mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-07 13:23:15 +00:00
Only reasoning agent should terminate run, not the grounding agent.
Grounding agent does not have the full context and capabilities to make this call. Only let reasoning agent make termination decision. Add a wait action instead when grounder requests termination.
This commit is contained in:
@@ -177,18 +177,18 @@ Focus on the visual action and provide all necessary context.
|
|||||||
|
|
||||||
# Process grounding response
|
# Process grounding response
|
||||||
if grounding_response.strip().endswith("DONE"):
|
if grounding_response.strip().endswith("DONE"):
|
||||||
rendered_parts += ["Completed task."]
|
# Ignore DONE response by the grounding agent. Reasoning agent handles termination.
|
||||||
|
actions.append(WaitAction(duration=1.0))
|
||||||
|
rendered_parts += ["Nothing to do."]
|
||||||
elif grounding_response.strip().endswith("FAIL"):
|
elif grounding_response.strip().endswith("FAIL"):
|
||||||
rendered_parts += ["Error in grounding LLM response."]
|
# Ignore FAIL response by the grounding agent. Reasoning agent handles termination.
|
||||||
|
actions.append(WaitAction(duration=1.0))
|
||||||
|
rendered_parts += ["Could not process response."]
|
||||||
else:
|
else:
|
||||||
rendered_parts += [f"**Thought (Grounding)**: {grounding_response}"]
|
rendered_parts += [f"**Thought (Grounding)**: {grounding_response}"]
|
||||||
for action in actions:
|
for action in actions:
|
||||||
rendered_parts += [f"**Action**: {action}"]
|
rendered_parts += [f"**Action**: {action}"]
|
||||||
action_results += [
|
action_results += [{"content": None}] # content set after environment step
|
||||||
{
|
|
||||||
"content": None, # Updated after environment step
|
|
||||||
}
|
|
||||||
]
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error calling Grounding LLM: {e}")
|
logger.error(f"Error calling Grounding LLM: {e}")
|
||||||
rendered_parts += [f"**Error**: Error contacting Grounding LLM: {e}"]
|
rendered_parts += [f"**Error**: Error contacting Grounding LLM: {e}"]
|
||||||
|
|||||||
Reference in New Issue
Block a user