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

x/openai/resources/beta/threads/threads.ts>Threads

Deno build of the official Typescript library for the OpenAI API.
Extremely Popular
Go to Latest
namespace Threads
import { Threads } from "https://deno.land/x/openai@v4.61.1/resources/beta/threads/threads.ts";

Type Aliases

class Threads
extends APIResource
import { Threads } from "https://deno.land/x/openai@v4.61.1/resources/beta/threads/threads.ts";

Properties

messages: MessagesAPI.Messages
runs: RunsAPI.Runs

Methods

create(body?: ThreadCreateParams, options?: Core.RequestOptions): Core.APIPromise<Thread>

Create a thread.

create(options?: Core.RequestOptions): Core.APIPromise<Thread>
createAndRun(body: ThreadCreateAndRunParamsNonStreaming, options?: Core.RequestOptions): APIPromise<RunsAPI.Run>

Create a thread and run it in one request.

createAndRun(body: ThreadCreateAndRunParamsStreaming, options?: Core.RequestOptions): APIPromise<Stream<AssistantsAPI.AssistantStreamEvent>>
createAndRun(body: ThreadCreateAndRunParamsBase, options?: Core.RequestOptions): APIPromise<Stream<AssistantsAPI.AssistantStreamEvent> | RunsAPI.Run>
createAndRunPoll(body: ThreadCreateAndRunParamsNonStreaming, options?: Core.RequestOptions & { pollIntervalMs?: number; }): Promise<Threads.Run>

A helper to create a thread, start a run and then 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

Create a thread and stream the run back

del(threadId: string, options?: Core.RequestOptions): Core.APIPromise<ThreadDeleted>

Delete a thread.

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

Retrieves a thread.

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

Modifies a thread.