-
Notifications
You must be signed in to change notification settings - Fork 15
feat: [Orchestration] Allow for streaming configuration convenience API #561
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
base: main
Are you sure you want to change the base?
Conversation
try (var requestInputStream = fileLoader.apply("groundingRequest.json")) { | ||
final String request = new String(requestInputStream.readAllBytes()); | ||
verify( | ||
postRequestedFor(urlPathEqualTo("/v2/completion")).withRequestBody(equalToJson(request))); | ||
} | ||
final String request = fileLoaderStr.apply("groundingRequest.json"); | ||
verify( | ||
postRequestedFor(urlPathEqualTo("/v2/completion")).withRequestBody(equalToJson(request))); |
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.
(Comment)
Drive-by test code change to eliminate redundant code.
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.
Can you compare this to an implementation that would accept these flags globally, together with other stream-related settings?
Considering that JS already does it that way: https://sap.github.io/ai-sdk/docs/js/orchestration/chat-completion#streaming-options and we probably need to support the other stream options as well eventually 😉
/** Configuration of optional streaming options for output filtering. */ | ||
@With(AccessLevel.NONE) | ||
@Nullable | ||
FilteringStreamOptions outputFilteringStreamOptions; | ||
|
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.
(Preference)
I like this is set on OrchestrationModuleConfig
.
I would go one more step to draft a convenience class to capture all streaming options together. This will be an abstraction over FilteringStreamOptions
and GlobalStreamOptions
(eg: chunking delimiters and chunk size)
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.
With your feedback and Matthias', I will consider an extra convenience class.
…filter-streaming-options # Conflicts: # docs/release_notes.md
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.
optional: an e2e would be nice if the unit test json resource did not come out of an e2e test
### ✨ New Functionality | ||
|
||
- | ||
- [Orchestration] For streaming, add convenience configuration AOU for output-filter-overlap, chunk-size, and delimiters via `OrchestrationModuleConfig#withStreamConfig`. |
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.
What is AOU? Those release notes are not clear.
/** Configuration of optional streaming options for output filtering. */ | ||
@With(AccessLevel.PRIVATE) // may be exposed to public in the future | ||
@Getter(AccessLevel.PACKAGE) | ||
@Nullable | ||
GlobalStreamOptions globalStreamOptions; |
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.
Wrong Javadoc? It is the same as the param above
Context
https://github.com/SAP/ai-sdk-java-backlog/issues/317
https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/streaming
(Stage 1) Allow for low-level class
OrchestrationModuleConfig config; // high-level ContentFilter azureFilter; // high-level ContentFilter llamaFilter; // high-level config .withInputFiltering(azureFilter, llamaFilter) .withOutputFiltering(azureFilter) + .withOutputFilteringStreamOptions(FilteringStreamOptions.create().overlap(1_000)) // low-level argument
(Stage 2) Allow for high-level convenience class
OrchestrationModuleConfig config; // high-level ContentFilter azureFilter; // high-level ContentFilter llamaFilter; // high-level config .withInputFiltering(azureFilter, llamaFilter) .withOutputFiltering(azureFilter) + .withStreamConfig(new OrchestrationStreamConfig().withChunkSize(42).withFilterOverlap(1_000))
Feature scope:
Definition of Done
Error handling created / updated & covered by the tests aboveAligned changes with the JavaScript SDKDocumentation updated