Skip to content

Commit aab484c

Browse files
Merge branch 'main' into mask-grounding
2 parents 11fdf80 + 8fefe94 commit aab484c

File tree

81 files changed

+380
-78
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+380
-78
lines changed

docs/guides/ORCHESTRATION_CHAT_COMPLETION.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,22 @@ var result = client.chatCompletion(prompt, configWithTemplate);
119119

120120
In this case the template is defined with the placeholder `{{?language}}` which is replaced by the value `German` in the input parameters.
121121

122+
Alternatively, you can use already prepared templates from the [Prompt Registry](https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/prompt-registry) of SAP AI Core instead of passing a template in the request yourself.
123+
124+
```java
125+
var template = TemplateConfig.reference().byId("21cb1358-0bf1-4f43-870b-00f14d0f9f16");
126+
var configWithTemplate = config.withTemplateConfig(template);
127+
128+
var inputParams = Map.of("language", "Italian", "input", "cloud ERP systems");
129+
var prompt = new OrchestrationPrompt(inputParams);
130+
131+
var result = client.chatCompletion(prompt, configWithTemplate);
132+
```
133+
134+
A prompt template can be referenced either by ID as above, or by using a combination of name, scenario, and version. For details on storing a template in the Prompt Registry, refer to [this guide](https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/create-prompt-template-imperative).
135+
136+
You can find [some examples](https://github.com/SAP/ai-sdk-java/tree/main/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/OrchestrationService.java) in our Spring Boot application demonstrating using templates from Prompt Registry.
137+
122138
## Message history
123139

124140
Include a message history to maintain context in the conversation:

docs/release-notes/release_notes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
### ✨ New Functionality
1414

15-
-
15+
- [Orchestration] [Prompt templates can be consumed from registry.](https://github.com/SAP/ai-sdk-java/tree/main/docs/guides/ORCHESTRATION_CHAT_COMPLETION.md#Chat-completion-with-Templates)
1616

1717
### 📈 Improvements
1818

orchestration/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
</developers>
3232
<properties>
3333
<project.rootdir>${project.basedir}/../</project.rootdir>
34-
<coverage.complexity>82%</coverage.complexity>
35-
<coverage.line>93%</coverage.line>
34+
<coverage.complexity>83%</coverage.complexity>
35+
<coverage.line>94%</coverage.line>
3636
<coverage.instruction>94%</coverage.instruction>
3737
<coverage.branch>75%</coverage.branch>
3838
<coverage.method>93%</coverage.method>

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import com.sap.ai.sdk.orchestration.model.ModuleConfigs;
66
import com.sap.ai.sdk.orchestration.model.OrchestrationConfig;
77
import com.sap.ai.sdk.orchestration.model.Template;
8+
import com.sap.ai.sdk.orchestration.model.TemplateRef;
89
import com.sap.ai.sdk.orchestration.model.TemplatingModuleConfig;
910
import io.vavr.control.Option;
1011
import java.util.ArrayList;
@@ -47,6 +48,9 @@ static TemplatingModuleConfig toTemplateModuleConfig(
4748
* In this case, the request will fail, since the templating module will try to resolve the parameter.
4849
* To be fixed with https://github.tools.sap/AI/llm-orchestration/issues/662
4950
*/
51+
if (config instanceof TemplateRef) {
52+
return config;
53+
}
5054
val template = config instanceof Template t ? t : Template.create().template();
5155
val messages = template.getTemplate();
5256
val responseFormat = template.getResponseFormat();

orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/AzureContentSafety.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Internal Orchestration Service API
3-
* SAP AI Core - Orchestration Service API
3+
* Orchestration is an inference service which provides common additional capabilities for business AI scenarios, such as content filtering and data masking. At the core of the service is the LLM module which allows for an easy, harmonized access to the language models of gen AI hub. The service is designed to be modular and extensible, allowing for the addition of new modules in the future. Each module can be configured independently and at runtime, allowing for a high degree of flexibility in the orchestration of AI services.
44
*
55
*
66
*

orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/AzureContentSafetyFilterConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Internal Orchestration Service API
3-
* SAP AI Core - Orchestration Service API
3+
* Orchestration is an inference service which provides common additional capabilities for business AI scenarios, such as content filtering and data masking. At the core of the service is the LLM module which allows for an easy, harmonized access to the language models of gen AI hub. The service is designed to be modular and extensible, allowing for the addition of new modules in the future. Each module can be configured independently and at runtime, allowing for a high degree of flexibility in the orchestration of AI services.
44
*
55
*
66
*

orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/AzureThreshold.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Internal Orchestration Service API
3-
* SAP AI Core - Orchestration Service API
3+
* Orchestration is an inference service which provides common additional capabilities for business AI scenarios, such as content filtering and data masking. At the core of the service is the LLM module which allows for an easy, harmonized access to the language models of gen AI hub. The service is designed to be modular and extensible, allowing for the addition of new modules in the future. Each module can be configured independently and at runtime, allowing for a high degree of flexibility in the orchestration of AI services.
44
*
55
*
66
*

orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/ChatCompletionTool.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Internal Orchestration Service API
3-
* SAP AI Core - Orchestration Service API
3+
* Orchestration is an inference service which provides common additional capabilities for business AI scenarios, such as content filtering and data masking. At the core of the service is the LLM module which allows for an easy, harmonized access to the language models of gen AI hub. The service is designed to be modular and extensible, allowing for the addition of new modules in the future. Each module can be configured independently and at runtime, allowing for a high degree of flexibility in the orchestration of AI services.
44
*
55
*
66
*

orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/ChatDelta.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Internal Orchestration Service API
3-
* SAP AI Core - Orchestration Service API
3+
* Orchestration is an inference service which provides common additional capabilities for business AI scenarios, such as content filtering and data masking. At the core of the service is the LLM module which allows for an easy, harmonized access to the language models of gen AI hub. The service is designed to be modular and extensible, allowing for the addition of new modules in the future. Each module can be configured independently and at runtime, allowing for a high degree of flexibility in the orchestration of AI services.
44
*
55
*
66
*

orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/ChatMessage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Internal Orchestration Service API
3-
* SAP AI Core - Orchestration Service API
3+
* Orchestration is an inference service which provides common additional capabilities for business AI scenarios, such as content filtering and data masking. At the core of the service is the LLM module which allows for an easy, harmonized access to the language models of gen AI hub. The service is designed to be modular and extensible, allowing for the addition of new modules in the future. Each module can be configured independently and at runtime, allowing for a high degree of flexibility in the orchestration of AI services.
44
*
55
*
66
*

0 commit comments

Comments
 (0)