mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-26 01:01:40 +00:00
fix(honcho): improve conclude descriptions and add exactly-one validation
Improve honcho_conclude tool descriptions to explicitly tell the model not to send both params together. Add runtime validation that rejects calls with both or neither of conclusion/delete_id. Add schema regression test and both-params rejection test. Consolidates #10847 by @ygd58, #10864 by @cola-runner, #10870 by @vominh1919, and #10952 by @ogzerber. The anyOf removal itself was already merged; this adds the runtime validation and tests those PRs contributed. Co-authored-by: ygd58 <ygd58@users.noreply.github.com> Co-authored-by: cola-runner <cola-runner@users.noreply.github.com> Co-authored-by: vominh1919 <vominh1919@users.noreply.github.com>
This commit is contained in:
parent
7e3845ac50
commit
4377d7da0d
2 changed files with 38 additions and 7 deletions
|
|
@ -160,11 +160,11 @@ CONCLUDE_SCHEMA = {
|
|||
"properties": {
|
||||
"conclusion": {
|
||||
"type": "string",
|
||||
"description": "A factual statement to persist. Required when not using delete_id.",
|
||||
"description": "A factual statement to persist. Provide this when creating a conclusion. Do not send it together with delete_id.",
|
||||
},
|
||||
"delete_id": {
|
||||
"type": "string",
|
||||
"description": "Conclusion ID to delete (for PII removal). Required when not using conclusion.",
|
||||
"description": "Conclusion ID to delete for PII removal. Provide this when deleting a conclusion. Do not send it together with conclusion.",
|
||||
},
|
||||
"peer": {
|
||||
"type": "string",
|
||||
|
|
@ -1009,15 +1009,19 @@ class HonchoMemoryProvider(MemoryProvider):
|
|||
|
||||
elif tool_name == "honcho_conclude":
|
||||
delete_id = args.get("delete_id")
|
||||
conclusion = args.get("conclusion", "")
|
||||
peer = args.get("peer", "user")
|
||||
if delete_id:
|
||||
|
||||
has_delete_id = bool(delete_id)
|
||||
has_conclusion = bool(conclusion)
|
||||
if has_delete_id == has_conclusion:
|
||||
return tool_error("Exactly one of conclusion or delete_id must be provided.")
|
||||
|
||||
if has_delete_id:
|
||||
ok = self._manager.delete_conclusion(self._session_key, delete_id, peer=peer)
|
||||
if ok:
|
||||
return json.dumps({"result": f"Conclusion {delete_id} deleted."})
|
||||
return tool_error(f"Failed to delete conclusion {delete_id}.")
|
||||
conclusion = args.get("conclusion", "")
|
||||
if not conclusion:
|
||||
return tool_error("Missing required parameter: conclusion or delete_id")
|
||||
ok = self._manager.create_conclusion(self._session_key, conclusion, peer=peer)
|
||||
if ok:
|
||||
return json.dumps({"result": f"Conclusion saved for {peer}: {conclusion}"})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue