llm/bedrock.py aktualisiert

This commit is contained in:
2026-07-05 09:35:47 +00:00
parent 6d2f3aecc6
commit badc4acd28
+25
View File
@@ -0,0 +1,25 @@
import boto3
from config import AWS_REGION, BEDROCK_MODEL
class BedrockClient:
def __init__(self):
self.client = boto3.client(
"bedrock-runtime",
region_name=AWS_REGION
)
async def chat(self, messages, tools=None):
request = {
"modelId": BEDROCK_MODEL,
"messages": messages,
}
if tools:
request["toolConfig"] = {
"tools": tools
}
return self.client.converse(**request)