Skip to content
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

fix(core): Make sure to return a callback manager if configure hooks #7366

Merged
merged 4 commits into from
Dec 16, 2024

Conversation

ibolmo
Copy link
Contributor

@ibolmo ibolmo commented Dec 15, 2024

Set a campaign manager, if we know there are callback managers we'd like to use

This preserves existing behavior except for when library creators want handlers registered with the registerConfigureHook function. In that case, we want to make sure we return a callback manager.

Twitter: @ibolmo

…ike to use

This preserves existing behavior except for when library creators want handlers
registered with the `registerConfigureHook` function. In that case, we want to make
sure we return a callback manager.
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Dec 15, 2024
Copy link

vercel bot commented Dec 15, 2024

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

Name Status Preview Comments Updated (UTC)
langchainjs-docs ✅ Ready (Inspect) Visit Preview Dec 16, 2024 7:22pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
langchainjs-api-refs ⬜️ Ignored (Inspect) Dec 16, 2024 7:22pm

@dosubot dosubot bot added the auto:improvement Medium size change to existing code to handle new use-cases label Dec 15, 2024
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Dec 16, 2024
@jacoblee93 jacoblee93 changed the title Make sure to return a campaign manager if configure hooks fix(core): Make sure to return a campaign manager if configure hooks Dec 16, 2024
Copy link
Collaborator

@jacoblee93 jacoblee93 left a comment

Choose a reason for hiding this comment

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

Small nit, can apply myself if you don't have time

@@ -1276,8 +1276,12 @@ export class CallbackManager
handler = new (handlerClass as any)({});
}
if (handler !== undefined) {
if (!callbackManager?.handlers.some((h) => h.name === handler!.name)) {
callbackManager?.addHandler(handler, inheritable);
if (!callbackManager) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since this can potentially create a callback manager - let's move this whole block above where we add the inheritableTags and inheritableMetadata so that those are added properly

@jacoblee93 jacoblee93 changed the title fix(core): Make sure to return a campaign manager if configure hooks fix(core): Make sure to return a callback manager if configure hooks Dec 16, 2024
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Dec 16, 2024
@jacoblee93 jacoblee93 merged commit 64c2351 into langchain-ai:main Dec 16, 2024
36 checks passed
@ibolmo ibolmo deleted the guarantee-callback-handler branch December 16, 2024 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto:improvement Medium size change to existing code to handle new use-cases size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants