mirror of
https://github.com/hwchase17/langchain
synced 2024-11-06 03:20:49 +00:00
Fix typing of attribute (#3999)
This commit is contained in:
parent
36ee60c96c
commit
1c68cbdb28
@ -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:
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user