@@ -249,9 +249,16 @@ export namespace FilePathDeltaAnnotation {
249
249
export interface ImageFile {
250
250
/**
251
251
* The [File](https://platform.openai.com/docs/api-reference/files) ID of the image
252
- * in the message content.
252
+ * in the message content. Set `purpose="vision"` when uploading the File if you
253
+ * need to later display the file content.
253
254
*/
254
255
file_id : string ;
256
+
257
+ /**
258
+ * Specifies the detail level of the image if specified by the user. `low` uses
259
+ * fewer tokens, you can opt in to high resolution using `high`.
260
+ */
261
+ detail ?: 'auto' | 'low' | 'high' ;
255
262
}
256
263
257
264
/**
@@ -268,9 +275,16 @@ export interface ImageFileContentBlock {
268
275
}
269
276
270
277
export interface ImageFileDelta {
278
+ /**
279
+ * Specifies the detail level of the image if specified by the user. `low` uses
280
+ * fewer tokens, you can opt in to high resolution using `high`.
281
+ */
282
+ detail ?: 'auto' | 'low' | 'high' ;
283
+
271
284
/**
272
285
* The [File](https://platform.openai.com/docs/api-reference/files) ID of the image
273
- * in the message content.
286
+ * in the message content. Set `purpose="vision"` when uploading the File if you
287
+ * need to later display the file content.
274
288
*/
275
289
file_id ?: string ;
276
290
}
@@ -293,6 +307,63 @@ export interface ImageFileDeltaBlock {
293
307
image_file ?: ImageFileDelta ;
294
308
}
295
309
310
+ export interface ImageURL {
311
+ /**
312
+ * The external URL of the image, must be a supported image types: jpeg, jpg, png,
313
+ * gif, webp.
314
+ */
315
+ url : string ;
316
+
317
+ /**
318
+ * Specifies the detail level of the image. `low` uses fewer tokens, you can opt in
319
+ * to high resolution using `high`. Default value is `auto`
320
+ */
321
+ detail ?: 'auto' | 'low' | 'high' ;
322
+ }
323
+
324
+ /**
325
+ * References an image URL in the content of a message.
326
+ */
327
+ export interface ImageURLContentBlock {
328
+ image_url : ImageURL ;
329
+
330
+ /**
331
+ * The type of the content part.
332
+ */
333
+ type : 'image_url' ;
334
+ }
335
+
336
+ export interface ImageURLDelta {
337
+ /**
338
+ * Specifies the detail level of the image. `low` uses fewer tokens, you can opt in
339
+ * to high resolution using `high`.
340
+ */
341
+ detail ?: 'auto' | 'low' | 'high' ;
342
+
343
+ /**
344
+ * The URL of the image, must be a supported image types: jpeg, jpg, png, gif,
345
+ * webp.
346
+ */
347
+ url ?: string ;
348
+ }
349
+
350
+ /**
351
+ * References an image URL in the content of a message.
352
+ */
353
+ export interface ImageURLDeltaBlock {
354
+ /**
355
+ * The index of the content part in the message.
356
+ */
357
+ index : number ;
358
+
359
+ /**
360
+ * Always `image_url`.
361
+ */
362
+ type : 'image_url' ;
363
+
364
+ image_url ?: ImageURLDelta ;
365
+ }
366
+
296
367
/**
297
368
* Represents a message within a
298
369
* [thread](https://platform.openai.com/docs/api-reference/threads).
@@ -406,13 +477,19 @@ export namespace Message {
406
477
* References an image [File](https://platform.openai.com/docs/api-reference/files)
407
478
* in the content of a message.
408
479
*/
409
- export type MessageContent = ImageFileContentBlock | TextContentBlock ;
480
+ export type MessageContent = ImageFileContentBlock | ImageURLContentBlock | TextContentBlock ;
481
+
482
+ /**
483
+ * References an image [File](https://platform.openai.com/docs/api-reference/files)
484
+ * in the content of a message.
485
+ */
486
+ export type MessageContentDelta = ImageFileDeltaBlock | TextDeltaBlock | ImageURLDeltaBlock ;
410
487
411
488
/**
412
489
* References an image [File](https://platform.openai.com/docs/api-reference/files)
413
490
* in the content of a message.
414
491
*/
415
- export type MessageContentDelta = ImageFileDeltaBlock | TextDeltaBlock ;
492
+ export type MessageContentPartParam = ImageFileContentBlock | ImageURLContentBlock | TextContentBlockParam ;
416
493
417
494
export interface MessageDeleted {
418
495
id : string ;
@@ -479,6 +556,21 @@ export interface TextContentBlock {
479
556
type : 'text' ;
480
557
}
481
558
559
+ /**
560
+ * The text content that is part of a message.
561
+ */
562
+ export interface TextContentBlockParam {
563
+ /**
564
+ * Text content to be sent to the model
565
+ */
566
+ text : string ;
567
+
568
+ /**
569
+ * Always `text`.
570
+ */
571
+ type : 'text' ;
572
+ }
573
+
482
574
export interface TextDelta {
483
575
annotations ?: Array < AnnotationDelta > ;
484
576
@@ -507,9 +599,9 @@ export interface TextDeltaBlock {
507
599
508
600
export interface MessageCreateParams {
509
601
/**
510
- * The content of the message.
602
+ * The text contents of the message.
511
603
*/
512
- content : string ;
604
+ content : string | Array < MessageContentPartParam > ;
513
605
514
606
/**
515
607
* The role of the entity that is creating the message. Allowed values include:
@@ -591,14 +683,20 @@ export namespace Messages {
591
683
export import ImageFileContentBlock = MessagesAPI . ImageFileContentBlock ;
592
684
export import ImageFileDelta = MessagesAPI . ImageFileDelta ;
593
685
export import ImageFileDeltaBlock = MessagesAPI . ImageFileDeltaBlock ;
686
+ export import ImageURL = MessagesAPI . ImageURL ;
687
+ export import ImageURLContentBlock = MessagesAPI . ImageURLContentBlock ;
688
+ export import ImageURLDelta = MessagesAPI . ImageURLDelta ;
689
+ export import ImageURLDeltaBlock = MessagesAPI . ImageURLDeltaBlock ;
594
690
export import Message = MessagesAPI . Message ;
595
691
export import MessageContent = MessagesAPI . MessageContent ;
596
692
export import MessageContentDelta = MessagesAPI . MessageContentDelta ;
693
+ export import MessageContentPartParam = MessagesAPI . MessageContentPartParam ;
597
694
export import MessageDeleted = MessagesAPI . MessageDeleted ;
598
695
export import MessageDelta = MessagesAPI . MessageDelta ;
599
696
export import MessageDeltaEvent = MessagesAPI . MessageDeltaEvent ;
600
697
export import Text = MessagesAPI . Text ;
601
698
export import TextContentBlock = MessagesAPI . TextContentBlock ;
699
+ export import TextContentBlockParam = MessagesAPI . TextContentBlockParam ;
602
700
export import TextDelta = MessagesAPI . TextDelta ;
603
701
export import TextDeltaBlock = MessagesAPI . TextDeltaBlock ;
604
702
export import MessagesPage = MessagesAPI . MessagesPage ;
0 commit comments