@@ -15,6 +15,12 @@ export class Completions extends APIResource {
15
15
* [text generation](https://platform.openai.com/docs/guides/text-generation),
16
16
* [vision](https://platform.openai.com/docs/guides/vision), and
17
17
* [audio](https://platform.openai.com/docs/guides/audio) guides.
18
+ *
19
+ * Parameter support can differ depending on the model used to generate the
20
+ * response, particularly for newer reasoning models. Parameters that are only
21
+ * supported for reasoning models are noted below. For the current state of
22
+ * unsupported parameters in reasoning models,
23
+ * [refer to the reasoning guide](https://platform.openai.com/docs/guides/reasoning).
18
24
*/
19
25
create (
20
26
body : ChatCompletionCreateParamsNonStreaming ,
@@ -135,6 +141,9 @@ export namespace ChatCompletion {
135
141
}
136
142
}
137
143
144
+ /**
145
+ * Messages sent by the model in response to user messages.
146
+ */
138
147
export interface ChatCompletionAssistantMessageParam {
139
148
/**
140
149
* The role of the messages author, in this case `assistant`.
@@ -530,6 +539,29 @@ export interface ChatCompletionContentPartText {
530
539
type : 'text' ;
531
540
}
532
541
542
+ /**
543
+ * Developer-provided instructions that the model should follow, regardless of
544
+ * messages sent by the user. With o1 models and newer, `developer` messages
545
+ * replace the previous `system` messages.
546
+ */
547
+ export interface ChatCompletionDeveloperMessageParam {
548
+ /**
549
+ * The contents of the developer message.
550
+ */
551
+ content : string | Array < ChatCompletionContentPartText > ;
552
+
553
+ /**
554
+ * The role of the messages author, in this case `developer`.
555
+ */
556
+ role : 'developer' ;
557
+
558
+ /**
559
+ * An optional name for the participant. Provides the model information to
560
+ * differentiate between participants of the same role.
561
+ */
562
+ name ?: string ;
563
+ }
564
+
533
565
/**
534
566
* Specifying a particular function via `{"name": "my_function"}` forces the model
535
567
* to call that function.
@@ -620,7 +652,13 @@ export namespace ChatCompletionMessage {
620
652
}
621
653
}
622
654
655
+ /**
656
+ * Developer-provided instructions that the model should follow, regardless of
657
+ * messages sent by the user. With o1 models and newer, `developer` messages
658
+ * replace the previous `system` messages.
659
+ */
623
660
export type ChatCompletionMessageParam =
661
+ | ChatCompletionDeveloperMessageParam
624
662
| ChatCompletionSystemMessageParam
625
663
| ChatCompletionUserMessageParam
626
664
| ChatCompletionAssistantMessageParam
@@ -707,6 +745,16 @@ export interface ChatCompletionPredictionContent {
707
745
type : 'content' ;
708
746
}
709
747
748
+ /**
749
+ * **o1 models only**
750
+ *
751
+ * Constrains effort on reasoning for
752
+ * [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
753
+ * supported values are `low`, `medium`, and `high`. Reducing reasoning effort can
754
+ * result in faster responses and fewer tokens used on reasoning in a response.
755
+ */
756
+ export type ChatCompletionReasoningEffort = 'low' | 'medium' | 'high' ;
757
+
710
758
/**
711
759
* The role of the author of a message
712
760
*/
@@ -725,6 +773,11 @@ export interface ChatCompletionStreamOptions {
725
773
include_usage ?: boolean ;
726
774
}
727
775
776
+ /**
777
+ * Developer-provided instructions that the model should follow, regardless of
778
+ * messages sent by the user. With o1 models and newer, use `developer` messages
779
+ * for this purpose instead.
780
+ */
728
781
export interface ChatCompletionSystemMessageParam {
729
782
/**
730
783
* The contents of the system message.
@@ -835,6 +888,10 @@ export interface ChatCompletionToolMessageParam {
835
888
tool_call_id : string ;
836
889
}
837
890
891
+ /**
892
+ * Messages sent by an end user, containing prompts or additional context
893
+ * information.
894
+ */
838
895
export interface ChatCompletionUserMessageParam {
839
896
/**
840
897
* The contents of the user message.
@@ -891,20 +948,22 @@ export interface ChatCompletionCreateParamsBase {
891
948
* Number between -2.0 and 2.0. Positive values penalize new tokens based on their
892
949
* existing frequency in the text so far, decreasing the model's likelihood to
893
950
* repeat the same line verbatim.
894
- *
895
- * [See more information about frequency and presence penalties.](https://platform.openai.com/docs/guides/text-generation)
896
951
*/
897
952
frequency_penalty ?: number | null ;
898
953
899
954
/**
900
955
* Deprecated in favor of `tool_choice`.
901
956
*
902
- * Controls which (if any) function is called by the model. `none` means the model
903
- * will not call a function and instead generates a message. `auto` means the model
904
- * can pick between generating a message or calling a function. Specifying a
905
- * particular function via `{"name": "my_function"}` forces the model to call that
957
+ * Controls which (if any) function is called by the model.
958
+ *
959
+ * `none` means the model will not call a function and instead generates a message.
960
+ *
961
+ * `auto` means the model can pick between generating a message or calling a
906
962
* function.
907
963
*
964
+ * Specifying a particular function via `{"name": "my_function"}` forces the model
965
+ * to call that function.
966
+ *
908
967
* `none` is the default when no functions are present. `auto` is the default if
909
968
* functions are present.
910
969
*/
@@ -998,17 +1057,21 @@ export interface ChatCompletionCreateParamsBase {
998
1057
* Number between -2.0 and 2.0. Positive values penalize new tokens based on
999
1058
* whether they appear in the text so far, increasing the model's likelihood to
1000
1059
* talk about new topics.
1001
- *
1002
- * [See more information about frequency and presence penalties.](https://platform.openai.com/docs/guides/text-generation)
1003
1060
*/
1004
1061
presence_penalty ?: number | null ;
1005
1062
1006
1063
/**
1007
- * An object specifying the format that the model must output. Compatible with
1008
- * [GPT-4o](https://platform.openai.com/docs/models#gpt-4o),
1009
- * [GPT-4o mini](https://platform.openai.com/docs/models#gpt-4o-mini),
1010
- * [GPT-4 Turbo](https://platform.openai.com/docs/models#gpt-4-turbo-and-gpt-4) and
1011
- * all GPT-3.5 Turbo models newer than `gpt-3.5-turbo-1106`.
1064
+ * **o1 models only**
1065
+ *
1066
+ * Constrains effort on reasoning for
1067
+ * [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
1068
+ * supported values are `low`, `medium`, and `high`. Reducing reasoning effort can
1069
+ * result in faster responses and fewer tokens used on reasoning in a response.
1070
+ */
1071
+ reasoning_effort ?: ChatCompletionReasoningEffort ;
1072
+
1073
+ /**
1074
+ * An object specifying the format that the model must output.
1012
1075
*
1013
1076
* Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
1014
1077
* Outputs which ensures the model will match your supplied JSON schema. Learn more
@@ -1088,9 +1151,8 @@ export interface ChatCompletionCreateParamsBase {
1088
1151
/**
1089
1152
* What sampling temperature to use, between 0 and 2. Higher values like 0.8 will
1090
1153
* make the output more random, while lower values like 0.2 will make it more
1091
- * focused and deterministic.
1092
- *
1093
- * We generally recommend altering this or `top_p` but not both.
1154
+ * focused and deterministic. We generally recommend altering this or `top_p` but
1155
+ * not both.
1094
1156
*/
1095
1157
temperature ?: number | null ;
1096
1158
@@ -1223,6 +1285,7 @@ export declare namespace Completions {
1223
1285
type ChatCompletionContentPartInputAudio as ChatCompletionContentPartInputAudio ,
1224
1286
type ChatCompletionContentPartRefusal as ChatCompletionContentPartRefusal ,
1225
1287
type ChatCompletionContentPartText as ChatCompletionContentPartText ,
1288
+ type ChatCompletionDeveloperMessageParam as ChatCompletionDeveloperMessageParam ,
1226
1289
type ChatCompletionFunctionCallOption as ChatCompletionFunctionCallOption ,
1227
1290
type ChatCompletionFunctionMessageParam as ChatCompletionFunctionMessageParam ,
1228
1291
type ChatCompletionMessage as ChatCompletionMessage ,
@@ -1231,6 +1294,7 @@ export declare namespace Completions {
1231
1294
type ChatCompletionModality as ChatCompletionModality ,
1232
1295
type ChatCompletionNamedToolChoice as ChatCompletionNamedToolChoice ,
1233
1296
type ChatCompletionPredictionContent as ChatCompletionPredictionContent ,
1297
+ type ChatCompletionReasoningEffort as ChatCompletionReasoningEffort ,
1234
1298
type ChatCompletionRole as ChatCompletionRole ,
1235
1299
type ChatCompletionStreamOptions as ChatCompletionStreamOptions ,
1236
1300
type ChatCompletionSystemMessageParam as ChatCompletionSystemMessageParam ,
0 commit comments