diff options
| author | Joel Kronqvist <joel.kronqvist@iki.fi> | 2026-10-12 19:54:29 +0300 |
|---|---|---|
| committer | Joel Kronqvist <joel.kronqvist@iki.fi> | 2026-10-12 19:54:29 +0300 |
| commit | 4d6f0330dd4648b2ae4385d08a58a8a78fb50b29 (patch) | |
| tree | 591efa0054e0859660a023fee7f9afbeab8bcdaa /llm.py | |
| parent | e42ae589c623dd1a5ae379899c94f93ed05bc848 (diff) | |
| download | agent-4d6f0330dd4648b2ae4385d08a58a8a78fb50b29.tar.gz agent-4d6f0330dd4648b2ae4385d08a58a8a78fb50b29.zip | |
fix: more robust action matching
Diffstat (limited to 'llm.py')
| -rwxr-xr-x | llm.py | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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 ( |
