Skip to content

Conversation

newtork
Copy link
Contributor

@newtork newtork commented Aug 29, 2025

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:

  • Add convenience option

Definition of Done

  • Functionality scope stated & covered
  • Tests cover the scope above
  • Error handling created / updated & covered by the tests above
  • Aligned changes with the JavaScript SDK
  • Documentation updated
  • Release notes updated

@newtork newtork added the please-review Request to review a pull-request label Aug 29, 2025
Comment on lines -250 to +256
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)));
Copy link
Contributor Author

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.

Copy link
Member

@MatKuhr MatKuhr left a 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 😉

Comment on lines 104 to 108
/** Configuration of optional streaming options for output filtering. */
@With(AccessLevel.NONE)
@Nullable
FilteringStreamOptions outputFilteringStreamOptions;

Copy link
Member

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)

Copy link
Contributor Author

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.

@newtork newtork removed the please-review Request to review a pull-request label Sep 4, 2025
@newtork newtork changed the title feat: [Orchestration] Allow for setting convenient output filter streaming options feat: [Orchestration] Allow for streaming configuration convenience API Sep 22, 2025
@newtork newtork added the please-review Request to review a pull-request label Sep 22, 2025
Copy link
Contributor

@CharlesDuboisSAP CharlesDuboisSAP left a 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`.
Copy link
Contributor

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.

Comment on lines +112 to +116
/** 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;
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
please-review Request to review a pull-request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants