mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 18:54:30 +00:00
add in ability to read AWS boto3 default AWS Region name if litellm .env config AWS_REGION_NAME not available
This commit is contained in:
parent
7304c75f9c
commit
1add0d604e
1 changed files with 6 additions and 2 deletions
|
@ -1,4 +1,5 @@
|
|||
import json, copy, types
|
||||
import os
|
||||
from enum import Enum
|
||||
import time
|
||||
from typing import Callable, Optional
|
||||
|
@ -190,11 +191,14 @@ def init_bedrock_client(
|
|||
)
|
||||
else:
|
||||
# aws_access_key_id is None, assume user is trying to auth using env variables
|
||||
# boto3 automaticaly reads env variables
|
||||
# boto3 automatically reads env variables
|
||||
|
||||
# we need to read region name from env
|
||||
# I assume majority of users use .env for auth
|
||||
# I assume majority of users use .env for auth
|
||||
region_name = get_secret("AWS_REGION_NAME") # reads env for AWS_REGION_NAME, defaults to None
|
||||
# if litellm config `AWS_REGION_NAME` is not set, attempt to read AWS default env variable name `AWS_REGION`
|
||||
if not region_name:
|
||||
region_name = get_secret("AWS_REGION")
|
||||
client = boto3.client(
|
||||
service_name="bedrock-runtime",
|
||||
region_name=region_name,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue