mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
Python: Fixing the OpenAI Responses Client to be able to persist and interact with server-side threads (#818)
* Fix options_dict handling in response client * Update python/packages/main/agent_framework/openai/_responses_client.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update condition for storing chat options Fixes issue where, when using server-side threads, AF would pass back the function call message due to store being in chat_options in kwargs, not at the kwargs level. Means the appending of only the tool execution result never happens. Resulted in a "tool output not found error" as we replied with the call not the result first. * Refactor chat_options access for clarity * Refactor store option assignment in responses client * Small fixes --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Dmytro Struk <13853051+dmytrostruk@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
Unverified
parent
205cd700c8
commit
94cef85c71
@@ -304,12 +304,13 @@ class OpenAIBaseResponsesClient(OpenAIBase, BaseChatClient):
|
||||
options_dict["tools"] = self._tools_to_response_tools(chat_options.tools)
|
||||
|
||||
# other settings
|
||||
if "store" not in options_dict:
|
||||
if chat_options.store:
|
||||
options_dict["store"] = True
|
||||
else:
|
||||
options_dict["store"] = False
|
||||
if "conversation_id" in options_dict:
|
||||
options_dict["previous_response_id"] = options_dict["conversation_id"]
|
||||
options_dict.pop("conversation_id")
|
||||
if "model" not in options_dict:
|
||||
if chat_options.conversation_id:
|
||||
options_dict["previous_response_id"] = chat_options.conversation_id
|
||||
if chat_options.ai_model_id is None:
|
||||
options_dict["model"] = self.ai_model_id
|
||||
return options_dict
|
||||
|
||||
|
||||
Reference in New Issue
Block a user