mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-10-07 20:50:52 +00:00
Merge 2a34226727
into ea15f2a270
This commit is contained in:
commit
79ced0c85b
94 changed files with 341 additions and 209 deletions
|
@ -5,7 +5,7 @@
|
|||
# the root directory of this source tree.
|
||||
from typing import Any
|
||||
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, SecretStr
|
||||
|
||||
from llama_stack.core.datatypes import Api
|
||||
|
||||
|
@ -13,7 +13,7 @@ from .config import BraintrustScoringConfig
|
|||
|
||||
|
||||
class BraintrustProviderDataValidator(BaseModel):
|
||||
openai_api_key: str
|
||||
openai_api_key: SecretStr
|
||||
|
||||
|
||||
async def get_provider_impl(
|
||||
|
|
|
@ -17,7 +17,7 @@ from autoevals.ragas import (
|
|||
ContextRelevancy,
|
||||
Faithfulness,
|
||||
)
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, SecretStr
|
||||
|
||||
from llama_stack.apis.datasetio import DatasetIO
|
||||
from llama_stack.apis.datasets import Datasets
|
||||
|
@ -152,9 +152,9 @@ class BraintrustScoringImpl(
|
|||
raise ValueError(
|
||||
'Pass OpenAI API Key in the header X-LlamaStack-Provider-Data as { "openai_api_key": <your api key>}'
|
||||
)
|
||||
self.config.openai_api_key = provider_data.openai_api_key
|
||||
self.config.openai_api_key = SecretStr(provider_data.openai_api_key)
|
||||
|
||||
os.environ["OPENAI_API_KEY"] = self.config.openai_api_key
|
||||
os.environ["OPENAI_API_KEY"] = self.config.openai_api_key.get_secret_value()
|
||||
|
||||
async def score_batch(
|
||||
self,
|
||||
|
|
|
@ -5,12 +5,11 @@
|
|||
# the root directory of this source tree.
|
||||
from typing import Any
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
from pydantic import BaseModel, Field, SecretStr
|
||||
|
||||
|
||||
class BraintrustScoringConfig(BaseModel):
|
||||
openai_api_key: str | None = Field(
|
||||
default=None,
|
||||
openai_api_key: SecretStr = Field(
|
||||
description="The OpenAI API Key",
|
||||
)
|
||||
|
||||
|
|
|
@ -64,6 +64,7 @@ class ConsoleSpanProcessor(SpanProcessor):
|
|||
for key, value in event.attributes.items():
|
||||
if key.startswith("__") or key in ["message", "severity"]:
|
||||
continue
|
||||
|
||||
logger.info(f"[dim]{key}[/dim]: {value}")
|
||||
|
||||
def shutdown(self) -> None:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue