mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-03 18:00:36 +00:00
Merge branch 'main' into elasticsearch-integration
This commit is contained in:
commit
7d026f29a3
14 changed files with 19 additions and 19 deletions
2
.github/CODEOWNERS
vendored
2
.github/CODEOWNERS
vendored
|
|
@ -2,4 +2,4 @@
|
||||||
|
|
||||||
# These owners will be the default owners for everything in
|
# These owners will be the default owners for everything in
|
||||||
# the repo. Unless a later match takes precedence,
|
# the repo. Unless a later match takes precedence,
|
||||||
* @ashwinb @raghotham @ehhuang @leseb @bbrowning @mattf @franciscojavierarceo
|
* @ashwinb @raghotham @ehhuang @leseb @bbrowning @mattf @franciscojavierarceo @cdoern
|
||||||
|
|
|
||||||
2
.github/workflows/integration-tests.yml
vendored
2
.github/workflows/integration-tests.yml
vendored
|
|
@ -95,7 +95,7 @@ jobs:
|
||||||
|
|
||||||
- name: Setup Node.js for TypeScript client tests
|
- name: Setup Node.js for TypeScript client tests
|
||||||
if: ${{ matrix.client == 'server' }}
|
if: ${{ matrix.client == 'server' }}
|
||||||
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
|
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
|
||||||
with:
|
with:
|
||||||
node-version: '20'
|
node-version: '20'
|
||||||
cache: 'npm'
|
cache: 'npm'
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,6 @@ AWS Bedrock inference provider using OpenAI compatible endpoint.
|
||||||
## Sample Configuration
|
## Sample Configuration
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
api_key: ${env.AWS_BEDROCK_API_KEY:=}
|
api_key: ${env.AWS_BEARER_TOKEN_BEDROCK:=}
|
||||||
region_name: ${env.AWS_DEFAULT_REGION:=us-east-2}
|
region_name: ${env.AWS_DEFAULT_REGION:=us-east-2}
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ providers:
|
||||||
- provider_id: bedrock
|
- provider_id: bedrock
|
||||||
provider_type: remote::bedrock
|
provider_type: remote::bedrock
|
||||||
config:
|
config:
|
||||||
api_key: ${env.AWS_BEDROCK_API_KEY:=}
|
api_key: ${env.AWS_BEARER_TOKEN_BEDROCK:=}
|
||||||
region_name: ${env.AWS_DEFAULT_REGION:=us-east-2}
|
region_name: ${env.AWS_DEFAULT_REGION:=us-east-2}
|
||||||
- provider_id: ${env.NVIDIA_API_KEY:+nvidia}
|
- provider_id: ${env.NVIDIA_API_KEY:+nvidia}
|
||||||
provider_type: remote::nvidia
|
provider_type: remote::nvidia
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ providers:
|
||||||
- provider_id: bedrock
|
- provider_id: bedrock
|
||||||
provider_type: remote::bedrock
|
provider_type: remote::bedrock
|
||||||
config:
|
config:
|
||||||
api_key: ${env.AWS_BEDROCK_API_KEY:=}
|
api_key: ${env.AWS_BEARER_TOKEN_BEDROCK:=}
|
||||||
region_name: ${env.AWS_DEFAULT_REGION:=us-east-2}
|
region_name: ${env.AWS_DEFAULT_REGION:=us-east-2}
|
||||||
- provider_id: ${env.NVIDIA_API_KEY:+nvidia}
|
- provider_id: ${env.NVIDIA_API_KEY:+nvidia}
|
||||||
provider_type: remote::nvidia
|
provider_type: remote::nvidia
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ providers:
|
||||||
- provider_id: bedrock
|
- provider_id: bedrock
|
||||||
provider_type: remote::bedrock
|
provider_type: remote::bedrock
|
||||||
config:
|
config:
|
||||||
api_key: ${env.AWS_BEDROCK_API_KEY:=}
|
api_key: ${env.AWS_BEARER_TOKEN_BEDROCK:=}
|
||||||
region_name: ${env.AWS_DEFAULT_REGION:=us-east-2}
|
region_name: ${env.AWS_DEFAULT_REGION:=us-east-2}
|
||||||
- provider_id: ${env.NVIDIA_API_KEY:+nvidia}
|
- provider_id: ${env.NVIDIA_API_KEY:+nvidia}
|
||||||
provider_type: remote::nvidia
|
provider_type: remote::nvidia
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ providers:
|
||||||
- provider_id: bedrock
|
- provider_id: bedrock
|
||||||
provider_type: remote::bedrock
|
provider_type: remote::bedrock
|
||||||
config:
|
config:
|
||||||
api_key: ${env.AWS_BEDROCK_API_KEY:=}
|
api_key: ${env.AWS_BEARER_TOKEN_BEDROCK:=}
|
||||||
region_name: ${env.AWS_DEFAULT_REGION:=us-east-2}
|
region_name: ${env.AWS_DEFAULT_REGION:=us-east-2}
|
||||||
- provider_id: ${env.NVIDIA_API_KEY:+nvidia}
|
- provider_id: ${env.NVIDIA_API_KEY:+nvidia}
|
||||||
provider_type: remote::nvidia
|
provider_type: remote::nvidia
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ providers:
|
||||||
- provider_id: bedrock
|
- provider_id: bedrock
|
||||||
provider_type: remote::bedrock
|
provider_type: remote::bedrock
|
||||||
config:
|
config:
|
||||||
api_key: ${env.AWS_BEDROCK_API_KEY:=}
|
api_key: ${env.AWS_BEARER_TOKEN_BEDROCK:=}
|
||||||
region_name: ${env.AWS_DEFAULT_REGION:=us-east-2}
|
region_name: ${env.AWS_DEFAULT_REGION:=us-east-2}
|
||||||
- provider_id: ${env.NVIDIA_API_KEY:+nvidia}
|
- provider_id: ${env.NVIDIA_API_KEY:+nvidia}
|
||||||
provider_type: remote::nvidia
|
provider_type: remote::nvidia
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ providers:
|
||||||
- provider_id: bedrock
|
- provider_id: bedrock
|
||||||
provider_type: remote::bedrock
|
provider_type: remote::bedrock
|
||||||
config:
|
config:
|
||||||
api_key: ${env.AWS_BEDROCK_API_KEY:=}
|
api_key: ${env.AWS_BEARER_TOKEN_BEDROCK:=}
|
||||||
region_name: ${env.AWS_DEFAULT_REGION:=us-east-2}
|
region_name: ${env.AWS_DEFAULT_REGION:=us-east-2}
|
||||||
- provider_id: ${env.NVIDIA_API_KEY:+nvidia}
|
- provider_id: ${env.NVIDIA_API_KEY:+nvidia}
|
||||||
provider_type: remote::nvidia
|
provider_type: remote::nvidia
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ class BedrockInferenceAdapter(OpenAIMixin):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
config: BedrockConfig
|
config: BedrockConfig
|
||||||
provider_data_api_key_field: str = "aws_bedrock_api_key"
|
provider_data_api_key_field: str = "aws_bearer_token_bedrock"
|
||||||
|
|
||||||
def get_base_url(self) -> str:
|
def get_base_url(self) -> str:
|
||||||
"""Get base URL for OpenAI client."""
|
"""Get base URL for OpenAI client."""
|
||||||
|
|
@ -111,7 +111,7 @@ class BedrockInferenceAdapter(OpenAIMixin):
|
||||||
logger.error(f"AWS Bedrock authentication token expired: {error_msg}")
|
logger.error(f"AWS Bedrock authentication token expired: {error_msg}")
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"AWS Bedrock authentication failed: Bearer token has expired. "
|
"AWS Bedrock authentication failed: Bearer token has expired. "
|
||||||
"The AWS_BEDROCK_API_KEY environment variable contains an expired pre-signed URL. "
|
"The AWS_BEARER_TOKEN_BEDROCK environment variable contains an expired pre-signed URL. "
|
||||||
"Please refresh your token by generating a new pre-signed URL with AWS credentials. "
|
"Please refresh your token by generating a new pre-signed URL with AWS credentials. "
|
||||||
"Refer to AWS Bedrock documentation for details on OpenAI-compatible endpoints."
|
"Refer to AWS Bedrock documentation for details on OpenAI-compatible endpoints."
|
||||||
) from e
|
) from e
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,9 @@ from llama_stack.providers.utils.inference.model_registry import RemoteInference
|
||||||
|
|
||||||
|
|
||||||
class BedrockProviderDataValidator(BaseModel):
|
class BedrockProviderDataValidator(BaseModel):
|
||||||
aws_bedrock_api_key: str | None = Field(
|
aws_bearer_token_bedrock: str | None = Field(
|
||||||
default=None,
|
default=None,
|
||||||
description="API key for Amazon Bedrock",
|
description="API Key (Bearer token) for Amazon Bedrock",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -27,6 +27,6 @@ class BedrockConfig(RemoteInferenceProviderConfig):
|
||||||
@classmethod
|
@classmethod
|
||||||
def sample_run_config(cls, **kwargs):
|
def sample_run_config(cls, **kwargs):
|
||||||
return {
|
return {
|
||||||
"api_key": "${env.AWS_BEDROCK_API_KEY:=}",
|
"api_key": "${env.AWS_BEARER_TOKEN_BEDROCK:=}",
|
||||||
"region_name": "${env.AWS_DEFAULT_REGION:=us-east-2}",
|
"region_name": "${env.AWS_DEFAULT_REGION:=us-east-2}",
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,4 +51,4 @@ class VertexAIInferenceAdapter(OpenAIMixin):
|
||||||
|
|
||||||
:return: An iterable of model IDs
|
:return: An iterable of model IDs
|
||||||
"""
|
"""
|
||||||
return ["vertexai/gemini-2.0-flash", "vertexai/gemini-2.5-flash", "vertexai/gemini-2.5-pro"]
|
return ["google/gemini-2.0-flash", "google/gemini-2.5-flash", "google/gemini-2.5-pro"]
|
||||||
|
|
|
||||||
|
|
@ -40,8 +40,8 @@ def test_api_key_from_header_overrides_config():
|
||||||
"""Test API key from request header overrides config via client property"""
|
"""Test API key from request header overrides config via client property"""
|
||||||
config = BedrockConfig(api_key="config-key", region_name="us-east-1")
|
config = BedrockConfig(api_key="config-key", region_name="us-east-1")
|
||||||
adapter = BedrockInferenceAdapter(config=config)
|
adapter = BedrockInferenceAdapter(config=config)
|
||||||
adapter.provider_data_api_key_field = "aws_bedrock_api_key"
|
adapter.provider_data_api_key_field = "aws_bearer_token_bedrock"
|
||||||
adapter.get_request_provider_data = MagicMock(return_value=SimpleNamespace(aws_bedrock_api_key="header-key"))
|
adapter.get_request_provider_data = MagicMock(return_value=SimpleNamespace(aws_bearer_token_bedrock="header-key"))
|
||||||
|
|
||||||
# The client property is where header override happens (in OpenAIMixin)
|
# The client property is where header override happens (in OpenAIMixin)
|
||||||
assert adapter.client.api_key == "header-key"
|
assert adapter.client.api_key == "header-key"
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ from llama_stack.providers.remote.inference.bedrock.config import BedrockConfig
|
||||||
|
|
||||||
def test_bedrock_config_defaults_no_env(monkeypatch):
|
def test_bedrock_config_defaults_no_env(monkeypatch):
|
||||||
"""Test BedrockConfig defaults when env vars are not set"""
|
"""Test BedrockConfig defaults when env vars are not set"""
|
||||||
monkeypatch.delenv("AWS_BEDROCK_API_KEY", raising=False)
|
monkeypatch.delenv("AWS_BEARER_TOKEN_BEDROCK", raising=False)
|
||||||
monkeypatch.delenv("AWS_DEFAULT_REGION", raising=False)
|
monkeypatch.delenv("AWS_DEFAULT_REGION", raising=False)
|
||||||
config = BedrockConfig()
|
config = BedrockConfig()
|
||||||
assert config.auth_credential is None
|
assert config.auth_credential is None
|
||||||
|
|
@ -35,5 +35,5 @@ def test_bedrock_config_sample():
|
||||||
sample = BedrockConfig.sample_run_config()
|
sample = BedrockConfig.sample_run_config()
|
||||||
assert "api_key" in sample
|
assert "api_key" in sample
|
||||||
assert "region_name" in sample
|
assert "region_name" in sample
|
||||||
assert sample["api_key"] == "${env.AWS_BEDROCK_API_KEY:=}"
|
assert sample["api_key"] == "${env.AWS_BEARER_TOKEN_BEDROCK:=}"
|
||||||
assert sample["region_name"] == "${env.AWS_DEFAULT_REGION:=us-east-2}"
|
assert sample["region_name"] == "${env.AWS_DEFAULT_REGION:=us-east-2}"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue