pull/906/merge
王祥宇 1 month ago committed by GitHub
commit cd8e9da278
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1051,7 +1051,19 @@ class Agent:
# # Convert to a str if the response is not a str
# if self.mcp_url is None or self.tools is None:
response = self.parse_llm_output(response)
# response = self.parse_llm_output(response)
# Check if response is empty
if (response is None or
(isinstance(response, dict) and not response) or
(isinstance(response, str) and not response.strip()) or
(isinstance(response, list) and not response) or
(hasattr(response, "__len__") and len(response) == 0)):
# response is empty, assign prompt information
response = {"message": "The LLM return value is empty"}
else:
# response is not empty, perform normal parsing
response = self.parse_llm_output(response)
self.short_memory.add(
role=self.agent_name,

Loading…
Cancel
Save