mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-07-30 07:39:38 +00:00
remove env var reading
This commit is contained in:
parent
1d775b342c
commit
7d28dc380e
2 changed files with 13 additions and 30 deletions
|
@ -16,7 +16,6 @@ from llama_models.llama3.api.tokenizer import Tokenizer
|
|||
from llama_stack.providers.utils.inference.model_registry import ModelRegistryHelper
|
||||
|
||||
from llama_stack.apis.inference import * # noqa: F403
|
||||
import os
|
||||
|
||||
from llama_stack.providers.adapters.inference.bedrock.config import BedrockConfig
|
||||
|
||||
|
@ -445,10 +444,8 @@ def _create_bedrock_client(config: BedrockConfig) -> BaseClient:
|
|||
retries_config = {
|
||||
k: v
|
||||
for k, v in dict(
|
||||
total_max_attempts=os.environ.get(
|
||||
"AWS_MAX_ATTEMPTS", config.total_max_attempts
|
||||
),
|
||||
mode=os.environ.get("AWS_RETRY_MODE", config.retry_mode),
|
||||
total_max_attempts=config.total_max_attempts,
|
||||
mode=config.retry_mode,
|
||||
).items()
|
||||
if v is not None
|
||||
}
|
||||
|
@ -456,7 +453,7 @@ def _create_bedrock_client(config: BedrockConfig) -> BaseClient:
|
|||
config_args = {
|
||||
k: v
|
||||
for k, v in dict(
|
||||
region_name=os.environ.get("AWS_DEFAULT_REGION", config.region_name),
|
||||
region_name=config.region_name,
|
||||
retries=retries_config if retries_config else None,
|
||||
connect_timeout=config.connect_timeout,
|
||||
read_timeout=config.read_timeout,
|
||||
|
@ -467,17 +464,11 @@ def _create_bedrock_client(config: BedrockConfig) -> BaseClient:
|
|||
boto3_config = Config(**config_args)
|
||||
|
||||
session_args = {
|
||||
"aws_access_key_id": os.environ.get(
|
||||
"AWS_ACCESS_KEY_ID", config.aws_access_key_id
|
||||
),
|
||||
"aws_secret_access_key": os.environ.get(
|
||||
"AWS_SECRET_ACCESS_KEY", config.aws_secret_access_key
|
||||
),
|
||||
"aws_session_token": os.environ.get(
|
||||
"AWS_SESSION_TOKEN", config.aws_session_token
|
||||
),
|
||||
"region_name": os.environ.get("AWS_DEFAULT_REGION", config.region_name),
|
||||
"profile_name": os.environ.get("AWS_PROFILE", config.profile_name),
|
||||
"aws_access_key_id": config.aws_access_key_id,
|
||||
"aws_secret_access_key": config.aws_secret_access_key,
|
||||
"aws_session_token": config.aws_session_token,
|
||||
"region_name": config.region_name,
|
||||
"profile_name": config.profile_name,
|
||||
}
|
||||
|
||||
# Remove None values
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
|
||||
from typing import Any, Dict, List
|
||||
|
||||
|
@ -28,19 +27,12 @@ BEDROCK_SUPPORTED_SHIELDS = [
|
|||
|
||||
|
||||
def _create_bedrock_client(config: BedrockSafetyConfig, name: str):
|
||||
# Use environment variables by default, fall back to config values
|
||||
session_args = {
|
||||
"aws_access_key_id": os.environ.get(
|
||||
"AWS_ACCESS_KEY_ID", config.aws_access_key_id
|
||||
),
|
||||
"aws_secret_access_key": os.environ.get(
|
||||
"AWS_SECRET_ACCESS_KEY", config.aws_secret_access_key
|
||||
),
|
||||
"aws_session_token": os.environ.get(
|
||||
"AWS_SESSION_TOKEN", config.aws_session_token
|
||||
),
|
||||
"region_name": os.environ.get("AWS_DEFAULT_REGION", config.region_name),
|
||||
"profile_name": os.environ.get("AWS_PROFILE", config.profile_name),
|
||||
"aws_access_key_id": config.aws_access_key_id,
|
||||
"aws_secret_access_key": config.aws_secret_access_key,
|
||||
"aws_session_token": config.aws_session_token,
|
||||
"region_name": config.region_name,
|
||||
"profile_name": config.profile_name,
|
||||
}
|
||||
|
||||
# Remove None values
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue