Fix bug in AWS Bedrock conversation summarization. It was using an out-of-date pattern (the _client property no longer exists)
This commit is contained in:
@@ -840,24 +840,27 @@ class AWSBedrockLLMService(LLMService):
|
|||||||
|
|
||||||
request_params["system"] = [{"text": summary_prompt}]
|
request_params["system"] = [{"text": summary_prompt}]
|
||||||
|
|
||||||
# Call Bedrock without streaming
|
async with self._aws_session.client(
|
||||||
response = self._client.converse(**request_params)
|
service_name="bedrock-runtime", **self._aws_params
|
||||||
|
) as client:
|
||||||
|
# Call Bedrock without streaming
|
||||||
|
response = await client.converse(**request_params)
|
||||||
|
|
||||||
# Extract the response text
|
# Extract the response text
|
||||||
if (
|
if (
|
||||||
"output" in response
|
"output" in response
|
||||||
and "message" in response["output"]
|
and "message" in response["output"]
|
||||||
and "content" in response["output"]["message"]
|
and "content" in response["output"]["message"]
|
||||||
):
|
):
|
||||||
content = response["output"]["message"]["content"]
|
content = response["output"]["message"]["content"]
|
||||||
if isinstance(content, list):
|
if isinstance(content, list):
|
||||||
for item in content:
|
for item in content:
|
||||||
if item.get("text"):
|
if item.get("text"):
|
||||||
return item["text"]
|
return item["text"]
|
||||||
elif isinstance(content, str):
|
elif isinstance(content, str):
|
||||||
return content
|
return content
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Bedrock summary generation failed: {e}", exc_info=True)
|
logger.error(f"Bedrock summary generation failed: {e}", exc_info=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user