mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-10-04 12:07:34 +00:00
revert: do not use MySecretStr
We don't need this if we can set it to empty string. Signed-off-by: Sébastien Han <seb@redhat.com>
This commit is contained in:
parent
bc64635835
commit
2a34226727
86 changed files with 208 additions and 263 deletions
|
@ -5,16 +5,15 @@
|
|||
# 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
|
||||
from llama_stack.core.secret_types import MySecretStr
|
||||
|
||||
from .config import BraintrustScoringConfig
|
||||
|
||||
|
||||
class BraintrustProviderDataValidator(BaseModel):
|
||||
openai_api_key: MySecretStr
|
||||
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
|
||||
|
@ -31,7 +31,6 @@ from llama_stack.apis.scoring import (
|
|||
from llama_stack.apis.scoring_functions import ScoringFn, ScoringFnParams
|
||||
from llama_stack.core.datatypes import Api
|
||||
from llama_stack.core.request_headers import NeedsRequestProviderData
|
||||
from llama_stack.core.secret_types import MySecretStr
|
||||
from llama_stack.providers.datatypes import ScoringFunctionsProtocolPrivate
|
||||
from llama_stack.providers.utils.common.data_schema_validator import (
|
||||
get_valid_schemas,
|
||||
|
@ -153,7 +152,7 @@ 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 = MySecretStr(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.get_secret_value()
|
||||
|
||||
|
|
|
@ -5,13 +5,11 @@
|
|||
# the root directory of this source tree.
|
||||
from typing import Any
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
from llama_stack.core.secret_types import MySecretStr
|
||||
from pydantic import BaseModel, Field, SecretStr
|
||||
|
||||
|
||||
class BraintrustScoringConfig(BaseModel):
|
||||
openai_api_key: MySecretStr = Field(
|
||||
openai_api_key: SecretStr = Field(
|
||||
description="The OpenAI API Key",
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue