diff --git a/agents/parser.py b/agents/parser.py index 5dd5050..3e70ff9 100644 --- a/agents/parser.py +++ b/agents/parser.py @@ -14,7 +14,7 @@ class EvalOutputParser(BaseOutputParser): regex = r"Action: (.*?)[\n]*Action Input: (.*)" match = re.search(regex, text, re.DOTALL) if not match: - return {"action": "Exit Conversation", "action_input": text} + raise Exception("parse error") action = match.group(1).strip() action_input = match.group(2) return {"action": action, "action_input": action_input.strip(" ").strip('"')} diff --git a/main.py b/main.py index a53a09d..af49891 100644 --- a/main.py +++ b/main.py @@ -35,7 +35,6 @@ toolsets: List[BaseToolSet] = [ Terminal(), CodeEditor(), RequestsGet(), - WineDB(), ExitConversation(), Text2Image("cuda"), ImageEditing("cuda"), @@ -90,6 +89,7 @@ async def command(request: Request) -> Response: try: res = executor({"input": promptedQuery}) except Exception as e: + logger.error(f"error while processing request: ", str(e)) try: res = executor( { diff --git a/prompts/input.py b/prompts/input.py index 0eb59a3..69bff23 100644 --- a/prompts/input.py +++ b/prompts/input.py @@ -57,8 +57,6 @@ Here is the user's input: EVAL_TOOL_RESPONSE = """TOOL RESPONSE: --------------------- {observation} - -USER'S INPUT -------------------- - +After exiting conversation, you must choose Final Answer Action. """ diff --git a/tools/cpu.py b/tools/cpu.py index a296260..674eb20 100644 --- a/tools/cpu.py +++ b/tools/cpu.py @@ -227,15 +227,14 @@ class ExitConversation(BaseToolSet): name="Exit Conversation", description="A tool to exit the conversation. " "Use this when you want to exit the conversation. " - "Input should be a user's session." - "The output will be a message that the conversation is over.", + "The input should be a message that the conversation is over.", scope=ToolScope.SESSION, ) - def exit(self, *args, get_session: SessionGetter) -> str: + def exit(self, message: str, get_session: SessionGetter) -> str: """Run the tool.""" _, executor = get_session() del executor logger.debug(f"\nProcessed ExitConversation.") - return f"Exit conversation." + return message