NAME
OpenAPI::Client::OpenAI::Path::threads-thread_id-runs-run_id-submit_tool_outputs - Documentation for the /threads/{thread_id}/runs/{run_id}/submit_tool_outputs path.
OPERATIONS
POST /threads/{thread_id}/runs/{run_id}/submit_tool_outputs
submitToolOuputsToRun
$client->submit_tool_ouputs_to_run({
body => { ... },
});
When a run has the status: "requires_action" and required_action.type is submit_tool_outputs , this endpoint can be used to submit the outputs from the tool calls once they're all completed. All outputs must be submitted in a single request.
Path/query parameters
thread_id(in path, required, string) - The ID of the thread to which this run belongs.run_id(in path, required, string) - The ID of the run that requires the tool output submission.
Request body
Content-Type: application/json
Example:
{
"assistant_id" : "asst_123",
"cancelled_at" : null,
"completed_at" : null,
"created_at" : 1699075592,
"expires_at" : 1699076192,
"failed_at" : null,
"id" : "run_123",
"instructions" : null,
"last_error" : null,
"max_completion_tokens" : 1000,
"max_prompt_tokens" : 1000,
"metadata" : {},
"model" : "gpt-4o",
"object" : "thread.run",
"parallel_tool_calls" : true,
"response_format" : "auto",
"started_at" : 1699075592,
"status" : "queued",
"temperature" : 1,
"thread_id" : "thread_123",
"tool_choice" : "auto",
"tools" : [
{
"function" : {
"description" : "Get the current weather in a given location",
"name" : "get_current_weather",
"parameters" : {
"properties" : {
"location" : {
"description" : "The city and state, e.g. San Francisco, CA",
"type" : "string"
},
"unit" : {
"enum" : [
"celsius",
"fahrenheit"
],
"type" : "string"
}
},
"required" : [
"location"
],
"type" : "object"
}
},
"type" : "function"
}
],
"top_p" : 1,
"truncation_strategy" : {
"last_messages" : null,
"type" : "auto"
},
"usage" : null
}
Responses
200 - OK
Content-Type: application/json
Example:
{
"assistant_id" : "asst_123",
"cancelled_at" : null,
"completed_at" : null,
"created_at" : 1699075592,
"expires_at" : 1699076192,
"failed_at" : null,
"id" : "run_123",
"instructions" : null,
"last_error" : null,
"max_completion_tokens" : 1000,
"max_prompt_tokens" : 1000,
"metadata" : {},
"model" : "gpt-4o",
"object" : "thread.run",
"parallel_tool_calls" : true,
"response_format" : "auto",
"started_at" : 1699075592,
"status" : "queued",
"temperature" : 1,
"thread_id" : "thread_123",
"tool_choice" : "auto",
"tools" : [
{
"function" : {
"description" : "Get the current weather in a given location",
"name" : "get_current_weather",
"parameters" : {
"properties" : {
"location" : {
"description" : "The city and state, e.g. San Francisco, CA",
"type" : "string"
},
"unit" : {
"enum" : [
"celsius",
"fahrenheit"
],
"type" : "string"
}
},
"required" : [
"location"
],
"type" : "object"
}
},
"type" : "function"
}
],
"top_p" : 1,
"truncation_strategy" : {
"last_messages" : null,
"type" : "auto"
},
"usage" : null
}
SCHEMAS
AssistantsApiResponseFormatOption
Specifies the format that the model must output. Compatible with GPT-4o , GPT-4 Turbo , and all GPT-3.5 Turbo models since gpt-3.5-turbo-1106 .
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 .
Setting to { "type": "json_object" } enables JSON mode, which ensures the message the model generates is valid JSON.
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.
Metadata
Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.
Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.
ParallelToolCalls
Whether to enable parallel function calling during tool use.
RunCompletionUsage
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.).
RunObject
Properties:
assistant_id(string, required) - The ID of the assistant used for execution of this run.cancelled_at(integer, required) - The Unix timestamp (in seconds) for when the run was cancelled.completed_at(integer, required) - The Unix timestamp (in seconds) for when the run was completed.created_at(integer, required) - The Unix timestamp (in seconds) for when the run was created.expires_at(integer, required) - The Unix timestamp (in seconds) for when the run will expire.failed_at(integer, required) - The Unix timestamp (in seconds) for when the run failed.id(string, required) - The identifier, which can be referenced in API endpoints.incomplete_details(object, required) - Details on why the run is incomplete. Will benullif the run is not incomplete.instructions(string, required) - The instructions that the assistant used for this run.last_error(object, required) - The last error associated with this run. Will benullif there are no errors.max_completion_tokens(integer, required) - The maximum number of completion tokens specified to have been used over the course of the run.max_prompt_tokens(integer, required) - The maximum number of prompt tokens specified to have been used over the course of the run.metadata(Metadata, required)See "Metadata" below for shape.
model(string, required) - The model that the assistant used for this run.object(string, required) - The object type, which is alwaysthread.run.Allowed values: thread.run
parallel_tool_calls(ParallelToolCalls, required)See "ParallelToolCalls" below for shape.
required_action(object, required) - Details on the action required to continue the run. Will benullif no action is required.response_format(AssistantsApiResponseFormatOption, required)See "AssistantsApiResponseFormatOption" below for shape.
started_at(integer, required) - The Unix timestamp (in seconds) for when the run was started.status(string, required) - The status of the run, which can be eitherqueued,in_progress,requires_action,cancelling,cancelled,failed,completed,incomplete, orexpired.Allowed values: queued, in_progress, requires_action, cancelling, cancelled, failed, completed, incomplete, expired
temperature(number) - The sampling temperature used for this run. If not set, defaults to 1.thread_id(string, required) - The ID of the thread that was executed on as a part of this run.tool_choice(allOf, required)tools(array of object, required) - The list of tools that the assistant used for this run.Default: []
top_p(number) - The nucleus sampling value used for this run. If not set, defaults to 1.truncation_strategy(allOf, required)usage(RunCompletionUsage, required)See "RunCompletionUsage" below for shape.
RunToolCallObject
Properties:
function(object, required) - The function definition.id(string, required) - 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 endpoint.type(string, required) - The type of tool call the output is required for. For now, this is alwaysfunction.Allowed values: function
SubmitToolOutputsRunRequest
Properties:
stream(anyOf)tool_outputs(array of object, required) - A list of tools for which the outputs are being submitted.
SEE ALSO
COPYRIGHT AND LICENSE
Copyright (C) 2023-2026 by Nelson Ferraz
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.14.0 or, at your option, any later version of Perl 5 you may have available.