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

Pass input value to handleChainStart in _transformStreamWithConfig #7419

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Stadly
Copy link
Contributor

@Stadly Stadly commented Dec 21, 2024

This pull request makes a small change to the Runnable class in the langchain-core package. The change passes finalInput instead of { input: "" } to the handleChainStart method. This allows the actual input value to be logged with tools like Langfuse.

Copy link

vercel bot commented Dec 21, 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 21, 2024 9:30pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
langchainjs-api-refs ⬜️ Ignored (Inspect) Dec 21, 2024 9:30pm

@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. auto:nit Small modifications/deletions, fixes, deps or improvements to existing code or docs labels Dec 21, 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.

I think there was a reason we don't do this but I can't remember what it was

You should be able to get the final input value from the handleChainEnd callback anyway right?

https://github.com/langchain-ai/langchainjs/pull/7419/files#diff-59ab510ff925ffbaa3959943f899d56160b14d8ffd74ea797ec9aee06fb8ef36R583

Can you add a test or two with permutations around what happens for transform inputs that aren't concattable?

@@ -521,7 +521,7 @@ export abstract class Runnable<
async () =>
callbackManager_?.handleChainStart(
this.toJSON(),
{ input: "" },
finalInput,
Copy link
Collaborator

Choose a reason for hiding this comment

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

There are cases where finalInput is undefined right?

Should this fall back to the old value?

@jacoblee93 jacoblee93 added the question Further information is requested label Dec 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto:nit Small modifications/deletions, fixes, deps or improvements to existing code or docs question Further information is requested size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants