generated from SAP/repository-template
-
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
Open
KavithaSiva
wants to merge
81
commits into
main
Choose a base branch
from
langchain-orchestration-client-streaming
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
81 commits
Select commit
Hold shift + click to select a range
996a818
chore: progress till now
KavithaSiva 6c9039f
chore: progress till now
KavithaSiva a84b446
Merge branch 'main' into langchain-orchestration-client-streaming
KavithaSiva a54250f
chore: update implementation
KavithaSiva e0f0e68
chore: minor corrections
KavithaSiva 9a743b6
chore: add changeset
KavithaSiva d386b30
Merge branch 'main' into langchain-orchestration-client-streaming
KavithaSiva 8c4a7ec
chore: change finish_reason storage
KavithaSiva 989f742
Merge branch 'langchain-orchestration-client-streaming' of github.com…
KavithaSiva db8491f
chore: update additonal properties
KavithaSiva fd37e19
chore: revert type change for additional_properties
KavithaSiva 009b508
Merge branch 'main' into langchain-orchestration-client-streaming
KavithaSiva ca2c7bc
Merge branch 'main' into langchain-orchestration-client-streaming
KavithaSiva 175e9b9
Update .changeset/chilly-steaks-divide.md
KavithaSiva dd0a47c
chore: address review comments
KavithaSiva 13f10ce
Merge branch 'main' into langchain-orchestration-client-streaming
KavithaSiva 96df564
chore: use convenience functions always
KavithaSiva 5769148
chore: switch to map
KavithaSiva 643a6bb
chore: add more convenience functions
KavithaSiva 7503191
chore: address review comments
KavithaSiva a6cb6d7
chore: simplify function
KavithaSiva aad9a05
chore: review comment
KavithaSiva 25a4a79
chore: simplify
KavithaSiva c72f742
chore: remove e2e test
KavithaSiva 2a3d810
chore: add tests, minor changes
KavithaSiva f5c8473
chore: additional test for utility functions
KavithaSiva fd331ef
chore: add test for tool calls
KavithaSiva b12bc70
Merge branch 'main' into langchain-orchestration-client-streaming
KavithaSiva 0be7944
chore: add tests for mapping function
KavithaSiva 373ccac
Merge branch 'langchain-orchestration-client-streaming' of github.com…
KavithaSiva ffd2456
chore: fix failing test
KavithaSiva 364ae6b
chore: refactor test names
KavithaSiva 2d3908d
Merge branch 'main' into langchain-orchestration-client-streaming
KavithaSiva a8359cc
Merge branch 'main' into langchain-orchestration-client-streaming
KavithaSiva 53666d9
Update packages/langchain/src/orchestration/client.ts
KavithaSiva a690099
chore: adapt name
KavithaSiva c24f9f5
chore: review changes
KavithaSiva acecf11
Update sample-code/src/langchain-orchestration.ts
KavithaSiva 3459207
Update sample-code/src/langchain-orchestration.ts
KavithaSiva 5dab701
chore: fix rename
KavithaSiva 448c403
chore: address JSDoc
KavithaSiva b6191a6
chore: link BLI instead
KavithaSiva 56ea273
chore: switch to hardcoded choice index
KavithaSiva dbf7174
chore: add convenience functions
KavithaSiva f82301e
chore: add convenience + tests
KavithaSiva ac9f6e8
chore: clean up generate
KavithaSiva cdb4749
chore: add callWithOptions back
KavithaSiva c073c88
Update packages/langchain/src/orchestration/util.ts
KavithaSiva 58434d5
Update packages/langchain/src/orchestration/util.ts
KavithaSiva f51b1d7
Merge branch 'main' into langchain-orchestration-client-streaming
KavithaSiva 64f16c7
chore: fix build
KavithaSiva 1cacf75
chore: fix build
KavithaSiva 0b34760
Update packages/langchain/src/orchestration/client.test.ts
KavithaSiva 206067a
chore: rename
KavithaSiva 4560687
chore: fix build
KavithaSiva 32971bd
chore: adjust test
KavithaSiva a9fc5d9
Update packages/langchain/src/orchestration/client.test.ts
KavithaSiva 46ddc01
chore: address review comment
KavithaSiva 473e9d8
Merge branch 'langchain-orchestration-client-streaming' of github.com…
KavithaSiva 27fc55b
chore: link BLI
KavithaSiva 6b50d39
chore: cleanup tests
KavithaSiva be56c21
chore: address review comments
KavithaSiva 93b6cf2
chore: review comments
KavithaSiva 40da119
chore: Add snapshot tests instead
KavithaSiva cc81b03
Merge branch 'main' into langchain-orchestration-client-streaming
KavithaSiva 94ceda9
chore: fix issues after merge conflict
KavithaSiva ad368c1
fix: Changes from lint
8968eb4
chore: fix tests
KavithaSiva b2ae5d0
Merge branch 'langchain-orchestration-client-streaming' of github.com…
KavithaSiva dcd5550
Merge branch 'main' into langchain-orchestration-client-streaming
KavithaSiva dd9c34f
chore: use mockInference instead of inference with resilience
KavithaSiva 146825f
Update packages/langchain/src/orchestration/util.ts
KavithaSiva 80f1e7d
Update packages/langchain/src/orchestration/util.ts
KavithaSiva d08f4a8
chore: review comment
KavithaSiva 1eac3c7
chore: Remove test file and adapt
KavithaSiva 9003b02
chore: adapt sample code
KavithaSiva 92ea3b3
chore: address review comment
KavithaSiva 3df806a
chore: improve comment
KavithaSiva 60a4f44
Merge branch 'main' into langchain-orchestration-client-streaming
KavithaSiva b4dae2b
chore: add test for testing timeout
KavithaSiva d87c204
Merge branch 'langchain-orchestration-client-streaming' of github.com…
KavithaSiva File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
Check warning on line 1 in .changeset/chilly-steaks-divide.md
|
||
'@sap-ai-sdk/orchestration': minor | ||
'@sap-ai-sdk/langchain': minor | ||
--- | ||
|
||
[New Functionality] Support streaming in LangChain orchestration client. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
114 changes: 114 additions & 0 deletions
114
packages/langchain/src/orchestration/__snapshots__/util.test.ts.snap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`mapOrchestrationChunkToLangChainMessageChunk should map a chunk with content to AIMessageChunk: AIMessageChunk with content 1`] = ` | ||
{ | ||
"id": [ | ||
"langchain_core", | ||
"messages", | ||
"AIMessageChunk", | ||
], | ||
"kwargs": { | ||
"additional_kwargs": { | ||
"module_results": { | ||
"llm": { | ||
"choices": [ | ||
{ | ||
"delta": { | ||
"content": "Test content", | ||
"role": "assistant", | ||
"tool_calls": undefined, | ||
}, | ||
"finish_reason": "", | ||
"index": 0, | ||
}, | ||
], | ||
"created": 1634840000, | ||
"id": "test-id", | ||
"model": "test-model", | ||
"object": "chat.completion.chunk", | ||
"system_fingerprint": "fp_123", | ||
"usage": undefined, | ||
}, | ||
}, | ||
"request_id": "req-123", | ||
}, | ||
"content": "Test content", | ||
"invalid_tool_calls": [], | ||
"response_metadata": {}, | ||
"tool_call_chunks": [], | ||
"tool_calls": [], | ||
"usage_metadata": undefined, | ||
}, | ||
"lc": 1, | ||
"type": "constructor", | ||
} | ||
`; | ||
|
||
exports[`mapOrchestrationChunkToLangChainMessageChunk should map a chunk with tool call chunks to AIMessageChunk: AIMessageChunk with tool call chunks 1`] = ` | ||
{ | ||
"id": [ | ||
"langchain_core", | ||
"messages", | ||
"AIMessageChunk", | ||
], | ||
"kwargs": { | ||
"additional_kwargs": { | ||
"module_results": { | ||
"llm": { | ||
"choices": [ | ||
{ | ||
"delta": { | ||
"content": "", | ||
"role": "assistant", | ||
"tool_calls": [ | ||
{ | ||
"function": { | ||
"arguments": "", | ||
"name": "test_function", | ||
}, | ||
"id": "call-123", | ||
"index": 0, | ||
"type": "function", | ||
}, | ||
], | ||
}, | ||
"finish_reason": "", | ||
"index": 0, | ||
}, | ||
], | ||
"created": 1634840000, | ||
"id": "test-id", | ||
"model": "test-model", | ||
"object": "chat.completion.chunk", | ||
"system_fingerprint": "fp_123", | ||
"usage": undefined, | ||
}, | ||
}, | ||
"request_id": "req-123", | ||
}, | ||
"content": "", | ||
"invalid_tool_calls": [], | ||
"response_metadata": {}, | ||
"tool_call_chunks": [ | ||
{ | ||
"args": "", | ||
"id": "call-123", | ||
"index": 0, | ||
"name": "test_function", | ||
"type": "tool_call_chunk", | ||
}, | ||
], | ||
"tool_calls": [ | ||
{ | ||
"args": {}, | ||
"id": "call-123", | ||
"name": "test_function", | ||
"type": "tool_call", | ||
}, | ||
], | ||
"usage_metadata": undefined, | ||
}, | ||
"lc": 1, | ||
"type": "constructor", | ||
} | ||
`; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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()
inAIMessageChunk
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?