basant307/AI_Governance_Project
048
1// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.2import { APIResource } from "../../core/resource.mjs";3import { CursorPage } from "../../core/pagination.mjs";4import { buildHeaders } from "../../internal/headers.mjs";5import { path } from "../../internal/utils/path.mjs";6export class Assistants extends APIResource {7 /**8 * Create an assistant with a model and instructions.9 *10 * @example11 * ```ts12 * const assistant = await client.beta.assistants.create({13 * model: 'gpt-4o',14 * });15 * ```16 */17 create(body, options) {18 return this._client.post('/assistants', {19 body,20 ...options,21 headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),22 });23 }24 /**25 * Retrieves an assistant.26 *27 * @example28 * ```ts29 * const assistant = await client.beta.assistants.retrieve(30 * 'assistant_id',31 * );32 * ```33 */34 retrieve(assistantID, options) {35 return this._client.get(path `/assistants/${assistantID}`, {36 ...options,37 headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),38 });39 }40 /**41 * Modifies an assistant.42 *43 * @example44 * ```ts45 * const assistant = await client.beta.assistants.update(46 * 'assistant_id',47 * );48 * ```49 */50 update(assistantID, body, options) {51 return this._client.post(path `/assistants/${assistantID}`, {52 body,53 ...options,54 headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),55 });56 }57 /**58 * Returns a list of assistants.59 *60 * @example61 * ```ts62 * // Automatically fetches more pages as needed.63 * for await (const assistant of client.beta.assistants.list()) {64 * // ...65 * }66 * ```67 */68 list(query = {}, options) {69 return this._client.getAPIList('/assistants', (CursorPage), {70 query,71 ...options,72 headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),73 });74 }75 /**76 * Delete an assistant.77 *78 * @example79 * ```ts80 * const assistantDeleted =81 * await client.beta.assistants.delete('assistant_id');82 * ```83 */84 delete(assistantID, options) {85 return this._client.delete(path `/assistants/${assistantID}`, {86 ...options,87 headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),88 });89 }90}91//# sourceMappingURL=assistants.mjs.map