-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: Add handleEvent callback #2025
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@jacoblee93, Let me know if there's anything you need to increase the chances of this getting merged! Be it reviewing, testing, etc. If introducing this change requires changing the upstream python library first, we can do that as well, if it helps. |
Yeah the biggest blocker is coordination with Python - if you open it there it would definitely speed things up. |
@jacoblee93 here is the PR for the Python: langchain-ai/langchain#9263 |
@jacoblee93 can u please advice who from python maintainers can help with python pr review? |
@jacoblee93 we have an identical Python PR opened. Would you be able to review the proposed small changes anytime soon? Could we do anything else to facilitate this process? |
Hi @vladgolubev and @andrewBatutin thanks for the PR and suggestion! While there is room for a generic onEvent callback, it would have to be completely generic and scoped to the base callback manager rather than the llm run manager. Would prefer to extend the llm's on new token callback to take in an optional chunk arg that each handler can decide to use |
# Description Main motivation for this PR is to sync with JS langchain langchain-ai/langchainjs#2025 Added `on_event` callback that works for both token and openai function calls in streaming mode Twitter: [@shelfdev](https://twitter.com/ShelfDev)
Hey @hinthornw, @jacoblee93 |
…handle-event-callback
Not super pretty, but should be backwards compatible and handle any additional arguments - when we're ready to make breaking changes, we can roll everything into one arg. Final comments @hinthornw? |
Following up on the earlier pull request #1964 I introduced one generic
handleEvent
callback.It will be responsible for catching both tokens as well as a function call.