feat: support partial translation via apply_to array #768
Open
n-o-u-r-h-a-n wants to merge 42 commits intomainfrom
Open
feat: support partial translation via apply_to array #768n-o-u-r-h-a-n wants to merge 42 commits intomainfrom
n-o-u-r-h-a-n wants to merge 42 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Make sure the API that you write is fluent.
Not readable doesn't flow:
.withApplyTo(
List.of(
TranslationApplyToSelector.placeholders(List.of("exam_type", "topic")),
TranslationApplyToSelector.templateRoles(TemplateRole.ASSISTANT)))Readable and flows:
.applyToPlaceholders("exam_type", "topic")
.applyToTemplateRoles(TemplateRole.ASSISTANT)
orchestration/src/main/java/com/sap/ai/sdk/orchestration/TranslationApplyToSelector.java
Outdated
Show resolved
Hide resolved
orchestration/src/main/java/com/sap/ai/sdk/orchestration/ApplyTo.java
Outdated
Show resolved
Hide resolved
orchestration/src/main/java/com/sap/ai/sdk/orchestration/ApplyTo.java
Outdated
Show resolved
Hide resolved
orchestration/src/main/java/com/sap/ai/sdk/orchestration/ApplyTo.java
Outdated
Show resolved
Hide resolved
sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/OrchestrationService.java
Show resolved
Hide resolved
sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/OrchestrationService.java
Outdated
Show resolved
Hide resolved
sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/OrchestrationService.java
Outdated
Show resolved
Hide resolved
orchestration/src/main/java/com/sap/ai/sdk/orchestration/TranslationConfig.java
Outdated
Show resolved
Hide resolved
sample-code/spring-app/src/test/java/com/sap/ai/sdk/app/controllers/OrchestrationTest.java
Outdated
Show resolved
Hide resolved
sample-code/spring-app/src/test/java/com/sap/ai/sdk/app/controllers/OrchestrationTest.java
Outdated
Show resolved
Hide resolved
…es/OrchestrationService.java Co-authored-by: Charles Dubois <103174266+CharlesDuboisSAP@users.noreply.github.com>
…o support-partial-translation
…o support-partial-translation
…o support-partial-translation
…o support-partial-translation
…o support-partial-translation
…o support-partial-translation # Conflicts: # orchestration/src/main/java/com/sap/ai/sdk/orchestration/TranslationConfig.java # orchestration/src/test/java/com/sap/ai/sdk/orchestration/OrchestrationModuleConfigTest.java
…o support-partial-translation
orchestration/src/main/java/com/sap/ai/sdk/orchestration/TranslationConfig.java
Outdated
Show resolved
Hide resolved
orchestration/src/main/java/com/sap/ai/sdk/orchestration/TranslationConfig.java
Show resolved
Hide resolved
orchestration/src/main/java/com/sap/ai/sdk/orchestration/TranslationConfig.java
Outdated
Show resolved
Hide resolved
orchestration/src/test/java/com/sap/ai/sdk/orchestration/OrchestrationModuleConfigTest.java
Show resolved
Hide resolved
orchestration/src/main/java/com/sap/ai/sdk/orchestration/TranslationConfig.java
Outdated
Show resolved
Hide resolved
sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/OrchestrationService.java
Show resolved
Hide resolved
…o support-partial-translation
Jonas-Isr
reviewed
Mar 3, 2026
Member
Jonas-Isr
left a comment
There was a problem hiding this comment.
Looks pretty good overall. Mostly smaller stuff I noticed 🙂
orchestration/src/main/java/com/sap/ai/sdk/orchestration/TranslationConfig.java
Outdated
Show resolved
Hide resolved
orchestration/src/main/java/com/sap/ai/sdk/orchestration/TranslationConfig.java
Outdated
Show resolved
Hide resolved
orchestration/src/main/java/com/sap/ai/sdk/orchestration/TranslationConfig.java
Outdated
Show resolved
Hide resolved
orchestration/src/main/java/com/sap/ai/sdk/orchestration/TranslationConfig.java
Show resolved
Hide resolved
…lationConfig.java Co-authored-by: Jonas-Isr <jonas.israel@sap.com>
Jonas-Isr
reviewed
Mar 4, 2026
| String targetLanguage; | ||
|
|
||
| @With String sourceLanguage; | ||
| @Getter String sourceLanguage; |
Member
There was a problem hiding this comment.
Suggested change
| @Getter String sourceLanguage; | |
| String sourceLanguage; |
You don't need the @Getter here, @Value already adds getters to the fields.
Comment on lines
+130
to
+136
| /** | ||
| * Set the source language for this translation. If no selectors are used, this applies to the | ||
| * whole message. If selectors are used, this applies to the most recently added selector. | ||
| * | ||
| * @param sourceLanguage The source language code | ||
| * @return A new Input with the given source language applied. | ||
| */ |
Member
There was a problem hiding this comment.
I think it makes sense to highlight the behaviour a bit more.
Suggested change
| /** | |
| * Set the source language for this translation. If no selectors are used, this applies to the | |
| * whole message. If selectors are used, this applies to the most recently added selector. | |
| * | |
| * @param sourceLanguage The source language code | |
| * @return A new Input with the given source language applied. | |
| */ | |
| /** | |
| * Set the source language for this translation. | |
| * <br> | |
| * <strong>Important Note:</strong> If no selectors are used, this applies to the | |
| * whole message. If selectors are used, this applies to the most recently added selector. | |
| * | |
| * @param sourceLanguage The source language code | |
| * @return A new Input with the given source language applied. | |
| */ |
| String targetLanguage; | ||
|
|
||
| @With String sourceLanguage; | ||
| @Getter @With String sourceLanguage; |
Member
There was a problem hiding this comment.
The getter is added by @Value already.
Suggested change
| @Getter @With String sourceLanguage; | |
| @With String sourceLanguage; |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Context
AI/ai-sdk-java-backlog#341.
Apply_to array is now supported instead of being set to null to support partial translation of the user's prompt.
Feature scope:
Definition of Done
Aligned changes with the JavaScript SDK