Skip to content

Commit 5c840ed

Browse files
committed
Fix formatting
1 parent ab25220 commit 5c840ed

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

haystack/components/generators/chat/openai_responses.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -708,14 +708,13 @@ def _convert_streaming_chunks_to_chat_message(chunks: list[StreamingChunk]) -> C
708708
reasoning_id = None
709709
reasoning_text = ""
710710
for chunk in chunks:
711-
logprobs_value = chunk.meta.get("logprobs")
711+
if chunk.reasoning:
712+
reasoning_text += chunk.reasoning.reasoning_text
713+
if chunk.reasoning.extra.get("id"):
714+
reasoning_id = chunk.reasoning.extra.get("id")
715+
logprobs_value = chunk.meta.get("logprobs")
712716
if logprobs_value is not None:
713717
logprobs.append(logprobs_value)
714-
if chunk.reasoning:
715-
reasoning_text += chunk.reasoning.reasoning_text
716-
if chunk.reasoning.extra.get("id"):
717-
reasoning_id = chunk.reasoning.extra.get("id")
718-
719718

720719
# Process tool calls if present in any chunk
721720
tool_call_data: dict[str, dict[str, Any]] = {} # Track tool calls by id
@@ -762,7 +761,7 @@ def _convert_streaming_chunks_to_chat_message(chunks: list[StreamingChunk]) -> C
762761
final_response = chunks[-1].meta.get("response")
763762

764763
if logprobs:
765-
final_response["logprobs"] = logprobs
764+
final_response["logprobs"] = logprobs
766765

767766
# Add reasoning content if both id and text are available
768767
reasoning = None

0 commit comments

Comments
 (0)