Skip to content

Commit 33ddc76

Browse files
committed
Merge branch 'main' into orchestrationConfig-persistence
# Conflicts: # docs/release_notes.md
2 parents e6a8239 + 5bfabe9 commit 33ddc76

File tree

23 files changed

+343
-71
lines changed

23 files changed

+343
-71
lines changed

core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/OrchestrationConfig.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public class OrchestrationConfig
2929
// CHECKSTYLE:ON
3030
{
3131
@JsonProperty("modules")
32-
private ModuleConfigs modules;
32+
private OrchestrationConfigModules modules;
3333

3434
@JsonProperty("stream")
3535
private GlobalStreamOptions stream;
@@ -47,7 +47,7 @@ protected OrchestrationConfig() {}
4747
* @return The same instance of this {@link OrchestrationConfig} class
4848
*/
4949
@Nonnull
50-
public OrchestrationConfig modules(@Nonnull final ModuleConfigs modules) {
50+
public OrchestrationConfig modules(@Nonnull final OrchestrationConfigModules modules) {
5151
this.modules = modules;
5252
return this;
5353
}
@@ -58,7 +58,7 @@ public OrchestrationConfig modules(@Nonnull final ModuleConfigs modules) {
5858
* @return modules The modules of this {@link OrchestrationConfig} instance.
5959
*/
6060
@Nonnull
61-
public ModuleConfigs getModules() {
61+
public OrchestrationConfigModules getModules() {
6262
return modules;
6363
}
6464

@@ -67,7 +67,7 @@ public ModuleConfigs getModules() {
6767
*
6868
* @param modules The modules of this {@link OrchestrationConfig}
6969
*/
70-
public void setModules(@Nonnull final ModuleConfigs modules) {
70+
public void setModules(@Nonnull final OrchestrationConfigModules modules) {
7171
this.modules = modules;
7272
}
7373

@@ -217,6 +217,6 @@ public interface Builder {
217217
* @param modules The modules of this {@link OrchestrationConfig}
218218
* @return The OrchestrationConfig instance.
219219
*/
220-
OrchestrationConfig modules(@Nonnull final ModuleConfigs modules);
220+
OrchestrationConfig modules(@Nonnull final OrchestrationConfigModules modules);
221221
}
222222
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/*
2+
* Prompt Registry API
3+
* Prompt Storage service for Design time & Runtime prompt templates.
4+
*
5+
*
6+
*
7+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
8+
* https://openapi-generator.tech
9+
* Do not edit the class manually.
10+
*/
11+
12+
package com.sap.ai.sdk.prompt.registry.model;
13+
14+
import java.util.List;
15+
import javax.annotation.Nonnull;
16+
17+
/** OrchestrationConfigModules */
18+
public interface OrchestrationConfigModules {
19+
/**
20+
* Helper class to create {@code ModuleConfigs } that implements {@link
21+
* OrchestrationConfigModules}.
22+
*/
23+
record InnerModuleConfigs(
24+
@com.fasterxml.jackson.annotation.JsonValue @Nonnull ModuleConfigs value)
25+
implements OrchestrationConfigModules {}
26+
27+
/**
28+
* Creator to enable deserialization of {@code ModuleConfigs }.
29+
*
30+
* @param val the value to use
31+
* @return a new instance of {@link InnerModuleConfigs}.
32+
*/
33+
@com.fasterxml.jackson.annotation.JsonCreator
34+
@Nonnull
35+
static InnerModuleConfigs createInnerModuleConfigs(@Nonnull final ModuleConfigs val) {
36+
return new InnerModuleConfigs(val);
37+
}
38+
39+
/**
40+
* Helper class to create {@code List<ModuleConfigs> } that implements {@link
41+
* OrchestrationConfigModules}.
42+
*/
43+
record ListOfModuleConfigss(
44+
@com.fasterxml.jackson.annotation.JsonValue @Nonnull List<ModuleConfigs> values)
45+
implements OrchestrationConfigModules {}
46+
47+
/**
48+
* Creator to enable deserialization of {@code List<ModuleConfigs> }.
49+
*
50+
* @param val the value to use
51+
* @return a new instance of {@link ListOfModuleConfigss}.
52+
*/
53+
@com.fasterxml.jackson.annotation.JsonCreator
54+
@Nonnull
55+
static ListOfModuleConfigss createListOfModuleConfigss(@Nonnull final List<ModuleConfigs> val) {
56+
return new ListOfModuleConfigss(val);
57+
}
58+
}

core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/PromptTemplateSubstitutionRequest.java

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ protected PromptTemplateSubstitutionRequest() {}
4545
* @return The same instance of this {@link PromptTemplateSubstitutionRequest} class
4646
*/
4747
@Nonnull
48-
public PromptTemplateSubstitutionRequest inputParams(@Nullable final Object inputParams) {
48+
public PromptTemplateSubstitutionRequest inputParams(@Nonnull final Object inputParams) {
4949
this.inputParams = inputParams;
5050
return this;
5151
}
@@ -65,7 +65,7 @@ public Object getInputParams() {
6565
*
6666
* @param inputParams The inputParams of this {@link PromptTemplateSubstitutionRequest}
6767
*/
68-
public void setInputParams(@Nullable final Object inputParams) {
68+
public void setInputParams(@Nonnull final Object inputParams) {
6969
this.inputParams = inputParams;
7070
}
7171

@@ -170,8 +170,22 @@ private String toIndentedString(final java.lang.Object o) {
170170
return o.toString().replace("\n", "\n ");
171171
}
172172

173-
/** Create a new {@link PromptTemplateSubstitutionRequest} instance. No arguments are required. */
174-
public static PromptTemplateSubstitutionRequest create() {
175-
return new PromptTemplateSubstitutionRequest();
173+
/**
174+
* Create a type-safe, fluent-api builder object to construct a new {@link
175+
* PromptTemplateSubstitutionRequest} instance with all required arguments.
176+
*/
177+
public static Builder create() {
178+
return (inputParams) -> new PromptTemplateSubstitutionRequest().inputParams(inputParams);
179+
}
180+
181+
/** Builder helper class. */
182+
public interface Builder {
183+
/**
184+
* Set the inputParams of this {@link PromptTemplateSubstitutionRequest} instance.
185+
*
186+
* @param inputParams The inputParams of this {@link PromptTemplateSubstitutionRequest}
187+
* @return The PromptTemplateSubstitutionRequest instance.
188+
*/
189+
PromptTemplateSubstitutionRequest inputParams(@Nonnull final Object inputParams);
176190
}
177191
}

core-services/prompt-registry/src/main/resources/spec/prompt-registry.yaml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -867,6 +867,8 @@ components:
867867
$ref: '#/components/schemas/PromptTemplateSpec'
868868
PromptTemplateSubstitutionRequest:
869869
type: object
870+
required:
871+
- inputParams
870872
properties:
871873
inputParams:
872874
type: object
@@ -1283,7 +1285,7 @@ components:
12831285
description: Additional parameters for the model. Default values are used for mandatory parameters.
12841286
additionalProperties: true
12851287
example:
1286-
max_tokens: 300
1288+
max_completion_tokens: 300
12871289
temperature: 0.1
12881290
frequency_penalty: 0
12891291
presence_penalty: 0
@@ -1942,6 +1944,13 @@ components:
19421944
$ref: '#/components/schemas/GroundingModuleConfig'
19431945
translation:
19441946
$ref: '#/components/schemas/TranslationModuleConfig'
1947+
ModuleConfigsList:
1948+
type: array
1949+
items:
1950+
$ref: '#/components/schemas/ModuleConfigs'
1951+
minItems: 1
1952+
description: |
1953+
A list of module configurations. The first configuration in the list that succeeds will be used.
19451954
GlobalStreamOptions:
19461955
description: Options for streaming. Will be ignored if enabled is false.
19471956
type: object
@@ -1976,7 +1985,9 @@ components:
19761985
additionalProperties: false
19771986
properties:
19781987
modules:
1979-
$ref: '#/components/schemas/ModuleConfigs'
1988+
oneOf:
1989+
- $ref: '#/components/schemas/ModuleConfigs'
1990+
- $ref: '#/components/schemas/ModuleConfigsList'
19801991
stream:
19811992
$ref: '#/components/schemas/GlobalStreamOptions'
19821993
responses:

docs/release_notes.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,17 @@
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`: `SAP_ABAP_1`, `SONAR`,`SONAR_PRO`, `GEMINI_2_5_FLASH_LITE`, `CLAUDE_4_5_HAIKU`, `GPT_REALTIME`.
1616
- [Orchestration] Configs stored in prompt registry can now be used for Orchestration calls via reference.
1717
- [Orchestration] Convenience for adding the `metadata_params` option to grounding calls.
18+
- [Orchestration] Added new models for `OrchestrationAiModel`: `COHERE_COMMAND_A_REASONING`, `NOVA_PREMIER`, `COHERE_RERANKER`.
19+
- [Orchestration] Deprecated `DEEPSEEK_R1` model from `OrchestrationAiModel` with no replacement.
1820
- [Prompt Registry] Added support to manage Orchestration configs stored in Prompt Registry.
1921

2022
### 📈 Improvements
2123

22-
-
24+
- [Orchestration] Added new API `TranslationConfig#translateInputTo` to extract input config.
25+
- [Orchestration] Added new API `TranslationConfig#translateOutputTo` to extract output config.
2326

2427
### 🐛 Fixed Issues
2528

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
*

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public Flux<ChatResponse> stream(@Nonnull final Prompt prompt) {
107107
});
108108
return flux.map(
109109
delta -> {
110-
val assistantMessage = new AssistantMessage(delta.getDeltaContent(), Map.of());
110+
val assistantMessage = new AssistantMessage(delta.getDeltaContent());
111111
val metadata =
112112
ChatGenerationMetadata.builder().finishReason(delta.getFinishReason()).build();
113113
return new ChatResponse(List.of(new Generation(assistantMessage, metadata)));
@@ -173,7 +173,8 @@ private static Generation toGeneration(
173173
}
174174
}
175175

176-
val assistantMessage = new AssistantMessage(message.getContent(), Map.of(), calls);
176+
val assistantMessage =
177+
AssistantMessage.builder().content(message.getContent()).toolCalls(calls).build();
177178
return new Generation(assistantMessage, metadata.build());
178179
}
179180

@@ -187,7 +188,10 @@ private static Generation toGeneration(
187188
@Nonnull
188189
protected static OpenAiChatCompletionRequest extractOptions(
189190
@Nonnull OpenAiChatCompletionRequest request, @Nonnull final ChatOptions options) {
190-
request = request.withStop(options.getStopSequences()).withMaxTokens(options.getMaxTokens());
191+
request =
192+
request
193+
.withStop(options.getStopSequences())
194+
.withMaxCompletionTokens(options.getMaxTokens());
191195
if (options.getTemperature() != null) {
192196
request = request.withTemperature(BigDecimal.valueOf(options.getTemperature()));
193197
}

foundation-models/openai/src/test/java/com/sap/ai/sdk/foundationmodels/openai/spring/EmbeddingModelTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import org.junit.jupiter.api.DisplayName;
2020
import org.junit.jupiter.api.Test;
2121
import org.springframework.ai.document.Document;
22-
import org.springframework.ai.embedding.EmbeddingOptionsBuilder;
22+
import org.springframework.ai.embedding.EmbeddingOptions;
2323
import org.springframework.ai.embedding.EmbeddingRequest;
2424

2525
class EmbeddingModelTest {
@@ -36,7 +36,7 @@ void setUp() {
3636
void testCallWithValidEmbeddingRequest() {
3737
val texts = List.of("Some text");
3838
val springAiRequest =
39-
new EmbeddingRequest(texts, EmbeddingOptionsBuilder.builder().withDimensions(128).build());
39+
new EmbeddingRequest(texts, EmbeddingOptions.builder().dimensions(128).build());
4040

4141
val expectedOpenAiResponse =
4242
new ObjectMapper()
@@ -67,7 +67,7 @@ void testCallWithValidEmbeddingRequest() {
6767
void testCallWithModelOptionSetThrows() {
6868
val springAiRequest =
6969
new EmbeddingRequest(
70-
List.of("Some text"), EmbeddingOptionsBuilder.builder().withModel("model").build());
70+
List.of("Some text"), EmbeddingOptions.builder().model("model").build());
7171

7272
val model = new OpenAiSpringEmbeddingModel(client);
7373

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

Lines changed: 21 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

@@ -332,6 +349,9 @@ public class OrchestrationAiModel {
332349
/** Perplexity AI Sonar Pro model */
333350
public static final OrchestrationAiModel SONAR_PRO = new OrchestrationAiModel("sonar-pro");
334351

352+
/** SAP ABAP 1 model */
353+
public static final OrchestrationAiModel SAP_ABAP_1 = new OrchestrationAiModel("sap-abap-1");
354+
335355
OrchestrationAiModel(@Nonnull final String name) {
336356
this(name, Map.of(), "latest");
337357
}

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)

0 commit comments

Comments
 (0)