generated from SAP/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: [Orchestration] Spring AI integration (#278)
* WiP * WiP 2 * finito * WiP * WiP 2 * finito * Formatting * docs * repo in parent pom * Formatting * Update docs * Aligned headers * Added no args constructor * Removed spring-ai-app * Added images in index.html * Alex's review comments * Shorter * Added instructions * M5 * fixed copy * Formatting * removed warnings * green CI * Fixed controller, added service * Removed chat Memory * Alex's review * Better documentation * Added images * Better images * mb --------- Co-authored-by: SAP Cloud SDK Bot <cloudsdk@sap.com>
- Loading branch information
1 parent
1b6d286
commit 98facc1
Showing
25 changed files
with
1,271 additions
and
76 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Spring AI Integration | ||
|
||
## Table of Contents | ||
|
||
- [Introduction](#introduction) | ||
- [Orchestration Chat Completion](#orchestration-chat-completion) | ||
- [Orchestration Masking](#orchestration-masking) | ||
|
||
## Introduction | ||
|
||
This guide provides examples of how to use our Spring AI integration with our clients in SAP AI Core | ||
for chat completion tasks using the SAP AI SDK for Java. | ||
|
||
## Orchestration Chat Completion | ||
|
||
The Orchestration client is integrated in Spring AI classes: | ||
|
||
```java | ||
ChatModel client = new OrchestrationChatModel(); | ||
OrchestrationModuleConfig config = new OrchestrationModuleConfig().withLlmConfig(GPT_35_TURBO); | ||
OrchestrationChatOptions opts = new OrchestrationChatOptions(config); | ||
|
||
Prompt prompt = new Prompt("What is the capital of France?", opts); | ||
ChatResponse response = client.call(prompt); | ||
``` | ||
|
||
Please | ||
find [an example in our Spring Boot application](../../sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/SpringAiOrchestrationController.java). | ||
|
||
## Orchestration Masking | ||
|
||
Configure Orchestration modules withing Spring AI: | ||
|
||
```java | ||
ChatModel client = new OrchestrationChatModel(); | ||
OrchestrationModuleConfig config = new OrchestrationModuleConfig().withLlmConfig(GPT_35_TURBO); | ||
|
||
val masking = | ||
DpiMasking.anonymization() | ||
.withEntities(DPIEntities.EMAIL, DPIEntities.ADDRESS, DPIEntities.LOCATION); | ||
|
||
val opts = new OrchestrationChatOptions(config.withMaskingConfig(masking)); | ||
val prompt = | ||
new Prompt( | ||
"Please write 'Hello World!' to me via email. My email address is foo.bar@baz.ai", | ||
opts); | ||
|
||
ChatResponse response = client.call(prompt); | ||
``` | ||
|
||
Please | ||
find [an example in our Spring Boot application](../../sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/SpringAiOrchestrationController.java). |
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.