Skip to content

Conversation

@alecf
Copy link
Contributor

@alecf alecf commented Jul 10, 2023

When using callbacks, there are times when callbacks can be added redundantly: for instance sometimes you might need to create an llm with specific callbacks, but then also create and agent that uses a chain that has those callbacks already set. This means that "callbacks" might get passed down again to the llm at predict() time, resulting in duplicate calls to the on_llm_start callback.

For the sake of simplicity, I made it so that langchain never adds an exact handler/callbacks object in add_handler, thus avoiding the duplicate handler issue.

Tagging @hwchase17 for callback review

@vercel
Copy link

vercel bot commented Jul 10, 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 12, 2023 7:38am

Copy link
Collaborator

@agola11 agola11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@baskaryan baskaryan merged commit 6cdd4b5 into langchain-ai:master Jul 12, 2023
@alecf alecf deleted the alecf/no-redundant-handlers branch July 17, 2023 17:45
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.

3 participants