Skip to content

Commit

Permalink
Added embedding documentation (#230)
Browse files Browse the repository at this point in the history
  • Loading branch information
CharlesDuboisSAP authored Dec 6, 2024
1 parent 8cc077b commit ab2d174
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions docs/guides/OPENAI_CHAT_COMPLETION.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,3 +200,15 @@ System.out.println("Tokens used: " + tokensUsed);

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
Boot's `ResponseBodyEmitter` to stream the chat completion delta messages to the frontend in real-time.

### Embedding

Get the embeddings of a text input in list of float values:

```java
OpenAiEmbeddingParameters request = new OpenAiEmbeddingParameters().setInput("Hello World");

OpenAiEmbeddingOutput embedding = OpenAiClient.forModel(TEXT_EMBEDDING_ADA_002).embedding(request);
```

See [an example in our Spring Boot application](../../sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/OpenAiController.java)

0 comments on commit ab2d174

Please sign in to comment.