Repository navigation
Store OpenAI Responses streaming response in events format understood by UI - #1479
Merged
Merged
Conversation
Deploying logfire-docs with
|
| Latest commit: |
0ed904b
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://baa61c30.logfire-docs.pages.dev |
| Branch Preview URL: | https://alex-openai-streaming-respon.logfire-docs.pages.dev |
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR standardizes the OpenAI Responses API streaming response format to use an events structure that is understood by the UI, moving away from storing raw response data to a more consistent event-based format.
- Replaces raw
response_datawith structuredeventsfor OpenAI streaming responses - Adds a new
get_attributesmethod toStreamStatefor customizing logged attributes - Updates test expectations to reflect the new event-based format
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| logfire/_internal/integrations/llm_providers/types.py | Adds get_attributes method to StreamState base class |
| logfire/_internal/integrations/llm_providers/openai.py | Implements event-based response format and custom attribute handling |
| logfire/_internal/integrations/llm_providers/llm_provider.py | Updates streaming response logging to use new attribute method |
| tests/otel_integrations/test_openai.py | Updates test expectations for new event-based format |
| tests/otel_integrations/test_anthropic.py | Reorders JSON schema properties (likely due to dictionary ordering changes) |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.