Skip to content

Python: Handle tuples in function tool results - #9679

Open
ssccinng wants to merge 1 commit into
microsoft:mainfrom
ssccinng:openfix/cfb0bcfb-2091-44cf-9b15-616ae191218b
Open

ssccinng wants to merge 1 commit into
microsoft:mainfrom
ssccinng:openfix/cfb0bcfb-2091-44cf-9b15-616ae191218b

Conversation

@ssccinng

@ssccinng ssccinng commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Motivation & Context

FunctionTool.parse_result handled lists of rich Content and Pydantic models, but tuples bypassed those paths. This could stringify Content objects and serialize models as strings instead of dictionaries.

Description & Review Guide

  • Handle tuples like lists during recursive JSON conversion and rich Content preservation.
  • Preserve tuple Content items in order, and serialize nested Pydantic models as dictionaries.
  • Add regression coverage for tuple and list equivalence, nested tuples, mixed Content and ordinary values, and empty tuples.

Related Issue

N/A - trivial change: fixes tuple handling in function result serialization.

AI Assistance

AI assistance was used for the implementation, regression tests, and this description.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR links to an agreed issue or documents a trivial-change exception
  • This is not a breaking change.

This branch was previously deployed

1 inactive deployment
github-app-auth — 24c8848e Deployed Oct 25, 2026 by ssccinng via team_check #7412
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant