dynamo-llm 1.7.0

Dynamo LLM Library
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
{
  "openapi": "3.1.0",
  "info": {
    "title": "Dynamo media protocol",
    "version": "1"
  },
  "paths": {},
  "components": {
    "schemas": {
      "ImageAccounting": {
        "type": "object",
        "description": "Per-request accounting in image units.\n\n`output_images` counts what the response carries, not the requested `n`.\nThe image counts are always present; only `num_inference_steps` can be\nomitted, and an unknown step count is omitted, never written as 0. See\n[`ImageAccounting::merge`] for how a multi-chunk response treats each field.",
        "required": [
          "output_images"
        ],
        "properties": {
          "output_images": {
            "type": "integer",
            "format": "int32",
            "description": "Images generated and returned in `data`.",
            "minimum": 0
          },
          "input_images": {
            "type": "integer",
            "format": "int32",
            "description": "Reference images the request consumed: 0 for text-to-image, 1 for an\n`input_reference` or an `/v1/images/edits` request.",
            "default": 0,
            "minimum": 0
          },
          "num_inference_steps": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "The step count the backend ran. Omitted when the backend does not\nknow it.",
            "minimum": 0
          }
        }
      },
      "ImageBackground": {
        "type": "string",
        "description": "Requested background of the generated images",
        "enum": [
          "auto",
          "transparent",
          "opaque"
        ]
      },
      "ImageData": {
        "type": "object",
        "description": "One generated image. The worker sets one of `url` and `b64_json`.",
        "properties": {
          "url": {
            "type": [
              "string",
              "null"
            ],
            "description": "URL of the generated image (if response_format is \"url\")"
          },
          "b64_json": {
            "type": [
              "string",
              "null"
            ],
            "description": "Base64-encoded image (if response_format is \"b64_json\")"
          },
          "revised_prompt": {
            "type": [
              "string",
              "null"
            ],
            "description": "The prompt the model used, when it rewrote the original prompt"
          }
        }
      },
      "ImageModeration": {
        "type": "string",
        "description": "Content-moderation level of the generation",
        "enum": [
          "auto",
          "low"
        ]
      },
      "ImageNvExt": {
        "type": "object",
        "description": "NVIDIA extensions to the OpenAI Images API",
        "properties": {
          "annotations": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            },
            "description": "Annotations\nUser requests triggers which result in the request issue back out-of-band information in the SSE\nstream using the `event:` field."
          },
          "negative_prompt": {
            "type": [
              "string",
              "null"
            ],
            "description": "A text description of the undesired image(s)."
          },
          "num_inference_steps": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "The number of denoising steps, at least 1. More denoising steps usually lead to a higher quality image at the expense of slower inference.",
            "minimum": 1
          },
          "guidance_scale": {
            "type": [
              "number",
              "null"
            ],
            "format": "float",
            "description": "The CFG scale. Higher values usually lead to more coherent images."
          },
          "seed": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "The seed for the random number generator.\ni64 to match PyTorch's torch.manual_seed() accepted range."
          }
        }
      },
      "ImageOutputFormat": {
        "type": "string",
        "description": "File format of the generated images",
        "enum": [
          "png",
          "jpeg",
          "webp"
        ]
      },
      "ImageQuality": {
        "type": "string",
        "description": "Quality of the generated images",
        "enum": [
          "standard",
          "hd",
          "high",
          "medium",
          "low",
          "xhigh",
          "max",
          "auto"
        ]
      },
      "ImageReferences": {
        "oneOf": [
          {
            "type": "string"
          },
          {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        ],
        "description": "The wire shape of [`NvCreateImageRequest::input_reference`]: one\nreference as a string, two or more as an array. The field itself is a\nlist, which is what a worker reads. One reference goes out as a string\nso a worker whose model has the string field of an earlier release keeps\nreading it. An empty array and a blank reference are rejected, and the\nerror does not repeat the references."
      },
      "ImageResponseBackground": {
        "type": "string",
        "description": "Actual background of the generated images",
        "enum": [
          "transparent",
          "opaque"
        ]
      },
      "ImageStyle": {
        "type": "string",
        "description": "Style of the generated images",
        "enum": [
          "vivid",
          "natural"
        ]
      },
      "ImageTokenDetails": {
        "type": "object",
        "description": "A token count split by kind.",
        "required": [
          "text_tokens",
          "image_tokens"
        ],
        "properties": {
          "text_tokens": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "image_tokens": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "ImageUsage": {
        "type": "object",
        "description": "Token usage of an image generation. Keeps the wire format of the OpenAI\n`ImageGenUsage`, including the singular `output_token_details`.",
        "required": [
          "input_tokens",
          "total_tokens",
          "output_tokens",
          "input_tokens_details"
        ],
        "properties": {
          "input_tokens": {
            "type": "integer",
            "format": "int32",
            "description": "Tokens (image and text) in the input prompt",
            "minimum": 0
          },
          "total_tokens": {
            "type": "integer",
            "format": "int32",
            "description": "Tokens (image and text) used for the generation",
            "minimum": 0
          },
          "output_tokens": {
            "type": "integer",
            "format": "int32",
            "description": "Tokens the model generated",
            "minimum": 0
          },
          "output_token_details": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ImageTokenDetails",
                "description": "The output tokens by kind"
              }
            ]
          },
          "input_tokens_details": {
            "$ref": "#/components/schemas/ImageTokenDetails",
            "description": "The input tokens by kind"
          }
        }
      },
      "ImagesResponseNvExt": {
        "type": "object",
        "description": "NVIDIA extensions to the OpenAI Images API response. Omitted from the\nwire when the worker reports nothing.",
        "properties": {
          "usage": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ImageAccounting",
                "description": "Image-based accounting for models that have no token usage."
              }
            ]
          }
        }
      },
      "MediaDelivery": {
        "type": "string",
        "description": "Delivery mode of generated media: a URL to the file, or the bytes as\nbase64 text.\n\nThe set has two values. A request with an unknown value fails to parse.",
        "enum": [
          "url",
          "b64_json"
        ]
      },
      "NvCreateImageRequest": {
        "type": "object",
        "description": "Request for image generation (/v1/images/generations and /v1/images/edits).\n\nThe OpenAI fields keep the wire format of the OpenAI `CreateImageRequest`;\nthe module documentation says why they are declared here and not wrapped.\n`model` and `size` are free text, because the OpenAI type accepts any\nstring there.",
        "required": [
          "prompt"
        ],
        "properties": {
          "prompt": {
            "type": "string"
          },
          "model": {
            "type": [
              "string",
              "null"
            ]
          },
          "n": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "Number of images to generate, 1 to 10 as the OpenAI API documents.\nThe frontend rejects a value outside the range, so a worker never\nsees one and needs no range check of its own.",
            "maximum": 10,
            "minimum": 1
          },
          "quality": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ImageQuality"
              }
            ]
          },
          "response_format": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/MediaDelivery",
                "description": "Delivery mode of the generated images"
              }
            ]
          },
          "output_format": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ImageOutputFormat"
              }
            ]
          },
          "output_compression": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "Compression level of jpeg and webp output, 0 to 100 percent as the\nOpenAI API documents. The frontend rejects a value outside the range,\nso a worker never sees one.",
            "maximum": 100,
            "minimum": 0
          },
          "stream": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "partial_images": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "Number of partial images to stream before the final image, 0 to 3 as\nthe OpenAI API documents. The frontend rejects a value outside the\nrange, so a worker never sees one.",
            "maximum": 3,
            "minimum": 0
          },
          "size": {
            "type": [
              "string",
              "null"
            ],
            "description": "Image size in WxH format, or \"auto\""
          },
          "moderation": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ImageModeration"
              }
            ]
          },
          "background": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ImageBackground"
              }
            ]
          },
          "style": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ImageStyle"
              }
            ]
          },
          "user": {
            "type": [
              "string",
              "null"
            ]
          },
          "input_reference": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ImageReferences",
                "description": "Ordered references of the images to edit, for image-to-image and\n`/v1/images/edits`. On the wire one reference is a string and two or\nmore are an array: see [`ImageReferences`]."
              }
            ]
          },
          "nvext": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ImageNvExt"
              }
            ]
          },
          "extra_args": {
            "type": [
              "object",
              "null"
            ],
            "description": "Worker-boundary passthrough. The frontend nests unknown top-level request fields (an OpenAI client's extra_body) under the \"media_passthrough\" key.",
            "additionalProperties": true
          }
        }
      },
      "NvImagesResponse": {
        "type": "object",
        "description": "Response for image generation.\n\nKeeps the wire format of the OpenAI `ImagesResponse`, which writes every\nabsent optional field as null. `nvext` is Dynamo's response extension;\nthe key is omitted when the worker reports nothing.",
        "required": [
          "created",
          "data"
        ],
        "properties": {
          "created": {
            "type": "integer",
            "format": "int32",
            "description": "Unix timestamp of creation",
            "minimum": 0
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ImageData"
            }
          },
          "background": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ImageResponseBackground"
              }
            ]
          },
          "output_format": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ImageOutputFormat"
              }
            ]
          },
          "size": {
            "type": [
              "string",
              "null"
            ],
            "description": "Image size in WxH format"
          },
          "quality": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ImageQuality"
              }
            ]
          },
          "usage": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ImageUsage",
                "description": "Token usage of the generation, when the model reports it"
              }
            ]
          },
          "nvext": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ImagesResponseNvExt",
                "description": "Image accounting for models without token usage"
              }
            ]
          }
        }
      }
    }
  }
}