feat(openai): Add gen_ai.response.id for Chat Completions and Responses API#1644
Open
jimilp7 wants to merge 1 commit intopydantic:mainfrom
Open
feat(openai): Add gen_ai.response.id for Chat Completions and Responses API#1644jimilp7 wants to merge 1 commit intopydantic:mainfrom
jimilp7 wants to merge 1 commit intopydantic:mainfrom
Conversation
…es API Description: Adds the `gen_ai.response.id` span attribute for OpenAI Chat Completions and Responses API, capturing the response ID (`chatcmpl-xxx` or `resp-xxx`). ## Changes 1. **Chat Completions**: Set `gen_ai.response.id` from `response.id` 2. **Responses API**: Set `gen_ai.response.id` from `response.id` 3. **Responses API**: Use full `request_data` (consistent with other endpoints) ## Why This Matters For Responses API multi-turn conversations using `previous_response_id`: - Turn 1 now exposes `gen_ai.response.id: "resp_xxx"` - Turn 2 now has `request_data.previous_response_id: "resp_xxx"` - Observability tools can link these spans together The `request_data` change also fixes an inconsistency where Responses API only captured `model` and `stream`, while all other endpoints capture the full request payload.
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.
Adds the
gen_ai.response.idspan attribute for OpenAI Chat Completions and Responses API, capturing the response ID (chatcmpl-xxxorresp-xxx).Changes
gen_ai.response.idfromresponse.idgen_ai.response.idfromresponse.idrequest_data(consistent with other endpoints)Why This Matters
For Responses API multi-turn conversations using
previous_response_id:gen_ai.response.id: "resp_xxx"request_data.previous_response_id: "resp_xxx"The
request_datachange also fixes an inconsistency where Responses API only capturedmodelandstream, while all other endpoints capture the full request payload.