llama-stack-client 0.2.7-rc1 → 0.2.8-rc1

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.
Files changed (196) hide show
  1. package/index.d.mts +3 -0
  2. package/index.d.ts +3 -0
  3. package/index.d.ts.map +1 -1
  4. package/index.js +3 -0
  5. package/index.js.map +1 -1
  6. package/index.mjs +3 -0
  7. package/index.mjs.map +1 -1
  8. package/package.json +1 -1
  9. package/resources/agents/agents.d.ts +13 -1
  10. package/resources/agents/agents.d.ts.map +1 -1
  11. package/resources/agents/agents.js +1 -1
  12. package/resources/agents/agents.js.map +1 -1
  13. package/resources/agents/agents.mjs +1 -1
  14. package/resources/agents/agents.mjs.map +1 -1
  15. package/resources/agents/session.d.ts +1 -1
  16. package/resources/agents/session.js +1 -1
  17. package/resources/agents/session.mjs +1 -1
  18. package/resources/benchmarks.d.ts +28 -1
  19. package/resources/benchmarks.d.ts.map +1 -1
  20. package/resources/benchmarks.js +9 -0
  21. package/resources/benchmarks.js.map +1 -1
  22. package/resources/benchmarks.mjs +9 -0
  23. package/resources/benchmarks.mjs.map +1 -1
  24. package/resources/chat/chat.d.ts +2 -2
  25. package/resources/chat/chat.d.ts.map +1 -1
  26. package/resources/chat/chat.js.map +1 -1
  27. package/resources/chat/chat.mjs.map +1 -1
  28. package/resources/chat/completions.d.ts +1015 -29
  29. package/resources/chat/completions.d.ts.map +1 -1
  30. package/resources/chat/completions.js +13 -0
  31. package/resources/chat/completions.js.map +1 -1
  32. package/resources/chat/completions.mjs +13 -0
  33. package/resources/chat/completions.mjs.map +1 -1
  34. package/resources/chat/index.d.ts +1 -1
  35. package/resources/chat/index.d.ts.map +1 -1
  36. package/resources/chat/index.js.map +1 -1
  37. package/resources/chat/index.mjs.map +1 -1
  38. package/resources/completions.d.ts +18 -18
  39. package/resources/datasets.d.ts +16 -7
  40. package/resources/datasets.d.ts.map +1 -1
  41. package/resources/datasets.js +9 -0
  42. package/resources/datasets.js.map +1 -1
  43. package/resources/datasets.mjs +9 -0
  44. package/resources/datasets.mjs.map +1 -1
  45. package/resources/index.d.ts +1 -0
  46. package/resources/index.d.ts.map +1 -1
  47. package/resources/index.js +3 -1
  48. package/resources/index.js.map +1 -1
  49. package/resources/index.mjs +1 -0
  50. package/resources/index.mjs.map +1 -1
  51. package/resources/inference.d.ts +51 -12
  52. package/resources/inference.d.ts.map +1 -1
  53. package/resources/inference.js +6 -0
  54. package/resources/inference.js.map +1 -1
  55. package/resources/inference.mjs +6 -0
  56. package/resources/inference.mjs.map +1 -1
  57. package/resources/inspect.d.ts +6 -0
  58. package/resources/inspect.d.ts.map +1 -1
  59. package/resources/inspect.js +6 -0
  60. package/resources/inspect.js.map +1 -1
  61. package/resources/inspect.mjs +6 -0
  62. package/resources/inspect.mjs.map +1 -1
  63. package/resources/models.d.ts +28 -1
  64. package/resources/models.d.ts.map +1 -1
  65. package/resources/models.js +12 -0
  66. package/resources/models.js.map +1 -1
  67. package/resources/models.mjs +12 -0
  68. package/resources/models.mjs.map +1 -1
  69. package/resources/post-training/job.d.ts +21 -0
  70. package/resources/post-training/job.d.ts.map +1 -1
  71. package/resources/post-training/job.js +12 -0
  72. package/resources/post-training/job.js.map +1 -1
  73. package/resources/post-training/job.mjs +12 -0
  74. package/resources/post-training/job.mjs.map +1 -1
  75. package/resources/post-training/post-training.d.ts +54 -0
  76. package/resources/post-training/post-training.d.ts.map +1 -1
  77. package/resources/post-training/post-training.js +6 -0
  78. package/resources/post-training/post-training.js.map +1 -1
  79. package/resources/post-training/post-training.mjs +6 -0
  80. package/resources/post-training/post-training.mjs.map +1 -1
  81. package/resources/providers.d.ts +6 -0
  82. package/resources/providers.d.ts.map +1 -1
  83. package/resources/providers.js +6 -0
  84. package/resources/providers.js.map +1 -1
  85. package/resources/providers.mjs +6 -0
  86. package/resources/providers.mjs.map +1 -1
  87. package/resources/responses.d.ts +360 -0
  88. package/resources/responses.d.ts.map +1 -0
  89. package/resources/responses.js +29 -0
  90. package/resources/responses.js.map +1 -0
  91. package/resources/responses.mjs +25 -0
  92. package/resources/responses.mjs.map +1 -0
  93. package/resources/routes.d.ts +3 -0
  94. package/resources/routes.d.ts.map +1 -1
  95. package/resources/routes.js +3 -0
  96. package/resources/routes.js.map +1 -1
  97. package/resources/routes.mjs +3 -0
  98. package/resources/routes.mjs.map +1 -1
  99. package/resources/safety.d.ts +12 -0
  100. package/resources/safety.d.ts.map +1 -1
  101. package/resources/safety.js +3 -0
  102. package/resources/safety.js.map +1 -1
  103. package/resources/safety.mjs +3 -0
  104. package/resources/safety.mjs.map +1 -1
  105. package/resources/scoring-functions.d.ts +31 -6
  106. package/resources/scoring-functions.d.ts.map +1 -1
  107. package/resources/scoring-functions.js +9 -0
  108. package/resources/scoring-functions.js.map +1 -1
  109. package/resources/scoring-functions.mjs +9 -0
  110. package/resources/scoring-functions.mjs.map +1 -1
  111. package/resources/scoring.d.ts +12 -0
  112. package/resources/scoring.d.ts.map +1 -1
  113. package/resources/scoring.js +3 -0
  114. package/resources/scoring.js.map +1 -1
  115. package/resources/scoring.mjs +3 -0
  116. package/resources/scoring.mjs.map +1 -1
  117. package/resources/shared.d.ts +23 -0
  118. package/resources/shared.d.ts.map +1 -1
  119. package/resources/shields.d.ts +22 -1
  120. package/resources/shields.d.ts.map +1 -1
  121. package/resources/shields.js +9 -0
  122. package/resources/shields.js.map +1 -1
  123. package/resources/shields.mjs +9 -0
  124. package/resources/shields.mjs.map +1 -1
  125. package/resources/telemetry.d.ts +66 -0
  126. package/resources/telemetry.d.ts.map +1 -1
  127. package/resources/telemetry.js +21 -0
  128. package/resources/telemetry.js.map +1 -1
  129. package/resources/telemetry.mjs +21 -0
  130. package/resources/telemetry.mjs.map +1 -1
  131. package/resources/tool-runtime/rag-tool.d.ts +3 -0
  132. package/resources/tool-runtime/rag-tool.d.ts.map +1 -1
  133. package/resources/tool-runtime/tool-runtime.d.ts +19 -1
  134. package/resources/tool-runtime/tool-runtime.d.ts.map +1 -1
  135. package/resources/tool-runtime/tool-runtime.js +1 -1
  136. package/resources/tool-runtime/tool-runtime.js.map +1 -1
  137. package/resources/tool-runtime/tool-runtime.mjs +1 -1
  138. package/resources/tool-runtime/tool-runtime.mjs.map +1 -1
  139. package/resources/toolgroups.d.ts +22 -4
  140. package/resources/toolgroups.d.ts.map +1 -1
  141. package/resources/toolgroups.js +6 -3
  142. package/resources/toolgroups.js.map +1 -1
  143. package/resources/toolgroups.mjs +6 -3
  144. package/resources/toolgroups.mjs.map +1 -1
  145. package/resources/tools.d.ts +8 -2
  146. package/resources/tools.d.ts.map +1 -1
  147. package/resources/tools.js +3 -0
  148. package/resources/tools.js.map +1 -1
  149. package/resources/tools.mjs +3 -0
  150. package/resources/tools.mjs.map +1 -1
  151. package/resources/vector-dbs.d.ts +30 -3
  152. package/resources/vector-dbs.d.ts.map +1 -1
  153. package/resources/vector-dbs.js +12 -0
  154. package/resources/vector-dbs.js.map +1 -1
  155. package/resources/vector-dbs.mjs +12 -0
  156. package/resources/vector-dbs.mjs.map +1 -1
  157. package/resources/vector-io.d.ts +22 -1
  158. package/resources/vector-io.d.ts.map +1 -1
  159. package/resources/vector-io.js +6 -0
  160. package/resources/vector-io.js.map +1 -1
  161. package/resources/vector-io.mjs +6 -0
  162. package/resources/vector-io.mjs.map +1 -1
  163. package/src/index.ts +23 -0
  164. package/src/resources/agents/agents.ts +13 -1
  165. package/src/resources/agents/session.ts +1 -1
  166. package/src/resources/benchmarks.ts +29 -2
  167. package/src/resources/chat/chat.ts +6 -0
  168. package/src/resources/chat/completions.ts +1429 -35
  169. package/src/resources/chat/index.ts +3 -0
  170. package/src/resources/completions.ts +18 -18
  171. package/src/resources/datasets.ts +19 -10
  172. package/src/resources/index.ts +10 -0
  173. package/src/resources/inference.ts +51 -12
  174. package/src/resources/inspect.ts +6 -0
  175. package/src/resources/models.ts +29 -2
  176. package/src/resources/post-training/job.ts +21 -0
  177. package/src/resources/post-training/post-training.ts +54 -0
  178. package/src/resources/providers.ts +6 -0
  179. package/src/resources/responses.ts +624 -0
  180. package/src/resources/routes.ts +3 -0
  181. package/src/resources/safety.ts +12 -0
  182. package/src/resources/scoring-functions.ts +40 -15
  183. package/src/resources/scoring.ts +12 -0
  184. package/src/resources/shared.ts +25 -0
  185. package/src/resources/shields.ts +23 -2
  186. package/src/resources/telemetry.ts +66 -0
  187. package/src/resources/tool-runtime/rag-tool.ts +3 -0
  188. package/src/resources/tool-runtime/tool-runtime.ts +19 -1
  189. package/src/resources/toolgroups.ts +23 -5
  190. package/src/resources/tools.ts +9 -3
  191. package/src/resources/vector-dbs.ts +33 -6
  192. package/src/resources/vector-io.ts +22 -1
  193. package/src/version.ts +1 -1
  194. package/version.d.ts +1 -1
  195. package/version.js +1 -1
  196. package/version.mjs +1 -1
@@ -1,6 +1,7 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  import { APIResource } from '../../resource';
4
+ import { isRequestOptions } from '../../core';
4
5
  import { APIPromise } from '../../core';
5
6
  import * as Core from '../../core';
6
7
  import * as CompletionsAPI from './completions';
@@ -34,20 +35,1118 @@ export class Completions extends APIResource {
34
35
  stream: body.stream ?? false,
35
36
  }) as APIPromise<CompletionCreateResponse> | APIPromise<Stream<ChatAPI.ChatCompletionChunk>>;
36
37
  }
38
+
39
+ /**
40
+ * Describe a chat completion by its ID.
41
+ */
42
+ retrieve(completionId: string, options?: Core.RequestOptions): Core.APIPromise<CompletionRetrieveResponse> {
43
+ return this._client.get(`/v1/openai/v1/chat/completions/${completionId}`, options);
44
+ }
45
+
46
+ /**
47
+ * List all chat completions.
48
+ */
49
+ list(query?: CompletionListParams, options?: Core.RequestOptions): Core.APIPromise<CompletionListResponse>;
50
+ list(options?: Core.RequestOptions): Core.APIPromise<CompletionListResponse>;
51
+ list(
52
+ query: CompletionListParams | Core.RequestOptions = {},
53
+ options?: Core.RequestOptions,
54
+ ): Core.APIPromise<CompletionListResponse> {
55
+ if (isRequestOptions(query)) {
56
+ return this.list({}, query);
57
+ }
58
+ return this._client.get('/v1/openai/v1/chat/completions', { query, ...options });
59
+ }
37
60
  }
38
61
 
39
- /**
40
- * Response from an OpenAI-compatible chat completion request.
41
- */
42
- export type CompletionCreateResponse =
43
- | CompletionCreateResponse.OpenAIChatCompletion
44
- | ChatAPI.ChatCompletionChunk;
62
+ /**
63
+ * Response from an OpenAI-compatible chat completion request.
64
+ */
65
+ export type CompletionCreateResponse =
66
+ | CompletionCreateResponse.OpenAIChatCompletion
67
+ | ChatAPI.ChatCompletionChunk;
68
+
69
+ export namespace CompletionCreateResponse {
70
+ /**
71
+ * Response from an OpenAI-compatible chat completion request.
72
+ */
73
+ export interface OpenAIChatCompletion {
74
+ /**
75
+ * The ID of the chat completion
76
+ */
77
+ id: string;
78
+
79
+ /**
80
+ * List of choices
81
+ */
82
+ choices: Array<OpenAIChatCompletion.Choice>;
83
+
84
+ /**
85
+ * The Unix timestamp in seconds when the chat completion was created
86
+ */
87
+ created: number;
88
+
89
+ /**
90
+ * The model that was used to generate the chat completion
91
+ */
92
+ model: string;
93
+
94
+ /**
95
+ * The object type, which will be "chat.completion"
96
+ */
97
+ object: 'chat.completion';
98
+ }
99
+
100
+ export namespace OpenAIChatCompletion {
101
+ /**
102
+ * A choice from an OpenAI-compatible chat completion response.
103
+ */
104
+ export interface Choice {
105
+ /**
106
+ * The reason the model stopped generating
107
+ */
108
+ finish_reason: string;
109
+
110
+ /**
111
+ * The index of the choice
112
+ */
113
+ index: number;
114
+
115
+ /**
116
+ * The message from the model
117
+ */
118
+ message:
119
+ | Choice.OpenAIUserMessageParam
120
+ | Choice.OpenAISystemMessageParam
121
+ | Choice.OpenAIAssistantMessageParam
122
+ | Choice.OpenAIToolMessageParam
123
+ | Choice.OpenAIDeveloperMessageParam;
124
+
125
+ /**
126
+ * (Optional) The log probabilities for the tokens in the message
127
+ */
128
+ logprobs?: Choice.Logprobs;
129
+ }
130
+
131
+ export namespace Choice {
132
+ /**
133
+ * A message from the user in an OpenAI-compatible chat completion request.
134
+ */
135
+ export interface OpenAIUserMessageParam {
136
+ /**
137
+ * The content of the message, which can include text and other media
138
+ */
139
+ content:
140
+ | string
141
+ | Array<
142
+ | OpenAIUserMessageParam.OpenAIChatCompletionContentPartTextParam
143
+ | OpenAIUserMessageParam.OpenAIChatCompletionContentPartImageParam
144
+ >;
145
+
146
+ /**
147
+ * Must be "user" to identify this as a user message
148
+ */
149
+ role: 'user';
150
+
151
+ /**
152
+ * (Optional) The name of the user message participant.
153
+ */
154
+ name?: string;
155
+ }
156
+
157
+ export namespace OpenAIUserMessageParam {
158
+ export interface OpenAIChatCompletionContentPartTextParam {
159
+ text: string;
160
+
161
+ type: 'text';
162
+ }
163
+
164
+ export interface OpenAIChatCompletionContentPartImageParam {
165
+ image_url: OpenAIChatCompletionContentPartImageParam.ImageURL;
166
+
167
+ type: 'image_url';
168
+ }
169
+
170
+ export namespace OpenAIChatCompletionContentPartImageParam {
171
+ export interface ImageURL {
172
+ url: string;
173
+
174
+ detail?: string;
175
+ }
176
+ }
177
+ }
178
+
179
+ /**
180
+ * A system message providing instructions or context to the model.
181
+ */
182
+ export interface OpenAISystemMessageParam {
183
+ /**
184
+ * The content of the "system prompt". If multiple system messages are provided,
185
+ * they are concatenated. The underlying Llama Stack code may also add other system
186
+ * messages (for example, for formatting tool definitions).
187
+ */
188
+ content:
189
+ | string
190
+ | Array<
191
+ | OpenAISystemMessageParam.OpenAIChatCompletionContentPartTextParam
192
+ | OpenAISystemMessageParam.OpenAIChatCompletionContentPartImageParam
193
+ >;
194
+
195
+ /**
196
+ * Must be "system" to identify this as a system message
197
+ */
198
+ role: 'system';
199
+
200
+ /**
201
+ * (Optional) The name of the system message participant.
202
+ */
203
+ name?: string;
204
+ }
205
+
206
+ export namespace OpenAISystemMessageParam {
207
+ export interface OpenAIChatCompletionContentPartTextParam {
208
+ text: string;
209
+
210
+ type: 'text';
211
+ }
212
+
213
+ export interface OpenAIChatCompletionContentPartImageParam {
214
+ image_url: OpenAIChatCompletionContentPartImageParam.ImageURL;
215
+
216
+ type: 'image_url';
217
+ }
218
+
219
+ export namespace OpenAIChatCompletionContentPartImageParam {
220
+ export interface ImageURL {
221
+ url: string;
222
+
223
+ detail?: string;
224
+ }
225
+ }
226
+ }
227
+
228
+ /**
229
+ * A message containing the model's (assistant) response in an OpenAI-compatible
230
+ * chat completion request.
231
+ */
232
+ export interface OpenAIAssistantMessageParam {
233
+ /**
234
+ * Must be "assistant" to identify this as the model's response
235
+ */
236
+ role: 'assistant';
237
+
238
+ /**
239
+ * The content of the model's response
240
+ */
241
+ content?:
242
+ | string
243
+ | Array<
244
+ | OpenAIAssistantMessageParam.OpenAIChatCompletionContentPartTextParam
245
+ | OpenAIAssistantMessageParam.OpenAIChatCompletionContentPartImageParam
246
+ >;
247
+
248
+ /**
249
+ * (Optional) The name of the assistant message participant.
250
+ */
251
+ name?: string;
252
+
253
+ /**
254
+ * List of tool calls. Each tool call is an OpenAIChatCompletionToolCall object.
255
+ */
256
+ tool_calls?: Array<OpenAIAssistantMessageParam.ToolCall>;
257
+ }
258
+
259
+ export namespace OpenAIAssistantMessageParam {
260
+ export interface OpenAIChatCompletionContentPartTextParam {
261
+ text: string;
262
+
263
+ type: 'text';
264
+ }
265
+
266
+ export interface OpenAIChatCompletionContentPartImageParam {
267
+ image_url: OpenAIChatCompletionContentPartImageParam.ImageURL;
268
+
269
+ type: 'image_url';
270
+ }
271
+
272
+ export namespace OpenAIChatCompletionContentPartImageParam {
273
+ export interface ImageURL {
274
+ url: string;
275
+
276
+ detail?: string;
277
+ }
278
+ }
279
+
280
+ export interface ToolCall {
281
+ type: 'function';
282
+
283
+ id?: string;
284
+
285
+ function?: ToolCall.Function;
286
+
287
+ index?: number;
288
+ }
289
+
290
+ export namespace ToolCall {
291
+ export interface Function {
292
+ arguments?: string;
293
+
294
+ name?: string;
295
+ }
296
+ }
297
+ }
298
+
299
+ /**
300
+ * A message representing the result of a tool invocation in an OpenAI-compatible
301
+ * chat completion request.
302
+ */
303
+ export interface OpenAIToolMessageParam {
304
+ /**
305
+ * The response content from the tool
306
+ */
307
+ content:
308
+ | string
309
+ | Array<
310
+ | OpenAIToolMessageParam.OpenAIChatCompletionContentPartTextParam
311
+ | OpenAIToolMessageParam.OpenAIChatCompletionContentPartImageParam
312
+ >;
313
+
314
+ /**
315
+ * Must be "tool" to identify this as a tool response
316
+ */
317
+ role: 'tool';
318
+
319
+ /**
320
+ * Unique identifier for the tool call this response is for
321
+ */
322
+ tool_call_id: string;
323
+ }
324
+
325
+ export namespace OpenAIToolMessageParam {
326
+ export interface OpenAIChatCompletionContentPartTextParam {
327
+ text: string;
328
+
329
+ type: 'text';
330
+ }
331
+
332
+ export interface OpenAIChatCompletionContentPartImageParam {
333
+ image_url: OpenAIChatCompletionContentPartImageParam.ImageURL;
334
+
335
+ type: 'image_url';
336
+ }
337
+
338
+ export namespace OpenAIChatCompletionContentPartImageParam {
339
+ export interface ImageURL {
340
+ url: string;
341
+
342
+ detail?: string;
343
+ }
344
+ }
345
+ }
346
+
347
+ /**
348
+ * A message from the developer in an OpenAI-compatible chat completion request.
349
+ */
350
+ export interface OpenAIDeveloperMessageParam {
351
+ /**
352
+ * The content of the developer message
353
+ */
354
+ content:
355
+ | string
356
+ | Array<
357
+ | OpenAIDeveloperMessageParam.OpenAIChatCompletionContentPartTextParam
358
+ | OpenAIDeveloperMessageParam.OpenAIChatCompletionContentPartImageParam
359
+ >;
360
+
361
+ /**
362
+ * Must be "developer" to identify this as a developer message
363
+ */
364
+ role: 'developer';
365
+
366
+ /**
367
+ * (Optional) The name of the developer message participant.
368
+ */
369
+ name?: string;
370
+ }
371
+
372
+ export namespace OpenAIDeveloperMessageParam {
373
+ export interface OpenAIChatCompletionContentPartTextParam {
374
+ text: string;
375
+
376
+ type: 'text';
377
+ }
378
+
379
+ export interface OpenAIChatCompletionContentPartImageParam {
380
+ image_url: OpenAIChatCompletionContentPartImageParam.ImageURL;
381
+
382
+ type: 'image_url';
383
+ }
384
+
385
+ export namespace OpenAIChatCompletionContentPartImageParam {
386
+ export interface ImageURL {
387
+ url: string;
388
+
389
+ detail?: string;
390
+ }
391
+ }
392
+ }
393
+
394
+ /**
395
+ * (Optional) The log probabilities for the tokens in the message
396
+ */
397
+ export interface Logprobs {
398
+ /**
399
+ * (Optional) The log probabilities for the tokens in the message
400
+ */
401
+ content?: Array<Logprobs.Content>;
402
+
403
+ /**
404
+ * (Optional) The log probabilities for the tokens in the message
405
+ */
406
+ refusal?: Array<Logprobs.Refusal>;
407
+ }
408
+
409
+ export namespace Logprobs {
410
+ /**
411
+ * The log probability for a token from an OpenAI-compatible chat completion
412
+ * response.
413
+ */
414
+ export interface Content {
415
+ token: string;
416
+
417
+ logprob: number;
418
+
419
+ top_logprobs: Array<Content.TopLogprob>;
420
+
421
+ bytes?: Array<number>;
422
+ }
423
+
424
+ export namespace Content {
425
+ /**
426
+ * The top log probability for a token from an OpenAI-compatible chat completion
427
+ * response.
428
+ */
429
+ export interface TopLogprob {
430
+ token: string;
431
+
432
+ logprob: number;
433
+
434
+ bytes?: Array<number>;
435
+ }
436
+ }
437
+
438
+ /**
439
+ * The log probability for a token from an OpenAI-compatible chat completion
440
+ * response.
441
+ */
442
+ export interface Refusal {
443
+ token: string;
444
+
445
+ logprob: number;
446
+
447
+ top_logprobs: Array<Refusal.TopLogprob>;
448
+
449
+ bytes?: Array<number>;
450
+ }
451
+
452
+ export namespace Refusal {
453
+ /**
454
+ * The top log probability for a token from an OpenAI-compatible chat completion
455
+ * response.
456
+ */
457
+ export interface TopLogprob {
458
+ token: string;
459
+
460
+ logprob: number;
461
+
462
+ bytes?: Array<number>;
463
+ }
464
+ }
465
+ }
466
+ }
467
+ }
468
+ }
469
+
470
+ export interface CompletionRetrieveResponse {
471
+ /**
472
+ * The ID of the chat completion
473
+ */
474
+ id: string;
475
+
476
+ /**
477
+ * List of choices
478
+ */
479
+ choices: Array<CompletionRetrieveResponse.Choice>;
480
+
481
+ /**
482
+ * The Unix timestamp in seconds when the chat completion was created
483
+ */
484
+ created: number;
485
+
486
+ input_messages: Array<
487
+ | CompletionRetrieveResponse.OpenAIUserMessageParam
488
+ | CompletionRetrieveResponse.OpenAISystemMessageParam
489
+ | CompletionRetrieveResponse.OpenAIAssistantMessageParam
490
+ | CompletionRetrieveResponse.OpenAIToolMessageParam
491
+ | CompletionRetrieveResponse.OpenAIDeveloperMessageParam
492
+ >;
493
+
494
+ /**
495
+ * The model that was used to generate the chat completion
496
+ */
497
+ model: string;
498
+
499
+ /**
500
+ * The object type, which will be "chat.completion"
501
+ */
502
+ object: 'chat.completion';
503
+ }
504
+
505
+ export namespace CompletionRetrieveResponse {
506
+ /**
507
+ * A choice from an OpenAI-compatible chat completion response.
508
+ */
509
+ export interface Choice {
510
+ /**
511
+ * The reason the model stopped generating
512
+ */
513
+ finish_reason: string;
514
+
515
+ /**
516
+ * The index of the choice
517
+ */
518
+ index: number;
519
+
520
+ /**
521
+ * The message from the model
522
+ */
523
+ message:
524
+ | Choice.OpenAIUserMessageParam
525
+ | Choice.OpenAISystemMessageParam
526
+ | Choice.OpenAIAssistantMessageParam
527
+ | Choice.OpenAIToolMessageParam
528
+ | Choice.OpenAIDeveloperMessageParam;
529
+
530
+ /**
531
+ * (Optional) The log probabilities for the tokens in the message
532
+ */
533
+ logprobs?: Choice.Logprobs;
534
+ }
535
+
536
+ export namespace Choice {
537
+ /**
538
+ * A message from the user in an OpenAI-compatible chat completion request.
539
+ */
540
+ export interface OpenAIUserMessageParam {
541
+ /**
542
+ * The content of the message, which can include text and other media
543
+ */
544
+ content:
545
+ | string
546
+ | Array<
547
+ | OpenAIUserMessageParam.OpenAIChatCompletionContentPartTextParam
548
+ | OpenAIUserMessageParam.OpenAIChatCompletionContentPartImageParam
549
+ >;
550
+
551
+ /**
552
+ * Must be "user" to identify this as a user message
553
+ */
554
+ role: 'user';
555
+
556
+ /**
557
+ * (Optional) The name of the user message participant.
558
+ */
559
+ name?: string;
560
+ }
561
+
562
+ export namespace OpenAIUserMessageParam {
563
+ export interface OpenAIChatCompletionContentPartTextParam {
564
+ text: string;
565
+
566
+ type: 'text';
567
+ }
568
+
569
+ export interface OpenAIChatCompletionContentPartImageParam {
570
+ image_url: OpenAIChatCompletionContentPartImageParam.ImageURL;
571
+
572
+ type: 'image_url';
573
+ }
574
+
575
+ export namespace OpenAIChatCompletionContentPartImageParam {
576
+ export interface ImageURL {
577
+ url: string;
578
+
579
+ detail?: string;
580
+ }
581
+ }
582
+ }
583
+
584
+ /**
585
+ * A system message providing instructions or context to the model.
586
+ */
587
+ export interface OpenAISystemMessageParam {
588
+ /**
589
+ * The content of the "system prompt". If multiple system messages are provided,
590
+ * they are concatenated. The underlying Llama Stack code may also add other system
591
+ * messages (for example, for formatting tool definitions).
592
+ */
593
+ content:
594
+ | string
595
+ | Array<
596
+ | OpenAISystemMessageParam.OpenAIChatCompletionContentPartTextParam
597
+ | OpenAISystemMessageParam.OpenAIChatCompletionContentPartImageParam
598
+ >;
599
+
600
+ /**
601
+ * Must be "system" to identify this as a system message
602
+ */
603
+ role: 'system';
604
+
605
+ /**
606
+ * (Optional) The name of the system message participant.
607
+ */
608
+ name?: string;
609
+ }
610
+
611
+ export namespace OpenAISystemMessageParam {
612
+ export interface OpenAIChatCompletionContentPartTextParam {
613
+ text: string;
614
+
615
+ type: 'text';
616
+ }
617
+
618
+ export interface OpenAIChatCompletionContentPartImageParam {
619
+ image_url: OpenAIChatCompletionContentPartImageParam.ImageURL;
620
+
621
+ type: 'image_url';
622
+ }
623
+
624
+ export namespace OpenAIChatCompletionContentPartImageParam {
625
+ export interface ImageURL {
626
+ url: string;
627
+
628
+ detail?: string;
629
+ }
630
+ }
631
+ }
632
+
633
+ /**
634
+ * A message containing the model's (assistant) response in an OpenAI-compatible
635
+ * chat completion request.
636
+ */
637
+ export interface OpenAIAssistantMessageParam {
638
+ /**
639
+ * Must be "assistant" to identify this as the model's response
640
+ */
641
+ role: 'assistant';
642
+
643
+ /**
644
+ * The content of the model's response
645
+ */
646
+ content?:
647
+ | string
648
+ | Array<
649
+ | OpenAIAssistantMessageParam.OpenAIChatCompletionContentPartTextParam
650
+ | OpenAIAssistantMessageParam.OpenAIChatCompletionContentPartImageParam
651
+ >;
652
+
653
+ /**
654
+ * (Optional) The name of the assistant message participant.
655
+ */
656
+ name?: string;
657
+
658
+ /**
659
+ * List of tool calls. Each tool call is an OpenAIChatCompletionToolCall object.
660
+ */
661
+ tool_calls?: Array<OpenAIAssistantMessageParam.ToolCall>;
662
+ }
663
+
664
+ export namespace OpenAIAssistantMessageParam {
665
+ export interface OpenAIChatCompletionContentPartTextParam {
666
+ text: string;
667
+
668
+ type: 'text';
669
+ }
670
+
671
+ export interface OpenAIChatCompletionContentPartImageParam {
672
+ image_url: OpenAIChatCompletionContentPartImageParam.ImageURL;
673
+
674
+ type: 'image_url';
675
+ }
676
+
677
+ export namespace OpenAIChatCompletionContentPartImageParam {
678
+ export interface ImageURL {
679
+ url: string;
680
+
681
+ detail?: string;
682
+ }
683
+ }
684
+
685
+ export interface ToolCall {
686
+ type: 'function';
687
+
688
+ id?: string;
689
+
690
+ function?: ToolCall.Function;
691
+
692
+ index?: number;
693
+ }
694
+
695
+ export namespace ToolCall {
696
+ export interface Function {
697
+ arguments?: string;
698
+
699
+ name?: string;
700
+ }
701
+ }
702
+ }
703
+
704
+ /**
705
+ * A message representing the result of a tool invocation in an OpenAI-compatible
706
+ * chat completion request.
707
+ */
708
+ export interface OpenAIToolMessageParam {
709
+ /**
710
+ * The response content from the tool
711
+ */
712
+ content:
713
+ | string
714
+ | Array<
715
+ | OpenAIToolMessageParam.OpenAIChatCompletionContentPartTextParam
716
+ | OpenAIToolMessageParam.OpenAIChatCompletionContentPartImageParam
717
+ >;
718
+
719
+ /**
720
+ * Must be "tool" to identify this as a tool response
721
+ */
722
+ role: 'tool';
723
+
724
+ /**
725
+ * Unique identifier for the tool call this response is for
726
+ */
727
+ tool_call_id: string;
728
+ }
729
+
730
+ export namespace OpenAIToolMessageParam {
731
+ export interface OpenAIChatCompletionContentPartTextParam {
732
+ text: string;
733
+
734
+ type: 'text';
735
+ }
736
+
737
+ export interface OpenAIChatCompletionContentPartImageParam {
738
+ image_url: OpenAIChatCompletionContentPartImageParam.ImageURL;
739
+
740
+ type: 'image_url';
741
+ }
742
+
743
+ export namespace OpenAIChatCompletionContentPartImageParam {
744
+ export interface ImageURL {
745
+ url: string;
746
+
747
+ detail?: string;
748
+ }
749
+ }
750
+ }
751
+
752
+ /**
753
+ * A message from the developer in an OpenAI-compatible chat completion request.
754
+ */
755
+ export interface OpenAIDeveloperMessageParam {
756
+ /**
757
+ * The content of the developer message
758
+ */
759
+ content:
760
+ | string
761
+ | Array<
762
+ | OpenAIDeveloperMessageParam.OpenAIChatCompletionContentPartTextParam
763
+ | OpenAIDeveloperMessageParam.OpenAIChatCompletionContentPartImageParam
764
+ >;
765
+
766
+ /**
767
+ * Must be "developer" to identify this as a developer message
768
+ */
769
+ role: 'developer';
770
+
771
+ /**
772
+ * (Optional) The name of the developer message participant.
773
+ */
774
+ name?: string;
775
+ }
776
+
777
+ export namespace OpenAIDeveloperMessageParam {
778
+ export interface OpenAIChatCompletionContentPartTextParam {
779
+ text: string;
780
+
781
+ type: 'text';
782
+ }
783
+
784
+ export interface OpenAIChatCompletionContentPartImageParam {
785
+ image_url: OpenAIChatCompletionContentPartImageParam.ImageURL;
786
+
787
+ type: 'image_url';
788
+ }
789
+
790
+ export namespace OpenAIChatCompletionContentPartImageParam {
791
+ export interface ImageURL {
792
+ url: string;
793
+
794
+ detail?: string;
795
+ }
796
+ }
797
+ }
798
+
799
+ /**
800
+ * (Optional) The log probabilities for the tokens in the message
801
+ */
802
+ export interface Logprobs {
803
+ /**
804
+ * (Optional) The log probabilities for the tokens in the message
805
+ */
806
+ content?: Array<Logprobs.Content>;
807
+
808
+ /**
809
+ * (Optional) The log probabilities for the tokens in the message
810
+ */
811
+ refusal?: Array<Logprobs.Refusal>;
812
+ }
813
+
814
+ export namespace Logprobs {
815
+ /**
816
+ * The log probability for a token from an OpenAI-compatible chat completion
817
+ * response.
818
+ */
819
+ export interface Content {
820
+ token: string;
821
+
822
+ logprob: number;
823
+
824
+ top_logprobs: Array<Content.TopLogprob>;
825
+
826
+ bytes?: Array<number>;
827
+ }
828
+
829
+ export namespace Content {
830
+ /**
831
+ * The top log probability for a token from an OpenAI-compatible chat completion
832
+ * response.
833
+ */
834
+ export interface TopLogprob {
835
+ token: string;
836
+
837
+ logprob: number;
838
+
839
+ bytes?: Array<number>;
840
+ }
841
+ }
842
+
843
+ /**
844
+ * The log probability for a token from an OpenAI-compatible chat completion
845
+ * response.
846
+ */
847
+ export interface Refusal {
848
+ token: string;
849
+
850
+ logprob: number;
851
+
852
+ top_logprobs: Array<Refusal.TopLogprob>;
853
+
854
+ bytes?: Array<number>;
855
+ }
856
+
857
+ export namespace Refusal {
858
+ /**
859
+ * The top log probability for a token from an OpenAI-compatible chat completion
860
+ * response.
861
+ */
862
+ export interface TopLogprob {
863
+ token: string;
864
+
865
+ logprob: number;
866
+
867
+ bytes?: Array<number>;
868
+ }
869
+ }
870
+ }
871
+ }
872
+
873
+ /**
874
+ * A message from the user in an OpenAI-compatible chat completion request.
875
+ */
876
+ export interface OpenAIUserMessageParam {
877
+ /**
878
+ * The content of the message, which can include text and other media
879
+ */
880
+ content:
881
+ | string
882
+ | Array<
883
+ | OpenAIUserMessageParam.OpenAIChatCompletionContentPartTextParam
884
+ | OpenAIUserMessageParam.OpenAIChatCompletionContentPartImageParam
885
+ >;
886
+
887
+ /**
888
+ * Must be "user" to identify this as a user message
889
+ */
890
+ role: 'user';
891
+
892
+ /**
893
+ * (Optional) The name of the user message participant.
894
+ */
895
+ name?: string;
896
+ }
897
+
898
+ export namespace OpenAIUserMessageParam {
899
+ export interface OpenAIChatCompletionContentPartTextParam {
900
+ text: string;
901
+
902
+ type: 'text';
903
+ }
904
+
905
+ export interface OpenAIChatCompletionContentPartImageParam {
906
+ image_url: OpenAIChatCompletionContentPartImageParam.ImageURL;
907
+
908
+ type: 'image_url';
909
+ }
910
+
911
+ export namespace OpenAIChatCompletionContentPartImageParam {
912
+ export interface ImageURL {
913
+ url: string;
914
+
915
+ detail?: string;
916
+ }
917
+ }
918
+ }
919
+
920
+ /**
921
+ * A system message providing instructions or context to the model.
922
+ */
923
+ export interface OpenAISystemMessageParam {
924
+ /**
925
+ * The content of the "system prompt". If multiple system messages are provided,
926
+ * they are concatenated. The underlying Llama Stack code may also add other system
927
+ * messages (for example, for formatting tool definitions).
928
+ */
929
+ content:
930
+ | string
931
+ | Array<
932
+ | OpenAISystemMessageParam.OpenAIChatCompletionContentPartTextParam
933
+ | OpenAISystemMessageParam.OpenAIChatCompletionContentPartImageParam
934
+ >;
935
+
936
+ /**
937
+ * Must be "system" to identify this as a system message
938
+ */
939
+ role: 'system';
940
+
941
+ /**
942
+ * (Optional) The name of the system message participant.
943
+ */
944
+ name?: string;
945
+ }
946
+
947
+ export namespace OpenAISystemMessageParam {
948
+ export interface OpenAIChatCompletionContentPartTextParam {
949
+ text: string;
950
+
951
+ type: 'text';
952
+ }
953
+
954
+ export interface OpenAIChatCompletionContentPartImageParam {
955
+ image_url: OpenAIChatCompletionContentPartImageParam.ImageURL;
956
+
957
+ type: 'image_url';
958
+ }
959
+
960
+ export namespace OpenAIChatCompletionContentPartImageParam {
961
+ export interface ImageURL {
962
+ url: string;
963
+
964
+ detail?: string;
965
+ }
966
+ }
967
+ }
968
+
969
+ /**
970
+ * A message containing the model's (assistant) response in an OpenAI-compatible
971
+ * chat completion request.
972
+ */
973
+ export interface OpenAIAssistantMessageParam {
974
+ /**
975
+ * Must be "assistant" to identify this as the model's response
976
+ */
977
+ role: 'assistant';
978
+
979
+ /**
980
+ * The content of the model's response
981
+ */
982
+ content?:
983
+ | string
984
+ | Array<
985
+ | OpenAIAssistantMessageParam.OpenAIChatCompletionContentPartTextParam
986
+ | OpenAIAssistantMessageParam.OpenAIChatCompletionContentPartImageParam
987
+ >;
988
+
989
+ /**
990
+ * (Optional) The name of the assistant message participant.
991
+ */
992
+ name?: string;
993
+
994
+ /**
995
+ * List of tool calls. Each tool call is an OpenAIChatCompletionToolCall object.
996
+ */
997
+ tool_calls?: Array<OpenAIAssistantMessageParam.ToolCall>;
998
+ }
999
+
1000
+ export namespace OpenAIAssistantMessageParam {
1001
+ export interface OpenAIChatCompletionContentPartTextParam {
1002
+ text: string;
1003
+
1004
+ type: 'text';
1005
+ }
1006
+
1007
+ export interface OpenAIChatCompletionContentPartImageParam {
1008
+ image_url: OpenAIChatCompletionContentPartImageParam.ImageURL;
1009
+
1010
+ type: 'image_url';
1011
+ }
1012
+
1013
+ export namespace OpenAIChatCompletionContentPartImageParam {
1014
+ export interface ImageURL {
1015
+ url: string;
1016
+
1017
+ detail?: string;
1018
+ }
1019
+ }
1020
+
1021
+ export interface ToolCall {
1022
+ type: 'function';
1023
+
1024
+ id?: string;
1025
+
1026
+ function?: ToolCall.Function;
1027
+
1028
+ index?: number;
1029
+ }
1030
+
1031
+ export namespace ToolCall {
1032
+ export interface Function {
1033
+ arguments?: string;
1034
+
1035
+ name?: string;
1036
+ }
1037
+ }
1038
+ }
45
1039
 
46
- export namespace CompletionCreateResponse {
47
1040
  /**
48
- * Response from an OpenAI-compatible chat completion request.
1041
+ * A message representing the result of a tool invocation in an OpenAI-compatible
1042
+ * chat completion request.
49
1043
  */
50
- export interface OpenAIChatCompletion {
1044
+ export interface OpenAIToolMessageParam {
1045
+ /**
1046
+ * The response content from the tool
1047
+ */
1048
+ content:
1049
+ | string
1050
+ | Array<
1051
+ | OpenAIToolMessageParam.OpenAIChatCompletionContentPartTextParam
1052
+ | OpenAIToolMessageParam.OpenAIChatCompletionContentPartImageParam
1053
+ >;
1054
+
1055
+ /**
1056
+ * Must be "tool" to identify this as a tool response
1057
+ */
1058
+ role: 'tool';
1059
+
1060
+ /**
1061
+ * Unique identifier for the tool call this response is for
1062
+ */
1063
+ tool_call_id: string;
1064
+ }
1065
+
1066
+ export namespace OpenAIToolMessageParam {
1067
+ export interface OpenAIChatCompletionContentPartTextParam {
1068
+ text: string;
1069
+
1070
+ type: 'text';
1071
+ }
1072
+
1073
+ export interface OpenAIChatCompletionContentPartImageParam {
1074
+ image_url: OpenAIChatCompletionContentPartImageParam.ImageURL;
1075
+
1076
+ type: 'image_url';
1077
+ }
1078
+
1079
+ export namespace OpenAIChatCompletionContentPartImageParam {
1080
+ export interface ImageURL {
1081
+ url: string;
1082
+
1083
+ detail?: string;
1084
+ }
1085
+ }
1086
+ }
1087
+
1088
+ /**
1089
+ * A message from the developer in an OpenAI-compatible chat completion request.
1090
+ */
1091
+ export interface OpenAIDeveloperMessageParam {
1092
+ /**
1093
+ * The content of the developer message
1094
+ */
1095
+ content:
1096
+ | string
1097
+ | Array<
1098
+ | OpenAIDeveloperMessageParam.OpenAIChatCompletionContentPartTextParam
1099
+ | OpenAIDeveloperMessageParam.OpenAIChatCompletionContentPartImageParam
1100
+ >;
1101
+
1102
+ /**
1103
+ * Must be "developer" to identify this as a developer message
1104
+ */
1105
+ role: 'developer';
1106
+
1107
+ /**
1108
+ * (Optional) The name of the developer message participant.
1109
+ */
1110
+ name?: string;
1111
+ }
1112
+
1113
+ export namespace OpenAIDeveloperMessageParam {
1114
+ export interface OpenAIChatCompletionContentPartTextParam {
1115
+ text: string;
1116
+
1117
+ type: 'text';
1118
+ }
1119
+
1120
+ export interface OpenAIChatCompletionContentPartImageParam {
1121
+ image_url: OpenAIChatCompletionContentPartImageParam.ImageURL;
1122
+
1123
+ type: 'image_url';
1124
+ }
1125
+
1126
+ export namespace OpenAIChatCompletionContentPartImageParam {
1127
+ export interface ImageURL {
1128
+ url: string;
1129
+
1130
+ detail?: string;
1131
+ }
1132
+ }
1133
+ }
1134
+ }
1135
+
1136
+ export interface CompletionListResponse {
1137
+ data: Array<CompletionListResponse.Data>;
1138
+
1139
+ first_id: string;
1140
+
1141
+ has_more: boolean;
1142
+
1143
+ last_id: string;
1144
+
1145
+ object: 'list';
1146
+ }
1147
+
1148
+ export namespace CompletionListResponse {
1149
+ export interface Data {
51
1150
  /**
52
1151
  * The ID of the chat completion
53
1152
  */
@@ -56,13 +1155,21 @@ export namespace CompletionCreateResponse {
56
1155
  /**
57
1156
  * List of choices
58
1157
  */
59
- choices: Array<OpenAIChatCompletion.Choice>;
1158
+ choices: Array<Data.Choice>;
60
1159
 
61
1160
  /**
62
1161
  * The Unix timestamp in seconds when the chat completion was created
63
1162
  */
64
1163
  created: number;
65
1164
 
1165
+ input_messages: Array<
1166
+ | Data.OpenAIUserMessageParam
1167
+ | Data.OpenAISystemMessageParam
1168
+ | Data.OpenAIAssistantMessageParam
1169
+ | Data.OpenAIToolMessageParam
1170
+ | Data.OpenAIDeveloperMessageParam
1171
+ >;
1172
+
66
1173
  /**
67
1174
  * The model that was used to generate the chat completion
68
1175
  */
@@ -74,7 +1181,7 @@ export namespace CompletionCreateResponse {
74
1181
  object: 'chat.completion';
75
1182
  }
76
1183
 
77
- export namespace OpenAIChatCompletion {
1184
+ export namespace Data {
78
1185
  /**
79
1186
  * A choice from an OpenAI-compatible chat completion response.
80
1187
  */
@@ -441,6 +1548,268 @@ export namespace CompletionCreateResponse {
441
1548
  }
442
1549
  }
443
1550
  }
1551
+
1552
+ /**
1553
+ * A message from the user in an OpenAI-compatible chat completion request.
1554
+ */
1555
+ export interface OpenAIUserMessageParam {
1556
+ /**
1557
+ * The content of the message, which can include text and other media
1558
+ */
1559
+ content:
1560
+ | string
1561
+ | Array<
1562
+ | OpenAIUserMessageParam.OpenAIChatCompletionContentPartTextParam
1563
+ | OpenAIUserMessageParam.OpenAIChatCompletionContentPartImageParam
1564
+ >;
1565
+
1566
+ /**
1567
+ * Must be "user" to identify this as a user message
1568
+ */
1569
+ role: 'user';
1570
+
1571
+ /**
1572
+ * (Optional) The name of the user message participant.
1573
+ */
1574
+ name?: string;
1575
+ }
1576
+
1577
+ export namespace OpenAIUserMessageParam {
1578
+ export interface OpenAIChatCompletionContentPartTextParam {
1579
+ text: string;
1580
+
1581
+ type: 'text';
1582
+ }
1583
+
1584
+ export interface OpenAIChatCompletionContentPartImageParam {
1585
+ image_url: OpenAIChatCompletionContentPartImageParam.ImageURL;
1586
+
1587
+ type: 'image_url';
1588
+ }
1589
+
1590
+ export namespace OpenAIChatCompletionContentPartImageParam {
1591
+ export interface ImageURL {
1592
+ url: string;
1593
+
1594
+ detail?: string;
1595
+ }
1596
+ }
1597
+ }
1598
+
1599
+ /**
1600
+ * A system message providing instructions or context to the model.
1601
+ */
1602
+ export interface OpenAISystemMessageParam {
1603
+ /**
1604
+ * The content of the "system prompt". If multiple system messages are provided,
1605
+ * they are concatenated. The underlying Llama Stack code may also add other system
1606
+ * messages (for example, for formatting tool definitions).
1607
+ */
1608
+ content:
1609
+ | string
1610
+ | Array<
1611
+ | OpenAISystemMessageParam.OpenAIChatCompletionContentPartTextParam
1612
+ | OpenAISystemMessageParam.OpenAIChatCompletionContentPartImageParam
1613
+ >;
1614
+
1615
+ /**
1616
+ * Must be "system" to identify this as a system message
1617
+ */
1618
+ role: 'system';
1619
+
1620
+ /**
1621
+ * (Optional) The name of the system message participant.
1622
+ */
1623
+ name?: string;
1624
+ }
1625
+
1626
+ export namespace OpenAISystemMessageParam {
1627
+ export interface OpenAIChatCompletionContentPartTextParam {
1628
+ text: string;
1629
+
1630
+ type: 'text';
1631
+ }
1632
+
1633
+ export interface OpenAIChatCompletionContentPartImageParam {
1634
+ image_url: OpenAIChatCompletionContentPartImageParam.ImageURL;
1635
+
1636
+ type: 'image_url';
1637
+ }
1638
+
1639
+ export namespace OpenAIChatCompletionContentPartImageParam {
1640
+ export interface ImageURL {
1641
+ url: string;
1642
+
1643
+ detail?: string;
1644
+ }
1645
+ }
1646
+ }
1647
+
1648
+ /**
1649
+ * A message containing the model's (assistant) response in an OpenAI-compatible
1650
+ * chat completion request.
1651
+ */
1652
+ export interface OpenAIAssistantMessageParam {
1653
+ /**
1654
+ * Must be "assistant" to identify this as the model's response
1655
+ */
1656
+ role: 'assistant';
1657
+
1658
+ /**
1659
+ * The content of the model's response
1660
+ */
1661
+ content?:
1662
+ | string
1663
+ | Array<
1664
+ | OpenAIAssistantMessageParam.OpenAIChatCompletionContentPartTextParam
1665
+ | OpenAIAssistantMessageParam.OpenAIChatCompletionContentPartImageParam
1666
+ >;
1667
+
1668
+ /**
1669
+ * (Optional) The name of the assistant message participant.
1670
+ */
1671
+ name?: string;
1672
+
1673
+ /**
1674
+ * List of tool calls. Each tool call is an OpenAIChatCompletionToolCall object.
1675
+ */
1676
+ tool_calls?: Array<OpenAIAssistantMessageParam.ToolCall>;
1677
+ }
1678
+
1679
+ export namespace OpenAIAssistantMessageParam {
1680
+ export interface OpenAIChatCompletionContentPartTextParam {
1681
+ text: string;
1682
+
1683
+ type: 'text';
1684
+ }
1685
+
1686
+ export interface OpenAIChatCompletionContentPartImageParam {
1687
+ image_url: OpenAIChatCompletionContentPartImageParam.ImageURL;
1688
+
1689
+ type: 'image_url';
1690
+ }
1691
+
1692
+ export namespace OpenAIChatCompletionContentPartImageParam {
1693
+ export interface ImageURL {
1694
+ url: string;
1695
+
1696
+ detail?: string;
1697
+ }
1698
+ }
1699
+
1700
+ export interface ToolCall {
1701
+ type: 'function';
1702
+
1703
+ id?: string;
1704
+
1705
+ function?: ToolCall.Function;
1706
+
1707
+ index?: number;
1708
+ }
1709
+
1710
+ export namespace ToolCall {
1711
+ export interface Function {
1712
+ arguments?: string;
1713
+
1714
+ name?: string;
1715
+ }
1716
+ }
1717
+ }
1718
+
1719
+ /**
1720
+ * A message representing the result of a tool invocation in an OpenAI-compatible
1721
+ * chat completion request.
1722
+ */
1723
+ export interface OpenAIToolMessageParam {
1724
+ /**
1725
+ * The response content from the tool
1726
+ */
1727
+ content:
1728
+ | string
1729
+ | Array<
1730
+ | OpenAIToolMessageParam.OpenAIChatCompletionContentPartTextParam
1731
+ | OpenAIToolMessageParam.OpenAIChatCompletionContentPartImageParam
1732
+ >;
1733
+
1734
+ /**
1735
+ * Must be "tool" to identify this as a tool response
1736
+ */
1737
+ role: 'tool';
1738
+
1739
+ /**
1740
+ * Unique identifier for the tool call this response is for
1741
+ */
1742
+ tool_call_id: string;
1743
+ }
1744
+
1745
+ export namespace OpenAIToolMessageParam {
1746
+ export interface OpenAIChatCompletionContentPartTextParam {
1747
+ text: string;
1748
+
1749
+ type: 'text';
1750
+ }
1751
+
1752
+ export interface OpenAIChatCompletionContentPartImageParam {
1753
+ image_url: OpenAIChatCompletionContentPartImageParam.ImageURL;
1754
+
1755
+ type: 'image_url';
1756
+ }
1757
+
1758
+ export namespace OpenAIChatCompletionContentPartImageParam {
1759
+ export interface ImageURL {
1760
+ url: string;
1761
+
1762
+ detail?: string;
1763
+ }
1764
+ }
1765
+ }
1766
+
1767
+ /**
1768
+ * A message from the developer in an OpenAI-compatible chat completion request.
1769
+ */
1770
+ export interface OpenAIDeveloperMessageParam {
1771
+ /**
1772
+ * The content of the developer message
1773
+ */
1774
+ content:
1775
+ | string
1776
+ | Array<
1777
+ | OpenAIDeveloperMessageParam.OpenAIChatCompletionContentPartTextParam
1778
+ | OpenAIDeveloperMessageParam.OpenAIChatCompletionContentPartImageParam
1779
+ >;
1780
+
1781
+ /**
1782
+ * Must be "developer" to identify this as a developer message
1783
+ */
1784
+ role: 'developer';
1785
+
1786
+ /**
1787
+ * (Optional) The name of the developer message participant.
1788
+ */
1789
+ name?: string;
1790
+ }
1791
+
1792
+ export namespace OpenAIDeveloperMessageParam {
1793
+ export interface OpenAIChatCompletionContentPartTextParam {
1794
+ text: string;
1795
+
1796
+ type: 'text';
1797
+ }
1798
+
1799
+ export interface OpenAIChatCompletionContentPartImageParam {
1800
+ image_url: OpenAIChatCompletionContentPartImageParam.ImageURL;
1801
+
1802
+ type: 'image_url';
1803
+ }
1804
+
1805
+ export namespace OpenAIChatCompletionContentPartImageParam {
1806
+ export interface ImageURL {
1807
+ url: string;
1808
+
1809
+ detail?: string;
1810
+ }
1811
+ }
1812
+ }
444
1813
  }
445
1814
  }
446
1815
 
@@ -448,7 +1817,7 @@ export type CompletionCreateParams = CompletionCreateParamsNonStreaming | Comple
448
1817
 
449
1818
  export interface CompletionCreateParamsBase {
450
1819
  /**
451
- * List of messages in the conversation
1820
+ * List of messages in the conversation.
452
1821
  */
453
1822
  messages: Array<
454
1823
  | CompletionCreateParams.OpenAIUserMessageParam
@@ -465,57 +1834,57 @@ export interface CompletionCreateParamsBase {
465
1834
  model: string;
466
1835
 
467
1836
  /**
468
- * (Optional) The penalty for repeated tokens
1837
+ * (Optional) The penalty for repeated tokens.
469
1838
  */
470
1839
  frequency_penalty?: number;
471
1840
 
472
1841
  /**
473
- * (Optional) The function call to use
1842
+ * (Optional) The function call to use.
474
1843
  */
475
1844
  function_call?: string | Record<string, boolean | number | string | Array<unknown> | unknown | null>;
476
1845
 
477
1846
  /**
478
- * (Optional) List of functions to use
1847
+ * (Optional) List of functions to use.
479
1848
  */
480
1849
  functions?: Array<Record<string, boolean | number | string | Array<unknown> | unknown | null>>;
481
1850
 
482
1851
  /**
483
- * (Optional) The logit bias to use
1852
+ * (Optional) The logit bias to use.
484
1853
  */
485
1854
  logit_bias?: Record<string, number>;
486
1855
 
487
1856
  /**
488
- * (Optional) The log probabilities to use
1857
+ * (Optional) The log probabilities to use.
489
1858
  */
490
1859
  logprobs?: boolean;
491
1860
 
492
1861
  /**
493
- * (Optional) The maximum number of tokens to generate
1862
+ * (Optional) The maximum number of tokens to generate.
494
1863
  */
495
1864
  max_completion_tokens?: number;
496
1865
 
497
1866
  /**
498
- * (Optional) The maximum number of tokens to generate
1867
+ * (Optional) The maximum number of tokens to generate.
499
1868
  */
500
1869
  max_tokens?: number;
501
1870
 
502
1871
  /**
503
- * (Optional) The number of completions to generate
1872
+ * (Optional) The number of completions to generate.
504
1873
  */
505
1874
  n?: number;
506
1875
 
507
1876
  /**
508
- * (Optional) Whether to parallelize tool calls
1877
+ * (Optional) Whether to parallelize tool calls.
509
1878
  */
510
1879
  parallel_tool_calls?: boolean;
511
1880
 
512
1881
  /**
513
- * (Optional) The penalty for repeated tokens
1882
+ * (Optional) The penalty for repeated tokens.
514
1883
  */
515
1884
  presence_penalty?: number;
516
1885
 
517
1886
  /**
518
- * (Optional) The response format to use
1887
+ * (Optional) The response format to use.
519
1888
  */
520
1889
  response_format?:
521
1890
  | CompletionCreateParams.OpenAIResponseFormatText
@@ -523,52 +1892,52 @@ export interface CompletionCreateParamsBase {
523
1892
  | CompletionCreateParams.OpenAIResponseFormatJsonObject;
524
1893
 
525
1894
  /**
526
- * (Optional) The seed to use
1895
+ * (Optional) The seed to use.
527
1896
  */
528
1897
  seed?: number;
529
1898
 
530
1899
  /**
531
- * (Optional) The stop tokens to use
1900
+ * (Optional) The stop tokens to use.
532
1901
  */
533
1902
  stop?: string | Array<string>;
534
1903
 
535
1904
  /**
536
- * (Optional) Whether to stream the response
1905
+ * (Optional) Whether to stream the response.
537
1906
  */
538
1907
  stream?: boolean;
539
1908
 
540
1909
  /**
541
- * (Optional) The stream options to use
1910
+ * (Optional) The stream options to use.
542
1911
  */
543
1912
  stream_options?: Record<string, boolean | number | string | Array<unknown> | unknown | null>;
544
1913
 
545
1914
  /**
546
- * (Optional) The temperature to use
1915
+ * (Optional) The temperature to use.
547
1916
  */
548
1917
  temperature?: number;
549
1918
 
550
1919
  /**
551
- * (Optional) The tool choice to use
1920
+ * (Optional) The tool choice to use.
552
1921
  */
553
1922
  tool_choice?: string | Record<string, boolean | number | string | Array<unknown> | unknown | null>;
554
1923
 
555
1924
  /**
556
- * (Optional) The tools to use
1925
+ * (Optional) The tools to use.
557
1926
  */
558
1927
  tools?: Array<Record<string, boolean | number | string | Array<unknown> | unknown | null>>;
559
1928
 
560
1929
  /**
561
- * (Optional) The top log probabilities to use
1930
+ * (Optional) The top log probabilities to use.
562
1931
  */
563
1932
  top_logprobs?: number;
564
1933
 
565
1934
  /**
566
- * (Optional) The top p to use
1935
+ * (Optional) The top p to use.
567
1936
  */
568
1937
  top_p?: number;
569
1938
 
570
1939
  /**
571
- * (Optional) The user to use
1940
+ * (Optional) The user to use.
572
1941
  */
573
1942
  user?: string;
574
1943
  }
@@ -868,23 +2237,48 @@ export namespace CompletionCreateParams {
868
2237
 
869
2238
  export interface CompletionCreateParamsNonStreaming extends CompletionCreateParamsBase {
870
2239
  /**
871
- * (Optional) Whether to stream the response
2240
+ * (Optional) Whether to stream the response.
872
2241
  */
873
2242
  stream?: false;
874
2243
  }
875
2244
 
876
2245
  export interface CompletionCreateParamsStreaming extends CompletionCreateParamsBase {
877
2246
  /**
878
- * (Optional) Whether to stream the response
2247
+ * (Optional) Whether to stream the response.
879
2248
  */
880
2249
  stream: true;
881
2250
  }
882
2251
 
2252
+ export interface CompletionListParams {
2253
+ /**
2254
+ * The ID of the last chat completion to return.
2255
+ */
2256
+ after?: string;
2257
+
2258
+ /**
2259
+ * The maximum number of chat completions to return.
2260
+ */
2261
+ limit?: number;
2262
+
2263
+ /**
2264
+ * The model to filter by.
2265
+ */
2266
+ model?: string;
2267
+
2268
+ /**
2269
+ * The order to sort the chat completions by: "asc" or "desc". Defaults to "desc".
2270
+ */
2271
+ order?: 'asc' | 'desc';
2272
+ }
2273
+
883
2274
  export declare namespace Completions {
884
2275
  export {
885
2276
  type CompletionCreateResponse as CompletionCreateResponse,
2277
+ type CompletionRetrieveResponse as CompletionRetrieveResponse,
2278
+ type CompletionListResponse as CompletionListResponse,
886
2279
  type CompletionCreateParams as CompletionCreateParams,
887
2280
  type CompletionCreateParamsNonStreaming as CompletionCreateParamsNonStreaming,
888
2281
  type CompletionCreateParamsStreaming as CompletionCreateParamsStreaming,
2282
+ type CompletionListParams as CompletionListParams,
889
2283
  };
890
2284
  }