From c4e7dc742cb9887b128aab75da952a4325057838 Mon Sep 17 00:00:00 2001 From: Vladimir Blagojevic Date: Tue, 11 Feb 2025 10:17:48 +0100 Subject: [PATCH] isort --- haystack/components/generators/chat/openai.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/haystack/components/generators/chat/openai.py b/haystack/components/generators/chat/openai.py index db430d2e06..23bf46729d 100644 --- a/haystack/components/generators/chat/openai.py +++ b/haystack/components/generators/chat/openai.py @@ -337,7 +337,9 @@ def _check_finish_reason(self, meta: Dict[str, Any]) -> None: finish_reason=meta["finish_reason"], ) - def _convert_streaming_chunks_to_chat_message(self, chunk: Any, chunks: List[StreamingChunk]) -> ChatMessage: + def _convert_streaming_chunks_to_chat_message( + self, chunk: ChatCompletionChunk, chunks: List[StreamingChunk] + ) -> ChatMessage: """ Connects the streaming chunks into a single ChatMessage. @@ -348,7 +350,7 @@ def _convert_streaming_chunks_to_chat_message(self, chunk: Any, chunks: List[Str tool_calls = [] # Process tool calls if present in any chunk - tool_call_data = {} # Track tool calls by ID + tool_call_data: Dict[str, Dict[str, str]] = {} # Track tool calls by ID for chunk_payload in chunks: tool_calls_meta = chunk_payload.meta.get("tool_calls") if tool_calls_meta: