@inductiv/node-red-openai-api
Version:
Enhance your Node-RED projects with advanced AI capabilities.
563 lines (505 loc) • 30.2 kB
HTML
<section>
<details>
<summary style="font-weight: bold;">🔄 Runs</summary>
<a href="https://platform.openai.com/docs/api-reference/runs" target="_blank">Official Documentation</a>
<h4 style="font-weight: bolder;"> ⋙ Create Thread and Run</h4>
<p>Create a thread and run it in one request.</p>
<dl class="message-properties">
<h4>msg.payload Properties</h4>
<dt>
assistant_id
<a href="https://platform.openai.com/docs/api-reference/runs/createThreadAndRun#runs-createthreadandrun-assistant_id"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">string</span>
</dt>
<dd>The ID of the assistant to use to execute this run.</dd>
<dt class="optional">
thread
<a href="https://platform.openai.com/docs/api-reference/runs/createThreadAndRun#runs-createthreadandrun-thread"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">object</span>
</dt>
<dd>A thread object to create with the run.</dd>
<dt class="optional">
model
<a href="https://platform.openai.com/docs/api-reference/runs/createThreadAndRun#runs-createthreadandrun-model"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">string</span>
</dt>
<dd>The ID of the Model to be used to execute this run.</dd>
<dt class="optional">
instructions
<a href="https://platform.openai.com/docs/api-reference/runs/createThreadAndRun#runs-createthreadandrun-instructions"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">string</span>
</dt>
<dd>Override the default system message of the assistant.</dd>
<dt class="optional">
tools
<a href="https://platform.openai.com/docs/api-reference/runs/createThreadAndRun#runs-createthreadandrun-tools"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">array</span>
</dt>
<dd>Override the tools the assistant can use for this run.</dd>
<dt class="optional">
tool_resources
<a href="https://platform.openai.com/docs/api-reference/runs/createThreadAndRun#runs-createthreadandrun-tool_resources"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">object or null</span>
</dt>
<dd>A set of resources that are used by the assistant's tools.</dd>
<dt class="optional">
metadata
<a href="https://platform.openai.com/docs/api-reference/runs/createThreadAndRun#runs-createthreadandrun-metadata"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">object</span>
</dt>
<dd>Set of 16 key-value pairs that can be attached to an object.</dd>
<dt class="optional">
temperature
<a href="https://platform.openai.com/docs/api-reference/runs/createThreadAndRun#runs-createthreadandrun-temperature"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">number</span>
</dt>
<dd>What sampling temperature to use, between 0 and 2.</dd>
<dt class="optional">
top_p
<a href="https://platform.openai.com/docs/api-reference/runs/createThreadAndRun#runs-createthreadandrun-top_p"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">number or null</span>
</dt>
<dd>An alternative to sampling with temperature.</dd>
<dt class="optional">
stream
<a href="https://platform.openai.com/docs/api-reference/runs/createThreadAndRun#runs-createthreadandrun-stream"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">boolean</span>
</dt>
<dd>If <code>true</code>, returns a stream of events that happen during the Run as server-sent events,
terminating when the Run enters a terminal state with a <code>data: [DONE]</code> message.</dd>
<dt class="optional">
max_prompt_tokens
<a href="https://platform.openai.com/docs/api-reference/runs/createThreadAndRun#runs-createthreadandrun-max_prompt_tokens"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">integer</span>
</dt>
<dd>The maximum number of prompt tokens that may be used over the course of the run.</dd>
<dt class="optional">
max_completion_tokens
<a href="https://platform.openai.com/docs/api-reference/runs/createThreadAndRun#runs-createthreadandrun-max_completion_tokens"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">integer</span>
</dt>
<dd>The maximum number of completion tokens that may be used over the course of the run.</dd>
<dt class="optional">
truncation_strategy
<a href="https://platform.openai.com/docs/api-reference/runs/createThreadAndRun#runs-createthreadandrun-truncation_strategy"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">object</span>
<dd>
<strong><code>@property {string} type</code></strong> - The truncation strategy to use for the thread.
The default is <code>auto</code>. If set to <code>last_messages</code>, the thread will be truncated to
the n most recent messages in the thread. When set to <code>auto</code>, messages in the middle of the
thread will be dropped to fit the context length of the model, <code>max_prompt_tokens</code>.
</dd>
<dd>
<strong><code>@property {integer} [last_messages]</code></strong> - The number of most recent messages
from the thread when constructing the context for the run.
</dd>
</dt>
<dt class="optional">
tool_choice
<a href="https://platform.openai.com/docs/api-reference/runs/createThreadAndRun#runs-createthreadandrun-tool_choice"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">string | object</span>
</dt>
<dd>Controls which (if any) tool is called by the model. <code>none</code> means the model will not call any
tools and instead generates a message. <code>auto</code> is the default value and means the model can
pick between generating a message or calling a tool. Specifying a particular tool like
<code>{"type": "TOOL_TYPE"}</code> forces the model to call that tool.</dd>
<dt class="optional">
parallel_tool_calls
<a href="https://platform.openai.com/docs/api-reference/runs/createThreadAndRun#runs-createthreadandrun-parallel_tool_calls"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">boolean</span>
</dt>
<dd>Whether to enable parallel function calling during tool use.</dd>
<dt class="optional">
response_format
<a href="https://platform.openai.com/docs/api-reference/runs/createThreadAndRun#runs-createthreadandrun-response_format"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">string | object</span>
</dt>
<dd>Specifies the format that the model must output.</dd>
</dl>
<h4 style="font-weight: bolder;"> ⋙ List Runs</h4>
<p>Returns a list of runs belonging to a thread.</p>
<dl class="message-properties">
<h4>msg.payload Properties</h4>
<dt>
thread_id
<a href="https://platform.openai.com/docs/api-reference/runs/listRuns#runs-listruns-thread_id"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">string</span>
</dt>
<dd>The ID of the thread the run belongs to.</dd>
<dt class="optional">
limit
<a href="https://platform.openai.com/docs/api-reference/runs/listRuns#runs-listruns-limit"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">integer</span>
</dt>
<dd>A limit on the number of objects to be returned.</dd>
<dt class="optional">
order
<a href="https://platform.openai.com/docs/api-reference/runs/listRuns#runs-listruns-order"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">string</span>
</dt>
<dd>Sort order by the created_at timestamp of the objects.</dd>
<dt class="optional">
after
<a href="https://platform.openai.com/docs/api-reference/runs/listRuns#runs-listruns-after"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">string</span>
</dt>
<dd>A cursor for use in pagination.</dd>
<dt class="optional">
before
<a href="https://platform.openai.com/docs/api-reference/runs/listRuns#runs-listruns-before"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">string</span>
</dt>
<dd>A cursor for use in pagination.</dd>
</dl>
<h4 style="font-weight: bolder;"> ⋙ Create Run</h4>
<p>Create a run.</p>
<dl class="message-properties">
<h4>msg.payload Properties</h4>
<dt>
thread_id
<a href="https://platform.openai.com/docs/api-reference/runs/createRun#runs-createrun-thread_id"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">string</span>
</dt>
<dd>The ID of the thread to run.</dd>
<dt>
include
<a href="https://platform.openai.com/docs/api-reference/runs/createRun#runs-createrun-include"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">array</span>
</dt>
<dd>A list of additional fields to include in the response.</dd>
<dt>
assistant_id
<a href="https://platform.openai.com/docs/api-reference/runs/createRun#runs-createrun-assistant_id"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">string</span>
</dt>
<dd>The ID of the assistant to use to execute this run.</dd>
<dt class="optional">
model
<a href="https://platform.openai.com/docs/api-reference/runs/createRun#runs-createrun-model"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">string</span>
</dt>
<dd>The ID of the Model to be used to execute this run.</dd>
<dt class="optional">
instructions
<a href="https://platform.openai.com/docs/api-reference/runs/createRun#runs-createrun-instructions"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">string</span>
</dt>
<dd>
Overrides the instructions of the assistant. This is useful for modifying the behavior on a per-run
basis.
</dd>
<dt class="optional">
additional_instructions
<a href="https://platform.openai.com/docs/api-reference/runs/createRun#runs-createrun-additional_instructions"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">string</span>
</dt>
<dd>
Appends additional instructions at the end of the instructions for the run. This is useful for modifying
the behavior on a per-run basis without overriding other instructions.
</dd>
<dt class="optional">
additional_messages
<a href="https://platform.openai.com/docs/api-reference/runs/createRun#runs-createrun-additional_messages"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">array</span>
</dt>
<dd>
Adds additional messages to the thread before creating the run.
</dd>
<dt class="optional">
tools
<a href="https://platform.openai.com/docs/api-reference/runs/createRun#runs-createrun-tools"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">array</span>
</dt>
<dd>Override the tools the assistant can use for this run.</dd>
<dt class="optional">
metadata
<a href="https://platform.openai.com/docs/api-reference/runs/createRun#runs-createrun-metadata"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">object</span>
</dt>
<dd>Set of 16 key-value pairs that can be attached to an object.</dd>
<dt class="optional">
temperature
<a href="https://platform.openai.com/docs/api-reference/runs/createRun#runs-createrun-temperature"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">number</span>
</dt>
<dd>What sampling temperature to use, between 0 and 2.</dd>
<dt class="optional">
top_p
<a href="https://platform.openai.com/docs/api-reference/runs/createRun#runs-createrun-top_p"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">number</span>
</dt>
<dd>An alternative to sampling with temperature, called nucleus sampling, where the model considers the
results of the tokens with top_p probability mass.</dd>
<dt class="optional">
stream
<a href="https://platform.openai.com/docs/api-reference/runs/createRun#runs-createrun-stream"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">boolean</span>
</dt>
<dd>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.</dd>
<dt class="optional">
max_prompt_tokens
<a href="https://platform.openai.com/docs/api-reference/runs/createRun#runs-createrun-max_prompt_tokens"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">integer</span>
</dt>
<dd>The maximum number of prompt tokens that may be used over the course of the run.</dd>
<dt class="optional">
max_completion_tokens
<a href="https://platform.openai.com/docs/api-reference/runs/createRun#runs-createrun-max_completion_tokens"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">integer</span>
</dt>
<dd>The maximum number of completion tokens that may be used over the course of the run.</dd>
<dt class="optional">
truncation_strategy
<a href="https://platform.openai.com/docs/api-reference/runs/createRun#runs-createrun-truncation_strategy"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">object</span>
</dt>
<dd>Controls for how a thread will be truncated prior to the run.</dd>
<dt class="optional">
tool_choice
<a href="https://platform.openai.com/docs/api-reference/runs/createRun#runs-createrun-tool_choice"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">string or object</span>
</dt>
<dd>Controls for how a thread will be truncated prior to the run.</dd>
<dt class="optional">
parallel_tool_calls
<a href="https://platform.openai.com/docs/api-reference/runs/createRun#runs-createrun-parallel_tool_calls"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">boolean</span>
</dt>
<dd>Whether to enable parallel function calling during tool use.</dd>
<dt class="optional">
response_format
<a href="https://platform.openai.com/docs/api-reference/runs/createRun#runs-createrun-response_format"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">string or object</span>
</dt>
<dd>Specifies the format that the model must output.</dd>
</dl>
<h4 style="font-weight: bolder;"> ⋙ Retrieve Run</h4>
<p>Retrieves a run.</p>
<dl class="message-properties">
<h4>msg.payload Properties</h4>
<dt>thread_id
<a href="https://platform.openai.com/docs/api-reference/runs/getRun#runs-getrun-thread_id"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">string</span>
</dt>
<dd>The ID of the thread that was run.</dd>
<dt>run_id
<a href="https://platform.openai.com/docs/api-reference/runs/getRun#runs-getrun-run_id"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">string</span>
</dt>
<dd>The ID of the run to retrieve.</dd>
</dl>
<h4 style="font-weight: bolder;"> ⋙ Modify Run</h4>
<p>Modifies a run.</p>
<dl class="message-properties">
<h4>msg.payload Properties</h4>
<dt>
thread_id
<a href="https://platform.openai.com/docs/api-reference/runs/getRun#runs-getrun-thread_id"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">string</span>
</dt>
<dd>The ID of the thread that was run.</dd>
<dt>
run_id
<a href="https://platform.openai.com/docs/api-reference/runs/getRun#runs-getrun-run_id"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">string</span>
</dt>
<dd>The ID of the run to modify.</dd>
<dt class="optional">
metadata
<a href="https://platform.openai.com/docs/api-reference/runs/modifyRun#runs-modifyrun-metadata"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">object</span>
</dt>
<dd>Set of 16 key-value pairs that can be attached to an object.</dd>
</dl>
<h4 style="font-weight: bolder;"> ⋙ Submit Tool Outputs to Run</h4>
<p>
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.
</p>
<dl class="message-properties">
<h4>msg.payload Properties</h4>
<dt>
thread_id
<a href="https://platform.openai.com/docs/api-reference/runs/submitToolOutputs#runs-submittooloutputs-thread_id"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">string</span>
</dt>
<dd>The ID of the thread to which this run belongs.</dd>
<dt>
run_id
<a href="https://platform.openai.com/docs/api-reference/runs/submitToolOutputs#runs-submittooloutputs-run_id"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">string</span>
</dt>
<dd>The ID of the run that requires the tool output submission.</dd>
<dt>
tool_outputs
<a href="https://platform.openai.com/docs/api-reference/runs/submitToolOutputs#runs-submittooloutputs-tool_outputs"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">array</span>
</dt>
<dd>A list of tools for which the outputs are being submitted.</dd>
<dt class="optional">
stream
<a href="https://platform.openai.com/docs/api-reference/runs/submitToolOutputs#runs-submittooloutputs-stream"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">boolean</span>
</dt>
<dd>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.</dd>
</dl>
<h4 style="font-weight: bolder;"> ⋙ Cancel Run</h4>
<p>Cancels a run that is `in_progress`.</p>
<dl class="message-properties">
<h4>msg.payload Properties</h4>
<dt>
thread_id
<a href="https://platform.openai.com/docs/api-reference/runs/cancelRun#runs-cancelrun-thread_id"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">string</span>
</dt>
<dd>The ID of the thread to which this run belongs.</dd>
<dt>
run_id
<a href="https://platform.openai.com/docs/api-reference/runs/cancelRun#runs-cancelrun-run_id"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">string</span>
</dt>
<dd>The ID of the run to cancel.</dd>
</dl>
<h4 style="font-weight: bolder;"> ⋙ List Run Steps</h4>
<p>Returns a list of run steps belonging to a run.</p>
<dl class="message-properties">
<h4>msg.payload Properties</h4>
<dt>
thread_id
<a href="https://platform.openai.com/docs/api-reference/runs/listRunSteps#runs-listrunsteps-thread_id"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">string</span>
</dt>
<dd>The ID of the thread the run and run steps belong to.</dd>
<dt>
run_id
<a href="https://platform.openai.com/docs/api-reference/runs/listRunSteps#runs-listrunsteps-run_id"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">string</span>
</dt>
<dd>The ID of the run the run steps belong to.</dd>
<dt class="optional">
limit
<a href="https://platform.openai.com/docs/api-reference/runs/listRunSteps#runs-listrunsteps-limit"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">integer</span>
</dt>
<dd>A limit on the number of objects to be returned.</dd>
<dt class="optional">
order
<a href="https://platform.openai.com/docs/api-reference/runs/listRunSteps#runs-listrunsteps-order"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">string</span>
</dt>
<dd>Sort order by the created_at timestamp of the objects.</dd>
<dt class="optional">
after
<a href="https://platform.openai.com/docs/api-reference/runs/listRunSteps#runs-listrunsteps-after"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">string</span>
</dt>
<dd>A cursor for use in pagination.</dd>
<dt class="optional">
before
<a href="https://platform.openai.com/docs/api-reference/runs/listRunSteps#runs-listrunsteps-before"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">string</span>
</dt>
<dd>A cursor for use in pagination.</dd>
<dt class="optional">
include
<a href="https://platform.openai.com/docs/api-reference/run-steps/listRunSteps#run-steps-listrunsteps-include"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">array</span>
</dt>
<dd>A list of additional fields to include in the response.</dd>
</dl>
<h4 style="font-weight: bolder;"> ⋙ Retrieve Run Step</h4>
<p>Retrieves a run step.</p>
<dl class="message-properties">
<h4>msg.payload Properties</h4>
<dt>
thread_id
<a href="https://platform.openai.com/docs/api-reference/runs/getRunStep#runs-getrunstep-thread_id"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">string</span>
</dt>
<dd>The ID of the thread to which the run and run step belongs.</dd>
<dt>
run_id
<a href="https://platform.openai.com/docs/api-reference/runs/getRunStep#runs-getrunstep-run_id"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">string</span>
</dt>
<dd>The ID of the run to which the run step belongs.</dd>
<dt>
step_id
<a href="https://platform.openai.com/docs/api-reference/runs/getRunStep#runs-getrunstep-step_id"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">string</span>
</dt>
<dd>The ID of the run step to retrieve.</dd>
<dt>
include
<a href="https://platform.openai.com/docs/api-reference/run-steps/getRunStep#run-steps-getrunstep-include"
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
<span class="property-type">array</span>
</dt>
<dd>A list of additional fields to include in the response.</dd>
</dl>
</details>
</section>