mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-12 20:12:33 +00:00
fix(responses): fix regression in support for mcp tool require_approval argument
Signed-off-by: Gordon Sim <gsim@redhat.com>
This commit is contained in:
parent
1970b4aa4b
commit
f4d141743a
2 changed files with 6 additions and 4 deletions
|
|
@ -269,7 +269,7 @@ class OpenAIResponsesImpl:
|
||||||
response_tools=tools,
|
response_tools=tools,
|
||||||
temperature=temperature,
|
temperature=temperature,
|
||||||
response_format=response_format,
|
response_format=response_format,
|
||||||
inputs=input,
|
inputs=all_input,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Create orchestrator and delegate streaming logic
|
# Create orchestrator and delegate streaming logic
|
||||||
|
|
|
||||||
|
|
@ -175,6 +175,8 @@ class StreamingResponseOrchestrator:
|
||||||
):
|
):
|
||||||
yield stream_event
|
yield stream_event
|
||||||
|
|
||||||
|
messages = next_turn_messages
|
||||||
|
|
||||||
if not function_tool_calls and not non_function_tool_calls:
|
if not function_tool_calls and not non_function_tool_calls:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
@ -187,9 +189,7 @@ class StreamingResponseOrchestrator:
|
||||||
logger.info(f"Exiting inference loop since iteration count({n_iter}) exceeds {self.max_infer_iters=}")
|
logger.info(f"Exiting inference loop since iteration count({n_iter}) exceeds {self.max_infer_iters=}")
|
||||||
break
|
break
|
||||||
|
|
||||||
messages = next_turn_messages
|
self.final_messages = messages.copy()
|
||||||
|
|
||||||
self.final_messages = messages.copy() + [current_response.choices[0].message]
|
|
||||||
|
|
||||||
# Create final response
|
# Create final response
|
||||||
final_response = OpenAIResponseObject(
|
final_response = OpenAIResponseObject(
|
||||||
|
|
@ -232,9 +232,11 @@ class StreamingResponseOrchestrator:
|
||||||
non_function_tool_calls.append(tool_call)
|
non_function_tool_calls.append(tool_call)
|
||||||
else:
|
else:
|
||||||
logger.info(f"Approval denied for {tool_call.id} on {tool_call.function.name}")
|
logger.info(f"Approval denied for {tool_call.id} on {tool_call.function.name}")
|
||||||
|
next_turn_messages.pop()
|
||||||
else:
|
else:
|
||||||
logger.info(f"Requesting approval for {tool_call.id} on {tool_call.function.name}")
|
logger.info(f"Requesting approval for {tool_call.id} on {tool_call.function.name}")
|
||||||
approvals.append(tool_call)
|
approvals.append(tool_call)
|
||||||
|
next_turn_messages.pop()
|
||||||
else:
|
else:
|
||||||
non_function_tool_calls.append(tool_call)
|
non_function_tool_calls.append(tool_call)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue