Skip to content

Python: Respect FunctionChoiceBehavior filters in OpenAI responses agent tools#13235

Merged
moonbox3 merged 6 commits intomicrosoft:mainfrom
ymuichiro:feat/respect-function-choice-filters
Apr 8, 2026
Merged

Python: Respect FunctionChoiceBehavior filters in OpenAI responses agent tools#13235
moonbox3 merged 6 commits intomicrosoft:mainfrom
ymuichiro:feat/respect-function-choice-filters

Conversation

@ymuichiro
Copy link
Copy Markdown
Contributor

issue: #13234

Summary

  • honor FunctionChoiceBehavior filters when retrieving kernel function metadata

Contribution Checklist

@ymuichiro ymuichiro requested a review from a team as a code owner October 8, 2025 17:43
Copilot AI review requested due to automatic review settings October 8, 2025 17:43
Copy link
Copy Markdown
Contributor

Copilot AI 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 ensures that FunctionChoiceBehavior filters are properly respected when retrieving kernel function metadata in OpenAI responses agent tools. Previously, the code was ignoring these filters and always returning all available functions.

  • Replaced the TODO comment with proper implementation of FunctionChoiceBehavior filter handling
  • Added early returns for cases where kernel functions are disabled or no plugins exist
  • Used conditional logic to apply filters when retrieving function metadata

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@ymuichiro ymuichiro force-pushed the feat/respect-function-choice-filters branch from 1b57d35 to 30d70c1 Compare October 8, 2025 17:48
@markwallace-microsoft markwallace-microsoft added the python Pull requests for the Python Semantic Kernel label Oct 17, 2025
@moonbox3
Copy link
Copy Markdown
Collaborator

@ymuichiro Thanks for the contribution. Please have a look at a failing test, thanks: https://github.com/microsoft/semantic-kernel/actions/runs/18583595889/job/52983055182?pr=13235#step:5:445

@ymuichiro
Copy link
Copy Markdown
Contributor Author

@moonbox3
Fixed! I suspected the problem was in the test code, so I only changed the test code.

@markwallace-microsoft
Copy link
Copy Markdown
Contributor

markwallace-microsoft commented Oct 17, 2025

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
agents/open_ai
   responses_agent_thread_actions.py44012870%177, 194, 207, 218–219, 227, 234, 247, 407–408, 410, 424, 429, 436, 451–452, 462, 469, 471–472, 481, 488, 490–491, 502, 509, 511–512, 522, 529, 534–535, 539, 551, 585–587, 590, 608–609, 620–622, 626, 630–631, 635–637, 648–650, 672, 674–675, 682–683, 685–686, 688, 690–691, 693–694, 792, 797, 805–806, 808, 814, 819, 824–826, 832–834, 839–840, 842–847, 849, 853–854, 856, 860, 864, 869–870, 875, 878–879, 939–942, 965, 1011–1014, 1055–1056, 1060–1062, 1064, 1089–1090, 1092–1096, 1098, 1108–1109, 1117, 1121, 1128, 1134, 1210, 1213, 1216
TOTAL27296456283% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
3759 23 💤 0 ❌ 0 🔥 1m 35s ⏱️

@moonbox3 moonbox3 enabled auto-merge October 17, 2025 07:21
@moonbox3 moonbox3 added this pull request to the merge queue Apr 8, 2026
Merged via the queue into microsoft:main with commit eeeccb4 Apr 8, 2026
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Pull requests for the Python Semantic Kernel

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants