mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 10:44:24 +00:00
(docs) bedrock pass existing client to completion
This commit is contained in:
parent
5f55b4a1ab
commit
f735ca7e46
2 changed files with 23 additions and 2 deletions
|
@ -49,6 +49,27 @@ response = completion(
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Passing a BedrockClient as a parameter - Completion()
|
||||||
|
Pass an existing BedrockClient object to litellm.completion. Useful when using AWS SSO sessions or assumed role sessions.
|
||||||
|
```python
|
||||||
|
import boto3
|
||||||
|
from litellm import completion
|
||||||
|
|
||||||
|
bedrock = boto3.client(
|
||||||
|
service_name="bedrock-runtime",
|
||||||
|
region_name="us-east-1",
|
||||||
|
aws_access_key_id="",
|
||||||
|
aws_secret_access_key_id="",
|
||||||
|
aws_session_token="",
|
||||||
|
)
|
||||||
|
|
||||||
|
response = completion(
|
||||||
|
model="bedrock/anthropic.claude-instant-v1",
|
||||||
|
messages=[{ "content": "Hello, how are you?","role": "user"}],
|
||||||
|
aws_bedrock_client=bedrock
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
## Supported AWS Bedrock Models
|
## Supported AWS Bedrock Models
|
||||||
Here's an example of using a bedrock model with LiteLLM
|
Here's an example of using a bedrock model with LiteLLM
|
||||||
|
|
||||||
|
|
|
@ -276,8 +276,8 @@ def completion(
|
||||||
init_bedrock_client(
|
init_bedrock_client(
|
||||||
aws_access_key_id=aws_access_key_id,
|
aws_access_key_id=aws_access_key_id,
|
||||||
aws_secret_access_key=aws_secret_access_key,
|
aws_secret_access_key=aws_secret_access_key,
|
||||||
aws_region_name=aws_region_name
|
aws_region_name=aws_region_name,
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
model = model
|
model = model
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue