Skip to content

Commit ac8e2a8

Browse files
ref(openai-agents): Clarify that chunk model capture only applies to Chat Completions paths
1 parent 7df5428 commit ac8e2a8

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

  • sentry_sdk/integrations/openai_agents/patches

‎sentry_sdk/integrations/openai_agents/patches/models.py‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,13 @@ class _ResponseModelRecordingStream:
6161
Proxies a provider chunk stream returned by `_fetch_response(stream=True)` and records
6262
the model reported on each chunk.
6363
64-
Streamed Chat Completions responses (also used by the LiteLLM model) are synthesized by
65-
the Agents SDK with `model` set to the requested model name, e.g. an Azure deployment
66-
name. Only the provider chunks carry the model that actually responded.
64+
The default `OpenAIResponsesModel` is not affected: its terminal streaming event carries
65+
the model that responded. This only applies to the opt-in Chat Completions code paths,
66+
i.e. an explicit `OpenAIChatCompletionsModel` (commonly used with Azure OpenAI and
67+
OpenAI-compatible providers), `set_default_openai_api("chat_completions")`, and
68+
`LitellmModel`. For those, the Agents SDK synthesizes the streamed response with `model`
69+
set to the requested model name, e.g. an Azure deployment name, so only the provider
70+
chunks carry the model that actually responded.
6771
"""
6872

6973
def __init__(self, stream: "Any", record: "Callable[[str], None]") -> None:

0 commit comments

Comments
 (0)