Skip to content

Conversation

@msaelices
Copy link
Contributor

@msaelices msaelices commented Jul 7, 2023

Changes

  • Fill the llm_output param when there is an output parsing error in a Pydantic schema so that we can get the original text that failed to parse when handling the exception

Background

With this change, we could do something like this:

output_parser = PydanticOutputParser(pydantic_object=pydantic_obj)
chain = ConversationChain(..., output_parser=output_parser)
try:
    response: PydanticSchema = chain.predict(input=input)
except OutputParserException as exc:
    logger.error(
        'OutputParserException while parsing chatbot response: %s', exc.llm_output,
    )

…ydantic schema so that we can get the original text that failed to parse when handling the exception
@vercel
Copy link

vercel bot commented Jul 7, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
langchain ⬜️ Ignored (Inspect) Jul 7, 2023 6:09pm

@baskaryan
Copy link
Collaborator

thanks @msaelices!

@baskaryan baskaryan added the lgtm label Jul 7, 2023
@baskaryan baskaryan merged commit 01dca1e into langchain-ai:master Jul 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants