@azure-rest/ai-inference 1.0.0-alpha.20250331.1 → 1.0.0-alpha.20250401.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,49 @@
1
+ # Release History
2
+
3
+ ## 1.0.0-beta.6 (2025-03-18)
4
+
5
+ ### Features Added
6
+
7
+ - Add "developer" chat role, and ChatRequestDeveloperMessage interface.
8
+ - Added audio input (data and url) to chat completions, with samples.
9
+
10
+
11
+ ### Bugs Fixed
12
+
13
+ * Re-export ErrorModel type from azure-rest/core-client (#33333)
14
+
15
+ ## 1.0.0-beta.5 (2025-01-22)
16
+
17
+ ### Breaking Changes
18
+
19
+ - Change ChatCompletionsResponseFormatJSON class name to ChatCompletionsResponseFormatJsonObject.
20
+
21
+ ### Features Added
22
+
23
+ - Add samples and tests for image embeddings.
24
+ - Add ChatCompletionsResponseFormatJsonSchema class for structured output in completions response.
25
+ - Add sample for Chat Completions with structured output
26
+
27
+ ## 1.0.0-beta.4 (2024-11-06)
28
+
29
+ ### Other Changes
30
+
31
+ - Updated README.
32
+
33
+ ## 1.0.0-beta.3 (2024-10-22)
34
+
35
+ ### Features Added
36
+
37
+ - Adds support for instrumentation using OpenTelemetry for chat completion without streaming.
38
+
39
+ ## 1.0.0-beta.2 (2024-07-17)
40
+
41
+ ### Features Added
42
+
43
+ - Adds support for text and image embeddings.
44
+
45
+ ## 1.0.0-beta.1 (2024-06-30)
46
+
47
+ ### Features Added
48
+
49
+ - This is the initial beta release for the Azure AI Inference SDK, which is a common API supporting Azure AI Inference models.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azure-rest/ai-inference",
3
- "version": "1.0.0-alpha.20250331.1",
3
+ "version": "1.0.0-alpha.20250401.2",
4
4
  "description": "Inference API for Azure-supported AI models",
5
5
  "exports": {
6
6
  "./package.json": "./package.json",
@@ -45,7 +45,9 @@
45
45
  "files": [
46
46
  "dist/",
47
47
  "README.md",
48
- "LICENSE"
48
+ "LICENSE",
49
+ "review/",
50
+ "CHANGELOG.md"
49
51
  ],
50
52
  "engines": {
51
53
  "node": ">=18.0.0"
@@ -0,0 +1,525 @@
1
+ ## API Report File for "@azure-rest/ai-inference"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ```ts
6
+
7
+ import type { Client } from '@azure-rest/core-client';
8
+ import type { ClientOptions } from '@azure-rest/core-client';
9
+ import { ErrorModel } from '@azure-rest/core-client';
10
+ import type { ErrorResponse } from '@azure-rest/core-client';
11
+ import type { HttpResponse } from '@azure-rest/core-client';
12
+ import type { KeyCredential } from '@azure/core-auth';
13
+ import type { RawHttpHeaders } from '@azure/core-rest-pipeline';
14
+ import type { RawHttpHeadersInput } from '@azure/core-rest-pipeline';
15
+ import type { RequestParameters } from '@azure-rest/core-client';
16
+ import type { StreamableMethod } from '@azure-rest/core-client';
17
+ import type { TokenCredential } from '@azure/core-auth';
18
+
19
+ // @public
20
+ export type AudioContentFormat = string;
21
+
22
+ // @public
23
+ export interface ChatChoiceOutput {
24
+ finish_reason: CompletionsFinishReasonOutput | null;
25
+ index: number;
26
+ message: ChatResponseMessageOutput;
27
+ }
28
+
29
+ // @public
30
+ export interface ChatCompletionsNamedToolChoice {
31
+ function: ChatCompletionsNamedToolChoiceFunction;
32
+ type: "function";
33
+ }
34
+
35
+ // @public
36
+ export interface ChatCompletionsNamedToolChoiceFunction {
37
+ name: string;
38
+ }
39
+
40
+ // @public
41
+ export interface ChatCompletionsOutput {
42
+ choices: Array<ChatChoiceOutput>;
43
+ created: number;
44
+ id: string;
45
+ model: string;
46
+ usage: CompletionsUsageOutput;
47
+ }
48
+
49
+ // @public
50
+ export type ChatCompletionsResponseFormat = ChatCompletionsResponseFormatParent | ChatCompletionsResponseFormatText | ChatCompletionsResponseFormatJsonObject | ChatCompletionsResponseFormatJsonSchema;
51
+
52
+ // @public
53
+ export interface ChatCompletionsResponseFormatJsonObject extends ChatCompletionsResponseFormatParent {
54
+ type: "json_object";
55
+ }
56
+
57
+ // @public
58
+ export interface ChatCompletionsResponseFormatJsonSchema extends ChatCompletionsResponseFormatParent {
59
+ json_schema: ChatCompletionsResponseFormatJsonSchemaDefinition;
60
+ type: "json_schema";
61
+ }
62
+
63
+ // @public
64
+ export interface ChatCompletionsResponseFormatJsonSchemaDefinition {
65
+ description?: string;
66
+ name: string;
67
+ schema: Record<string, unknown>;
68
+ strict?: boolean;
69
+ }
70
+
71
+ // @public
72
+ export interface ChatCompletionsResponseFormatParent {
73
+ // (undocumented)
74
+ type: string;
75
+ }
76
+
77
+ // @public
78
+ export interface ChatCompletionsResponseFormatText extends ChatCompletionsResponseFormatParent {
79
+ type: "text";
80
+ }
81
+
82
+ // @public
83
+ export interface ChatCompletionsToolCall {
84
+ function: FunctionCall;
85
+ id: string;
86
+ type: "function";
87
+ }
88
+
89
+ // @public
90
+ export interface ChatCompletionsToolCallOutput {
91
+ function: FunctionCallOutput;
92
+ id: string;
93
+ type: "function";
94
+ }
95
+
96
+ // @public
97
+ export type ChatCompletionsToolChoicePreset = string;
98
+
99
+ // @public
100
+ export interface ChatCompletionsToolDefinition {
101
+ function: FunctionDefinition;
102
+ type: "function";
103
+ }
104
+
105
+ // @public
106
+ export interface ChatMessageAudioDataContentItem extends ChatMessageContentItemParent {
107
+ input_audio: ChatMessageInputAudio;
108
+ type: "input_audio";
109
+ }
110
+
111
+ // @public
112
+ export interface ChatMessageAudioUrlContentItem extends ChatMessageContentItemParent {
113
+ audio_url: ChatMessageInputAudioUrl;
114
+ type: "audio_url";
115
+ }
116
+
117
+ // @public
118
+ export type ChatMessageContentItem = ChatMessageContentItemParent | ChatMessageTextContentItem | ChatMessageImageContentItem | ChatMessageAudioUrlContentItem | ChatMessageAudioDataContentItem;
119
+
120
+ // @public
121
+ export interface ChatMessageContentItemParent {
122
+ // (undocumented)
123
+ type: string;
124
+ }
125
+
126
+ // @public
127
+ export interface ChatMessageImageContentItem extends ChatMessageContentItemParent {
128
+ image_url: ChatMessageImageUrl;
129
+ type: "image_url";
130
+ }
131
+
132
+ // @public
133
+ export type ChatMessageImageDetailLevel = string;
134
+
135
+ // @public
136
+ export interface ChatMessageImageUrl {
137
+ detail?: ChatMessageImageDetailLevel;
138
+ url: string;
139
+ }
140
+
141
+ // @public
142
+ export interface ChatMessageInputAudio {
143
+ data: string;
144
+ format: AudioContentFormat;
145
+ }
146
+
147
+ // @public
148
+ export interface ChatMessageInputAudioUrl {
149
+ url: string;
150
+ }
151
+
152
+ // @public
153
+ export interface ChatMessageTextContentItem extends ChatMessageContentItemParent {
154
+ text: string;
155
+ type: "text";
156
+ }
157
+
158
+ // @public
159
+ export interface ChatRequestAssistantMessage extends ChatRequestMessageParent {
160
+ content?: string;
161
+ role: "assistant";
162
+ tool_calls?: Array<ChatCompletionsToolCall>;
163
+ }
164
+
165
+ // @public
166
+ export interface ChatRequestDeveloperMessage extends ChatRequestMessageParent {
167
+ content: string;
168
+ role: "developer";
169
+ }
170
+
171
+ // @public
172
+ export type ChatRequestMessage = ChatRequestMessageParent | ChatRequestSystemMessage | ChatRequestDeveloperMessage | ChatRequestUserMessage | ChatRequestAssistantMessage | ChatRequestToolMessage;
173
+
174
+ // @public
175
+ export interface ChatRequestMessageParent {
176
+ // (undocumented)
177
+ role: ChatRole;
178
+ }
179
+
180
+ // @public
181
+ export interface ChatRequestSystemMessage extends ChatRequestMessageParent {
182
+ content: string;
183
+ role: "system";
184
+ }
185
+
186
+ // @public
187
+ export interface ChatRequestToolMessage extends ChatRequestMessageParent {
188
+ content?: string;
189
+ role: "tool";
190
+ tool_call_id: string;
191
+ }
192
+
193
+ // @public
194
+ export interface ChatRequestUserMessage extends ChatRequestMessageParent {
195
+ content: string | Array<ChatMessageContentItem>;
196
+ role: "user";
197
+ }
198
+
199
+ // @public
200
+ export interface ChatResponseMessageOutput {
201
+ content: string | null;
202
+ role: ChatRoleOutput;
203
+ tool_calls?: Array<ChatCompletionsToolCallOutput>;
204
+ }
205
+
206
+ // @public
207
+ export type ChatRole = string;
208
+
209
+ // @public
210
+ export type ChatRoleOutput = string;
211
+
212
+ // @public
213
+ export type CompletionsFinishReasonOutput = string;
214
+
215
+ // @public
216
+ export interface CompletionsUsageOutput {
217
+ completion_tokens: number;
218
+ prompt_tokens: number;
219
+ total_tokens: number;
220
+ }
221
+
222
+ // @public
223
+ function createClient(endpointParam: string, credentials: TokenCredential | KeyCredential, { apiVersion, ...options }?: ModelClientOptions): ModelClient;
224
+ export default createClient;
225
+
226
+ // @public
227
+ export type EmbeddingEncodingFormat = string;
228
+
229
+ // @public
230
+ export type EmbeddingInputType = string;
231
+
232
+ // @public
233
+ export interface EmbeddingItemOutput {
234
+ embedding: string | number[];
235
+ index: number;
236
+ }
237
+
238
+ // @public
239
+ export interface EmbeddingsResultOutput {
240
+ data: Array<EmbeddingItemOutput>;
241
+ id: string;
242
+ model: string;
243
+ usage: EmbeddingsUsageOutput;
244
+ }
245
+
246
+ // @public
247
+ export interface EmbeddingsUsageOutput {
248
+ prompt_tokens: number;
249
+ total_tokens: number;
250
+ }
251
+
252
+ export { ErrorModel }
253
+
254
+ // @public
255
+ export type ExtraParameters = string;
256
+
257
+ // @public
258
+ export interface FunctionCall {
259
+ arguments: string;
260
+ name: string;
261
+ }
262
+
263
+ // @public
264
+ export interface FunctionCallOutput {
265
+ arguments: string;
266
+ name: string;
267
+ }
268
+
269
+ // @public
270
+ export interface FunctionDefinition {
271
+ description?: string;
272
+ name: string;
273
+ parameters?: unknown;
274
+ }
275
+
276
+ // @public (undocumented)
277
+ export interface GetChatCompletions {
278
+ post(options: GetChatCompletionsParameters): StreamableMethod<GetChatCompletions200Response | GetChatCompletionsDefaultResponse>;
279
+ }
280
+
281
+ // @public
282
+ export interface GetChatCompletions200Response extends HttpResponse {
283
+ // (undocumented)
284
+ body: ChatCompletionsOutput;
285
+ // (undocumented)
286
+ status: "200";
287
+ }
288
+
289
+ // @public (undocumented)
290
+ export interface GetChatCompletionsBodyParam {
291
+ // (undocumented)
292
+ body: {
293
+ messages: Array<ChatRequestMessage>;
294
+ frequency_penalty?: number;
295
+ stream?: boolean;
296
+ presence_penalty?: number;
297
+ temperature?: number;
298
+ top_p?: number;
299
+ max_tokens?: number;
300
+ response_format?: ChatCompletionsResponseFormat;
301
+ stop?: string[];
302
+ tools?: Array<ChatCompletionsToolDefinition>;
303
+ tool_choice?: ChatCompletionsToolChoicePreset | ChatCompletionsNamedToolChoice;
304
+ seed?: number;
305
+ model?: string;
306
+ };
307
+ }
308
+
309
+ // @public (undocumented)
310
+ export interface GetChatCompletionsDefaultHeaders {
311
+ "x-ms-error-code"?: string;
312
+ }
313
+
314
+ // @public (undocumented)
315
+ export interface GetChatCompletionsDefaultResponse extends HttpResponse {
316
+ // (undocumented)
317
+ body: ErrorResponse;
318
+ // (undocumented)
319
+ headers: RawHttpHeaders & GetChatCompletionsDefaultHeaders;
320
+ // (undocumented)
321
+ status: string;
322
+ }
323
+
324
+ // @public (undocumented)
325
+ export interface GetChatCompletionsHeaderParam {
326
+ // (undocumented)
327
+ headers?: RawHttpHeadersInput & GetChatCompletionsHeaders;
328
+ }
329
+
330
+ // @public (undocumented)
331
+ export interface GetChatCompletionsHeaders {
332
+ "extra-parameters"?: ExtraParameters;
333
+ }
334
+
335
+ // @public (undocumented)
336
+ export type GetChatCompletionsParameters = GetChatCompletionsHeaderParam & GetChatCompletionsBodyParam & RequestParameters;
337
+
338
+ // @public (undocumented)
339
+ export interface GetEmbeddings {
340
+ post(options: GetEmbeddingsParameters): StreamableMethod<GetEmbeddings200Response | GetEmbeddingsDefaultResponse>;
341
+ }
342
+
343
+ // @public
344
+ export interface GetEmbeddings200Response extends HttpResponse {
345
+ // (undocumented)
346
+ body: EmbeddingsResultOutput;
347
+ // (undocumented)
348
+ status: "200";
349
+ }
350
+
351
+ // @public (undocumented)
352
+ export interface GetEmbeddingsBodyParam {
353
+ // (undocumented)
354
+ body?: {
355
+ input: string[];
356
+ dimensions?: number;
357
+ encoding_format?: EmbeddingEncodingFormat;
358
+ input_type?: EmbeddingInputType;
359
+ model?: string;
360
+ };
361
+ }
362
+
363
+ // @public (undocumented)
364
+ export interface GetEmbeddingsDefaultHeaders {
365
+ "x-ms-error-code"?: string;
366
+ }
367
+
368
+ // @public (undocumented)
369
+ export interface GetEmbeddingsDefaultResponse extends HttpResponse {
370
+ // (undocumented)
371
+ body: ErrorResponse;
372
+ // (undocumented)
373
+ headers: RawHttpHeaders & GetEmbeddingsDefaultHeaders;
374
+ // (undocumented)
375
+ status: string;
376
+ }
377
+
378
+ // @public (undocumented)
379
+ export interface GetEmbeddingsHeaderParam {
380
+ // (undocumented)
381
+ headers?: RawHttpHeadersInput & GetEmbeddingsHeaders;
382
+ }
383
+
384
+ // @public (undocumented)
385
+ export interface GetEmbeddingsHeaders {
386
+ "extra-parameters"?: ExtraParameters;
387
+ }
388
+
389
+ // @public (undocumented)
390
+ export type GetEmbeddingsParameters = GetEmbeddingsHeaderParam & GetEmbeddingsBodyParam & RequestParameters;
391
+
392
+ // @public (undocumented)
393
+ export interface GetImageEmbeddings {
394
+ post(options: GetImageEmbeddingsParameters): StreamableMethod<GetImageEmbeddings200Response | GetImageEmbeddingsDefaultResponse>;
395
+ }
396
+
397
+ // @public
398
+ export interface GetImageEmbeddings200Response extends HttpResponse {
399
+ // (undocumented)
400
+ body: EmbeddingsResultOutput;
401
+ // (undocumented)
402
+ status: "200";
403
+ }
404
+
405
+ // @public (undocumented)
406
+ export interface GetImageEmbeddingsBodyParam {
407
+ // (undocumented)
408
+ body: {
409
+ input: Array<ImageEmbeddingInput>;
410
+ dimensions?: number;
411
+ encoding_format?: EmbeddingEncodingFormat;
412
+ input_type?: EmbeddingInputType;
413
+ model?: string;
414
+ };
415
+ }
416
+
417
+ // @public (undocumented)
418
+ export interface GetImageEmbeddingsDefaultHeaders {
419
+ "x-ms-error-code"?: string;
420
+ }
421
+
422
+ // @public (undocumented)
423
+ export interface GetImageEmbeddingsDefaultResponse extends HttpResponse {
424
+ // (undocumented)
425
+ body: ErrorResponse;
426
+ // (undocumented)
427
+ headers: RawHttpHeaders & GetImageEmbeddingsDefaultHeaders;
428
+ // (undocumented)
429
+ status: string;
430
+ }
431
+
432
+ // @public (undocumented)
433
+ export interface GetImageEmbeddingsHeaderParam {
434
+ // (undocumented)
435
+ headers?: RawHttpHeadersInput & GetImageEmbeddingsHeaders;
436
+ }
437
+
438
+ // @public (undocumented)
439
+ export interface GetImageEmbeddingsHeaders {
440
+ "extra-parameters"?: ExtraParameters;
441
+ }
442
+
443
+ // @public (undocumented)
444
+ export type GetImageEmbeddingsParameters = GetImageEmbeddingsHeaderParam & GetImageEmbeddingsBodyParam & RequestParameters;
445
+
446
+ // @public (undocumented)
447
+ export interface GetModelInfo {
448
+ get(options?: GetModelInfoParameters): StreamableMethod<GetModelInfo200Response | GetModelInfoDefaultResponse>;
449
+ }
450
+
451
+ // @public
452
+ export interface GetModelInfo200Response extends HttpResponse {
453
+ // (undocumented)
454
+ body: ModelInfoOutput;
455
+ // (undocumented)
456
+ status: "200";
457
+ }
458
+
459
+ // @public (undocumented)
460
+ export interface GetModelInfoDefaultHeaders {
461
+ "x-ms-error-code"?: string;
462
+ }
463
+
464
+ // @public (undocumented)
465
+ export interface GetModelInfoDefaultResponse extends HttpResponse {
466
+ // (undocumented)
467
+ body: ErrorResponse;
468
+ // (undocumented)
469
+ headers: RawHttpHeaders & GetModelInfoDefaultHeaders;
470
+ // (undocumented)
471
+ status: string;
472
+ }
473
+
474
+ // @public (undocumented)
475
+ export type GetModelInfoParameters = RequestParameters;
476
+
477
+ // @public
478
+ export interface ImageEmbeddingInput {
479
+ image: string;
480
+ text?: string;
481
+ }
482
+
483
+ // @public (undocumented)
484
+ export function isUnexpected(response: GetChatCompletions200Response | GetChatCompletionsDefaultResponse): response is GetChatCompletionsDefaultResponse;
485
+
486
+ // @public (undocumented)
487
+ export function isUnexpected(response: GetModelInfo200Response | GetModelInfoDefaultResponse): response is GetModelInfoDefaultResponse;
488
+
489
+ // @public (undocumented)
490
+ export function isUnexpected(response: GetEmbeddings200Response | GetEmbeddingsDefaultResponse): response is GetEmbeddingsDefaultResponse;
491
+
492
+ // @public (undocumented)
493
+ export function isUnexpected(response: GetImageEmbeddings200Response | GetImageEmbeddingsDefaultResponse): response is GetImageEmbeddingsDefaultResponse;
494
+
495
+ // @public (undocumented)
496
+ export type ModelClient = Client & {
497
+ path: Routes;
498
+ };
499
+
500
+ // @public
501
+ export interface ModelClientOptions extends ClientOptions {
502
+ apiVersion?: string;
503
+ }
504
+
505
+ // @public
506
+ export interface ModelInfoOutput {
507
+ model_name: string;
508
+ model_provider_name: string;
509
+ model_type: ModelTypeOutput;
510
+ }
511
+
512
+ // @public
513
+ export type ModelTypeOutput = string;
514
+
515
+ // @public (undocumented)
516
+ export interface Routes {
517
+ (path: "/chat/completions"): GetChatCompletions;
518
+ (path: "/info"): GetModelInfo;
519
+ (path: "/embeddings"): GetEmbeddings;
520
+ (path: "/images/embeddings"): GetImageEmbeddings;
521
+ }
522
+
523
+ // (No @packageDocumentation comment for this package)
524
+
525
+ ```