mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 19:24:27 +00:00
fix use s3 get_credentials to get boto3 creds
This commit is contained in:
parent
a37f087b62
commit
09535b25f4
1 changed files with 13 additions and 1 deletions
|
@ -8,7 +8,19 @@ from litellm._logging import verbose_proxy_logger
|
||||||
|
|
||||||
def get_file_contents_from_s3(bucket_name, object_key):
|
def get_file_contents_from_s3(bucket_name, object_key):
|
||||||
# v0 rely on boto3 for authentication - allowing boto3 to handle IAM credentials etc
|
# v0 rely on boto3 for authentication - allowing boto3 to handle IAM credentials etc
|
||||||
s3_client = boto3.client("s3")
|
from botocore.config import Config
|
||||||
|
from botocore.credentials import Credentials
|
||||||
|
|
||||||
|
from litellm.main import bedrock_converse_chat_completion
|
||||||
|
|
||||||
|
credentials: Credentials = bedrock_converse_chat_completion.get_credentials()
|
||||||
|
s3_client = boto3.client(
|
||||||
|
"s3",
|
||||||
|
aws_access_key_id=credentials.access_key,
|
||||||
|
aws_secret_access_key=credentials.secret_key,
|
||||||
|
aws_session_token=credentials.token, # Optional, if using temporary credentials
|
||||||
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
verbose_proxy_logger.debug(
|
verbose_proxy_logger.debug(
|
||||||
f"Retrieving {object_key} from S3 bucket: {bucket_name}"
|
f"Retrieving {object_key} from S3 bucket: {bucket_name}"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue