mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-06-28 02:53:30 +00:00
update template run.yaml to include openai api key for braintrust (#590)
# What does this PR do? **Why** - braintrust provider needs OpenAI API Key set in config for DirectClient to work ## Test Plan ``` python llama_stack/scripts/distro_codegen.py ``` <img width="340" alt="image" src="https://github.com/user-attachments/assets/eae38296-f880-40f0-9a9e-46a12038db64"> - set API key in client via provider_data <img width="907" alt="image" src="https://github.com/user-attachments/assets/3d74cd7c-dc7e-4a42-8a40-c22f19b0c534"> ## Before submitting - [ ] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case). - [ ] Ran pre-commit to handle lint / formatting issues. - [ ] Read the [contributor guideline](https://github.com/meta-llama/llama-stack/blob/main/CONTRIBUTING.md), Pull Request section? - [ ] Updated relevant documentation. - [ ] Wrote necessary unit or integration tests.
This commit is contained in:
parent
c699e884b5
commit
cd40a5fdbf
17 changed files with 37 additions and 16 deletions
|
@ -86,7 +86,7 @@ class BraintrustScoringImpl(
|
|||
|
||||
async def set_api_key(self) -> None:
|
||||
# api key is in the request headers
|
||||
if self.config.openai_api_key is None:
|
||||
if self.config.openai_api_key is None or not self.config.openai_api_key:
|
||||
provider_data = self.get_request_provider_data()
|
||||
if provider_data is None or not provider_data.openai_api_key:
|
||||
raise ValueError(
|
||||
|
|
|
@ -11,3 +11,9 @@ class BraintrustScoringConfig(BaseModel):
|
|||
default=None,
|
||||
description="The OpenAI API Key",
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def sample_run_config(cls, **kwargs) -> Dict[str, Any]:
|
||||
return {
|
||||
"openai_api_key": "${env.OPENAI_API_KEY:}",
|
||||
}
|
||||
|
|
|
@ -63,7 +63,8 @@ providers:
|
|||
config: {}
|
||||
- provider_id: braintrust
|
||||
provider_type: inline::braintrust
|
||||
config: {}
|
||||
config:
|
||||
openai_api_key: ${env.OPENAI_API_KEY:}
|
||||
metadata_store:
|
||||
namespace: null
|
||||
type: sqlite
|
||||
|
|
|
@ -65,7 +65,8 @@ providers:
|
|||
config: {}
|
||||
- provider_id: braintrust
|
||||
provider_type: inline::braintrust
|
||||
config: {}
|
||||
config:
|
||||
openai_api_key: ${env.OPENAI_API_KEY:}
|
||||
metadata_store:
|
||||
namespace: null
|
||||
type: sqlite
|
||||
|
|
|
@ -70,7 +70,8 @@ providers:
|
|||
config: {}
|
||||
- provider_id: braintrust
|
||||
provider_type: inline::braintrust
|
||||
config: {}
|
||||
config:
|
||||
openai_api_key: ${env.OPENAI_API_KEY:}
|
||||
metadata_store:
|
||||
namespace: null
|
||||
type: sqlite
|
||||
|
|
|
@ -65,7 +65,8 @@ providers:
|
|||
config: {}
|
||||
- provider_id: braintrust
|
||||
provider_type: inline::braintrust
|
||||
config: {}
|
||||
config:
|
||||
openai_api_key: ${env.OPENAI_API_KEY:}
|
||||
metadata_store:
|
||||
namespace: null
|
||||
type: sqlite
|
||||
|
|
|
@ -70,7 +70,8 @@ providers:
|
|||
config: {}
|
||||
- provider_id: braintrust
|
||||
provider_type: inline::braintrust
|
||||
config: {}
|
||||
config:
|
||||
openai_api_key: ${env.OPENAI_API_KEY:}
|
||||
metadata_store:
|
||||
namespace: null
|
||||
type: sqlite
|
||||
|
|
|
@ -65,7 +65,8 @@ providers:
|
|||
config: {}
|
||||
- provider_id: braintrust
|
||||
provider_type: inline::braintrust
|
||||
config: {}
|
||||
config:
|
||||
openai_api_key: ${env.OPENAI_API_KEY:}
|
||||
metadata_store:
|
||||
namespace: null
|
||||
type: sqlite
|
||||
|
|
|
@ -72,7 +72,8 @@ providers:
|
|||
config: {}
|
||||
- provider_id: braintrust
|
||||
provider_type: inline::braintrust
|
||||
config: {}
|
||||
config:
|
||||
openai_api_key: ${env.OPENAI_API_KEY:}
|
||||
metadata_store:
|
||||
namespace: null
|
||||
type: sqlite
|
||||
|
|
|
@ -66,7 +66,8 @@ providers:
|
|||
config: {}
|
||||
- provider_id: braintrust
|
||||
provider_type: inline::braintrust
|
||||
config: {}
|
||||
config:
|
||||
openai_api_key: ${env.OPENAI_API_KEY:}
|
||||
metadata_store:
|
||||
namespace: null
|
||||
type: sqlite
|
||||
|
|
|
@ -68,7 +68,8 @@ providers:
|
|||
config: {}
|
||||
- provider_id: braintrust
|
||||
provider_type: inline::braintrust
|
||||
config: {}
|
||||
config:
|
||||
openai_api_key: ${env.OPENAI_API_KEY:}
|
||||
metadata_store:
|
||||
namespace: null
|
||||
type: sqlite
|
||||
|
|
|
@ -64,7 +64,8 @@ providers:
|
|||
config: {}
|
||||
- provider_id: braintrust
|
||||
provider_type: inline::braintrust
|
||||
config: {}
|
||||
config:
|
||||
openai_api_key: ${env.OPENAI_API_KEY:}
|
||||
metadata_store:
|
||||
namespace: null
|
||||
type: sqlite
|
||||
|
|
|
@ -64,7 +64,8 @@ providers:
|
|||
config: {}
|
||||
- provider_id: braintrust
|
||||
provider_type: inline::braintrust
|
||||
config: {}
|
||||
config:
|
||||
openai_api_key: ${env.OPENAI_API_KEY:}
|
||||
metadata_store:
|
||||
namespace: null
|
||||
type: sqlite
|
||||
|
|
|
@ -68,7 +68,8 @@ providers:
|
|||
config: {}
|
||||
- provider_id: braintrust
|
||||
provider_type: inline::braintrust
|
||||
config: {}
|
||||
config:
|
||||
openai_api_key: ${env.OPENAI_API_KEY:}
|
||||
metadata_store:
|
||||
namespace: null
|
||||
type: sqlite
|
||||
|
|
|
@ -64,7 +64,8 @@ providers:
|
|||
config: {}
|
||||
- provider_id: braintrust
|
||||
provider_type: inline::braintrust
|
||||
config: {}
|
||||
config:
|
||||
openai_api_key: ${env.OPENAI_API_KEY:}
|
||||
metadata_store:
|
||||
namespace: null
|
||||
type: sqlite
|
||||
|
|
|
@ -65,7 +65,8 @@ providers:
|
|||
config: {}
|
||||
- provider_id: braintrust
|
||||
provider_type: inline::braintrust
|
||||
config: {}
|
||||
config:
|
||||
openai_api_key: ${env.OPENAI_API_KEY:}
|
||||
metadata_store:
|
||||
namespace: null
|
||||
type: sqlite
|
||||
|
|
|
@ -68,7 +68,8 @@ providers:
|
|||
config: {}
|
||||
- provider_id: braintrust
|
||||
provider_type: inline::braintrust
|
||||
config: {}
|
||||
config:
|
||||
openai_api_key: ${env.OPENAI_API_KEY:}
|
||||
metadata_store:
|
||||
namespace: null
|
||||
type: sqlite
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue