Skip to content

Commit 3f1c3c9

Browse files
committed
Better approach
1 parent 902320e commit 3f1c3c9

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/app/endpoints/streaming_query.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ async def response_generator( # pylint: disable=too-many-branches,too-many-stat
698698
# Completed response - capture final text and response object
699699
elif event_type == "response.completed":
700700
latest_response_object = cast(
701-
OpenAIResponseObject, chunk.response
701+
OpenAIResponseObject, getattr(chunk, "response") # noqa: B009
702702
)
703703
turn_summary.llm_response = turn_summary.llm_response or "".join(text_parts)
704704
yield stream_event(
@@ -714,7 +714,7 @@ async def response_generator( # pylint: disable=too-many-branches,too-many-stat
714714
# Incomplete or failed response - emit error
715715
elif event_type in ("response.incomplete", "response.failed"):
716716
latest_response_object = cast(
717-
OpenAIResponseObject, chunk.response
717+
OpenAIResponseObject, getattr(chunk, "response") # noqa: B009
718718
)
719719
error_message = (
720720
latest_response_object.error.message

0 commit comments

Comments
 (0)