Skip to content

Commit ab2d174

Browse files
Added embedding documentation (#230)
1 parent 8cc077b commit ab2d174

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

docs/guides/OPENAI_CHAT_COMPLETION.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,3 +200,15 @@ System.out.println("Tokens used: " + tokensUsed);
200200

201201
Please find [an example in our Spring Boot application](../../sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/OpenAiController.java). It shows the usage of Spring
202202
Boot's `ResponseBodyEmitter` to stream the chat completion delta messages to the frontend in real-time.
203+
204+
### Embedding
205+
206+
Get the embeddings of a text input in list of float values:
207+
208+
```java
209+
OpenAiEmbeddingParameters request = new OpenAiEmbeddingParameters().setInput("Hello World");
210+
211+
OpenAiEmbeddingOutput embedding = OpenAiClient.forModel(TEXT_EMBEDDING_ADA_002).embedding(request);
212+
```
213+
214+
See [an example in our Spring Boot application](../../sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/OpenAiController.java)

0 commit comments

Comments
 (0)