aboutsummaryrefslogtreecommitdiff
path: root/llm.py
diff options
context:
space:
mode:
authorJoel Kronqvist <joel.kronqvist@iki.fi>2026-10-12 19:54:29 +0300
committerJoel Kronqvist <joel.kronqvist@iki.fi>2026-10-12 19:54:29 +0300
commit4d6f0330dd4648b2ae4385d08a58a8a78fb50b29 (patch)
tree591efa0054e0859660a023fee7f9afbeab8bcdaa /llm.py
parente42ae589c623dd1a5ae379899c94f93ed05bc848 (diff)
downloadagent-4d6f0330dd4648b2ae4385d08a58a8a78fb50b29.tar.gz
agent-4d6f0330dd4648b2ae4385d08a58a8a78fb50b29.zip
fix: more robust action matching
Diffstat (limited to 'llm.py')
-rwxr-xr-xllm.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/llm.py b/llm.py
index db72ba3..7577f9f 100755
--- a/llm.py
+++ b/llm.py
@@ -87,10 +87,10 @@ def query_agent(query: str, config: AgentConfig, state=()):
try:
action = json.loads(json_str)
action_name = action["action"]
- except (json.JSONDecodeError, KeyError):
+ except (json.JSONDecodeError, KeyError, TypeError):
continue
- f = first(config.actions, lambda f: f.name == action_name)
+ f = first(config.actions, lambda f: f.name == action_name and all(k in action for k in f.required_keys))
if f is not None:
desc = f.formatter(action)
if (