@@ -16,7 +16,7 @@ export class Completions extends APIResource {
16
16
* ```ts
17
17
* const chatCompletion = await client.chat.completions.create(
18
18
* {
19
- * messages: [{ content: 'string ', role: 'system' }],
19
+ * messages: [{ content: 'content ', role: 'system' }],
20
20
* model: 'meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo',
21
21
* },
22
22
* );
@@ -277,7 +277,13 @@ export interface CompletionCreateParamsBase {
277
277
/**
278
278
* A list of messages comprising the conversation so far.
279
279
*/
280
- messages : Array < CompletionCreateParams . Message > ;
280
+ messages : Array <
281
+ | CompletionCreateParams . ChatCompletionSystemMessageParam
282
+ | CompletionCreateParams . ChatCompletionUserMessageParam
283
+ | CompletionCreateParams . ChatCompletionAssistantMessageParam
284
+ | CompletionCreateParams . ChatCompletionToolMessageParam
285
+ | CompletionCreateParams . ChatCompletionFunctionMessageParam
286
+ > ;
281
287
282
288
/**
283
289
* The name of the model to query.
@@ -424,41 +430,65 @@ export interface CompletionCreateParamsBase {
424
430
}
425
431
426
432
export namespace CompletionCreateParams {
427
- export interface Message {
433
+ export interface ChatCompletionSystemMessageParam {
434
+ content : string ;
435
+
436
+ role : 'system' ;
437
+
438
+ name ?: string ;
439
+ }
440
+
441
+ export interface ChatCompletionUserMessageParam {
442
+ content : string ;
443
+
444
+ role : 'user' ;
445
+
446
+ name ?: string ;
447
+ }
448
+
449
+ export interface ChatCompletionAssistantMessageParam {
450
+ role : 'assistant' ;
451
+
452
+ content ?: string | null ;
453
+
428
454
/**
429
- * The content of the message, which can either be a simple string or a structured
430
- * format.
455
+ * @deprecated
431
456
*/
432
- content :
433
- | string
434
- | Array <
435
- | ChatCompletionsAPI . ChatCompletionStructuredMessageText
436
- | ChatCompletionsAPI . ChatCompletionStructuredMessageImageURL
437
- | Message . Video
438
- > ;
457
+ function_call ?: ChatCompletionAssistantMessageParam . FunctionCall ;
458
+
459
+ name ?: string ;
460
+
461
+ tool_calls ?: Array < CompletionsAPI . ToolChoice > ;
462
+ }
439
463
464
+ export namespace ChatCompletionAssistantMessageParam {
440
465
/**
441
- * The role of the messages author. Choice between: system, user, assistant, or
442
- * tool.
466
+ * @deprecated
443
467
*/
444
- role : 'system' | 'user' | 'assistant' | 'tool' ;
468
+ export interface FunctionCall {
469
+ arguments : string ;
470
+
471
+ name : string ;
472
+ }
445
473
}
446
474
447
- export namespace Message {
448
- export interface Video {
449
- type : 'video_url' ;
475
+ export interface ChatCompletionToolMessageParam {
476
+ content : string ;
450
477
451
- video_url : Video . VideoURL ;
452
- }
478
+ role : 'tool' ;
453
479
454
- export namespace Video {
455
- export interface VideoURL {
456
- /**
457
- * The URL of the video
458
- */
459
- url : string ;
460
- }
461
- }
480
+ tool_call_id : string ;
481
+ }
482
+
483
+ /**
484
+ * @deprecated
485
+ */
486
+ export interface ChatCompletionFunctionMessageParam {
487
+ content : string ;
488
+
489
+ name : string ;
490
+
491
+ role : 'function' ;
462
492
}
463
493
464
494
export interface Name {
0 commit comments