Skip to content

Commit d45a397

Browse files
repo in parent pom
1 parent 7155ad5 commit d45a397

File tree

4 files changed

+35
-43
lines changed

4 files changed

+35
-43
lines changed

pom.xml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,24 @@
209209
<scope>test</scope>
210210
</dependency>
211211
</dependencies>
212+
<repositories>
213+
<repository>
214+
<snapshots>
215+
<enabled>true</enabled>
216+
</snapshots>
217+
<id>spring-milestones</id>
218+
<name>Spring Milestones</name>
219+
<url>https://repo.spring.io/milestone</url>
220+
</repository>
221+
<repository>
222+
<releases>
223+
<enabled>false</enabled>
224+
</releases>
225+
<id>spring-snapshots</id>
226+
<name>Spring Snapshots</name>
227+
<url>https://repo.spring.io/snapshot</url>
228+
</repository>
229+
</repositories>
212230
<build>
213231
<resources>
214232
<resource>

sample-code/spring-ai-app/pom.xml

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -97,16 +97,6 @@
9797
<groupId>org.springframework</groupId>
9898
<artifactId>spring-web</artifactId>
9999
</dependency>
100-
<dependency>
101-
<groupId>org.springframework</groupId>
102-
<artifactId>spring-webmvc</artifactId>
103-
<version>${springframework.version}</version>
104-
</dependency>
105-
<dependency>
106-
<groupId>org.springframework</groupId>
107-
<artifactId>spring-beans</artifactId>
108-
<version>${springframework.version}</version>
109-
</dependency>
110100
<dependency>
111101
<groupId>com.google.code.findbugs</groupId>
112102
<artifactId>jsr305</artifactId>
@@ -162,24 +152,6 @@
162152
<scope>test</scope>
163153
</dependency>
164154
</dependencies>
165-
<repositories>
166-
<repository>
167-
<snapshots>
168-
<enabled>true</enabled>
169-
</snapshots>
170-
<id>spring-milestones</id>
171-
<name>Spring Milestones</name>
172-
<url>https://repo.spring.io/milestone</url>
173-
</repository>
174-
<repository>
175-
<releases>
176-
<enabled>false</enabled>
177-
</releases>
178-
<id>spring-snapshots</id>
179-
<name>Spring Snapshots</name>
180-
<url>https://repo.spring.io/snapshot</url>
181-
</repository>
182-
</repositories>
183155

184156
<build>
185157
<plugins>

sample-code/spring-ai-app/src/main/java/com/sap/ai/sdk/app/controllers/OrchestrationController.java renamed to sample-code/spring-ai-app/src/main/java/com/sap/ai/sdk/app/controllers/SpringAiOrchestrationController.java

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import com.sap.ai.sdk.orchestration.spring.OrchestrationChatModel;
1010
import com.sap.ai.sdk.orchestration.spring.OrchestrationChatOptions;
1111
import java.util.Map;
12+
import lombok.val;
1213
import org.springframework.ai.chat.client.ChatClient;
1314
import org.springframework.ai.chat.client.advisor.MessageChatMemoryAdvisor;
1415
import org.springframework.ai.chat.memory.InMemoryChatMemory;
@@ -23,36 +24,36 @@
2324
/** Endpoints for the Orchestration service */
2425
@RestController
2526
@RequestMapping("/orchestration")
26-
class OrchestrationController {
27+
class SpringAiOrchestrationController {
2728

28-
ChatModel client = new OrchestrationChatModel(new OrchestrationClient());
29+
private final ChatModel client = new OrchestrationChatModel(new OrchestrationClient());
2930
private final OrchestrationModuleConfig config =
3031
new OrchestrationModuleConfig().withLlmConfig(GPT_35_TURBO);
3132
private final OrchestrationChatOptions defaultOptions = new OrchestrationChatOptions(config);
3233

3334
@GetMapping("/completion")
3435
ChatResponse completion() {
35-
var prompt = new Prompt("What is the capital of France?", defaultOptions);
36+
val prompt = new Prompt("What is the capital of France?", defaultOptions);
3637

3738
return client.call(prompt);
3839
}
3940

4041
@GetMapping("/template")
4142
ChatResponse template() {
42-
var template = new PromptTemplate("{input}");
43-
var prompt = template.create(Map.of("input", "Hello World!"), defaultOptions);
43+
val template = new PromptTemplate("{input}");
44+
val prompt = template.create(Map.of("input", "Hello World!"), defaultOptions);
4445

4546
return client.call(prompt);
4647
}
4748

4849
@GetMapping("/masking")
4950
ChatResponse masking() {
50-
var masking =
51+
val masking =
5152
DpiMasking.anonymization()
5253
.withEntities(DPIEntities.EMAIL, DPIEntities.ADDRESS, DPIEntities.LOCATION);
5354

54-
var opts = new OrchestrationChatOptions(config.withMaskingConfig(masking));
55-
var prompt =
55+
val opts = new OrchestrationChatOptions(config.withMaskingConfig(masking));
56+
val prompt =
5657
new Prompt(
5758
"Please write 'Hello World!' to me via email. My email address is [email protected]",
5859
opts);
@@ -62,11 +63,11 @@ ChatResponse masking() {
6263

6364
@GetMapping("/chatMemory")
6465
ChatResponse chatMemory() {
65-
var memory = new InMemoryChatMemory();
66-
var advisor = new MessageChatMemoryAdvisor(memory);
67-
ChatClient cl = ChatClient.builder(client).defaultAdvisors(advisor).build();
68-
var prompt1 = new Prompt("What is the capital of France?", defaultOptions);
69-
var prompt2 = new Prompt("And what is the typical food there?", defaultOptions);
66+
val memory = new InMemoryChatMemory();
67+
val advisor = new MessageChatMemoryAdvisor(memory);
68+
val cl = ChatClient.builder(client).defaultAdvisors(advisor).build();
69+
val prompt1 = new Prompt("What is the capital of France?", defaultOptions);
70+
val prompt2 = new Prompt("And what is the typical food there?", defaultOptions);
7071

7172
cl.prompt(prompt1).call();
7273
return cl.prompt(prompt2).call().chatResponse();

sample-code/spring-ai-app/src/test/java/com/sap/ai/sdk/app/controllers/OrchestrationTest.java renamed to sample-code/spring-ai-app/src/test/java/com/sap/ai/sdk/app/controllers/SpringAiOrchestrationTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
import org.junit.jupiter.api.Test;
66
import org.springframework.ai.chat.model.ChatResponse;
77

8-
public class OrchestrationTest {
8+
public class SpringAiOrchestrationTest
9+
{
910

10-
OrchestrationController controller = new OrchestrationController();
11+
SpringAiOrchestrationController controller = new SpringAiOrchestrationController();
1112

1213
@Test
1314
void testCompletion() {

0 commit comments

Comments
 (0)