Unit_AI/node_modules/openai/resources/beta/threads/threads.js

94 lines
3.3 KiB
JavaScript
Raw Normal View History

2024-06-01 21:24:36 +01:00
"use strict";
// File generated from our OpenAPI spec by Stainless.
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Threads = void 0;
const resource_1 = require("openai/resource");
const core_1 = require("openai/core");
const MessagesAPI = __importStar(require("openai/resources/beta/threads/messages/messages"));
const RunsAPI = __importStar(require("openai/resources/beta/threads/runs/runs"));
class Threads extends resource_1.APIResource {
constructor() {
super(...arguments);
this.runs = new RunsAPI.Runs(this._client);
this.messages = new MessagesAPI.Messages(this._client);
}
create(body = {}, options) {
if ((0, core_1.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 },
});
}
}
exports.Threads = Threads;
(function (Threads) {
Threads.Runs = RunsAPI.Runs;
Threads.RunsPage = RunsAPI.RunsPage;
Threads.Messages = MessagesAPI.Messages;
Threads.ThreadMessagesPage = MessagesAPI.ThreadMessagesPage;
})(Threads = exports.Threads || (exports.Threads = {}));
//# sourceMappingURL=threads.js.map