Skip to content

feat: support partial translation via apply_to array #768

Open
n-o-u-r-h-a-n wants to merge 21 commits intomainfrom
support-partial-translation
Open

feat: support partial translation via apply_to array #768
n-o-u-r-h-a-n wants to merge 21 commits intomainfrom
support-partial-translation

Conversation

@n-o-u-r-h-a-n
Copy link
Contributor

@n-o-u-r-h-a-n n-o-u-r-h-a-n commented Feb 25, 2026

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:

  • TranslationApplyToSelector a new class was created as a convenience builder for SAPDocumentTranslationApplyToSelector.
  • Sample code was updated.
  • Translation test was updated in OrchestrationTest.
    • New tests were added in OrchestrationModuleConfigTest to cover the new class methods.

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

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.

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)

@@ -29,13 +31,21 @@ class Input implements TranslationConfig {

@With String sourceLanguage;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mistake from your old PR:
sourceLanguage isn't being used and applied.
You should fix it and improve the unit test to make sure it is being used and applied.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's used in OrchestrationService class and all other test classes.What do you mean exactly?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants