fix: Filter invalid messages

This commit is contained in:
Leni Aniva 2024-10-11 17:06:31 -07:00
parent cd05b67c10
commit 9fc035d466
Signed by: aniva
GPG Key ID: 4D9B1C8D10EA4C50
1 changed files with 4 additions and 0 deletions

View File

@ -1,5 +1,6 @@
from typing import Optional from typing import Optional
import collections, unittest import collections, unittest
from termcolor import colored
from pantograph.search import Agent from pantograph.search import Agent
from pantograph.server import Server, TacticFailure, ServerError from pantograph.server import Server, TacticFailure, ServerError
from pantograph.expr import Expr, Tactic, GoalState from pantograph.expr import Expr, Tactic, GoalState
@ -70,6 +71,9 @@ class LLMAgent(Agent):
print("\n-- new state --\n", new_state) print("\n-- new state --\n", new_state)
if tactic: if tactic:
if not isinstance(tactic, Tactic):
print(colored("[Tactic] Failed:", "red"), tactic)
return None
return tactic return tactic
return None return None
else: else: