openai: pass tool definitions to genai utils#4554
Open
Jwrede wants to merge 1 commit intoopen-telemetry:mainfrom
Open
openai: pass tool definitions to genai utils#4554Jwrede wants to merge 1 commit intoopen-telemetry:mainfrom
Jwrede wants to merge 1 commit intoopen-telemetry:mainfrom
Conversation
Extract tool definitions from the `tools` kwarg in chat completion requests and set them on InferenceInvocation.tool_definitions so they are serialized into gen_ai.tool.definitions span attributes and forwarded to the completion hook. Fixes open-telemetry#4511 Assisted-by: Claude Opus 4.6
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.
Description
Pass tool definitions from the OpenAI
toolskwarg through toInferenceInvocation.tool_definitionsso they are serialized intogen_ai.tool.definitionsspan/event attributes and forwarded to the completion hook.The utils layer already supports tool definitions (PR #4181), but the OpenAI v2 instrumentation was not extracting them from request kwargs.
Fixes #4511
Type of change
How Has This Been Tested?
gen_ai.tool.definitionsin existing sync and async tool call tests (both non-streaming and streaming variants)Does This PR Require a Core Repo Change?
Checklist: