File Deleted
View Diff
1## Create thread and run
2
3**post** `/threads/runs`
4
5Create a thread and run it in one request.
6
7### Body Parameters
8
9- `assistant_id: string`
10
11 The ID of the [assistant](/docs/api-reference/assistants) to use to execute this run.
12
13- `instructions: optional string or null`
14
15 Override the default system message of the assistant. This is useful for modifying the behavior on a per-run basis.
16
17- `max_completion_tokens: optional number or null`
18
19 The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of completion tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info.
20
21- `max_prompt_tokens: optional number or null`
22
23 The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info.
24
25- `metadata: optional Metadata or null`
26
27 Set of 16 key-value pairs that can be attached to an object. This can be
28 useful for storing additional information about the object in a structured
29 format, and querying for objects via API or the dashboard.
30
31 Keys are strings with a maximum length of 64 characters. Values are strings
32 with a maximum length of 512 characters.
33
34- `model: optional string or "gpt-5" or "gpt-5-mini" or "gpt-5-nano" or 35 more or null`
35
36 The ID of the [Model](/docs/api-reference/models) to be used to execute this run. If a value is provided here, it will override the model associated with the assistant. If not, the model associated with the assistant will be used.
37
38 - `string`
39
40 - `"gpt-5" or "gpt-5-mini" or "gpt-5-nano" or 35 more`
41
42 The ID of the [Model](/docs/api-reference/models) to be used to execute this run. If a value is provided here, it will override the model associated with the assistant. If not, the model associated with the assistant will be used.
43
44 - `"gpt-5"`
45
46 - `"gpt-5-mini"`
47
48 - `"gpt-5-nano"`
49
50 - `"gpt-5-2025-08-07"`
51
52 - `"gpt-5-mini-2025-08-07"`
53
54 - `"gpt-5-nano-2025-08-07"`
55
56 - `"gpt-4.1"`
57
58 - `"gpt-4.1-mini"`
59
60 - `"gpt-4.1-nano"`
61
62 - `"gpt-4.1-2025-04-14"`
63
64 - `"gpt-4.1-mini-2025-04-14"`
65
66 - `"gpt-4.1-nano-2025-04-14"`
67
68 - `"gpt-4o"`
69
70 - `"gpt-4o-2024-11-20"`
71
72 - `"gpt-4o-2024-08-06"`
73
74 - `"gpt-4o-2024-05-13"`
75
76 - `"gpt-4o-mini"`
77
78 - `"gpt-4o-mini-2024-07-18"`
79
80 - `"gpt-4.5-preview"`
81
82 - `"gpt-4.5-preview-2025-02-27"`
83
84 - `"gpt-4-turbo"`
85
86 - `"gpt-4-turbo-2024-04-09"`
87
88 - `"gpt-4-0125-preview"`
89
90 - `"gpt-4-turbo-preview"`
91
92 - `"gpt-4-1106-preview"`
93
94 - `"gpt-4-vision-preview"`
95
96 - `"gpt-4"`
97
98 - `"gpt-4-0314"`
99
100 - `"gpt-4-0613"`
101
102 - `"gpt-4-32k"`
103
104 - `"gpt-4-32k-0314"`
105
106 - `"gpt-4-32k-0613"`
107
108 - `"gpt-3.5-turbo"`
109
110 - `"gpt-3.5-turbo-16k"`
111
112 - `"gpt-3.5-turbo-0613"`
113
114 - `"gpt-3.5-turbo-1106"`
115
116 - `"gpt-3.5-turbo-0125"`
117
118 - `"gpt-3.5-turbo-16k-0613"`
119
120- `parallel_tool_calls: optional boolean`
121
122 Whether to enable [parallel function calling](/docs/guides/function-calling#configuring-parallel-function-calling) during tool use.
123
124- `response_format: optional AssistantResponseFormatOption or null`
125
126 Specifies the format that the model must output. Compatible with [GPT-4o](/docs/models#gpt-4o), [GPT-4 Turbo](/docs/models#gpt-4-turbo-and-gpt-4), and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.
127
128 Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured Outputs which ensures the model will match your supplied JSON schema. Learn more in the [Structured Outputs guide](/docs/guides/structured-outputs).
129
130 Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the message the model generates is valid JSON.
131
132 **Important:** when using JSON mode, you **must** also instruct the model to produce JSON yourself 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.
133
134 - `"auto"`
135
136 `auto` is the default value
137
138 - `"auto"`
139
140 - `ResponseFormatText object { type }`
141
142 Default response format. Used to generate text responses.
143
144 - `type: "text"`
145
146 The type of response format being defined. Always `text`.
147
148 - `"text"`
149
150 - `ResponseFormatJSONObject object { type }`
151
152 JSON object response format. An older method of generating JSON responses.
153 Using `json_schema` is recommended for models that support it. Note that the
154 model will not generate JSON without a system or user message instructing it
155 to do so.
156
157 - `type: "json_object"`
158
159 The type of response format being defined. Always `json_object`.
160
161 - `"json_object"`
162
163 - `ResponseFormatJSONSchema object { json_schema, type }`
164
165 JSON Schema response format. Used to generate structured JSON responses.
166 Learn more about [Structured Outputs](/docs/guides/structured-outputs).
167
168 - `json_schema: object { name, description, schema, strict }`
169
170 Structured Outputs configuration options, including a JSON Schema.
171
172 - `name: string`
173
174 The name of the response format. Must be a-z, A-Z, 0-9, or contain
175 underscores and dashes, with a maximum length of 64.
176
177 - `description: optional string`
178
179 A description of what the response format is for, used by the model to
180 determine how to respond in the format.
181
182 - `schema: optional map[unknown]`
183
184 The schema for the response format, described as a JSON Schema object.
185 Learn how to build JSON schemas [here](https://json-schema.org/).
186
187 - `strict: optional boolean or null`
188
189 Whether to enable strict schema adherence when generating the output.
190 If set to true, the model will always follow the exact schema defined
191 in the `schema` field. Only a subset of JSON Schema is supported when
192 `strict` is `true`. To learn more, read the [Structured Outputs
193 guide](/docs/guides/structured-outputs).
194
195 - `type: "json_schema"`
196
197 The type of response format being defined. Always `json_schema`.
198
199 - `"json_schema"`
200
201- `stream: optional boolean or null`
202
203 If `true`, returns a stream of events that happen during the Run as server-sent events, terminating when the Run enters a terminal state with a `data: [DONE]` message.
204
205- `temperature: optional number or null`
206
207 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.
208
209- `thread: optional object { messages, metadata, tool_resources }`
210
211 Options to create a new thread. If no thread is provided when running a
212 request, an empty thread will be created.
213
214 - `messages: optional array of object { content, role, attachments, metadata }`
215
216 A list of [messages](/docs/api-reference/messages) to start the thread with.
217
218 - `content: string or array of ImageFileContentBlock or ImageURLContentBlock or TextContentBlockParam`
219
220 The text contents of the message.
221
222 - `TextContent = string`
223
224 The text contents of the message.
225
226 - `ArrayOfContentParts = array of ImageFileContentBlock or ImageURLContentBlock or TextContentBlockParam`
227
228 An array of content parts with a defined type, each can be of type `text` or images can be passed with `image_url` or `image_file`. Image types are only supported on [Vision-compatible models](/docs/models).
229
230 - `ImageFileContentBlock object { image_file, type }`
231
232 References an image [File](/docs/api-reference/files) in the content of a message.
233
234 - `image_file: ImageFile`
235
236 - `file_id: string`
237
238 The [File](/docs/api-reference/files) ID of the image in the message content. Set `purpose="vision"` when uploading the File if you need to later display the file content.
239
240 - `detail: optional "auto" or "low" or "high"`
241
242 Specifies the detail level of the image if specified by the user. `low` uses fewer tokens, you can opt in to high resolution using `high`.
243
244 - `"auto"`
245
246 - `"low"`
247
248 - `"high"`
249
250 - `type: "image_file"`
251
252 Always `image_file`.
253
254 - `"image_file"`
255
256 - `ImageURLContentBlock object { image_url, type }`
257
258 References an image URL in the content of a message.
259
260 - `image_url: ImageURL`
261
262 - `url: string`
263
264 The external URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp.
265
266 - `detail: optional "auto" or "low" or "high"`
267
268 Specifies the detail level of the image. `low` uses fewer tokens, you can opt in to high resolution using `high`. Default value is `auto`
269
270 - `"auto"`
271
272 - `"low"`
273
274 - `"high"`
275
276 - `type: "image_url"`
277
278 The type of the content part.
279
280 - `"image_url"`
281
282 - `TextContentBlockParam object { text, type }`
283
284 The text content that is part of a message.
285
286 - `text: string`
287
288 Text content to be sent to the model
289
290 - `type: "text"`
291
292 Always `text`.
293
294 - `"text"`
295
296 - `role: "user" or "assistant"`
297
298 The role of the entity that is creating the message. Allowed values include:
299
300 - `user`: Indicates the message is sent by an actual user and should be used in most cases to represent user-generated messages.
301 - `assistant`: Indicates the message is generated by the assistant. Use this value to insert messages from the assistant into the conversation.
302
303 - `"user"`
304
305 - `"assistant"`
306
307 - `attachments: optional array of object { file_id, tools } or null`
308
309 A list of files attached to the message, and the tools they should be added to.
310
311 - `file_id: optional string`
312
313 The ID of the file to attach to the message.
314
315 - `tools: optional array of CodeInterpreterTool or object { type }`
316
317 The tools to add this file to.
318
319 - `CodeInterpreterTool object { type }`
320
321 - `type: "code_interpreter"`
322
323 The type of tool being defined: `code_interpreter`
324
325 - `"code_interpreter"`
326
327 - `FileSearchTool object { type }`
328
329 - `type: "file_search"`
330
331 The type of tool being defined: `file_search`
332
333 - `"file_search"`
334
335 - `metadata: optional Metadata or null`
336
337 Set of 16 key-value pairs that can be attached to an object. This can be
338 useful for storing additional information about the object in a structured
339 format, and querying for objects via API or the dashboard.
340
341 Keys are strings with a maximum length of 64 characters. Values are strings
342 with a maximum length of 512 characters.
343
344 - `metadata: optional Metadata or null`
345
346 Set of 16 key-value pairs that can be attached to an object. This can be
347 useful for storing additional information about the object in a structured
348 format, and querying for objects via API or the dashboard.
349
350 Keys are strings with a maximum length of 64 characters. Values are strings
351 with a maximum length of 512 characters.
352
353 - `tool_resources: optional object { code_interpreter, file_search } or null`
354
355 A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.
356
357 - `code_interpreter: optional object { file_ids }`
358
359 - `file_ids: optional array of string`
360
361 A list of [file](/docs/api-reference/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.
362
363 - `file_search: optional object { vector_store_ids, vector_stores }`
364
365 - `vector_store_ids: optional array of string`
366
367 The [vector store](/docs/api-reference/vector-stores/object) attached to this thread. There can be a maximum of 1 vector store attached to the thread.
368
369 - `vector_stores: optional array of object { chunking_strategy, file_ids, metadata }`
370
371 A helper to create a [vector store](/docs/api-reference/vector-stores/object) with file_ids and attach it to this thread. There can be a maximum of 1 vector store attached to the thread.
372
373 - `chunking_strategy: optional object { type } or object { static, type }`
374
375 The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy.
376
377 - `Auto object { type }`
378
379 The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`.
380
381 - `type: "auto"`
382
383 Always `auto`.
384
385 - `"auto"`
386
387 - `Static object { static, type }`
388
389 - `static: object { chunk_overlap_tokens, max_chunk_size_tokens }`
390
391 - `chunk_overlap_tokens: number`
392
393 The number of tokens that overlap between chunks. The default value is `400`.
394
395 Note that the overlap must not exceed half of `max_chunk_size_tokens`.
396
397 - `max_chunk_size_tokens: number`
398
399 The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`.
400
401 - `type: "static"`
402
403 Always `static`.
404
405 - `"static"`
406
407 - `file_ids: optional array of string`
408
409 A list of [file](/docs/api-reference/files) IDs to add to the vector store. For vector stores created before Nov 2025, there can be a maximum of 10,000 files in a vector store. For vector stores created starting in Nov 2025, the limit is 100,000,000 files.
410
411 - `metadata: optional Metadata or null`
412
413 Set of 16 key-value pairs that can be attached to an object. This can be
414 useful for storing additional information about the object in a structured
415 format, and querying for objects via API or the dashboard.
416
417 Keys are strings with a maximum length of 64 characters. Values are strings
418 with a maximum length of 512 characters.
419
420- `tool_choice: optional AssistantToolChoiceOption or null`
421
422 Controls which (if any) tool is called by the model.
423 `none` means the model will not call any tools and instead generates a message.
424 `auto` is the default value and means the model can pick between generating a message or calling one or more tools.
425 `required` means the model must call one or more tools before responding to the user.
426 Specifying a particular tool like `{"type": "file_search"}` or `{"type": "function", "function": {"name": "my_function"}}` forces the model to call that tool.
427
428 - `"none" or "auto" or "required"`
429
430 `none` means the model will not call any tools and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. `required` means the model must call one or more tools before responding to the user.
431
432 - `"none"`
433
434 - `"auto"`
435
436 - `"required"`
437
438 - `AssistantToolChoice object { type, function }`
439
440 Specifies a tool the model should use. Use to force the model to call a specific tool.
441
442 - `type: "function" or "code_interpreter" or "file_search"`
443
444 The type of the tool. If type is `function`, the function name must be set
445
446 - `"function"`
447
448 - `"code_interpreter"`
449
450 - `"file_search"`
451
452 - `function: optional AssistantToolChoiceFunction`
453
454 - `name: string`
455
456 The name of the function to call.
457
458- `tool_resources: optional object { code_interpreter, file_search } or null`
459
460 A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.
461
462 - `code_interpreter: optional object { file_ids }`
463
464 - `file_ids: optional array of string`
465
466 A list of [file](/docs/api-reference/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.
467
468 - `file_search: optional object { vector_store_ids }`
469
470 - `vector_store_ids: optional array of string`
471
472 The ID of the [vector store](/docs/api-reference/vector-stores/object) attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.
473
474- `tools: optional array of CodeInterpreterTool or FileSearchTool or FunctionTool or null`
475
476 Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis.
477
478 - `CodeInterpreterTool object { type }`
479
480 - `FileSearchTool object { type, file_search }`
481
482 - `type: "file_search"`
483
484 The type of tool being defined: `file_search`
485
486 - `"file_search"`
487
488 - `file_search: optional object { max_num_results, ranking_options }`
489
490 Overrides for the file search tool.
491
492 - `max_num_results: optional number`
493
494 The maximum number of results the file search tool should output. The default is 20 for `gpt-4*` models and 5 for `gpt-3.5-turbo`. This number should be between 1 and 50 inclusive.
495
496 Note that the file search tool may output fewer than `max_num_results` results. See the [file search tool documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) for more information.
497
498 - `ranking_options: optional object { score_threshold, ranker }`
499
500 The ranking options for the file search. If not specified, the file search tool will use the `auto` ranker and a score_threshold of 0.
501
502 See the [file search tool documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) for more information.
503
504 - `score_threshold: number`
505
506 The score threshold for the file search. All values must be a floating point number between 0 and 1.
507
508 - `ranker: optional "auto" or "default_2024_08_21"`
509
510 The ranker to use for the file search. If not specified will use the `auto` ranker.
511
512 - `"auto"`
513
514 - `"default_2024_08_21"`
515
516 - `FunctionTool object { function, type }`
517
518 - `function: FunctionDefinition`
519
520 - `name: string`
521
522 The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
523
524 - `description: optional string`
525
526 A description of what the function does, used by the model to choose when and how to call the function.
527
528 - `parameters: optional FunctionParameters`
529
530 The parameters the functions accepts, described as a JSON Schema object. See the [guide](/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format.
531
532 Omitting `parameters` defines a function with an empty parameter list.
533
534 - `strict: optional boolean or null`
535
536 Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](/docs/guides/function-calling).
537
538 - `type: "function"`
539
540 The type of tool being defined: `function`
541
542 - `"function"`
543
544- `top_p: optional number or null`
545
546 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.
547
548 We generally recommend altering this or temperature but not both.
549
550- `truncation_strategy: optional object { type, last_messages } or null`
551
552 Controls for how a thread will be truncated prior to the run. Use this to control the initial context window of the run.
553
554 - `type: "auto" or "last_messages"`
555
556 The truncation strategy to use for the thread. The default is `auto`. If set to `last_messages`, the thread will be truncated to the n most recent messages in the thread. When set to `auto`, messages in the middle of the thread will be dropped to fit the context length of the model, `max_prompt_tokens`.
557
558 - `"auto"`
559
560 - `"last_messages"`
561
562 - `last_messages: optional number or null`
563
564 The number of most recent messages from the thread when constructing the context for the run.
565
566### Returns
567
568- `Run object { id, assistant_id, cancelled_at, 24 more }`
569
570 Represents an execution run on a [thread](/docs/api-reference/threads).
571
572 - `id: string`
573
574 The identifier, which can be referenced in API endpoints.
575
576 - `assistant_id: string`
577
578 The ID of the [assistant](/docs/api-reference/assistants) used for execution of this run.
579
580 - `cancelled_at: number or null`
581
582 The Unix timestamp (in seconds) for when the run was cancelled.
583
584 - `completed_at: number or null`
585
586 The Unix timestamp (in seconds) for when the run was completed.
587
588 - `created_at: number`
589
590 The Unix timestamp (in seconds) for when the run was created.
591
592 - `expires_at: number or null`
593
594 The Unix timestamp (in seconds) for when the run will expire.
595
596 - `failed_at: number or null`
597
598 The Unix timestamp (in seconds) for when the run failed.
599
600 - `incomplete_details: object { reason } or null`
601
602 Details on why the run is incomplete. Will be `null` if the run is not incomplete.
603
604 - `reason: optional "max_completion_tokens" or "max_prompt_tokens"`
605
606 The reason why the run is incomplete. This will point to which specific token limit was reached over the course of the run.
607
608 - `"max_completion_tokens"`
609
610 - `"max_prompt_tokens"`
611
612 - `instructions: string`
613
614 The instructions that the [assistant](/docs/api-reference/assistants) used for this run.
615
616 - `last_error: object { code, message } or null`
617
618 The last error associated with this run. Will be `null` if there are no errors.
619
620 - `code: "server_error" or "rate_limit_exceeded" or "invalid_prompt"`
621
622 One of `server_error`, `rate_limit_exceeded`, or `invalid_prompt`.
623
624 - `"server_error"`
625
626 - `"rate_limit_exceeded"`
627
628 - `"invalid_prompt"`
629
630 - `message: string`
631
632 A human-readable description of the error.
633
634 - `max_completion_tokens: number or null`
635
636 The maximum number of completion tokens specified to have been used over the course of the run.
637
638 - `max_prompt_tokens: number or null`
639
640 The maximum number of prompt tokens specified to have been used over the course of the run.
641
642 - `metadata: Metadata or null`
643
644 Set of 16 key-value pairs that can be attached to an object. This can be
645 useful for storing additional information about the object in a structured
646 format, and querying for objects via API or the dashboard.
647
648 Keys are strings with a maximum length of 64 characters. Values are strings
649 with a maximum length of 512 characters.
650
651 - `model: string`
652
653 The model that the [assistant](/docs/api-reference/assistants) used for this run.
654
655 - `object: "thread.run"`
656
657 The object type, which is always `thread.run`.
658
659 - `"thread.run"`
660
661 - `parallel_tool_calls: boolean`
662
663 Whether to enable [parallel function calling](/docs/guides/function-calling#configuring-parallel-function-calling) during tool use.
664
665 - `required_action: object { submit_tool_outputs, type } or null`
666
667 Details on the action required to continue the run. Will be `null` if no action is required.
668
669 - `submit_tool_outputs: object { tool_calls }`
670
671 Details on the tool outputs needed for this run to continue.
672
673 - `tool_calls: array of RequiredActionFunctionToolCall`
674
675 A list of the relevant tool calls.
676
677 - `id: string`
678
679 The ID of the tool call. This ID must be referenced when you submit the tool outputs in using the [Submit tool outputs to run](/docs/api-reference/runs/submitToolOutputs) endpoint.
680
681 - `function: object { arguments, name }`
682
683 The function definition.
684
685 - `arguments: string`
686
687 The arguments that the model expects you to pass to the function.
688
689 - `name: string`
690
691 The name of the function.
692
693 - `type: "function"`
694
695 The type of tool call the output is required for. For now, this is always `function`.
696
697 - `"function"`
698
699 - `type: "submit_tool_outputs"`
700
701 For now, this is always `submit_tool_outputs`.
702
703 - `"submit_tool_outputs"`
704
705 - `response_format: AssistantResponseFormatOption or null`
706
707 Specifies the format that the model must output. Compatible with [GPT-4o](/docs/models#gpt-4o), [GPT-4 Turbo](/docs/models#gpt-4-turbo-and-gpt-4), and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.
708
709 Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured Outputs which ensures the model will match your supplied JSON schema. Learn more in the [Structured Outputs guide](/docs/guides/structured-outputs).
710
711 Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the message the model generates is valid JSON.
712
713 **Important:** when using JSON mode, you **must** also instruct the model to produce JSON yourself 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.
714
715 - `"auto"`
716
717 `auto` is the default value
718
719 - `"auto"`
720
721 - `ResponseFormatText object { type }`
722
723 Default response format. Used to generate text responses.
724
725 - `type: "text"`
726
727 The type of response format being defined. Always `text`.
728
729 - `"text"`
730
731 - `ResponseFormatJSONObject object { type }`
732
733 JSON object response format. An older method of generating JSON responses.
734 Using `json_schema` is recommended for models that support it. Note that the
735 model will not generate JSON without a system or user message instructing it
736 to do so.
737
738 - `type: "json_object"`
739
740 The type of response format being defined. Always `json_object`.
741
742 - `"json_object"`
743
744 - `ResponseFormatJSONSchema object { json_schema, type }`
745
746 JSON Schema response format. Used to generate structured JSON responses.
747 Learn more about [Structured Outputs](/docs/guides/structured-outputs).
748
749 - `json_schema: object { name, description, schema, strict }`
750
751 Structured Outputs configuration options, including a JSON Schema.
752
753 - `name: string`
754
755 The name of the response format. Must be a-z, A-Z, 0-9, or contain
756 underscores and dashes, with a maximum length of 64.
757
758 - `description: optional string`
759
760 A description of what the response format is for, used by the model to
761 determine how to respond in the format.
762
763 - `schema: optional map[unknown]`
764
765 The schema for the response format, described as a JSON Schema object.
766 Learn how to build JSON schemas [here](https://json-schema.org/).
767
768 - `strict: optional boolean or null`
769
770 Whether to enable strict schema adherence when generating the output.
771 If set to true, the model will always follow the exact schema defined
772 in the `schema` field. Only a subset of JSON Schema is supported when
773 `strict` is `true`. To learn more, read the [Structured Outputs
774 guide](/docs/guides/structured-outputs).
775
776 - `type: "json_schema"`
777
778 The type of response format being defined. Always `json_schema`.
779
780 - `"json_schema"`
781
782 - `started_at: number or null`
783
784 The Unix timestamp (in seconds) for when the run was started.
785
786 - `status: "queued" or "in_progress" or "requires_action" or 6 more`
787
788 The status of the run, which can be either `queued`, `in_progress`, `requires_action`, `cancelling`, `cancelled`, `failed`, `completed`, `incomplete`, or `expired`.
789
790 - `"queued"`
791
792 - `"in_progress"`
793
794 - `"requires_action"`
795
796 - `"cancelling"`
797
798 - `"cancelled"`
799
800 - `"failed"`
801
802 - `"completed"`
803
804 - `"incomplete"`
805
806 - `"expired"`
807
808 - `thread_id: string`
809
810 The ID of the [thread](/docs/api-reference/threads) that was executed on as a part of this run.
811
812 - `tool_choice: AssistantToolChoiceOption or null`
813
814 Controls which (if any) tool is called by the model.
815 `none` means the model will not call any tools and instead generates a message.
816 `auto` is the default value and means the model can pick between generating a message or calling one or more tools.
817 `required` means the model must call one or more tools before responding to the user.
818 Specifying a particular tool like `{"type": "file_search"}` or `{"type": "function", "function": {"name": "my_function"}}` forces the model to call that tool.
819
820 - `"none" or "auto" or "required"`
821
822 `none` means the model will not call any tools and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. `required` means the model must call one or more tools before responding to the user.
823
824 - `"none"`
825
826 - `"auto"`
827
828 - `"required"`
829
830 - `AssistantToolChoice object { type, function }`
831
832 Specifies a tool the model should use. Use to force the model to call a specific tool.
833
834 - `type: "function" or "code_interpreter" or "file_search"`
835
836 The type of the tool. If type is `function`, the function name must be set
837
838 - `"function"`
839
840 - `"code_interpreter"`
841
842 - `"file_search"`
843
844 - `function: optional AssistantToolChoiceFunction`
845
846 - `name: string`
847
848 The name of the function to call.
849
850 - `tools: array of CodeInterpreterTool or FileSearchTool or FunctionTool`
851
852 The list of tools that the [assistant](/docs/api-reference/assistants) used for this run.
853
854 - `CodeInterpreterTool object { type }`
855
856 - `type: "code_interpreter"`
857
858 The type of tool being defined: `code_interpreter`
859
860 - `"code_interpreter"`
861
862 - `FileSearchTool object { type, file_search }`
863
864 - `type: "file_search"`
865
866 The type of tool being defined: `file_search`
867
868 - `"file_search"`
869
870 - `file_search: optional object { max_num_results, ranking_options }`
871
872 Overrides for the file search tool.
873
874 - `max_num_results: optional number`
875
876 The maximum number of results the file search tool should output. The default is 20 for `gpt-4*` models and 5 for `gpt-3.5-turbo`. This number should be between 1 and 50 inclusive.
877
878 Note that the file search tool may output fewer than `max_num_results` results. See the [file search tool documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) for more information.
879
880 - `ranking_options: optional object { score_threshold, ranker }`
881
882 The ranking options for the file search. If not specified, the file search tool will use the `auto` ranker and a score_threshold of 0.
883
884 See the [file search tool documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) for more information.
885
886 - `score_threshold: number`
887
888 The score threshold for the file search. All values must be a floating point number between 0 and 1.
889
890 - `ranker: optional "auto" or "default_2024_08_21"`
891
892 The ranker to use for the file search. If not specified will use the `auto` ranker.
893
894 - `"auto"`
895
896 - `"default_2024_08_21"`
897
898 - `FunctionTool object { function, type }`
899
900 - `function: FunctionDefinition`
901
902 - `name: string`
903
904 The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
905
906 - `description: optional string`
907
908 A description of what the function does, used by the model to choose when and how to call the function.
909
910 - `parameters: optional FunctionParameters`
911
912 The parameters the functions accepts, described as a JSON Schema object. See the [guide](/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format.
913
914 Omitting `parameters` defines a function with an empty parameter list.
915
916 - `strict: optional boolean or null`
917
918 Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](/docs/guides/function-calling).
919
920 - `type: "function"`
921
922 The type of tool being defined: `function`
923
924 - `"function"`
925
926 - `truncation_strategy: object { type, last_messages } or null`
927
928 Controls for how a thread will be truncated prior to the run. Use this to control the initial context window of the run.
929
930 - `type: "auto" or "last_messages"`
931
932 The truncation strategy to use for the thread. The default is `auto`. If set to `last_messages`, the thread will be truncated to the n most recent messages in the thread. When set to `auto`, messages in the middle of the thread will be dropped to fit the context length of the model, `max_prompt_tokens`.
933
934 - `"auto"`
935
936 - `"last_messages"`
937
938 - `last_messages: optional number or null`
939
940 The number of most recent messages from the thread when constructing the context for the run.
941
942 - `usage: object { completion_tokens, prompt_tokens, total_tokens } or null`
943
944 Usage statistics related to the run. This value will be `null` if the run is not in a terminal state (i.e. `in_progress`, `queued`, etc.).
945
946 - `completion_tokens: number`
947
948 Number of completion tokens used over the course of the run.
949
950 - `prompt_tokens: number`
951
952 Number of prompt tokens used over the course of the run.
953
954 - `total_tokens: number`
955
956 Total number of tokens used (prompt + completion).
957
958 - `temperature: optional number or null`
959
960 The sampling temperature used for this run. If not set, defaults to 1.
961
962 - `top_p: optional number or null`
963
964 The nucleus sampling value used for this run. If not set, defaults to 1.
965
966### Example
967
968```http
969curl https://api.openai.com/v1/threads/runs \
970 -H 'Content-Type: application/json' \
971 -H 'OpenAI-Beta: assistants=v2' \
972 -H "Authorization: Bearer $OPENAI_API_KEY" \
973 -d '{
974 "assistant_id": "assistant_id",
975 "temperature": 1,
976 "top_p": 1
977 }'
978```
979
980#### Response
981
982```json
983{
984 "id": "id",
985 "assistant_id": "assistant_id",
986 "cancelled_at": 0,
987 "completed_at": 0,
988 "created_at": 0,
989 "expires_at": 0,
990 "failed_at": 0,
991 "incomplete_details": {
992 "reason": "max_completion_tokens"
993 },
994 "instructions": "instructions",
995 "last_error": {
996 "code": "server_error",
997 "message": "message"
998 },
999 "max_completion_tokens": 256,
1000 "max_prompt_tokens": 256,
1001 "metadata": {
1002 "foo": "string"
1003 },
1004 "model": "model",
1005 "object": "thread.run",
1006 "parallel_tool_calls": true,
1007 "required_action": {
1008 "submit_tool_outputs": {
1009 "tool_calls": [
1010 {
1011 "id": "id",
1012 "function": {
1013 "arguments": "arguments",
1014 "name": "name"
1015 },
1016 "type": "function"
1017 }
1018 ]
1019 },
1020 "type": "submit_tool_outputs"
1021 },
1022 "response_format": "auto",
1023 "started_at": 0,
1024 "status": "queued",
1025 "thread_id": "thread_id",
1026 "tool_choice": "none",
1027 "tools": [
1028 {
1029 "type": "code_interpreter"
1030 }
1031 ],
1032 "truncation_strategy": {
1033 "type": "auto",
1034 "last_messages": 1
1035 },
1036 "usage": {
1037 "completion_tokens": 0,
1038 "prompt_tokens": 0,
1039 "total_tokens": 0
1040 },
1041 "temperature": 0,
1042 "top_p": 0
1043}
1044```
1045
1046### Example
1047
1048```http
1049curl https://api.openai.com/v1/threads/runs \
1050 -H "Authorization: Bearer $OPENAI_API_KEY" \
1051 -H "Content-Type: application/json" \
1052 -H "OpenAI-Beta: assistants=v2" \
1053 -d '{
1054 "assistant_id": "asst_abc123",
1055 "thread": {
1056 "messages": [
1057 {"role": "user", "content": "Explain deep learning to a 5 year old."}
1058 ]
1059 }
1060 }'
1061```
1062
1063#### Response
1064
1065```json
1066{
1067 "id": "run_abc123",
1068 "object": "thread.run",
1069 "created_at": 1699076792,
1070 "assistant_id": "asst_abc123",
1071 "thread_id": "thread_abc123",
1072 "status": "queued",
1073 "started_at": null,
1074 "expires_at": 1699077392,
1075 "cancelled_at": null,
1076 "failed_at": null,
1077 "completed_at": null,
1078 "required_action": null,
1079 "last_error": null,
1080 "model": "gpt-4o",
1081 "instructions": "You are a helpful assistant.",
1082 "tools": [],
1083 "tool_resources": {},
1084 "metadata": {},
1085 "temperature": 1.0,
1086 "top_p": 1.0,
1087 "max_completion_tokens": null,
1088 "max_prompt_tokens": null,
1089 "truncation_strategy": {
1090 "type": "auto",
1091 "last_messages": null
1092 },
1093 "incomplete_details": null,
1094 "usage": null,
1095 "response_format": "auto",
1096 "tool_choice": "auto",
1097 "parallel_tool_calls": true
1098}
1099```
1100
1101### Streaming
1102
1103```http
1104curl https://api.openai.com/v1/threads/runs \
1105 -H "Authorization: Bearer $OPENAI_API_KEY" \
1106 -H "Content-Type: application/json" \
1107 -H "OpenAI-Beta: assistants=v2" \
1108 -d '{
1109 "assistant_id": "asst_123",
1110 "thread": {
1111 "messages": [
1112 {"role": "user", "content": "Hello"}
1113 ]
1114 },
1115 "stream": true
1116 }'
1117```
1118
1119#### Response
1120
1121```json
1122event: thread.created
1123data: {"id":"thread_123","object":"thread","created_at":1710348075,"metadata":{}}
1124
1125event: thread.run.created
1126data: {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710348675,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"tool_resources":{},"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}
1127
1128event: thread.run.queued
1129data: {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710348675,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"tool_resources":{},"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}
1130
1131event: thread.run.in_progress
1132data: {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"in_progress","started_at":null,"expires_at":1710348675,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"tool_resources":{},"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}
1133
1134event: thread.run.step.created
1135data: {"id":"step_001","object":"thread.run.step","created_at":1710348076,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710348675,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":null}
1136
1137event: thread.run.step.in_progress
1138data: {"id":"step_001","object":"thread.run.step","created_at":1710348076,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710348675,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":null}
1139
1140event: thread.message.created
1141data: {"id":"msg_001","object":"thread.message","created_at":1710348076,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"in_progress","incomplete_details":null,"incomplete_at":null,"completed_at":null,"role":"assistant","content":[], "metadata":{}}
1142
1143event: thread.message.in_progress
1144data: {"id":"msg_001","object":"thread.message","created_at":1710348076,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"in_progress","incomplete_details":null,"incomplete_at":null,"completed_at":null,"role":"assistant","content":[], "metadata":{}}
1145
1146event: thread.message.delta
1147data: {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"Hello","annotations":[]}}]}}
1148
1149...
1150
1151event: thread.message.delta
1152data: {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" today"}}]}}
1153
1154event: thread.message.delta
1155data: {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"?"}}]}}
1156
1157event: thread.message.completed
1158data: {"id":"msg_001","object":"thread.message","created_at":1710348076,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"completed","incomplete_details":null,"incomplete_at":null,"completed_at":1710348077,"role":"assistant","content":[{"type":"text","text":{"value":"Hello! How can I assist you today?","annotations":[]}}], "metadata":{}}
1159
1160event: thread.run.step.completed
1161data: {"id":"step_001","object":"thread.run.step","created_at":1710348076,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"completed","cancelled_at":null,"completed_at":1710348077,"expires_at":1710348675,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":{"prompt_tokens":20,"completion_tokens":11,"total_tokens":31}}
1162
1163event: thread.run.completed
1164{"id":"run_123","object":"thread.run","created_at":1710348076,"assistant_id":"asst_123","thread_id":"thread_123","status":"completed","started_at":1713226836,"expires_at":null,"cancelled_at":null,"failed_at":null,"completed_at":1713226837,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":{"prompt_tokens":345,"completion_tokens":11,"total_tokens":356},"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}
1165
1166event: done
1167data: [DONE]
1168```
1169
1170### Streaming with Functions
1171
1172```http
1173curl https://api.openai.com/v1/threads/runs \
1174 -H "Authorization: Bearer $OPENAI_API_KEY" \
1175 -H "Content-Type: application/json" \
1176 -H "OpenAI-Beta: assistants=v2" \
1177 -d '{
1178 "assistant_id": "asst_abc123",
1179 "thread": {
1180 "messages": [
1181 {"role": "user", "content": "What is the weather like in San Francisco?"}
1182 ]
1183 },
1184 "tools": [
1185 {
1186 "type": "function",
1187 "function": {
1188 "name": "get_current_weather",
1189 "description": "Get the current weather in a given location",
1190 "parameters": {
1191 "type": "object",
1192 "properties": {
1193 "location": {
1194 "type": "string",
1195 "description": "The city and state, e.g. San Francisco, CA"
1196 },
1197 "unit": {
1198 "type": "string",
1199 "enum": ["celsius", "fahrenheit"]
1200 }
1201 },
1202 "required": ["location"]
1203 }
1204 }
1205 }
1206 ],
1207 "stream": true
1208 }'
1209```
1210
1211#### Response
1212
1213```json
1214event: thread.created
1215data: {"id":"thread_123","object":"thread","created_at":1710351818,"metadata":{}}
1216
1217event: thread.run.created
1218data: {"id":"run_123","object":"thread.run","created_at":1710351818,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710352418,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[{"type":"function","function":{"name":"get_current_weather","description":"Get the current weather in a given location","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The city and state, e.g. San Francisco, CA"},"unit":{"type":"string","enum":["celsius","fahrenheit"]}},"required":["location"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}}
1219
1220event: thread.run.queued
1221data: {"id":"run_123","object":"thread.run","created_at":1710351818,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710352418,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[{"type":"function","function":{"name":"get_current_weather","description":"Get the current weather in a given location","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The city and state, e.g. San Francisco, CA"},"unit":{"type":"string","enum":["celsius","fahrenheit"]}},"required":["location"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}}
1222
1223event: thread.run.in_progress
1224data: {"id":"run_123","object":"thread.run","created_at":1710351818,"assistant_id":"asst_123","thread_id":"thread_123","status":"in_progress","started_at":1710351818,"expires_at":1710352418,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[{"type":"function","function":{"name":"get_current_weather","description":"Get the current weather in a given location","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The city and state, e.g. San Francisco, CA"},"unit":{"type":"string","enum":["celsius","fahrenheit"]}},"required":["location"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}}
1225
1226event: thread.run.step.created
1227data: {"id":"step_001","object":"thread.run.step","created_at":1710351819,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"tool_calls","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710352418,"failed_at":null,"last_error":null,"step_details":{"type":"tool_calls","tool_calls":[]},"usage":null}
1228
1229event: thread.run.step.in_progress
1230data: {"id":"step_001","object":"thread.run.step","created_at":1710351819,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"tool_calls","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710352418,"failed_at":null,"last_error":null,"step_details":{"type":"tool_calls","tool_calls":[]},"usage":null}
1231
1232event: thread.run.step.delta
1233data: {"id":"step_001","object":"thread.run.step.delta","delta":{"step_details":{"type":"tool_calls","tool_calls":[{"index":0,"id":"call_XXNp8YGaFrjrSjgqxtC8JJ1B","type":"function","function":{"name":"get_current_weather","arguments":"","output":null}}]}}}
1234
1235event: thread.run.step.delta
1236data: {"id":"step_001","object":"thread.run.step.delta","delta":{"step_details":{"type":"tool_calls","tool_calls":[{"index":0,"type":"function","function":{"arguments":"{\""}}]}}}
1237
1238event: thread.run.step.delta
1239data: {"id":"step_001","object":"thread.run.step.delta","delta":{"step_details":{"type":"tool_calls","tool_calls":[{"index":0,"type":"function","function":{"arguments":"location"}}]}}}
1240
1241...
1242
1243event: thread.run.step.delta
1244data: {"id":"step_001","object":"thread.run.step.delta","delta":{"step_details":{"type":"tool_calls","tool_calls":[{"index":0,"type":"function","function":{"arguments":"ahrenheit"}}]}}}
1245
1246event: thread.run.step.delta
1247data: {"id":"step_001","object":"thread.run.step.delta","delta":{"step_details":{"type":"tool_calls","tool_calls":[{"index":0,"type":"function","function":{"arguments":"\"}"}}]}}}
1248
1249event: thread.run.requires_action
1250data: {"id":"run_123","object":"thread.run","created_at":1710351818,"assistant_id":"asst_123","thread_id":"thread_123","status":"requires_action","started_at":1710351818,"expires_at":1710352418,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":{"type":"submit_tool_outputs","submit_tool_outputs":{"tool_calls":[{"id":"call_XXNp8YGaFrjrSjgqxtC8JJ1B","type":"function","function":{"name":"get_current_weather","arguments":"{\"location\":\"San Francisco, CA\",\"unit\":\"fahrenheit\"}"}}]}},"last_error":null,"model":"gpt-4o","instructions":null,"tools":[{"type":"function","function":{"name":"get_current_weather","description":"Get the current weather in a given location","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The city and state, e.g. San Francisco, CA"},"unit":{"type":"string","enum":["celsius","fahrenheit"]}},"required":["location"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":{"prompt_tokens":345,"completion_tokens":11,"total_tokens":356},"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}}
1251
1252event: done
1253data: [DONE]
1254```