You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: [OpenAI] Update documentation and release notes for new api (#354)
* Add parallel documentation for new openai api
* Updating release notes and ToC in docs
* fixes missed test and format change
* Make version mentions bold
* Fixing docs formatting, sample messages and release notes module tagging
---------
Co-authored-by: Roshin Rajan Panackal <[email protected]>
Co-authored-by: Jonas-Isr <[email protected]>
Copy file name to clipboardExpand all lines: docs/guides/OPENAI_CHAT_COMPLETION.md
+95-4Lines changed: 95 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,7 @@
3
3
## Table of Contents
4
4
5
5
-[Introduction](#introduction)
6
+
-[New User Interface (v1.4.0)](#new-user-interface-v140)
6
7
-[Prerequisites](#prerequisites)
7
8
-[Maven Dependencies](#maven-dependencies)
8
9
-[Usage](#usage)
@@ -18,6 +19,20 @@
18
19
19
20
This guide demonstrates how to use the SAP AI SDK for Java to perform chat completion tasks using OpenAI models deployed on SAP AI Core.
20
21
22
+
### New User Interface (v1.4.0)
23
+
24
+
We're excited to introduce a new user interface for OpenAI chat completions starting with **version 1.4.0**. This update is designed to improve the SDK by:
25
+
26
+
-**Decoupling Layers:** Separating the convenience layer from the model classes to deliver a more stable and maintainable experience.
27
+
-**Staying Current:** Making it easier for the SDK to adapt to the latest changes in the OpenAI API specification.
28
+
-**Consistent Design:** Aligning with the Orchestrator convenience API for a smoother transition and easier adoption.
29
+
30
+
**Please Note:**
31
+
32
+
- The new interface is gradually being rolled out across the SDK.
33
+
- We welcome your feedback to help us refine this interface.
34
+
- The existing interface (v1.0.0) remains available for compatibility.
35
+
21
36
## Prerequisites
22
37
23
38
Before using the AI Core module, ensure that you have met all the general requirements outlined in the [README.md](../../README.md#general-requirements).
The following example demonstrate how you can leverage a concurrency-safe container (like an AtomicReference) to "listen" for usage information in any incoming delta.
207
+
208
+
```java
209
+
String question ="Can you give me the first 100 numbers of the Fibonacci sequence?";
210
+
var userMessage =OpenAiMessage.user(question);
211
+
var request =newOpenAiChatCompletionRequest(userMessage);
Please find [an example in our Spring Boot application](../../sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/OpenAiService.java). It shows the usage of Spring
209
282
Boot's `ResponseBodyEmitter` to stream the chat completion delta messages to the frontend in real-time.
210
283
284
+
</details>
285
+
211
286
## Embedding
212
287
288
+
**Since v1.4.0**
289
+
213
290
Get the embeddings of a text input in list of float values:
214
291
292
+
```java
293
+
var request =newOpenAiEmbeddingRequest(List.of("Hello World"));
Copy file name to clipboardExpand all lines: docs/release-notes/release_notes.md
+13-6Lines changed: 13 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,16 +8,23 @@
8
8
9
9
### 🔧 Compatibility Notes
10
10
11
-
- The constructors `UserMessage(MessageContent)` and `SystemMessage(MessageContent)` are removed. Use `Message.user(String)`, `Message.user(ImageItem)`, or `Message.system(String)` instead.
11
+
-[Orchestration]The constructors `UserMessage(MessageContent)` and `SystemMessage(MessageContent)` are removed. Use `Message.user(String)`, `Message.user(ImageItem)`, or `Message.system(String)` instead.
12
12
- Deprecate `getCustomField(String)` in favor of `toMap()` on generated model classes.
13
-
-`com.sap.ai.sdk.core.model.*`
14
-
-`com.sap.ai.sdk.orchestration.model.*`
13
+
-`com.sap.ai.sdk.core.model.*`
14
+
-`com.sap.ai.sdk.orchestration.model.*`
15
15
16
16
### ✨ New Functionality
17
17
18
-
-[Add Spring AI tool calling](../guides/SPRING_AI_INTEGRATION.md#tool-calling).
- New generated model classes introduced for _AzureOpenAI_ specification dated 2024-10-21.
23
+
- Introducing [new user interface](../guides/OPENAI_CHAT_COMPLETION.md/#new-user-interface-v140) for chat completion wrapping the generated model classes.
24
+
-`OpenAiChatCompletionRequest` and `OpenAiChatCompletionResponse`' for high level request and response handling.
25
+
-`OpenAiUserMessage`, `OpenAiSystemMessage`, `OpenAiAssistantMessage` and `OpenAiToolMessage` for message creation for different content types.
26
+
-`OpenAiToolChoice` for configuring chat completion requests with tool selection strategy.
27
+
- Introducing new user interface for embedding calls using `OpenAiEmbeddingRequest` and `OpenAiEmbeddingResponse`.
0 commit comments