Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix OpenTelemetryChatClient failing on unknown content types#6915

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
stephentoub merged 1 commit intodotnet:mainfromstephentoub:fixotelexception
Oct 13, 2025

Conversation

@stephentoub
Copy link
Member

@stephentoubstephentoub commentedOct 13, 2025
edited by dotnet-policy-servicebot
Loading

It should fail gracefully by ignoring any content it can't output telemetry for rather than throwing.

Microsoft Reviewers:Open in CodeFlow

@stephentoubstephentoub requested a review froma team as acode ownerOctober 13, 2025 15:28
CopilotAI review requested due to automatic review settingsOctober 13, 2025 15:28
@stephentoubstephentoubenabled auto-merge (squash)October 13, 2025 15:29
@github-actionsgithub-actionsbot added the area-aiMicrosoft.Extensions.AI libraries labelOct 13, 2025
Copy link
Contributor

CopilotAI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a bug in OpenTelemetryChatClient where it would fail when encountering unknown or non-serializable AI content types. Instead of throwing exceptions, the client now gracefully handles these cases by attempting to serialize unknown content types and ignoring any that can't be serialized.

Key Changes

  • Modified the serialization logic to handle unknown content types gracefully with try-catch protection
  • Added support for custom JSON serializer options when processing unknown content types
  • Added comprehensive test coverage for the new graceful failure behavior

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

FileDescription
src/Libraries/Microsoft.Extensions.AI/ChatCompletion/OpenTelemetryChatClient.csEnhanced SerializeChatMessages method to handle unknown content types gracefully and pass custom serializer options
test/Libraries/Microsoft.Extensions.AI.Tests/ChatCompletion/OpenTelemetryChatClientTests.csAdded test case to verify unknown content types are handled without throwing exceptions

It should fail gracefully by ignoring any content it can't output telemetry for rather than throwing.
@stephentoubstephentoub merged commit4e71161 intodotnet:mainOct 13, 2025
6 checks passed
joperezr pushed a commit to joperezr/extensions that referenced this pull requestOct 14, 2025
…6915)It should fail gracefully by ignoring any content it can't output telemetry for rather than throwing.
jeffhandley pushed a commit to jeffhandley/extensions that referenced this pull requestOct 21, 2025
…6915)It should fail gracefully by ignoring any content it can't output telemetry for rather than throwing.
jeffhandley pushed a commit to jeffhandley/extensions that referenced this pull requestOct 21, 2025
…6915)It should fail gracefully by ignoring any content it can't output telemetry for rather than throwing.
This was referencedNov 11, 2025
This was referencedNov 12, 2025
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsNov 13, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

Copilot code reviewCopilotCopilot left review comments

@eiriktsarpaliseiriktsarpaliseiriktsarpalis approved these changes

Assignees

@stephentoubstephentoub

Labels

area-aiMicrosoft.Extensions.AI libraries

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@stephentoub@eiriktsarpalis

[8]ページ先頭

©2009-2025 Movatter.jp