Skip to content

Commit 91da522

Browse files
committed
Merge remote-tracking branch 'refs/remotes/origin/main' into feat/openai-conv-api-msg
2 parents 0def156 + 0edd308 commit 91da522

File tree

369 files changed

+24650
-106
lines changed

Some content is hidden

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

369 files changed

+24650
-106
lines changed

.pipeline/checkstyle-suppressions.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
<suppress files="[/\\]core[/\\]model[/\\]" checks=".*"/>
1111
<suppress files="[/\\]openai[/\\]generated[/\\]model[/\\]" checks=".*"/>
1212
<suppress files="[/\\]orchestration[/\\]model[/\\]" checks=".*"/>
13+
<suppress files="[/\\]grounding[/\\]api[/\\]" checks=".*"/>
14+
<suppress files="[/\\]grounding[/\\]model[/\\]" checks=".*"/>
1315
<!-- Suppress TODOs -->
1416
<suppress files="OpenAiChatMessage.java" checks="TodoComment" lines="257,7" />
1517
<suppress files="ChatCompletionResponseMessage.java" checks="TodoComment" lines="53,34" />

.pipeline/spotbugs-exclusions.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
<Package name="com.sap.ai.sdk.core.client"/>
66
<Package name="com.sap.ai.sdk.core.model"/>
77
<Package name="com.sap.ai.sdk.orchestration.model"/>
8+
<Package name="com.sap.ai.sdk.grounding.client"/>
9+
<Package name="com.sap.ai.sdk.grounding.model"/>
810
</Or>
911
</Match>
1012
</FindBugsFilter>

README.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ For more detailed information and advanced usage, please refer to the following:
136136
- [<img src="sample-code/spring-app/src/main/resources/static/Open-AI-Logo.svg" width="16"/> OpenAI Chat Completion](docs/guides/OPENAI_CHAT_COMPLETION.md)
137137
- [<img src="https://spring.io/favicon-32x32.png" width="16"/> Spring AI Integration](docs/guides/SPRING_AI_INTEGRATION.md)
138138
- [🧰 AI Core Deployment](docs/guides/AI_CORE_DEPLOYMENT.md)
139+
- [<img src="sample-code/spring-app/src/main/resources/static/grounding.png" width="16"/> AI Core Grounding](docs/guides/GROUNDING.md)
139140

140141
For updating versions, please refer to the [**Release Notes**](docs/release-notes/release-notes-0-to-14.md).
141142

@@ -160,11 +161,20 @@ This opens up a wide range of possibilities to customize the connection, includi
160161

161162
```java
162163
var service = new AiCoreService();
163-
var service = service.withBaseDestination(
164-
DefaultHttpDestination.fromDestination(service.getBaseDestination())
165-
.header("my-header-key", "my-header-value")
166-
.build()
167-
);
164+
var destination =
165+
DefaultHttpDestination.fromDestination(service.getBaseDestination())
166+
.header("my-header-key", "my-header-value")
167+
.build();
168+
169+
// AI Core client
170+
service = service.withBaseDestination(destination);
171+
DeploymentApi client = new DeploymentApi(service);
172+
173+
// Orchestration client
174+
OrchestrationClient client = new OrchestrationClient(destination);
175+
176+
// OpenAI client
177+
OpenAiClient client2 = OpenAiClient.withCustomDestination(destination);
168178
```
169179

170180
For more information, please refer to the [AI Core connectivity guide](./docs/guides/CONNECTING_TO_AICORE.md) and the [SAP Cloud SDK documentation](https://sap.github.io/cloud-sdk/docs/java/features/connectivity/http-destinations).

core/src/main/java/com/sap/ai/sdk/core/model/AiApiError.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,18 +219,38 @@ public Set<String> getCustomFieldNames() {
219219
/**
220220
* Get the value of an unrecognizable property of this {@link AiApiError} instance.
221221
*
222+
* @deprecated Use {@link #toMap()} instead.
222223
* @param name The name of the property
223224
* @return The value of the property
224225
* @throws NoSuchElementException If no property with the given name could be found.
225226
*/
226227
@Nullable
228+
@Deprecated
227229
public Object getCustomField(@Nonnull final String name) throws NoSuchElementException {
228230
if (!cloudSdkCustomFields.containsKey(name)) {
229231
throw new NoSuchElementException("AiApiError has no field with name '" + name + "'.");
230232
}
231233
return cloudSdkCustomFields.get(name);
232234
}
233235

236+
/**
237+
* Get the value of all properties of this {@link AiApiError} instance including unrecognized
238+
* properties.
239+
*
240+
* @return The map of all properties
241+
*/
242+
@JsonIgnore
243+
@Nonnull
244+
public Map<String, Object> toMap() {
245+
final Map<String, Object> declaredFields = new LinkedHashMap<>(cloudSdkCustomFields);
246+
if (code != null) declaredFields.put("code", code);
247+
if (message != null) declaredFields.put("message", message);
248+
if (requestId != null) declaredFields.put("requestId", requestId);
249+
if (target != null) declaredFields.put("target", target);
250+
if (details != null) declaredFields.put("details", details);
251+
return declaredFields;
252+
}
253+
234254
/**
235255
* Set an unrecognizable property of this {@link AiApiError} instance. If the map previously
236256
* contained a mapping for the key, the old value is replaced by the specified value.

core/src/main/java/com/sap/ai/sdk/core/model/AiApiErrorWithId.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,18 +117,35 @@ public Set<String> getCustomFieldNames() {
117117
/**
118118
* Get the value of an unrecognizable property of this {@link AiApiErrorWithId} instance.
119119
*
120+
* @deprecated Use {@link #toMap()} instead.
120121
* @param name The name of the property
121122
* @return The value of the property
122123
* @throws NoSuchElementException If no property with the given name could be found.
123124
*/
124125
@Nullable
126+
@Deprecated
125127
public Object getCustomField(@Nonnull final String name) throws NoSuchElementException {
126128
if (!cloudSdkCustomFields.containsKey(name)) {
127129
throw new NoSuchElementException("AiApiErrorWithId has no field with name '" + name + "'.");
128130
}
129131
return cloudSdkCustomFields.get(name);
130132
}
131133

134+
/**
135+
* Get the value of all properties of this {@link AiApiErrorWithId} instance including
136+
* unrecognized properties.
137+
*
138+
* @return The map of all properties
139+
*/
140+
@JsonIgnore
141+
@Nonnull
142+
public Map<String, Object> toMap() {
143+
final Map<String, Object> declaredFields = new LinkedHashMap<>(cloudSdkCustomFields);
144+
if (id != null) declaredFields.put("id", id);
145+
if (error != null) declaredFields.put("error", error);
146+
return declaredFields;
147+
}
148+
132149
/**
133150
* Set an unrecognizable property of this {@link AiApiErrorWithId} instance. If the map previously
134151
* contained a mapping for the key, the old value is replaced by the specified value.

core/src/main/java/com/sap/ai/sdk/core/model/AiArtifact.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,18 +546,45 @@ public Set<String> getCustomFieldNames() {
546546
/**
547547
* Get the value of an unrecognizable property of this {@link AiArtifact} instance.
548548
*
549+
* @deprecated Use {@link #toMap()} instead.
549550
* @param name The name of the property
550551
* @return The value of the property
551552
* @throws NoSuchElementException If no property with the given name could be found.
552553
*/
553554
@Nullable
555+
@Deprecated
554556
public Object getCustomField(@Nonnull final String name) throws NoSuchElementException {
555557
if (!cloudSdkCustomFields.containsKey(name)) {
556558
throw new NoSuchElementException("AiArtifact has no field with name '" + name + "'.");
557559
}
558560
return cloudSdkCustomFields.get(name);
559561
}
560562

563+
/**
564+
* Get the value of all properties of this {@link AiArtifact} instance including unrecognized
565+
* properties.
566+
*
567+
* @return The map of all properties
568+
*/
569+
@JsonIgnore
570+
@Nonnull
571+
public Map<String, Object> toMap() {
572+
final Map<String, Object> declaredFields = new LinkedHashMap<>(cloudSdkCustomFields);
573+
if (labels != null) declaredFields.put("labels", labels);
574+
if (name != null) declaredFields.put("name", name);
575+
if (kind != null) declaredFields.put("kind", kind);
576+
if (url != null) declaredFields.put("url", url);
577+
if (description != null) declaredFields.put("description", description);
578+
if (id != null) declaredFields.put("id", id);
579+
if (scenarioId != null) declaredFields.put("scenarioId", scenarioId);
580+
if (configurationId != null) declaredFields.put("configurationId", configurationId);
581+
if (executionId != null) declaredFields.put("executionId", executionId);
582+
if (createdAt != null) declaredFields.put("createdAt", createdAt);
583+
if (modifiedAt != null) declaredFields.put("modifiedAt", modifiedAt);
584+
if (scenario != null) declaredFields.put("scenario", scenario);
585+
return declaredFields;
586+
}
587+
561588
/**
562589
* Set an unrecognizable property of this {@link AiArtifact} instance. If the map previously
563590
* contained a mapping for the key, the old value is replaced by the specified value.

core/src/main/java/com/sap/ai/sdk/core/model/AiArtifactArgumentBinding.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,13 @@ public Set<String> getCustomFieldNames() {
118118
/**
119119
* Get the value of an unrecognizable property of this {@link AiArtifactArgumentBinding} instance.
120120
*
121+
* @deprecated Use {@link #toMap()} instead.
121122
* @param name The name of the property
122123
* @return The value of the property
123124
* @throws NoSuchElementException If no property with the given name could be found.
124125
*/
125126
@Nullable
127+
@Deprecated
126128
public Object getCustomField(@Nonnull final String name) throws NoSuchElementException {
127129
if (!cloudSdkCustomFields.containsKey(name)) {
128130
throw new NoSuchElementException(
@@ -131,6 +133,21 @@ public Object getCustomField(@Nonnull final String name) throws NoSuchElementExc
131133
return cloudSdkCustomFields.get(name);
132134
}
133135

136+
/**
137+
* Get the value of all properties of this {@link AiArtifactArgumentBinding} instance including
138+
* unrecognized properties.
139+
*
140+
* @return The map of all properties
141+
*/
142+
@JsonIgnore
143+
@Nonnull
144+
public Map<String, Object> toMap() {
145+
final Map<String, Object> declaredFields = new LinkedHashMap<>(cloudSdkCustomFields);
146+
if (key != null) declaredFields.put("key", key);
147+
if (artifactId != null) declaredFields.put("artifactId", artifactId);
148+
return declaredFields;
149+
}
150+
134151
/**
135152
* Set an unrecognizable property of this {@link AiArtifactArgumentBinding} instance. If the map
136153
* previously contained a mapping for the key, the old value is replaced by the specified value.

core/src/main/java/com/sap/ai/sdk/core/model/AiArtifactCreationResponse.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,13 @@ public Set<String> getCustomFieldNames() {
153153
* Get the value of an unrecognizable property of this {@link AiArtifactCreationResponse}
154154
* instance.
155155
*
156+
* @deprecated Use {@link #toMap()} instead.
156157
* @param name The name of the property
157158
* @return The value of the property
158159
* @throws NoSuchElementException If no property with the given name could be found.
159160
*/
160161
@Nullable
162+
@Deprecated
161163
public Object getCustomField(@Nonnull final String name) throws NoSuchElementException {
162164
if (!cloudSdkCustomFields.containsKey(name)) {
163165
throw new NoSuchElementException(
@@ -166,6 +168,22 @@ public Object getCustomField(@Nonnull final String name) throws NoSuchElementExc
166168
return cloudSdkCustomFields.get(name);
167169
}
168170

171+
/**
172+
* Get the value of all properties of this {@link AiArtifactCreationResponse} instance including
173+
* unrecognized properties.
174+
*
175+
* @return The map of all properties
176+
*/
177+
@JsonIgnore
178+
@Nonnull
179+
public Map<String, Object> toMap() {
180+
final Map<String, Object> declaredFields = new LinkedHashMap<>(cloudSdkCustomFields);
181+
if (id != null) declaredFields.put("id", id);
182+
if (message != null) declaredFields.put("message", message);
183+
if (url != null) declaredFields.put("url", url);
184+
return declaredFields;
185+
}
186+
169187
/**
170188
* Set an unrecognizable property of this {@link AiArtifactCreationResponse} instance. If the map
171189
* previously contained a mapping for the key, the old value is replaced by the specified value.

core/src/main/java/com/sap/ai/sdk/core/model/AiArtifactList.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,18 +135,35 @@ public Set<String> getCustomFieldNames() {
135135
/**
136136
* Get the value of an unrecognizable property of this {@link AiArtifactList} instance.
137137
*
138+
* @deprecated Use {@link #toMap()} instead.
138139
* @param name The name of the property
139140
* @return The value of the property
140141
* @throws NoSuchElementException If no property with the given name could be found.
141142
*/
142143
@Nullable
144+
@Deprecated
143145
public Object getCustomField(@Nonnull final String name) throws NoSuchElementException {
144146
if (!cloudSdkCustomFields.containsKey(name)) {
145147
throw new NoSuchElementException("AiArtifactList has no field with name '" + name + "'.");
146148
}
147149
return cloudSdkCustomFields.get(name);
148150
}
149151

152+
/**
153+
* Get the value of all properties of this {@link AiArtifactList} instance including unrecognized
154+
* properties.
155+
*
156+
* @return The map of all properties
157+
*/
158+
@JsonIgnore
159+
@Nonnull
160+
public Map<String, Object> toMap() {
161+
final Map<String, Object> declaredFields = new LinkedHashMap<>(cloudSdkCustomFields);
162+
if (count != null) declaredFields.put("count", count);
163+
if (resources != null) declaredFields.put("resources", resources);
164+
return declaredFields;
165+
}
166+
150167
/**
151168
* Set an unrecognizable property of this {@link AiArtifactList} instance. If the map previously
152169
* contained a mapping for the key, the old value is replaced by the specified value.

core/src/main/java/com/sap/ai/sdk/core/model/AiArtifactPostData.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,18 +341,39 @@ public Set<String> getCustomFieldNames() {
341341
/**
342342
* Get the value of an unrecognizable property of this {@link AiArtifactPostData} instance.
343343
*
344+
* @deprecated Use {@link #toMap()} instead.
344345
* @param name The name of the property
345346
* @return The value of the property
346347
* @throws NoSuchElementException If no property with the given name could be found.
347348
*/
348349
@Nullable
350+
@Deprecated
349351
public Object getCustomField(@Nonnull final String name) throws NoSuchElementException {
350352
if (!cloudSdkCustomFields.containsKey(name)) {
351353
throw new NoSuchElementException("AiArtifactPostData has no field with name '" + name + "'.");
352354
}
353355
return cloudSdkCustomFields.get(name);
354356
}
355357

358+
/**
359+
* Get the value of all properties of this {@link AiArtifactPostData} instance including
360+
* unrecognized properties.
361+
*
362+
* @return The map of all properties
363+
*/
364+
@JsonIgnore
365+
@Nonnull
366+
public Map<String, Object> toMap() {
367+
final Map<String, Object> declaredFields = new LinkedHashMap<>(cloudSdkCustomFields);
368+
if (labels != null) declaredFields.put("labels", labels);
369+
if (name != null) declaredFields.put("name", name);
370+
if (kind != null) declaredFields.put("kind", kind);
371+
if (url != null) declaredFields.put("url", url);
372+
if (description != null) declaredFields.put("description", description);
373+
if (scenarioId != null) declaredFields.put("scenarioId", scenarioId);
374+
return declaredFields;
375+
}
376+
356377
/**
357378
* Set an unrecognizable property of this {@link AiArtifactPostData} instance. If the map
358379
* previously contained a mapping for the key, the old value is replaced by the specified value.

0 commit comments

Comments
 (0)