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

Allow aggregator for streamed chunks to be passed to traceable in TS #629

Merged
merged 2 commits into from
Apr 26, 2024

Conversation

jacoblee93
Copy link
Collaborator

We'll automatically create and pass one of these for wrapOpenAI. Will do that in a third PR as I didn't want to create conflicts with #628.

@agola11 @hinthornw

Copy link
Collaborator

@hinthornw hinthornw left a comment

Choose a reason for hiding this comment

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

Seems reasonable...

@@ -157,7 +161,9 @@ export function traceable<Func extends (...args: any[]) => any>(
chunks.push(chunk);
yield chunk;
}
await currentRunTree.end({ outputs: chunks });
const finalOutputs =
aggregator === undefined ? chunks : aggregator(chunks);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we try/catch the aggregator? Woudl probably not want to break the function execution just because someone mis-implemented the function

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure, down for that.

@jacoblee93
Copy link
Collaborator Author

Updated

@hinthornw hinthornw merged commit 6e56b51 into main Apr 26, 2024
10 of 11 checks passed
@hinthornw hinthornw deleted the jacob/ts_aggregator branch April 26, 2024 07:33
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.

None yet

2 participants