Skip to content

Conversation

@dmytrostruk
Copy link
Member

Motivation and Context

Replaced obsolete create_response method with to_function_approval_response on Content type in samples.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

@dmytrostruk dmytrostruk self-assigned this Jan 30, 2026
Copilot AI review requested due to automatic review settings January 30, 2026 21:08
Copy link
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 pull request updates Python sample code to replace the obsolete create_response method with the new to_function_approval_response method on the Content type. This is part of API modernization where FunctionApprovalRequestContent and FunctionApprovalResponseContent types have been replaced with a generic Content type using type discriminators.

Changes:

  • Replaced imports of FunctionApprovalRequestContent and FunctionApprovalResponseContent with the generic Content type
  • Updated type checking from isinstance(data, FunctionApprovalRequestContent) to isinstance(data, Content) and data.type == "function_approval_request"
  • Replaced all calls to create_response() with to_function_approval_response() on Content objects
  • Updated comments and documentation to reflect the new API

Reviewed changes

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

Show a summary per file
File Description
sequential_builder_tool_approval.py Updated imports, type checks, and method calls for tool approval in sequential workflows
group_chat_builder_tool_approval.py Updated imports, type checks, and method calls for tool approval in group chat workflows
concurrent_builder_tool_approval.py Updated imports, type checks, and method calls for tool approval in concurrent workflows
agents_with_approval_requests.py Updated imports, type checks, and method calls for approval requests; contains a critical bug
handoff_with_tool_approval_checkpoint_resume.py Updated imports, type checks, method calls, and helper function signatures for checkpoint workflows
function_tool_with_approval_and_threads.py Updated method calls from create_response to to_function_approval_response
function_tool_with_approval.py Updated method calls from create_response to to_function_approval_response
openai_responses_client_with_hosted_mcp.py Updated method calls in OpenAI client examples
azure_responses_client_with_hosted_mcp.py Updated method calls in Azure OpenAI client examples
azure_ai_with_multiple_tools.py Updated method calls in Azure AI agent examples
azure_ai_with_hosted_mcp.py (azure_ai_agent) Updated method calls in Azure AI agent with MCP example
azure_ai_with_hosted_mcp.py (azure_ai) Updated method calls in Azure AI with MCP example

@dmytrostruk dmytrostruk added this pull request to the merge queue Jan 30, 2026
Merged via the queue into microsoft:main with commit 4938916 Jan 30, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants