services: mark function calls as completed even the result is None
This commit is contained in:
@@ -711,12 +711,13 @@ class AnthropicAssistantContextAggregator(LLMAssistantContextAggregator):
|
|||||||
)
|
)
|
||||||
|
|
||||||
async def handle_function_call_result(self, frame: FunctionCallResultFrame):
|
async def handle_function_call_result(self, frame: FunctionCallResultFrame):
|
||||||
if not frame.result:
|
if frame.result:
|
||||||
return
|
result = json.dumps(frame.result)
|
||||||
|
await self._update_function_call_result(frame.function_name, frame.tool_call_id, result)
|
||||||
result = json.dumps(frame.result)
|
else:
|
||||||
|
await self._update_function_call_result(
|
||||||
await self._update_function_call_result(frame.function_name, frame.tool_call_id, result)
|
frame.function_name, frame.tool_call_id, "COMPLETED"
|
||||||
|
)
|
||||||
|
|
||||||
async def handle_function_call_cancel(self, frame: FunctionCallCancelFrame):
|
async def handle_function_call_cancel(self, frame: FunctionCallCancelFrame):
|
||||||
await self._update_function_call_result(
|
await self._update_function_call_result(
|
||||||
|
|||||||
@@ -600,15 +600,19 @@ class GoogleAssistantContextAggregator(OpenAIAssistantContextAggregator):
|
|||||||
)
|
)
|
||||||
|
|
||||||
async def handle_function_call_result(self, frame: FunctionCallResultFrame):
|
async def handle_function_call_result(self, frame: FunctionCallResultFrame):
|
||||||
if not frame.result:
|
if frame.result:
|
||||||
return
|
if not isinstance(frame.result, str):
|
||||||
|
return
|
||||||
|
|
||||||
if not isinstance(frame.result, str):
|
response = {"response": frame.result}
|
||||||
return
|
|
||||||
|
|
||||||
response = {"response": frame.result}
|
await self._update_function_call_result(
|
||||||
|
frame.function_name, frame.tool_call_id, response
|
||||||
await self._update_function_call_result(frame.function_name, frame.tool_call_id, response)
|
)
|
||||||
|
else:
|
||||||
|
await self._update_function_call_result(
|
||||||
|
frame.function_name, frame.tool_call_id, "COMPLETED"
|
||||||
|
)
|
||||||
|
|
||||||
async def handle_function_call_cancel(self, frame: FunctionCallCancelFrame):
|
async def handle_function_call_cancel(self, frame: FunctionCallCancelFrame):
|
||||||
await self._update_function_call_result(
|
await self._update_function_call_result(
|
||||||
|
|||||||
@@ -584,12 +584,13 @@ class OpenAIAssistantContextAggregator(LLMAssistantContextAggregator):
|
|||||||
)
|
)
|
||||||
|
|
||||||
async def handle_function_call_result(self, frame: FunctionCallResultFrame):
|
async def handle_function_call_result(self, frame: FunctionCallResultFrame):
|
||||||
if not frame.result:
|
if frame.result:
|
||||||
return
|
result = json.dumps(frame.result)
|
||||||
|
await self._update_function_call_result(frame.function_name, frame.tool_call_id, result)
|
||||||
result = json.dumps(frame.result)
|
else:
|
||||||
|
await self._update_function_call_result(
|
||||||
await self._update_function_call_result(frame.function_name, frame.tool_call_id, result)
|
frame.function_name, frame.tool_call_id, "COMPLETED"
|
||||||
|
)
|
||||||
|
|
||||||
async def handle_function_call_cancel(self, frame: FunctionCallCancelFrame):
|
async def handle_function_call_cancel(self, frame: FunctionCallCancelFrame):
|
||||||
await self._update_function_call_result(
|
await self._update_function_call_result(
|
||||||
|
|||||||
Reference in New Issue
Block a user