Reputation: 171
Is there a way to call Bedrock claude3 model with Python SDK asynchronously?
More specifically, I want the results to be sent to S3.
Upvotes: 2
Views: 1862
Reputation: 1099
from anthropic import AsyncAnthropicBedrock
model_id = "my_model_id"
user_message = "Hello Claude!"
client = AsyncAnthropicBedrock()
message = await client.messages.create(
model=model_id,
max_tokens=1024,
messages=[
{"role": "user", "content": user_message}
]
)
For the S3 part you'll need to use boto3 to upload the files manually. This solution is just doing the async part. But hopefully it is already helpful. (Uploading to S3 should be relatively easy.)
Upvotes: 0