@flow-like/widget-sdk 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1385 @@
1
+ // Verbatim copies of packages/schema/llm/*.json, generated from the Rust model-provider types by
2
+ // apps/schema-gen. tests/llm.test.ts fails when they drift; copy the files again after regenerating.
3
+ import type { JsonSchema } from "./contract";
4
+
5
+ export const LLM_SCHEMAS: Record<
6
+ "History" | "Response" | "ResponseChunk",
7
+ JsonSchema
8
+ > = {
9
+ History: {
10
+ $schema: "https://json-schema.org/draft/2020-12/schema",
11
+ title: "History",
12
+ type: "object",
13
+ properties: {
14
+ model: {
15
+ type: "string",
16
+ },
17
+ messages: {
18
+ type: "array",
19
+ items: {
20
+ $ref: "#/$defs/HistoryMessage",
21
+ },
22
+ },
23
+ preset: {
24
+ type: ["string", "null"],
25
+ },
26
+ stream: {
27
+ type: ["boolean", "null"],
28
+ },
29
+ stream_options: {
30
+ anyOf: [
31
+ {
32
+ $ref: "#/$defs/StreamOptions",
33
+ },
34
+ {
35
+ type: "null",
36
+ },
37
+ ],
38
+ },
39
+ max_completion_tokens: {
40
+ type: ["integer", "null"],
41
+ format: "uint32",
42
+ minimum: 0,
43
+ },
44
+ top_p: {
45
+ type: ["number", "null"],
46
+ format: "float",
47
+ },
48
+ temperature: {
49
+ type: ["number", "null"],
50
+ format: "float",
51
+ },
52
+ thinking: {
53
+ anyOf: [
54
+ {
55
+ $ref: "#/$defs/HistoryThinking",
56
+ },
57
+ {
58
+ type: "null",
59
+ },
60
+ ],
61
+ },
62
+ seed: {
63
+ type: ["integer", "null"],
64
+ format: "uint32",
65
+ minimum: 0,
66
+ },
67
+ presence_penalty: {
68
+ type: ["number", "null"],
69
+ format: "float",
70
+ },
71
+ frequency_penalty: {
72
+ type: ["number", "null"],
73
+ format: "float",
74
+ },
75
+ user: {
76
+ type: ["string", "null"],
77
+ },
78
+ stop: {
79
+ type: ["array", "null"],
80
+ items: {
81
+ type: "string",
82
+ },
83
+ },
84
+ response_format: {
85
+ anyOf: [
86
+ {
87
+ $ref: "#/$defs/ResponseFormat",
88
+ },
89
+ {
90
+ type: "null",
91
+ },
92
+ ],
93
+ },
94
+ n: {
95
+ type: ["integer", "null"],
96
+ format: "uint32",
97
+ minimum: 0,
98
+ },
99
+ tools: {
100
+ type: ["array", "null"],
101
+ items: {
102
+ $ref: "#/$defs/Tool",
103
+ },
104
+ },
105
+ tool_choice: {
106
+ anyOf: [
107
+ {
108
+ $ref: "#/$defs/ToolChoice",
109
+ },
110
+ {
111
+ type: "null",
112
+ },
113
+ ],
114
+ },
115
+ usage: {
116
+ anyOf: [
117
+ {
118
+ $ref: "#/$defs/Usage",
119
+ },
120
+ {
121
+ type: "null",
122
+ },
123
+ ],
124
+ },
125
+ },
126
+ required: ["model", "messages"],
127
+ $defs: {
128
+ HistoryMessage: {
129
+ type: "object",
130
+ properties: {
131
+ role: {
132
+ $ref: "#/$defs/Role",
133
+ },
134
+ content: {
135
+ $ref: "#/$defs/MessageContent",
136
+ },
137
+ name: {
138
+ type: ["string", "null"],
139
+ },
140
+ tool_calls: {
141
+ type: ["array", "null"],
142
+ items: {
143
+ $ref: "#/$defs/ToolCall",
144
+ },
145
+ },
146
+ tool_call_id: {
147
+ type: ["string", "null"],
148
+ },
149
+ annotations: {
150
+ type: ["array", "null"],
151
+ items: {
152
+ $ref: "#/$defs/Annotation",
153
+ },
154
+ },
155
+ },
156
+ required: ["role", "content"],
157
+ },
158
+ Role: {
159
+ type: "string",
160
+ enum: ["system", "user", "assistant", "function", "tool"],
161
+ },
162
+ MessageContent: {
163
+ anyOf: [
164
+ {
165
+ type: "string",
166
+ },
167
+ {
168
+ type: "array",
169
+ items: {
170
+ $ref: "#/$defs/Content",
171
+ },
172
+ },
173
+ ],
174
+ },
175
+ Content: {
176
+ anyOf: [
177
+ {
178
+ type: "object",
179
+ properties: {
180
+ type: {
181
+ $ref: "#/$defs/ContentType",
182
+ },
183
+ text: {
184
+ type: "string",
185
+ },
186
+ },
187
+ required: ["type", "text"],
188
+ },
189
+ {
190
+ type: "object",
191
+ properties: {
192
+ type: {
193
+ $ref: "#/$defs/ContentType",
194
+ },
195
+ image_url: {
196
+ $ref: "#/$defs/ImageUrl",
197
+ },
198
+ },
199
+ required: ["type", "image_url"],
200
+ },
201
+ {
202
+ type: "object",
203
+ properties: {
204
+ type: {
205
+ $ref: "#/$defs/ContentType",
206
+ },
207
+ audio_url: {
208
+ type: "string",
209
+ },
210
+ media_type: {
211
+ type: ["string", "null"],
212
+ },
213
+ additional_params: true,
214
+ },
215
+ required: ["type", "audio_url"],
216
+ },
217
+ {
218
+ type: "object",
219
+ properties: {
220
+ type: {
221
+ $ref: "#/$defs/ContentType",
222
+ },
223
+ video_url: {
224
+ type: "string",
225
+ },
226
+ media_type: {
227
+ type: ["string", "null"],
228
+ },
229
+ additional_params: true,
230
+ },
231
+ required: ["type", "video_url"],
232
+ },
233
+ {
234
+ type: "object",
235
+ properties: {
236
+ type: {
237
+ $ref: "#/$defs/ContentType",
238
+ },
239
+ document_url: {
240
+ type: "string",
241
+ },
242
+ media_type: {
243
+ type: ["string", "null"],
244
+ },
245
+ additional_params: true,
246
+ },
247
+ required: ["type", "document_url"],
248
+ },
249
+ ],
250
+ },
251
+ ContentType: {
252
+ type: "string",
253
+ enum: ["text", "image_url", "audio_url", "video_url", "document_url"],
254
+ },
255
+ ImageUrl: {
256
+ type: "object",
257
+ properties: {
258
+ url: {
259
+ type: "string",
260
+ },
261
+ detail: {
262
+ type: ["string", "null"],
263
+ },
264
+ media_type: {
265
+ type: ["string", "null"],
266
+ },
267
+ additional_params: true,
268
+ },
269
+ required: ["url"],
270
+ },
271
+ ToolCall: {
272
+ type: "object",
273
+ properties: {
274
+ id: {
275
+ type: "string",
276
+ },
277
+ type: {
278
+ type: "string",
279
+ },
280
+ function: {
281
+ $ref: "#/$defs/ToolCallFunction",
282
+ },
283
+ },
284
+ required: ["id", "type", "function"],
285
+ },
286
+ ToolCallFunction: {
287
+ type: "object",
288
+ properties: {
289
+ name: {
290
+ type: "string",
291
+ },
292
+ arguments: {
293
+ type: "string",
294
+ },
295
+ },
296
+ required: ["name", "arguments"],
297
+ },
298
+ Annotation: {
299
+ type: "object",
300
+ properties: {
301
+ type: {
302
+ type: "string",
303
+ },
304
+ url_citation: {
305
+ anyOf: [
306
+ {
307
+ $ref: "#/$defs/UrlCitation",
308
+ },
309
+ {
310
+ type: "null",
311
+ },
312
+ ],
313
+ },
314
+ },
315
+ required: ["type"],
316
+ },
317
+ UrlCitation: {
318
+ type: "object",
319
+ properties: {
320
+ end_index: {
321
+ type: "integer",
322
+ format: "uint32",
323
+ minimum: 0,
324
+ },
325
+ start_index: {
326
+ type: "integer",
327
+ format: "uint32",
328
+ minimum: 0,
329
+ },
330
+ title: {
331
+ type: "string",
332
+ },
333
+ url: {
334
+ type: "string",
335
+ },
336
+ content: {
337
+ type: ["string", "null"],
338
+ },
339
+ },
340
+ required: ["end_index", "start_index", "title", "url"],
341
+ },
342
+ StreamOptions: {
343
+ type: "object",
344
+ properties: {
345
+ include_usage: {
346
+ type: "boolean",
347
+ },
348
+ },
349
+ required: ["include_usage"],
350
+ },
351
+ HistoryThinking: {
352
+ type: "string",
353
+ enum: ["off", "low", "mid", "high"],
354
+ },
355
+ ResponseFormat: {
356
+ anyOf: [
357
+ {
358
+ type: "string",
359
+ },
360
+ true,
361
+ ],
362
+ },
363
+ Tool: {
364
+ type: "object",
365
+ properties: {
366
+ type: {
367
+ $ref: "#/$defs/ToolType",
368
+ },
369
+ function: {
370
+ $ref: "#/$defs/HistoryFunction",
371
+ },
372
+ },
373
+ required: ["type", "function"],
374
+ },
375
+ ToolType: {
376
+ type: "string",
377
+ enum: ["function"],
378
+ },
379
+ HistoryFunction: {
380
+ type: "object",
381
+ properties: {
382
+ name: {
383
+ type: "string",
384
+ },
385
+ description: {
386
+ type: ["string", "null"],
387
+ },
388
+ parameters: {
389
+ $ref: "#/$defs/HistoryFunctionParameters",
390
+ },
391
+ },
392
+ required: ["name", "parameters"],
393
+ },
394
+ HistoryFunctionParameters: {
395
+ type: "object",
396
+ properties: {
397
+ type: {
398
+ $ref: "#/$defs/HistoryJSONSchemaType",
399
+ },
400
+ properties: {
401
+ type: ["object", "null"],
402
+ additionalProperties: {
403
+ $ref: "#/$defs/HistoryJSONSchemaDefine",
404
+ },
405
+ },
406
+ required: {
407
+ type: ["array", "null"],
408
+ items: {
409
+ type: "string",
410
+ },
411
+ },
412
+ },
413
+ required: ["type"],
414
+ },
415
+ HistoryJSONSchemaType: {
416
+ type: "string",
417
+ enum: ["object", "number", "string", "array", "null", "boolean"],
418
+ },
419
+ HistoryJSONSchemaDefine: {
420
+ type: "object",
421
+ properties: {
422
+ type: {
423
+ anyOf: [
424
+ {
425
+ $ref: "#/$defs/HistoryJSONSchemaType",
426
+ },
427
+ {
428
+ type: "null",
429
+ },
430
+ ],
431
+ },
432
+ description: {
433
+ type: ["string", "null"],
434
+ },
435
+ default: true,
436
+ enum: {
437
+ type: ["array", "null"],
438
+ items: {
439
+ type: "string",
440
+ },
441
+ },
442
+ properties: {
443
+ type: ["object", "null"],
444
+ additionalProperties: {
445
+ $ref: "#/$defs/HistoryJSONSchemaDefine",
446
+ },
447
+ },
448
+ required: {
449
+ type: ["array", "null"],
450
+ items: {
451
+ type: "string",
452
+ },
453
+ },
454
+ items: {
455
+ anyOf: [
456
+ {
457
+ $ref: "#/$defs/HistoryJSONSchemaDefine",
458
+ },
459
+ {
460
+ type: "null",
461
+ },
462
+ ],
463
+ },
464
+ },
465
+ },
466
+ ToolChoice: {
467
+ anyOf: [
468
+ {
469
+ type: "null",
470
+ },
471
+ {
472
+ type: "null",
473
+ },
474
+ {
475
+ type: "null",
476
+ },
477
+ {
478
+ type: "object",
479
+ properties: {
480
+ type: {
481
+ $ref: "#/$defs/ToolType",
482
+ },
483
+ function: {
484
+ $ref: "#/$defs/HistoryFunction",
485
+ },
486
+ },
487
+ required: ["type", "function"],
488
+ },
489
+ ],
490
+ },
491
+ Usage: {
492
+ type: "object",
493
+ properties: {
494
+ include: {
495
+ type: "boolean",
496
+ },
497
+ },
498
+ required: ["include"],
499
+ },
500
+ },
501
+ },
502
+ Response: {
503
+ $schema: "https://json-schema.org/draft/2020-12/schema",
504
+ title: "Response",
505
+ type: "object",
506
+ properties: {
507
+ id: {
508
+ type: ["string", "null"],
509
+ },
510
+ choices: {
511
+ type: "array",
512
+ items: {
513
+ $ref: "#/$defs/Choice",
514
+ },
515
+ },
516
+ created: {
517
+ type: ["integer", "null"],
518
+ format: "uint64",
519
+ minimum: 0,
520
+ },
521
+ model: {
522
+ type: ["string", "null"],
523
+ },
524
+ service_tier: {
525
+ type: ["string", "null"],
526
+ },
527
+ system_fingerprint: {
528
+ type: ["string", "null"],
529
+ },
530
+ object: {
531
+ type: ["string", "null"],
532
+ },
533
+ usage: {
534
+ $ref: "#/$defs/Usage",
535
+ },
536
+ },
537
+ required: ["choices", "usage"],
538
+ $defs: {
539
+ Choice: {
540
+ type: "object",
541
+ properties: {
542
+ index: {
543
+ type: "integer",
544
+ format: "int32",
545
+ },
546
+ finish_reason: {
547
+ type: "string",
548
+ },
549
+ message: {
550
+ $ref: "#/$defs/ResponseMessage",
551
+ },
552
+ logprobs: {
553
+ anyOf: [
554
+ {
555
+ $ref: "#/$defs/LogProbs",
556
+ },
557
+ {
558
+ type: "null",
559
+ },
560
+ ],
561
+ },
562
+ },
563
+ required: ["index", "finish_reason", "message"],
564
+ },
565
+ ResponseMessage: {
566
+ type: "object",
567
+ properties: {
568
+ role: {
569
+ type: "string",
570
+ },
571
+ content: {
572
+ type: ["string", "null"],
573
+ },
574
+ content_parts: {
575
+ description:
576
+ "Ordered structured content returned by Rig when the assistant response contains media.\nText-only responses continue to use `content` alone for OpenAI compatibility.",
577
+ type: "array",
578
+ items: {
579
+ $ref: "#/$defs/Content",
580
+ },
581
+ },
582
+ refusal: {
583
+ type: ["string", "null"],
584
+ },
585
+ annotations: {
586
+ type: ["array", "null"],
587
+ items: {
588
+ $ref: "#/$defs/Annotation",
589
+ },
590
+ },
591
+ audio: {
592
+ anyOf: [
593
+ {
594
+ $ref: "#/$defs/Audio",
595
+ },
596
+ {
597
+ type: "null",
598
+ },
599
+ ],
600
+ },
601
+ reasoning: {
602
+ type: ["string", "null"],
603
+ },
604
+ tool_calls: {
605
+ type: "array",
606
+ items: {
607
+ $ref: "#/$defs/FunctionCall",
608
+ },
609
+ },
610
+ },
611
+ required: ["role", "tool_calls"],
612
+ },
613
+ Content: {
614
+ anyOf: [
615
+ {
616
+ type: "object",
617
+ properties: {
618
+ type: {
619
+ $ref: "#/$defs/ContentType",
620
+ },
621
+ text: {
622
+ type: "string",
623
+ },
624
+ },
625
+ required: ["type", "text"],
626
+ },
627
+ {
628
+ type: "object",
629
+ properties: {
630
+ type: {
631
+ $ref: "#/$defs/ContentType",
632
+ },
633
+ image_url: {
634
+ $ref: "#/$defs/ImageUrl",
635
+ },
636
+ },
637
+ required: ["type", "image_url"],
638
+ },
639
+ {
640
+ type: "object",
641
+ properties: {
642
+ type: {
643
+ $ref: "#/$defs/ContentType",
644
+ },
645
+ audio_url: {
646
+ type: "string",
647
+ },
648
+ media_type: {
649
+ type: ["string", "null"],
650
+ },
651
+ additional_params: true,
652
+ },
653
+ required: ["type", "audio_url"],
654
+ },
655
+ {
656
+ type: "object",
657
+ properties: {
658
+ type: {
659
+ $ref: "#/$defs/ContentType",
660
+ },
661
+ video_url: {
662
+ type: "string",
663
+ },
664
+ media_type: {
665
+ type: ["string", "null"],
666
+ },
667
+ additional_params: true,
668
+ },
669
+ required: ["type", "video_url"],
670
+ },
671
+ {
672
+ type: "object",
673
+ properties: {
674
+ type: {
675
+ $ref: "#/$defs/ContentType",
676
+ },
677
+ document_url: {
678
+ type: "string",
679
+ },
680
+ media_type: {
681
+ type: ["string", "null"],
682
+ },
683
+ additional_params: true,
684
+ },
685
+ required: ["type", "document_url"],
686
+ },
687
+ ],
688
+ },
689
+ ContentType: {
690
+ type: "string",
691
+ enum: ["text", "image_url", "audio_url", "video_url", "document_url"],
692
+ },
693
+ ImageUrl: {
694
+ type: "object",
695
+ properties: {
696
+ url: {
697
+ type: "string",
698
+ },
699
+ detail: {
700
+ type: ["string", "null"],
701
+ },
702
+ media_type: {
703
+ type: ["string", "null"],
704
+ },
705
+ additional_params: true,
706
+ },
707
+ required: ["url"],
708
+ },
709
+ Annotation: {
710
+ type: "object",
711
+ properties: {
712
+ type: {
713
+ type: "string",
714
+ },
715
+ url_citation: {
716
+ anyOf: [
717
+ {
718
+ $ref: "#/$defs/UrlCitation",
719
+ },
720
+ {
721
+ type: "null",
722
+ },
723
+ ],
724
+ },
725
+ },
726
+ required: ["type"],
727
+ },
728
+ UrlCitation: {
729
+ type: "object",
730
+ properties: {
731
+ end_index: {
732
+ type: "integer",
733
+ format: "uint32",
734
+ minimum: 0,
735
+ },
736
+ start_index: {
737
+ type: "integer",
738
+ format: "uint32",
739
+ minimum: 0,
740
+ },
741
+ title: {
742
+ type: "string",
743
+ },
744
+ url: {
745
+ type: "string",
746
+ },
747
+ content: {
748
+ type: ["string", "null"],
749
+ },
750
+ },
751
+ required: ["end_index", "start_index", "title", "url"],
752
+ },
753
+ Audio: {
754
+ type: "object",
755
+ properties: {
756
+ data: {
757
+ type: "string",
758
+ },
759
+ expires_at: {
760
+ type: ["integer", "null"],
761
+ format: "uint64",
762
+ minimum: 0,
763
+ },
764
+ id: {
765
+ type: "string",
766
+ },
767
+ transcript: {
768
+ type: ["string", "null"],
769
+ },
770
+ },
771
+ required: ["data", "id"],
772
+ },
773
+ FunctionCall: {
774
+ type: "object",
775
+ properties: {
776
+ index: {
777
+ type: ["integer", "null"],
778
+ format: "int32",
779
+ },
780
+ id: {
781
+ type: "string",
782
+ },
783
+ type: {
784
+ type: ["string", "null"],
785
+ },
786
+ function: {
787
+ $ref: "#/$defs/ResponseFunction",
788
+ },
789
+ },
790
+ required: ["id", "function"],
791
+ },
792
+ ResponseFunction: {
793
+ type: "object",
794
+ properties: {
795
+ name: {
796
+ type: "string",
797
+ },
798
+ arguments: {
799
+ type: "string",
800
+ },
801
+ },
802
+ required: ["name", "arguments"],
803
+ },
804
+ LogProbs: {
805
+ type: "object",
806
+ properties: {
807
+ content: {
808
+ type: ["array", "null"],
809
+ items: {
810
+ $ref: "#/$defs/TokenLogProbs",
811
+ },
812
+ },
813
+ refusal: {
814
+ type: ["array", "null"],
815
+ items: {
816
+ $ref: "#/$defs/TokenLogProbs",
817
+ },
818
+ },
819
+ },
820
+ },
821
+ TokenLogProbs: {
822
+ type: "object",
823
+ properties: {
824
+ token: {
825
+ type: "string",
826
+ },
827
+ logprob: {
828
+ type: "number",
829
+ format: "double",
830
+ },
831
+ bytes: {
832
+ type: ["array", "null"],
833
+ items: {
834
+ type: "integer",
835
+ format: "uint8",
836
+ minimum: 0,
837
+ maximum: 255,
838
+ },
839
+ },
840
+ top_logprobs: {
841
+ type: ["array", "null"],
842
+ items: {
843
+ $ref: "#/$defs/TopLogProbs",
844
+ },
845
+ },
846
+ },
847
+ required: ["token", "logprob"],
848
+ },
849
+ TopLogProbs: {
850
+ type: "object",
851
+ properties: {
852
+ token: {
853
+ type: "string",
854
+ },
855
+ logprob: {
856
+ type: "number",
857
+ format: "double",
858
+ },
859
+ bytes: {
860
+ type: ["array", "null"],
861
+ items: {
862
+ type: "integer",
863
+ format: "uint8",
864
+ minimum: 0,
865
+ maximum: 255,
866
+ },
867
+ },
868
+ },
869
+ required: ["token", "logprob"],
870
+ },
871
+ Usage: {
872
+ type: "object",
873
+ properties: {
874
+ completion_tokens: {
875
+ type: "integer",
876
+ format: "uint32",
877
+ minimum: 0,
878
+ },
879
+ prompt_tokens: {
880
+ type: "integer",
881
+ format: "uint32",
882
+ minimum: 0,
883
+ },
884
+ total_tokens: {
885
+ type: "integer",
886
+ format: "uint32",
887
+ minimum: 0,
888
+ },
889
+ cost: {
890
+ type: ["number", "null"],
891
+ format: "double",
892
+ },
893
+ prompt_tokens_details: {
894
+ anyOf: [
895
+ {
896
+ $ref: "#/$defs/PromptTokenDetails",
897
+ },
898
+ {
899
+ type: "null",
900
+ },
901
+ ],
902
+ },
903
+ completion_tokens_details: {
904
+ anyOf: [
905
+ {
906
+ $ref: "#/$defs/CompletionTokenDetails",
907
+ },
908
+ {
909
+ type: "null",
910
+ },
911
+ ],
912
+ },
913
+ upstream_inference_cost: {
914
+ anyOf: [
915
+ {
916
+ $ref: "#/$defs/CostDetails",
917
+ },
918
+ {
919
+ type: "null",
920
+ },
921
+ ],
922
+ },
923
+ },
924
+ required: ["completion_tokens", "prompt_tokens", "total_tokens"],
925
+ },
926
+ PromptTokenDetails: {
927
+ type: "object",
928
+ properties: {
929
+ cached_tokens: {
930
+ type: ["integer", "null"],
931
+ format: "uint32",
932
+ minimum: 0,
933
+ },
934
+ audio_tokens: {
935
+ type: ["integer", "null"],
936
+ format: "uint32",
937
+ minimum: 0,
938
+ },
939
+ },
940
+ },
941
+ CompletionTokenDetails: {
942
+ type: "object",
943
+ properties: {
944
+ accepted_prediction_tokens: {
945
+ type: ["integer", "null"],
946
+ format: "uint32",
947
+ minimum: 0,
948
+ },
949
+ audio_tokens: {
950
+ type: ["integer", "null"],
951
+ format: "uint32",
952
+ minimum: 0,
953
+ },
954
+ reasoning_tokens: {
955
+ type: ["integer", "null"],
956
+ format: "uint32",
957
+ minimum: 0,
958
+ },
959
+ rejected_prediction_tokens: {
960
+ type: ["integer", "null"],
961
+ format: "uint32",
962
+ minimum: 0,
963
+ },
964
+ },
965
+ },
966
+ CostDetails: {
967
+ type: "object",
968
+ properties: {
969
+ upstream_inference_cost: {
970
+ type: ["integer", "null"],
971
+ format: "uint32",
972
+ minimum: 0,
973
+ },
974
+ },
975
+ },
976
+ },
977
+ },
978
+ ResponseChunk: {
979
+ $schema: "https://json-schema.org/draft/2020-12/schema",
980
+ title: "ResponseChunk",
981
+ type: "object",
982
+ properties: {
983
+ id: {
984
+ type: "string",
985
+ },
986
+ choices: {
987
+ type: "array",
988
+ items: {
989
+ $ref: "#/$defs/ResponseChunkChoice",
990
+ },
991
+ },
992
+ created: {
993
+ type: ["integer", "null"],
994
+ format: "uint64",
995
+ minimum: 0,
996
+ },
997
+ model: {
998
+ type: ["string", "null"],
999
+ },
1000
+ service_tier: {
1001
+ type: ["string", "null"],
1002
+ },
1003
+ system_fingerprint: {
1004
+ type: ["string", "null"],
1005
+ },
1006
+ usage: {
1007
+ anyOf: [
1008
+ {
1009
+ $ref: "#/$defs/Usage",
1010
+ },
1011
+ {
1012
+ type: "null",
1013
+ },
1014
+ ],
1015
+ },
1016
+ x_prefill_progress: {
1017
+ type: ["number", "null"],
1018
+ format: "float",
1019
+ },
1020
+ },
1021
+ required: ["id", "choices"],
1022
+ $defs: {
1023
+ ResponseChunkChoice: {
1024
+ type: "object",
1025
+ properties: {
1026
+ index: {
1027
+ type: "integer",
1028
+ format: "int32",
1029
+ },
1030
+ delta: {
1031
+ anyOf: [
1032
+ {
1033
+ $ref: "#/$defs/Delta",
1034
+ },
1035
+ {
1036
+ type: "null",
1037
+ },
1038
+ ],
1039
+ },
1040
+ finish_reason: {
1041
+ type: ["string", "null"],
1042
+ },
1043
+ logprobs: {
1044
+ anyOf: [
1045
+ {
1046
+ $ref: "#/$defs/LogProbs",
1047
+ },
1048
+ {
1049
+ type: "null",
1050
+ },
1051
+ ],
1052
+ },
1053
+ },
1054
+ required: ["index"],
1055
+ },
1056
+ Delta: {
1057
+ type: "object",
1058
+ properties: {
1059
+ role: {
1060
+ type: ["string", "null"],
1061
+ },
1062
+ content: {
1063
+ type: ["string", "null"],
1064
+ },
1065
+ content_parts: {
1066
+ type: ["array", "null"],
1067
+ items: {
1068
+ $ref: "#/$defs/Content",
1069
+ },
1070
+ },
1071
+ tool_calls: {
1072
+ type: ["array", "null"],
1073
+ items: {
1074
+ $ref: "#/$defs/DeltaFunctionCall",
1075
+ },
1076
+ },
1077
+ refusal: {
1078
+ type: ["string", "null"],
1079
+ },
1080
+ reasoning: {
1081
+ type: ["string", "null"],
1082
+ },
1083
+ },
1084
+ },
1085
+ Content: {
1086
+ anyOf: [
1087
+ {
1088
+ type: "object",
1089
+ properties: {
1090
+ type: {
1091
+ $ref: "#/$defs/ContentType",
1092
+ },
1093
+ text: {
1094
+ type: "string",
1095
+ },
1096
+ },
1097
+ required: ["type", "text"],
1098
+ },
1099
+ {
1100
+ type: "object",
1101
+ properties: {
1102
+ type: {
1103
+ $ref: "#/$defs/ContentType",
1104
+ },
1105
+ image_url: {
1106
+ $ref: "#/$defs/ImageUrl",
1107
+ },
1108
+ },
1109
+ required: ["type", "image_url"],
1110
+ },
1111
+ {
1112
+ type: "object",
1113
+ properties: {
1114
+ type: {
1115
+ $ref: "#/$defs/ContentType",
1116
+ },
1117
+ audio_url: {
1118
+ type: "string",
1119
+ },
1120
+ media_type: {
1121
+ type: ["string", "null"],
1122
+ },
1123
+ additional_params: true,
1124
+ },
1125
+ required: ["type", "audio_url"],
1126
+ },
1127
+ {
1128
+ type: "object",
1129
+ properties: {
1130
+ type: {
1131
+ $ref: "#/$defs/ContentType",
1132
+ },
1133
+ video_url: {
1134
+ type: "string",
1135
+ },
1136
+ media_type: {
1137
+ type: ["string", "null"],
1138
+ },
1139
+ additional_params: true,
1140
+ },
1141
+ required: ["type", "video_url"],
1142
+ },
1143
+ {
1144
+ type: "object",
1145
+ properties: {
1146
+ type: {
1147
+ $ref: "#/$defs/ContentType",
1148
+ },
1149
+ document_url: {
1150
+ type: "string",
1151
+ },
1152
+ media_type: {
1153
+ type: ["string", "null"],
1154
+ },
1155
+ additional_params: true,
1156
+ },
1157
+ required: ["type", "document_url"],
1158
+ },
1159
+ ],
1160
+ },
1161
+ ContentType: {
1162
+ type: "string",
1163
+ enum: ["text", "image_url", "audio_url", "video_url", "document_url"],
1164
+ },
1165
+ ImageUrl: {
1166
+ type: "object",
1167
+ properties: {
1168
+ url: {
1169
+ type: "string",
1170
+ },
1171
+ detail: {
1172
+ type: ["string", "null"],
1173
+ },
1174
+ media_type: {
1175
+ type: ["string", "null"],
1176
+ },
1177
+ additional_params: true,
1178
+ },
1179
+ required: ["url"],
1180
+ },
1181
+ DeltaFunctionCall: {
1182
+ type: "object",
1183
+ properties: {
1184
+ index: {
1185
+ type: ["integer", "null"],
1186
+ format: "int32",
1187
+ },
1188
+ id: {
1189
+ type: ["string", "null"],
1190
+ },
1191
+ type: {
1192
+ type: ["string", "null"],
1193
+ },
1194
+ function: {
1195
+ $ref: "#/$defs/DeltaResponseFunction",
1196
+ },
1197
+ },
1198
+ required: ["function"],
1199
+ },
1200
+ DeltaResponseFunction: {
1201
+ type: "object",
1202
+ properties: {
1203
+ name: {
1204
+ type: ["string", "null"],
1205
+ },
1206
+ arguments: {
1207
+ type: ["string", "null"],
1208
+ },
1209
+ },
1210
+ },
1211
+ LogProbs: {
1212
+ type: "object",
1213
+ properties: {
1214
+ content: {
1215
+ type: ["array", "null"],
1216
+ items: {
1217
+ $ref: "#/$defs/TokenLogProbs",
1218
+ },
1219
+ },
1220
+ refusal: {
1221
+ type: ["array", "null"],
1222
+ items: {
1223
+ $ref: "#/$defs/TokenLogProbs",
1224
+ },
1225
+ },
1226
+ },
1227
+ },
1228
+ TokenLogProbs: {
1229
+ type: "object",
1230
+ properties: {
1231
+ token: {
1232
+ type: "string",
1233
+ },
1234
+ logprob: {
1235
+ type: "number",
1236
+ format: "double",
1237
+ },
1238
+ bytes: {
1239
+ type: ["array", "null"],
1240
+ items: {
1241
+ type: "integer",
1242
+ format: "uint8",
1243
+ minimum: 0,
1244
+ maximum: 255,
1245
+ },
1246
+ },
1247
+ top_logprobs: {
1248
+ type: ["array", "null"],
1249
+ items: {
1250
+ $ref: "#/$defs/TopLogProbs",
1251
+ },
1252
+ },
1253
+ },
1254
+ required: ["token", "logprob"],
1255
+ },
1256
+ TopLogProbs: {
1257
+ type: "object",
1258
+ properties: {
1259
+ token: {
1260
+ type: "string",
1261
+ },
1262
+ logprob: {
1263
+ type: "number",
1264
+ format: "double",
1265
+ },
1266
+ bytes: {
1267
+ type: ["array", "null"],
1268
+ items: {
1269
+ type: "integer",
1270
+ format: "uint8",
1271
+ minimum: 0,
1272
+ maximum: 255,
1273
+ },
1274
+ },
1275
+ },
1276
+ required: ["token", "logprob"],
1277
+ },
1278
+ Usage: {
1279
+ type: "object",
1280
+ properties: {
1281
+ completion_tokens: {
1282
+ type: "integer",
1283
+ format: "uint32",
1284
+ minimum: 0,
1285
+ },
1286
+ prompt_tokens: {
1287
+ type: "integer",
1288
+ format: "uint32",
1289
+ minimum: 0,
1290
+ },
1291
+ total_tokens: {
1292
+ type: "integer",
1293
+ format: "uint32",
1294
+ minimum: 0,
1295
+ },
1296
+ cost: {
1297
+ type: ["number", "null"],
1298
+ format: "double",
1299
+ },
1300
+ prompt_tokens_details: {
1301
+ anyOf: [
1302
+ {
1303
+ $ref: "#/$defs/PromptTokenDetails",
1304
+ },
1305
+ {
1306
+ type: "null",
1307
+ },
1308
+ ],
1309
+ },
1310
+ completion_tokens_details: {
1311
+ anyOf: [
1312
+ {
1313
+ $ref: "#/$defs/CompletionTokenDetails",
1314
+ },
1315
+ {
1316
+ type: "null",
1317
+ },
1318
+ ],
1319
+ },
1320
+ upstream_inference_cost: {
1321
+ anyOf: [
1322
+ {
1323
+ $ref: "#/$defs/CostDetails",
1324
+ },
1325
+ {
1326
+ type: "null",
1327
+ },
1328
+ ],
1329
+ },
1330
+ },
1331
+ required: ["completion_tokens", "prompt_tokens", "total_tokens"],
1332
+ },
1333
+ PromptTokenDetails: {
1334
+ type: "object",
1335
+ properties: {
1336
+ cached_tokens: {
1337
+ type: ["integer", "null"],
1338
+ format: "uint32",
1339
+ minimum: 0,
1340
+ },
1341
+ audio_tokens: {
1342
+ type: ["integer", "null"],
1343
+ format: "uint32",
1344
+ minimum: 0,
1345
+ },
1346
+ },
1347
+ },
1348
+ CompletionTokenDetails: {
1349
+ type: "object",
1350
+ properties: {
1351
+ accepted_prediction_tokens: {
1352
+ type: ["integer", "null"],
1353
+ format: "uint32",
1354
+ minimum: 0,
1355
+ },
1356
+ audio_tokens: {
1357
+ type: ["integer", "null"],
1358
+ format: "uint32",
1359
+ minimum: 0,
1360
+ },
1361
+ reasoning_tokens: {
1362
+ type: ["integer", "null"],
1363
+ format: "uint32",
1364
+ minimum: 0,
1365
+ },
1366
+ rejected_prediction_tokens: {
1367
+ type: ["integer", "null"],
1368
+ format: "uint32",
1369
+ minimum: 0,
1370
+ },
1371
+ },
1372
+ },
1373
+ CostDetails: {
1374
+ type: "object",
1375
+ properties: {
1376
+ upstream_inference_cost: {
1377
+ type: ["integer", "null"],
1378
+ format: "uint32",
1379
+ minimum: 0,
1380
+ },
1381
+ },
1382
+ },
1383
+ },
1384
+ },
1385
+ };