Skip to content

Commit 0dab60e

Browse files
committed
simplify
1 parent 1f9f67a commit 0dab60e

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

  • integrations/amazon_bedrock/src/haystack_integrations/components/generators/amazon_bedrock/chat

integrations/amazon_bedrock/src/haystack_integrations/components/generators/amazon_bedrock/chat/utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,8 @@ def _convert_chunks_to_messages(chunks: list[StreamingChunk]) -> list[ChatMessag
678678

679679
# the trace are ignored in _convert_streaming_chunks_to_chat_message
680680
# so we need to process them separately
681-
if chunks and (last_chunk := chunks[-1]) and last_chunk.meta and "trace" in last_chunk.meta:
681+
last_chunk = chunks[-1] if chunks else None
682+
if last_chunk and last_chunk.meta and "trace" in last_chunk.meta:
682683
reply.meta["trace"] = last_chunk.meta["trace"]
683684

684685
return [reply]

0 commit comments

Comments
 (0)