Fix typing of attribute (#3999)

This commit is contained in:
Zander Chase 2023-05-02 15:11:23 -07:00 committed by GitHub
parent 36ee60c96c
commit 1c68cbdb28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 6 deletions

View File

@ -5,7 +5,6 @@ from pydantic import Field
from langchain.agents.agent import Agent, AgentOutputParser
from langchain.agents.structured_chat.output_parser import (
StructuredChatOutputParser,
StructuredChatOutputParserWithRetries,
)
from langchain.agents.structured_chat.prompt import FORMAT_INSTRUCTIONS, PREFIX, SUFFIX
@ -23,7 +22,9 @@ from langchain.tools import BaseTool
class StructuredChatAgent(Agent):
output_parser: AgentOutputParser = Field(default_factory=StructuredChatOutputParser)
output_parser: AgentOutputParser = Field(
default_factory=StructuredChatOutputParserWithRetries
)
@property
def observation_prefix(self) -> str:

View File

@ -11,7 +11,6 @@ from langchain.agents.agent import AgentOutputParser
from langchain.agents.structured_chat.prompt import FORMAT_INSTRUCTIONS
from langchain.base_language import BaseLanguageModel
from langchain.output_parsers import OutputFixingParser
from langchain.output_parsers.pydantic import PydanticOutputParser
from langchain.schema import AgentAction, AgentFinish, OutputParserException
logger = logging.getLogger(__name__)
@ -43,9 +42,7 @@ class StructuredChatOutputParser(AgentOutputParser):
class StructuredChatOutputParserWithRetries(AgentOutputParser):
base_parser: PydanticOutputParser = Field(
default_factory=StructuredChatOutputParser
)
base_parser: AgentOutputParser = Field(default_factory=StructuredChatOutputParser)
output_fixing_parser: Optional[OutputFixingParser] = None
def get_format_instructions(self) -> str: