Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/openai/resources/beta/threads/mod.ts>Runs

Deno build of the official Typescript library for the OpenAI API.
Extremely Popular
Go to Latest
class Runs
extends APIResource
import { Runs } from "https://deno.land/x/openai@v4.52.0/resources/beta/threads/mod.ts";

Properties

steps: StepsAPI.Steps

Methods

cancel(
threadId: string,
runId: string,
options?: Core.RequestOptions,
): Core.APIPromise<Run>

Cancels a run that is in_progress.

create(
threadId: string,
options?: Core.RequestOptions,
): APIPromise<Run>

Create a run.

create(
threadId: string,
options?: Core.RequestOptions,
): APIPromise<Stream<AssistantsAPI.AssistantStreamEvent>>
create(
threadId: string,
body: RunCreateParamsBase,
options?: Core.RequestOptions,
): APIPromise<Stream<AssistantsAPI.AssistantStreamEvent> | Run>
createAndPoll(
threadId: string,
options?: Core.RequestOptions & { pollIntervalMs?: number; },
): Promise<Run>

A helper to create a run an poll for a terminal state. More information on Run lifecycles can be found here: https://platform.openai.com/docs/assistants/how-it-works/runs-and-run-steps

deprecated
createAndStream(
threadId: string,
body: RunCreateParamsBaseStream,
options?: Core.RequestOptions,
): AssistantStream

Create a Run stream

list(
threadId: string,
query?: RunListParams,
options?: Core.RequestOptions,
): Core.PagePromise<RunsPage, Run>

Returns a list of runs belonging to a thread.

list(threadId: string, options?: Core.RequestOptions): Core.PagePromise<RunsPage, Run>
poll(
threadId: string,
runId: string,
options?: Core.RequestOptions & { pollIntervalMs?: number; },
): Promise<Run>

A helper to poll a run status until it reaches a terminal state. More information on Run lifecycles can be found here: https://platform.openai.com/docs/assistants/how-it-works/runs-and-run-steps

retrieve(
threadId: string,
runId: string,
options?: Core.RequestOptions,
): Core.APIPromise<Run>

Retrieves a run.

stream(
threadId: string,
body: RunCreateParamsBaseStream,
options?: Core.RequestOptions,
): AssistantStream

Create a Run stream

submitToolOutputs(
threadId: string,
runId: string,
options?: Core.RequestOptions,
): APIPromise<Run>

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.

submitToolOutputs(
threadId: string,
runId: string,
options?: Core.RequestOptions,
): APIPromise<Stream<AssistantsAPI.AssistantStreamEvent>>
submitToolOutputs(
threadId: string,
runId: string,
body: RunSubmitToolOutputsParamsBase,
options?: Core.RequestOptions,
): APIPromise<Stream<AssistantsAPI.AssistantStreamEvent> | Run>
submitToolOutputsAndPoll(
threadId: string,
runId: string,
options?: Core.RequestOptions & { pollIntervalMs?: number; },
): Promise<Run>

A helper to submit a tool output to a run and poll for a terminal run state. More information on Run lifecycles can be found here: https://platform.openai.com/docs/assistants/how-it-works/runs-and-run-steps

submitToolOutputsStream(
threadId: string,
runId: string,
body: RunSubmitToolOutputsParamsStream,
options?: Core.RequestOptions,
): AssistantStream

Submit the tool outputs from a previous run and stream the run to a terminal state. More information on Run lifecycles can be found here: https://platform.openai.com/docs/assistants/how-it-works/runs-and-run-steps

update(
threadId: string,
runId: string,
options?: Core.RequestOptions,
): Core.APIPromise<Run>

Modifies a run.