generated from mintlify/starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopenapi3.yml
1337 lines (1274 loc) · 46.3 KB
/
openapi3.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
---
openapi: 3.0.0
info:
title: Fireworks REST API
description:
REST API for performing inference on Fireworks large language models
(LLMs).
version: 0.0.1
servers:
- url: https://api.fireworks.ai/inference/v1/
paths:
"/chat/completions":
post:
operationId: createChatCompletion
summary: POST /chat/completions
description: Creates a model response for the given chat conversation.
requestBody:
required: true
content:
application/json:
schema:
allOf:
- "$ref": "#/components/schemas/CreateChatCompletionExclusiveFields"
- "$ref": "#/components/schemas/BaseCreateCompletionRequest"
responses:
"200":
description: OK
content:
application/json:
schema:
"$ref": "#/components/schemas/CreateChatCompletionResponse"
"/completions":
post:
operationId: createCompletion
summary: POST /completions
description: Creates a completion for the provided prompt and parameters.
requestBody:
required: true
content:
application/json:
schema:
allOf:
- "$ref": "#/components/schemas/CreateCompletionExclusiveFields"
- "$ref": "#/components/schemas/BaseCreateCompletionRequest"
responses:
"200":
description: OK
content:
application/json:
schema:
"$ref": "#/components/schemas/CreateCompletionResponse"
"/image_generation/accounts/fireworks/models/stable-diffusion-xl-1024-v1-0":
post:
summary: Generate a new image from a text prompt
parameters:
- "$ref": "#/components/parameters/HuggingfaceHeader"
requestBody:
required: true
content:
application/json:
schema:
"$ref": "#/components/schemas/CreateImageRequest"
responses:
200:
"$ref": "#/components/responses/ImageResponse"
400:
description: General error for invalid parameters
401:
description: API key missing or invalid
403:
description: Permission denied
404:
description: The requested resource was not found
500:
description: Some unexpected server error occurred
"/image_generation/accounts/fireworks/models/stable-diffusion-xl-1024-v1-0/image_to_image":
post:
summary: Generate a new image from an image
parameters:
- "$ref": "#/components/parameters/HuggingfaceHeader"
requestBody:
required: true
content:
multipart/form-data:
schema:
"$ref": "#/components/schemas/CreateImageToImageRequest"
responses:
200:
"$ref": "#/components/responses/ImageResponse"
400:
description: General error for invalid parameters
401:
description: API key missing or invalid
403:
description: Permission denied
404:
description: The requested resource was not found
500:
description: Some unexpected server error occurred
"/image_generation/accounts/fireworks/models/stable-diffusion-xl-1024-v1-0/control_net":
post:
summary: Generate a new image using ControlNet with provided image as a guidance
parameters:
- "$ref": "#/components/parameters/HuggingfaceHeader"
requestBody:
required: true
content:
multipart/form-data:
schema:
"$ref": "#/components/schemas/CreateControlNetRequest"
responses:
200:
"$ref": "#/components/responses/ImageResponse"
400:
description: General error for invalid parameters
401:
description: API key missing or invalid
403:
description: Permission denied
404:
description: The requested resource was not found
500:
description: Some unexpected server error occurred
"/embeddings":
post:
operationId: createEmbedding
summary: Creates an embedding vector representing the input text.
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/CreateEmbeddingRequest"
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/CreateEmbeddingResponse"
x-oaiMeta:
name: Create embeddings
group: embeddings
returns: A list of embedding objects.
examples:
request:
curl: |
curl https://api.fireworks.ai/inference/v1/embeddings \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "The food was delicious and the waiter...",
"model": "",
"encoding_format": "float"
}'
python: |
from openai import OpenAI
client = OpenAI()
client.embeddings.create(
model="nomic-ai/nomic-embed-text-v1.5",
input="The food was delicious and the waiter...",
encoding_format="float"
)
node.js: |-
import OpenAI from "openai";
const openai = new OpenAI();
async function main() {
const embedding = await openai.embeddings.create({
model: "nomic-ai/nomic-embed-text-v1.5",
input: "The quick brown fox jumped over the lazy dog",
encoding_format: "float",
});
console.log(embedding);
}
main();
response: |
{
"object": "list",
"data": [
{
"object": "embedding",
"embedding": [
0.0023064255,
-0.009327292,
.... (1536 floats total for ada-002)
-0.0028842222,
],
"index": 0
}
],
"model": "nomic-ai/nomic-embed-text-v1.5",
"usage": {
"prompt_tokens": 8,
"total_tokens": 8
}
}
components:
securitySchemes:
BearerAuth:
type: http
scheme: bearer
parameters:
HuggingfaceHeader:
name: Huggingface-Access-Key
in: header
required: false
schema:
type: string
description: Optional Huggingface access key to use for downloading the LoRA adapter. Only needed if LoRA is provided and the corresponsing Huggingface repo is private.
schemas:
Error:
type: object
properties:
type:
type: string
nullable: false
message:
type: string
nullable: false
param:
type: string
nullable: true
code:
type: string
nullable: true
required:
- type
- message
- param
- code
ErrorResponse:
type: object
properties:
error:
"$ref": "#/components/schemas/Error"
required:
- error
ListModelsResponse:
type: object
properties:
object:
type: string
description: The object type, which is always "list".
data:
type: array
items:
"$ref": "#/components/schemas/Model"
required:
- object
- data
Model:
title: Model
properties:
id:
type: string
description: The name of the model.
object:
type: string
description: The object type, which is always "model".
created:
type: integer
description: The Unix time in seconds when the model was created.
owned_by:
type: string
description: The ID of the account that owns the model.
required:
- id
- object
- created
- owned_by
TextPrompt:
type: object
properties:
text:
type: string
description: The prompt itself
example: "A lighthouse on a cliff"
maxLength: 2000
weight:
type: number
description: Weight of the prompt (use negative numbers for negative prompts). Only +1 and -1 are supported right now.
format: float
default: 1
required:
- text
- weight
TextPromptForImageToImage:
type: string
description: |
A JSON encoded array of objects, each with field "text" and "weight".
For weight of the prompt (use negative numbers for negative prompts), only +1 and -1 are supported right now.
Example: "[{\"text\": \"test\", \"weight\": 1}]"
Sampler:
description: We support none and "K_DPMPP_2M" here
enum: [K_DPMPP_2M]
type: string
Samples:
type: integer
description: Number of images to generate
default: 1
example: 1
minimum: 1
maximum: 10
Seed:
type: integer
description: Random noise seed (omit this option or use `0` for a random seed)
default: 0
example: 0
minimum: 0
maximum: 4294967295
Steps:
type: integer
description: Number of diffusion steps to run
default: 50
example: 75
minimum: 10
maximum: 150
InitImage:
type: string
description: Image used to initialize the diffusion process, in lieu of random noise.
example: <image binary>
format: binary
ControlImage:
type: string
description: Image to use as a guidance for ControlNet.
example: <image binary>
format: binary
Height:
type: integer
description: Height of the image in pixels. Supported resolutions (width, height) are (1024, 1024), (1152, 896), (896, 1152), (1216, 832), (832, 1216), (1344, 768), (768, 1344), (1536, 640), and (640, 1536).
default: 1024
minimum: 512
maximum: 1024
Width:
type: integer
description: Width of the image in pixels. Supported resolutions (width, height) are (1024, 1024), (1152, 896), (896, 1152), (1216, 832), (832, 1216), (1344, 768), (768, 1344), (1536, 640), and (640, 1536).
default: 1024
minimum: 512
maximum: 1024
CFGScale:
type: number
description: Configuration scale for the image diffusion process. Adjust the description as needed.
default: 7
BaseImageToImageRequest:
type: object
properties:
prompt:
type: string
description: The prompt to use when transforming the image
negative_prompt:
type: string
description: The negative prompt to use when transforming the image
default: null
init_image:
$ref: '#/components/schemas/InitImage'
init_image_mode:
type: string
cfg_scale:
type: integer
default: 7
clip_guidance_preset:
type: string
default: "NONE"
sampler:
$ref: '#/components/schemas/Sampler'
samples:
$ref: '#/components/schemas/Samples'
seed:
$ref: '#/components/schemas/Seed'
steps:
$ref: '#/components/schemas/Steps'
safety_check:
description: Enable a safety check for each response. If the safety check model detects unsafe content, the response will be filtered with Finish-Reason = CONTENT_FILTERED.
type: boolean
default: false
lora_adapter_name:
description: A huggingface name (e.g. jbilcke-hf/sdxl-botw) that specifies which LoRA adapter to load and run in SDXL inference.
type: string
nullable: true
lora_weight_filename:
description: The filename (e.g. lora.safetensors) of the file within the HF repo to load as the HF adapter.
type: string
nullable: true
ImageStrengthRequest:
allOf:
- $ref: '#/components/schemas/BaseImageToImageRequest'
- type: object
required:
- image_strength
properties:
image_strength:
type: number
format: float
default: 0.1
minimum: 0.0
maximum: 1.0
StepScheduleRequest:
allOf:
- $ref: '#/components/schemas/BaseImageToImageRequest'
- type: object
required:
- step_schedule_start
- step_schedule_end
properties:
step_schedule_start:
type: number
format: float
default: 0.65
step_schedule_end:
type: number
format: float
CreateImageToImageRequest:
discriminator:
propertyName: init_image_mode
mapping:
IMAGE_STRENGTH: '#/components/schemas/ImageStrengthRequest'
STEP_SCHEDULE: '#/components/schemas/StepScheduleRequest'
anyOf:
- $ref: '#/components/schemas/ImageStrengthRequest'
- $ref: '#/components/schemas/StepScheduleRequest'
CreateControlNetRequest:
type: object
description: Request object to transform textual prompts into high-quality images using diffusion models while using image as a guidance via ControlNet.
properties:
prompt:
type: string
description: The prompt to use when transforming the image
negative_prompt:
type: string
description: The negative prompt to use when transforming the image
default: null
control_image:
$ref: '#/components/schemas/ControlImage'
control_net_name:
description: Which ControlNet to use. Currently only "canny" is supported
enum: ["canny"]
type: string
default: "canny"
conditioning_scale:
description: Scaler from 0 to 1 of the guidance strength from control image.
type: number
format: float
default: 0.5
step_schedule_start:
type: number
format: float
default: 0.0
step_schedule_end:
type: number
format: float
default: 1.0
cfg_scale:
$ref: '#/components/schemas/CFGScale'
clip_guidance_preset:
type: string
default: "NONE"
sampler:
$ref: '#/components/schemas/Sampler'
samples:
$ref: '#/components/schemas/Samples'
steps:
$ref: '#/components/schemas/Steps'
seed:
$ref: '#/components/schemas/Seed'
safety_check:
description: Enable a safety check for each response. If the safety check model detects unsafe content, the response will be filtered with Finish-Reason = CONTENT_FILTERED.
type: boolean
default: false
lora_adapter_name:
description: A huggingface name (e.g. jbilcke-hf/sdxl-botw) that specifies which LoRA adapter to load and run in SDXL inference.
type: string
nullable: true
lora_weight_filename:
description: The filename (e.g. lora.safetensors) of the file within the HF repo to load as the HF adapter.
type: string
nullable: true
required:
- model
- prompt
- control_image
CreateImageRequest:
type: object
description: Request object to transform textual prompts into high-quality images using diffusion models.
properties:
height:
$ref: '#/components/schemas/Height'
width:
$ref: '#/components/schemas/Width'
text_prompts:
type: array
items:
'$ref': '#/components/schemas/TextPrompt'
minItems: 1
cfg_scale:
$ref: '#/components/schemas/CFGScale'
sampler:
$ref: '#/components/schemas/Sampler'
samples:
$ref: '#/components/schemas/Samples'
seed:
$ref: '#/components/schemas/Seed'
steps:
$ref: '#/components/schemas/Steps'
safety_check:
description: Enable a safety check for each response. If the safety check model detects unsafe content, the response will be filtered with Finish-Reason = CONTENT_FILTERED.
type: boolean
default: false
lora_adapter_name:
description: A huggingface name (e.g. jbilcke-hf/sdxl-botw) that specifies which LoRA adapter to load and run in SDXL inference.
type: string
nullable: true
lora_weight_filename:
description: The filename (e.g. lora.safetensors) of the file within the HF repo to load as the HF adapter.
type: string
nullable: true
required:
- model
- text_prompts
BaseCreateCompletionRequest:
type: object
properties:
temperature:
type: number
minimum: 0
maximum: 2
default: 1
example: 1
nullable: true
description: |
What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.
We generally recommend altering this or `top_p` but not both.
top_p:
type: number
minimum: 0
maximum: 1
default: 1
example: 1
nullable: true
description: |
An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.
We generally recommend altering this or `temperature` but not both.
top_k:
type: integer
minimum: 1
maximum: 128
example: 50
nullable: true
description: |
Top-k sampling is another sampling method where the k most probable next tokens are filtered and the probability mass is redistributed among only those k next tokens. The value of k controls the number of candidates for the next token at each step during text generation.
frequency_penalty:
type: number
default: 0
minimum: -2
maximum: 2
nullable: true
description: |
Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.
Reasonable value is around 0.1 to 1 if the aim is to just reduce repetitive samples somewhat. If the aim is to strongly suppress repetition, then one can increase the coefficients up to 2, but this can noticeably degrade the quality of samples. Negative values can be used to increase the likelihood of repetition.
See also `presence_penalty` for penalizing tokens that have at least one appearance at a fixed rate.
presence_penalty:
type: number
default: 0
minimum: -2
maximum: 2
nullable: true
description: |
Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.
Reasonable value is around 0.1 to 1 if the aim is to just reduce repetitive samples somewhat. If the aim is to strongly suppress repetition, then one can increase the coefficients up to 2, but this can noticeably degrade the quality of samples. Negative values can be used to increase the likelihood of repetition.
See also `frequence_penalty` for penalizing tokens at an increasing rate depending on how often they appear.
n:
type: integer
minimum: 1
maximum: 128
default: 1
example: 1
nullable: true
description: |
How many completions to generate for each prompt.
**Note:** Because this parameter generates many completions, it can quickly consume your token quota. Use carefully and ensure that you have reasonable settings for `max_tokens` and `stop`.
stop:
description: |
Up to 4 sequences where the API will stop generating further tokens. The returned text will contain the stop sequence.
default: null
oneOf:
- type: string
nullable: true
- type: array
minItems: 1
maxItems: 4
items:
type: string
response_format:
type: object
description: |
Allows to force the model to produce specific output format.
Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the message the model generates is valid JSON.
Optional JSON schema can be provided as `response_format = {"type": "json_object", "schema": <json_schema>}`.
**Important:** when using JSON mode, it's crucial to also instruct the model to produce JSON via a system or user message. Without this, the model may generate an unending stream of whitespace until the generation reaches the token limit, resulting in a long-running and seemingly "stuck" request. Also note that the message content may be partially cut off if `finish_reason="length"`, which indicates the generation exceeded `max_tokens` or the conversation exceeded the max context length. In this case the return value might not be a valid JSON.
nullable: true
default: null
properties:
type:
type: string
enum: ["text", "json_object"]
example: "json_object"
default: "text"
description: Must be one of `text` or `json_object`.
schema:
type: object
default: null
nullable: true
description: |
JSON schema according to https://json-schema.org/specification that can be provided if `"type": "json_object"`.
Most common fields like `type`, `properties`, `items`, `required` and `anyOf` are supported.
More sophisticated cases like `oneOf` might not be covered.
Note: it's an OpenAI API extension.
Example: `{"type": "object", "properties": {"foo": {"type": "string"}, "bar": {"type": "integer"}}, "required": ["foo"]}`
required:
- type
stream:
description: |
Whether to stream back partial progress. If set, tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format)
as they become available, with the stream terminated by a `data: [DONE]` message.
type: boolean
nullable: true
default: false
context_length_exceeded_behavior:
type: string
enum:
- truncate
- error
description: |
What to do if the token count of prompt plus `max_tokens` exceeds the model's context window.
Passing `truncate` limits the `max_tokens` to at most `context_window_length - prompt_length`. This is the default.
Passing `error` would trigger a request error.
The default of 'truncate' is selected as it allows to ask for high `max_tokens` value while respecting the context window length without having to do client-side prompt tokenization.
Note, that it differs from OpenAI's behavior that matches that of `error`.
user:
description: "A unique identifier representing your end-user, which can help monitor and detect abuse"
type: string
nullable: true
CreateCompletionExclusiveFields:
type: object
properties:
model:
description: "The name of the model to use."
type: string
example: accounts/fireworks/models/llama-v2-7b
prompt:
description: |
The prompt to generate completions for.
It can be a single string or an array of strings.
It can also be an array of integers or an array of integer arrays,
which allows to pass already tokenized prompt.
If multiple prompts are specified, several choices with corresponding `index` will be returned in the output."
oneOf:
- type: string
example: The sky is
- type: array
minItems: 1
items:
type: string
example: The sky is
- type: array
minItems: 1
items:
type: integer
example: "[123, 10, 456]"
- type: array
minItems: 1
items:
type: array
minItems: 1
items:
type: integer
example: "[[123, 10, 456], [100, 543]]"
images:
description: |
The list of base64 encoded images for visual language completition generation.
They should be formatted as MIME_TYPE,\<base64 encoded str\>
eg. data:image/jpeg;base64,\<base64 encoded str\>
Additionally, the number of images provided should match the number of '\<image\>' special token in the prompt
type: array
items:
type: string
max_tokens:
type: integer
minimum: 0
default: 16
example: 16
nullable: true
description: |
The maximum number of tokens to generate in the completion.
If the token count of your prompt plus `max_tokens` exceed the model's context length, the behavior is depends on `context_length_exceeded_behavior`. By default, `max_tokens` will be lowered to fit in the context window instead of returning an error.
logprobs:
type: integer
minimum: 0
maximum: 5
default:
nullable: true
description: |
Include the log probabilities on the `logprobs` most likely tokens, as well the chosen tokens. For example, if `logprobs` is 5, the API will return a list of the 5 most likely tokens. The API will always return the `logprob` of the sampled token, so there may be up to `logprobs+1` elements in the response.
The maximum value for `logprobs` is 5.
echo:
type: boolean
default: false
nullable: true
description: "Echo back the prompt in addition to the completion."
required:
- model
- prompt
CreateCompletionResponse:
type: object
properties:
id:
type: string
description: A unique identifier of the response.
object:
type: string
description: The object type, which is always "text_completion".
created:
type: integer
description: The Unix time in seconds when the response was generated.
model:
type: string
description: The model used for the completion.
choices:
type: array
description: The list of generated completion choices.
items:
type: object
required:
- text
- index
- logprobs
- finish_reason
properties:
text:
type: string
description: The completion response.
index:
type: integer
description: The index of the completion choice.
logprobs:
type: object
description: The log probabilities of the most likely tokens.
nullable: true
properties:
tokens:
type: array
items:
type: string
token_logprobs:
type: array
items:
type: number
top_logprobs:
type: array
items:
type: object
additionalProperties:
type: integer
text_offset:
type: array
items:
type: integer
finish_reason:
type: string
description: |
The reason the model stopped generating tokens. This will be "stop" if
the model hit a natural stop point or a provided stop sequence, or
"length" if the maximum number of tokens specified in the request was
reached.
enum:
- stop
- length
usage:
"$ref": "#/components/schemas/UsageInfo"
required:
- id
- object
- created
- model
- choices
CreateChatCompletionExclusiveFields:
type: object
properties:
model:
description: The name of the model to use.
type: string
example: accounts/fireworks/models/llama-v2-7b-chat
messages:
description: A list of messages comprising the conversation so far.
type: array
minItems: 1
items:
"$ref": "#/components/schemas/ChatCompletionRequestMessage"
tools:
type: array
description: >
A list of tools the model may call. Currently, only functions are supported as a tool.
Use this to provide a list of functions the model may generate JSON inputs for.
See the guide for more information and the list of supported models: https://readme.fireworks.ai/docs/function-calling#supported-models
items:
$ref: "#/components/schemas/ChatCompletionTool"
max_tokens:
description: |
The maximum number of tokens to generate in the completion.
If the token count of your prompt (previous messages) plus `max_tokens` exceed the model's context length, the behavior is depends on `context_length_exceeded_behavior`. By default, `max_tokens` will be lowered to fit in the context window instead of returning an error.
default: 200
type: integer
prompt_truncate_len:
description: |
The size to which to truncate chat prompts. Earlier user/assistant messages will be evicted to fit the prompt into this length.
This should usually be set to a number << the max context size of the model, to allow enough remaining tokens for generating a response.
If omitted, you may receive "prompt too long" errors in your responses as conversations grow. Note that even with this set, you may still receive "prompt too long" errors if individual messages are too long for the model context window.
default: 1500
nullable: true
type: integer
required:
- model
- messages
CreateChatCompletionResponse:
type: object
properties:
id:
type: string
description: A unique identifier of the response.
object:
type: string
description: The object type, which is always "chat.completion".
created:
type: integer
description: The Unix time in seconds when the response was generated.
model:
type: string
description: The model used for the chat completion.
choices:
type: array
description: The list of chat completion choices.
items:
type: object
required:
- index
- message
- finish_reason
properties:
index:
type: integer
description: The index of the chat completion choice.
message:
"$ref": "#/components/schemas/ChatCompletionResponseMessage"
finish_reason:
type: string
description: |
The reason the model stopped generating tokens. This will be "stop" if
the model hit a natural stop point or a provided stop sequence, or
"length" if the maximum number of tokens specified in the request was
reached.
enum:
- stop
- length
usage:
"$ref": "#/components/schemas/UsageInfo"
required:
- id
- object
- created
- model
- choices
CreateChatCompletionStreamResponse:
type: object
properties:
id:
type: string
object:
type: string
created:
type: integer
model:
type: string
choices:
type: array
items:
type: object
required:
- index
- delta
- finish_reason
properties:
index:
type: integer
delta:
"$ref": "#/components/schemas/ChatCompletionStreamResponseDelta"
finish_reason:
type: string
enum:
- stop
- length
nullable: true
usage:
"$ref": "#/components/schemas/UsageInfo"
required:
- id
- object
- created
- model
- choices
ChatCompletionRequestMessage:
type: object
properties:
role:
type: string
enum:
- system
- user
- assistant
description:
The role of the messages author. One of `system`, `user`, or
`assistant`.
content:
oneOf:
- type: string
nullable: true
description: |
The contents of the message. `content` is required for all
messages, and may be null for assistant messages with function calls.
- type: array
description: "A list of chat messages that could contain images or texts"
items:
$ref: "#/components/schemas/ChatMessageContent"
name:
type: string
description:
The name of the author of this message. May contain a-z, A-Z,
0-9, and underscores, with a maximum length of 64 characters.
required:
- role
- content
ChatMessageContent:
description: |
The content of the message. Can either be text or image_url.
oneOf:
- type: object
description: "A message containing text"
properties:
type:
type: string