@azure/openai-assistants
Version:
An isomorphic client library for Azure OpenAI Assistants.
119 lines • 9.81 kB
TypeScript
/**
* THIS IS AN AUTO-GENERATED FILE - DO NOT EDIT!
*
* Any changes you make here may be lost.
*
* If you need to make changes, please do so in the original source file, \{project-root\}/sources/custom
*/
import { KeyCredential, TokenCredential } from "@azure/core-auth";
import { Pipeline } from "@azure/core-rest-pipeline";
import { AssistantsClientOptions } from "./index.js";
import { Assistant, AssistantCreationOptions, AssistantDeletionStatus, AssistantFile, AssistantFileDeletionStatus, AssistantThread, AssistantThreadCreationOptions, CreateAndRunThreadOptions, CreateRunOptions, FileDeletionStatus, FileListResponse, FilePurpose, InputFile, MessageFile, MessageRole, ListResponseOf, RunStep, ThreadDeletionStatus, ThreadMessage, ThreadRun, ToolOutput, UpdateAssistantOptions } from "./models/models.js";
import { CancelRunOptions, CreateAssistantFileOptions, CreateAssistantOptions, CreateMessageOptions, CreateRunRequestOptions, CreateThreadAndRunOptions, CreateThreadOptions, DeleteAssistantFileOptions, DeleteAssistantOptions, DeleteFileOptions, DeleteThreadOptions, GetAssistantFileOptions, GetAssistantOptions, GetFileOptions, GetMessageFileOptions, GetMessageOptions, GetRunOptions, GetRunStepOptions, GetThreadOptions, ListAssistantFilesOptions, ListAssistantsOptions, ListFilesOptions, ListMessageFilesOptions, ListMessagesOptions, ListRunStepsOptions, ListRunsOptions, SubmitToolOutputsToRunOptions, UpdateAssistantRequestOptions, UpdateMessageOptions, UpdateRunOptions, UpdateThreadOptions, UploadFileOptions } from "./models/options.js";
export { AssistantsClientOptions } from "./api/AssistantsContext.js";
/**
* Client handling assistant-related operations.
* @deprecated The Azure OpenAI Assistants client library for JavaScript beta will be retired on January 14th, 2025. Please migrate to the stable OpenAI SDK for JavaScript using the [migration guide](https://aka.ms/oai/js/asst/migrate) before that date.
*/
export declare class AssistantsClient {
/** The pipeline used by this client to make requests */
readonly pipeline: Pipeline;
private _client;
private _isAzure;
/**
* Initializes an instance of AssistantsClient for use with an OpenAI resource.
* @param endpoint - The URI for an Azure OpenAI resource, including protocol and hostname.
* For example: https://my-resource.openai.azure.com.
* @param credential - A key credential used to authenticate to an Azure OpenAI resource.
* @param options - The options for configuring the client.
* @remarks
* This constructor initializes an AssistantsClient object that can only be used with Azure OpenAI resources.
* To use AssistantsClient with a non-Azure OpenAI inference endpoint, use a constructor that accepts a non-Azure OpenAI API key instead.
*/
constructor(endpoint: string, credential: KeyCredential, options?: AssistantsClientOptions);
/**
* Initializes an instance of AssistantsClient for use with an Azure OpenAI resource.
* @param endpoint - The URI for an Azure OpenAI resource, including protocol and hostname.
* For example: https://my-resource.openai.azure.com.
* @param credential - A token credential used to authenticate with an Azure OpenAI resource.
* @param options - The options for configuring the client.
*/
constructor(endpoint: string, credential: TokenCredential, options?: AssistantsClientOptions);
/**
* Initializes an instance of AssistantsClient for use with the non-Azure OpenAI endpoint.
* @param openAiApiKey - The API key to use when connecting to the non-Azure OpenAI endpoint.
* @param options - The options for configuring the client.
* @remarks
* AssistantsClient objects initialized with this constructor can only be used with the non-Azure OpenAI inference endpoint.
* To use AssistantsClient with an Azure OpenAI resource, use a constructor that accepts a resource URI and Azure authentication credential instead.
*/
constructor(openAiApiKey: KeyCredential, options?: AssistantsClientOptions);
/** Creates a new assistant. */
createAssistant(body: AssistantCreationOptions, options?: CreateAssistantOptions): Promise<Assistant>;
/** Gets a list of assistants that were previously created. */
listAssistants(options?: ListAssistantsOptions): Promise<ListResponseOf<Assistant>>;
/** Retrieves an existing assistant. */
getAssistant(assistantId: string, options?: GetAssistantOptions): Promise<Assistant>;
/** Modifies an existing assistant. */
updateAssistant(assistantId: string, body: UpdateAssistantOptions, options?: UpdateAssistantRequestOptions): Promise<Assistant>;
/** Deletes an assistant. */
deleteAssistant(assistantId: string, options?: DeleteAssistantOptions): Promise<AssistantDeletionStatus>;
/** Attaches a previously uploaded file to an assistant for use by tools that can read files. */
createAssistantFile(assistantId: string, fileId: string, options?: CreateAssistantFileOptions): Promise<AssistantFile>;
/** Gets a list of files attached to a specific assistant, as used by tools that can read files. */
listAssistantFiles(assistantId: string, options?: ListAssistantFilesOptions): Promise<ListResponseOf<AssistantFile>>;
/** Retrieves a file attached to an assistant. */
getAssistantFile(assistantId: string, fileId: string, options?: GetAssistantFileOptions): Promise<AssistantFile>;
/**
* Unlinks a previously attached file from an assistant, rendering it unavailable for use by tools that can read
* files.
*/
deleteAssistantFile(assistantId: string, fileId: string, options?: DeleteAssistantFileOptions): Promise<AssistantFileDeletionStatus>;
/** Creates a new thread. Threads contain messages and can be run by assistants. */
createThread(body?: AssistantThreadCreationOptions, options?: CreateThreadOptions): Promise<AssistantThread>;
/** Gets information about an existing thread. */
getThread(threadId: string, options?: GetThreadOptions): Promise<AssistantThread>;
/** Modifies an existing thread. */
updateThread(threadId: string, options?: UpdateThreadOptions): Promise<AssistantThread>;
/** Deletes an existing thread. */
deleteThread(threadId: string, options?: DeleteThreadOptions): Promise<ThreadDeletionStatus>;
/** Creates a new message on a specified thread. */
createMessage(threadId: string, role: MessageRole, content: string, options?: CreateMessageOptions): Promise<ThreadMessage>;
/** Gets a list of messages that exist on a thread. */
listMessages(threadId: string, options?: ListMessagesOptions): Promise<ListResponseOf<ThreadMessage>>;
/** Gets an existing message from an existing thread. */
getMessage(threadId: string, messageId: string, options?: GetMessageOptions): Promise<ThreadMessage>;
/** Modifies an existing message on an existing thread. */
updateMessage(threadId: string, messageId: string, options?: UpdateMessageOptions): Promise<ThreadMessage>;
/** Gets a list of previously uploaded files associated with a message from a thread. */
listMessageFiles(threadId: string, messageId: string, options?: ListMessageFilesOptions): Promise<ListResponseOf<MessageFile>>;
/** Gets information about a file attachment to a message within a thread. */
getMessageFile(threadId: string, messageId: string, fileId: string, options?: GetMessageFileOptions): Promise<MessageFile>;
/** Creates a new run for an assistant thread. */
createRun(threadId: string, createRunOptions: CreateRunOptions, options?: CreateRunRequestOptions): Promise<ThreadRun>;
/** Gets a list of runs for a specified thread. */
listRuns(threadId: string, options?: ListRunsOptions): Promise<ListResponseOf<ThreadRun>>;
/** Gets an existing run from an existing thread. */
getRun(threadId: string, runId: string, options?: GetRunOptions): Promise<ThreadRun>;
/** Modifies an existing thread run. */
updateRun(threadId: string, runId: string, options?: UpdateRunOptions): Promise<ThreadRun>;
/** Submits outputs from tools as requested by tool calls in a run. Runs that need submitted tool outputs will have a status of 'requires_action' with a required_action.type of 'submit_tool_outputs'. */
submitToolOutputsToRun(threadId: string, runId: string, toolOutputs: ToolOutput[], options?: SubmitToolOutputsToRunOptions): Promise<ThreadRun>;
/** Cancels a run of an in progress thread. */
cancelRun(threadId: string, runId: string, options?: CancelRunOptions): Promise<ThreadRun>;
/** Creates a new assistant thread and immediately starts a run using that new thread. */
createThreadAndRun(body: CreateAndRunThreadOptions, options?: CreateThreadAndRunOptions): Promise<ThreadRun>;
/** Gets a single run step from a thread run. */
getRunStep(threadId: string, runId: string, stepId: string, options?: GetRunStepOptions): Promise<RunStep>;
/** Gets a list of run steps from a thread run. */
listRunSteps(threadId: string, runId: string, options?: ListRunStepsOptions): Promise<ListResponseOf<RunStep>>;
/** Gets a list of previously uploaded files. */
listFiles(options?: ListFilesOptions): Promise<FileListResponse>;
/** Uploads a file for use by other operations. */
uploadFile(file: Uint8Array, purpose: FilePurpose, options?: UploadFileOptions): Promise<InputFile>;
/** Delete a previously uploaded file. */
deleteFile(fileId: string, options?: DeleteFileOptions): Promise<FileDeletionStatus>;
/** Returns information about a specific file. Does not retrieve file content. */
getFile(fileId: string, options?: GetFileOptions): Promise<InputFile>;
}
//# sourceMappingURL=assistantsClient.d.ts.map