Skip to content

Conversation

@jonjomckay
Copy link

This PR attempts to fix the issue described at the bottom of #652 - the choices are missing from spans for Chat Completions, for Generation spans.

I'm unsure if this is the best way to do this, so I'm opening this to get a discussion going!

@changeset-bot
Copy link

changeset-bot bot commented Dec 3, 2025

⚠️ No Changeset found

Latest commit: 3bd36d9

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@seratch seratch added bug Something isn't working package:agents-core labels Dec 4, 2025
Copy link
Member

@seratch seratch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for sending this patch!

I have a few points on the suggested changes:

  • my comment on the conversion logic maintenance cost
  • add unit tests covering the scenario

) {
response.choices = event.response.output
.flatMap((o): OpenAI.Chat.Completions.ChatCompletion.Choice[] => {
if (o.type === 'function_call') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic here requires updates when the platform adds new types. We'd like to explore more robust way to handle the conversion here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I was worried about that too. Do you have any suggestions? This is the first time I've actually looked into this API!

@seratch seratch marked this pull request as draft December 4, 2025 00:31
@seratch seratch changed the title fix: Now returning choices for chat completions for tracing fix: Add Chat Completions choices data in traces when using streaming Dec 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working package:agents-core

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants