@inductiv/node-red-openai-api
Version:
Enhance your Node-RED projects with advanced AI capabilities.
441 lines (383 loc) • 16.8 kB
HTML
<section>
<details>
<summary style="font-weight: bold;">🔄 Runs</summary>
<a href="https://developers.openai.com/api/reference/typescript/resources/beta/threads/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
<span class="property-type">string</span>
</dt>
<dd>The ID of the assistant to use to execute this run.</dd>
<dt class="optional">
thread
<span class="property-type">object</span>
</dt>
<dd>A thread object to create with the run.</dd>
<dt class="optional">
model
<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
<span class="property-type">string</span>
</dt>
<dd>Override the default system message of the assistant.</dd>
<dt class="optional">
tools
<span class="property-type">array</span>
</dt>
<dd>Override the tools the assistant can use for this run.</dd>
<dt class="optional">
tool_resources
<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
<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
<span class="property-type">number</span>
</dt>
<dd>What sampling temperature to use, between 0 and 2.</dd>
<dt class="optional">
top_p
<span class="property-type">number or null</span>
</dt>
<dd>An alternative to sampling with temperature.</dd>
<dt class="optional">
stream
<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
<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
<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
<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
<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
<span class="property-type">boolean</span>
</dt>
<dd>Whether to enable parallel function calling during tool use.</dd>
<dt class="optional">
response_format
<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
<span class="property-type">string</span>
</dt>
<dd>The ID of the thread the run belongs to.</dd>
<dt class="optional">
limit
<span class="property-type">integer</span>
</dt>
<dd>A limit on the number of objects to be returned.</dd>
<dt class="optional">
order
<span class="property-type">string</span>
</dt>
<dd>Sort order by the created_at timestamp of the objects.</dd>
<dt class="optional">
after
<span class="property-type">string</span>
</dt>
<dd>A cursor for use in pagination.</dd>
<dt class="optional">
before
<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
<span class="property-type">string</span>
</dt>
<dd>The ID of the thread to run.</dd>
<dt>
include
<span class="property-type">array</span>
</dt>
<dd>A list of additional fields to include in the response.</dd>
<dt>
assistant_id
<span class="property-type">string</span>
</dt>
<dd>The ID of the assistant to use to execute this run.</dd>
<dt class="optional">
model
<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
<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
<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
<span class="property-type">array</span>
</dt>
<dd>
Adds additional messages to the thread before creating the run.
</dd>
<dt class="optional">
tools
<span class="property-type">array</span>
</dt>
<dd>Override the tools the assistant can use for this run.</dd>
<dt class="optional">
metadata
<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
<span class="property-type">number</span>
</dt>
<dd>What sampling temperature to use, between 0 and 2.</dd>
<dt class="optional">
top_p
<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
<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
<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
<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
<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
<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
<span class="property-type">boolean</span>
</dt>
<dd>Whether to enable parallel function calling during tool use.</dd>
<dt class="optional">
response_format
<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
<span class="property-type">string</span>
</dt>
<dd>The ID of the thread that was run.</dd>
<dt>run_id
<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
<span class="property-type">string</span>
</dt>
<dd>The ID of the thread that was run.</dd>
<dt>
run_id
<span class="property-type">string</span>
</dt>
<dd>The ID of the run to modify.</dd>
<dt class="optional">
metadata
<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
<span class="property-type">string</span>
</dt>
<dd>The ID of the thread to which this run belongs.</dd>
<dt>
run_id
<span class="property-type">string</span>
</dt>
<dd>The ID of the run that requires the tool output submission.</dd>
<dt>
tool_outputs
<span class="property-type">array</span>
</dt>
<dd>A list of tools for which the outputs are being submitted.</dd>
<dt class="optional">
stream
<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
<span class="property-type">string</span>
</dt>
<dd>The ID of the thread to which this run belongs.</dd>
<dt>
run_id
<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
<span class="property-type">string</span>
</dt>
<dd>The ID of the thread the run and run steps belong to.</dd>
<dt>
run_id
<span class="property-type">string</span>
</dt>
<dd>The ID of the run the run steps belong to.</dd>
<dt class="optional">
limit
<span class="property-type">integer</span>
</dt>
<dd>A limit on the number of objects to be returned.</dd>
<dt class="optional">
order
<span class="property-type">string</span>
</dt>
<dd>Sort order by the created_at timestamp of the objects.</dd>
<dt class="optional">
after
<span class="property-type">string</span>
</dt>
<dd>A cursor for use in pagination.</dd>
<dt class="optional">
before
<span class="property-type">string</span>
</dt>
<dd>A cursor for use in pagination.</dd>
<dt class="optional">
include
<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
<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
<span class="property-type">string</span>
</dt>
<dd>The ID of the run to which the run step belongs.</dd>
<dt>
step_id
<span class="property-type">string</span>
</dt>
<dd>The ID of the run step to retrieve.</dd>
<dt>
include
<span class="property-type">array</span>
</dt>
<dd>A list of additional fields to include in the response.</dd>
</dl>
</details>
</section>