@azure/openai-assistants
Version:
An isomorphic client library for Azure OpenAI Assistants.
946 lines (844 loc) • 48.2 kB
TypeScript
import { AzureKeyCredential } from '@azure/core-auth';
import { ClientOptions } from '@azure-rest/core-client';
import { KeyCredential } from '@azure/core-auth';
import { OperationOptions } from '@azure-rest/core-client';
import { Pipeline } from '@azure/core-rest-pipeline';
import { TokenCredential } from '@azure/core-auth';
/** Represents an assistant that can call the model and use tools. */
export declare interface Assistant {
/** The identifier, which can be referenced in API endpoints. */
id: string;
/** The Unix timestamp, in seconds, representing when this object was created. */
createdAt: Date;
/** The name of the assistant. */
name: string | null;
/** The description of the assistant. */
description: string | null;
/** The ID of the model to use. */
model: string;
/** The system instructions for the assistant to use. */
instructions: string | null;
/** The collection of tools enabled for the assistant. */
tools: ToolDefinition[];
/** A list of attached file IDs, ordered by creation date in ascending order. */
fileIds: string[];
/** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */
metadata?: Record<string, string> | null;
}
/**
* 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
*/
/** The request details to use when creating a new assistant. */
export declare interface AssistantCreationOptions {
/** The ID of the model to use. */
model: string;
/** The name of the new assistant. */
name?: string | null;
/** The description of the new assistant. */
description?: string | null;
/** The system instructions for the new assistant to use. */
instructions?: string | null;
/** The collection of tools to enable for the new assistant. */
tools?: ToolDefinition[];
/** A list of previously uploaded file IDs to attach to the assistant. */
fileIds?: string[];
/** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */
metadata?: Record<string, string> | null;
}
/** The status of an assistant deletion operation. */
export declare interface AssistantDeletionStatus extends DeletionStatus {
}
/** Information about a file attached to an assistant, as used by tools that can read files. */
export declare interface AssistantFile {
/** The identifier, which can be referenced in API endpoints. */
id: string;
/** The Unix timestamp, in seconds, representing when this object was created. */
createdAt: Date;
/** The assistant ID that the file is attached to. */
assistantId: string;
}
/** The status of an assistant file deletion operation. */
export declare interface AssistantFileDeletionStatus extends DeletionStatus {
}
/**
* 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>;
}
/** The details used to create a assistant client **/
export declare interface AssistantsClientOptions extends ClientOptions {
}
/** Information about a single thread associated with an assistant. */
export declare interface AssistantThread {
/** The identifier, which can be referenced in API endpoints. */
id: string;
/** The Unix timestamp, in seconds, representing when this object was created. */
createdAt: Date;
/** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */
metadata: Record<string, string> | null;
}
/** The details used to create a new assistant thread. */
export declare interface AssistantThreadCreationOptions {
/** The messages to associate with the new thread. */
messages?: {
/** The role associated with the assistant thread message. */
role: string;
/** The list of content items associated with the assistant thread message. */
content: string;
}[];
/** A set of key/value pairs used to store additional information about the object. */
metadata?: Record<string, string>;
}
export { AzureKeyCredential }
/** The details used to cancel a run. */
export declare interface CancelRunOptions extends OperationOptions {
}
/** A representation of an image output emitted by a code interpreter tool in response to a tool call by the model. */
export declare interface CodeInterpreterImageOutput {
/** The object type, which is always 'image'. */
type: "image";
/** Referential information for the image associated with this output. */
image: CodeInterpreterImageReference;
}
/** An image reference emitted by a code interpreter tool in response to a tool call by the model. */
export declare interface CodeInterpreterImageReference {
/** The ID of the file associated with this image. */
fileId: string;
}
/** A representation of a log output emitted by a code interpreter tool in response to a tool call by the model. */
export declare interface CodeInterpreterLogOutput {
/** The object type, which is always 'logs'. */
type: "logs";
/** The serialized log output emitted by the code interpreter. */
logs: string;
}
/**
* A record of a call to a code interpreter tool, issued by the model in evaluation of a defined tool, that
* represents inputs and outputs consumed and emitted by the code interpreter.
*/
export declare interface CodeInterpreterToolCall {
/** The object type, which is always 'code_interpreter'. */
type: "code_interpreter";
/** The ID of the tool call. This ID must be referenced when you submit tool outputs. */
id: string;
/** The details of the tool call to the code interpreter tool. */
codeInterpreter: CodeInterpreterToolCallDetails;
}
/** The detailed information about a code interpreter invocation by the model. */
export declare interface CodeInterpreterToolCallDetails {
/** The input provided by the model to the code interpreter tool. */
input: string;
/** The outputs produced by the code interpreter tool back to the model in response to the tool call. */
outputs: CodeInterpreterToolCallOutput[];
}
/** Alias for CodeInterpreterToolCallOutput */
export declare type CodeInterpreterToolCallOutput = CodeInterpreterLogOutput | CodeInterpreterImageOutput;
/** The input definition information for a code interpreter tool as used to configure an assistant. */
export declare interface CodeInterpreterToolDefinition {
/** The object type, which is always 'code_interpreter'. */
type: "code_interpreter";
}
/** The details used when creating and immediately running a new assistant thread. */
export declare interface CreateAndRunThreadOptions {
/** The ID of the assistant for which the thread should be created. */
assistantId: string;
/** The details used to create the new thread. */
thread?: AssistantThreadCreationOptions;
/** The overridden model that the assistant should use to run the thread. */
model?: string;
/** The overridden system instructions the assistant should use to run the thread. */
instructions?: string;
/** The overridden list of enabled tools the assistant should use to run the thread. */
tools?: ToolDefinition[];
/** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */
metadata?: Record<string, string> | null;
}
/** The details used to create an assistant file. */
export declare interface CreateAssistantFileOptions extends OperationOptions {
}
/** The details used to create an assistant. */
export declare interface CreateAssistantOptions extends OperationOptions {
}
/** The details used to create a message. */
export declare interface CreateMessageOptions extends OperationOptions {
/** A list of up to 10 file IDs to associate with the message, as used by tools like 'code_interpreter' or 'retrieval' that can read files. */
fileIds?: string[];
/** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */
metadata?: Record<string, string>;
}
/** The details used when creating a new run of an assistant thread. */
export declare interface CreateRunOptions {
/** The ID of the assistant that should run the thread. */
assistantId: string;
/** The overridden model name that the assistant should use to run the thread. */
model?: string | null;
/** The overridden system instructions that the assistant should use to run the thread. */
instructions?: string | null;
/**
* Additional instructions to append at the end of the instructions for the run. This is useful for modifying the behavior
* on a per-run basis without overriding other instructions.
*/
additionalInstructions?: string | null;
/** The overridden list of enabled tools that the assistant should use to run the thread. */
tools?: ToolDefinition[] | null;
/** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */
metadata?: Record<string, string> | null;
}
/** The details used to create a run request. */
export declare interface CreateRunRequestOptions extends OperationOptions {
}
/** The details used to create and run a thread. */
export declare interface CreateThreadAndRunOptions extends OperationOptions {
}
/** The details used to create a thread. */
export declare interface CreateThreadOptions extends OperationOptions {
}
/** The details used to delete an assistant file. */
export declare interface DeleteAssistantFileOptions extends OperationOptions {
}
/** The details used to delete an assistant. */
export declare interface DeleteAssistantOptions extends OperationOptions {
}
/** The details used to delete files. */
export declare interface DeleteFileOptions extends OperationOptions {
}
/** The details used to delete a thread. */
export declare interface DeleteThreadOptions extends OperationOptions {
}
/** An abstract representation of an OpenAI deletion operation result status. */
export declare interface DeletionStatus {
/** The ID of the resource specified for deletion. */
id: string;
/** A value indicating whether deletion was successful. */
deleted: boolean;
}
/** A status response from a file deletion operation. */
export declare interface FileDeletionStatus extends DeletionStatus {
/** The ID of the deleted file. */
id: string;
}
/** The response data from a file list operation. */
export declare interface FileListResponse {
/** The files returned for the request. */
data: InputFile[];
}
/** The possible values denoting the intended usage of a file. */
/** "fine-tune", "fine-tune-results", "assistants", "assistants_output" */
export declare type FilePurpose = string;
/** The input definition information for a function. */
export declare interface FunctionDefinition {
/** The name of the function to be called. */
name: string;
/** A description of what the function does, used by the model to choose when and how to call the function. */
description: string;
/** The parameters the functions accepts, described as a JSON Schema object. */
parameters: unknown;
}
/**
* A record of a call to a function tool, issued by the model in evaluation of a defined tool, that represents the inputs
* and output consumed and emitted by the specified function.
*/
export declare interface FunctionToolCall {
/** The object type, which is always 'function'. */
type: "function";
/** The ID of the tool call. This ID must be referenced when you submit tool outputs. */
id: string;
/** The detailed information about the function called by the model. */
function: FunctionToolCallDetails;
}
/** The detailed information about the function called by the model. */
export declare interface FunctionToolCallDetails {
/** The name of the function. */
name: string;
/** The arguments that the model requires are provided to the named function. */
arguments: string;
/** The output of the function, only populated for function calls that have already have had their outputs submitted. */
output: string | null;
}
/** The input definition information for a function tool as used to configure an assistant. */
export declare interface FunctionToolDefinition {
/** The object type, which is always 'function'. */
type: "function";
/** The definition of the concrete function that the function tool should call. */
function: FunctionDefinition;
}
/** The details used to get an assistant file. */
export declare interface GetAssistantFileOptions extends OperationOptions {
}
/** The details used to get an assistant. */
export declare interface GetAssistantOptions extends OperationOptions {
}
/** The details used to get files. */
export declare interface GetFileOptions extends OperationOptions {
}
/** The details used to get a message file. */
export declare interface GetMessageFileOptions extends OperationOptions {
}
/** The details used to get a message. */
export declare interface GetMessageOptions extends OperationOptions {
}
/** The details used to get a run. */
export declare interface GetRunOptions extends OperationOptions {
}
/** The details used to get a run step. */
export declare interface GetRunStepOptions extends OperationOptions {
}
/** The details used to get a thread. */
export declare interface GetThreadOptions extends OperationOptions {
}
/** Represents an assistant that can call the model and use tools. */
export declare interface InputFile {
/** The identifier, which can be referenced in API endpoints. */
id: string;
/** The size of the file, in bytes. */
bytes: number;
/** The name of the file. */
filename: string;
/** The Unix timestamp, in seconds, representing when this object was created. */
createdAt: Date;
/** The intended purpose of a file. */
purpose: FilePurpose;
}
/** The details used to list assistant files. */
export declare interface ListAssistantFilesOptions extends OperationOptions {
/** A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. */
limit?: number;
/** Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. */
order?: ListSortOrder;
/** A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. */
after?: string;
/** A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. */
before?: string;
}
/** The details used to list assistants. */
export declare interface ListAssistantsOptions extends OperationOptions {
/** A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. */
limit?: number;
/** Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. */
order?: ListSortOrder;
/** A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. */
after?: string;
/** A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. */
before?: string;
}
/** The details used to list files. */
export declare interface ListFilesOptions extends OperationOptions {
/** A value that, when provided, limits list results to files matching the corresponding purpose. */
purpose?: FilePurpose;
}
/** The details used to list message files. */
export declare interface ListMessageFilesOptions extends OperationOptions {
/** A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. */
limit?: number;
/** Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. */
order?: ListSortOrder;
/** A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. */
after?: string;
/** A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. */
before?: string;
}
/** The details used to list messages. */
export declare interface ListMessagesOptions extends OperationOptions {
/** A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. */
limit?: number;
/** Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. */
order?: ListSortOrder;
/** A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. */
after?: string;
/** A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. */
before?: string;
}
/** The response data for a requested list of items. */
export declare interface ListResponseOf<T> {
/** The requested list of items. */
data: T[];
/** The first ID represented in this list. */
firstId: string;
/** The last ID represented in this list. */
lastId: string;
/** A value indicating whether there are additional values available not captured in this list. */
hasMore: boolean;
}
/** The details used to list runs. */
export declare interface ListRunsOptions extends OperationOptions {
/** A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. */
limit?: number;
/** Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. */
order?: ListSortOrder;
/** A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. */
after?: string;
/** A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. */
before?: string;
}
/** The details used to list run steps. */
export declare interface ListRunStepsOptions extends OperationOptions {
/** A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. */
limit?: number;
/** Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. */
order?: ListSortOrder;
/** A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. */
after?: string;
/** A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. */
before?: string;
}
/** The available sorting options when requesting a list of response objects. */
/** "asc", "desc" */
export declare type ListSortOrder = string;
/** Alias for MessageContent */
export declare type MessageContent = MessageTextContent | MessageImageFileContent;
/** Information about a file attached to an assistant thread message. */
export declare interface MessageFile {
/** The identifier, which can be referenced in API endpoints. */
id: string;
/** The Unix timestamp, in seconds, representing when this object was created. */
createdAt: Date;
/** The ID of the message that this file is attached to. */
messageId: string;
}
/** A representation of image file content in a thread message. */
export declare interface MessageImageFileContent {
/** The object type, which is always 'image_file'. */
type: "image_file";
/** The image file for this thread message content item. */
imageFile: MessageImageFileDetails;
}
/** An image reference, as represented in thread message content. */
export declare interface MessageImageFileDetails {
/** The ID for the file associated with this image. */
fileId: string;
}
/** The possible values for roles attributed to messages in a thread. */
/** "user", "assistant" */
export declare type MessageRole = string;
/** Alias for MessageTextAnnotation */
export declare type MessageTextAnnotation = MessageTextFileCitationAnnotation | MessageTextFilePathAnnotation;
/** A representation of a textual item of thread message content. */
export declare interface MessageTextContent {
/** The object type, which is always 'text'. */
type: "text";
/** The text and associated annotations for this thread message content item. */
text: MessageTextDetails;
}
/** The text and associated annotations for a single item of assistant thread message content. */
export declare interface MessageTextDetails {
/** The text data. */
value: string;
/** A list of annotations associated with this text. */
annotations: MessageTextAnnotation[];
}
/** A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the 'retrieval' tool to search files. */
export declare interface MessageTextFileCitationAnnotation {
/** The object type, which is always 'file_citation'. */
type: "file_citation";
/** The textual content associated with this text annotation item. */
text: string;
/** The first text index associated with this text annotation. */
startIndex: number;
/** The last text index associated with this text annotation. */
endIndex: number;
/**
* A citation within the message that points to a specific quote from a specific file.
* Generated when the assistant uses the "retrieval" tool to search files.
*/
fileCitation: MessageTextFileCitationDetails;
}
/** A representation of a file-based text citation, as used in a file-based annotation of text thread message content. */
export declare interface MessageTextFileCitationDetails {
/** The ID of the file associated with this citation. */
fileId: string;
/** The specific quote cited in the associated file. */
quote: string;
}
/** A citation within the message that points to a file located at a specific path. */
export declare interface MessageTextFilePathAnnotation {
/** The object type, which is always 'file_path'. */
type: "file_path";
/** The textual content associated with this text annotation item. */
text: string;
/** The first text index associated with this text annotation. */
startIndex: number;
/** The last text index associated with this text annotation. */
endIndex: number;
/** A URL for the file that's generated when the assistant used the code_interpreter tool to generate a file. */
filePath: MessageTextFilePathDetails;
}
/** An encapsulation of an image file ID, as used by message image content. */
export declare interface MessageTextFilePathDetails {
/** The ID of the specific file that the citation is from. */
fileId: string;
}
/**
* The OpenAIKeyCredential class represents an OpenAI API key
* and is used to authenticate into an Assistants client for
* an OpenAI endpoint.
*/
export declare class OpenAIKeyCredential implements KeyCredential {
private _key;
/**
* Create an instance of an AzureKeyCredential for use
* with a service client.
*
* @param key - The initial value of the key to use in authentication
*/
constructor(key: string);
/**
* The value of the key to be used in authentication
*/
get key(): string;
/**
* Change the value of the key.
*
* Updates will take effect upon the next request after
* updating the key value.
*
* @param newKey - The new key value to be used
*/
update(newKey: string): void;
}
/** An abstract representation of a required action for an assistant thread run to continue. */
export declare interface RequiredAction {
/** the discriminator possible values: submit_tool_outputs */
type: string;
/** The details describing tools that should be called to submit tool outputs. **/
submitToolOutputs?: SubmitToolOutputsDetails;
}
/** A representation of a requested call to a function tool, needed by the model to continue evaluation of a run. */
export declare interface RequiredFunctionToolCall {
/** The object type of the required tool call. Always 'function' for function tools. */
type: "function";
/** The ID of the tool call. This ID must be referenced when submitting tool outputs. */
id: string;
/** Detailed information about the function to be executed by the tool that includes name and arguments. */
function: FunctionToolCallDetails;
}
/** Alias for RequiredToolCall */
export declare type RequiredToolCall = RequiredFunctionToolCall;
/**
* A record of a call to a retrieval tool, issued by the model in evaluation of a defined tool, that represents
* executed retrieval actions.
*/
export declare interface RetrievalToolCall {
/** The object type, which is always 'retrieval'. */
type: "retrieval";
/** The ID of the tool call. This ID must be referenced when you submit tool outputs. */
id: string;
/** The key/value pairs produced by the retrieval tool. */
retrieval: Record<string, string>;
}
/** The input definition information for a retrieval tool as used to configure an assistant. */
export declare interface RetrievalToolDefinition {
/** The object type, which is always 'retrieval'. */
type: "retrieval";
}
/** The details of an error as encountered by an assistant thread run. */
export declare interface RunError {
/** The status for the error. */
code: string;
/** The human-readable text associated with the error. */
message: string;
}
/** Possible values for the status of an assistant thread run. */
/** "queued", "in_progress", "requires_action", "cancelling", "cancelled", "failed", "completed", "expired" */
export declare type RunStatus = string;
/** Detailed information about a single step of an assistant thread run. */
export declare interface RunStep {
/** The identifier, which can be referenced in API endpoints. */
id: string;
/** The type of run step, which can be either message_creation or tool_calls. */
type: RunStepType;
/** The ID of the assistant associated with the run step. */
assistantId: string;
/** The ID of the thread that was run. */
threadId: string;
/** The ID of the run that this run step is a part of. */
runId: string;
/** The status of this run step. */
status: RunStepStatus;
/** The details for this run step. */
stepDetails: RunStepDetails;
/** If applicable, information about the last error encountered by this run step. */
lastError: RunStepError | null;
/** The Unix timestamp, in seconds, representing when this object was created. */
createdAt: Date;
/** The Unix timestamp, in seconds, representing when this item expired. */
expiredAt: Date | null;
/** The Unix timestamp, in seconds, representing when this completed. */
completedAt: Date | null;
/** The Unix timestamp, in seconds, representing when this was cancelled. */
cancelledAt: Date | null;
/** The Unix timestamp, in seconds, representing when this failed. */
failedAt: Date | null;
/** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */
metadata?: Record<string, string> | null;
}
/** Alias for RunStepDetails */
export declare type RunStepDetails = RunStepMessageCreationDetails | RunStepToolCallDetails;
/** The error information associated with a failed run step. */
export declare interface RunStepError {
/** The error code for this error. */
code: RunStepErrorCode;
/** The human-readable text associated with this error. */
message: string;
}
/** The error information associated with a failed run step. */
export declare interface RunStepError {
/** The error code for this error. */
code: RunStepErrorCode;
/** The human-readable text associated with this error. */
message: string;
}
/** Possible error code values attributable to a failed run step. */
/** "server_error", "rate_limit_exceeded" */
export declare type RunStepErrorCode = string;
/** The detailed information associated with a message creation run step. */
export declare interface RunStepMessageCreationDetails {
/** The object type, which is always 'message_creation'. */
type: "message_creation";
/** Information about the message creation associated with this run step. */
messageCreation: RunStepMessageCreationReference;
}
/** The details of a message created as a part of a run step. */
export declare interface RunStepMessageCreationReference {
/** The ID of the message created by this run step. */
messageId: string;
}
/** Possible values for the status of a run step. */
/** "in_progress", "cancelled", "failed", "completed", "expired" */
export declare type RunStepStatus = string;
/** The detailed information associated with a run step calling tools. */
export declare interface RunStepToolCallDetails {
/** The object type, which is always 'tool_calls'. */
type: "tool_calls";
/** A list of tool call details for this run step. */
toolCalls: ToolCall[];
}
/** The possible types of run steps. */
/** "message_creation", "tool_calls" */
export declare type RunStepType = string;
/** The details describing tools that should be called to submit tool outputs. */
export declare interface SubmitToolOutputsDetails {
/** The list of tool calls that must be resolved for the assistant thread run to continue. */
toolCalls: RequiredToolCall[];
}
/** The details used to submit tool outputs to a run. */
export declare interface SubmitToolOutputsToRunOptions extends OperationOptions {
}
/** The status of a thread deletion operation. */
export declare interface ThreadDeletionStatus extends DeletionStatus {
}
/** A single, existing message within an assistant thread. */
export declare interface ThreadMessage {
/** The identifier, which can be referenced in API endpoints. */
id?: string;
/** The Unix timestamp, in seconds, representing when this object was created. */
createdAt?: Date;
/** The ID of the thread that this message belongs to. */
threadId?: string;
/** The role associated with the assistant thread message. */
role: string;
/** The list of content items associated with the assistant thread message. */
content: MessageContent[];
/** If applicable, the ID of the assistant that authored this message. */
assistantId?: string;
/** If applicable, the ID of the run associated with the authoring of this message. */
runId?: string;
/** The IDs for the files associated with this message. */
fileIds?: string[];
/** A set of key/value pairs used to store additional information about the object. */
metadata: Record<string, string> | null;
}
/** Data representing a single evaluation run of an assistant thread. */
export declare interface ThreadRun {
/** The identifier, which can be referenced in API endpoints. */
id: string;
/** The ID of the thread associated with this run. */
threadId: string;
/** The ID of the assistant associated with the thread this run was performed against. */
assistantId: string;
/** The status of the assistant thread run. */
status: RunStatus;
/** The details of the action required for the assistant thread run to continue. */
requiredAction?: RequiredAction | null;
/** The last error, if any, encountered by this assistant thread run. */
lastError?: RunError | null;
/** The ID of the model to use. */
model: string;
/** The overriden system instructions used for this assistant thread run. */
instructions: string;
/** The overriden enabled tools used for this assistant thread run. */
tools: ToolDefinition[];
/** A list of attached file IDs, ordered by creation date in ascending order. */
fileIds: string[];
/** The Unix timestamp, in seconds, representing when this object was created. */
createdAt: Date;
/** The Unix timestamp, in seconds, representing when this item expires. */
expiresAt: Date | null;
/** The Unix timestamp, in seconds, representing when this item was started. */
startedAt: Date | null;
/** The Unix timestamp, in seconds, representing when this completed. */
completedAt: Date | null;
/** The Unix timestamp, in seconds, representing when this was cancelled. */
cancelledAt: Date | null;
/** The Unix timestamp, in seconds, representing when this failed. */
failedAt: Date | null;
/** A set of key/value pairs used to store additional information about the object. */
metadata?: Record<string, string> | null;
}
/** Alias for ToolCall */
export declare type ToolCall = CodeInterpreterToolCall | RetrievalToolCall | FunctionToolCall;
/** An abstract representation of an input tool definition that an assistant can use. */
export declare type ToolDefinition = CodeInterpreterToolDefinition | RetrievalToolDefinition | FunctionToolDefinition;
/** The data provided during a tool outputs submission to resolve pending tool calls and allow the model to continue. */
export declare interface ToolOutput {
/** The ID of the tool call being resolved, as provided in the tool calls of a required action from a run. */
toolCallId?: string;
/** The output from the tool to be submitted. */
output?: string;
}
/** The request details to use when modifying an existing assistant. */
export declare interface UpdateAssistantOptions {
/** The ID of the model to use. */
model?: string;
/** The modified name for the assistant to use. */
name?: string | null;
/** The modified description for the assistant to use. */
description?: string | null;
/** The modified system instructions for the new assistant to use. */
instructions?: string | null;
/** The modified collection of tools to enable for the assistant. */
tools?: ToolDefinition[];
/** The modified list of previously uploaded fileIDs to attach to the assistant. */
fileIds?: string[];
/** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */
metadata?: Record<string, string> | null;
}
/** The details used to update an assistant. */
export declare interface UpdateAssistantRequestOptions extends OperationOptions {
}
/** The details used to update a message. */
export declare interface UpdateMessageOptions extends OperationOptions {
/** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */
metadata?: Record<string, string>;
}
/** The details used to update a run. */
export declare interface UpdateRunOptions extends OperationOptions {
/** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */
metadata?: Record<string, string>;
}
/** The details used to update a thread. */
export declare interface UpdateThreadOptions extends OperationOptions {
/** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */
metadata?: Record<string, string>;
}
/** The details used to upload files. */
export declare interface UploadFileOptions extends OperationOptions {
/** The 'content-type' header value, always 'multipart/format-data' for this operation. */
contentType?: string;
/** A filename to associate with the uploaded data. */
filename?: string;
}
export { }