// File generated from our OpenAPI spec by Stainless. import { APIResource } from 'openai/resource'; import { isRequestOptions } from 'openai/core'; import * as MessagesAPI from 'openai/resources/beta/threads/messages/messages'; import * as RunsAPI from 'openai/resources/beta/threads/runs/runs'; export class Threads extends APIResource { constructor() { super(...arguments); this.runs = new RunsAPI.Runs(this._client); this.messages = new MessagesAPI.Messages(this._client); } create(body = {}, options) { if (isRequestOptions(body)) { return this.create({}, body); } return this._client.post('/threads', { body, ...options, headers: { 'OpenAI-Beta': 'assistants=v1', ...options?.headers }, }); } /** * Retrieves a thread. */ retrieve(threadId, options) { return this._client.get(`/threads/${threadId}`, { ...options, headers: { 'OpenAI-Beta': 'assistants=v1', ...options?.headers }, }); } /** * Modifies a thread. */ update(threadId, body, options) { return this._client.post(`/threads/${threadId}`, { body, ...options, headers: { 'OpenAI-Beta': 'assistants=v1', ...options?.headers }, }); } /** * Delete a thread. */ del(threadId, options) { return this._client.delete(`/threads/${threadId}`, { ...options, headers: { 'OpenAI-Beta': 'assistants=v1', ...options?.headers }, }); } /** * Create a thread and run it in one request. */ createAndRun(body, options) { return this._client.post('/threads/runs', { body, ...options, headers: { 'OpenAI-Beta': 'assistants=v1', ...options?.headers }, }); } } (function (Threads) { Threads.Runs = RunsAPI.Runs; Threads.RunsPage = RunsAPI.RunsPage; Threads.Messages = MessagesAPI.Messages; Threads.ThreadMessagesPage = MessagesAPI.ThreadMessagesPage; })(Threads || (Threads = {})); //# sourceMappingURL=threads.mjs.map