Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/openai/resources/beta/mod.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.38.5/resources/beta/mod.ts";

Type Aliases

class Threads
extends APIResource
import { Threads } from "https://deno.land/x/openai@v4.38.5/resources/beta/mod.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

createAndRunStream(body: ThreadCreateAndRunParamsBaseStream, options?: Core.RequestOptions): AssistantStream

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.