@@ -71,7 +71,8 @@ public final class OpenAIAsyncClient {
71
71
* }
72
72
* }</pre>
73
73
*
74
- * @param deploymentId deployment id of the deployed model.
74
+ * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name
75
+ * (when using non-Azure OpenAI) to use for this request.
75
76
* @param embeddingsOptions The configuration information for an embeddings request. Embeddings measure the
76
77
* relatedness of text strings and are commonly used for search, clustering, recommendations, and other similar
77
78
* scenarios.
@@ -86,10 +87,12 @@ public final class OpenAIAsyncClient {
86
87
*/
87
88
@ ServiceMethod (returns = ReturnType .SINGLE )
88
89
public Mono <Response <BinaryData >> getEmbeddingsWithResponse (
89
- String deploymentId , BinaryData embeddingsOptions , RequestOptions requestOptions ) {
90
+ String deploymentOrModelName , BinaryData embeddingsOptions , RequestOptions requestOptions ) {
90
91
return openAIServiceClient != null
91
- ? openAIServiceClient .getEmbeddingsWithResponseAsync (deploymentId , embeddingsOptions , requestOptions )
92
- : serviceClient .getEmbeddingsWithResponseAsync (deploymentId , embeddingsOptions , requestOptions );
92
+ ? openAIServiceClient .getEmbeddingsWithResponseAsync (
93
+ deploymentOrModelName , embeddingsOptions , requestOptions )
94
+ : serviceClient .getEmbeddingsWithResponseAsync (
95
+ deploymentOrModelName , embeddingsOptions , requestOptions );
93
96
}
94
97
95
98
/**
@@ -161,7 +164,8 @@ public Mono<Response<BinaryData>> getEmbeddingsWithResponse(
161
164
* }
162
165
* }</pre>
163
166
*
164
- * @param deploymentId deployment id of the deployed model.
167
+ * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name
168
+ * (when using non-Azure OpenAI) to use for this request.
165
169
* @param completionsOptions The configuration information for a completions request. Completions support a wide
166
170
* variety of tasks and generate text that continues from or "completes" provided prompt data.
167
171
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
@@ -175,10 +179,12 @@ public Mono<Response<BinaryData>> getEmbeddingsWithResponse(
175
179
*/
176
180
@ ServiceMethod (returns = ReturnType .SINGLE )
177
181
public Mono <Response <BinaryData >> getCompletionsWithResponse (
178
- String deploymentId , BinaryData completionsOptions , RequestOptions requestOptions ) {
182
+ String deploymentOrModelName , BinaryData completionsOptions , RequestOptions requestOptions ) {
179
183
return openAIServiceClient != null
180
- ? openAIServiceClient .getCompletionsWithResponseAsync (deploymentId , completionsOptions , requestOptions )
181
- : serviceClient .getCompletionsWithResponseAsync (deploymentId , completionsOptions , requestOptions );
184
+ ? openAIServiceClient .getCompletionsWithResponseAsync (
185
+ deploymentOrModelName , completionsOptions , requestOptions )
186
+ : serviceClient .getCompletionsWithResponseAsync (
187
+ deploymentOrModelName , completionsOptions , requestOptions );
182
188
}
183
189
184
190
/**
@@ -241,7 +247,8 @@ public Mono<Response<BinaryData>> getCompletionsWithResponse(
241
247
* }
242
248
* }</pre>
243
249
*
244
- * @param deploymentId deployment id of the deployed model.
250
+ * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name
251
+ * (when using non-Azure OpenAI) to use for this request.
245
252
* @param chatCompletionsOptions The configuration information for a chat completions request. Completions support a
246
253
* wide variety of tasks and generate text that continues from or "completes" provided prompt data.
247
254
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
@@ -255,18 +262,19 @@ public Mono<Response<BinaryData>> getCompletionsWithResponse(
255
262
*/
256
263
@ ServiceMethod (returns = ReturnType .SINGLE )
257
264
public Mono <Response <BinaryData >> getChatCompletionsWithResponse (
258
- String deploymentId , BinaryData chatCompletionsOptions , RequestOptions requestOptions ) {
265
+ String deploymentOrModelName , BinaryData chatCompletionsOptions , RequestOptions requestOptions ) {
259
266
return openAIServiceClient != null
260
267
? openAIServiceClient .getChatCompletionsWithResponseAsync (
261
- deploymentId , chatCompletionsOptions , requestOptions )
268
+ deploymentOrModelName , chatCompletionsOptions , requestOptions )
262
269
: serviceClient .getChatCompletionsWithResponseAsync (
263
- deploymentId , chatCompletionsOptions , requestOptions );
270
+ deploymentOrModelName , chatCompletionsOptions , requestOptions );
264
271
}
265
272
266
273
/**
267
274
* Return the embeddings for a given prompt.
268
275
*
269
- * @param deploymentId deployment id of the deployed model.
276
+ * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name
277
+ * (when using non-Azure OpenAI) to use for this request.
270
278
* @param embeddingsOptions The configuration information for an embeddings request. Embeddings measure the
271
279
* relatedness of text strings and are commonly used for search, clustering, recommendations, and other similar
272
280
* scenarios.
@@ -282,10 +290,11 @@ public Mono<Response<BinaryData>> getChatCompletionsWithResponse(
282
290
*/
283
291
@ Generated
284
292
@ ServiceMethod (returns = ReturnType .SINGLE )
285
- public Mono <Embeddings > getEmbeddings (String deploymentId , EmbeddingsOptions embeddingsOptions ) {
293
+ public Mono <Embeddings > getEmbeddings (String deploymentOrModelName , EmbeddingsOptions embeddingsOptions ) {
286
294
// Generated convenience method for getEmbeddingsWithResponse
287
295
RequestOptions requestOptions = new RequestOptions ();
288
- return getEmbeddingsWithResponse (deploymentId , BinaryData .fromObject (embeddingsOptions ), requestOptions )
296
+ return getEmbeddingsWithResponse (
297
+ deploymentOrModelName , BinaryData .fromObject (embeddingsOptions ), requestOptions )
289
298
.flatMap (FluxUtil ::toMono )
290
299
.map (protocolMethodData -> protocolMethodData .toObject (Embeddings .class ));
291
300
}
@@ -294,7 +303,8 @@ public Mono<Embeddings> getEmbeddings(String deploymentId, EmbeddingsOptions emb
294
303
* Gets completions for the provided input prompts. Completions support a wide variety of tasks and generate text
295
304
* that continues from or "completes" provided prompt data.
296
305
*
297
- * @param deploymentId deployment id of the deployed model.
306
+ * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name
307
+ * (when using non-Azure OpenAI) to use for this request.
298
308
* @param completionsOptions The configuration information for a completions request. Completions support a wide
299
309
* variety of tasks and generate text that continues from or "completes" provided prompt data.
300
310
* @throws IllegalArgumentException thrown if parameters fail the validation.
@@ -308,10 +318,11 @@ public Mono<Embeddings> getEmbeddings(String deploymentId, EmbeddingsOptions emb
308
318
*/
309
319
@ Generated
310
320
@ ServiceMethod (returns = ReturnType .SINGLE )
311
- public Mono <Completions > getCompletions (String deploymentId , CompletionsOptions completionsOptions ) {
321
+ public Mono <Completions > getCompletions (String deploymentOrModelName , CompletionsOptions completionsOptions ) {
312
322
// Generated convenience method for getCompletionsWithResponse
313
323
RequestOptions requestOptions = new RequestOptions ();
314
- return getCompletionsWithResponse (deploymentId , BinaryData .fromObject (completionsOptions ), requestOptions )
324
+ return getCompletionsWithResponse (
325
+ deploymentOrModelName , BinaryData .fromObject (completionsOptions ), requestOptions )
315
326
.flatMap (FluxUtil ::toMono )
316
327
.map (protocolMethodData -> protocolMethodData .toObject (Completions .class ));
317
328
}
@@ -320,7 +331,8 @@ public Mono<Completions> getCompletions(String deploymentId, CompletionsOptions
320
331
* Gets completions for the provided input prompt. Completions support a wide variety of tasks and generate text
321
332
* that continues from or "completes" provided prompt data.
322
333
*
323
- * @param deploymentId deployment id of the deployed model.
334
+ * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name
335
+ * (when using non-Azure OpenAI) to use for this request.
324
336
* @param prompt The prompt to generate completion text from.
325
337
* @throws IllegalArgumentException thrown if parameters fail the validation.
326
338
* @throws HttpResponseException thrown if the request is rejected by server.
@@ -332,15 +344,16 @@ public Mono<Completions> getCompletions(String deploymentId, CompletionsOptions
332
344
* that continues from or "completes" provided prompt data on successful completion of {@link Mono}.
333
345
*/
334
346
@ ServiceMethod (returns = ReturnType .SINGLE )
335
- public Mono <Completions > getCompletions (String deploymentId , String prompt ) {
336
- return getCompletions (deploymentId , CompletionsUtils .defaultCompletionsOptions (prompt ));
347
+ public Mono <Completions > getCompletions (String deploymentOrModelName , String prompt ) {
348
+ return getCompletions (deploymentOrModelName , CompletionsUtils .defaultCompletionsOptions (prompt ));
337
349
}
338
350
339
351
/**
340
352
* Gets completions as a stream for the provided input prompts. Completions support a wide variety of tasks and
341
353
* generate text that continues from or "completes" provided prompt data.
342
354
*
343
- * @param deploymentId deployment id of the deployed model.
355
+ * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name
356
+ * (when using non-Azure OpenAI) to use for this request.
344
357
* @param completionsOptions The configuration information for a completions request. Completions support a wide
345
358
* variety of tasks and generate text that continues from or "completes" provided prompt data.
346
359
* @throws IllegalArgumentException thrown if parameters fail the validation.
@@ -353,12 +366,12 @@ public Mono<Completions> getCompletions(String deploymentId, String prompt) {
353
366
* and generate text that continues from or "completes" provided prompt data.
354
367
*/
355
368
@ ServiceMethod (returns = ReturnType .COLLECTION )
356
- public Flux <Completions > getCompletionsStream (String deploymentId , CompletionsOptions completionsOptions ) {
369
+ public Flux <Completions > getCompletionsStream (String deploymentOrModelName , CompletionsOptions completionsOptions ) {
357
370
completionsOptions .setStream (true );
358
371
RequestOptions requestOptions = new RequestOptions ();
359
372
BinaryData requestBody = BinaryData .fromObject (completionsOptions );
360
373
Flux <ByteBuffer > responseStream =
361
- getCompletionsWithResponse (deploymentId , requestBody , requestOptions )
374
+ getCompletionsWithResponse (deploymentOrModelName , requestBody , requestOptions )
362
375
.flatMapMany (response -> response .getValue ().toFluxByteBuffer ());
363
376
OpenAIServerSentEvents <Completions > completionsStream =
364
377
new OpenAIServerSentEvents <>(responseStream , Completions .class );
@@ -369,7 +382,8 @@ public Flux<Completions> getCompletionsStream(String deploymentId, CompletionsOp
369
382
* Gets chat completions for the provided chat messages. Completions support a wide variety of tasks and generate
370
383
* text that continues from or "completes" provided prompt data.
371
384
*
372
- * @param deploymentId deployment id of the deployed model.
385
+ * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name
386
+ * (when using non-Azure OpenAI) to use for this request.
373
387
* @param chatCompletionsOptions The configuration information for a chat completions request. Completions support a
374
388
* wide variety of tasks and generate text that continues from or "completes" provided prompt data.
375
389
* @throws IllegalArgumentException thrown if parameters fail the validation.
@@ -384,11 +398,11 @@ public Flux<Completions> getCompletionsStream(String deploymentId, CompletionsOp
384
398
@ Generated
385
399
@ ServiceMethod (returns = ReturnType .SINGLE )
386
400
public Mono <ChatCompletions > getChatCompletions (
387
- String deploymentId , ChatCompletionsOptions chatCompletionsOptions ) {
401
+ String deploymentOrModelName , ChatCompletionsOptions chatCompletionsOptions ) {
388
402
// Generated convenience method for getChatCompletionsWithResponse
389
403
RequestOptions requestOptions = new RequestOptions ();
390
404
return getChatCompletionsWithResponse (
391
- deploymentId , BinaryData .fromObject (chatCompletionsOptions ), requestOptions )
405
+ deploymentOrModelName , BinaryData .fromObject (chatCompletionsOptions ), requestOptions )
392
406
.flatMap (FluxUtil ::toMono )
393
407
.map (protocolMethodData -> protocolMethodData .toObject (ChatCompletions .class ));
394
408
}
@@ -397,7 +411,8 @@ public Mono<ChatCompletions> getChatCompletions(
397
411
* Gets chat completions for the provided chat messages. Chat completions support a wide variety of tasks and
398
412
* generate text that continues from or "completes" provided prompt data.
399
413
*
400
- * @param deploymentId deployment id of the deployed model.
414
+ * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name
415
+ * (when using non-Azure OpenAI) to use for this request.
401
416
* @param chatCompletionsOptions The configuration information for a chat completions request. Completions support a
402
417
* wide variety of tasks and generate text that continues from or "completes" provided prompt data.
403
418
* @throws IllegalArgumentException thrown if parameters fail the validation.
@@ -411,12 +426,12 @@ public Mono<ChatCompletions> getChatCompletions(
411
426
*/
412
427
@ ServiceMethod (returns = ReturnType .COLLECTION )
413
428
public Flux <ChatCompletions > getChatCompletionsStream (
414
- String deploymentId , ChatCompletionsOptions chatCompletionsOptions ) {
429
+ String deploymentOrModelName , ChatCompletionsOptions chatCompletionsOptions ) {
415
430
chatCompletionsOptions .setStream (true );
416
431
RequestOptions requestOptions = new RequestOptions ();
417
432
Flux <ByteBuffer > responseStream =
418
433
getChatCompletionsWithResponse (
419
- deploymentId , BinaryData .fromObject (chatCompletionsOptions ), requestOptions )
434
+ deploymentOrModelName , BinaryData .fromObject (chatCompletionsOptions ), requestOptions )
420
435
.flatMapMany (response -> response .getValue ().toFluxByteBuffer ());
421
436
OpenAIServerSentEvents <ChatCompletions > chatCompletionsStream =
422
437
new OpenAIServerSentEvents <>(responseStream , ChatCompletions .class );
0 commit comments