Skip to content

Conversation

@ymuichiro
Copy link
Contributor

@ymuichiro ymuichiro commented Oct 22, 2025

Summary

Fixed an issue where the text parameter was missing in requests to the OpenAI Responses API.

Changes Made

Modified the ResponsesAgentThreadActions._generate_options() method to correctly handle the text parameter:

  • Added to the options dictionary only if text is not None.
  • Not added if it is an empty dict (the default value).
  • This ensures that only explicitly set text parameters are sent to the API.

Fix Location

File: semantic_kernel/agents/open_ai/responses_agent_thread_actions.py

Before:

options = {
    "model": merged.get("model"),
    "top_p": merged.get("top_p"),
    "temperature": merged.get("temperature"),
    "truncation": truncation,
    "metadata": merged.get("metadata"),
    "max_output_tokens": max_output_tokens,
    "parallel_tool_calls": parallel_tool_calls,
}

After:

options = {
    "model": merged.get("model"),
    "top_p": merged.get("top_p"),
    "temperature": merged.get("temperature"),
    "truncation": truncation,
    "metadata": merged.get("metadata"),
    "max_output_tokens": max_output_tokens,
    "parallel_tool_calls": parallel_tool_calls,
}

# Add text option if it exists
if merged.get("text") is not None:
    options["text"] = merged.get("text")

Contribution Checklist

Copilot AI review requested due to automatic review settings October 22, 2025 16:25
@ymuichiro ymuichiro requested a review from a team as a code owner October 22, 2025 16:25
@markwallace-microsoft markwallace-microsoft added the python Pull requests for the Python Semantic Kernel label Oct 22, 2025
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 PR fixes a bug where the text parameter was not being included in requests to the OpenAI Responses API. The fix ensures that when a text parameter is explicitly provided, it is correctly added to the options dictionary sent to the API.

  • Added conditional logic to include the text parameter in API requests only when it is explicitly set
  • Prevents sending None or default empty dict values to the API

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

@markwallace-microsoft
Copy link
Member

markwallace-microsoft commented Oct 23, 2025

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
agents/open_ai
   responses_agent_thread_actions.py44012671%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, 1215
TOTAL27301456083% 

Python Unit Test Overview

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

@moonbox3
Copy link
Collaborator

@ymuichiro are there any unit tests we need to add or update?

@ymuichiro
Copy link
Contributor Author

@moonbox3

I don’t think any test changes are needed this time 😃

Adding unit tests for this case would be excessive — the logic is simply to pass the text parameter to the subsequent process if it exists, and skip it if it doesn’t.

It’s possible to implement a focused test to check whether text is passed correctly, but that would require using several surrounding functions and essentially become more like an integration test.

@TaoChenOSU TaoChenOSU added this pull request to the merge queue Oct 27, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 27, 2025
@moonbox3 moonbox3 added this pull request to the merge queue Oct 28, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 28, 2025
@moonbox3 moonbox3 added this pull request to the merge queue Oct 30, 2025
Merged via the queue into microsoft:main with commit 9962d43 Oct 30, 2025
27 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.

Python Bug: The text parameter was missing when sending to the OpenAI Responses API.

4 participants