Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V3 polling #32385

Draft
wants to merge 3 commits into
base: feature/azure-ai-projects-beta3
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sdk/ai/ai-projects/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"@azure/core-rest-pipeline": "^1.5.0",
"@azure/core-util": "^1.9.0",
"@azure/logger": "^1.1.4",
"@azure/core-lro": "^2.0.0",
"@azure/core-lro": "^3.0.0",
"tslib": "^2.6.2",
"@azure/core-paging": "^1.5.0",
"@azure/core-sse": "^2.1.3",
Expand Down
49 changes: 16 additions & 33 deletions sdk/ai/ai-projects/review/ai-projects.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@

```ts

import type { AbortSignalLike } from '@azure/abort-controller';
import { ClientOptions } from '@azure-rest/core-client';
import type { OperationOptions } from '@azure-rest/core-client';
import type { PollerLike } from '@azure/core-lro';
import type { PollOperationState } from '@azure/core-lro';
import { OperationState } from '@azure/core-lro';
import { PollerLike } from '@azure/core-lro';
import { StreamableMethod } from '@azure-rest/core-client';
import type { TokenCredential } from '@azure/core-auth';

Expand Down Expand Up @@ -115,12 +114,12 @@ export interface AgentsOperations {
createRun: (threadId: string, assistantId: string, options?: CreateRunOptionalParams) => AgentRunResponse;
createThread: (options?: CreateAgentThreadOptionalParams) => Promise<AgentThreadOutput>;
createThreadAndRun: (assistantId: string, options?: CreateAndRunThreadOptionalParams) => AgentRunResponse;
createVectorStore: (options?: CreateVectorStoreOptionalParams) => Promise<VectorStoreOutput>;
createVectorStoreAndPoll: (options?: CreateVectorStoreWithPollingOptionalParams) => PollerLike<PollOperationState<VectorStoreOutput>, VectorStoreOutput>;
createVectorStoreFile: (vectorStoreId: string, options?: CreateVectorStoreFileOptionalParams) => Promise<VectorStoreFileOutput>;
createVectorStoreFileAndPoll: (vectorStoreId: string, options?: CreateVectorStoreFileWithPollingOptionalParams) => PollerLike<PollOperationState<VectorStoreFileOutput>, VectorStoreFileOutput>;
createVectorStoreFileBatch: (vectorStoreId: string, options?: CreateVectorStoreFileBatchOptionalParams) => Promise<VectorStoreFileBatchOutput>;
createVectorStoreFileBatchAndPoll: (vectorStoreId: string, options?: CreateVectorStoreFileBatchWithPollingOptionalParams) => PollerLike<PollOperationState<VectorStoreFileBatchOutput>, VectorStoreFileBatchOutput>;
// Warning: (ae-forgotten-export) The symbol "CreateVectorStoreResponse" needs to be exported by the entry point index.d.ts
createVectorStore: (options?: CreateVectorStoreOptionalParams) => Promise<CreateVectorStoreResponse>;
// Warning: (ae-forgotten-export) The symbol "CreateVectorStoreFileResponse" needs to be exported by the entry point index.d.ts
createVectorStoreFile: (vectorStoreId: string, options?: CreateVectorStoreFileOptionalParams) => Promise<CreateVectorStoreFileResponse>;
// Warning: (ae-forgotten-export) The symbol "CreateVectorStoreFileBatchResponse" needs to be exported by the entry point index.d.ts
createVectorStoreFileBatch: (vectorStoreId: string, options?: CreateVectorStoreFileBatchOptionalParams) => Promise<CreateVectorStoreFileBatchResponse>;
deleteAgent: (assistantId: string, options?: DeleteAgentOptionalParams) => Promise<AgentDeletionStatusOutput>;
deleteFile: (fileId: string, options?: DeleteFileOptionalParams) => Promise<FileDeletionStatusOutput>;
deleteThread: (threadId: string, options?: DeleteAgentThreadOptionalParams) => Promise<ThreadDeletionStatusOutput>;
Expand Down Expand Up @@ -149,8 +148,8 @@ export interface AgentsOperations {
updateMessage: (threadId: string, messageId: string, options?: UpdateMessageOptionalParams) => Promise<ThreadMessageOutput>;
updateRun: (threadId: string, runId: string, options?: UpdateRunOptionalParams) => Promise<ThreadRunOutput>;
updateThread: (threadId: string, options?: UpdateAgentThreadOptionalParams) => Promise<AgentThreadOutput>;
uploadFile: (data: ReadableStream | NodeJS.ReadableStream, purpose: FilePurpose, options?: UploadFileOptionalParams) => Promise<OpenAIFileOutput>;
uploadFileAndPoll: (data: ReadableStream | NodeJS.ReadableStream, purpose: FilePurpose, options?: UploadFileWithPollingOptionalParams) => PollerLike<PollOperationState<OpenAIFileOutput>, OpenAIFileOutput>;
// Warning: (ae-forgotten-export) The symbol "UploadFileResponse" needs to be exported by the entry point index.d.ts
uploadFile: (data: ReadableStream | NodeJS.ReadableStream, purpose: FilePurpose, options?: UploadFileOptionalParams) => Promise<UploadFileResponse>;
}

// @public
Expand Down Expand Up @@ -347,7 +346,7 @@ export interface CreateRunOptions {
}

// @public
export interface CreateVectorStoreFileBatchOptionalParams extends CreateVectorStoreFileBatchOptions, OperationOptions {
export interface CreateVectorStoreFileBatchOptionalParams extends CreateVectorStoreFileBatchOptions, OperationOptions, PollingOptionsParams {
}

// @public
Expand All @@ -358,11 +357,7 @@ export interface CreateVectorStoreFileBatchOptions {
}

// @public
export interface CreateVectorStoreFileBatchWithPollingOptionalParams extends CreateVectorStoreFileBatchOptionalParams, PollingOptionsParams {
}

// @public
export interface CreateVectorStoreFileOptionalParams extends CreateVectorStoreFileOptions, OperationOptions {
export interface CreateVectorStoreFileOptionalParams extends CreateVectorStoreFileOptions, OperationOptions, PollingOptionsParams {
}

// @public
Expand All @@ -373,15 +368,7 @@ export interface CreateVectorStoreFileOptions {
}

// @public
export interface CreateVectorStoreFileWithPollingOptionalParams extends CreateVectorStoreFileOptions, PollingOptionsParams, OperationOptions {
}

// @public
export interface CreateVectorStoreOptionalParams extends VectorStoreOptions, OperationOptions {
}

// @public
export interface CreateVectorStoreWithPollingOptionalParams extends CreateVectorStoreOptionalParams, PollingOptionsParams {
export interface CreateVectorStoreOptionalParams extends VectorStoreOptions, OperationOptions, PollingOptionsParams {
}

// @public
Expand Down Expand Up @@ -1073,8 +1060,8 @@ export interface OpenAIPageableListOfVectorStoreOutput {

// @public
export interface PollingOptions {
abortSignal?: AbortSignalLike;
sleepIntervalInMs?: number;
intervalInMs?: number;
restoreFrom?: string;
}

// @public
Expand Down Expand Up @@ -1742,14 +1729,10 @@ export interface UpdateVectorStoreOptionalParams extends VectorStoreUpdateOption
}

// @public
export interface UploadFileOptionalParams extends OperationOptions {
export interface UploadFileOptionalParams extends OperationOptions, PollingOptionsParams {
fileName?: string;
}

// @public
export interface UploadFileWithPollingOptionalParams extends UploadFileOptionalParams, PollingOptionsParams {
}

// @public
export interface VectorStoreAutoChunkingStrategyRequest extends VectorStoreChunkingStrategyRequestParent {
type: "auto";
Expand Down
71 changes: 42 additions & 29 deletions sdk/ai/ai-projects/src/agents/customModels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
// Licensed under the MIT License.

import type { OperationOptions, RequestParameters } from "@azure-rest/core-client";
import type { AbortSignalLike } from "@azure/abort-controller";
import type { ThreadRunOutput } from "../customization/outputModels.js";
import type { OpenAIFileOutput, ThreadRunOutput, VectorStoreFileBatchOutput, VectorStoreFileOutput, VectorStoreOutput } from "../customization/outputModels.js";
import type { AgentEventMessageStream } from "./streamingModels.js";
import type {
AgentThreadCreationOptions,
Expand All @@ -24,6 +23,7 @@ import type {
CreateVectorStoreFileBatchOptions,
CreateVectorStoreFileOptions,
} from "./vectorStoresModels.js";
import { OperationState, PollerLike } from "@azure/core-lro";

/**
* Optional request parameters support passing headers, abort signal, etc.
Expand Down Expand Up @@ -65,12 +65,12 @@ export interface PollingOptions {
/**
* The interval, in milliseconds, to wait between polling attempts. If not specified, a default interval of 1000ms will be used.
*/
sleepIntervalInMs?: number;
intervalInMs?: number;

/**
* An AbortSignalLike object (as defined by @azure/abort-controller) that can be used to cancel the polling operation.
* A serialized poller state that can be used to resume polling from a previous state.
*/
abortSignal?: AbortSignalLike;
restoreFrom?: string;
}

/**
Expand Down Expand Up @@ -194,14 +194,17 @@ export interface ListMessagesOptionalParams
/**
* Optional parameters creating vector store.
*/
export interface CreateVectorStoreOptionalParams extends VectorStoreOptions, OperationOptions {}
export interface CreateVectorStoreOptionalParams extends VectorStoreOptions, OperationOptions, PollingOptionsParams {}

/**
* Optional parameters for creating vector store with polling.
* Response for creating vector store.
*/
export interface CreateVectorStoreWithPollingOptionalParams
extends CreateVectorStoreOptionalParams,
PollingOptionsParams {}
export type CreateVectorStoreResponse = VectorStoreOutput & {
/**
* Poller to poll the vector store creation operation.
*/
poller: PollerLike<OperationState<VectorStoreOutput>, VectorStoreOutput>;
};

/**
* Optional parameters for listing vector stores.
Expand Down Expand Up @@ -235,7 +238,18 @@ export interface ListVectorStoreFilesOptionalParams extends ListQueryParameters,
*/
export interface CreateVectorStoreFileOptionalParams
extends CreateVectorStoreFileOptions,
OperationOptions {}
OperationOptions,
PollingOptionsParams {}

/**
* Response for creating a vector store file.
*/
export type CreateVectorStoreFileResponse = VectorStoreFileOutput & {
/**
* Poller to poll the vector store file creation operation.
*/
poller: PollerLike<OperationState<VectorStoreFileOutput>, VectorStoreFileOutput>;
};

/**
* Optional parameters for getting a vector store file.
Expand All @@ -247,14 +261,6 @@ export interface GetVectorStoreFileOptionalParams extends OperationOptions {}
*/
export interface DeleteVectorStoreFileOptionalParams extends OperationOptions {}

/**
* Optional parameters for creating a vector store file with polling.
*/
export interface CreateVectorStoreFileWithPollingOptionalParams
extends CreateVectorStoreFileOptions,
PollingOptionsParams,
OperationOptions {}

/**
* Optional parameters for listing vector store file batches.
*/
Expand All @@ -280,14 +286,18 @@ export interface CancelVectorStoreFileBatchOptionalParams extends OperationOptio
*/
export interface CreateVectorStoreFileBatchOptionalParams
extends CreateVectorStoreFileBatchOptions,
OperationOptions {}
OperationOptions,
PollingOptionsParams {}

/**
* Optional parameters for creating a vector store file batch with polling.
* Response for creating a vector store file batch.
*/
export interface CreateVectorStoreFileBatchWithPollingOptionalParams
extends CreateVectorStoreFileBatchOptionalParams,
PollingOptionsParams {}
export type CreateVectorStoreFileBatchResponse = VectorStoreFileBatchOutput & {
/**
* Poller to poll the vector store file batch creation operation.
*/
poller: PollerLike<OperationState<VectorStoreFileBatchOutput>, VectorStoreFileBatchOutput>;
};

/**
* Optional parameters for creating agent.
Expand Down Expand Up @@ -339,14 +349,17 @@ export interface GetFileContentOptionalParams extends OperationOptions {}
/**
* Optional parameters for uploading a file.
*/
export interface UploadFileOptionalParams extends OperationOptions {
export interface UploadFileOptionalParams extends OperationOptions, PollingOptionsParams {
/** The name of the file. */
fileName?: string;
}

/**
* Optional parameters for uploading a file with polling.
* Response for uploading a file.
*/
export interface UploadFileWithPollingOptionalParams
extends UploadFileOptionalParams,
PollingOptionsParams {}
export type UploadFileResponse = OpenAIFileOutput & {
/**
* Poller to poll the file upload operation.
*/
poller: PollerLike<OperationState<OpenAIFileOutput>, OpenAIFileOutput>;
};
Loading
Loading