@@ -105,21 +105,28 @@ export namespace ChatCompletion {
105
105
106
106
export interface ChatCompletionAssistantMessageParam {
107
107
/**
108
- * The contents of the assistant message .
108
+ * The role of the messages author, in this case `assistant` .
109
109
*/
110
- content : string | null ;
110
+ role : 'assistant' ;
111
111
112
112
/**
113
- * The role of the messages author, in this case `assistant`.
113
+ * The contents of the assistant message. Required unless `tool_calls` or
114
+ * `function_call` is specified.
114
115
*/
115
- role : 'assistant' ;
116
+ content ?: string | null ;
116
117
117
118
/**
118
119
* Deprecated and replaced by `tool_calls`. The name and arguments of a function
119
120
* that should be called, as generated by the model.
120
121
*/
121
122
function_call ?: ChatCompletionAssistantMessageParam . FunctionCall ;
122
123
124
+ /**
125
+ * An optional name for the participant. Provides the model information to
126
+ * differentiate between participants of the same role.
127
+ */
128
+ name ?: string ;
129
+
123
130
/**
124
131
* The tool calls generated by the model, such as function calls.
125
132
*/
@@ -309,7 +316,8 @@ export namespace ChatCompletionContentPartImage {
309
316
url : string ;
310
317
311
318
/**
312
- * Specifies the detail level of the image.
319
+ * Specifies the detail level of the image. Learn more in the
320
+ * [Vision guide](https://platform.openai.com/docs/guides/vision/low-or-high-fidelity-image-understanding).
313
321
*/
314
322
detail ?: 'auto' | 'low' | 'high' ;
315
323
}
@@ -340,9 +348,9 @@ export interface ChatCompletionFunctionCallOption {
340
348
341
349
export interface ChatCompletionFunctionMessageParam {
342
350
/**
343
- * The return value from the function call, to return to the model .
351
+ * The contents of the function message .
344
352
*/
345
- content : string | null ;
353
+ content : string ;
346
354
347
355
/**
348
356
* The name of the function to call.
@@ -451,12 +459,12 @@ export namespace ChatCompletionMessageToolCall {
451
459
* function.
452
460
*/
453
461
export interface ChatCompletionNamedToolChoice {
454
- function ? : ChatCompletionNamedToolChoice . Function ;
462
+ function : ChatCompletionNamedToolChoice . Function ;
455
463
456
464
/**
457
465
* The type of the tool. Currently, only `function` is supported.
458
466
*/
459
- type ? : 'function' ;
467
+ type : 'function' ;
460
468
}
461
469
462
470
export namespace ChatCompletionNamedToolChoice {
@@ -477,12 +485,18 @@ export interface ChatCompletionSystemMessageParam {
477
485
/**
478
486
* The contents of the system message.
479
487
*/
480
- content : string | null ;
488
+ content : string ;
481
489
482
490
/**
483
491
* The role of the messages author, in this case `system`.
484
492
*/
485
493
role : 'system' ;
494
+
495
+ /**
496
+ * An optional name for the participant. Provides the model information to
497
+ * differentiate between participants of the same role.
498
+ */
499
+ name ?: string ;
486
500
}
487
501
488
502
export interface ChatCompletionTool {
@@ -511,7 +525,7 @@ export interface ChatCompletionToolMessageParam {
511
525
/**
512
526
* The contents of the tool message.
513
527
*/
514
- content : string | null ;
528
+ content : string ;
515
529
516
530
/**
517
531
* The role of the messages author, in this case `tool`.
@@ -528,12 +542,18 @@ export interface ChatCompletionUserMessageParam {
528
542
/**
529
543
* The contents of the user message.
530
544
*/
531
- content : string | Array < ChatCompletionContentPart > | null ;
545
+ content : string | Array < ChatCompletionContentPart > ;
532
546
533
547
/**
534
548
* The role of the messages author, in this case `user`.
535
549
*/
536
550
role : 'user' ;
551
+
552
+ /**
553
+ * An optional name for the participant. Provides the model information to
554
+ * differentiate between participants of the same role.
555
+ */
556
+ name ?: string ;
537
557
}
538
558
539
559
/**
@@ -567,19 +587,19 @@ export interface ChatCompletionCreateParamsBase {
567
587
| 'gpt-4-32k'
568
588
| 'gpt-4-32k-0314'
569
589
| 'gpt-4-32k-0613'
570
- | 'gpt-3.5-turbo-1106'
571
590
| 'gpt-3.5-turbo'
572
591
| 'gpt-3.5-turbo-16k'
573
592
| 'gpt-3.5-turbo-0301'
574
593
| 'gpt-3.5-turbo-0613'
594
+ | 'gpt-3.5-turbo-1106'
575
595
| 'gpt-3.5-turbo-16k-0613' ;
576
596
577
597
/**
578
598
* Number between -2.0 and 2.0. Positive values penalize new tokens based on their
579
599
* existing frequency in the text so far, decreasing the model's likelihood to
580
600
* repeat the same line verbatim.
581
601
*
582
- * [See more information about frequency and presence penalties.](https://platform.openai.com/docs/guides/gpt /parameter-details)
602
+ * [See more information about frequency and presence penalties.](https://platform.openai.com/docs/guides/text-generation /parameter-details)
583
603
*/
584
604
frequency_penalty ?: number | null ;
585
605
@@ -627,7 +647,9 @@ export interface ChatCompletionCreateParamsBase {
627
647
max_tokens ?: number | null ;
628
648
629
649
/**
630
- * How many chat completion choices to generate for each input message.
650
+ * How many chat completion choices to generate for each input message. Note that
651
+ * you will be charged based on the number of generated tokens across all of the
652
+ * choices. Keep `n` as `1` to minimize costs.
631
653
*/
632
654
n ?: number | null ;
633
655
@@ -636,7 +658,7 @@ export interface ChatCompletionCreateParamsBase {
636
658
* whether they appear in the text so far, increasing the model's likelihood to
637
659
* talk about new topics.
638
660
*
639
- * [See more information about frequency and presence penalties.](https://platform.openai.com/docs/guides/gpt /parameter-details)
661
+ * [See more information about frequency and presence penalties.](https://platform.openai.com/docs/guides/text-generation /parameter-details)
640
662
*/
641
663
presence_penalty ?: number | null ;
642
664
@@ -649,10 +671,10 @@ export interface ChatCompletionCreateParamsBase {
649
671
* **Important:** when using JSON mode, you **must** also instruct the model to
650
672
* produce JSON yourself via a system or user message. Without this, the model may
651
673
* generate an unending stream of whitespace until the generation reaches the token
652
- * limit, resulting in increased latency and appearance of a "stuck" request. Also
653
- * note that the message content may be partially cut off if
654
- * `finish_reason="length"`, which indicates the generation exceeded `max_tokens`
655
- * or the conversation exceeded the max context length.
674
+ * limit, resulting in a long-running and seemingly "stuck" request. Also note that
675
+ * the message content may be partially cut off if `finish_reason="length"`, which
676
+ * indicates the generation exceeded `max_tokens` or the conversation exceeded the
677
+ * max context length.
656
678
*/
657
679
response_format ?: ChatCompletionCreateParams . ResponseFormat ;
658
680
@@ -734,23 +756,22 @@ export namespace ChatCompletionCreateParams {
734
756
*/
735
757
name : string ;
736
758
759
+ /**
760
+ * A description of what the function does, used by the model to choose when and
761
+ * how to call the function.
762
+ */
763
+ description ?: string ;
764
+
737
765
/**
738
766
* The parameters the functions accepts, described as a JSON Schema object. See the
739
- * [guide](https://platform.openai.com/docs/guides/gpt /function-calling) for
740
- * examples, and the
767
+ * [guide](https://platform.openai.com/docs/guides/text-generation /function-calling)
768
+ * for examples, and the
741
769
* [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for
742
770
* documentation about the format.
743
771
*
744
- * To describe a function that accepts no parameters, provide the value
745
- * `{"type": "object", "properties": {}}`.
746
- */
747
- parameters : Shared . FunctionParameters ;
748
-
749
- /**
750
- * A description of what the function does, used by the model to choose when and
751
- * how to call the function.
772
+ * Omitting `parameters` defines a function with an empty parameter list.
752
773
*/
753
- description ?: string ;
774
+ parameters ?: Shared . FunctionParameters ;
754
775
}
755
776
756
777
/**
@@ -762,10 +783,10 @@ export namespace ChatCompletionCreateParams {
762
783
* **Important:** when using JSON mode, you **must** also instruct the model to
763
784
* produce JSON yourself via a system or user message. Without this, the model may
764
785
* generate an unending stream of whitespace until the generation reaches the token
765
- * limit, resulting in increased latency and appearance of a "stuck" request. Also
766
- * note that the message content may be partially cut off if
767
- * `finish_reason="length"`, which indicates the generation exceeded `max_tokens`
768
- * or the conversation exceeded the max context length.
786
+ * limit, resulting in a long-running and seemingly "stuck" request. Also note that
787
+ * the message content may be partially cut off if `finish_reason="length"`, which
788
+ * indicates the generation exceeded `max_tokens` or the conversation exceeded the
789
+ * max context length.
769
790
*/
770
791
export interface ResponseFormat {
771
792
/**
0 commit comments