Skip to content

feat(core): Add missing openai tool calls attributes #17226

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

RulaKhaled
Copy link
Member

@RulaKhaled RulaKhaled commented Jul 30, 2025

This PR adds missing tool call attributes, we addgen_ai.response.tool_calls attribute for OpenAI Chat Completion and Responses API, supporting both streaming and non-streaming requests.

Core changes:

  1. Request Side - Capture available tools:

    • Extract tools + web_search_options from request params
    • Set gen_ai.request.available_tools attribute
  2. Response Side - Capture actual tool calls:

    • Chat Completion: Extract from response.choices[].message.tool_calls
    • Responses API: Extract from response.output[] (filter type === 'function_call')
    • Set gen_ai.response.tool_calls attribute for both
  3. Streaming Support (in streaming.ts):

    • Accumulation of tool calls during streaming
    • Respects recordOutputs privacy setting

Copy link

linear bot commented Jul 30, 2025

Copy link
Contributor

github-actions bot commented Jul 30, 2025

size-limit report 📦

Path Size % Change Change
@sentry/browser 23.77 kB - -
@sentry/browser - with treeshaking flags 22.35 kB - -
@sentry/browser (incl. Tracing) 39.41 kB - -
@sentry/browser (incl. Tracing, Replay) 77.53 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 67.4 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 82.24 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 94.37 kB - -
@sentry/browser (incl. Feedback) 40.45 kB - -
@sentry/browser (incl. sendFeedback) 28.45 kB - -
@sentry/browser (incl. FeedbackAsync) 33.34 kB - -
@sentry/react 25.5 kB - -
@sentry/react (incl. Tracing) 41.38 kB - -
@sentry/vue 28.2 kB - -
@sentry/vue (incl. Tracing) 41.22 kB - -
@sentry/svelte 23.79 kB - -
CDN Bundle 25.28 kB - -
CDN Bundle (incl. Tracing) 39.29 kB - -
CDN Bundle (incl. Tracing, Replay) 75.41 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 80.84 kB - -
CDN Bundle - uncompressed 73.86 kB - -
CDN Bundle (incl. Tracing) - uncompressed 116.3 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 230.61 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 243.42 kB - -
@sentry/nextjs (client) 43.44 kB - -
@sentry/sveltekit (client) 39.84 kB - -
@sentry/node-core 47.53 kB - -
@sentry/node 146.19 kB +0.24% +338 B 🔺
@sentry/node - without tracing 91.63 kB -0.01% -1 B 🔽
@sentry/aws-serverless 103.08 kB +0.01% +1 B 🔺

View base workflow run

@RulaKhaled RulaKhaled marked this pull request as ready for review July 30, 2025 12:48
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@RulaKhaled RulaKhaled requested a review from AbhiPrasad July 31, 2025 11:42
@RulaKhaled RulaKhaled merged commit 254a86f into develop Jul 31, 2025
355 of 357 checks passed
@RulaKhaled RulaKhaled deleted the rolaabuhasna/js-789-add-missing-span-attributes-for-openai-instrumentation-eg branch July 31, 2025 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants