@@ -161,6 +161,55 @@ export namespace ChatCompletionChunk {
161
161
}
162
162
}
163
163
164
+ export interface CreateChatCompletionRequestMessage {
165
+ /**
166
+ * The contents of the message. `content` is required for all messages, and may be
167
+ * null for assistant messages with function calls.
168
+ */
169
+ content : string | null ;
170
+
171
+ /**
172
+ * The role of the messages author. One of `system`, `user`, `assistant`, or
173
+ * `function`.
174
+ */
175
+ role : 'system' | 'user' | 'assistant' | 'function' ;
176
+
177
+ /**
178
+ * The name and arguments of a function that should be called, as generated by the
179
+ * model.
180
+ */
181
+ function_call ?: CreateChatCompletionRequestMessage . FunctionCall ;
182
+
183
+ /**
184
+ * The name of the author of this message. `name` is required if role is
185
+ * `function`, and it should be the name of the function whose response is in the
186
+ * `content`. May contain a-z, A-Z, 0-9, and underscores, with a maximum length of
187
+ * 64 characters.
188
+ */
189
+ name ?: string ;
190
+ }
191
+
192
+ export namespace CreateChatCompletionRequestMessage {
193
+ /**
194
+ * The name and arguments of a function that should be called, as generated by the
195
+ * model.
196
+ */
197
+ export interface FunctionCall {
198
+ /**
199
+ * The arguments to call the function with, as generated by the model in JSON
200
+ * format. Note that the model does not always generate valid JSON, and may
201
+ * hallucinate parameters not defined by your function schema. Validate the
202
+ * arguments in your code before calling your function.
203
+ */
204
+ arguments : string ;
205
+
206
+ /**
207
+ * The name of the function to call.
208
+ */
209
+ name : string ;
210
+ }
211
+ }
212
+
164
213
export type CompletionCreateParams =
165
214
| CompletionCreateParams . CreateChatCompletionRequestNonStreaming
166
215
| CompletionCreateParams . CreateChatCompletionRequestStreaming ;
@@ -171,7 +220,7 @@ export namespace CompletionCreateParams {
171
220
* A list of messages comprising the conversation so far.
172
221
* [Example Python code](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_format_inputs_to_ChatGPT_models.ipynb).
173
222
*/
174
- messages : Array < CompletionCreateParams . CreateChatCompletionRequestNonStreaming . Message > ;
223
+ messages : Array < CreateChatCompletionRequestMessage > ;
175
224
176
225
/**
177
226
* ID of the model to use. See the
@@ -296,55 +345,6 @@ export namespace CompletionCreateParams {
296
345
}
297
346
298
347
export namespace CreateChatCompletionRequestNonStreaming {
299
- export interface Message {
300
- /**
301
- * The contents of the message. `content` is required for all messages, and may be
302
- * null for assistant messages with function calls.
303
- */
304
- content : string | null ;
305
-
306
- /**
307
- * The role of the messages author. One of `system`, `user`, `assistant`, or
308
- * `function`.
309
- */
310
- role : 'system' | 'user' | 'assistant' | 'function' ;
311
-
312
- /**
313
- * The name and arguments of a function that should be called, as generated by the
314
- * model.
315
- */
316
- function_call ?: Message . FunctionCall ;
317
-
318
- /**
319
- * The name of the author of this message. `name` is required if role is
320
- * `function`, and it should be the name of the function whose response is in the
321
- * `content`. May contain a-z, A-Z, 0-9, and underscores, with a maximum length of
322
- * 64 characters.
323
- */
324
- name ?: string ;
325
- }
326
-
327
- export namespace Message {
328
- /**
329
- * The name and arguments of a function that should be called, as generated by the
330
- * model.
331
- */
332
- export interface FunctionCall {
333
- /**
334
- * The arguments to call the function with, as generated by the model in JSON
335
- * format. Note that the model does not always generate valid JSON, and may
336
- * hallucinate parameters not defined by your function schema. Validate the
337
- * arguments in your code before calling your function.
338
- */
339
- arguments : string ;
340
-
341
- /**
342
- * The name of the function to call.
343
- */
344
- name : string ;
345
- }
346
- }
347
-
348
348
export interface FunctionCallOption {
349
349
/**
350
350
* The name of the function to call.
@@ -383,7 +383,7 @@ export namespace CompletionCreateParams {
383
383
* A list of messages comprising the conversation so far.
384
384
* [Example Python code](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_format_inputs_to_ChatGPT_models.ipynb).
385
385
*/
386
- messages : Array < CompletionCreateParams . CreateChatCompletionRequestStreaming . Message > ;
386
+ messages : Array < CreateChatCompletionRequestMessage > ;
387
387
388
388
/**
389
389
* ID of the model to use. See the
@@ -508,55 +508,6 @@ export namespace CompletionCreateParams {
508
508
}
509
509
510
510
export namespace CreateChatCompletionRequestStreaming {
511
- export interface Message {
512
- /**
513
- * The contents of the message. `content` is required for all messages, and may be
514
- * null for assistant messages with function calls.
515
- */
516
- content : string | null ;
517
-
518
- /**
519
- * The role of the messages author. One of `system`, `user`, `assistant`, or
520
- * `function`.
521
- */
522
- role : 'system' | 'user' | 'assistant' | 'function' ;
523
-
524
- /**
525
- * The name and arguments of a function that should be called, as generated by the
526
- * model.
527
- */
528
- function_call ?: Message . FunctionCall ;
529
-
530
- /**
531
- * The name of the author of this message. `name` is required if role is
532
- * `function`, and it should be the name of the function whose response is in the
533
- * `content`. May contain a-z, A-Z, 0-9, and underscores, with a maximum length of
534
- * 64 characters.
535
- */
536
- name ?: string ;
537
- }
538
-
539
- export namespace Message {
540
- /**
541
- * The name and arguments of a function that should be called, as generated by the
542
- * model.
543
- */
544
- export interface FunctionCall {
545
- /**
546
- * The arguments to call the function with, as generated by the model in JSON
547
- * format. Note that the model does not always generate valid JSON, and may
548
- * hallucinate parameters not defined by your function schema. Validate the
549
- * arguments in your code before calling your function.
550
- */
551
- arguments : string ;
552
-
553
- /**
554
- * The name of the function to call.
555
- */
556
- name : string ;
557
- }
558
- }
559
-
560
511
export interface FunctionCallOption {
561
512
/**
562
513
* The name of the function to call.
@@ -594,5 +545,6 @@ export namespace CompletionCreateParams {
594
545
export namespace Completions {
595
546
export import ChatCompletion = API . ChatCompletion ;
596
547
export import ChatCompletionChunk = API . ChatCompletionChunk ;
548
+ export import CreateChatCompletionRequestMessage = API . CreateChatCompletionRequestMessage ;
597
549
export import CompletionCreateParams = API . CompletionCreateParams ;
598
550
}
0 commit comments