Skip to content

Commit 39e2c62

Browse files
authored
Merge branch 'main' into spec-update/prompt-registry/main
2 parents 4a88687 + 77fc250 commit 39e2c62

File tree

14 files changed

+224
-45
lines changed

14 files changed

+224
-45
lines changed

docs/release_notes.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,15 @@
1212

1313
### ✨ New Functionality
1414

15-
- [Orchestration] Added new models for `OrchestrationAiModel`: `SONAR`,`SONAR_PRO`, `GEMINI_2_5_FLASH_LITE`, `CLAUDE_4_5_HAIKU`.
15+
- [Orchestration] Added new models for `OrchestrationAiModel`: `SONAR`,`SONAR_PRO`, `GEMINI_2_5_FLASH_LITE`, `CLAUDE_4_5_HAIKU`, `GPT_REALTIME`.
1616
- [Orchestration] Convenience for adding the `metadata_params` option to grounding calls.
17+
- [Orchestration] Added new models for `OrchestrationAiModel`: `COHERE_COMMAND_A_REASONING`, `NOVA_PREMIER`, `COHERE_RERANKER`.
18+
- [Orchestration] Deprecated `DEEPSEEK_R1` model from `OrchestrationAiModel` with no replacement.
1719

1820
### 📈 Improvements
1921

20-
-
22+
- [Orchestration] Added new API `TranslationConfig#translateInputTo` to extract input config.
23+
- [Orchestration] Added new API `TranslationConfig#translateOutputTo` to extract output config.
2124

2225
### 🐛 Fixed Issues
2326

foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiModel.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ public record OpenAiModel(@Nonnull String name, @Nullable String version) implem
104104
/** Azure OpenAI GPT-5-nano model */
105105
public static final OpenAiModel GPT_5_NANO = new OpenAiModel("gpt-5-nano", null);
106106

107+
/** Azure OpenAI GPT-5-nano model */
108+
public static final OpenAiModel GPT_REALTIME = new OpenAiModel("gpt-realtime", null);
109+
107110
/**
108111
* Azure OpenAI Text Embedding ADA 002 model
109112
*

orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationAiModel.java

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ public class OrchestrationAiModel {
9494
public static final OrchestrationAiModel LLAMA3_1_70B_INSTRUCT =
9595
new OrchestrationAiModel("meta--llama3.1-70b-instruct");
9696

97+
/** Cohere Command a Reasoning model */
98+
public static final OrchestrationAiModel COHERE_COMMAND_A_REASONING =
99+
new OrchestrationAiModel("cohere--command-a-reasoning");
100+
97101
/**
98102
* Anthropic Claude 3 Sonnet model
99103
*
@@ -177,6 +181,14 @@ public class OrchestrationAiModel {
177181
public static final OrchestrationAiModel NOVA_MICRO =
178182
new OrchestrationAiModel("amazon--nova-micro");
179183

184+
/** Amazon Nova Premier model */
185+
public static final OrchestrationAiModel NOVA_PREMIER =
186+
new OrchestrationAiModel("amazon--nova-premier");
187+
188+
/** Cohere Reranker Model */
189+
public static final OrchestrationAiModel COHERE_RERANKER =
190+
new OrchestrationAiModel("cohere-reranker");
191+
180192
/**
181193
* Azure OpenAI GPT-3.5 Turbo model
182194
*
@@ -322,7 +334,12 @@ public class OrchestrationAiModel {
322334
public static final OrchestrationAiModel ALEPHALPHA_PHARIA_1_7B_CONTROL =
323335
new OrchestrationAiModel("alephalpha-pharia-1-7b-control");
324336

325-
/** DeepSeek-R1 */
337+
/**
338+
* DeepSeek-R1
339+
*
340+
* @deprecated This model is deprecated on AI Core with a planned retirement on 2025-11-31.
341+
*/
342+
@Deprecated
326343
public static final OrchestrationAiModel DEEPSEEK_R1 =
327344
new OrchestrationAiModel("deepseek-ai--deepseek-r1");
328345

orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationClientException.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ static Map<String, Object> extractInputFilterDetails(@Nullable final Orchestrati
4343
.flatMap(OrchestrationClientException::lastError)
4444
.map(Error::getIntermediateResults)
4545
.map(ModuleResults::getInputFiltering)
46-
.filter(filter -> !filter.getMessage().equals("Input Filter passed successfully."))
46+
.filter(filter -> !filter.getMessage().equals("Filtering passed successfully. "))
4747
.map(GenericModuleResult::getData)
4848
.map(map -> (Map<String, Object>) map)
4949
.orElseGet(Collections::emptyMap);
@@ -53,7 +53,7 @@ static Map<String, Object> extractInputFilterDetails(@Nullable final Orchestrati
5353
.flatMap(OrchestrationClientException::lastErrorStreaming)
5454
.map(ErrorStreaming::getIntermediateResults)
5555
.map(ModuleResultsStreaming::getInputFiltering)
56-
.filter(filter -> !filter.getMessage().equals("Input Filter passed successfully."))
56+
.filter(filter -> !filter.getMessage().equals("Filtering passed successfully. "))
5757
.map(GenericModuleResult::getData)
5858
.filter(Map.class::isInstance)
5959
.map(map -> (Map<String, Object>) map)

orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationModuleConfig.java

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,24 @@ public class OrchestrationModuleConfig {
100100
*/
101101
@Nullable GroundingModuleConfig groundingConfig;
102102

103+
/**
104+
* Configuration for translating input content before processing.
105+
*
106+
* @link <a
107+
* href="https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/enhance-model-consumption-with-translation">
108+
* SAP AI Core: Orchestration - Input Translation</a>
109+
* @since 1.8.0
110+
*/
103111
@Nullable SAPDocumentTranslationInput inputTranslationConfig;
104112

113+
/**
114+
* Configuration for translating output content after processing.
115+
*
116+
* @link <a
117+
* href="https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/enhance-model-consumption-with-output-translation">
118+
* SAP AI Core: Orchestration - Output Translation</a>
119+
* @since 1.8.0
120+
*/
105121
@Nullable SAPDocumentTranslationOutput outputTranslationConfig;
106122

107123
/** Configuration of optional streaming options for output filtering. */
@@ -304,4 +320,30 @@ public OrchestrationModuleConfig withTemplateConfig(
304320
@Nonnull final TemplateConfig templateConfig) {
305321
return this.withTemplateConfig(templateConfig.toLowLevel());
306322
}
323+
324+
/**
325+
* Configure input translation using a high-level TranslationConfig.
326+
*
327+
* @param translationConfig The translation configuration
328+
* @return A new OrchestrationModuleConfig with input translation configured
329+
*/
330+
@Tolerate
331+
@Nonnull
332+
public OrchestrationModuleConfig withInputTranslationConfig(
333+
@Nonnull final TranslationConfig.Input translationConfig) {
334+
return this.withInputTranslationConfig(translationConfig.createSAPDocumentTranslationInput());
335+
}
336+
337+
/**
338+
* Configure output translation using a high-level TranslationConfig.
339+
*
340+
* @param translationConfig The translation configuration
341+
* @return A new OrchestrationModuleConfig with output translation configured
342+
*/
343+
@Tolerate
344+
@Nonnull
345+
public OrchestrationModuleConfig withOutputTranslationConfig(
346+
@Nonnull final TranslationConfig.Output translationConfig) {
347+
return this.withOutputTranslationConfig(translationConfig.createSAPDocumentTranslationOutput());
348+
}
307349
}
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
package com.sap.ai.sdk.orchestration;
2+
3+
import com.sap.ai.sdk.orchestration.model.SAPDocumentTranslationInput;
4+
import com.sap.ai.sdk.orchestration.model.SAPDocumentTranslationInputConfig;
5+
import com.sap.ai.sdk.orchestration.model.SAPDocumentTranslationOutput;
6+
import com.sap.ai.sdk.orchestration.model.SAPDocumentTranslationOutputConfig;
7+
import com.sap.ai.sdk.orchestration.model.SAPDocumentTranslationOutputTargetLanguage;
8+
import javax.annotation.Nonnull;
9+
import lombok.AccessLevel;
10+
import lombok.RequiredArgsConstructor;
11+
import lombok.Value;
12+
import lombok.With;
13+
import lombok.val;
14+
15+
/**
16+
* Configuration helper for SAP Document Translation.
17+
*
18+
* @link <a
19+
* href="https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/sap-document-translation">SAP
20+
* AI Core: Orchestration - SAP Document Translation</a>
21+
* @since 1.14.0
22+
*/
23+
public interface TranslationConfig {
24+
/** Input configuration for translation. */
25+
@Value
26+
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
27+
class Input implements TranslationConfig {
28+
String targetLanguage;
29+
30+
@With String sourceLanguage;
31+
32+
Object ApplyTo; // Can be null
33+
34+
@Nonnull
35+
SAPDocumentTranslationInput createSAPDocumentTranslationInput() {
36+
val translationType = SAPDocumentTranslationInput.TypeEnum.SAP_DOCUMENT_TRANSLATION;
37+
val conf =
38+
SAPDocumentTranslationInputConfig.create().targetLanguage(targetLanguage).applyTo(null);
39+
return SAPDocumentTranslationInput.create().type(translationType).config(conf);
40+
}
41+
}
42+
43+
/** Output configuration for translation. */
44+
@Value
45+
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
46+
class Output implements TranslationConfig {
47+
String targetLanguage;
48+
49+
@With String sourceLanguage;
50+
51+
@Nonnull
52+
SAPDocumentTranslationOutput createSAPDocumentTranslationOutput() {
53+
val translationType = SAPDocumentTranslationOutput.TypeEnum.SAP_DOCUMENT_TRANSLATION;
54+
val tLang = SAPDocumentTranslationOutputTargetLanguage.create(targetLanguage);
55+
val conf =
56+
SAPDocumentTranslationOutputConfig.create()
57+
.targetLanguage(tLang)
58+
.sourceLanguage(sourceLanguage);
59+
return SAPDocumentTranslationOutput.create().type(translationType).config(conf);
60+
}
61+
}
62+
63+
/**
64+
* Create a new input translation configuration.
65+
*
66+
* @param targetLanguage The target language code
67+
* @link <a
68+
* href="https://help.sap.com/docs/translation-hub/sap-translation-hub/supported-languages">SAP
69+
* AI Core: Orchestration - SAP Translation Hub Table with official languages</a>
70+
* @return A TranslationConfig configured for input translation
71+
*/
72+
@Nonnull
73+
static TranslationConfig.Input translateInputTo(@Nonnull final String targetLanguage) {
74+
75+
return new TranslationConfig.Input(targetLanguage, null, null);
76+
}
77+
78+
/**
79+
* Create a new output translation configuration.
80+
*
81+
* @param targetLanguage The target language code
82+
* @link <a
83+
* href="https://help.sap.com/docs/translation-hub/sap-translation-hub/supported-languages">
84+
* SAP AI Core: Orchestration - SAP Translation Hub Table with official languages</a>
85+
* @return A TranslationConfig configured for output translation
86+
*/
87+
@Nonnull
88+
static TranslationConfig.Output translateOutputTo(@Nonnull final String targetLanguage) {
89+
90+
return new TranslationConfig.Output(targetLanguage, null);
91+
}
92+
}

orchestration/src/main/resources/spec/orchestration.yaml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ components:
112112
$ref: "#/components/schemas/EmbeddingsInputText"
113113
type:
114114
type: string
115-
enum: ["text", "document", "query"]
115+
enum: [ "text", "document", "query" ]
116116
EmbeddingsInputText:
117117
oneOf:
118118
- type: string
@@ -124,9 +124,9 @@ components:
124124
items:
125125
type: string
126126
minLength: 1
127-
example: ["Hello", "World", "!"]
127+
example: [ "Hello", "World", "!" ]
128128
description: Text input for which embeddings need to be generated
129-
example: ["This is an input string.", "This is another input string."]
129+
example: [ "This is an input string.", "This is another input string." ]
130130
EmbeddingsModuleConfigs:
131131
type: object
132132
required:
@@ -181,7 +181,7 @@ components:
181181
The number of dimensions the resulting output embeddings should have.
182182
encoding_format:
183183
type: string
184-
enum: [float, base64, binary]
184+
enum: [ float, base64, binary ]
185185
description: >
186186
OpenAI's spec allows for 'float' and 'base64' encoding formats.
187187
normalize:
@@ -466,7 +466,7 @@ components:
466466
properties:
467467
type:
468468
type: string
469-
enum: ["text"]
469+
enum: [ "text" ]
470470
text:
471471
type: string
472472
ChatDelta:
@@ -659,7 +659,7 @@ components:
659659
description: List of delimiters to split the input text into chunks.Please note, this is a required parameter when `input_translation_module_config` or `output_translation_module_config` are configured.
660660
items:
661661
type: string
662-
example: ["\n", ".", "?", "!"]
662+
example: [ "\n", ".", "?", "!" ]
663663

664664
GenericModuleResult:
665665
type: object
@@ -702,8 +702,8 @@ components:
702702
type: string
703703
example:
704704
user:
705-
["translated user content", "another translated user content"]
706-
system: ["translated system message"]
705+
[ "translated user content", "another translated user content" ]
706+
system: [ "translated system message" ]
707707
translated_placeholders:
708708
type: object
709709
additionalProperties:
@@ -1380,7 +1380,7 @@ components:
13801380
allowlist:
13811381
description: List of strings that should not be masked
13821382
type: array
1383-
example: ["SAP", "Joule"]
1383+
example: [ "SAP", "Joule" ]
13841384
items:
13851385
type: string
13861386
mask_grounding_input:
@@ -1499,7 +1499,7 @@ components:
14991499
anyOf:
15001500
- enum:
15011501
- document_grounding_service
1502-
- {}
1502+
- { }
15031503
example: document_grounding_service
15041504
config:
15051505
type: object

orchestration/src/test/java/com/sap/ai/sdk/orchestration/OrchestrationModuleConfigTest.java

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,43 @@ void testDpiMaskingRegex() {
138138
.value("**-**-*****"));
139139
}
140140

141+
@Test
142+
void testTranslationConfig() {
143+
var inputTranslationConfig =
144+
TranslationConfig.translateInputTo("en-US").withSourceLanguage("de-DE");
145+
var outputTranslationConfig =
146+
TranslationConfig.translateOutputTo("de-DE").withSourceLanguage("en-US");
147+
var config =
148+
new OrchestrationModuleConfig()
149+
.withLlmConfig(GPT_4O)
150+
.withInputTranslationConfig(inputTranslationConfig)
151+
.withOutputTranslationConfig(outputTranslationConfig);
152+
153+
assertThat(config.getInputTranslationConfig()).isNotNull();
154+
assertThat(config.getInputTranslationConfig().getConfig().getTargetLanguage())
155+
.isEqualTo("en-US");
156+
assertThat(config.getInputTranslationConfig().getConfig().getSourceLanguage())
157+
.isEqualTo(
158+
inputTranslationConfig
159+
.createSAPDocumentTranslationInput()
160+
.getConfig()
161+
.getSourceLanguage());
162+
163+
assertThat(config.getOutputTranslationConfig()).isNotNull();
164+
assertThat(config.getOutputTranslationConfig().getConfig().getTargetLanguage())
165+
.isEqualTo(
166+
outputTranslationConfig
167+
.createSAPDocumentTranslationOutput()
168+
.getConfig()
169+
.getTargetLanguage());
170+
assertThat(config.getOutputTranslationConfig().getConfig().getSourceLanguage())
171+
.isEqualTo(
172+
outputTranslationConfig
173+
.createSAPDocumentTranslationOutput()
174+
.getConfig()
175+
.getSourceLanguage());
176+
}
177+
141178
@Test
142179
void testParams() {
143180
// test withParams(Map<String, Object>)

orchestration/src/test/resources/__files/errorResponse.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"location": "request body",
77
"intermediate_results": {
88
"input_filtering": {
9-
"message": "Input Filter passed successfully.",
9+
"message": "Filtering passed successfully. ",
1010
"data": {
1111
"azure_content_safety": {
1212
"userPromptAnalysis": {

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
<javaparser.version>3.27.1</javaparser.version>
7272
<jsonschema-generator.version>4.38.0</jsonschema-generator.version>
7373
<jackson.version>2.20.1</jackson.version>
74-
<logback.version>1.5.21</logback.version>
74+
<logback.version>1.5.22</logback.version>
7575
<!-- conflicts resolution -->
7676
<micrometer.version>1.16.0</micrometer.version>
7777
<json.version>20250517</json.version>
@@ -539,7 +539,7 @@
539539
<plugin>
540540
<groupId>org.apache.maven.plugins</groupId>
541541
<artifactId>maven-resources-plugin</artifactId>
542-
<version>3.3.1</version>
542+
<version>3.4.0</version>
543543
</plugin>
544544
<!-- phase: test-compile -->
545545
<plugin>
@@ -815,7 +815,7 @@ https://gitbox.apache.org/repos/asf?p=maven-pmd-plugin.git;a=blob_plain;f=src/ma
815815
<plugin>
816816
<groupId>org.apache.maven.plugins</groupId>
817817
<artifactId>maven-source-plugin</artifactId>
818-
<version>3.3.1</version>
818+
<version>3.4.0</version>
819819
<executions>
820820
<execution>
821821
<id>attach-sources</id>

0 commit comments

Comments
 (0)