Skip to content

Commit 7fef719

Browse files
committed
Minor cosmetic fix
1 parent f949fb2 commit 7fef719

File tree

1 file changed

+19
-18
lines changed
  • foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai

1 file changed

+19
-18
lines changed

foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiClient.java

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,22 @@ public OpenAiChatCompletionResponse chatCompletion(
186186
return chatCompletion(request.toCreateChatCompletionRequest());
187187
}
188188

189+
/**
190+
* Generate a completion for the given conversation and request parameters.
191+
*
192+
* @param parameters the completion request.
193+
* @return the completion output
194+
* @throws OpenAiClientException if the request fails
195+
* @deprecated Use {@link #chatCompletion(OpenAiChatCompletionRequest)} instead.
196+
*/
197+
@Deprecated(since = "1.3.0")
198+
@Nonnull
199+
public OpenAiChatCompletionOutput chatCompletion(
200+
@Nonnull final OpenAiChatCompletionParameters parameters) throws OpenAiClientException {
201+
warnIfUnsupportedUsage();
202+
return execute("/chat/completions", parameters, OpenAiChatCompletionOutput.class);
203+
}
204+
189205
/**
190206
* Stream a completion for the given string prompt as user.
191207
*
@@ -208,7 +224,7 @@ public OpenAiChatCompletionResponse chatCompletion(
208224
* Stream#parallel()} on this stream is not supported.
209225
*
210226
* @param prompt a text message.
211-
* @return A stream of message deltas
227+
* @return A stream of text chunks
212228
* @throws OpenAiClientException if the request fails or if the finish reason is content_filter
213229
* @see #streamChatCompletionDeltas(OpenAiChatCompletionRequest)
214230
*/
@@ -227,22 +243,6 @@ public Stream<String> streamChatCompletion(@Nonnull final String prompt)
227243
.map(OpenAiChatCompletionDelta::getDeltaContent);
228244
}
229245

230-
/**
231-
* Generate a completion for the given conversation and request parameters.
232-
*
233-
* @param parameters the completion request.
234-
* @return the completion output
235-
* @throws OpenAiClientException if the request fails
236-
* @deprecated Use {@link #chatCompletion(OpenAiChatCompletionRequest)} instead.
237-
*/
238-
@Deprecated(since = "1.3.0")
239-
@Nonnull
240-
public OpenAiChatCompletionOutput chatCompletion(
241-
@Nonnull final OpenAiChatCompletionParameters parameters) throws OpenAiClientException {
242-
warnIfUnsupportedUsage();
243-
return execute("/chat/completions", parameters, OpenAiChatCompletionOutput.class);
244-
}
245-
246246
/**
247247
* Stream a completion for the given conversation and request parameters.
248248
*
@@ -285,6 +285,7 @@ public Stream<OpenAiChatCompletionDelta> streamChatCompletionDeltas(
285285
* @param request The completion request.
286286
* @return A stream of message deltas
287287
* @throws OpenAiClientException if the request fails or if the finish reason is content_filter
288+
* @see #streamChatCompletionDeltas(OpenAiChatCompletionRequest) for a higher-level API
288289
*/
289290
@Nonnull
290291
public Stream<OpenAiChatCompletionDelta> streamChatCompletionDeltas(
@@ -305,7 +306,7 @@ public Stream<OpenAiChatCompletionDelta> streamChatCompletionDeltas(
305306
* <p>Example:
306307
*
307308
* <pre>{@code
308-
* try (var stream = client.streamChatCompletionDeltas(prompt)) {
309+
* try (var stream = client.streamChatCompletionDeltas(request)) {
309310
* stream
310311
* .peek(delta -> System.out.println(delta.getUsage()))
311312
* .map(com.sap.ai.sdk.foundationmodels.openai.model.OpenAiChatCompletionDelta::getDeltaContent)

0 commit comments

Comments
 (0)