From ac982e80a5bf52440501283419e8275efb33a602 Mon Sep 17 00:00:00 2001 From: jinno Date: Sun, 5 May 2024 16:25:31 +0900 Subject: [PATCH] fix: use GuardrailsOutputParser --- src/codeinterpreterapi/_patch_parser.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/codeinterpreterapi/_patch_parser.py b/src/codeinterpreterapi/_patch_parser.py index 03a8028f..ac6de14d 100644 --- a/src/codeinterpreterapi/_patch_parser.py +++ b/src/codeinterpreterapi/_patch_parser.py @@ -3,15 +3,15 @@ from json import JSONDecodeError from typing import List, Union -from langchain.agents.agent import AgentOutputParser from langchain.agents.openai_functions_agent import base +from langchain_community.output_parsers.rail_parser import GuardrailsOutputParser from langchain_core.agents import AgentAction, AgentActionMessageLog, AgentFinish from langchain_core.exceptions import OutputParserException from langchain_core.messages import AIMessage, BaseMessage from langchain_core.outputs import ChatGeneration, Generation -class OpenAIFunctionsAgentOutputParser(AgentOutputParser): +class OpenAIFunctionsAgentOutputParser(GuardrailsOutputParser): """Parses a message into agent action/finish. Is meant to be used with OpenAI models, as it relies on the specific