From 8c433f22c172a5d7350e5f391886caaad4b43533 Mon Sep 17 00:00:00 2001 From: takatost Date: Thu, 12 Oct 2023 17:33:42 +0800 Subject: [PATCH] fix: dataset segment not exist return agent response --- api/core/agent/agent/multi_dataset_router_agent.py | 2 ++ api/core/agent/agent/structed_multi_dataset_router_agent.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/api/core/agent/agent/multi_dataset_router_agent.py b/api/core/agent/agent/multi_dataset_router_agent.py index 57f054f7f40d77..5636d91b51fc2b 100644 --- a/api/core/agent/agent/multi_dataset_router_agent.py +++ b/api/core/agent/agent/multi_dataset_router_agent.py @@ -79,6 +79,8 @@ def plan( if isinstance(tool_inputs, dict) and 'query' in tool_inputs: tool_inputs['query'] = kwargs['input'] agent_decision.tool_input = tool_inputs + else: + agent_decision.return_values['output'] = '' return agent_decision except Exception as e: new_exception = self.model_instance.handle_exceptions(e) diff --git a/api/core/agent/agent/structed_multi_dataset_router_agent.py b/api/core/agent/agent/structed_multi_dataset_router_agent.py index 6b2889f45a8ed8..0ba774a88fc34c 100644 --- a/api/core/agent/agent/structed_multi_dataset_router_agent.py +++ b/api/core/agent/agent/structed_multi_dataset_router_agent.py @@ -107,6 +107,8 @@ def plan( if isinstance(tool_inputs, dict) and 'query' in tool_inputs: tool_inputs['query'] = kwargs['input'] agent_decision.tool_input = tool_inputs + else: + agent_decision.return_values['output'] = '' return agent_decision except OutputParserException: return AgentFinish({"output": "I'm sorry, the answer of model is invalid, "