AI_botter/node_modules/openai/resources/beta/threads/messages/messages.mjs

59 lines
2 KiB
JavaScript
Raw Normal View History

2024-05-01 02:46:10 +01:00
// 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 FilesAPI from 'openai/resources/beta/threads/messages/files';
import { CursorPage } from 'openai/pagination';
export class Messages extends APIResource {
constructor() {
super(...arguments);
this.files = new FilesAPI.Files(this._client);
}
/**
* Create a message.
*/
create(threadId, body, options) {
return this._client.post(`/threads/${threadId}/messages`, {
body,
...options,
headers: { 'OpenAI-Beta': 'assistants=v1', ...options?.headers },
});
}
/**
* Retrieve a message.
*/
retrieve(threadId, messageId, options) {
return this._client.get(`/threads/${threadId}/messages/${messageId}`, {
...options,
headers: { 'OpenAI-Beta': 'assistants=v1', ...options?.headers },
});
}
/**
* Modifies a message.
*/
update(threadId, messageId, body, options) {
return this._client.post(`/threads/${threadId}/messages/${messageId}`, {
body,
...options,
headers: { 'OpenAI-Beta': 'assistants=v1', ...options?.headers },
});
}
list(threadId, query = {}, options) {
if (isRequestOptions(query)) {
return this.list(threadId, {}, query);
}
return this._client.getAPIList(`/threads/${threadId}/messages`, ThreadMessagesPage, {
query,
...options,
headers: { 'OpenAI-Beta': 'assistants=v1', ...options?.headers },
});
}
}
export class ThreadMessagesPage extends CursorPage {
}
(function (Messages) {
Messages.ThreadMessagesPage = MessagesAPI.ThreadMessagesPage;
Messages.Files = FilesAPI.Files;
Messages.MessageFilesPage = FilesAPI.MessageFilesPage;
})(Messages || (Messages = {}));
//# sourceMappingURL=messages.mjs.map