-
Notifications
You must be signed in to change notification settings - Fork 17
feat: Support LangChain orchestration client streaming #711
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
Conversation
…:SAP/ai-sdk-js into langchain-orchestration-client-streaming
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestions for improvement. Also please do implement tests already in this PR to avoid changes later in case they don't work as expected. 😄
packages/langchain/src/orchestration/orchestration-message-chunk.ts
Outdated
Show resolved
Hide resolved
Co-authored-by: Zhongpin Wang <zhongpin.wang@sap.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see refactoring needed for the big *_streamResponseChunks
function. It would make the code more readable and testable.
…:SAP/ai-sdk-js into langchain-orchestration-client-streaming
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a lot was already considered, still there are some pointers from my side left.
I will continue reviewing the tests.
test-util/data/orchestration/orchestration-chat-completion-stream-chunk-response-tool-call.json
Show resolved
Hide resolved
test-util/data/orchestration/orchestration-chat-completion-stream-chunks-tool-calls.txt
Outdated
Show resolved
Hide resolved
packages/orchestration/src/orchestration-stream-chunk-response.test.ts
Outdated
Show resolved
Hide resolved
generationInfo: { ...tokenIndices } | ||
}); | ||
|
||
// Notify the run manager about the new token, some parameters are undefined as they are implicitly read from the context. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would put it as a comment right above this line. Doesn't need to be user-facing, but for us to maintain in the future.
Co-authored-by: Tom Frenken <54979414+tomfrenken@users.noreply.github.com>
Co-authored-by: Tom Frenken <54979414+tomfrenken@users.noreply.github.com>
{ | ||
"delta": { | ||
"content": "", | ||
"role": "assistantassistantassistantassistantassistantassistantassistantassistantassistantassistantassistant", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some properties are concatenated multiple times, as concat()
in AIMessageChunk
does not have these properties. We need to custom handle these properties during concatenation. Will handle this in a follow-up BLI: https://github.com/SAP/ai-sdk-js-backlog/issues/322.
I don't think this is a blocker for the streaming feature. What do the others think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, but could also be a contribution to LangChain itself (as part of that follow-up ticket), as they hint as concat being the "standard" way to chain chunks together, and it's clearly flawed.
…:SAP/ai-sdk-js into langchain-orchestration-client-streaming
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few minor comments, but overall LGTM!
packages/orchestration/src/orchestration-stream-chunk-response.test.ts
Outdated
Show resolved
Hide resolved
{ | ||
"delta": { | ||
"content": "", | ||
"role": "assistantassistantassistantassistantassistantassistantassistantassistantassistantassistantassistant", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, but could also be a contribution to LangChain itself (as part of that follow-up ticket), as they hint as concat being the "standard" way to chain chunks together, and it's clearly flawed.
….test.ts Co-authored-by: Tom Frenken <54979414+tomfrenken@users.noreply.github.com>
Context
Closes SAP/ai-sdk-js-backlog#259.
What this PR does and why it is needed
This PR introduces streaming support for Langchain Orchestration client.
Usage: