From ff3d8249092ac6d5d0d47045955151f04366dcf6 Mon Sep 17 00:00:00 2001 From: Glenn Harper Date: Fri, 10 Jul 2026 12:30:30 -0400 Subject: [PATCH 1/6] [ai-projects] regen: emitter output @ 16c414e --- .../ai-projects/generated/aiProjectClient.ts | 4 + .../ai-projects/generated/api/agents/index.ts | 30 + .../generated/api/agents/operations.ts | 1064 +- .../generated/api/agents/options.ts | 121 + .../generated/api/beta/agents/index.ts | 38 - .../generated/api/beta/agents/operations.ts | 1543 +-- .../generated/api/beta/agents/options.ts | 231 +- .../generated/api/beta/datasets/operations.ts | 60 +- .../beta/evaluationTaxonomies/operations.ts | 2 +- .../api/beta/evaluators/operations.ts | 93 +- .../generated/api/beta/insights/operations.ts | 36 +- .../api/beta/memoryStores/operations.ts | 168 +- .../generated/api/beta/models/operations.ts | 4 +- .../generated/api/beta/redTeams/operations.ts | 12 +- .../generated/api/beta/routines/operations.ts | 96 +- .../api/beta/schedules/operations.ts | 12 +- .../generated/api/beta/skills/operations.ts | 132 +- .../generated/api/datasets/operations.ts | 2 +- .../generated/api/deployments/operations.ts | 2 +- .../api/{beta => }/toolboxes/index.ts | 8 +- .../api/{beta => }/toolboxes/operations.ts | 220 +- .../api/{beta => }/toolboxes/options.ts | 10 +- .../generated/classic/agents/index.ts | 254 + .../generated/classic/beta/agents/index.ts | 365 +- .../beta/evaluationTaxonomies/index.ts | 2 +- .../classic/beta/evaluators/index.ts | 9 +- .../generated/classic/beta/index.ts | 7 +- .../generated/classic/beta/models/index.ts | 4 +- .../generated/classic/beta/toolboxes/index.ts | 138 - .../generated/classic/datasets/index.ts | 2 +- .../generated/classic/deployments/index.ts | 2 +- sdk/ai/ai-projects/generated/classic/index.ts | 2 +- .../generated/classic/toolboxes/index.ts | 98 + sdk/ai/ai-projects/generated/index.ts | 220 +- sdk/ai/ai-projects/generated/models/index.ts | 158 +- sdk/ai/ai-projects/generated/models/models.ts | 10056 ++++++++-------- .../generated/restorePollerHelpers.ts | 3 +- .../static-helpers/multipartHelpers.ts | 6 +- sdk/ai/ai-projects/tsp-location.saved.yaml | 13 +- 39 files changed, 7211 insertions(+), 8016 deletions(-) rename sdk/ai/ai-projects/generated/api/{beta => }/toolboxes/index.ts (72%) rename sdk/ai/ai-projects/generated/api/{beta => }/toolboxes/operations.ts (62%) rename sdk/ai/ai-projects/generated/api/{beta => }/toolboxes/options.ts (90%) delete mode 100644 sdk/ai/ai-projects/generated/classic/beta/toolboxes/index.ts create mode 100644 sdk/ai/ai-projects/generated/classic/toolboxes/index.ts diff --git a/sdk/ai/ai-projects/generated/aiProjectClient.ts b/sdk/ai/ai-projects/generated/aiProjectClient.ts index cab35039cdb9..83169bf6583a 100644 --- a/sdk/ai/ai-projects/generated/aiProjectClient.ts +++ b/sdk/ai/ai-projects/generated/aiProjectClient.ts @@ -12,6 +12,7 @@ import { _getEvaluationRulesOperations, } from "./classic/evaluationRules/index.js"; import { IndexesOperations, _getIndexesOperations } from "./classic/indexes/index.js"; +import { ToolboxesOperations, _getToolboxesOperations } from "./classic/toolboxes/index.js"; import { TokenCredential } from "@azure/core-auth"; import { Pipeline } from "@azure/core-rest-pipeline"; @@ -36,6 +37,7 @@ export class AIProjectClient { userAgentOptions: { userAgentPrefix }, }); this.pipeline = this._client.pipeline; + this.toolboxes = _getToolboxesOperations(this._client); this.indexes = _getIndexesOperations(this._client); this.deployments = _getDeploymentsOperations(this._client); this.datasets = _getDatasetsOperations(this._client); @@ -45,6 +47,8 @@ export class AIProjectClient { this.beta = _getBetaOperations(this._client); } + /** The operation groups for toolboxes */ + public readonly toolboxes: ToolboxesOperations; /** The operation groups for indexes */ public readonly indexes: IndexesOperations; /** The operation groups for deployments */ diff --git a/sdk/ai/ai-projects/generated/api/agents/index.ts b/sdk/ai/ai-projects/generated/api/agents/index.ts index 670090232bac..3cca90ed22a2 100644 --- a/sdk/ai/ai-projects/generated/api/agents/index.ts +++ b/sdk/ai/ai-projects/generated/api/agents/index.ts @@ -2,6 +2,21 @@ // Licensed under the MIT License. export { + deleteSessionFile, + listSessionFiles, + downloadSessionFile, + uploadSessionFile, + getSessionLogStream, + listSessions, + stopSession, + deleteSession, + getSession, + createSession, + disable, + enable, + downloadAgentCode, + createVersionFromCode, + patchAgentObject, listVersions, deleteVersion, getVersion, @@ -16,6 +31,21 @@ export { get, } from "./operations.js"; export type { + AgentsDeleteSessionFileOptionalParams, + AgentsListSessionFilesOptionalParams, + AgentsDownloadSessionFileOptionalParams, + AgentsUploadSessionFileOptionalParams, + AgentsGetSessionLogStreamOptionalParams, + AgentsListSessionsOptionalParams, + AgentsStopSessionOptionalParams, + AgentsDeleteSessionOptionalParams, + AgentsGetSessionOptionalParams, + AgentsCreateSessionOptionalParams, + AgentsDisableOptionalParams, + AgentsEnableOptionalParams, + AgentsDownloadAgentCodeOptionalParams, + AgentsCreateVersionFromCodeOptionalParams, + AgentsPatchAgentObjectOptionalParams, AgentsListVersionsOptionalParams, AgentsDeleteVersionOptionalParams, AgentsGetVersionOptionalParams, diff --git a/sdk/ai/ai-projects/generated/api/agents/operations.ts b/sdk/ai/ai-projects/generated/api/agents/operations.ts index 35e81338cf47..78373bfecdbc 100644 --- a/sdk/ai/ai-projects/generated/api/agents/operations.ts +++ b/sdk/ai/ai-projects/generated/api/agents/operations.ts @@ -21,13 +21,46 @@ import { deleteAgentVersionResponseDeserializer, _AgentsPagedResultAgentVersionObject, _agentsPagedResultAgentVersionObjectDeserializer, + CreateAgentVersionFromCodeContent, + createAgentVersionFromCodeContentSerializer, + versionIndicatorUnionSerializer, + VersionIndicatorUnion, + AgentSessionResource, + agentSessionResourceDeserializer, + _AgentsPagedResultAgentSessionResource, + _agentsPagedResultAgentSessionResourceDeserializer, + SessionLogEvent, + sessionLogEventDeserializer, + SessionFileWriteResponse, + sessionFileWriteResponseDeserializer, + _SessionDirectoryListResponse, + _sessionDirectoryListResponseDeserializer, + SessionDirectoryEntry, + AgentsDownloadSessionFileResponse, + AgentsDownloadAgentCodeResponse, } from "../../models/models.js"; import { PagedAsyncIterableIterator, buildPagedAsyncIterator, } from "../../static-helpers/pagingHelpers.js"; +import { getBinaryStreamResponse } from "../../static-helpers/serialization/get-binary-stream-response.js"; import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; import { + AgentsDeleteSessionFileOptionalParams, + AgentsListSessionFilesOptionalParams, + AgentsDownloadSessionFileOptionalParams, + AgentsUploadSessionFileOptionalParams, + AgentsGetSessionLogStreamOptionalParams, + AgentsListSessionsOptionalParams, + AgentsStopSessionOptionalParams, + AgentsDeleteSessionOptionalParams, + AgentsGetSessionOptionalParams, + AgentsCreateSessionOptionalParams, + AgentsDisableOptionalParams, + AgentsEnableOptionalParams, + AgentsDownloadAgentCodeOptionalParams, + AgentsCreateVersionFromCodeOptionalParams, + AgentsPatchAgentObjectOptionalParams, AgentsListVersionsOptionalParams, AgentsDeleteVersionOptionalParams, AgentsGetVersionOptionalParams, @@ -48,19 +81,893 @@ import { operationOptionsToRequestParameters, } from "@azure-rest/core-client"; +export function _deleteSessionFileSend( + context: Client, + agentName: string, + agentSessionId: string, + path: string, + options: AgentsDeleteSessionFileOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path_1 = expandUrlTemplate( + "/agents/{agent_name}/endpoint/sessions/{agent_session_id}/files{?path,recursive,api%2Dversion}", + { + agent_name: agentName, + agent_session_id: agentSessionId, + path: path, + recursive: options?.recursive, + "api%2Dversion": context.apiVersion ?? "v1", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path_1).delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _deleteSessionFileDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); + } + + throw error; + } + + return; +} + +/** + * Deletes the specified file or directory from the session sandbox. + * When `recursive` is false, deleting a non-empty directory returns 409 Conflict. + */ +export async function deleteSessionFile( + context: Client, + agentName: string, + agentSessionId: string, + path: string, + options: AgentsDeleteSessionFileOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _deleteSessionFileSend(context, agentName, agentSessionId, path, options); + return _deleteSessionFileDeserialize(result); +} + +export function _listSessionFilesSend( + context: Client, + agentName: string, + agentSessionId: string, + options: AgentsListSessionFilesOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/agents/{agent_name}/endpoint/sessions/{agent_session_id}/files{?path,limit,order,after,before,api%2Dversion}", + { + agent_name: agentName, + agent_session_id: agentSessionId, + path: options?.path, + limit: options?.limit, + order: options?.order, + after: options?.after, + before: options?.before, + "api%2Dversion": context.apiVersion ?? "v1", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listSessionFilesDeserialize( + result: PathUncheckedResponse, +): Promise<_SessionDirectoryListResponse> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); + } + + throw error; + } + + return _sessionDirectoryListResponseDeserializer(result.body); +} + +/** + * Returns files and directories at the specified path in the session sandbox. + * The response includes only the immediate children of the target directory and defaults to the session home directory when no path is supplied. + */ +export function listSessionFiles( + context: Client, + agentName: string, + agentSessionId: string, + options: AgentsListSessionFilesOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listSessionFilesSend(context, agentName, agentSessionId, options), + _listSessionFilesDeserialize, + ["200"], + { itemName: "entries", apiVersion: context.apiVersion ?? "v1" }, + ); +} + +export function _downloadSessionFileSend( + context: Client, + agentName: string, + agentSessionId: string, + path: string, + options: AgentsDownloadSessionFileOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path_1 = expandUrlTemplate( + "/agents/{agent_name}/endpoint/sessions/{agent_session_id}/files/content{?path,api%2Dversion}", + { + agent_name: agentName, + agent_session_id: agentSessionId, + path: path, + "api%2Dversion": context.apiVersion ?? "v1", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path_1) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/octet-stream", ...options.requestOptions?.headers }, + }); +} + +export async function _downloadSessionFileDeserialize( + result: PathUncheckedResponse & AgentsDownloadSessionFileResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); + } + + throw error; + } + + return { blobBody: result.blobBody, readableStreamBody: result.readableStreamBody }; +} + +/** + * Downloads the file at the specified sandbox path as a binary stream. + * The path is resolved relative to the session home directory. + */ +export async function downloadSessionFile( + context: Client, + agentName: string, + agentSessionId: string, + path: string, + options: AgentsDownloadSessionFileOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _downloadSessionFileSend(context, agentName, agentSessionId, path, options); + return _downloadSessionFileDeserialize(result); +} + +export function _uploadSessionFileSend( + context: Client, + agentName: string, + agentSessionId: string, + path: string, + content: Uint8Array, + options: AgentsUploadSessionFileOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path_1 = expandUrlTemplate( + "/agents/{agent_name}/endpoint/sessions/{agent_session_id}/files/content{?path,api%2Dversion}", + { + agent_name: agentName, + agent_session_id: agentSessionId, + path: path, + "api%2Dversion": context.apiVersion ?? "v1", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path_1) + .put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/octet-stream", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: content, + }); +} + +export async function _uploadSessionFileDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); + } + + throw error; + } + + return sessionFileWriteResponseDeserializer(result.body); +} + +/** + * Uploads binary file content to the specified path in the session sandbox. + * The service stores the file relative to the session home directory and rejects payloads larger than 50 MB. + */ +export async function uploadSessionFile( + context: Client, + agentName: string, + agentSessionId: string, + path: string, + content: Uint8Array, + options: AgentsUploadSessionFileOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _uploadSessionFileSend( + context, + agentName, + agentSessionId, + path, + content, + options, + ); + return _uploadSessionFileDeserialize(result); +} + +export function _getSessionLogStreamSend( + context: Client, + agentName: string, + agentVersion: string, + sessionId: string, + options: AgentsGetSessionLogStreamOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/agents/{agent_name}/versions/{agent_version}/sessions/{session_id}:logstream{?api%2Dversion}", + { + agent_name: agentName, + agent_version: agentVersion, + session_id: sessionId, + "api%2Dversion": context.apiVersion ?? "v1", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "text/event-stream", ...options.requestOptions?.headers }, + }); +} + +export async function _getSessionLogStreamDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); + } + + throw error; + } + + return sessionLogEventDeserializer(result.body); +} + +/** + * Streams console logs (stdout / stderr) for a specific hosted agent session + * as a Server-Sent Events (SSE) stream. + * + * Each SSE frame contains: + * - `event`: always `"log"` + * - `data`: a plain-text log line (currently JSON-formatted, but the schema + * is not contractual and may include additional keys or change format + * over time — clients should treat it as an opaque string) + * + * Example SSE frames: + * ``` + * event: log + * data: {"timestamp":"2026-03-10T09:33:17.121Z","stream":"stdout","message":"Starting FoundryCBAgent server on port 8088"} + * + * event: log + * data: {"timestamp":"2026-03-10T09:33:17.130Z","stream":"stderr","message":"INFO: Application startup complete."} + * + * event: log + * data: {"timestamp":"2026-03-10T09:34:52.714Z","stream":"status","message":"Successfully connected to container"} + * + * event: log + * data: {"timestamp":"2026-03-10T09:35:52.714Z","stream":"status","message":"No logs since last 60 seconds"} + * ``` + * + * The stream remains open until the client disconnects or the server + * terminates the connection. Clients should handle reconnection as needed. + */ +export async function getSessionLogStream( + context: Client, + agentName: string, + agentVersion: string, + sessionId: string, + options: AgentsGetSessionLogStreamOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSessionLogStreamSend( + context, + agentName, + agentVersion, + sessionId, + options, + ); + return _getSessionLogStreamDeserialize(result); +} + +export function _listSessionsSend( + context: Client, + agentName: string, + options: AgentsListSessionsOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/agents/{agent_name}/endpoint/sessions{?limit,order,after,before,api%2Dversion}", + { + agent_name: agentName, + limit: options?.limit, + order: options?.order, + after: options?.after, + before: options?.before, + "api%2Dversion": context.apiVersion ?? "v1", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listSessionsDeserialize( + result: PathUncheckedResponse, +): Promise<_AgentsPagedResultAgentSessionResource> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); + } + + throw error; + } + + return _agentsPagedResultAgentSessionResourceDeserializer(result.body); +} + +/** Returns a paged collection of sessions associated with the specified agent endpoint. */ +export function listSessions( + context: Client, + agentName: string, + options: AgentsListSessionsOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listSessionsSend(context, agentName, options), + _listSessionsDeserialize, + ["200"], + { itemName: "data", apiVersion: context.apiVersion ?? "v1" }, + ); +} + +export function _stopSessionSend( + context: Client, + agentName: string, + sessionId: string, + options: AgentsStopSessionOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/agents/{agent_name}/endpoint/sessions/{session_id}:stop{?api%2Dversion}", + { + agent_name: agentName, + session_id: sessionId, + "api%2Dversion": context.apiVersion ?? "v1", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _stopSessionDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); + } + + throw error; + } + + return; +} + +/** Terminates the specified hosted agent session and returns 204 No Content when the request succeeds. */ +export async function stopSession( + context: Client, + agentName: string, + sessionId: string, + options: AgentsStopSessionOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _stopSessionSend(context, agentName, sessionId, options); + return _stopSessionDeserialize(result); +} + +export function _deleteSessionSend( + context: Client, + agentName: string, + sessionId: string, + options: AgentsDeleteSessionOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/agents/{agent_name}/endpoint/sessions/{session_id}{?api%2Dversion}", + { + agent_name: agentName, + session_id: sessionId, + "api%2Dversion": context.apiVersion ?? "v1", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _deleteSessionDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); + } + + throw error; + } + + return; +} + +/** + * Deletes a session synchronously. + * Returns 204 No Content when the session is deleted or does not exist. + */ +export async function deleteSession( + context: Client, + agentName: string, + sessionId: string, + options: AgentsDeleteSessionOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _deleteSessionSend(context, agentName, sessionId, options); + return _deleteSessionDeserialize(result); +} + +export function _getSessionSend( + context: Client, + agentName: string, + sessionId: string, + options: AgentsGetSessionOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/agents/{agent_name}/endpoint/sessions/{session_id}{?api%2Dversion}", + { + agent_name: agentName, + session_id: sessionId, + "api%2Dversion": context.apiVersion ?? "v1", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _getSessionDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); + } + + throw error; + } + + return agentSessionResourceDeserializer(result.body); +} + +/** Retrieves the details of a hosted agent session by agent name and session identifier. */ +export async function getSession( + context: Client, + agentName: string, + sessionId: string, + options: AgentsGetSessionOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSessionSend(context, agentName, sessionId, options); + return _getSessionDeserialize(result); +} + +export function _createSessionSend( + context: Client, + agentName: string, + versionIndicator: VersionIndicatorUnion, + options: AgentsCreateSessionOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/agents/{agent_name}/endpoint/sessions{?api%2Dversion}", + { + agent_name: agentName, + "api%2Dversion": context.apiVersion ?? "v1", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: { + agent_session_id: options?.agentSessionId, + version_indicator: versionIndicatorUnionSerializer(versionIndicator), + }, + }); +} + +export async function _createSessionDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); + } + + throw error; + } + + return agentSessionResourceDeserializer(result.body); +} + +/** + * Creates a new session for an agent endpoint. + * The endpoint resolves the backing agent version from `version_indicator` and + * enforces session ownership using the provided user identity for session-mutating operations. + */ +export async function createSession( + context: Client, + agentName: string, + versionIndicator: VersionIndicatorUnion, + options: AgentsCreateSessionOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _createSessionSend(context, agentName, versionIndicator, options); + return _createSessionDeserialize(result); +} + +export function _disableSend( + context: Client, + agentName: string, + options: AgentsDisableOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/agents/{agent_name}:disable{?api%2Dversion}", + { + agent_name: agentName, + "api%2Dversion": context.apiVersion ?? "v1", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _disableDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); + } + + throw error; + } + + return; +} + +/** + * Disables the specified agent, preventing it from accepting new sessions or processing requests. + * Existing active sessions are allowed to drain gracefully but no new sessions can be created. + * This operation is idempotent — disabling an already-disabled agent returns success with no side effects. + */ +export async function disable( + context: Client, + agentName: string, + options: AgentsDisableOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _disableSend(context, agentName, options); + return _disableDeserialize(result); +} + +export function _enableSend( + context: Client, + agentName: string, + options: AgentsEnableOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/agents/{agent_name}:enable{?api%2Dversion}", + { + agent_name: agentName, + "api%2Dversion": context.apiVersion ?? "v1", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _enableDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); + } + + throw error; + } + + return; +} + +/** + * Enables the specified agent, allowing it to accept new sessions and process requests. + * This operation is idempotent — enabling an already-enabled agent returns success with no side effects. + */ +export async function enable( + context: Client, + agentName: string, + options: AgentsEnableOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _enableSend(context, agentName, options); + return _enableDeserialize(result); +} + +export function _downloadAgentCodeSend( + context: Client, + agentName: string, + options: AgentsDownloadAgentCodeOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/agents/{agent_name}/code:download{?agent_version,api%2Dversion}", + { + agent_name: agentName, + agent_version: options?.agentVersion, + "api%2Dversion": context.apiVersion ?? "v1", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/zip", ...options.requestOptions?.headers }, + }); +} + +export async function _downloadAgentCodeDeserialize( + result: PathUncheckedResponse & AgentsDownloadAgentCodeResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); + } + + throw error; + } + + return { blobBody: result.blobBody, readableStreamBody: result.readableStreamBody }; +} + +/** + * Downloads the code zip for a code-based hosted agent. + * Returns the previously-uploaded zip (`application/zip`). + * + * If `agent_version` is supplied, returns that version's code zip; otherwise + * returns the latest version's code zip. + * + * The SHA-256 digest of the returned bytes matches the `content_hash` on the + * resolved version's `code_configuration`. + */ +export async function downloadAgentCode( + context: Client, + agentName: string, + options: AgentsDownloadAgentCodeOptionalParams = { requestOptions: {} }, +): Promise { + const streamableMethod = _downloadAgentCodeSend(context, agentName, options); + const result = await getBinaryStreamResponse(streamableMethod); + return _downloadAgentCodeDeserialize(result); +} + +export function _createVersionFromCodeSend( + context: Client, + agentName: string, + codeZipSha256: string, + content: CreateAgentVersionFromCodeContent, + options: AgentsCreateVersionFromCodeOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/agents/{agent_name}/versions{?api%2Dversion}", + { + agent_name: agentName, + "api%2Dversion": context.apiVersion ?? "v1", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "multipart/form-data", + headers: { + "x-ms-code-zip-sha256": codeZipSha256, + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: createAgentVersionFromCodeContentSerializer(content), + }); +} + +export async function _createVersionFromCodeDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); + } + + throw error; + } + + return agentVersionDeserializer(result.body); +} + +/** + * Creates a new agent version from code. Uploads the code zip and creates a new version + * for an existing agent. The SHA-256 hex digest of the zip is provided in the + * `x-ms-code-zip-sha256` header for integrity and dedup. + * The request body is multipart/form-data with a JSON metadata part and a binary code part (part order is irrelevant). + * Maximum upload size is 250 MB. + */ +export async function createVersionFromCode( + context: Client, + agentName: string, + codeZipSha256: string, + content: CreateAgentVersionFromCodeContent, + options: AgentsCreateVersionFromCodeOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _createVersionFromCodeSend( + context, + agentName, + codeZipSha256, + content, + options, + ); + return _createVersionFromCodeDeserialize(result); +} + +export function _patchAgentObjectSend( + context: Client, + agentName: string, + options: AgentsPatchAgentObjectOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/agents/{agent_name}{?api%2Dversion}", + { + agent_name: agentName, + "api%2Dversion": context.apiVersion ?? "v1", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .patch({ + ...operationOptionsToRequestParameters(options), + contentType: "application/merge-patch+json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: { + agent_endpoint: !options?.agentEndpoint + ? options?.agentEndpoint + : agentEndpointConfigSerializer(options?.agentEndpoint), + agent_card: !options?.agentCard + ? options?.agentCard + : agentCardSerializer(options?.agentCard), + }, + }); +} + +export async function _patchAgentObjectDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); + } + + throw error; + } + + return agentDeserializer(result.body); +} + +/** Applies a merge-patch update to the specified agent endpoint configuration. */ +export async function patchAgentObject( + context: Client, + agentName: string, + options: AgentsPatchAgentObjectOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _patchAgentObjectSend(context, agentName, options); + return _patchAgentObjectDeserialize(result); +} + export function _listVersionsSend( context: Client, agentName: string, options: AgentsListVersionsOptionalParams = { requestOptions: {} }, ): StreamableMethod { const path = expandUrlTemplate( - "/agents/{agent_name}/versions{?limit,order,after,before,api%2Dversion}", + "/agents/{agent_name}/versions{?limit,order,after,before,include_drafts,api%2Dversion}", { agent_name: agentName, limit: options?.limit, order: options?.order, after: options?.after, before: options?.before, + include_drafts: options?.includeDrafts, "api%2Dversion": context.apiVersion ?? "v1", }, { @@ -71,7 +978,13 @@ export function _listVersionsSend( .path(path) .get({ ...operationOptionsToRequestParameters(options), - headers: { accept: "application/json", ...options.requestOptions?.headers }, + headers: { + ...(options?.foundryFeatures !== undefined + ? { "foundry-features": options?.foundryFeatures } + : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, }); } @@ -81,16 +994,10 @@ export async function _listVersionsDeserialize( const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -144,16 +1051,10 @@ export async function _deleteVersionDeserialize( const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -204,16 +1105,10 @@ export async function _getVersionDeserialize(result: PathUncheckedResponse): Pro const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -269,16 +1164,10 @@ export async function _createAgentVersionFromManifestDeserialize( const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -338,6 +1227,7 @@ export function _createVersionSend( blueprint_reference: !options?.blueprintReference ? options?.blueprintReference : agentBlueprintReferenceUnionSerializer(options?.blueprintReference), + draft: options?.draft, }, }); } @@ -348,16 +1238,10 @@ export async function _createVersionDeserialize( const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -407,16 +1291,10 @@ export async function _listDeserialize( const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -467,16 +1345,10 @@ export async function _$deleteDeserialize( const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -540,16 +1412,10 @@ export async function _updateAgentFromManifestDeserialize( const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -615,16 +1481,10 @@ export async function _createAgentFromManifestDeserialize( const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -692,16 +1552,10 @@ export async function _updateAgentDeserialize(result: PathUncheckedResponse): Pr const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -751,12 +1605,14 @@ export function _createAgentSend( }, body: { name: name, + state: options?.state, metadata: options?.metadata, description: options?.description, definition: agentDefinitionUnionSerializer(definition), blueprint_reference: !options?.blueprintReference ? options?.blueprintReference : agentBlueprintReferenceUnionSerializer(options?.blueprintReference), + draft: options?.draft, agent_endpoint: !options?.agentEndpoint ? options?.agentEndpoint : agentEndpointConfigSerializer(options?.agentEndpoint), @@ -771,16 +1627,10 @@ export async function _createAgentDeserialize(result: PathUncheckedResponse): Pr const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -825,16 +1675,10 @@ export async function _getDeserialize(result: PathUncheckedResponse): Promise= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } diff --git a/sdk/ai/ai-projects/generated/api/agents/options.ts b/sdk/ai/ai-projects/generated/api/agents/options.ts index b1de8f6e411e..69fedd74fe3d 100644 --- a/sdk/ai/ai-projects/generated/api/agents/options.ts +++ b/sdk/ai/ai-projects/generated/api/agents/options.ts @@ -2,6 +2,7 @@ // Licensed under the MIT License. import { + AgentState, AgentKind, AgentBlueprintReferenceUnion, AgentEndpointConfig, @@ -11,6 +12,116 @@ import { } from "../../models/models.js"; import { OperationOptions } from "@azure-rest/core-client"; +/** Optional parameters. */ +export interface AgentsDeleteSessionFileOptionalParams extends OperationOptions { + /** Whether to recursively delete directory contents. The service defaults to `false` if a value is not specified by the caller. */ + recursive?: boolean; +} + +/** Optional parameters. */ +export interface AgentsListSessionFilesOptionalParams extends OperationOptions { + /** The directory path to list, relative to the session home directory. Defaults to the home directory if not provided. */ + path?: string; + /** + * 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?: PageOrder; + /** + * 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; +} + +/** Optional parameters. */ +export interface AgentsDownloadSessionFileOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface AgentsUploadSessionFileOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface AgentsGetSessionLogStreamOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface AgentsListSessionsOptionalParams 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?: PageOrder; + /** + * 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; +} + +/** Optional parameters. */ +export interface AgentsStopSessionOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface AgentsDeleteSessionOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface AgentsGetSessionOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface AgentsCreateSessionOptionalParams extends OperationOptions { + /** Optional caller-provided session ID. If specified, it must be unique within the agent endpoint. Auto-generated if omitted. */ + agentSessionId?: string; +} + +/** Optional parameters. */ +export interface AgentsDisableOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface AgentsEnableOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface AgentsDownloadAgentCodeOptionalParams extends OperationOptions { + /** + * The version of the agent whose code zip should be downloaded. + * If omitted, the latest version's code zip is returned. + */ + agentVersion?: string; +} + +/** Optional parameters. */ +export interface AgentsCreateVersionFromCodeOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface AgentsPatchAgentObjectOptionalParams extends OperationOptions { + /** The endpoint configuration for the agent */ + agentEndpoint?: AgentEndpointConfig; + /** Optional agent card for the agent */ + agentCard?: AgentCard; +} + /** Optional parameters. */ export interface AgentsListVersionsOptionalParams extends OperationOptions { /** @@ -35,6 +146,10 @@ export interface AgentsListVersionsOptionalParams extends OperationOptions { * subsequent call can include before=obj_foo in order to fetch the previous page of the list. */ before?: string; + /** A feature flag opt-in required when using preview operations or modifying persisted preview resources. */ + foundryFeatures?: "DraftAgents=V1Preview"; + /** (Preview) Whether to include draft versions in the listing. The service defaults to `false` if a value is not specified by the caller (only non-draft versions are returned). */ + includeDrafts?: boolean; } /** Optional parameters. */ @@ -78,6 +193,8 @@ export interface AgentsCreateVersionOptionalParams extends OperationOptions { description?: string; /** The blueprint reference for the agent. */ blueprintReference?: AgentBlueprintReferenceUnion; + /** (Preview) Whether this agent version is a draft (candidate) rather than a release. The service defaults to `false` if a value is not specified by the caller. Draft versions are recorded but excluded from default 'latest' resolution and are not auto-promoted. */ + draft?: boolean; } /** Optional parameters. */ @@ -167,6 +284,8 @@ export interface AgentsUpdateAgentOptionalParams extends OperationOptions { export interface AgentsCreateAgentOptionalParams extends OperationOptions { /** A feature flag opt-in required when using preview operations or modifying persisted preview resources. */ foundryFeatures?: AgentDefinitionOptInKeys; + /** The initial operational state of the agent. Defaults to 'enabled' if not specified. */ + state?: AgentState; /** * Set of 16 key-value pairs that can be attached to an object. This can be * useful for storing additional information about the object in a structured @@ -180,6 +299,8 @@ export interface AgentsCreateAgentOptionalParams extends OperationOptions { description?: string; /** The blueprint reference for the agent. */ blueprintReference?: AgentBlueprintReferenceUnion; + /** (Preview) Whether this agent version is a draft (candidate) rather than a release. The service defaults to `false` if a value is not specified by the caller. Draft versions are recorded but excluded from default 'latest' resolution and are not auto-promoted. */ + draft?: boolean; /** An optional endpoint configuration. If not specified, a default endpoint configuration will be set for the agent */ agentEndpoint?: AgentEndpointConfig; /** Optional agent card for the agent */ diff --git a/sdk/ai/ai-projects/generated/api/beta/agents/index.ts b/sdk/ai/ai-projects/generated/api/beta/agents/index.ts index 5c4c04b95de8..a2b23e1033f3 100644 --- a/sdk/ai/ai-projects/generated/api/beta/agents/index.ts +++ b/sdk/ai/ai-projects/generated/api/beta/agents/index.ts @@ -2,54 +2,16 @@ // Licensed under the MIT License. export { - promoteCandidate, - getCandidateFile, - getOptimizationCandidateResults, - getOptimizationCandidateConfig, - getOptimizationCandidate, - listOptimizationCandidates, deleteOptimizationJob, cancelOptimizationJob, listOptimizationJobs, getOptimizationJob, createOptimizationJob, - deleteSessionFile, - listSessionFiles, - downloadSessionFile, - uploadSessionFile, - getSessionLogStream, - listSessions, - stopSession, - deleteSession, - getSession, - createSession, - downloadAgentCode, - createVersionFromCode, - patchAgentObject, } from "./operations.js"; export type { - BetaAgentsPromoteCandidateOptionalParams, - BetaAgentsGetCandidateFileOptionalParams, - BetaAgentsGetOptimizationCandidateResultsOptionalParams, - BetaAgentsGetOptimizationCandidateConfigOptionalParams, - BetaAgentsGetOptimizationCandidateOptionalParams, - BetaAgentsListOptimizationCandidatesOptionalParams, BetaAgentsDeleteOptimizationJobOptionalParams, BetaAgentsCancelOptimizationJobOptionalParams, BetaAgentsListOptimizationJobsOptionalParams, BetaAgentsGetOptimizationJobOptionalParams, BetaAgentsCreateOptimizationJobOptionalParams, - BetaAgentsDeleteSessionFileOptionalParams, - BetaAgentsListSessionFilesOptionalParams, - BetaAgentsDownloadSessionFileOptionalParams, - BetaAgentsUploadSessionFileOptionalParams, - BetaAgentsGetSessionLogStreamOptionalParams, - BetaAgentsListSessionsOptionalParams, - BetaAgentsStopSessionOptionalParams, - BetaAgentsDeleteSessionOptionalParams, - BetaAgentsGetSessionOptionalParams, - BetaAgentsCreateSessionOptionalParams, - BetaAgentsDownloadAgentCodeOptionalParams, - BetaAgentsCreateVersionFromCodeOptionalParams, - BetaAgentsPatchAgentObjectOptionalParams, } from "./options.js"; diff --git a/sdk/ai/ai-projects/generated/api/beta/agents/operations.ts b/sdk/ai/ai-projects/generated/api/beta/agents/operations.ts index 03e61663e580..23f385fbf842 100644 --- a/sdk/ai/ai-projects/generated/api/beta/agents/operations.ts +++ b/sdk/ai/ai-projects/generated/api/beta/agents/operations.ts @@ -3,82 +3,25 @@ import { AIProjectContext as Client } from "../../index.js"; import { - Agent, - agentDeserializer, - AgentVersion, - agentVersionDeserializer, - agentEndpointConfigSerializer, - agentCardSerializer, apiErrorResponseDeserializer, - CreateAgentVersionFromCodeContent, - createAgentVersionFromCodeContentSerializer, - versionIndicatorUnionSerializer, - VersionIndicatorUnion, - AgentSessionResource, - agentSessionResourceDeserializer, - _AgentsPagedResultAgentSessionResource, - _agentsPagedResultAgentSessionResourceDeserializer, - SessionLogEvent, - sessionLogEventDeserializer, - SessionFileWriteResponse, - sessionFileWriteResponseDeserializer, - _SessionDirectoryListResponse, - _sessionDirectoryListResponseDeserializer, - SessionDirectoryEntry, - OptimizationJobInputs, - optimizationJobInputsSerializer, OptimizationJob, + optimizationJobSerializer, optimizationJobDeserializer, - OptimizationCandidate, - _AgentsPagedResultOptimizationJob, - _agentsPagedResultOptimizationJobDeserializer, - _AgentsPagedResultOptimizationCandidate, - _agentsPagedResultOptimizationCandidateDeserializer, - CandidateMetadata, - candidateMetadataDeserializer, - CandidateDeployConfig, - candidateDeployConfigDeserializer, - CandidateResults, - candidateResultsDeserializer, - PromoteCandidateRequest, - promoteCandidateRequestSerializer, - PromoteCandidateResponse, - promoteCandidateResponseDeserializer, - BetaAgentsGetCandidateFileResponse, - BetaAgentsDownloadSessionFileResponse, - BetaAgentsDownloadAgentCodeResponse, + _AgentsPagedResultOptimizationJobListItem, + _agentsPagedResultOptimizationJobListItemDeserializer, + OptimizationJobListItem, } from "../../../models/models.js"; import { PagedAsyncIterableIterator, buildPagedAsyncIterator, } from "../../../static-helpers/pagingHelpers.js"; -import { getBinaryStreamResponse } from "../../../static-helpers/serialization/get-binary-stream-response.js"; import { expandUrlTemplate } from "../../../static-helpers/urlTemplate.js"; import { - BetaAgentsPromoteCandidateOptionalParams, - BetaAgentsGetCandidateFileOptionalParams, - BetaAgentsGetOptimizationCandidateResultsOptionalParams, - BetaAgentsGetOptimizationCandidateConfigOptionalParams, - BetaAgentsGetOptimizationCandidateOptionalParams, - BetaAgentsListOptimizationCandidatesOptionalParams, BetaAgentsDeleteOptimizationJobOptionalParams, BetaAgentsCancelOptimizationJobOptionalParams, BetaAgentsListOptimizationJobsOptionalParams, BetaAgentsGetOptimizationJobOptionalParams, BetaAgentsCreateOptimizationJobOptionalParams, - BetaAgentsDeleteSessionFileOptionalParams, - BetaAgentsListSessionFilesOptionalParams, - BetaAgentsDownloadSessionFileOptionalParams, - BetaAgentsUploadSessionFileOptionalParams, - BetaAgentsGetSessionLogStreamOptionalParams, - BetaAgentsListSessionsOptionalParams, - BetaAgentsStopSessionOptionalParams, - BetaAgentsDeleteSessionOptionalParams, - BetaAgentsGetSessionOptionalParams, - BetaAgentsCreateSessionOptionalParams, - BetaAgentsDownloadAgentCodeOptionalParams, - BetaAgentsCreateVersionFromCodeOptionalParams, - BetaAgentsPatchAgentObjectOptionalParams, } from "./options.js"; import { StreamableMethod, @@ -87,422 +30,15 @@ import { operationOptionsToRequestParameters, } from "@azure-rest/core-client"; -export function _promoteCandidateSend( - context: Client, - jobId: string, - candidateId: string, - candidateRequest: PromoteCandidateRequest, - options: BetaAgentsPromoteCandidateOptionalParams = { requestOptions: {} }, -): StreamableMethod { - const path = expandUrlTemplate( - "/agent_optimization_jobs/{jobId}/candidates/{candidateId}:promote{?api%2Dversion}", - { - jobId: jobId, - candidateId: candidateId, - "api%2Dversion": context.apiVersion ?? "v1", - }, - { - allowReserved: options?.requestOptions?.skipUrlEncoding, - }, - ); - return context - .path(path) - .post({ - ...operationOptionsToRequestParameters(options), - contentType: "application/json", - headers: { - ...(options?.foundryFeatures !== undefined - ? { "foundry-features": options?.foundryFeatures } - : {}), - accept: "application/json", - ...options.requestOptions?.headers, - }, - body: promoteCandidateRequestSerializer(candidateRequest), - }); -} - -export async function _promoteCandidateDeserialize( - result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["200"]; - if (!expectedStatuses.includes(result.status)) { - const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } - throw error; - } - - return promoteCandidateResponseDeserializer(result.body); -} - -/** Promotes the specified candidate and records the deployment timestamp and target agent version. */ -export async function promoteCandidate( - context: Client, - jobId: string, - candidateId: string, - candidateRequest: PromoteCandidateRequest, - options: BetaAgentsPromoteCandidateOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _promoteCandidateSend( - context, - jobId, - candidateId, - candidateRequest, - options, - ); - return _promoteCandidateDeserialize(result); -} - -export function _getCandidateFileSend( - context: Client, - jobId: string, - candidateId: string, - path: string, - options: BetaAgentsGetCandidateFileOptionalParams = { requestOptions: {} }, -): StreamableMethod { - const path_1 = expandUrlTemplate( - "/agent_optimization_jobs/{jobId}/candidates/{candidateId}/files{?path,api%2Dversion}", - { - jobId: jobId, - candidateId: candidateId, - path: path, - "api%2Dversion": context.apiVersion ?? "v1", - }, - { - allowReserved: options?.requestOptions?.skipUrlEncoding, - }, - ); - return context - .path(path_1) - .get({ - ...operationOptionsToRequestParameters(options), - headers: { - ...(options?.foundryFeatures !== undefined - ? { "foundry-features": options?.foundryFeatures } - : {}), - accept: "application/octet-stream", - ...options.requestOptions?.headers, - }, - }); -} - -export async function _getCandidateFileDeserialize( - result: PathUncheckedResponse & BetaAgentsGetCandidateFileResponse, -): Promise { - const expectedStatuses = ["200"]; - if (!expectedStatuses.includes(result.status)) { - const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } - throw error; - } - - return { blobBody: result.blobBody, readableStreamBody: result.readableStreamBody }; -} - -/** Streams the specified file from the candidate's blob directory. */ -export async function getCandidateFile( - context: Client, - jobId: string, - candidateId: string, - path: string, - options: BetaAgentsGetCandidateFileOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _getCandidateFileSend(context, jobId, candidateId, path, options); - return _getCandidateFileDeserialize(result); -} - -export function _getOptimizationCandidateResultsSend( - context: Client, - jobId: string, - candidateId: string, - options: BetaAgentsGetOptimizationCandidateResultsOptionalParams = { requestOptions: {} }, -): StreamableMethod { - const path = expandUrlTemplate( - "/agent_optimization_jobs/{jobId}/candidates/{candidateId}/results{?api%2Dversion}", - { - jobId: jobId, - candidateId: candidateId, - "api%2Dversion": context.apiVersion ?? "v1", - }, - { - allowReserved: options?.requestOptions?.skipUrlEncoding, - }, - ); - return context - .path(path) - .get({ - ...operationOptionsToRequestParameters(options), - headers: { - ...(options?.foundryFeatures !== undefined - ? { "foundry-features": options?.foundryFeatures } - : {}), - accept: "application/json", - ...options.requestOptions?.headers, - }, - }); -} - -export async function _getOptimizationCandidateResultsDeserialize( - result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["200"]; - if (!expectedStatuses.includes(result.status)) { - const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } - throw error; - } - - return candidateResultsDeserializer(result.body); -} - -/** Retrieves full per-task evaluation results for the specified candidate. */ -export async function getOptimizationCandidateResults( - context: Client, - jobId: string, - candidateId: string, - options: BetaAgentsGetOptimizationCandidateResultsOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _getOptimizationCandidateResultsSend(context, jobId, candidateId, options); - return _getOptimizationCandidateResultsDeserialize(result); -} - -export function _getOptimizationCandidateConfigSend( - context: Client, - jobId: string, - candidateId: string, - options: BetaAgentsGetOptimizationCandidateConfigOptionalParams = { requestOptions: {} }, -): StreamableMethod { - const path = expandUrlTemplate( - "/agent_optimization_jobs/{jobId}/candidates/{candidateId}/config{?api%2Dversion}", - { - jobId: jobId, - candidateId: candidateId, - "api%2Dversion": context.apiVersion ?? "v1", - }, - { - allowReserved: options?.requestOptions?.skipUrlEncoding, - }, - ); - return context - .path(path) - .get({ - ...operationOptionsToRequestParameters(options), - headers: { - ...(options?.foundryFeatures !== undefined - ? { "foundry-features": options?.foundryFeatures } - : {}), - accept: "application/json", - ...options.requestOptions?.headers, - }, - }); -} - -export async function _getOptimizationCandidateConfigDeserialize( - result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["200"]; - if (!expectedStatuses.includes(result.status)) { - const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } - throw error; - } - - return candidateDeployConfigDeserializer(result.body); -} - -/** - * Retrieves the deploy configuration JSON for the specified candidate. - * Clients can use it to compose `agents.create_version(...)` requests. - */ -export async function getOptimizationCandidateConfig( - context: Client, - jobId: string, - candidateId: string, - options: BetaAgentsGetOptimizationCandidateConfigOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _getOptimizationCandidateConfigSend(context, jobId, candidateId, options); - return _getOptimizationCandidateConfigDeserialize(result); -} - -export function _getOptimizationCandidateSend( - context: Client, - jobId: string, - candidateId: string, - options: BetaAgentsGetOptimizationCandidateOptionalParams = { requestOptions: {} }, -): StreamableMethod { - const path = expandUrlTemplate( - "/agent_optimization_jobs/{jobId}/candidates/{candidateId}{?api%2Dversion}", - { - jobId: jobId, - candidateId: candidateId, - "api%2Dversion": context.apiVersion ?? "v1", - }, - { - allowReserved: options?.requestOptions?.skipUrlEncoding, - }, - ); - return context - .path(path) - .get({ - ...operationOptionsToRequestParameters(options), - headers: { - ...(options?.foundryFeatures !== undefined - ? { "foundry-features": options?.foundryFeatures } - : {}), - accept: "application/json", - ...options.requestOptions?.headers, - }, - }); -} - -export async function _getOptimizationCandidateDeserialize( - result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["200"]; - if (!expectedStatuses.includes(result.status)) { - const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } - throw error; - } - - return candidateMetadataDeserializer(result.body); -} - -/** Retrieves metadata, manifest information, and promotion details for the specified candidate. */ -export async function getOptimizationCandidate( - context: Client, - jobId: string, - candidateId: string, - options: BetaAgentsGetOptimizationCandidateOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _getOptimizationCandidateSend(context, jobId, candidateId, options); - return _getOptimizationCandidateDeserialize(result); -} - -export function _listOptimizationCandidatesSend( - context: Client, - jobId: string, - options: BetaAgentsListOptimizationCandidatesOptionalParams = { requestOptions: {} }, -): StreamableMethod { - const path = expandUrlTemplate( - "/agent_optimization_jobs/{jobId}/candidates{?limit,order,after,before,api%2Dversion}", - { - jobId: jobId, - limit: options?.limit, - order: options?.order, - after: options?.after, - before: options?.before, - "api%2Dversion": context.apiVersion ?? "v1", - }, - { - allowReserved: options?.requestOptions?.skipUrlEncoding, - }, - ); - return context - .path(path) - .get({ - ...operationOptionsToRequestParameters(options), - headers: { - ...(options?.foundryFeatures !== undefined - ? { "foundry-features": options?.foundryFeatures } - : {}), - accept: "application/json", - ...options.requestOptions?.headers, - }, - }); -} - -export async function _listOptimizationCandidatesDeserialize( - result: PathUncheckedResponse, -): Promise<_AgentsPagedResultOptimizationCandidate> { - const expectedStatuses = ["200"]; - if (!expectedStatuses.includes(result.status)) { - const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } - throw error; - } - - return _agentsPagedResultOptimizationCandidateDeserializer(result.body); -} - -/** Returns the candidates produced by the specified optimization job. */ -export function listOptimizationCandidates( - context: Client, - jobId: string, - options: BetaAgentsListOptimizationCandidatesOptionalParams = { requestOptions: {} }, -): PagedAsyncIterableIterator { - return buildPagedAsyncIterator( - context, - () => _listOptimizationCandidatesSend(context, jobId, options), - _listOptimizationCandidatesDeserialize, - ["200"], - { itemName: "data", apiVersion: context.apiVersion ?? "v1" }, - ); -} - export function _deleteOptimizationJobSend( context: Client, jobId: string, options: BetaAgentsDeleteOptimizationJobOptionalParams = { requestOptions: {} }, ): StreamableMethod { const path = expandUrlTemplate( - "/agent_optimization_jobs/{jobId}{?force,api%2Dversion}", + "/agent_optimization_jobs/{jobId}{?api%2Dversion}", { jobId: jobId, - force: options?.force, "api%2Dversion": context.apiVersion ?? "v1", }, { @@ -528,26 +64,17 @@ export async function _deleteOptimizationJobDeserialize( const expectedStatuses = ["204"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } return; } -/** - * Deletes the specified agent optimization job and its candidate artifacts. - * Cancels the job first when it is still in a non-terminal state. - */ +/** Deletes the job and its candidate artifacts, canceling the job first if it is non-terminal. */ export async function deleteOptimizationJob( context: Client, jobId: string, @@ -592,26 +119,17 @@ export async function _cancelOptimizationJobDeserialize( const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } return optimizationJobDeserializer(result.body); } -/** - * Requests cancellation of the specified agent optimization job. - * The operation remains idempotent after the job reaches a terminal state. - */ +/** Requests cancellation of a running or queued job and returns an error if the job is already in a terminal state. */ export async function cancelOptimizationJob( context: Client, jobId: string, @@ -656,31 +174,25 @@ export function _listOptimizationJobsSend( export async function _listOptimizationJobsDeserialize( result: PathUncheckedResponse, -): Promise<_AgentsPagedResultOptimizationJob> { +): Promise<_AgentsPagedResultOptimizationJobListItem> { const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } - return _agentsPagedResultOptimizationJobDeserializer(result.body); + return _agentsPagedResultOptimizationJobListItemDeserializer(result.body); } -/** Returns agent optimization jobs with cursor pagination and optional lifecycle or agent filters. */ +/** Lists optimization jobs with cursor pagination and optional status or agent name filters. */ export function listOptimizationJobs( context: Client, options: BetaAgentsListOptimizationJobsOptionalParams = { requestOptions: {} }, -): PagedAsyncIterableIterator { +): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, () => _listOptimizationJobsSend(context, options), @@ -722,29 +234,20 @@ export function _getOptimizationJobSend( export async function _getOptimizationJobDeserialize( result: PathUncheckedResponse, ): Promise { - const expectedStatuses = ["200", "202"]; + const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } return optimizationJobDeserializer(result.body); } -/** - * Retrieves the specified agent optimization job. - * Returns 202 while the job is in progress and 200 after it reaches a terminal state. - */ +/** Retrieves an optimization job by its identifier. */ export async function getOptimizationJob( context: Client, jobId: string, @@ -756,7 +259,7 @@ export async function getOptimizationJob( export function _createOptimizationJobSend( context: Client, - inputs: OptimizationJobInputs, + job: OptimizationJob, options: BetaAgentsCreateOptimizationJobOptionalParams = { requestOptions: {} }, ): StreamableMethod { const path = expandUrlTemplate( @@ -781,7 +284,7 @@ export function _createOptimizationJobSend( accept: "application/json", ...options.requestOptions?.headers, }, - body: optimizationJobInputsSerializer(inputs), + body: optimizationJobSerializer(job), }); } @@ -791,1002 +294,22 @@ export async function _createOptimizationJobDeserialize( const expectedStatuses = ["201"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } return optimizationJobDeserializer(result.body); } -/** - * Creates an agent optimization job and returns the queued job. - * Honors `Operation-Id` for idempotent retry. - */ +/** Creates an optimization job and returns the queued job. Honors `Operation-Id` for idempotent retry. */ export async function createOptimizationJob( context: Client, - inputs: OptimizationJobInputs, + job: OptimizationJob, options: BetaAgentsCreateOptimizationJobOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _createOptimizationJobSend(context, inputs, options); + const result = await _createOptimizationJobSend(context, job, options); return _createOptimizationJobDeserialize(result); } - -export function _deleteSessionFileSend( - context: Client, - agentName: string, - agentSessionId: string, - path: string, - options: BetaAgentsDeleteSessionFileOptionalParams = { requestOptions: {} }, -): StreamableMethod { - const path_1 = expandUrlTemplate( - "/agents/{agent_name}/endpoint/sessions/{agent_session_id}/files{?path,recursive,api%2Dversion}", - { - agent_name: agentName, - agent_session_id: agentSessionId, - path: path, - recursive: options?.recursive, - "api%2Dversion": context.apiVersion ?? "v1", - }, - { - allowReserved: options?.requestOptions?.skipUrlEncoding, - }, - ); - return context - .path(path_1) - .delete({ - ...operationOptionsToRequestParameters(options), - headers: { - ...(options?.foundryFeatures !== undefined - ? { "foundry-features": options?.foundryFeatures } - : {}), - ...(options?.userIsolationKey !== undefined - ? { "x-ms-user-isolation-key": options?.userIsolationKey } - : {}), - ...options.requestOptions?.headers, - }, - }); -} - -export async function _deleteSessionFileDeserialize(result: PathUncheckedResponse): Promise { - const expectedStatuses = ["204"]; - if (!expectedStatuses.includes(result.status)) { - const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } - throw error; - } - - return; -} - -/** - * Deletes the specified file or directory from the session sandbox. - * When `recursive` is false, deleting a non-empty directory returns 409 Conflict. - */ -export async function deleteSessionFile( - context: Client, - agentName: string, - agentSessionId: string, - path: string, - options: BetaAgentsDeleteSessionFileOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _deleteSessionFileSend(context, agentName, agentSessionId, path, options); - return _deleteSessionFileDeserialize(result); -} - -export function _listSessionFilesSend( - context: Client, - agentName: string, - agentSessionId: string, - options: BetaAgentsListSessionFilesOptionalParams = { requestOptions: {} }, -): StreamableMethod { - const path = expandUrlTemplate( - "/agents/{agent_name}/endpoint/sessions/{agent_session_id}/files{?path,limit,order,after,before,api%2Dversion}", - { - agent_name: agentName, - agent_session_id: agentSessionId, - path: options?.path, - limit: options?.limit, - order: options?.order, - after: options?.after, - before: options?.before, - "api%2Dversion": context.apiVersion ?? "v1", - }, - { - allowReserved: options?.requestOptions?.skipUrlEncoding, - }, - ); - return context - .path(path) - .get({ - ...operationOptionsToRequestParameters(options), - headers: { - ...(options?.foundryFeatures !== undefined - ? { "foundry-features": options?.foundryFeatures } - : {}), - ...(options?.userIsolationKey !== undefined - ? { "x-ms-user-isolation-key": options?.userIsolationKey } - : {}), - accept: "application/json", - ...options.requestOptions?.headers, - }, - }); -} - -export async function _listSessionFilesDeserialize( - result: PathUncheckedResponse, -): Promise<_SessionDirectoryListResponse> { - const expectedStatuses = ["200"]; - if (!expectedStatuses.includes(result.status)) { - const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } - throw error; - } - - return _sessionDirectoryListResponseDeserializer(result.body); -} - -/** - * Returns files and directories at the specified path in the session sandbox. - * The response includes only the immediate children of the target directory and defaults to the session home directory when no path is supplied. - */ -export function listSessionFiles( - context: Client, - agentName: string, - agentSessionId: string, - options: BetaAgentsListSessionFilesOptionalParams = { requestOptions: {} }, -): PagedAsyncIterableIterator { - return buildPagedAsyncIterator( - context, - () => _listSessionFilesSend(context, agentName, agentSessionId, options), - _listSessionFilesDeserialize, - ["200"], - { itemName: "entries", apiVersion: context.apiVersion ?? "v1" }, - ); -} - -export function _downloadSessionFileSend( - context: Client, - agentName: string, - agentSessionId: string, - path: string, - options: BetaAgentsDownloadSessionFileOptionalParams = { requestOptions: {} }, -): StreamableMethod { - const path_1 = expandUrlTemplate( - "/agents/{agent_name}/endpoint/sessions/{agent_session_id}/files/content{?path,api%2Dversion}", - { - agent_name: agentName, - agent_session_id: agentSessionId, - path: path, - "api%2Dversion": context.apiVersion ?? "v1", - }, - { - allowReserved: options?.requestOptions?.skipUrlEncoding, - }, - ); - return context - .path(path_1) - .get({ - ...operationOptionsToRequestParameters(options), - headers: { - ...(options?.foundryFeatures !== undefined - ? { "foundry-features": options?.foundryFeatures } - : {}), - ...(options?.userIsolationKey !== undefined - ? { "x-ms-user-isolation-key": options?.userIsolationKey } - : {}), - accept: "application/octet-stream", - ...options.requestOptions?.headers, - }, - }); -} - -export async function _downloadSessionFileDeserialize( - result: PathUncheckedResponse & BetaAgentsDownloadSessionFileResponse, -): Promise { - const expectedStatuses = ["200"]; - if (!expectedStatuses.includes(result.status)) { - const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } - throw error; - } - - return { blobBody: result.blobBody, readableStreamBody: result.readableStreamBody }; -} - -/** - * Downloads the file at the specified sandbox path as a binary stream. - * The path is resolved relative to the session home directory. - */ -export async function downloadSessionFile( - context: Client, - agentName: string, - agentSessionId: string, - path: string, - options: BetaAgentsDownloadSessionFileOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _downloadSessionFileSend(context, agentName, agentSessionId, path, options); - return _downloadSessionFileDeserialize(result); -} - -export function _uploadSessionFileSend( - context: Client, - agentName: string, - agentSessionId: string, - path: string, - content: Uint8Array, - options: BetaAgentsUploadSessionFileOptionalParams = { requestOptions: {} }, -): StreamableMethod { - const path_1 = expandUrlTemplate( - "/agents/{agent_name}/endpoint/sessions/{agent_session_id}/files/content{?path,api%2Dversion}", - { - agent_name: agentName, - agent_session_id: agentSessionId, - path: path, - "api%2Dversion": context.apiVersion ?? "v1", - }, - { - allowReserved: options?.requestOptions?.skipUrlEncoding, - }, - ); - return context - .path(path_1) - .put({ - ...operationOptionsToRequestParameters(options), - contentType: "application/octet-stream", - headers: { - ...(options?.foundryFeatures !== undefined - ? { "foundry-features": options?.foundryFeatures } - : {}), - ...(options?.userIsolationKey !== undefined - ? { "x-ms-user-isolation-key": options?.userIsolationKey } - : {}), - accept: "application/json", - ...options.requestOptions?.headers, - }, - body: content, - }); -} - -export async function _uploadSessionFileDeserialize( - result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["201"]; - if (!expectedStatuses.includes(result.status)) { - const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } - throw error; - } - - return sessionFileWriteResponseDeserializer(result.body); -} - -/** - * Uploads binary file content to the specified path in the session sandbox. - * The service stores the file relative to the session home directory and rejects payloads larger than 50 MB. - */ -export async function uploadSessionFile( - context: Client, - agentName: string, - agentSessionId: string, - path: string, - content: Uint8Array, - options: BetaAgentsUploadSessionFileOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _uploadSessionFileSend( - context, - agentName, - agentSessionId, - path, - content, - options, - ); - return _uploadSessionFileDeserialize(result); -} - -export function _getSessionLogStreamSend( - context: Client, - agentName: string, - agentVersion: string, - sessionId: string, - options: BetaAgentsGetSessionLogStreamOptionalParams = { requestOptions: {} }, -): StreamableMethod { - const path = expandUrlTemplate( - "/agents/{agent_name}/versions/{agent_version}/sessions/{session_id}:logstream{?api%2Dversion}", - { - agent_name: agentName, - agent_version: agentVersion, - session_id: sessionId, - "api%2Dversion": context.apiVersion ?? "v1", - }, - { - allowReserved: options?.requestOptions?.skipUrlEncoding, - }, - ); - return context - .path(path) - .get({ - ...operationOptionsToRequestParameters(options), - headers: { - ...(options?.foundryFeatures !== undefined - ? { "foundry-features": options?.foundryFeatures } - : {}), - accept: "text/event-stream", - ...options.requestOptions?.headers, - }, - }); -} - -export async function _getSessionLogStreamDeserialize( - result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["200"]; - if (!expectedStatuses.includes(result.status)) { - const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } - throw error; - } - - return sessionLogEventDeserializer(result.body); -} - -/** - * Streams console logs (stdout / stderr) for a specific hosted agent session - * as a Server-Sent Events (SSE) stream. - * - * Each SSE frame contains: - * - `event`: always `"log"` - * - `data`: a plain-text log line (currently JSON-formatted, but the schema - * is not contractual and may include additional keys or change format - * over time — clients should treat it as an opaque string) - * - * Example SSE frames: - * ``` - * event: log - * data: {"timestamp":"2026-03-10T09:33:17.121Z","stream":"stdout","message":"Starting FoundryCBAgent server on port 8088"} - * - * event: log - * data: {"timestamp":"2026-03-10T09:33:17.130Z","stream":"stderr","message":"INFO: Application startup complete."} - * - * event: log - * data: {"timestamp":"2026-03-10T09:34:52.714Z","stream":"status","message":"Successfully connected to container"} - * - * event: log - * data: {"timestamp":"2026-03-10T09:35:52.714Z","stream":"status","message":"No logs since last 60 seconds"} - * ``` - * - * The stream remains open until the client disconnects or the server - * terminates the connection. Clients should handle reconnection as needed. - */ -export async function getSessionLogStream( - context: Client, - agentName: string, - agentVersion: string, - sessionId: string, - options: BetaAgentsGetSessionLogStreamOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _getSessionLogStreamSend( - context, - agentName, - agentVersion, - sessionId, - options, - ); - return _getSessionLogStreamDeserialize(result); -} - -export function _listSessionsSend( - context: Client, - agentName: string, - options: BetaAgentsListSessionsOptionalParams = { requestOptions: {} }, -): StreamableMethod { - const path = expandUrlTemplate( - "/agents/{agent_name}/endpoint/sessions{?limit,order,after,before,api%2Dversion}", - { - agent_name: agentName, - limit: options?.limit, - order: options?.order, - after: options?.after, - before: options?.before, - "api%2Dversion": context.apiVersion ?? "v1", - }, - { - allowReserved: options?.requestOptions?.skipUrlEncoding, - }, - ); - return context - .path(path) - .get({ - ...operationOptionsToRequestParameters(options), - headers: { - ...(options?.foundryFeatures !== undefined - ? { "foundry-features": options?.foundryFeatures } - : {}), - ...(options?.userIsolationKey !== undefined - ? { "x-ms-user-isolation-key": options?.userIsolationKey } - : {}), - accept: "application/json", - ...options.requestOptions?.headers, - }, - }); -} - -export async function _listSessionsDeserialize( - result: PathUncheckedResponse, -): Promise<_AgentsPagedResultAgentSessionResource> { - const expectedStatuses = ["200"]; - if (!expectedStatuses.includes(result.status)) { - const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } - throw error; - } - - return _agentsPagedResultAgentSessionResourceDeserializer(result.body); -} - -/** Returns a paged collection of sessions associated with the specified agent endpoint. */ -export function listSessions( - context: Client, - agentName: string, - options: BetaAgentsListSessionsOptionalParams = { requestOptions: {} }, -): PagedAsyncIterableIterator { - return buildPagedAsyncIterator( - context, - () => _listSessionsSend(context, agentName, options), - _listSessionsDeserialize, - ["200"], - { itemName: "data", apiVersion: context.apiVersion ?? "v1" }, - ); -} - -export function _stopSessionSend( - context: Client, - agentName: string, - sessionId: string, - options: BetaAgentsStopSessionOptionalParams = { requestOptions: {} }, -): StreamableMethod { - const path = expandUrlTemplate( - "/agents/{agent_name}/endpoint/sessions/{session_id}:stop{?api%2Dversion}", - { - agent_name: agentName, - session_id: sessionId, - "api%2Dversion": context.apiVersion ?? "v1", - }, - { - allowReserved: options?.requestOptions?.skipUrlEncoding, - }, - ); - return context - .path(path) - .post({ - ...operationOptionsToRequestParameters(options), - headers: { - ...(options?.foundryFeatures !== undefined - ? { "foundry-features": options?.foundryFeatures } - : {}), - ...options.requestOptions?.headers, - }, - }); -} - -export async function _stopSessionDeserialize(result: PathUncheckedResponse): Promise { - const expectedStatuses = ["204"]; - if (!expectedStatuses.includes(result.status)) { - const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } - throw error; - } - - return; -} - -/** Terminates the specified hosted agent session and returns 204 No Content when the request succeeds. */ -export async function stopSession( - context: Client, - agentName: string, - sessionId: string, - options: BetaAgentsStopSessionOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _stopSessionSend(context, agentName, sessionId, options); - return _stopSessionDeserialize(result); -} - -export function _deleteSessionSend( - context: Client, - agentName: string, - sessionId: string, - options: BetaAgentsDeleteSessionOptionalParams = { requestOptions: {} }, -): StreamableMethod { - const path = expandUrlTemplate( - "/agents/{agent_name}/endpoint/sessions/{session_id}{?api%2Dversion}", - { - agent_name: agentName, - session_id: sessionId, - "api%2Dversion": context.apiVersion ?? "v1", - }, - { - allowReserved: options?.requestOptions?.skipUrlEncoding, - }, - ); - return context - .path(path) - .delete({ - ...operationOptionsToRequestParameters(options), - headers: { - ...(options?.foundryFeatures !== undefined - ? { "foundry-features": options?.foundryFeatures } - : {}), - ...(options?.userIsolationKey !== undefined - ? { "x-ms-user-isolation-key": options?.userIsolationKey } - : {}), - ...options.requestOptions?.headers, - }, - }); -} - -export async function _deleteSessionDeserialize(result: PathUncheckedResponse): Promise { - const expectedStatuses = ["204"]; - if (!expectedStatuses.includes(result.status)) { - const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } - throw error; - } - - return; -} - -/** - * Deletes a session synchronously. - * Returns 204 No Content when the session is deleted or does not exist. - */ -export async function deleteSession( - context: Client, - agentName: string, - sessionId: string, - options: BetaAgentsDeleteSessionOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _deleteSessionSend(context, agentName, sessionId, options); - return _deleteSessionDeserialize(result); -} - -export function _getSessionSend( - context: Client, - agentName: string, - sessionId: string, - options: BetaAgentsGetSessionOptionalParams = { requestOptions: {} }, -): StreamableMethod { - const path = expandUrlTemplate( - "/agents/{agent_name}/endpoint/sessions/{session_id}{?api%2Dversion}", - { - agent_name: agentName, - session_id: sessionId, - "api%2Dversion": context.apiVersion ?? "v1", - }, - { - allowReserved: options?.requestOptions?.skipUrlEncoding, - }, - ); - return context - .path(path) - .get({ - ...operationOptionsToRequestParameters(options), - headers: { - ...(options?.foundryFeatures !== undefined - ? { "foundry-features": options?.foundryFeatures } - : {}), - ...(options?.userIsolationKey !== undefined - ? { "x-ms-user-isolation-key": options?.userIsolationKey } - : {}), - accept: "application/json", - ...options.requestOptions?.headers, - }, - }); -} - -export async function _getSessionDeserialize( - result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["200"]; - if (!expectedStatuses.includes(result.status)) { - const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } - throw error; - } - - return agentSessionResourceDeserializer(result.body); -} - -/** Retrieves the details of a hosted agent session by agent name and session identifier. */ -export async function getSession( - context: Client, - agentName: string, - sessionId: string, - options: BetaAgentsGetSessionOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _getSessionSend(context, agentName, sessionId, options); - return _getSessionDeserialize(result); -} - -export function _createSessionSend( - context: Client, - agentName: string, - versionIndicator: VersionIndicatorUnion, - options: BetaAgentsCreateSessionOptionalParams = { requestOptions: {} }, -): StreamableMethod { - const path = expandUrlTemplate( - "/agents/{agent_name}/endpoint/sessions{?api%2Dversion}", - { - agent_name: agentName, - "api%2Dversion": context.apiVersion ?? "v1", - }, - { - allowReserved: options?.requestOptions?.skipUrlEncoding, - }, - ); - return context - .path(path) - .post({ - ...operationOptionsToRequestParameters(options), - contentType: "application/json", - headers: { - ...(options?.foundryFeatures !== undefined - ? { "foundry-features": options?.foundryFeatures } - : {}), - ...(options?.userIsolationKey !== undefined - ? { "x-ms-user-isolation-key": options?.userIsolationKey } - : {}), - accept: "application/json", - ...options.requestOptions?.headers, - }, - body: { - agent_session_id: options?.agentSessionId, - version_indicator: versionIndicatorUnionSerializer(versionIndicator), - }, - }); -} - -export async function _createSessionDeserialize( - result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["201"]; - if (!expectedStatuses.includes(result.status)) { - const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } - throw error; - } - - return agentSessionResourceDeserializer(result.body); -} - -/** - * Creates a new session for an agent endpoint. - * The endpoint resolves the backing agent version from `version_indicator` and - * enforces session ownership using the provided isolation key for session-mutating operations. - */ -export async function createSession( - context: Client, - agentName: string, - versionIndicator: VersionIndicatorUnion, - options: BetaAgentsCreateSessionOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _createSessionSend(context, agentName, versionIndicator, options); - return _createSessionDeserialize(result); -} - -export function _downloadAgentCodeSend( - context: Client, - agentName: string, - options: BetaAgentsDownloadAgentCodeOptionalParams = { requestOptions: {} }, -): StreamableMethod { - const path = expandUrlTemplate( - "/agents/{agent_name}/code:download{?agent_version,api%2Dversion}", - { - agent_name: agentName, - agent_version: options?.agentVersion, - "api%2Dversion": context.apiVersion ?? "v1", - }, - { - allowReserved: options?.requestOptions?.skipUrlEncoding, - }, - ); - return context - .path(path) - .get({ - ...operationOptionsToRequestParameters(options), - headers: { - ...(options?.foundryFeatures !== undefined - ? { "foundry-features": options?.foundryFeatures } - : {}), - accept: "application/zip", - ...options.requestOptions?.headers, - }, - }); -} - -export async function _downloadAgentCodeDeserialize( - result: PathUncheckedResponse & BetaAgentsDownloadAgentCodeResponse, -): Promise { - const expectedStatuses = ["200"]; - if (!expectedStatuses.includes(result.status)) { - const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } - throw error; - } - - return { blobBody: result.blobBody, readableStreamBody: result.readableStreamBody }; -} - -/** - * Downloads the code zip for a code-based hosted agent. - * Returns the previously-uploaded zip (`application/zip`). - * - * If `agent_version` is supplied, returns that version's code zip; otherwise - * returns the latest version's code zip. - * - * The SHA-256 digest of the returned bytes matches the `content_hash` on the - * resolved version's `code_configuration`. - */ -export async function downloadAgentCode( - context: Client, - agentName: string, - options: BetaAgentsDownloadAgentCodeOptionalParams = { requestOptions: {} }, -): Promise { - const streamableMethod = _downloadAgentCodeSend(context, agentName, options); - const result = await getBinaryStreamResponse(streamableMethod); - return _downloadAgentCodeDeserialize(result); -} - -export function _createVersionFromCodeSend( - context: Client, - agentName: string, - codeZipSha256: string, - content: CreateAgentVersionFromCodeContent, - options: BetaAgentsCreateVersionFromCodeOptionalParams = { requestOptions: {} }, -): StreamableMethod { - const path = expandUrlTemplate( - "/agents/{agent_name}/versions{?api%2Dversion}", - { - agent_name: agentName, - "api%2Dversion": context.apiVersion ?? "v1", - }, - { - allowReserved: options?.requestOptions?.skipUrlEncoding, - }, - ); - return context - .path(path) - .post({ - ...operationOptionsToRequestParameters(options), - contentType: "multipart/form-data", - headers: { - ...(options?.foundryFeatures !== undefined - ? { "foundry-features": options?.foundryFeatures } - : {}), - "x-ms-code-zip-sha256": codeZipSha256, - accept: "application/json", - ...options.requestOptions?.headers, - }, - body: createAgentVersionFromCodeContentSerializer(content), - }); -} - -export async function _createVersionFromCodeDeserialize( - result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["200"]; - if (!expectedStatuses.includes(result.status)) { - const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } - throw error; - } - - return agentVersionDeserializer(result.body); -} - -/** - * Creates a new agent version from code. Uploads the code zip and creates a new version - * for an existing agent. The SHA-256 hex digest of the zip is provided in the - * `x-ms-code-zip-sha256` header for integrity and dedup. - * The request body is multipart/form-data with a JSON metadata part and a binary code part (part order is irrelevant). - * Maximum upload size is 250 MB. - */ -export async function createVersionFromCode( - context: Client, - agentName: string, - codeZipSha256: string, - content: CreateAgentVersionFromCodeContent, - options: BetaAgentsCreateVersionFromCodeOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _createVersionFromCodeSend( - context, - agentName, - codeZipSha256, - content, - options, - ); - return _createVersionFromCodeDeserialize(result); -} - -export function _patchAgentObjectSend( - context: Client, - agentName: string, - options: BetaAgentsPatchAgentObjectOptionalParams = { requestOptions: {} }, -): StreamableMethod { - const path = expandUrlTemplate( - "/agents/{agent_name}{?api%2Dversion}", - { - agent_name: agentName, - "api%2Dversion": context.apiVersion ?? "v1", - }, - { - allowReserved: options?.requestOptions?.skipUrlEncoding, - }, - ); - return context - .path(path) - .patch({ - ...operationOptionsToRequestParameters(options), - contentType: "application/merge-patch+json", - headers: { - ...(options?.foundryFeatures !== undefined - ? { "foundry-features": options?.foundryFeatures } - : {}), - accept: "application/json", - ...options.requestOptions?.headers, - }, - body: { - agent_endpoint: !options?.agentEndpoint - ? options?.agentEndpoint - : agentEndpointConfigSerializer(options?.agentEndpoint), - agent_card: !options?.agentCard - ? options?.agentCard - : agentCardSerializer(options?.agentCard), - }, - }); -} - -export async function _patchAgentObjectDeserialize(result: PathUncheckedResponse): Promise { - const expectedStatuses = ["200"]; - if (!expectedStatuses.includes(result.status)) { - const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } - throw error; - } - - return agentDeserializer(result.body); -} - -/** Applies a merge-patch update to the specified agent endpoint configuration. */ -export async function patchAgentObject( - context: Client, - agentName: string, - options: BetaAgentsPatchAgentObjectOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _patchAgentObjectSend(context, agentName, options); - return _patchAgentObjectDeserialize(result); -} diff --git a/sdk/ai/ai-projects/generated/api/beta/agents/options.ts b/sdk/ai/ai-projects/generated/api/beta/agents/options.ts index 5441e9ae4c75..17762ae759ad 100644 --- a/sdk/ai/ai-projects/generated/api/beta/agents/options.ts +++ b/sdk/ai/ai-projects/generated/api/beta/agents/options.ts @@ -1,91 +1,25 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { - AgentEndpointConfig, - AgentCard, - JobStatus, - AgentDefinitionOptInKeys, - PageOrder, -} from "../../../models/models.js"; +import { JobStatus, PageOrder } from "../../../models/models.js"; import { OperationOptions } from "@azure-rest/core-client"; -/** Optional parameters. */ -export interface BetaAgentsPromoteCandidateOptionalParams extends OperationOptions { - /** A feature flag opt-in required when using preview operations or modifying persisted preview resources. */ - foundryFeatures?: "AgentsOptimization=V1Preview"; -} - -/** Optional parameters. */ -export interface BetaAgentsGetCandidateFileOptionalParams extends OperationOptions { - /** A feature flag opt-in required when using preview operations or modifying persisted preview resources. */ - foundryFeatures?: "AgentsOptimization=V1Preview"; -} - -/** Optional parameters. */ -export interface BetaAgentsGetOptimizationCandidateResultsOptionalParams extends OperationOptions { - /** A feature flag opt-in required when using preview operations or modifying persisted preview resources. */ - foundryFeatures?: "AgentsOptimization=V1Preview"; -} - -/** Optional parameters. */ -export interface BetaAgentsGetOptimizationCandidateConfigOptionalParams extends OperationOptions { - /** A feature flag opt-in required when using preview operations or modifying persisted preview resources. */ - foundryFeatures?: "AgentsOptimization=V1Preview"; -} - -/** Optional parameters. */ -export interface BetaAgentsGetOptimizationCandidateOptionalParams extends OperationOptions { - /** A feature flag opt-in required when using preview operations or modifying persisted preview resources. */ - foundryFeatures?: "AgentsOptimization=V1Preview"; -} - -/** Optional parameters. */ -export interface BetaAgentsListOptimizationCandidatesOptionalParams extends OperationOptions { - /** A feature flag opt-in required when using preview operations or modifying persisted preview resources. */ - foundryFeatures?: "AgentsOptimization=V1Preview"; - /** - * 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?: PageOrder; - /** - * 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; -} - /** Optional parameters. */ export interface BetaAgentsDeleteOptimizationJobOptionalParams extends OperationOptions { /** A feature flag opt-in required when using preview operations or modifying persisted preview resources. */ - foundryFeatures?: "AgentsOptimization=V1Preview"; - /** When true, force-delete even if the job is in a non-terminal state. */ - force?: boolean; + foundryFeatures?: "AgentsOptimization=V2Preview"; } /** Optional parameters. */ export interface BetaAgentsCancelOptimizationJobOptionalParams extends OperationOptions { /** A feature flag opt-in required when using preview operations or modifying persisted preview resources. */ - foundryFeatures?: "AgentsOptimization=V1Preview"; + foundryFeatures?: "AgentsOptimization=V2Preview"; } /** Optional parameters. */ export interface BetaAgentsListOptimizationJobsOptionalParams extends OperationOptions { /** A feature flag opt-in required when using preview operations or modifying persisted preview resources. */ - foundryFeatures?: "AgentsOptimization=V1Preview"; + foundryFeatures?: "AgentsOptimization=V2Preview"; /** * A limit on the number of objects to be returned. Limit can range between 1 and 100, and the * default is 20. @@ -117,166 +51,13 @@ export interface BetaAgentsListOptimizationJobsOptionalParams extends OperationO /** Optional parameters. */ export interface BetaAgentsGetOptimizationJobOptionalParams extends OperationOptions { /** A feature flag opt-in required when using preview operations or modifying persisted preview resources. */ - foundryFeatures?: "AgentsOptimization=V1Preview"; + foundryFeatures?: "AgentsOptimization=V2Preview"; } /** Optional parameters. */ export interface BetaAgentsCreateOptimizationJobOptionalParams extends OperationOptions { /** A feature flag opt-in required when using preview operations or modifying persisted preview resources. */ - foundryFeatures?: "AgentsOptimization=V1Preview"; + foundryFeatures?: "AgentsOptimization=V2Preview"; /** Client-generated unique ID for idempotent retries. When absent, the server creates the job unconditionally. */ operationId?: string; } - -/** Optional parameters. */ -export interface BetaAgentsDeleteSessionFileOptionalParams extends OperationOptions { - /** A feature flag opt-in required when using preview operations or modifying persisted preview resources. */ - foundryFeatures?: "HostedAgents=V1Preview"; - /** Whether to recursively delete directory contents. The service defaults to `false` if a value is not specified by the caller. */ - recursive?: boolean; - /** Opaque per-user isolation key used to scope endpoint-scoped data (responses, conversations, sessions) to a specific end user. */ - userIsolationKey?: string; -} - -/** Optional parameters. */ -export interface BetaAgentsListSessionFilesOptionalParams extends OperationOptions { - /** A feature flag opt-in required when using preview operations or modifying persisted preview resources. */ - foundryFeatures?: "HostedAgents=V1Preview"; - /** The directory path to list, relative to the session home directory. Defaults to the home directory if not provided. */ - path?: string; - /** Opaque per-user isolation key used to scope endpoint-scoped data (responses, conversations, sessions) to a specific end user. */ - userIsolationKey?: string; - /** - * 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?: PageOrder; - /** - * 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; -} - -/** Optional parameters. */ -export interface BetaAgentsDownloadSessionFileOptionalParams extends OperationOptions { - /** A feature flag opt-in required when using preview operations or modifying persisted preview resources. */ - foundryFeatures?: "HostedAgents=V1Preview"; - /** Opaque per-user isolation key used to scope endpoint-scoped data (responses, conversations, sessions) to a specific end user. */ - userIsolationKey?: string; -} - -/** Optional parameters. */ -export interface BetaAgentsUploadSessionFileOptionalParams extends OperationOptions { - /** A feature flag opt-in required when using preview operations or modifying persisted preview resources. */ - foundryFeatures?: "HostedAgents=V1Preview"; - /** Opaque per-user isolation key used to scope endpoint-scoped data (responses, conversations, sessions) to a specific end user. */ - userIsolationKey?: string; -} - -/** Optional parameters. */ -export interface BetaAgentsGetSessionLogStreamOptionalParams extends OperationOptions { - /** A feature flag opt-in required when using preview operations or modifying persisted preview resources. */ - foundryFeatures?: "HostedAgents=V1Preview"; -} - -/** Optional parameters. */ -export interface BetaAgentsListSessionsOptionalParams extends OperationOptions { - /** A feature flag opt-in required when using preview operations or modifying persisted preview resources. */ - foundryFeatures?: "AgentEndpoints=V1Preview"; - /** Opaque per-user isolation key used to scope endpoint-scoped data (responses, conversations, sessions) to a specific end user. */ - userIsolationKey?: string; - /** - * 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?: PageOrder; - /** - * 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; -} - -/** Optional parameters. */ -export interface BetaAgentsStopSessionOptionalParams extends OperationOptions { - /** A feature flag opt-in required when using preview operations or modifying persisted preview resources. */ - foundryFeatures?: "AgentEndpoints=V1Preview"; -} - -/** Optional parameters. */ -export interface BetaAgentsDeleteSessionOptionalParams extends OperationOptions { - /** A feature flag opt-in required when using preview operations or modifying persisted preview resources. */ - foundryFeatures?: "AgentEndpoints=V1Preview"; - /** Opaque per-user isolation key used to scope endpoint-scoped data (responses, conversations, sessions) to a specific end user. */ - userIsolationKey?: string; -} - -/** Optional parameters. */ -export interface BetaAgentsGetSessionOptionalParams extends OperationOptions { - /** A feature flag opt-in required when using preview operations or modifying persisted preview resources. */ - foundryFeatures?: "AgentEndpoints=V1Preview"; - /** Opaque per-user isolation key used to scope endpoint-scoped data (responses, conversations, sessions) to a specific end user. */ - userIsolationKey?: string; -} - -/** Optional parameters. */ -export interface BetaAgentsCreateSessionOptionalParams extends OperationOptions { - /** A feature flag opt-in required when using preview operations or modifying persisted preview resources. */ - foundryFeatures?: "AgentEndpoints=V1Preview"; - /** Opaque per-user isolation key used to scope endpoint-scoped data (responses, conversations, sessions) to a specific end user. */ - userIsolationKey?: string; - /** Optional caller-provided session ID. If specified, it must be unique within the agent endpoint. Auto-generated if omitted. */ - agentSessionId?: string; -} - -/** Optional parameters. */ -export interface BetaAgentsDownloadAgentCodeOptionalParams extends OperationOptions { - /** A feature flag opt-in required when using preview operations or modifying persisted preview resources. */ - foundryFeatures?: "CodeAgents=V1Preview"; - /** - * The version of the agent whose code zip should be downloaded. - * If omitted, the latest version's code zip is returned. - */ - agentVersion?: string; -} - -/** Optional parameters. */ -export interface BetaAgentsCreateVersionFromCodeOptionalParams extends OperationOptions { - /** A feature flag opt-in required when using preview operations or modifying persisted preview resources. */ - foundryFeatures?: AgentDefinitionOptInKeys; -} - -/** Optional parameters. */ -export interface BetaAgentsPatchAgentObjectOptionalParams extends OperationOptions { - /** A feature flag opt-in required when using preview operations or modifying persisted preview resources. */ - foundryFeatures?: "AgentEndpoints=V1Preview"; - /** The endpoint configuration for the agent */ - agentEndpoint?: AgentEndpointConfig; - /** Optional agent card for the agent */ - agentCard?: AgentCard; -} diff --git a/sdk/ai/ai-projects/generated/api/beta/datasets/operations.ts b/sdk/ai/ai-projects/generated/api/beta/datasets/operations.ts index 9f6cc656928e..5f5a42184d1a 100644 --- a/sdk/ai/ai-projects/generated/api/beta/datasets/operations.ts +++ b/sdk/ai/ai-projects/generated/api/beta/datasets/operations.ts @@ -63,16 +63,10 @@ export async function _deleteGenerationJobDeserialize( const expectedStatuses = ["204"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -124,16 +118,10 @@ export async function _cancelGenerationJobDeserialize( const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -187,16 +175,10 @@ export async function _createGenerationJobDeserialize( const expectedStatuses = ["201"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -250,16 +232,10 @@ export async function _listGenerationJobsDeserialize( const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -315,16 +291,10 @@ export async function _getGenerationJobDeserialize( const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } diff --git a/sdk/ai/ai-projects/generated/api/beta/evaluationTaxonomies/operations.ts b/sdk/ai/ai-projects/generated/api/beta/evaluationTaxonomies/operations.ts index a59d8156e412..5ca3b88c4eb4 100644 --- a/sdk/ai/ai-projects/generated/api/beta/evaluationTaxonomies/operations.ts +++ b/sdk/ai/ai-projects/generated/api/beta/evaluationTaxonomies/operations.ts @@ -70,7 +70,7 @@ export async function _updateDeserialize( return evaluationTaxonomyDeserializer(result.body); } -/** Update an evaluation taxonomy. */ +/** Modifies the specified evaluation taxonomy with the provided changes. */ export async function update( context: Client, foundryFeatures: "Evaluations=V1Preview", diff --git a/sdk/ai/ai-projects/generated/api/beta/evaluators/operations.ts b/sdk/ai/ai-projects/generated/api/beta/evaluators/operations.ts index 6954259f7c11..beb829b8d99b 100644 --- a/sdk/ai/ai-projects/generated/api/beta/evaluators/operations.ts +++ b/sdk/ai/ai-projects/generated/api/beta/evaluators/operations.ts @@ -84,16 +84,10 @@ export async function _deleteGenerationJobDeserialize( const expectedStatuses = ["204"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -148,16 +142,10 @@ export async function _cancelGenerationJobDeserialize( const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -211,23 +199,22 @@ export async function _listGenerationJobsDeserialize( const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } return _agentsPagedResultEvaluatorGenerationJobDeserializer(result.body); } -/** Returns a list of evaluator generation jobs. */ +/** + * Returns a list of evaluator generation jobs. The List API has up to a few + * seconds of propagation delay, so a recently created job may not appear + * immediately; use the Get evaluator generation job API with the job ID to + * retrieve a specific job without delay. + */ export function listGenerationJobs( context: Client, options: BetaEvaluatorsListGenerationJobsOptionalParams = { requestOptions: {} }, @@ -276,16 +263,10 @@ export async function _getGenerationJobDeserialize( const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -339,16 +320,10 @@ export async function _createGenerationJobDeserialize( const expectedStatuses = ["201"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -408,16 +383,10 @@ export async function _getCredentialsDeserialize( const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -476,16 +445,10 @@ export async function _pendingUploadDeserialize( const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -767,7 +730,7 @@ export async function _listDeserialize( return _pagedEvaluatorVersionDeserializer(result.body); } -/** Lists the latest version of each evaluator */ +/** Lists the latest version of each evaluator. */ export function list( context: Client, foundryFeatures: "Evaluations=V1Preview", diff --git a/sdk/ai/ai-projects/generated/api/beta/insights/operations.ts b/sdk/ai/ai-projects/generated/api/beta/insights/operations.ts index f91c25e2047f..9778872aaf9c 100644 --- a/sdk/ai/ai-projects/generated/api/beta/insights/operations.ts +++ b/sdk/ai/ai-projects/generated/api/beta/insights/operations.ts @@ -63,16 +63,10 @@ export async function _listDeserialize(result: PathUncheckedResponse): Promise<_ const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -127,16 +121,10 @@ export async function _getDeserialize(result: PathUncheckedResponse): Promise= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -197,16 +185,10 @@ export async function _generateDeserialize(result: PathUncheckedResponse): Promi const expectedStatuses = ["201"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } diff --git a/sdk/ai/ai-projects/generated/api/beta/memoryStores/operations.ts b/sdk/ai/ai-projects/generated/api/beta/memoryStores/operations.ts index 67129f435fa4..84615b362d9c 100644 --- a/sdk/ai/ai-projects/generated/api/beta/memoryStores/operations.ts +++ b/sdk/ai/ai-projects/generated/api/beta/memoryStores/operations.ts @@ -95,16 +95,10 @@ export async function _deleteMemoryDeserialize( const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -165,16 +159,10 @@ export async function _listMemoriesDeserialize( const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -234,16 +222,10 @@ export async function _getMemoryDeserialize( const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -301,16 +283,10 @@ export async function _updateMemoryDeserialize( const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -376,16 +352,10 @@ export async function _createMemoryDeserialize( const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -451,16 +421,10 @@ export async function _deleteScopeDeserialize( const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -515,16 +479,10 @@ export async function _getUpdateResultDeserialize( const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -587,16 +545,10 @@ export async function _updateMemoriesDeserialize( const expectedStatuses = ["202", "200", "201"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -679,16 +631,10 @@ export async function _searchMemoriesDeserialize( const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -741,16 +687,10 @@ export async function _$deleteDeserialize( const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -809,16 +749,10 @@ export async function _listDeserialize( const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -872,16 +806,10 @@ export async function _getDeserialize(result: PathUncheckedResponse): Promise= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -933,16 +861,10 @@ export async function _updateDeserialize(result: PathUncheckedResponse): Promise const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -999,16 +921,10 @@ export async function _createDeserialize(result: PathUncheckedResponse): Promise const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } diff --git a/sdk/ai/ai-projects/generated/api/beta/models/operations.ts b/sdk/ai/ai-projects/generated/api/beta/models/operations.ts index 7a52b2fd8348..791c0bd8f88c 100644 --- a/sdk/ai/ai-projects/generated/api/beta/models/operations.ts +++ b/sdk/ai/ai-projects/generated/api/beta/models/operations.ts @@ -280,7 +280,7 @@ export async function _updateDeserialize(result: PathUncheckedResponse): Promise return modelVersionDeserializer(result.body); } -/** Update an existing ModelVersion with the given version id */ +/** Updates an existing model version identified by its version ID. */ export async function update( context: Client, name: string, @@ -335,7 +335,7 @@ export async function _$deleteDeserialize(result: PathUncheckedResponse): Promis return; } -/** Delete the specific version of the ModelVersion. The service returns 200 OK if the ModelVersion was deleted successfully or if the ModelVersion does not exist. */ +/** Removes the specified model version. Returns 200 whether the version existed or not. */ /** * @fixme delete is a reserved word that cannot be used as an operation name. * Please add @clientName("clientName") or @clientName("", "javascript") diff --git a/sdk/ai/ai-projects/generated/api/beta/redTeams/operations.ts b/sdk/ai/ai-projects/generated/api/beta/redTeams/operations.ts index 85bc9a2000dc..fdb6882e3a9e 100644 --- a/sdk/ai/ai-projects/generated/api/beta/redTeams/operations.ts +++ b/sdk/ai/ai-projects/generated/api/beta/redTeams/operations.ts @@ -60,16 +60,10 @@ export async function _createDeserialize(result: PathUncheckedResponse): Promise const expectedStatuses = ["201"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } diff --git a/sdk/ai/ai-projects/generated/api/beta/routines/operations.ts b/sdk/ai/ai-projects/generated/api/beta/routines/operations.ts index 72d28708ea99..0adb71916f34 100644 --- a/sdk/ai/ai-projects/generated/api/beta/routines/operations.ts +++ b/sdk/ai/ai-projects/generated/api/beta/routines/operations.ts @@ -80,16 +80,10 @@ export async function _dispatchDeserialize( const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -146,16 +140,10 @@ export async function _listRunsDeserialize( const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -209,16 +197,10 @@ export async function _$deleteDeserialize(result: PathUncheckedResponse): Promis const expectedStatuses = ["204"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -277,16 +259,10 @@ export async function _listDeserialize( const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -340,16 +316,10 @@ export async function _disableDeserialize(result: PathUncheckedResponse): Promis const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -399,16 +369,10 @@ export async function _enableDeserialize(result: PathUncheckedResponse): Promise const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -458,16 +422,10 @@ export async function _getDeserialize(result: PathUncheckedResponse): Promise= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -526,16 +484,10 @@ export async function _createOrUpdateDeserialize(result: PathUncheckedResponse): const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } diff --git a/sdk/ai/ai-projects/generated/api/beta/schedules/operations.ts b/sdk/ai/ai-projects/generated/api/beta/schedules/operations.ts index 7e2f161e8e09..dbdbc1ee4f3d 100644 --- a/sdk/ai/ai-projects/generated/api/beta/schedules/operations.ts +++ b/sdk/ai/ai-projects/generated/api/beta/schedules/operations.ts @@ -125,16 +125,10 @@ export async function _getRunDeserialize(result: PathUncheckedResponse): Promise const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } diff --git a/sdk/ai/ai-projects/generated/api/beta/skills/operations.ts b/sdk/ai/ai-projects/generated/api/beta/skills/operations.ts index 211816c1e086..a7f737c51e15 100644 --- a/sdk/ai/ai-projects/generated/api/beta/skills/operations.ts +++ b/sdk/ai/ai-projects/generated/api/beta/skills/operations.ts @@ -84,16 +84,10 @@ export async function _deleteVersionDeserialize( const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -148,16 +142,10 @@ export async function _downloadVersionDeserialize( const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -211,16 +199,10 @@ export async function _downloadDeserialize( const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -273,16 +255,10 @@ export async function _getVersionDeserialize(result: PathUncheckedResponse): Pro const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -339,16 +315,10 @@ export async function _listVersionsDeserialize( const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -408,16 +378,10 @@ export async function _createFromFilesDeserialize( const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -475,16 +439,10 @@ export async function _createDeserialize(result: PathUncheckedResponse): Promise const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -536,16 +494,10 @@ export async function _$deleteDeserialize( const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -603,16 +555,10 @@ export async function _updateDeserialize(result: PathUncheckedResponse): Promise const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -667,16 +613,10 @@ export async function _listDeserialize( const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -730,16 +670,10 @@ export async function _getDeserialize(result: PathUncheckedResponse): Promise= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } diff --git a/sdk/ai/ai-projects/generated/api/datasets/operations.ts b/sdk/ai/ai-projects/generated/api/datasets/operations.ts index 9dc11cec4204..45298d2241f9 100644 --- a/sdk/ai/ai-projects/generated/api/datasets/operations.ts +++ b/sdk/ai/ai-projects/generated/api/datasets/operations.ts @@ -72,7 +72,7 @@ export async function _getCredentialsDeserialize( return datasetCredentialDeserializer(result.body); } -/** Gets the SAS credential to access the storage account associated with a Dataset version. */ +/** Retrieves the SAS credential to access the storage account associated with a dataset version. */ export async function getCredentials( context: Client, name: string, diff --git a/sdk/ai/ai-projects/generated/api/deployments/operations.ts b/sdk/ai/ai-projects/generated/api/deployments/operations.ts index 60666c011a9c..da5dbbd3aae7 100644 --- a/sdk/ai/ai-projects/generated/api/deployments/operations.ts +++ b/sdk/ai/ai-projects/generated/api/deployments/operations.ts @@ -112,7 +112,7 @@ export async function _getDeserialize(result: PathUncheckedResponse): Promise { const expectedStatuses = ["204"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -90,18 +78,16 @@ export async function deleteVersion( context: Client, name: string, version: string, - foundryFeatures: "Toolboxes=V1Preview", options: DeleteVersionOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _deleteVersionSend(context, name, version, foundryFeatures, options); + const result = await _deleteVersionSend(context, name, version, options); return _deleteVersionDeserialize(result); } export function _$deleteSend( context: Client, name: string, - foundryFeatures: "Toolboxes=V1Preview", - options: BetaToolboxesDeleteOptionalParams = { requestOptions: {} }, + options: ToolboxesDeleteOptionalParams = { requestOptions: {} }, ): StreamableMethod { const path = expandUrlTemplate( "/toolboxes/{name}{?api%2Dversion}", @@ -113,28 +99,17 @@ export function _$deleteSend( allowReserved: options?.requestOptions?.skipUrlEncoding, }, ); - return context - .path(path) - .delete({ - ...operationOptionsToRequestParameters(options), - headers: { "foundry-features": foundryFeatures, ...options.requestOptions?.headers }, - }); + return context.path(path).delete({ ...operationOptionsToRequestParameters(options) }); } export async function _$deleteDeserialize(result: PathUncheckedResponse): Promise { const expectedStatuses = ["204"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -150,10 +125,9 @@ export async function _$deleteDeserialize(result: PathUncheckedResponse): Promis export async function $delete( context: Client, name: string, - foundryFeatures: "Toolboxes=V1Preview", - options: BetaToolboxesDeleteOptionalParams = { requestOptions: {} }, + options: ToolboxesDeleteOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _$deleteSend(context, name, foundryFeatures, options); + const result = await _$deleteSend(context, name, options); return _$deleteDeserialize(result); } @@ -161,8 +135,7 @@ export function _updateSend( context: Client, name: string, defaultVersion: string, - foundryFeatures: "Toolboxes=V1Preview", - options: BetaToolboxesUpdateOptionalParams = { requestOptions: {} }, + options: ToolboxesUpdateOptionalParams = { requestOptions: {} }, ): StreamableMethod { const path = expandUrlTemplate( "/toolboxes/{name}{?api%2Dversion}", @@ -179,11 +152,7 @@ export function _updateSend( .patch({ ...operationOptionsToRequestParameters(options), contentType: "application/json", - headers: { - "foundry-features": foundryFeatures, - accept: "application/json", - ...options.requestOptions?.headers, - }, + headers: { accept: "application/json", ...options.requestOptions?.headers }, body: { default_version: defaultVersion }, }); } @@ -192,16 +161,10 @@ export async function _updateDeserialize(result: PathUncheckedResponse): Promise const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -213,10 +176,9 @@ export async function update( context: Client, name: string, defaultVersion: string, - foundryFeatures: "Toolboxes=V1Preview", - options: BetaToolboxesUpdateOptionalParams = { requestOptions: {} }, + options: ToolboxesUpdateOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _updateSend(context, name, defaultVersion, foundryFeatures, options); + const result = await _updateSend(context, name, defaultVersion, options); return _updateDeserialize(result); } @@ -224,7 +186,6 @@ export function _getVersionSend( context: Client, name: string, version: string, - foundryFeatures: "Toolboxes=V1Preview", options: GetVersionOptionalParams = { requestOptions: {} }, ): StreamableMethod { const path = expandUrlTemplate( @@ -242,11 +203,7 @@ export function _getVersionSend( .path(path) .get({ ...operationOptionsToRequestParameters(options), - headers: { - "foundry-features": foundryFeatures, - accept: "application/json", - ...options.requestOptions?.headers, - }, + headers: { accept: "application/json", ...options.requestOptions?.headers }, }); } @@ -256,16 +213,10 @@ export async function _getVersionDeserialize( const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -277,17 +228,15 @@ export async function getVersion( context: Client, name: string, version: string, - foundryFeatures: "Toolboxes=V1Preview", options: GetVersionOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _getVersionSend(context, name, version, foundryFeatures, options); + const result = await _getVersionSend(context, name, version, options); return _getVersionDeserialize(result); } export function _listVersionsSend( context: Client, name: string, - foundryFeatures: "Toolboxes=V1Preview", options: ListVersionsOptionalParams = { requestOptions: {} }, ): StreamableMethod { const path = expandUrlTemplate( @@ -308,11 +257,7 @@ export function _listVersionsSend( .path(path) .get({ ...operationOptionsToRequestParameters(options), - headers: { - "foundry-features": foundryFeatures, - accept: "application/json", - ...options.requestOptions?.headers, - }, + headers: { accept: "application/json", ...options.requestOptions?.headers }, }); } @@ -322,16 +267,10 @@ export async function _listVersionsDeserialize( const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -342,12 +281,11 @@ export async function _listVersionsDeserialize( export function listVersions( context: Client, name: string, - foundryFeatures: "Toolboxes=V1Preview", options: ListVersionsOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, - () => _listVersionsSend(context, name, foundryFeatures, options), + () => _listVersionsSend(context, name, options), _listVersionsDeserialize, ["200"], { itemName: "data", apiVersion: context.apiVersion ?? "v1" }, @@ -356,8 +294,7 @@ export function listVersions( export function _listSend( context: Client, - foundryFeatures: "Toolboxes=V1Preview", - options: BetaToolboxesListOptionalParams = { requestOptions: {} }, + options: ToolboxesListOptionalParams = { requestOptions: {} }, ): StreamableMethod { const path = expandUrlTemplate( "/toolboxes{?limit,order,after,before,api%2Dversion}", @@ -376,11 +313,7 @@ export function _listSend( .path(path) .get({ ...operationOptionsToRequestParameters(options), - headers: { - "foundry-features": foundryFeatures, - accept: "application/json", - ...options.requestOptions?.headers, - }, + headers: { accept: "application/json", ...options.requestOptions?.headers }, }); } @@ -390,16 +323,10 @@ export async function _listDeserialize( const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -409,12 +336,11 @@ export async function _listDeserialize( /** Returns the toolboxes available in the current project. */ export function list( context: Client, - foundryFeatures: "Toolboxes=V1Preview", - options: BetaToolboxesListOptionalParams = { requestOptions: {} }, + options: ToolboxesListOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, - () => _listSend(context, foundryFeatures, options), + () => _listSend(context, options), _listDeserialize, ["200"], { itemName: "data", apiVersion: context.apiVersion ?? "v1" }, @@ -424,8 +350,7 @@ export function list( export function _getSend( context: Client, name: string, - foundryFeatures: "Toolboxes=V1Preview", - options: BetaToolboxesGetOptionalParams = { requestOptions: {} }, + options: ToolboxesGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { const path = expandUrlTemplate( "/toolboxes/{name}{?api%2Dversion}", @@ -441,11 +366,7 @@ export function _getSend( .path(path) .get({ ...operationOptionsToRequestParameters(options), - headers: { - "foundry-features": foundryFeatures, - accept: "application/json", - ...options.requestOptions?.headers, - }, + headers: { accept: "application/json", ...options.requestOptions?.headers }, }); } @@ -453,16 +374,10 @@ export async function _getDeserialize(result: PathUncheckedResponse): Promise= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -473,18 +388,16 @@ export async function _getDeserialize(result: PathUncheckedResponse): Promise { - const result = await _getSend(context, name, foundryFeatures, options); + const result = await _getSend(context, name, options); return _getDeserialize(result); } export function _createVersionSend( context: Client, name: string, - tools: ToolUnion[], - foundryFeatures: "Toolboxes=V1Preview", + tools: ToolboxToolUnion[], options: CreateVersionOptionalParams = { requestOptions: {} }, ): StreamableMethod { const path = expandUrlTemplate( @@ -502,15 +415,11 @@ export function _createVersionSend( .post({ ...operationOptionsToRequestParameters(options), contentType: "application/json", - headers: { - "foundry-features": foundryFeatures, - accept: "application/json", - ...options.requestOptions?.headers, - }, + headers: { accept: "application/json", ...options.requestOptions?.headers }, body: { description: options?.description, metadata: options?.metadata, - tools: toolUnionArraySerializer(tools), + tools: toolboxToolUnionArraySerializer(tools), skills: !options?.skills ? options?.skills : toolboxSkillUnionArraySerializer(options?.skills), @@ -527,16 +436,10 @@ export async function _createVersionDeserialize( const expectedStatuses = ["200"]; if (!expectedStatuses.includes(result.status)) { const error = createRestError(result); - const statusCode = Number.parseInt(result.status); - if (statusCode >= 400 && statusCode <= 499) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } - } else if (statusCode >= 500 && statusCode <= 599) { - if (result.body) { - error.details = apiErrorResponseDeserializer(result.body); - } + if (result.body) { + error.details = apiErrorResponseDeserializer(result.body); } + throw error; } @@ -547,10 +450,9 @@ export async function _createVersionDeserialize( export async function createVersion( context: Client, name: string, - tools: ToolUnion[], - foundryFeatures: "Toolboxes=V1Preview", + tools: ToolboxToolUnion[], options: CreateVersionOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _createVersionSend(context, name, tools, foundryFeatures, options); + const result = await _createVersionSend(context, name, tools, options); return _createVersionDeserialize(result); } diff --git a/sdk/ai/ai-projects/generated/api/beta/toolboxes/options.ts b/sdk/ai/ai-projects/generated/api/toolboxes/options.ts similarity index 90% rename from sdk/ai/ai-projects/generated/api/beta/toolboxes/options.ts rename to sdk/ai/ai-projects/generated/api/toolboxes/options.ts index e5d678ccb188..00e58f85bd44 100644 --- a/sdk/ai/ai-projects/generated/api/beta/toolboxes/options.ts +++ b/sdk/ai/ai-projects/generated/api/toolboxes/options.ts @@ -1,17 +1,17 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { ToolboxSkillUnion, ToolboxPolicies, PageOrder } from "../../../models/models.js"; +import { ToolboxSkillUnion, ToolboxPolicies, PageOrder } from "../../models/models.js"; import { OperationOptions } from "@azure-rest/core-client"; /** Optional parameters. */ export interface DeleteVersionOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface BetaToolboxesDeleteOptionalParams extends OperationOptions {} +export interface ToolboxesDeleteOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface BetaToolboxesUpdateOptionalParams extends OperationOptions {} +export interface ToolboxesUpdateOptionalParams extends OperationOptions {} /** Optional parameters. */ export interface GetVersionOptionalParams extends OperationOptions {} @@ -43,7 +43,7 @@ export interface ListVersionsOptionalParams extends OperationOptions { } /** Optional parameters. */ -export interface BetaToolboxesListOptionalParams extends OperationOptions { +export interface ToolboxesListOptionalParams extends OperationOptions { /** * A limit on the number of objects to be returned. Limit can range between 1 and 100, and the * default is 20. @@ -69,7 +69,7 @@ export interface BetaToolboxesListOptionalParams extends OperationOptions { } /** Optional parameters. */ -export interface BetaToolboxesGetOptionalParams extends OperationOptions {} +export interface ToolboxesGetOptionalParams extends OperationOptions {} /** Optional parameters. */ export interface CreateVersionOptionalParams extends OperationOptions { diff --git a/sdk/ai/ai-projects/generated/classic/agents/index.ts b/sdk/ai/ai-projects/generated/classic/agents/index.ts index c8936f7bf7bb..a089fe7d1812 100644 --- a/sdk/ai/ai-projects/generated/classic/agents/index.ts +++ b/sdk/ai/ai-projects/generated/classic/agents/index.ts @@ -3,6 +3,21 @@ import { AIProjectContext } from "../../api/aiProjectContext.js"; import { + deleteSessionFile, + listSessionFiles, + downloadSessionFile, + uploadSessionFile, + getSessionLogStream, + listSessions, + stopSession, + deleteSession, + getSession, + createSession, + disable, + enable, + downloadAgentCode, + createVersionFromCode, + patchAgentObject, listVersions, deleteVersion, getVersion, @@ -17,6 +32,21 @@ import { get, } from "../../api/agents/operations.js"; import { + AgentsDeleteSessionFileOptionalParams, + AgentsListSessionFilesOptionalParams, + AgentsDownloadSessionFileOptionalParams, + AgentsUploadSessionFileOptionalParams, + AgentsGetSessionLogStreamOptionalParams, + AgentsListSessionsOptionalParams, + AgentsStopSessionOptionalParams, + AgentsDeleteSessionOptionalParams, + AgentsGetSessionOptionalParams, + AgentsCreateSessionOptionalParams, + AgentsDisableOptionalParams, + AgentsEnableOptionalParams, + AgentsDownloadAgentCodeOptionalParams, + AgentsCreateVersionFromCodeOptionalParams, + AgentsPatchAgentObjectOptionalParams, AgentsListVersionsOptionalParams, AgentsDeleteVersionOptionalParams, AgentsGetVersionOptionalParams, @@ -36,11 +66,172 @@ import { AgentDefinitionUnion, DeleteAgentResponse, DeleteAgentVersionResponse, + CreateAgentVersionFromCodeContent, + VersionIndicatorUnion, + AgentSessionResource, + SessionLogEvent, + SessionFileWriteResponse, + SessionDirectoryEntry, + AgentsDownloadSessionFileResponse, + AgentsDownloadAgentCodeResponse, } from "../../models/models.js"; import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; /** Interface representing a Agents operations. */ export interface AgentsOperations { + /** + * Deletes the specified file or directory from the session sandbox. + * When `recursive` is false, deleting a non-empty directory returns 409 Conflict. + */ + deleteSessionFile: ( + agentName: string, + agentSessionId: string, + path: string, + options?: AgentsDeleteSessionFileOptionalParams, + ) => Promise; + /** + * Returns files and directories at the specified path in the session sandbox. + * The response includes only the immediate children of the target directory and defaults to the session home directory when no path is supplied. + */ + listSessionFiles: ( + agentName: string, + agentSessionId: string, + options?: AgentsListSessionFilesOptionalParams, + ) => PagedAsyncIterableIterator; + /** + * Downloads the file at the specified sandbox path as a binary stream. + * The path is resolved relative to the session home directory. + */ + downloadSessionFile: ( + agentName: string, + agentSessionId: string, + path: string, + options?: AgentsDownloadSessionFileOptionalParams, + ) => Promise; + /** + * Uploads binary file content to the specified path in the session sandbox. + * The service stores the file relative to the session home directory and rejects payloads larger than 50 MB. + */ + uploadSessionFile: ( + agentName: string, + agentSessionId: string, + path: string, + content: Uint8Array, + options?: AgentsUploadSessionFileOptionalParams, + ) => Promise; + /** + * Streams console logs (stdout / stderr) for a specific hosted agent session + * as a Server-Sent Events (SSE) stream. + * + * Each SSE frame contains: + * - `event`: always `"log"` + * - `data`: a plain-text log line (currently JSON-formatted, but the schema + * is not contractual and may include additional keys or change format + * over time — clients should treat it as an opaque string) + * + * Example SSE frames: + * ``` + * event: log + * data: {"timestamp":"2026-03-10T09:33:17.121Z","stream":"stdout","message":"Starting FoundryCBAgent server on port 8088"} + * + * event: log + * data: {"timestamp":"2026-03-10T09:33:17.130Z","stream":"stderr","message":"INFO: Application startup complete."} + * + * event: log + * data: {"timestamp":"2026-03-10T09:34:52.714Z","stream":"status","message":"Successfully connected to container"} + * + * event: log + * data: {"timestamp":"2026-03-10T09:35:52.714Z","stream":"status","message":"No logs since last 60 seconds"} + * ``` + * + * The stream remains open until the client disconnects or the server + * terminates the connection. Clients should handle reconnection as needed. + */ + getSessionLogStream: ( + agentName: string, + agentVersion: string, + sessionId: string, + options?: AgentsGetSessionLogStreamOptionalParams, + ) => Promise; + /** Returns a paged collection of sessions associated with the specified agent endpoint. */ + listSessions: ( + agentName: string, + options?: AgentsListSessionsOptionalParams, + ) => PagedAsyncIterableIterator; + /** Terminates the specified hosted agent session and returns 204 No Content when the request succeeds. */ + stopSession: ( + agentName: string, + sessionId: string, + options?: AgentsStopSessionOptionalParams, + ) => Promise; + /** + * Deletes a session synchronously. + * Returns 204 No Content when the session is deleted or does not exist. + */ + deleteSession: ( + agentName: string, + sessionId: string, + options?: AgentsDeleteSessionOptionalParams, + ) => Promise; + /** Retrieves the details of a hosted agent session by agent name and session identifier. */ + getSession: ( + agentName: string, + sessionId: string, + options?: AgentsGetSessionOptionalParams, + ) => Promise; + /** + * Creates a new session for an agent endpoint. + * The endpoint resolves the backing agent version from `version_indicator` and + * enforces session ownership using the provided user identity for session-mutating operations. + */ + createSession: ( + agentName: string, + versionIndicator: VersionIndicatorUnion, + options?: AgentsCreateSessionOptionalParams, + ) => Promise; + /** + * Disables the specified agent, preventing it from accepting new sessions or processing requests. + * Existing active sessions are allowed to drain gracefully but no new sessions can be created. + * This operation is idempotent — disabling an already-disabled agent returns success with no side effects. + */ + disable: (agentName: string, options?: AgentsDisableOptionalParams) => Promise; + /** + * Enables the specified agent, allowing it to accept new sessions and process requests. + * This operation is idempotent — enabling an already-enabled agent returns success with no side effects. + */ + enable: (agentName: string, options?: AgentsEnableOptionalParams) => Promise; + /** + * Downloads the code zip for a code-based hosted agent. + * Returns the previously-uploaded zip (`application/zip`). + * + * If `agent_version` is supplied, returns that version's code zip; otherwise + * returns the latest version's code zip. + * + * The SHA-256 digest of the returned bytes matches the `content_hash` on the + * resolved version's `code_configuration`. + */ + downloadAgentCode: ( + agentName: string, + options?: AgentsDownloadAgentCodeOptionalParams, + ) => Promise; + /** + * Creates a new agent version from code. Uploads the code zip and creates a new version + * for an existing agent. The SHA-256 hex digest of the zip is provided in the + * `x-ms-code-zip-sha256` header for integrity and dedup. + * The request body is multipart/form-data with a JSON metadata part and a binary code part (part order is irrelevant). + * Maximum upload size is 250 MB. + */ + createVersionFromCode: ( + agentName: string, + codeZipSha256: string, + content: CreateAgentVersionFromCodeContent, + options?: AgentsCreateVersionFromCodeOptionalParams, + ) => Promise; + /** Applies a merge-patch update to the specified agent endpoint configuration. */ + patchAgentObject: ( + agentName: string, + options?: AgentsPatchAgentObjectOptionalParams, + ) => Promise; /** Returns a paged collection of versions for the specified agent. */ listVersions: ( agentName: string, @@ -126,6 +317,69 @@ export interface AgentsOperations { function _getAgents(context: AIProjectContext) { return { + deleteSessionFile: ( + agentName: string, + agentSessionId: string, + path: string, + options?: AgentsDeleteSessionFileOptionalParams, + ) => deleteSessionFile(context, agentName, agentSessionId, path, options), + listSessionFiles: ( + agentName: string, + agentSessionId: string, + options?: AgentsListSessionFilesOptionalParams, + ) => listSessionFiles(context, agentName, agentSessionId, options), + downloadSessionFile: ( + agentName: string, + agentSessionId: string, + path: string, + options?: AgentsDownloadSessionFileOptionalParams, + ) => downloadSessionFile(context, agentName, agentSessionId, path, options), + uploadSessionFile: ( + agentName: string, + agentSessionId: string, + path: string, + content: Uint8Array, + options?: AgentsUploadSessionFileOptionalParams, + ) => uploadSessionFile(context, agentName, agentSessionId, path, content, options), + getSessionLogStream: ( + agentName: string, + agentVersion: string, + sessionId: string, + options?: AgentsGetSessionLogStreamOptionalParams, + ) => getSessionLogStream(context, agentName, agentVersion, sessionId, options), + listSessions: (agentName: string, options?: AgentsListSessionsOptionalParams) => + listSessions(context, agentName, options), + stopSession: ( + agentName: string, + sessionId: string, + options?: AgentsStopSessionOptionalParams, + ) => stopSession(context, agentName, sessionId, options), + deleteSession: ( + agentName: string, + sessionId: string, + options?: AgentsDeleteSessionOptionalParams, + ) => deleteSession(context, agentName, sessionId, options), + getSession: (agentName: string, sessionId: string, options?: AgentsGetSessionOptionalParams) => + getSession(context, agentName, sessionId, options), + createSession: ( + agentName: string, + versionIndicator: VersionIndicatorUnion, + options?: AgentsCreateSessionOptionalParams, + ) => createSession(context, agentName, versionIndicator, options), + disable: (agentName: string, options?: AgentsDisableOptionalParams) => + disable(context, agentName, options), + enable: (agentName: string, options?: AgentsEnableOptionalParams) => + enable(context, agentName, options), + downloadAgentCode: (agentName: string, options?: AgentsDownloadAgentCodeOptionalParams) => + downloadAgentCode(context, agentName, options), + createVersionFromCode: ( + agentName: string, + codeZipSha256: string, + content: CreateAgentVersionFromCodeContent, + options?: AgentsCreateVersionFromCodeOptionalParams, + ) => createVersionFromCode(context, agentName, codeZipSha256, content, options), + patchAgentObject: (agentName: string, options?: AgentsPatchAgentObjectOptionalParams) => + patchAgentObject(context, agentName, options), listVersions: (agentName: string, options?: AgentsListVersionsOptionalParams) => listVersions(context, agentName, options), deleteVersion: ( diff --git a/sdk/ai/ai-projects/generated/classic/beta/agents/index.ts b/sdk/ai/ai-projects/generated/classic/beta/agents/index.ts index 23ec2e86ed5c..aaadfc975dcc 100644 --- a/sdk/ai/ai-projects/generated/classic/beta/agents/index.ts +++ b/sdk/ai/ai-projects/generated/classic/beta/agents/index.ts @@ -3,335 +3,52 @@ import { AIProjectContext } from "../../../api/aiProjectContext.js"; import { - promoteCandidate, - getCandidateFile, - getOptimizationCandidateResults, - getOptimizationCandidateConfig, - getOptimizationCandidate, - listOptimizationCandidates, deleteOptimizationJob, cancelOptimizationJob, listOptimizationJobs, getOptimizationJob, createOptimizationJob, - deleteSessionFile, - listSessionFiles, - downloadSessionFile, - uploadSessionFile, - getSessionLogStream, - listSessions, - stopSession, - deleteSession, - getSession, - createSession, - downloadAgentCode, - createVersionFromCode, - patchAgentObject, } from "../../../api/beta/agents/operations.js"; import { - BetaAgentsPromoteCandidateOptionalParams, - BetaAgentsGetCandidateFileOptionalParams, - BetaAgentsGetOptimizationCandidateResultsOptionalParams, - BetaAgentsGetOptimizationCandidateConfigOptionalParams, - BetaAgentsGetOptimizationCandidateOptionalParams, - BetaAgentsListOptimizationCandidatesOptionalParams, BetaAgentsDeleteOptimizationJobOptionalParams, BetaAgentsCancelOptimizationJobOptionalParams, BetaAgentsListOptimizationJobsOptionalParams, BetaAgentsGetOptimizationJobOptionalParams, BetaAgentsCreateOptimizationJobOptionalParams, - BetaAgentsDeleteSessionFileOptionalParams, - BetaAgentsListSessionFilesOptionalParams, - BetaAgentsDownloadSessionFileOptionalParams, - BetaAgentsUploadSessionFileOptionalParams, - BetaAgentsGetSessionLogStreamOptionalParams, - BetaAgentsListSessionsOptionalParams, - BetaAgentsStopSessionOptionalParams, - BetaAgentsDeleteSessionOptionalParams, - BetaAgentsGetSessionOptionalParams, - BetaAgentsCreateSessionOptionalParams, - BetaAgentsDownloadAgentCodeOptionalParams, - BetaAgentsCreateVersionFromCodeOptionalParams, - BetaAgentsPatchAgentObjectOptionalParams, } from "../../../api/beta/agents/options.js"; -import { - Agent, - AgentVersion, - CreateAgentVersionFromCodeContent, - VersionIndicatorUnion, - AgentSessionResource, - SessionLogEvent, - SessionFileWriteResponse, - SessionDirectoryEntry, - OptimizationJobInputs, - OptimizationJob, - OptimizationCandidate, - CandidateMetadata, - CandidateDeployConfig, - CandidateResults, - PromoteCandidateRequest, - PromoteCandidateResponse, - BetaAgentsGetCandidateFileResponse, - BetaAgentsDownloadSessionFileResponse, - BetaAgentsDownloadAgentCodeResponse, -} from "../../../models/models.js"; +import { OptimizationJob, OptimizationJobListItem } from "../../../models/models.js"; import { PagedAsyncIterableIterator } from "../../../static-helpers/pagingHelpers.js"; /** Interface representing a BetaAgents operations. */ export interface BetaAgentsOperations { - /** Promotes the specified candidate and records the deployment timestamp and target agent version. */ - promoteCandidate: ( - jobId: string, - candidateId: string, - candidateRequest: PromoteCandidateRequest, - options?: BetaAgentsPromoteCandidateOptionalParams, - ) => Promise; - /** Streams the specified file from the candidate's blob directory. */ - getCandidateFile: ( - jobId: string, - candidateId: string, - path: string, - options?: BetaAgentsGetCandidateFileOptionalParams, - ) => Promise; - /** Retrieves full per-task evaluation results for the specified candidate. */ - getOptimizationCandidateResults: ( - jobId: string, - candidateId: string, - options?: BetaAgentsGetOptimizationCandidateResultsOptionalParams, - ) => Promise; - /** - * Retrieves the deploy configuration JSON for the specified candidate. - * Clients can use it to compose `agents.create_version(...)` requests. - */ - getOptimizationCandidateConfig: ( - jobId: string, - candidateId: string, - options?: BetaAgentsGetOptimizationCandidateConfigOptionalParams, - ) => Promise; - /** Retrieves metadata, manifest information, and promotion details for the specified candidate. */ - getOptimizationCandidate: ( - jobId: string, - candidateId: string, - options?: BetaAgentsGetOptimizationCandidateOptionalParams, - ) => Promise; - /** Returns the candidates produced by the specified optimization job. */ - listOptimizationCandidates: ( - jobId: string, - options?: BetaAgentsListOptimizationCandidatesOptionalParams, - ) => PagedAsyncIterableIterator; - /** - * Deletes the specified agent optimization job and its candidate artifacts. - * Cancels the job first when it is still in a non-terminal state. - */ + /** Deletes the job and its candidate artifacts, canceling the job first if it is non-terminal. */ deleteOptimizationJob: ( jobId: string, options?: BetaAgentsDeleteOptimizationJobOptionalParams, ) => Promise; - /** - * Requests cancellation of the specified agent optimization job. - * The operation remains idempotent after the job reaches a terminal state. - */ + /** Requests cancellation of a running or queued job and returns an error if the job is already in a terminal state. */ cancelOptimizationJob: ( jobId: string, options?: BetaAgentsCancelOptimizationJobOptionalParams, ) => Promise; - /** Returns agent optimization jobs with cursor pagination and optional lifecycle or agent filters. */ + /** Lists optimization jobs with cursor pagination and optional status or agent name filters. */ listOptimizationJobs: ( options?: BetaAgentsListOptimizationJobsOptionalParams, - ) => PagedAsyncIterableIterator; - /** - * Retrieves the specified agent optimization job. - * Returns 202 while the job is in progress and 200 after it reaches a terminal state. - */ + ) => PagedAsyncIterableIterator; + /** Retrieves an optimization job by its identifier. */ getOptimizationJob: ( jobId: string, options?: BetaAgentsGetOptimizationJobOptionalParams, ) => Promise; - /** - * Creates an agent optimization job and returns the queued job. - * Honors `Operation-Id` for idempotent retry. - */ + /** Creates an optimization job and returns the queued job. Honors `Operation-Id` for idempotent retry. */ createOptimizationJob: ( - inputs: OptimizationJobInputs, + job: OptimizationJob, options?: BetaAgentsCreateOptimizationJobOptionalParams, ) => Promise; - /** - * Deletes the specified file or directory from the session sandbox. - * When `recursive` is false, deleting a non-empty directory returns 409 Conflict. - */ - deleteSessionFile: ( - agentName: string, - agentSessionId: string, - path: string, - options?: BetaAgentsDeleteSessionFileOptionalParams, - ) => Promise; - /** - * Returns files and directories at the specified path in the session sandbox. - * The response includes only the immediate children of the target directory and defaults to the session home directory when no path is supplied. - */ - listSessionFiles: ( - agentName: string, - agentSessionId: string, - options?: BetaAgentsListSessionFilesOptionalParams, - ) => PagedAsyncIterableIterator; - /** - * Downloads the file at the specified sandbox path as a binary stream. - * The path is resolved relative to the session home directory. - */ - downloadSessionFile: ( - agentName: string, - agentSessionId: string, - path: string, - options?: BetaAgentsDownloadSessionFileOptionalParams, - ) => Promise; - /** - * Uploads binary file content to the specified path in the session sandbox. - * The service stores the file relative to the session home directory and rejects payloads larger than 50 MB. - */ - uploadSessionFile: ( - agentName: string, - agentSessionId: string, - path: string, - content: Uint8Array, - options?: BetaAgentsUploadSessionFileOptionalParams, - ) => Promise; - /** - * Streams console logs (stdout / stderr) for a specific hosted agent session - * as a Server-Sent Events (SSE) stream. - * - * Each SSE frame contains: - * - `event`: always `"log"` - * - `data`: a plain-text log line (currently JSON-formatted, but the schema - * is not contractual and may include additional keys or change format - * over time — clients should treat it as an opaque string) - * - * Example SSE frames: - * ``` - * event: log - * data: {"timestamp":"2026-03-10T09:33:17.121Z","stream":"stdout","message":"Starting FoundryCBAgent server on port 8088"} - * - * event: log - * data: {"timestamp":"2026-03-10T09:33:17.130Z","stream":"stderr","message":"INFO: Application startup complete."} - * - * event: log - * data: {"timestamp":"2026-03-10T09:34:52.714Z","stream":"status","message":"Successfully connected to container"} - * - * event: log - * data: {"timestamp":"2026-03-10T09:35:52.714Z","stream":"status","message":"No logs since last 60 seconds"} - * ``` - * - * The stream remains open until the client disconnects or the server - * terminates the connection. Clients should handle reconnection as needed. - */ - getSessionLogStream: ( - agentName: string, - agentVersion: string, - sessionId: string, - options?: BetaAgentsGetSessionLogStreamOptionalParams, - ) => Promise; - /** Returns a paged collection of sessions associated with the specified agent endpoint. */ - listSessions: ( - agentName: string, - options?: BetaAgentsListSessionsOptionalParams, - ) => PagedAsyncIterableIterator; - /** Terminates the specified hosted agent session and returns 204 No Content when the request succeeds. */ - stopSession: ( - agentName: string, - sessionId: string, - options?: BetaAgentsStopSessionOptionalParams, - ) => Promise; - /** - * Deletes a session synchronously. - * Returns 204 No Content when the session is deleted or does not exist. - */ - deleteSession: ( - agentName: string, - sessionId: string, - options?: BetaAgentsDeleteSessionOptionalParams, - ) => Promise; - /** Retrieves the details of a hosted agent session by agent name and session identifier. */ - getSession: ( - agentName: string, - sessionId: string, - options?: BetaAgentsGetSessionOptionalParams, - ) => Promise; - /** - * Creates a new session for an agent endpoint. - * The endpoint resolves the backing agent version from `version_indicator` and - * enforces session ownership using the provided isolation key for session-mutating operations. - */ - createSession: ( - agentName: string, - versionIndicator: VersionIndicatorUnion, - options?: BetaAgentsCreateSessionOptionalParams, - ) => Promise; - /** - * Downloads the code zip for a code-based hosted agent. - * Returns the previously-uploaded zip (`application/zip`). - * - * If `agent_version` is supplied, returns that version's code zip; otherwise - * returns the latest version's code zip. - * - * The SHA-256 digest of the returned bytes matches the `content_hash` on the - * resolved version's `code_configuration`. - */ - downloadAgentCode: ( - agentName: string, - options?: BetaAgentsDownloadAgentCodeOptionalParams, - ) => Promise; - /** - * Creates a new agent version from code. Uploads the code zip and creates a new version - * for an existing agent. The SHA-256 hex digest of the zip is provided in the - * `x-ms-code-zip-sha256` header for integrity and dedup. - * The request body is multipart/form-data with a JSON metadata part and a binary code part (part order is irrelevant). - * Maximum upload size is 250 MB. - */ - createVersionFromCode: ( - agentName: string, - codeZipSha256: string, - content: CreateAgentVersionFromCodeContent, - options?: BetaAgentsCreateVersionFromCodeOptionalParams, - ) => Promise; - /** Applies a merge-patch update to the specified agent endpoint configuration. */ - patchAgentObject: ( - agentName: string, - options?: BetaAgentsPatchAgentObjectOptionalParams, - ) => Promise; } function _getBetaAgents(context: AIProjectContext) { return { - promoteCandidate: ( - jobId: string, - candidateId: string, - candidateRequest: PromoteCandidateRequest, - options?: BetaAgentsPromoteCandidateOptionalParams, - ) => promoteCandidate(context, jobId, candidateId, candidateRequest, options), - getCandidateFile: ( - jobId: string, - candidateId: string, - path: string, - options?: BetaAgentsGetCandidateFileOptionalParams, - ) => getCandidateFile(context, jobId, candidateId, path, options), - getOptimizationCandidateResults: ( - jobId: string, - candidateId: string, - options?: BetaAgentsGetOptimizationCandidateResultsOptionalParams, - ) => getOptimizationCandidateResults(context, jobId, candidateId, options), - getOptimizationCandidateConfig: ( - jobId: string, - candidateId: string, - options?: BetaAgentsGetOptimizationCandidateConfigOptionalParams, - ) => getOptimizationCandidateConfig(context, jobId, candidateId, options), - getOptimizationCandidate: ( - jobId: string, - candidateId: string, - options?: BetaAgentsGetOptimizationCandidateOptionalParams, - ) => getOptimizationCandidate(context, jobId, candidateId, options), - listOptimizationCandidates: ( - jobId: string, - options?: BetaAgentsListOptimizationCandidatesOptionalParams, - ) => listOptimizationCandidates(context, jobId, options), deleteOptimizationJob: ( jobId: string, options?: BetaAgentsDeleteOptimizationJobOptionalParams, @@ -345,71 +62,9 @@ function _getBetaAgents(context: AIProjectContext) { getOptimizationJob: (jobId: string, options?: BetaAgentsGetOptimizationJobOptionalParams) => getOptimizationJob(context, jobId, options), createOptimizationJob: ( - inputs: OptimizationJobInputs, + job: OptimizationJob, options?: BetaAgentsCreateOptimizationJobOptionalParams, - ) => createOptimizationJob(context, inputs, options), - deleteSessionFile: ( - agentName: string, - agentSessionId: string, - path: string, - options?: BetaAgentsDeleteSessionFileOptionalParams, - ) => deleteSessionFile(context, agentName, agentSessionId, path, options), - listSessionFiles: ( - agentName: string, - agentSessionId: string, - options?: BetaAgentsListSessionFilesOptionalParams, - ) => listSessionFiles(context, agentName, agentSessionId, options), - downloadSessionFile: ( - agentName: string, - agentSessionId: string, - path: string, - options?: BetaAgentsDownloadSessionFileOptionalParams, - ) => downloadSessionFile(context, agentName, agentSessionId, path, options), - uploadSessionFile: ( - agentName: string, - agentSessionId: string, - path: string, - content: Uint8Array, - options?: BetaAgentsUploadSessionFileOptionalParams, - ) => uploadSessionFile(context, agentName, agentSessionId, path, content, options), - getSessionLogStream: ( - agentName: string, - agentVersion: string, - sessionId: string, - options?: BetaAgentsGetSessionLogStreamOptionalParams, - ) => getSessionLogStream(context, agentName, agentVersion, sessionId, options), - listSessions: (agentName: string, options?: BetaAgentsListSessionsOptionalParams) => - listSessions(context, agentName, options), - stopSession: ( - agentName: string, - sessionId: string, - options?: BetaAgentsStopSessionOptionalParams, - ) => stopSession(context, agentName, sessionId, options), - deleteSession: ( - agentName: string, - sessionId: string, - options?: BetaAgentsDeleteSessionOptionalParams, - ) => deleteSession(context, agentName, sessionId, options), - getSession: ( - agentName: string, - sessionId: string, - options?: BetaAgentsGetSessionOptionalParams, - ) => getSession(context, agentName, sessionId, options), - createSession: ( - agentName: string, - versionIndicator: VersionIndicatorUnion, - options?: BetaAgentsCreateSessionOptionalParams, - ) => createSession(context, agentName, versionIndicator, options), - downloadAgentCode: (agentName: string, options?: BetaAgentsDownloadAgentCodeOptionalParams) => - downloadAgentCode(context, agentName, options), - createVersionFromCode: ( - agentName: string, - codeZipSha256: string, - content: CreateAgentVersionFromCodeContent, - options?: BetaAgentsCreateVersionFromCodeOptionalParams, - ) => createVersionFromCode(context, agentName, codeZipSha256, content, options), - patchAgentObject: (agentName: string, options?: BetaAgentsPatchAgentObjectOptionalParams) => - patchAgentObject(context, agentName, options), + ) => createOptimizationJob(context, job, options), }; } diff --git a/sdk/ai/ai-projects/generated/classic/beta/evaluationTaxonomies/index.ts b/sdk/ai/ai-projects/generated/classic/beta/evaluationTaxonomies/index.ts index 9f64183a382c..9fd95ae8d9dc 100644 --- a/sdk/ai/ai-projects/generated/classic/beta/evaluationTaxonomies/index.ts +++ b/sdk/ai/ai-projects/generated/classic/beta/evaluationTaxonomies/index.ts @@ -21,7 +21,7 @@ import { PagedAsyncIterableIterator } from "../../../static-helpers/pagingHelper /** Interface representing a BetaEvaluationTaxonomies operations. */ export interface BetaEvaluationTaxonomiesOperations { - /** Update an evaluation taxonomy. */ + /** Modifies the specified evaluation taxonomy with the provided changes. */ update: ( foundryFeatures: "Evaluations=V1Preview", name: string, diff --git a/sdk/ai/ai-projects/generated/classic/beta/evaluators/index.ts b/sdk/ai/ai-projects/generated/classic/beta/evaluators/index.ts index 98477ef97382..7a78482ebfd9 100644 --- a/sdk/ai/ai-projects/generated/classic/beta/evaluators/index.ts +++ b/sdk/ai/ai-projects/generated/classic/beta/evaluators/index.ts @@ -57,7 +57,12 @@ export interface BetaEvaluatorsOperations { jobId: string, options?: BetaEvaluatorsCancelGenerationJobOptionalParams, ) => Promise; - /** Returns a list of evaluator generation jobs. */ + /** + * Returns a list of evaluator generation jobs. The List API has up to a few + * seconds of propagation delay, so a recently created job may not appear + * immediately; use the Get evaluator generation job API with the job ID to + * retrieve a specific job without delay. + */ listGenerationJobs: ( options?: BetaEvaluatorsListGenerationJobsOptionalParams, ) => PagedAsyncIterableIterator; @@ -117,7 +122,7 @@ export interface BetaEvaluatorsOperations { version: string, options?: BetaEvaluatorsGetVersionOptionalParams, ) => Promise; - /** Lists the latest version of each evaluator */ + /** Lists the latest version of each evaluator. */ list: ( foundryFeatures: "Evaluations=V1Preview", options?: BetaEvaluatorsListOptionalParams, diff --git a/sdk/ai/ai-projects/generated/classic/beta/index.ts b/sdk/ai/ai-projects/generated/classic/beta/index.ts index 6563eb0deb5e..b0e2473bd151 100644 --- a/sdk/ai/ai-projects/generated/classic/beta/index.ts +++ b/sdk/ai/ai-projects/generated/classic/beta/index.ts @@ -19,13 +19,12 @@ import { BetaRedTeamsOperations, _getBetaRedTeamsOperations } from "./redTeams/i import { BetaRoutinesOperations, _getBetaRoutinesOperations } from "./routines/index.js"; import { BetaSchedulesOperations, _getBetaSchedulesOperations } from "./schedules/index.js"; import { BetaSkillsOperations, _getBetaSkillsOperations } from "./skills/index.js"; -import { BetaToolboxesOperations, _getBetaToolboxesOperations } from "./toolboxes/index.js"; /** Interface representing a Beta operations. */ export interface BetaOperations { + agents: BetaAgentsOperations; datasets: BetaDatasetsOperations; skills: BetaSkillsOperations; - toolboxes: BetaToolboxesOperations; schedules: BetaSchedulesOperations; routines: BetaRoutinesOperations; redTeams: BetaRedTeamsOperations; @@ -34,14 +33,13 @@ export interface BetaOperations { insights: BetaInsightsOperations; evaluators: BetaEvaluatorsOperations; evaluationTaxonomies: BetaEvaluationTaxonomiesOperations; - agents: BetaAgentsOperations; } export function _getBetaOperations(context: AIProjectContext): BetaOperations { return { + agents: _getBetaAgentsOperations(context), datasets: _getBetaDatasetsOperations(context), skills: _getBetaSkillsOperations(context), - toolboxes: _getBetaToolboxesOperations(context), schedules: _getBetaSchedulesOperations(context), routines: _getBetaRoutinesOperations(context), redTeams: _getBetaRedTeamsOperations(context), @@ -50,6 +48,5 @@ export function _getBetaOperations(context: AIProjectContext): BetaOperations { insights: _getBetaInsightsOperations(context), evaluators: _getBetaEvaluatorsOperations(context), evaluationTaxonomies: _getBetaEvaluationTaxonomiesOperations(context), - agents: _getBetaAgentsOperations(context), }; } diff --git a/sdk/ai/ai-projects/generated/classic/beta/models/index.ts b/sdk/ai/ai-projects/generated/classic/beta/models/index.ts index 6c14c7696332..1e7cda0947bf 100644 --- a/sdk/ai/ai-projects/generated/classic/beta/models/index.ts +++ b/sdk/ai/ai-projects/generated/classic/beta/models/index.ts @@ -61,7 +61,7 @@ export interface BetaModelsOperations { location?: string; operationResult?: string | null; }>; - /** Update an existing ModelVersion with the given version id */ + /** Updates an existing model version identified by its version ID. */ update: ( name: string, modelVersionUpdate: UpdateModelVersionRequest, @@ -69,7 +69,7 @@ export interface BetaModelsOperations { foundryFeatures: "Models=V1Preview", options?: BetaModelsUpdateOptionalParams, ) => Promise; - /** Delete the specific version of the ModelVersion. The service returns 200 OK if the ModelVersion was deleted successfully or if the ModelVersion does not exist. */ + /** Removes the specified model version. Returns 200 whether the version existed or not. */ /** * @fixme delete is a reserved word that cannot be used as an operation name. * Please add @clientName("clientName") or @clientName("", "javascript") diff --git a/sdk/ai/ai-projects/generated/classic/beta/toolboxes/index.ts b/sdk/ai/ai-projects/generated/classic/beta/toolboxes/index.ts deleted file mode 100644 index fd4e719376aa..000000000000 --- a/sdk/ai/ai-projects/generated/classic/beta/toolboxes/index.ts +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { AIProjectContext } from "../../../api/aiProjectContext.js"; -import { - deleteVersion, - $delete, - update, - getVersion, - listVersions, - list, - get, - createVersion, -} from "../../../api/beta/toolboxes/operations.js"; -import { - DeleteVersionOptionalParams, - BetaToolboxesDeleteOptionalParams, - BetaToolboxesUpdateOptionalParams, - GetVersionOptionalParams, - ListVersionsOptionalParams, - BetaToolboxesListOptionalParams, - BetaToolboxesGetOptionalParams, - CreateVersionOptionalParams, -} from "../../../api/beta/toolboxes/options.js"; -import { ToolUnion, ToolboxVersionObject, ToolboxObject } from "../../../models/models.js"; -import { PagedAsyncIterableIterator } from "../../../static-helpers/pagingHelpers.js"; - -/** Interface representing a BetaToolboxes operations. */ -export interface BetaToolboxesOperations { - /** Removes the specified version of a toolbox. */ - deleteVersion: ( - name: string, - version: string, - foundryFeatures: "Toolboxes=V1Preview", - options?: DeleteVersionOptionalParams, - ) => Promise; - /** Removes the specified toolbox along with all of its versions. */ - /** - * @fixme delete is a reserved word that cannot be used as an operation name. - * Please add @clientName("clientName") or @clientName("", "javascript") - * to the operation to override the generated name. - */ - delete: ( - name: string, - foundryFeatures: "Toolboxes=V1Preview", - options?: BetaToolboxesDeleteOptionalParams, - ) => Promise; - /** Updates the toolbox's default version pointer to the specified version. */ - update: ( - name: string, - defaultVersion: string, - foundryFeatures: "Toolboxes=V1Preview", - options?: BetaToolboxesUpdateOptionalParams, - ) => Promise; - /** Retrieves the specified version of a toolbox by name and version identifier. */ - getVersion: ( - name: string, - version: string, - foundryFeatures: "Toolboxes=V1Preview", - options?: GetVersionOptionalParams, - ) => Promise; - /** Returns the available versions for the specified toolbox. */ - listVersions: ( - name: string, - foundryFeatures: "Toolboxes=V1Preview", - options?: ListVersionsOptionalParams, - ) => PagedAsyncIterableIterator; - /** Returns the toolboxes available in the current project. */ - list: ( - foundryFeatures: "Toolboxes=V1Preview", - options?: BetaToolboxesListOptionalParams, - ) => PagedAsyncIterableIterator; - /** Retrieves the specified toolbox and its current configuration. */ - get: ( - name: string, - foundryFeatures: "Toolboxes=V1Preview", - options?: BetaToolboxesGetOptionalParams, - ) => Promise; - /** Creates a new toolbox version, provisioning the toolbox itself if it does not already exist. */ - createVersion: ( - name: string, - tools: ToolUnion[], - foundryFeatures: "Toolboxes=V1Preview", - options?: CreateVersionOptionalParams, - ) => Promise; -} - -function _getBetaToolboxes(context: AIProjectContext) { - return { - deleteVersion: ( - name: string, - version: string, - foundryFeatures: "Toolboxes=V1Preview", - options?: DeleteVersionOptionalParams, - ) => deleteVersion(context, name, version, foundryFeatures, options), - delete: ( - name: string, - foundryFeatures: "Toolboxes=V1Preview", - options?: BetaToolboxesDeleteOptionalParams, - ) => $delete(context, name, foundryFeatures, options), - update: ( - name: string, - defaultVersion: string, - foundryFeatures: "Toolboxes=V1Preview", - options?: BetaToolboxesUpdateOptionalParams, - ) => update(context, name, defaultVersion, foundryFeatures, options), - getVersion: ( - name: string, - version: string, - foundryFeatures: "Toolboxes=V1Preview", - options?: GetVersionOptionalParams, - ) => getVersion(context, name, version, foundryFeatures, options), - listVersions: ( - name: string, - foundryFeatures: "Toolboxes=V1Preview", - options?: ListVersionsOptionalParams, - ) => listVersions(context, name, foundryFeatures, options), - list: (foundryFeatures: "Toolboxes=V1Preview", options?: BetaToolboxesListOptionalParams) => - list(context, foundryFeatures, options), - get: ( - name: string, - foundryFeatures: "Toolboxes=V1Preview", - options?: BetaToolboxesGetOptionalParams, - ) => get(context, name, foundryFeatures, options), - createVersion: ( - name: string, - tools: ToolUnion[], - foundryFeatures: "Toolboxes=V1Preview", - options?: CreateVersionOptionalParams, - ) => createVersion(context, name, tools, foundryFeatures, options), - }; -} - -export function _getBetaToolboxesOperations(context: AIProjectContext): BetaToolboxesOperations { - return { - ..._getBetaToolboxes(context), - }; -} diff --git a/sdk/ai/ai-projects/generated/classic/datasets/index.ts b/sdk/ai/ai-projects/generated/classic/datasets/index.ts index 368b9bac8c1e..ae2ba8729233 100644 --- a/sdk/ai/ai-projects/generated/classic/datasets/index.ts +++ b/sdk/ai/ai-projects/generated/classic/datasets/index.ts @@ -30,7 +30,7 @@ import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.j /** Interface representing a Datasets operations. */ export interface DatasetsOperations { - /** Gets the SAS credential to access the storage account associated with a Dataset version. */ + /** Retrieves the SAS credential to access the storage account associated with a dataset version. */ getCredentials: ( name: string, version: string, diff --git a/sdk/ai/ai-projects/generated/classic/deployments/index.ts b/sdk/ai/ai-projects/generated/classic/deployments/index.ts index b5ff7352c787..24d87f2ad305 100644 --- a/sdk/ai/ai-projects/generated/classic/deployments/index.ts +++ b/sdk/ai/ai-projects/generated/classic/deployments/index.ts @@ -14,7 +14,7 @@ import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.j export interface DeploymentsOperations { /** Returns the deployed models available in the current project, optionally filtered by publisher, model name, or deployment type. */ list: (options?: DeploymentsListOptionalParams) => PagedAsyncIterableIterator; - /** Gets a deployed model. */ + /** Retrieves a deployed model. */ get: (name: string, options?: DeploymentsGetOptionalParams) => Promise; } diff --git a/sdk/ai/ai-projects/generated/classic/index.ts b/sdk/ai/ai-projects/generated/classic/index.ts index 59f76fc29c69..55c1f2a9f33b 100644 --- a/sdk/ai/ai-projects/generated/classic/index.ts +++ b/sdk/ai/ai-projects/generated/classic/index.ts @@ -8,6 +8,7 @@ export type { DatasetsOperations } from "./datasets/index.js"; export type { DeploymentsOperations } from "./deployments/index.js"; export type { EvaluationRulesOperations } from "./evaluationRules/index.js"; export type { IndexesOperations } from "./indexes/index.js"; +export type { ToolboxesOperations } from "./toolboxes/index.js"; export type { BetaAgentsOperations } from "./beta/agents/index.js"; export type { BetaDatasetsOperations } from "./beta/datasets/index.js"; export type { BetaEvaluationTaxonomiesOperations } from "./beta/evaluationTaxonomies/index.js"; @@ -19,4 +20,3 @@ export type { BetaRedTeamsOperations } from "./beta/redTeams/index.js"; export type { BetaRoutinesOperations } from "./beta/routines/index.js"; export type { BetaSchedulesOperations } from "./beta/schedules/index.js"; export type { BetaSkillsOperations } from "./beta/skills/index.js"; -export type { BetaToolboxesOperations } from "./beta/toolboxes/index.js"; diff --git a/sdk/ai/ai-projects/generated/classic/toolboxes/index.ts b/sdk/ai/ai-projects/generated/classic/toolboxes/index.ts new file mode 100644 index 000000000000..4b9c58383edf --- /dev/null +++ b/sdk/ai/ai-projects/generated/classic/toolboxes/index.ts @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AIProjectContext } from "../../api/aiProjectContext.js"; +import { + deleteVersion, + $delete, + update, + getVersion, + listVersions, + list, + get, + createVersion, +} from "../../api/toolboxes/operations.js"; +import { + DeleteVersionOptionalParams, + ToolboxesDeleteOptionalParams, + ToolboxesUpdateOptionalParams, + GetVersionOptionalParams, + ListVersionsOptionalParams, + ToolboxesListOptionalParams, + ToolboxesGetOptionalParams, + CreateVersionOptionalParams, +} from "../../api/toolboxes/options.js"; +import { ToolboxToolUnion, ToolboxVersionObject, ToolboxObject } from "../../models/models.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; + +/** Interface representing a Toolboxes operations. */ +export interface ToolboxesOperations { + /** Removes the specified version of a toolbox. */ + deleteVersion: ( + name: string, + version: string, + options?: DeleteVersionOptionalParams, + ) => Promise; + /** Removes the specified toolbox along with all of its versions. */ + /** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ + delete: (name: string, options?: ToolboxesDeleteOptionalParams) => Promise; + /** Updates the toolbox's default version pointer to the specified version. */ + update: ( + name: string, + defaultVersion: string, + options?: ToolboxesUpdateOptionalParams, + ) => Promise; + /** Retrieves the specified version of a toolbox by name and version identifier. */ + getVersion: ( + name: string, + version: string, + options?: GetVersionOptionalParams, + ) => Promise; + /** Returns the available versions for the specified toolbox. */ + listVersions: ( + name: string, + options?: ListVersionsOptionalParams, + ) => PagedAsyncIterableIterator; + /** Returns the toolboxes available in the current project. */ + list: (options?: ToolboxesListOptionalParams) => PagedAsyncIterableIterator; + /** Retrieves the specified toolbox and its current configuration. */ + get: (name: string, options?: ToolboxesGetOptionalParams) => Promise; + /** Creates a new toolbox version, provisioning the toolbox itself if it does not already exist. */ + createVersion: ( + name: string, + tools: ToolboxToolUnion[], + options?: CreateVersionOptionalParams, + ) => Promise; +} + +function _getToolboxes(context: AIProjectContext) { + return { + deleteVersion: (name: string, version: string, options?: DeleteVersionOptionalParams) => + deleteVersion(context, name, version, options), + delete: (name: string, options?: ToolboxesDeleteOptionalParams) => + $delete(context, name, options), + update: (name: string, defaultVersion: string, options?: ToolboxesUpdateOptionalParams) => + update(context, name, defaultVersion, options), + getVersion: (name: string, version: string, options?: GetVersionOptionalParams) => + getVersion(context, name, version, options), + listVersions: (name: string, options?: ListVersionsOptionalParams) => + listVersions(context, name, options), + list: (options?: ToolboxesListOptionalParams) => list(context, options), + get: (name: string, options?: ToolboxesGetOptionalParams) => get(context, name, options), + createVersion: ( + name: string, + tools: ToolboxToolUnion[], + options?: CreateVersionOptionalParams, + ) => createVersion(context, name, tools, options), + }; +} + +export function _getToolboxesOperations(context: AIProjectContext): ToolboxesOperations { + return { + ..._getToolboxes(context), + }; +} diff --git a/sdk/ai/ai-projects/generated/index.ts b/sdk/ai/ai-projects/generated/index.ts index b74a63e6f8a8..f950def3ff12 100644 --- a/sdk/ai/ai-projects/generated/index.ts +++ b/sdk/ai/ai-projects/generated/index.ts @@ -14,12 +14,32 @@ export type { RestorePollerOptions } from "./restorePollerHelpers.js"; export { restorePoller } from "./restorePollerHelpers.js"; export type { Agent, + AgentState, AgentVersion, AgentDefinition, AgentDefinitionUnion, AgentKind, RaiConfig, HostedAgentDefinition, + ContainerConfiguration, + ProtocolVersionRecord, + AgentEndpointProtocol, + CodeConfiguration, + CodeDependencyResolution, + TelemetryConfig, + TelemetryEndpoint, + TelemetryEndpointUnion, + TelemetryEndpointKind, + TelemetryDataKind, + TelemetryEndpointAuth, + TelemetryEndpointAuthUnion, + TelemetryEndpointAuthType, + HeaderTelemetryEndpointAuth, + OtlpTelemetryEndpoint, + TelemetryTransportProtocol, + PromptAgentDefinition, + Reasoning, + ReasoningEffort, Tool, ToolUnion, ToolType, @@ -65,7 +85,6 @@ export type { MCPToolFilter, MemorySearchPreviewTool, MemorySearchOptions, - ToolboxSearchPreviewTool, CodeInterpreterTool, AutoCodeInterpreterToolParam, ContainerMemoryLimit, @@ -75,7 +94,6 @@ export type { ContainerNetworkPolicyDisabledParam, ContainerNetworkPolicyAllowlistParam, ContainerNetworkPolicyDomainSecretParam, - FunctionTool, FileSearchTool, RankingOptions, RankerVersionType, @@ -83,13 +101,14 @@ export type { Filters, ComparisonFilter, CompoundFilter, - ComputerUsePreviewTool, - ComputerEnvironment, WebSearchTool, WebSearchToolFilters, WebSearchApproximateLocation, WebSearchConfiguration, MCPTool, + FunctionTool, + ComputerUsePreviewTool, + ComputerEnvironment, ImageGenTool, InputFidelity, ImageGenToolInputImageMask, @@ -127,25 +146,6 @@ export type { EmptyModelParam, ToolSearchToolParam, ToolSearchExecutionType, - ContainerConfiguration, - ProtocolVersionRecord, - AgentProtocol, - CodeConfiguration, - CodeDependencyResolution, - TelemetryConfig, - TelemetryEndpoint, - TelemetryEndpointUnion, - TelemetryEndpointKind, - TelemetryDataKind, - TelemetryEndpointAuth, - TelemetryEndpointAuthUnion, - TelemetryEndpointAuthType, - HeaderTelemetryEndpointAuth, - OtlpTelemetryEndpoint, - TelemetryTransportProtocol, - PromptAgentDefinition, - Reasoning, - ReasoningEffort, ToolChoiceParam, ToolChoiceParamUnion, ToolChoiceParamType, @@ -185,24 +185,38 @@ export type { VersionSelectionRuleUnion, VersionSelectorType, FixedRatioVersionSelectionRule, - AgentEndpointProtocol, + ProtocolConfiguration, + ActivityProtocolConfiguration, + ResponsesProtocolConfiguration, + A2AProtocolConfiguration, + McpProtocolConfiguration, + InvocationsProtocolConfiguration, + InvocationsWsProtocolConfiguration, AgentEndpointAuthorizationScheme, AgentEndpointAuthorizationSchemeUnion, AgentEndpointAuthorizationSchemeType, EntraAuthorizationScheme, - IsolationKeySource, - IsolationKeySourceUnion, - IsolationKeySourceKind, - EntraIsolationKeySource, - HeaderIsolationKeySource, BotServiceAuthorizationScheme, BotServiceRbacAuthorizationScheme, + BotServiceTenantAuthorizationScheme, AgentCard, AgentCardSkill, ApiErrorResponse, ApiError, DeleteAgentResponse, DeleteAgentVersionResponse, + CreateAgentVersionFromCodeContent, + CreateAgentVersionFromCodeMetadata, + VersionIndicator, + VersionIndicatorUnion, + VersionIndicatorType, + VersionRefIndicator, + AgentSessionResource, + AgentSessionStatus, + SessionLogEvent, + SessionLogEventType, + SessionFileWriteResponse, + SessionDirectoryEntry, EvaluationRule, EvaluationRuleAction, EvaluationRuleActionUnion, @@ -245,38 +259,27 @@ export type { ManagedAzureAISearchIndex, CosmosDBIndex, EmbeddingConfiguration, - CreateAgentVersionFromCodeContent, - CreateAgentVersionFromCodeMetadata, - VersionIndicator, - VersionIndicatorUnion, - VersionIndicatorType, - VersionRefIndicator, - AgentSessionResource, - AgentSessionStatus, - SessionLogEvent, - SessionLogEventType, - SessionFileWriteResponse, - SessionDirectoryEntry, - OptimizationJobInputs, - AgentIdentifier, - DatasetRef, - OptimizationOptions, - EvaluationLevel, - OptimizationJob, - JobStatus, - OptimizationJobResult, - OptimizationCandidate, - OptimizationAgentDefinition, - OptimizationTaskResult, - PromotionInfo, - OptimizationJobProgress, - DatasetInfo, - CandidateMetadata, - CandidateFileInfo, - CandidateDeployConfig, - CandidateResults, - PromoteCandidateRequest, - PromoteCandidateResponse, + ToolboxTool, + ToolboxToolUnion, + ToolboxToolType, + CodeInterpreterToolboxTool, + FileSearchToolboxTool, + WebSearchToolboxTool, + MCPToolboxTool, + AzureAISearchToolboxTool, + OpenApiToolboxTool, + A2APreviewToolboxTool, + BrowserAutomationPreviewToolboxTool, + ReminderPreviewToolboxTool, + WorkIQPreviewToolboxTool, + FabricIQPreviewToolboxTool, + ToolboxSearchPreviewToolboxTool, + ToolboxSkill, + ToolboxSkillUnion, + ToolboxSkillReference, + ToolboxPolicies, + ToolboxVersionObject, + ToolboxObject, EvaluationTaxonomy, EvaluationTaxonomyInput, EvaluationTaxonomyInputUnion, @@ -294,6 +297,7 @@ export type { EvaluatorVersion, EvaluatorType, EvaluatorCategory, + EvaluationLevel, EvaluatorDefinition, EvaluatorDefinitionUnion, EvaluatorDefinitionType, @@ -304,6 +308,7 @@ export type { PromptBasedEvaluatorDefinition, RubricBasedEvaluatorDefinition, Dimension, + EndpointBasedEvaluatorDefinition, EvaluatorGenerationArtifacts, DatasetReference, EvaluatorCredentialRequest, @@ -316,6 +321,7 @@ export type { AgentEvaluatorGenerationJobSource, TracesEvaluatorGenerationJobSource, DatasetEvaluatorGenerationJobSource, + JobStatus, EvaluatorGenerationTokenUsage, Insight, InsightsMetadata, @@ -372,7 +378,6 @@ export type { MemoryStoreDeleteScopeResponse, DeleteMemoryResponse, ModelVersion, - SystemDataV3, FoundryModelWeightType, ModelSourceData, FoundryModelSourceType, @@ -406,6 +411,7 @@ export type { InvokeAgentInvocationsApiRoutineAction, Routine, RoutineRun, + RoutineRunStatus, RoutineRunPhase, RoutineAttemptSource, RoutineDispatchPayload, @@ -436,12 +442,6 @@ export type { EvaluationScheduleTask, InsightScheduleTask, ScheduleRun, - ToolboxSkill, - ToolboxSkillUnion, - ToolboxSkillReference, - ToolboxPolicies, - ToolboxVersionObject, - ToolboxObject, Skill, DeleteSkillResponse, SkillInlineContent, @@ -474,6 +474,23 @@ export type { FileDataGenerationJobOutput, DatasetDataGenerationJobOutput, DataGenerationTokenUsage, + OptimizationJob, + OptimizationJobInputs, + OptimizationAgentIdentifier, + OptimizationDatasetInput, + OptimizationDatasetInputUnion, + OptimizationDatasetInputType, + OptimizationInlineDatasetInput, + OptimizationDatasetItem, + OptimizationDatasetCriterion, + OptimizationReferenceDatasetInput, + OptimizationEvaluatorRef, + OptimizationOptions, + OptimizationJobResult, + OptimizationCandidate, + PromotionInfo, + OptimizationJobProgress, + OptimizationJobListItem, UpdateToolboxRequest, AgentObjectType, AgentDefinitionOptInKeys, @@ -481,15 +498,29 @@ export type { FoundryFeaturesOptInKeys, PendingUploadType, MemoryStoreObjectType, + AgentsDownloadSessionFileResponse, + AgentsDownloadAgentCodeResponse, DownloadVersionResponse, BetaSkillsDownloadResponse, - BetaAgentsGetCandidateFileResponse, - BetaAgentsDownloadSessionFileResponse, - BetaAgentsDownloadAgentCodeResponse, } from "./models/index.js"; export { KnownVersions } from "./models/index.js"; export type { AIProjectClientOptionalParams } from "./api/index.js"; export type { + AgentsDeleteSessionFileOptionalParams, + AgentsListSessionFilesOptionalParams, + AgentsDownloadSessionFileOptionalParams, + AgentsUploadSessionFileOptionalParams, + AgentsGetSessionLogStreamOptionalParams, + AgentsListSessionsOptionalParams, + AgentsStopSessionOptionalParams, + AgentsDeleteSessionOptionalParams, + AgentsGetSessionOptionalParams, + AgentsCreateSessionOptionalParams, + AgentsDisableOptionalParams, + AgentsEnableOptionalParams, + AgentsDownloadAgentCodeOptionalParams, + AgentsCreateVersionFromCodeOptionalParams, + AgentsPatchAgentObjectOptionalParams, AgentsListVersionsOptionalParams, AgentsDeleteVersionOptionalParams, AgentsGetVersionOptionalParams, @@ -535,30 +566,21 @@ export type { IndexesListVersionsOptionalParams, } from "./api/indexes/index.js"; export type { - BetaAgentsPromoteCandidateOptionalParams, - BetaAgentsGetCandidateFileOptionalParams, - BetaAgentsGetOptimizationCandidateResultsOptionalParams, - BetaAgentsGetOptimizationCandidateConfigOptionalParams, - BetaAgentsGetOptimizationCandidateOptionalParams, - BetaAgentsListOptimizationCandidatesOptionalParams, + DeleteVersionOptionalParams, + ToolboxesDeleteOptionalParams, + ToolboxesUpdateOptionalParams, + GetVersionOptionalParams, + ListVersionsOptionalParams, + ToolboxesListOptionalParams, + ToolboxesGetOptionalParams, + CreateVersionOptionalParams, +} from "./api/toolboxes/index.js"; +export type { BetaAgentsDeleteOptimizationJobOptionalParams, BetaAgentsCancelOptimizationJobOptionalParams, BetaAgentsListOptimizationJobsOptionalParams, BetaAgentsGetOptimizationJobOptionalParams, BetaAgentsCreateOptimizationJobOptionalParams, - BetaAgentsDeleteSessionFileOptionalParams, - BetaAgentsListSessionFilesOptionalParams, - BetaAgentsDownloadSessionFileOptionalParams, - BetaAgentsUploadSessionFileOptionalParams, - BetaAgentsGetSessionLogStreamOptionalParams, - BetaAgentsListSessionsOptionalParams, - BetaAgentsStopSessionOptionalParams, - BetaAgentsDeleteSessionOptionalParams, - BetaAgentsGetSessionOptionalParams, - BetaAgentsCreateSessionOptionalParams, - BetaAgentsDownloadAgentCodeOptionalParams, - BetaAgentsCreateVersionFromCodeOptionalParams, - BetaAgentsPatchAgentObjectOptionalParams, } from "./api/beta/agents/index.js"; export type { BetaDatasetsDeleteGenerationJobOptionalParams, @@ -644,11 +666,11 @@ export type { BetaSchedulesDeleteOptionalParams, } from "./api/beta/schedules/index.js"; export type { - DeleteVersionOptionalParams, + DeleteVersionOptionalParams as AIProjectClientDeleteVersionOptionalParams, DownloadVersionOptionalParams, BetaSkillsDownloadOptionalParams, - GetVersionOptionalParams, - ListVersionsOptionalParams, + GetVersionOptionalParams as AIProjectClientGetVersionOptionalParams, + ListVersionsOptionalParams as AIProjectClientListVersionsOptionalParams, CreateFromFilesOptionalParams, BetaSkillsCreateOptionalParams, BetaSkillsDeleteOptionalParams, @@ -656,16 +678,6 @@ export type { BetaSkillsListOptionalParams, BetaSkillsGetOptionalParams, } from "./api/beta/skills/index.js"; -export type { - DeleteVersionOptionalParams as AIProjectClientDeleteVersionOptionalParams, - BetaToolboxesDeleteOptionalParams, - BetaToolboxesUpdateOptionalParams, - GetVersionOptionalParams as AIProjectClientGetVersionOptionalParams, - ListVersionsOptionalParams as AIProjectClientListVersionsOptionalParams, - BetaToolboxesListOptionalParams, - BetaToolboxesGetOptionalParams, - CreateVersionOptionalParams, -} from "./api/beta/toolboxes/index.js"; export type { AgentsOperations, BetaOperations, @@ -674,6 +686,7 @@ export type { DeploymentsOperations, EvaluationRulesOperations, IndexesOperations, + ToolboxesOperations, BetaAgentsOperations, BetaDatasetsOperations, BetaEvaluationTaxonomiesOperations, @@ -685,7 +698,6 @@ export type { BetaRoutinesOperations, BetaSchedulesOperations, BetaSkillsOperations, - BetaToolboxesOperations, } from "./classic/index.js"; export type { PageSettings, ContinuablePage, PagedAsyncIterableIterator }; export type { FileContents, NodeReadableStream }; diff --git a/sdk/ai/ai-projects/generated/models/index.ts b/sdk/ai/ai-projects/generated/models/index.ts index 14e47c5096f1..a4038f53c5c4 100644 --- a/sdk/ai/ai-projects/generated/models/index.ts +++ b/sdk/ai/ai-projects/generated/models/index.ts @@ -3,12 +3,32 @@ export type { Agent, + AgentState, AgentVersion, AgentDefinition, AgentDefinitionUnion, AgentKind, RaiConfig, HostedAgentDefinition, + ContainerConfiguration, + ProtocolVersionRecord, + AgentEndpointProtocol, + CodeConfiguration, + CodeDependencyResolution, + TelemetryConfig, + TelemetryEndpoint, + TelemetryEndpointUnion, + TelemetryEndpointKind, + TelemetryDataKind, + TelemetryEndpointAuth, + TelemetryEndpointAuthUnion, + TelemetryEndpointAuthType, + HeaderTelemetryEndpointAuth, + OtlpTelemetryEndpoint, + TelemetryTransportProtocol, + PromptAgentDefinition, + Reasoning, + ReasoningEffort, Tool, ToolUnion, ToolType, @@ -54,7 +74,6 @@ export type { MCPToolFilter, MemorySearchPreviewTool, MemorySearchOptions, - ToolboxSearchPreviewTool, CodeInterpreterTool, AutoCodeInterpreterToolParam, ContainerMemoryLimit, @@ -64,7 +83,6 @@ export type { ContainerNetworkPolicyDisabledParam, ContainerNetworkPolicyAllowlistParam, ContainerNetworkPolicyDomainSecretParam, - FunctionTool, FileSearchTool, RankingOptions, RankerVersionType, @@ -72,13 +90,14 @@ export type { Filters, ComparisonFilter, CompoundFilter, - ComputerUsePreviewTool, - ComputerEnvironment, WebSearchTool, WebSearchToolFilters, WebSearchApproximateLocation, WebSearchConfiguration, MCPTool, + FunctionTool, + ComputerUsePreviewTool, + ComputerEnvironment, ImageGenTool, InputFidelity, ImageGenToolInputImageMask, @@ -116,25 +135,6 @@ export type { EmptyModelParam, ToolSearchToolParam, ToolSearchExecutionType, - ContainerConfiguration, - ProtocolVersionRecord, - AgentProtocol, - CodeConfiguration, - CodeDependencyResolution, - TelemetryConfig, - TelemetryEndpoint, - TelemetryEndpointUnion, - TelemetryEndpointKind, - TelemetryDataKind, - TelemetryEndpointAuth, - TelemetryEndpointAuthUnion, - TelemetryEndpointAuthType, - HeaderTelemetryEndpointAuth, - OtlpTelemetryEndpoint, - TelemetryTransportProtocol, - PromptAgentDefinition, - Reasoning, - ReasoningEffort, ToolChoiceParam, ToolChoiceParamUnion, ToolChoiceParamType, @@ -174,24 +174,38 @@ export type { VersionSelectionRuleUnion, VersionSelectorType, FixedRatioVersionSelectionRule, - AgentEndpointProtocol, + ProtocolConfiguration, + ActivityProtocolConfiguration, + ResponsesProtocolConfiguration, + A2AProtocolConfiguration, + McpProtocolConfiguration, + InvocationsProtocolConfiguration, + InvocationsWsProtocolConfiguration, AgentEndpointAuthorizationScheme, AgentEndpointAuthorizationSchemeUnion, AgentEndpointAuthorizationSchemeType, EntraAuthorizationScheme, - IsolationKeySource, - IsolationKeySourceUnion, - IsolationKeySourceKind, - EntraIsolationKeySource, - HeaderIsolationKeySource, BotServiceAuthorizationScheme, BotServiceRbacAuthorizationScheme, + BotServiceTenantAuthorizationScheme, AgentCard, AgentCardSkill, ApiErrorResponse, ApiError, DeleteAgentResponse, DeleteAgentVersionResponse, + CreateAgentVersionFromCodeContent, + CreateAgentVersionFromCodeMetadata, + VersionIndicator, + VersionIndicatorUnion, + VersionIndicatorType, + VersionRefIndicator, + AgentSessionResource, + AgentSessionStatus, + SessionLogEvent, + SessionLogEventType, + SessionFileWriteResponse, + SessionDirectoryEntry, EvaluationRule, EvaluationRuleAction, EvaluationRuleActionUnion, @@ -234,38 +248,27 @@ export type { ManagedAzureAISearchIndex, CosmosDBIndex, EmbeddingConfiguration, - CreateAgentVersionFromCodeContent, - CreateAgentVersionFromCodeMetadata, - VersionIndicator, - VersionIndicatorUnion, - VersionIndicatorType, - VersionRefIndicator, - AgentSessionResource, - AgentSessionStatus, - SessionLogEvent, - SessionLogEventType, - SessionFileWriteResponse, - SessionDirectoryEntry, - OptimizationJobInputs, - AgentIdentifier, - DatasetRef, - OptimizationOptions, - EvaluationLevel, - OptimizationJob, - JobStatus, - OptimizationJobResult, - OptimizationCandidate, - OptimizationAgentDefinition, - OptimizationTaskResult, - PromotionInfo, - OptimizationJobProgress, - DatasetInfo, - CandidateMetadata, - CandidateFileInfo, - CandidateDeployConfig, - CandidateResults, - PromoteCandidateRequest, - PromoteCandidateResponse, + ToolboxTool, + ToolboxToolUnion, + ToolboxToolType, + CodeInterpreterToolboxTool, + FileSearchToolboxTool, + WebSearchToolboxTool, + MCPToolboxTool, + AzureAISearchToolboxTool, + OpenApiToolboxTool, + A2APreviewToolboxTool, + BrowserAutomationPreviewToolboxTool, + ReminderPreviewToolboxTool, + WorkIQPreviewToolboxTool, + FabricIQPreviewToolboxTool, + ToolboxSearchPreviewToolboxTool, + ToolboxSkill, + ToolboxSkillUnion, + ToolboxSkillReference, + ToolboxPolicies, + ToolboxVersionObject, + ToolboxObject, EvaluationTaxonomy, EvaluationTaxonomyInput, EvaluationTaxonomyInputUnion, @@ -283,6 +286,7 @@ export type { EvaluatorVersion, EvaluatorType, EvaluatorCategory, + EvaluationLevel, EvaluatorDefinition, EvaluatorDefinitionUnion, EvaluatorDefinitionType, @@ -293,6 +297,7 @@ export type { PromptBasedEvaluatorDefinition, RubricBasedEvaluatorDefinition, Dimension, + EndpointBasedEvaluatorDefinition, EvaluatorGenerationArtifacts, DatasetReference, EvaluatorCredentialRequest, @@ -305,6 +310,7 @@ export type { AgentEvaluatorGenerationJobSource, TracesEvaluatorGenerationJobSource, DatasetEvaluatorGenerationJobSource, + JobStatus, EvaluatorGenerationTokenUsage, Insight, InsightsMetadata, @@ -361,7 +367,6 @@ export type { MemoryStoreDeleteScopeResponse, DeleteMemoryResponse, ModelVersion, - SystemDataV3, FoundryModelWeightType, ModelSourceData, FoundryModelSourceType, @@ -395,6 +400,7 @@ export type { InvokeAgentInvocationsApiRoutineAction, Routine, RoutineRun, + RoutineRunStatus, RoutineRunPhase, RoutineAttemptSource, RoutineDispatchPayload, @@ -425,12 +431,6 @@ export type { EvaluationScheduleTask, InsightScheduleTask, ScheduleRun, - ToolboxSkill, - ToolboxSkillUnion, - ToolboxSkillReference, - ToolboxPolicies, - ToolboxVersionObject, - ToolboxObject, Skill, DeleteSkillResponse, SkillInlineContent, @@ -463,6 +463,23 @@ export type { FileDataGenerationJobOutput, DatasetDataGenerationJobOutput, DataGenerationTokenUsage, + OptimizationJob, + OptimizationJobInputs, + OptimizationAgentIdentifier, + OptimizationDatasetInput, + OptimizationDatasetInputUnion, + OptimizationDatasetInputType, + OptimizationInlineDatasetInput, + OptimizationDatasetItem, + OptimizationDatasetCriterion, + OptimizationReferenceDatasetInput, + OptimizationEvaluatorRef, + OptimizationOptions, + OptimizationJobResult, + OptimizationCandidate, + PromotionInfo, + OptimizationJobProgress, + OptimizationJobListItem, UpdateToolboxRequest, AgentObjectType, AgentDefinitionOptInKeys, @@ -470,10 +487,9 @@ export type { FoundryFeaturesOptInKeys, PendingUploadType, MemoryStoreObjectType, + AgentsDownloadSessionFileResponse, + AgentsDownloadAgentCodeResponse, DownloadVersionResponse, BetaSkillsDownloadResponse, - BetaAgentsGetCandidateFileResponse, - BetaAgentsDownloadSessionFileResponse, - BetaAgentsDownloadAgentCodeResponse, } from "./models.js"; export { KnownVersions } from "./models.js"; diff --git a/sdk/ai/ai-projects/generated/models/models.ts b/sdk/ai/ai-projects/generated/models/models.ts index 1af64c73625d..977686637fe9 100644 --- a/sdk/ai/ai-projects/generated/models/models.ts +++ b/sdk/ai/ai-projects/generated/models/models.ts @@ -19,6 +19,8 @@ export interface Agent { id: string; /** The name of the agent. */ name: string; + /** The operational state of the agent. Controls whether the agent endpoint accepts or rejects requests. */ + readonly state: AgentState; /** The latest version of the agent. */ versions: { latest: AgentVersion; @@ -39,6 +41,7 @@ export function agentDeserializer(item: any): Agent { object: item["object"], id: item["id"], name: item["name"], + state: item["state"], versions: _agentObjectVersionsDeserializer(item["versions"]), agent_endpoint: !item["agent_endpoint"] ? item["agent_endpoint"] @@ -58,6 +61,9 @@ export function agentDeserializer(item: any): Agent { }; } +/** The operational state of an agent. */ +export type AgentState = "enabled" | "disabled"; + /** model interface _AgentObjectVersions */ export interface _AgentObjectVersions { latest: AgentVersion; @@ -93,6 +99,8 @@ export interface AgentVersion { /** The Unix timestamp (seconds) when the agent was created. */ created_at: Date; definition: AgentDefinitionUnion; + /** Whether this agent version is a draft (candidate) rather than a release. Draft versions are recorded but excluded from default 'latest' resolution and are not auto-promoted. Defaults to false. */ + draft?: boolean; /** The provisioning status of the agent version. Defaults to 'active' for non-hosted agents. For hosted agents, reflects infrastructure readiness. */ status?: AgentVersionStatus; /** The instance identity of the agent */ @@ -119,6 +127,7 @@ export function agentVersionDeserializer(item: any): AgentVersion { description: item["description"], created_at: new Date(item["created_at"] * 1000), definition: agentDefinitionUnionDeserializer(item["definition"]), + draft: item["draft"], status: item["status"], instance_identity: !item["instance_identity"] ? item["instance_identity"] @@ -224,11 +233,6 @@ export function raiConfigDeserializer(item: any): RaiConfig { /** The hosted agent definition. */ export interface HostedAgentDefinition extends AgentDefinition { kind: "hosted"; - /** - * An array of tools the hosted agent's model may call while generating a response. You - * can specify which tool to use by setting the `tool_choice` parameter. - */ - tools?: ToolUnion[]; /** The CPU configuration for the hosted agent. */ cpu: string; /** The memory configuration for the hosted agent. */ @@ -249,7 +253,6 @@ export function hostedAgentDefinitionSerializer(item: HostedAgentDefinition): an return { kind: item["kind"], rai_config: !item["rai_config"] ? item["rai_config"] : raiConfigSerializer(item["rai_config"]), - tools: !item["tools"] ? item["tools"] : toolUnionArraySerializer(item["tools"]), cpu: item["cpu"], memory: item["memory"], environment_variables: item["environment_variables"], @@ -274,7 +277,6 @@ export function hostedAgentDefinitionDeserializer(item: any): HostedAgentDefinit rai_config: !item["rai_config"] ? item["rai_config"] : raiConfigDeserializer(item["rai_config"]), - tools: !item["tools"] ? item["tools"] : toolUnionArrayDeserializer(item["tools"]), cpu: item["cpu"], memory: item["memory"], environment_variables: !item["environment_variables"] @@ -297,576 +299,711 @@ export function hostedAgentDefinitionDeserializer(item: any): HostedAgentDefinit }; } -export function toolUnionArraySerializer(result: Array): any[] { +/** Container-based deployment configuration for a hosted agent. */ +export interface ContainerConfiguration { + /** The container image for the hosted agent. */ + image: string; +} + +export function containerConfigurationSerializer(item: ContainerConfiguration): any { + return { image: item["image"] }; +} + +export function containerConfigurationDeserializer(item: any): ContainerConfiguration { + return { + image: item["image"], + }; +} + +export function protocolVersionRecordArraySerializer(result: Array): any[] { return result.map((item) => { - return toolUnionSerializer(item); + return protocolVersionRecordSerializer(item); }); } -export function toolUnionArrayDeserializer(result: Array): any[] { +export function protocolVersionRecordArrayDeserializer( + result: Array, +): any[] { return result.map((item) => { - return toolUnionDeserializer(item); + return protocolVersionRecordDeserializer(item); }); } -/** A tool that can be used to generate a response. */ -export interface Tool { - type: ToolType; +/** A record mapping for a single protocol and its version. */ +export interface ProtocolVersionRecord { + /** The protocol type. */ + protocol: AgentEndpointProtocol; + /** The version string for the protocol, e.g. 'v0.1.1'. */ + version: string; } -export function toolSerializer(item: Tool): any { - return { type: item["type"] }; +export function protocolVersionRecordSerializer(item: ProtocolVersionRecord): any { + return { protocol: item["protocol"], version: item["version"] }; } -export function toolDeserializer(item: any): Tool { +export function protocolVersionRecordDeserializer(item: any): ProtocolVersionRecord { return { - type: item["type"], + protocol: item["protocol"], + version: item["version"], }; } -/** Alias for ToolUnion */ -export type ToolUnion = - | BingGroundingTool - | MicrosoftFabricPreviewTool - | SharepointPreviewTool - | AzureAISearchTool - | OpenApiTool - | BingCustomSearchPreviewTool - | BrowserAutomationPreviewTool - | AzureFunctionTool - | CaptureStructuredOutputsTool - | A2APreviewTool - | WorkIQPreviewTool - | FabricIQPreviewTool - | MemorySearchPreviewTool - | ToolboxSearchPreviewTool - | CodeInterpreterTool - | FunctionTool - | FileSearchTool - | ComputerUsePreviewTool - | WebSearchTool - | MCPTool - | ImageGenTool - | LocalShellToolParam - | FunctionShellToolParam - | CustomToolParam - | WebSearchPreviewTool - | ApplyPatchToolParam - | ComputerTool - | NamespaceToolParam - | ToolSearchToolParam - | Tool; +/** Type of AgentEndpointProtocol */ +export type AgentEndpointProtocol = + "activity" | "responses" | "a2a" | "mcp" | "invocations" | "invocations_ws"; -export function toolUnionSerializer(item: ToolUnion): any { - switch (item.type) { - case "bing_grounding": - return bingGroundingToolSerializer(item as BingGroundingTool); +/** Code-based deployment configuration for a hosted agent. */ +export interface CodeConfiguration { + /** The runtime identifier for code execution (e.g., 'python_3_11', 'python_3_12', 'python_3_13'). */ + runtime: string; + /** The entry point command and arguments for the code execution. */ + entry_point: string[]; + /** + * How package dependencies are resolved at deployment time. Defaults to `bundled`, + * where the caller bundles all dependencies into the uploaded zip and the service + * performs no remote build. `remote_build` instructs the service to build + * dependencies remotely from the manifest included in the uploaded zip. + */ + dependency_resolution: CodeDependencyResolution; + /** The SHA-256 hex digest of the uploaded code zip. Set by the service from the `x-ms-code-zip-sha256` request header; read-only in responses and never accepted in request payloads. */ + readonly content_hash?: string; +} - case "fabric_dataagent_preview": - return microsoftFabricPreviewToolSerializer(item as MicrosoftFabricPreviewTool); +export function codeConfigurationSerializer(item: CodeConfiguration): any { + return { + runtime: item["runtime"], + entry_point: item["entry_point"].map((p: any) => { + return p; + }), + dependency_resolution: item["dependency_resolution"], + }; +} - case "sharepoint_grounding_preview": - return sharepointPreviewToolSerializer(item as SharepointPreviewTool); +export function codeConfigurationDeserializer(item: any): CodeConfiguration { + return { + runtime: item["runtime"], + entry_point: item["entry_point"].map((p: any) => { + return p; + }), + dependency_resolution: item["dependency_resolution"], + content_hash: item["content_hash"], + }; +} - case "azure_ai_search": - return azureAISearchToolSerializer(item as AzureAISearchTool); +/** How package dependencies are resolved at deployment time for a code-based hosted agent. */ +export type CodeDependencyResolution = "bundled" | "remote_build"; - case "openapi": - return openApiToolSerializer(item as OpenApiTool); +/** Customer-supplied telemetry configuration for exporting container logs, traces, and metrics. */ +export interface TelemetryConfig { + /** Customer-supplied telemetry export endpoint configurations. */ + endpoints: TelemetryEndpointUnion[]; +} - case "bing_custom_search_preview": - return bingCustomSearchPreviewToolSerializer(item as BingCustomSearchPreviewTool); +export function telemetryConfigSerializer(item: TelemetryConfig): any { + return { endpoints: telemetryEndpointUnionArraySerializer(item["endpoints"]) }; +} - case "browser_automation_preview": - return browserAutomationPreviewToolSerializer(item as BrowserAutomationPreviewTool); +export function telemetryConfigDeserializer(item: any): TelemetryConfig { + return { + endpoints: telemetryEndpointUnionArrayDeserializer(item["endpoints"]), + }; +} - case "azure_function": - return azureFunctionToolSerializer(item as AzureFunctionTool); +export function telemetryEndpointUnionArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return telemetryEndpointUnionSerializer(item); + }); +} - case "capture_structured_outputs": - return captureStructuredOutputsToolSerializer(item as CaptureStructuredOutputsTool); +export function telemetryEndpointUnionArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return telemetryEndpointUnionDeserializer(item); + }); +} - case "a2a_preview": - return a2APreviewToolSerializer(item as A2APreviewTool); +/** A telemetry export endpoint configuration. */ +export interface TelemetryEndpoint { + /** The telemetry export endpoint kind. */ + /** The discriminator possible values: OTLP */ + kind: TelemetryEndpointKind; + /** Data types to export to this endpoint. Use an empty array to export no data. */ + data: TelemetryDataKind[]; + /** Optional authentication configuration. */ + auth?: TelemetryEndpointAuthUnion; +} - case "work_iq_preview": - return workIQPreviewToolSerializer(item as WorkIQPreviewTool); +export function telemetryEndpointSerializer(item: TelemetryEndpoint): any { + return { + kind: item["kind"], + data: item["data"].map((p: any) => { + return p; + }), + auth: !item["auth"] ? item["auth"] : telemetryEndpointAuthUnionSerializer(item["auth"]), + }; +} - case "fabric_iq_preview": - return fabricIQPreviewToolSerializer(item as FabricIQPreviewTool); +export function telemetryEndpointDeserializer(item: any): TelemetryEndpoint { + return { + kind: item["kind"], + data: item["data"].map((p: any) => { + return p; + }), + auth: !item["auth"] ? item["auth"] : telemetryEndpointAuthUnionDeserializer(item["auth"]), + }; +} - case "memory_search_preview": - return memorySearchPreviewToolSerializer(item as MemorySearchPreviewTool); +/** Alias for TelemetryEndpointUnion */ +export type TelemetryEndpointUnion = OtlpTelemetryEndpoint | TelemetryEndpoint; - case "toolbox_search_preview": - return toolboxSearchPreviewToolSerializer(item as ToolboxSearchPreviewTool); +export function telemetryEndpointUnionSerializer(item: TelemetryEndpointUnion): any { + switch (item.kind) { + case "OTLP": + return otlpTelemetryEndpointSerializer(item as OtlpTelemetryEndpoint); - case "code_interpreter": - return codeInterpreterToolSerializer(item as CodeInterpreterTool); + default: + return telemetryEndpointSerializer(item); + } +} - case "function": - return functionToolSerializer(item as FunctionTool); +export function telemetryEndpointUnionDeserializer(item: any): TelemetryEndpointUnion { + switch (item["kind"]) { + case "OTLP": + return otlpTelemetryEndpointDeserializer(item as OtlpTelemetryEndpoint); - case "file_search": - return fileSearchToolSerializer(item as FileSearchTool); + default: + return telemetryEndpointDeserializer(item); + } +} - case "computer_use_preview": - return computerUsePreviewToolSerializer(item as ComputerUsePreviewTool); +/** The kind of telemetry export endpoint. */ +export type TelemetryEndpointKind = "OTLP"; +/** The type of telemetry data to export. */ +export type TelemetryDataKind = "ContainerStdoutStderr" | "ContainerOtel" | "Metrics"; - case "web_search": - return webSearchToolSerializer(item as WebSearchTool); +/** Authentication configuration for a telemetry endpoint. */ +export interface TelemetryEndpointAuth { + /** The authentication type. */ + /** The discriminator possible values: header */ + type: TelemetryEndpointAuthType; +} - case "mcp": - return mcpToolSerializer(item as MCPTool); +export function telemetryEndpointAuthSerializer(item: TelemetryEndpointAuth): any { + return { type: item["type"] }; +} - case "image_generation": - return imageGenToolSerializer(item as ImageGenTool); +export function telemetryEndpointAuthDeserializer(item: any): TelemetryEndpointAuth { + return { + type: item["type"], + }; +} - case "local_shell": - return localShellToolParamSerializer(item as LocalShellToolParam); - - case "shell": - return functionShellToolParamSerializer(item as FunctionShellToolParam); - - case "custom": - return customToolParamSerializer(item as CustomToolParam); - - case "web_search_preview": - return webSearchPreviewToolSerializer(item as WebSearchPreviewTool); - - case "apply_patch": - return applyPatchToolParamSerializer(item as ApplyPatchToolParam); - - case "computer": - return computerToolSerializer(item as ComputerTool); - - case "namespace": - return namespaceToolParamSerializer(item as NamespaceToolParam); +/** Alias for TelemetryEndpointAuthUnion */ +export type TelemetryEndpointAuthUnion = HeaderTelemetryEndpointAuth | TelemetryEndpointAuth; - case "tool_search": - return toolSearchToolParamSerializer(item as ToolSearchToolParam); +export function telemetryEndpointAuthUnionSerializer(item: TelemetryEndpointAuthUnion): any { + switch (item.type) { + case "header": + return headerTelemetryEndpointAuthSerializer(item as HeaderTelemetryEndpointAuth); default: - return toolSerializer(item); + return telemetryEndpointAuthSerializer(item); } } -export function toolUnionDeserializer(item: any): ToolUnion { +export function telemetryEndpointAuthUnionDeserializer(item: any): TelemetryEndpointAuthUnion { switch (item["type"]) { - case "bing_grounding": - return bingGroundingToolDeserializer(item as BingGroundingTool); - - case "fabric_dataagent_preview": - return microsoftFabricPreviewToolDeserializer(item as MicrosoftFabricPreviewTool); - - case "sharepoint_grounding_preview": - return sharepointPreviewToolDeserializer(item as SharepointPreviewTool); - - case "azure_ai_search": - return azureAISearchToolDeserializer(item as AzureAISearchTool); - - case "openapi": - return openApiToolDeserializer(item as OpenApiTool); - - case "bing_custom_search_preview": - return bingCustomSearchPreviewToolDeserializer(item as BingCustomSearchPreviewTool); - - case "browser_automation_preview": - return browserAutomationPreviewToolDeserializer(item as BrowserAutomationPreviewTool); - - case "azure_function": - return azureFunctionToolDeserializer(item as AzureFunctionTool); - - case "capture_structured_outputs": - return captureStructuredOutputsToolDeserializer(item as CaptureStructuredOutputsTool); - - case "a2a_preview": - return a2APreviewToolDeserializer(item as A2APreviewTool); - - case "work_iq_preview": - return workIQPreviewToolDeserializer(item as WorkIQPreviewTool); - - case "fabric_iq_preview": - return fabricIQPreviewToolDeserializer(item as FabricIQPreviewTool); - - case "memory_search_preview": - return memorySearchPreviewToolDeserializer(item as MemorySearchPreviewTool); - - case "toolbox_search_preview": - return toolboxSearchPreviewToolDeserializer(item as ToolboxSearchPreviewTool); - - case "code_interpreter": - return codeInterpreterToolDeserializer(item as CodeInterpreterTool); - - case "function": - return functionToolDeserializer(item as FunctionTool); - - case "file_search": - return fileSearchToolDeserializer(item as FileSearchTool); - - case "computer_use_preview": - return computerUsePreviewToolDeserializer(item as ComputerUsePreviewTool); - - case "web_search": - return webSearchToolDeserializer(item as WebSearchTool); - - case "mcp": - return mcpToolDeserializer(item as MCPTool); - - case "image_generation": - return imageGenToolDeserializer(item as ImageGenTool); - - case "local_shell": - return localShellToolParamDeserializer(item as LocalShellToolParam); - - case "shell": - return functionShellToolParamDeserializer(item as FunctionShellToolParam); - - case "custom": - return customToolParamDeserializer(item as CustomToolParam); - - case "web_search_preview": - return webSearchPreviewToolDeserializer(item as WebSearchPreviewTool); - - case "apply_patch": - return applyPatchToolParamDeserializer(item as ApplyPatchToolParam); - - case "computer": - return computerToolDeserializer(item as ComputerTool); - - case "namespace": - return namespaceToolParamDeserializer(item as NamespaceToolParam); - - case "tool_search": - return toolSearchToolParamDeserializer(item as ToolSearchToolParam); + case "header": + return headerTelemetryEndpointAuthDeserializer(item as HeaderTelemetryEndpointAuth); default: - return toolDeserializer(item); + return telemetryEndpointAuthDeserializer(item); } } -/** Type of ToolType */ -export type ToolType = - | "function" - | "file_search" - | "computer" - | "computer_use_preview" - | "web_search" - | "mcp" - | "code_interpreter" - | "image_generation" - | "local_shell" - | "shell" - | "custom" - | "namespace" - | "tool_search" - | "web_search_preview" - | "apply_patch" - | "a2a_preview" - | "bing_custom_search_preview" - | "browser_automation_preview" - | "fabric_dataagent_preview" - | "sharepoint_grounding_preview" - | "memory_search_preview" - | "work_iq_preview" - | "fabric_iq_preview" - | "toolbox_search_preview" - | "azure_ai_search" - | "azure_function" - | "bing_grounding" - | "capture_structured_outputs" - | "openapi"; +/** The type of authentication for a telemetry endpoint. */ +export type TelemetryEndpointAuthType = "header"; -/** The input definition information for a bing grounding search tool as used to configure an agent. */ -export interface BingGroundingTool extends Tool { - /** The object type, which is always 'bing_grounding'. */ - type: "bing_grounding"; - /** Optional user-defined name for this tool or configuration. */ - name?: string; - /** Optional user-defined description for this tool or configuration. */ - description?: string; - /** - * Per-tool configuration map. Keys are tool names or `*` (catch-all default). - * Resolution order: exact tool name match takes priority over `*`. - * Unknown tool names are silently ignored at runtime. - */ - tool_configs?: Record; - /** The bing grounding search tool parameters. */ - bing_grounding: BingGroundingSearchToolParameters; +/** Header-based secret authentication for a telemetry endpoint. The resolved secret value is injected as an HTTP header. */ +export interface HeaderTelemetryEndpointAuth extends TelemetryEndpointAuth { + /** The authentication type, always 'header' for header-based secret authentication. */ + type: "header"; + /** The name of the HTTP header to inject the secret value into. */ + header_name: string; + /** The identifier of the secret store or connection. */ + secret_id: string; + /** The key within the secret to retrieve the authentication value. */ + secret_key: string; } -export function bingGroundingToolSerializer(item: BingGroundingTool): any { +export function headerTelemetryEndpointAuthSerializer(item: HeaderTelemetryEndpointAuth): any { return { type: item["type"], - name: item["name"], - description: item["description"], - tool_configs: !item["tool_configs"] - ? item["tool_configs"] - : toolConfigRecordSerializer(item["tool_configs"]), - bing_grounding: bingGroundingSearchToolParametersSerializer(item["bing_grounding"]), + header_name: item["header_name"], + secret_id: item["secret_id"], + secret_key: item["secret_key"], }; } -export function bingGroundingToolDeserializer(item: any): BingGroundingTool { +export function headerTelemetryEndpointAuthDeserializer(item: any): HeaderTelemetryEndpointAuth { return { type: item["type"], - name: item["name"], - description: item["description"], - tool_configs: !item["tool_configs"] - ? item["tool_configs"] - : toolConfigRecordDeserializer(item["tool_configs"]), - bing_grounding: bingGroundingSearchToolParametersDeserializer(item["bing_grounding"]), + header_name: item["header_name"], + secret_id: item["secret_id"], + secret_key: item["secret_key"], }; } -export function toolConfigRecordSerializer(item: Record): Record { - const result: Record = {}; - Object.keys(item).map((key) => { - result[key] = !item[key] ? item[key] : toolConfigSerializer(item[key]); - }); - return result; -} - -export function toolConfigRecordDeserializer( - item: Record, -): Record { - const result: Record = {}; - Object.keys(item).map((key) => { - result[key] = !item[key] ? item[key] : toolConfigDeserializer(item[key]); - }); - return result; -} - -/** Per-tool configuration that controls tool visibility and search behavior. */ -export interface ToolConfig { - /** - * When true, the tool is always included in agent context and visible in `tools/list`. - * When false (default), the tool is hidden from `tools/list` and only discoverable via `tool_search`. - */ - pin?: boolean; - /** - * Additional text indexed for tool_search. Supplements the native tool description - * to improve discoverability. Does not alter `tools/list` output. - */ - additional_search_text?: string; -} - -export function toolConfigSerializer(item: ToolConfig): any { - return { pin: item["pin"], additional_search_text: item["additional_search_text"] }; +/** An OTLP (OpenTelemetry Protocol) telemetry export endpoint. */ +export interface OtlpTelemetryEndpoint extends TelemetryEndpoint { + /** The endpoint kind, always 'OTLP' for OpenTelemetry Protocol endpoints. */ + kind: "OTLP"; + /** The OTLP collector endpoint URL. */ + endpoint: string; + /** The transport protocol for the OTLP endpoint. */ + protocol: TelemetryTransportProtocol; } -export function toolConfigDeserializer(item: any): ToolConfig { +export function otlpTelemetryEndpointSerializer(item: OtlpTelemetryEndpoint): any { return { - pin: item["pin"], - additional_search_text: item["additional_search_text"], + kind: item["kind"], + data: item["data"].map((p: any) => { + return p; + }), + auth: !item["auth"] ? item["auth"] : telemetryEndpointAuthUnionSerializer(item["auth"]), + endpoint: item["endpoint"], + protocol: item["protocol"], }; } -/** The bing grounding search tool parameters. */ -export interface BingGroundingSearchToolParameters { +export function otlpTelemetryEndpointDeserializer(item: any): OtlpTelemetryEndpoint { + return { + kind: item["kind"], + data: item["data"].map((p: any) => { + return p; + }), + auth: !item["auth"] ? item["auth"] : telemetryEndpointAuthUnionDeserializer(item["auth"]), + endpoint: item["endpoint"], + protocol: item["protocol"], + }; +} + +/** The transport protocol for telemetry export. */ +export type TelemetryTransportProtocol = "Http" | "Grpc"; + +/** The prompt agent definition */ +export interface PromptAgentDefinition extends AgentDefinition { + kind: "prompt"; + /** The model deployment to use for this agent. */ + model: string; + /** A system (or developer) message inserted into the model's context. */ + instructions?: string; /** - * The search configurations attached to this tool. There can be a maximum of 1 - * search configuration resource attached to the tool. + * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. + * We generally recommend altering this or `top_p` but not both. Defaults to `1`. */ - search_configurations: BingGroundingSearchConfiguration[]; + temperature?: number; + /** + * An alternative to sampling with temperature, called nucleus sampling, + * where the model considers the results of the tokens with top_p probability + * mass. So 0.1 means only the tokens comprising the top 10% probability mass + * are considered. We generally recommend altering this or `temperature` but not both. + * Defaults to `1`. + */ + top_p?: number; + reasoning?: Reasoning; + /** + * An array of tools the model may call while generating a response. You + * can specify which tool to use by setting the `tool_choice` parameter. + */ + tools?: ToolUnion[]; + /** + * How the model should select which tool (or tools) to use when generating a response. + * See the `tools` parameter to see how to specify which tools the model can call. + */ + tool_choice?: string | ToolChoiceParamUnion; + /** Configuration options for a text response from the model. Can be plain text or structured JSON data. */ + text?: PromptAgentDefinitionTextOptions; + /** Set of structured inputs that can participate in prompt template substitution or tool argument bindings. */ + structured_inputs?: Record; } -export function bingGroundingSearchToolParametersSerializer( - item: BingGroundingSearchToolParameters, -): any { +export function promptAgentDefinitionSerializer(item: PromptAgentDefinition): any { return { - search_configurations: bingGroundingSearchConfigurationArraySerializer( - item["search_configurations"], - ), + kind: item["kind"], + rai_config: !item["rai_config"] ? item["rai_config"] : raiConfigSerializer(item["rai_config"]), + model: item["model"], + instructions: item["instructions"], + temperature: item["temperature"], + top_p: item["top_p"], + reasoning: !item["reasoning"] ? item["reasoning"] : reasoningSerializer(item["reasoning"]), + tools: !item["tools"] ? item["tools"] : toolUnionArraySerializer(item["tools"]), + tool_choice: !item["tool_choice"] + ? item["tool_choice"] + : _promptAgentDefinitionToolChoiceSerializer(item["tool_choice"]), + text: !item["text"] ? item["text"] : promptAgentDefinitionTextOptionsSerializer(item["text"]), + structured_inputs: !item["structured_inputs"] + ? item["structured_inputs"] + : structuredInputDefinitionRecordSerializer(item["structured_inputs"]), }; } -export function bingGroundingSearchToolParametersDeserializer( - item: any, -): BingGroundingSearchToolParameters { +export function promptAgentDefinitionDeserializer(item: any): PromptAgentDefinition { return { - search_configurations: bingGroundingSearchConfigurationArrayDeserializer( - item["search_configurations"], - ), + kind: item["kind"], + rai_config: !item["rai_config"] + ? item["rai_config"] + : raiConfigDeserializer(item["rai_config"]), + model: item["model"], + instructions: item["instructions"], + temperature: item["temperature"], + top_p: item["top_p"], + reasoning: !item["reasoning"] ? item["reasoning"] : reasoningDeserializer(item["reasoning"]), + tools: !item["tools"] ? item["tools"] : toolUnionArrayDeserializer(item["tools"]), + tool_choice: !item["tool_choice"] + ? item["tool_choice"] + : _promptAgentDefinitionToolChoiceDeserializer(item["tool_choice"]), + text: !item["text"] ? item["text"] : promptAgentDefinitionTextOptionsDeserializer(item["text"]), + structured_inputs: !item["structured_inputs"] + ? item["structured_inputs"] + : structuredInputDefinitionRecordDeserializer(item["structured_inputs"]), }; } -export function bingGroundingSearchConfigurationArraySerializer( - result: Array, -): any[] { +/** + * **gpt-5 and o-series models only** + * Configuration options for + * [reasoning models](https://platform.openai.com/docs/guides/reasoning). + */ +export interface Reasoning { + effort?: ReasoningEffort; + summary?: "auto" | "concise" | "detailed"; + context?: "auto" | "current_turn" | "all_turns"; + generate_summary?: "auto" | "concise" | "detailed"; +} + +export function reasoningSerializer(item: Reasoning): any { + return { + effort: item["effort"], + summary: item["summary"], + context: item["context"], + generate_summary: item["generate_summary"], + }; +} + +export function reasoningDeserializer(item: any): Reasoning { + return { + effort: item["effort"], + summary: item["summary"], + context: item["context"], + generate_summary: item["generate_summary"], + }; +} + +/** + * Constrains effort on reasoning for + * [reasoning models](https://platform.openai.com/docs/guides/reasoning). + * Currently supported values are `none`, `minimal`, `low`, `medium`, `high`, and `xhigh`. Reducing + * reasoning effort can result in faster responses and fewer tokens used + * on reasoning in a response. + * - `gpt-5.1` defaults to `none`, which does not perform reasoning. The supported reasoning values for `gpt-5.1` are `none`, `low`, `medium`, and `high`. Tool calls are supported for all reasoning values in gpt-5.1. + * - All models before `gpt-5.1` default to `medium` reasoning effort, and do not support `none`. + * - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort. + * - `xhigh` is supported for all models after `gpt-5.1-codex-max`. + */ +export type ReasoningEffort = "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | null; + +export function toolUnionArraySerializer(result: Array): any[] { return result.map((item) => { - return bingGroundingSearchConfigurationSerializer(item); + return toolUnionSerializer(item); }); } -export function bingGroundingSearchConfigurationArrayDeserializer( - result: Array, -): any[] { +export function toolUnionArrayDeserializer(result: Array): any[] { return result.map((item) => { - return bingGroundingSearchConfigurationDeserializer(item); + return toolUnionDeserializer(item); }); } -/** Search configuration for Bing Grounding */ -export interface BingGroundingSearchConfiguration { - /** Project connection id for grounding with bing search */ - project_connection_id: string; - /** The market where the results come from. */ - market?: string; - /** The language to use for user interface strings when calling Bing API. */ - set_lang?: string; - /** The number of search results to return in the bing api response */ - count?: number; - /** Filter search results by a specific time range. See [accepted values here](https://learn.microsoft.com/bing/search-apis/bing-web-search/reference/query-parameters). */ - freshness?: string; +/** A tool that can be used to generate a response. */ +export interface Tool { + type: ToolType; } -export function bingGroundingSearchConfigurationSerializer( - item: BingGroundingSearchConfiguration, -): any { - return { - project_connection_id: item["project_connection_id"], - market: item["market"], - set_lang: item["set_lang"], - count: item["count"], - freshness: item["freshness"], - }; +export function toolSerializer(item: Tool): any { + return { type: item["type"] }; } -export function bingGroundingSearchConfigurationDeserializer( - item: any, -): BingGroundingSearchConfiguration { +export function toolDeserializer(item: any): Tool { return { - project_connection_id: item["project_connection_id"], - market: item["market"], - set_lang: item["set_lang"], - count: item["count"], - freshness: item["freshness"], + type: item["type"], }; } -/** The input definition information for a Microsoft Fabric tool as used to configure an agent. */ -export interface MicrosoftFabricPreviewTool extends Tool { - /** The object type, which is always 'fabric_dataagent_preview'. */ - type: "fabric_dataagent_preview"; - /** Optional user-defined name for this tool or configuration. */ - name?: string; - /** Optional user-defined description for this tool or configuration. */ - description?: string; - /** - * Per-tool configuration map. Keys are tool names or `*` (catch-all default). - * Resolution order: exact tool name match takes priority over `*`. - * Unknown tool names are silently ignored at runtime. - */ - tool_configs?: Record; - /** The fabric data agent tool parameters. */ - fabric_dataagent_preview: FabricDataAgentToolParameters; -} +/** Alias for ToolUnion */ +export type ToolUnion = + | BingGroundingTool + | MicrosoftFabricPreviewTool + | SharepointPreviewTool + | AzureAISearchTool + | OpenApiTool + | BingCustomSearchPreviewTool + | BrowserAutomationPreviewTool + | AzureFunctionTool + | CaptureStructuredOutputsTool + | A2APreviewTool + | WorkIQPreviewTool + | FabricIQPreviewTool + | MemorySearchPreviewTool + | CodeInterpreterTool + | FileSearchTool + | WebSearchTool + | MCPTool + | FunctionTool + | ComputerUsePreviewTool + | ImageGenTool + | LocalShellToolParam + | FunctionShellToolParam + | CustomToolParam + | WebSearchPreviewTool + | ApplyPatchToolParam + | ComputerTool + | NamespaceToolParam + | ToolSearchToolParam + | Tool; -export function microsoftFabricPreviewToolSerializer(item: MicrosoftFabricPreviewTool): any { - return { - type: item["type"], - name: item["name"], - description: item["description"], - tool_configs: !item["tool_configs"] - ? item["tool_configs"] - : toolConfigRecordSerializer(item["tool_configs"]), - fabric_dataagent_preview: fabricDataAgentToolParametersSerializer( - item["fabric_dataagent_preview"], - ), - }; -} +export function toolUnionSerializer(item: ToolUnion): any { + switch (item.type) { + case "bing_grounding": + return bingGroundingToolSerializer(item as BingGroundingTool); -export function microsoftFabricPreviewToolDeserializer(item: any): MicrosoftFabricPreviewTool { - return { - type: item["type"], - name: item["name"], - description: item["description"], - tool_configs: !item["tool_configs"] - ? item["tool_configs"] - : toolConfigRecordDeserializer(item["tool_configs"]), - fabric_dataagent_preview: fabricDataAgentToolParametersDeserializer( - item["fabric_dataagent_preview"], - ), - }; + case "fabric_dataagent_preview": + return microsoftFabricPreviewToolSerializer(item as MicrosoftFabricPreviewTool); + + case "sharepoint_grounding_preview": + return sharepointPreviewToolSerializer(item as SharepointPreviewTool); + + case "azure_ai_search": + return azureAISearchToolSerializer(item as AzureAISearchTool); + + case "openapi": + return openApiToolSerializer(item as OpenApiTool); + + case "bing_custom_search_preview": + return bingCustomSearchPreviewToolSerializer(item as BingCustomSearchPreviewTool); + + case "browser_automation_preview": + return browserAutomationPreviewToolSerializer(item as BrowserAutomationPreviewTool); + + case "azure_function": + return azureFunctionToolSerializer(item as AzureFunctionTool); + + case "capture_structured_outputs": + return captureStructuredOutputsToolSerializer(item as CaptureStructuredOutputsTool); + + case "a2a_preview": + return a2APreviewToolSerializer(item as A2APreviewTool); + + case "work_iq_preview": + return workIQPreviewToolSerializer(item as WorkIQPreviewTool); + + case "fabric_iq_preview": + return fabricIQPreviewToolSerializer(item as FabricIQPreviewTool); + + case "memory_search_preview": + return memorySearchPreviewToolSerializer(item as MemorySearchPreviewTool); + + case "code_interpreter": + return codeInterpreterToolSerializer(item as CodeInterpreterTool); + + case "file_search": + return fileSearchToolSerializer(item as FileSearchTool); + + case "web_search": + return webSearchToolSerializer(item as WebSearchTool); + + case "mcp": + return mcpToolSerializer(item as MCPTool); + + case "function": + return functionToolSerializer(item as FunctionTool); + + case "computer_use_preview": + return computerUsePreviewToolSerializer(item as ComputerUsePreviewTool); + + case "image_generation": + return imageGenToolSerializer(item as ImageGenTool); + + case "local_shell": + return localShellToolParamSerializer(item as LocalShellToolParam); + + case "shell": + return functionShellToolParamSerializer(item as FunctionShellToolParam); + + case "custom": + return customToolParamSerializer(item as CustomToolParam); + + case "web_search_preview": + return webSearchPreviewToolSerializer(item as WebSearchPreviewTool); + + case "apply_patch": + return applyPatchToolParamSerializer(item as ApplyPatchToolParam); + + case "computer": + return computerToolSerializer(item as ComputerTool); + + case "namespace": + return namespaceToolParamSerializer(item as NamespaceToolParam); + + case "tool_search": + return toolSearchToolParamSerializer(item as ToolSearchToolParam); + + default: + return toolSerializer(item); + } } -/** The fabric data agent tool parameters. */ -export interface FabricDataAgentToolParameters { - /** - * The project connections attached to this tool. There can be a maximum of 1 connection - * resource attached to the tool. - */ - project_connections?: ToolProjectConnection[]; -} +export function toolUnionDeserializer(item: any): ToolUnion { + switch (item["type"]) { + case "bing_grounding": + return bingGroundingToolDeserializer(item as BingGroundingTool); + + case "fabric_dataagent_preview": + return microsoftFabricPreviewToolDeserializer(item as MicrosoftFabricPreviewTool); + + case "sharepoint_grounding_preview": + return sharepointPreviewToolDeserializer(item as SharepointPreviewTool); + + case "azure_ai_search": + return azureAISearchToolDeserializer(item as AzureAISearchTool); + + case "openapi": + return openApiToolDeserializer(item as OpenApiTool); + + case "bing_custom_search_preview": + return bingCustomSearchPreviewToolDeserializer(item as BingCustomSearchPreviewTool); + + case "browser_automation_preview": + return browserAutomationPreviewToolDeserializer(item as BrowserAutomationPreviewTool); + + case "azure_function": + return azureFunctionToolDeserializer(item as AzureFunctionTool); + + case "capture_structured_outputs": + return captureStructuredOutputsToolDeserializer(item as CaptureStructuredOutputsTool); + + case "a2a_preview": + return a2APreviewToolDeserializer(item as A2APreviewTool); + + case "work_iq_preview": + return workIQPreviewToolDeserializer(item as WorkIQPreviewTool); + + case "fabric_iq_preview": + return fabricIQPreviewToolDeserializer(item as FabricIQPreviewTool); + + case "memory_search_preview": + return memorySearchPreviewToolDeserializer(item as MemorySearchPreviewTool); + + case "code_interpreter": + return codeInterpreterToolDeserializer(item as CodeInterpreterTool); + + case "file_search": + return fileSearchToolDeserializer(item as FileSearchTool); + + case "web_search": + return webSearchToolDeserializer(item as WebSearchTool); + + case "mcp": + return mcpToolDeserializer(item as MCPTool); + + case "function": + return functionToolDeserializer(item as FunctionTool); + + case "computer_use_preview": + return computerUsePreviewToolDeserializer(item as ComputerUsePreviewTool); -export function fabricDataAgentToolParametersSerializer(item: FabricDataAgentToolParameters): any { - return { - project_connections: !item["project_connections"] - ? item["project_connections"] - : toolProjectConnectionArraySerializer(item["project_connections"]), - }; -} + case "image_generation": + return imageGenToolDeserializer(item as ImageGenTool); -export function fabricDataAgentToolParametersDeserializer( - item: any, -): FabricDataAgentToolParameters { - return { - project_connections: !item["project_connections"] - ? item["project_connections"] - : toolProjectConnectionArrayDeserializer(item["project_connections"]), - }; -} + case "local_shell": + return localShellToolParamDeserializer(item as LocalShellToolParam); -export function toolProjectConnectionArraySerializer(result: Array): any[] { - return result.map((item) => { - return toolProjectConnectionSerializer(item); - }); -} + case "shell": + return functionShellToolParamDeserializer(item as FunctionShellToolParam); -export function toolProjectConnectionArrayDeserializer( - result: Array, -): any[] { - return result.map((item) => { - return toolProjectConnectionDeserializer(item); - }); -} + case "custom": + return customToolParamDeserializer(item as CustomToolParam); -/** A project connection resource. */ -export interface ToolProjectConnection { - /** A project connection in a ToolProjectConnectionList attached to this tool. */ - project_connection_id: string; -} + case "web_search_preview": + return webSearchPreviewToolDeserializer(item as WebSearchPreviewTool); -export function toolProjectConnectionSerializer(item: ToolProjectConnection): any { - return { project_connection_id: item["project_connection_id"] }; -} + case "apply_patch": + return applyPatchToolParamDeserializer(item as ApplyPatchToolParam); -export function toolProjectConnectionDeserializer(item: any): ToolProjectConnection { - return { - project_connection_id: item["project_connection_id"], - }; + case "computer": + return computerToolDeserializer(item as ComputerTool); + + case "namespace": + return namespaceToolParamDeserializer(item as NamespaceToolParam); + + case "tool_search": + return toolSearchToolParamDeserializer(item as ToolSearchToolParam); + + default: + return toolDeserializer(item); + } } -/** The input definition information for a sharepoint tool as used to configure an agent. */ -export interface SharepointPreviewTool extends Tool { - /** The object type, which is always 'sharepoint_grounding_preview'. */ - type: "sharepoint_grounding_preview"; - /** Optional user-defined name for this tool or configuration. */ +/** Type of ToolType */ +export type ToolType = + | "function" + | "file_search" + | "computer" + | "computer_use_preview" + | "web_search" + | "mcp" + | "code_interpreter" + | "image_generation" + | "local_shell" + | "shell" + | "custom" + | "namespace" + | "tool_search" + | "web_search_preview" + | "apply_patch" + | "a2a_preview" + | "bing_custom_search_preview" + | "browser_automation_preview" + | "fabric_dataagent_preview" + | "sharepoint_grounding_preview" + | "memory_search_preview" + | "work_iq_preview" + | "fabric_iq_preview" + | "toolbox_search_preview" + | "azure_ai_search" + | "azure_function" + | "bing_grounding" + | "capture_structured_outputs" + | "openapi"; + +/** The input definition information for a bing grounding search tool as used to configure an agent. */ +export interface BingGroundingTool extends Tool { + /** The object type, which is always 'bing_grounding'. */ + type: "bing_grounding"; + /** Deprecated. This property is deprecated and will be removed in a future version. */ name?: string; - /** Optional user-defined description for this tool or configuration. */ + /** Deprecated. This property is deprecated and will be removed in a future version. */ description?: string; - /** - * Per-tool configuration map. Keys are tool names or `*` (catch-all default). - * Resolution order: exact tool name match takes priority over `*`. - * Unknown tool names are silently ignored at runtime. - */ + /** Deprecated. This property is deprecated and will be removed in a future version. */ tool_configs?: Record; - /** The sharepoint grounding tool parameters. */ - sharepoint_grounding_preview: SharepointGroundingToolParameters; + /** The bing grounding search tool parameters. */ + bing_grounding: BingGroundingSearchToolParameters; } -export function sharepointPreviewToolSerializer(item: SharepointPreviewTool): any { +export function bingGroundingToolSerializer(item: BingGroundingTool): any { return { type: item["type"], name: item["name"], @@ -874,13 +1011,11 @@ export function sharepointPreviewToolSerializer(item: SharepointPreviewTool): an tool_configs: !item["tool_configs"] ? item["tool_configs"] : toolConfigRecordSerializer(item["tool_configs"]), - sharepoint_grounding_preview: sharepointGroundingToolParametersSerializer( - item["sharepoint_grounding_preview"], - ), + bing_grounding: bingGroundingSearchToolParametersSerializer(item["bing_grounding"]), }; } -export function sharepointPreviewToolDeserializer(item: any): SharepointPreviewTool { +export function bingGroundingToolDeserializer(item: any): BingGroundingTool { return { type: item["type"], name: item["name"], @@ -888,728 +1023,646 @@ export function sharepointPreviewToolDeserializer(item: any): SharepointPreviewT tool_configs: !item["tool_configs"] ? item["tool_configs"] : toolConfigRecordDeserializer(item["tool_configs"]), - sharepoint_grounding_preview: sharepointGroundingToolParametersDeserializer( - item["sharepoint_grounding_preview"], - ), + bing_grounding: bingGroundingSearchToolParametersDeserializer(item["bing_grounding"]), }; } -/** The sharepoint grounding tool parameters. */ -export interface SharepointGroundingToolParameters { - /** - * The project connections attached to this tool. There can be a maximum of 1 connection - * resource attached to the tool. - */ - project_connections?: ToolProjectConnection[]; -} - -export function sharepointGroundingToolParametersSerializer( - item: SharepointGroundingToolParameters, -): any { - return { - project_connections: !item["project_connections"] - ? item["project_connections"] - : toolProjectConnectionArraySerializer(item["project_connections"]), - }; +export function toolConfigRecordSerializer(item: Record): Record { + const result: Record = {}; + Object.keys(item).map((key) => { + result[key] = !item[key] ? item[key] : toolConfigSerializer(item[key]); + }); + return result; } -export function sharepointGroundingToolParametersDeserializer( - item: any, -): SharepointGroundingToolParameters { - return { - project_connections: !item["project_connections"] - ? item["project_connections"] - : toolProjectConnectionArrayDeserializer(item["project_connections"]), - }; +export function toolConfigRecordDeserializer( + item: Record, +): Record { + const result: Record = {}; + Object.keys(item).map((key) => { + result[key] = !item[key] ? item[key] : toolConfigDeserializer(item[key]); + }); + return result; } -/** The input definition information for an Azure AI search tool as used to configure an agent. */ -export interface AzureAISearchTool extends Tool { - /** The object type, which is always 'azure_ai_search'. */ - type: "azure_ai_search"; - /** Optional user-defined name for this tool or configuration. */ - name?: string; - /** Optional user-defined description for this tool or configuration. */ - description?: string; +/** Per-tool configuration that controls tool visibility and search behavior. */ +export interface ToolConfig { /** - * Per-tool configuration map. Keys are tool names or `*` (catch-all default). - * Resolution order: exact tool name match takes priority over `*`. - * Unknown tool names are silently ignored at runtime. + * When true, the tool is always included in agent context and visible in `tools/list`. + * When false (default), the tool is hidden from `tools/list` and only discoverable via `tool_search`. */ - tool_configs?: Record; - /** The azure ai search index resource. */ - azure_ai_search: AzureAISearchToolResource; + pin?: boolean; + /** + * Additional text indexed for tool_search. Supplements the native tool description + * to improve discoverability. Does not alter `tools/list` output. + */ + additional_search_text?: string; } -export function azureAISearchToolSerializer(item: AzureAISearchTool): any { - return { - type: item["type"], - name: item["name"], - description: item["description"], - tool_configs: !item["tool_configs"] - ? item["tool_configs"] - : toolConfigRecordSerializer(item["tool_configs"]), - azure_ai_search: azureAISearchToolResourceSerializer(item["azure_ai_search"]), - }; +export function toolConfigSerializer(item: ToolConfig): any { + return { pin: item["pin"], additional_search_text: item["additional_search_text"] }; } -export function azureAISearchToolDeserializer(item: any): AzureAISearchTool { +export function toolConfigDeserializer(item: any): ToolConfig { return { - type: item["type"], - name: item["name"], - description: item["description"], - tool_configs: !item["tool_configs"] - ? item["tool_configs"] - : toolConfigRecordDeserializer(item["tool_configs"]), - azure_ai_search: azureAISearchToolResourceDeserializer(item["azure_ai_search"]), + pin: item["pin"], + additional_search_text: item["additional_search_text"], }; } -/** A set of index resources used by the `azure_ai_search` tool. */ -export interface AzureAISearchToolResource { +/** The bing grounding search tool parameters. */ +export interface BingGroundingSearchToolParameters { /** - * The indices attached to this agent. There can be a maximum of 1 index - * resource attached to the agent. + * The search configurations attached to this tool. There can be a maximum of 1 + * search configuration resource attached to the tool. */ - indexes: AISearchIndexResource[]; + search_configurations: BingGroundingSearchConfiguration[]; } -export function azureAISearchToolResourceSerializer(item: AzureAISearchToolResource): any { - return { indexes: aiSearchIndexResourceArraySerializer(item["indexes"]) }; +export function bingGroundingSearchToolParametersSerializer( + item: BingGroundingSearchToolParameters, +): any { + return { + search_configurations: bingGroundingSearchConfigurationArraySerializer( + item["search_configurations"], + ), + }; } -export function azureAISearchToolResourceDeserializer(item: any): AzureAISearchToolResource { +export function bingGroundingSearchToolParametersDeserializer( + item: any, +): BingGroundingSearchToolParameters { return { - indexes: aiSearchIndexResourceArrayDeserializer(item["indexes"]), + search_configurations: bingGroundingSearchConfigurationArrayDeserializer( + item["search_configurations"], + ), }; } -export function aiSearchIndexResourceArraySerializer(result: Array): any[] { +export function bingGroundingSearchConfigurationArraySerializer( + result: Array, +): any[] { return result.map((item) => { - return aiSearchIndexResourceSerializer(item); + return bingGroundingSearchConfigurationSerializer(item); }); } -export function aiSearchIndexResourceArrayDeserializer( - result: Array, +export function bingGroundingSearchConfigurationArrayDeserializer( + result: Array, ): any[] { return result.map((item) => { - return aiSearchIndexResourceDeserializer(item); + return bingGroundingSearchConfigurationDeserializer(item); }); } -/** A AI Search Index resource. */ -export interface AISearchIndexResource { - /** An index connection ID in an IndexResource attached to this agent. */ - project_connection_id?: string; - /** The name of an index in an IndexResource attached to this agent. */ - index_name?: string; - /** Type of query in an AIIndexResource attached to this agent. */ - query_type?: AzureAISearchQueryType; - /** Number of documents to retrieve from search and present to the model. */ - top_k?: number; - /** filter string for search resource. [Learn more here](https://learn.microsoft.com/azure/search/search-filters). */ - filter?: string; - /** Index asset id for search resource. */ - index_asset_id?: string; +/** Search configuration for Bing Grounding */ +export interface BingGroundingSearchConfiguration { + /** Project connection id for grounding with bing search */ + project_connection_id: string; + /** The market where the results come from. */ + market?: string; + /** The language to use for user interface strings when calling Bing API. */ + set_lang?: string; + /** The number of search results to return in the bing api response */ + count?: number; + /** Filter search results by a specific time range. See [accepted values here](https://learn.microsoft.com/bing/search-apis/bing-web-search/reference/query-parameters). */ + freshness?: string; } -export function aiSearchIndexResourceSerializer(item: AISearchIndexResource): any { +export function bingGroundingSearchConfigurationSerializer( + item: BingGroundingSearchConfiguration, +): any { return { project_connection_id: item["project_connection_id"], - index_name: item["index_name"], - query_type: item["query_type"], - top_k: item["top_k"], - filter: item["filter"], - index_asset_id: item["index_asset_id"], + market: item["market"], + set_lang: item["set_lang"], + count: item["count"], + freshness: item["freshness"], }; } -export function aiSearchIndexResourceDeserializer(item: any): AISearchIndexResource { +export function bingGroundingSearchConfigurationDeserializer( + item: any, +): BingGroundingSearchConfiguration { return { project_connection_id: item["project_connection_id"], - index_name: item["index_name"], - query_type: item["query_type"], - top_k: item["top_k"], - filter: item["filter"], - index_asset_id: item["index_asset_id"], + market: item["market"], + set_lang: item["set_lang"], + count: item["count"], + freshness: item["freshness"], }; } -/** Available query types for Azure AI Search tool. */ -export type AzureAISearchQueryType = - | "simple" - | "semantic" - | "vector" - | "vector_simple_hybrid" - | "vector_semantic_hybrid"; - -/** The input definition information for an OpenAPI tool as used to configure an agent. */ -export interface OpenApiTool extends Tool { - /** The object type, which is always 'openapi'. */ - type: "openapi"; - /** The openapi function definition. */ - openapi: OpenApiFunctionDefinition; - /** - * Per-tool configuration map. Keys are tool names or `*` (catch-all default). - * Resolution order: exact tool name match takes priority over `*`. - * Unknown tool names are silently ignored at runtime. - */ - tool_configs?: Record; +/** The input definition information for a Microsoft Fabric tool as used to configure an agent. */ +export interface MicrosoftFabricPreviewTool extends Tool { + /** The object type, which is always 'fabric_dataagent_preview'. */ + type: "fabric_dataagent_preview"; + /** The fabric data agent tool parameters. */ + fabric_dataagent_preview: FabricDataAgentToolParameters; } -export function openApiToolSerializer(item: OpenApiTool): any { +export function microsoftFabricPreviewToolSerializer(item: MicrosoftFabricPreviewTool): any { return { type: item["type"], - openapi: openApiFunctionDefinitionSerializer(item["openapi"]), - tool_configs: !item["tool_configs"] - ? item["tool_configs"] - : toolConfigRecordSerializer(item["tool_configs"]), + fabric_dataagent_preview: fabricDataAgentToolParametersSerializer( + item["fabric_dataagent_preview"], + ), }; } -export function openApiToolDeserializer(item: any): OpenApiTool { +export function microsoftFabricPreviewToolDeserializer(item: any): MicrosoftFabricPreviewTool { return { type: item["type"], - openapi: openApiFunctionDefinitionDeserializer(item["openapi"]), - tool_configs: !item["tool_configs"] - ? item["tool_configs"] - : toolConfigRecordDeserializer(item["tool_configs"]), + fabric_dataagent_preview: fabricDataAgentToolParametersDeserializer( + item["fabric_dataagent_preview"], + ), }; } -/** The input definition information for an openapi function. */ -export interface OpenApiFunctionDefinition { - /** 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 openapi function shape, described as a JSON Schema object. */ - spec: Record; - /** Open API authentication details */ - auth: OpenApiAuthDetailsUnion; - /** List of OpenAPI spec parameters that will use user-provided defaults */ - default_params?: string[]; - /** List of function definitions used by OpenApi tool */ - readonly functions?: { - name: string; - description?: string; - parameters: Record; - }[]; -} - -export function openApiFunctionDefinitionSerializer(item: OpenApiFunctionDefinition): any { - return { - name: item["name"], - description: item["description"], - spec: item["spec"], - auth: openApiAuthDetailsUnionSerializer(item["auth"]), - default_params: !item["default_params"] - ? item["default_params"] - : item["default_params"].map((p: any) => { - return p; - }), - }; +/** The fabric data agent tool parameters. */ +export interface FabricDataAgentToolParameters { + /** + * The project connections attached to this tool. There can be a maximum of 1 connection + * resource attached to the tool. + */ + project_connections?: ToolProjectConnection[]; } -export function openApiFunctionDefinitionDeserializer(item: any): OpenApiFunctionDefinition { +export function fabricDataAgentToolParametersSerializer(item: FabricDataAgentToolParameters): any { return { - name: item["name"], - description: item["description"], - spec: Object.fromEntries(Object.entries(item["spec"]).map(([k, p]: [string, any]) => [k, p])), - auth: openApiAuthDetailsUnionDeserializer(item["auth"]), - default_params: !item["default_params"] - ? item["default_params"] - : item["default_params"].map((p: any) => { - return p; - }), - functions: !item["functions"] - ? item["functions"] - : _openApiFunctionDefinitionFunctionArrayDeserializer(item["functions"]), + project_connections: !item["project_connections"] + ? item["project_connections"] + : toolProjectConnectionArraySerializer(item["project_connections"]), }; } -/** authentication details for OpenApiFunctionDefinition */ -export interface OpenApiAuthDetails { - /** The type of authentication, must be anonymous/project_connection/managed_identity */ - /** The discriminator possible values: anonymous, project_connection, managed_identity */ - type: OpenApiAuthType; -} - -export function openApiAuthDetailsSerializer(item: OpenApiAuthDetails): any { - return { type: item["type"] }; -} - -export function openApiAuthDetailsDeserializer(item: any): OpenApiAuthDetails { +export function fabricDataAgentToolParametersDeserializer( + item: any, +): FabricDataAgentToolParameters { return { - type: item["type"], + project_connections: !item["project_connections"] + ? item["project_connections"] + : toolProjectConnectionArrayDeserializer(item["project_connections"]), }; } -/** Alias for OpenApiAuthDetailsUnion */ -export type OpenApiAuthDetailsUnion = - | OpenApiAnonymousAuthDetails - | OpenApiProjectConnectionAuthDetails - | OpenApiManagedAuthDetails - | OpenApiAuthDetails; - -export function openApiAuthDetailsUnionSerializer(item: OpenApiAuthDetailsUnion): any { - switch (item.type) { - case "anonymous": - return openApiAnonymousAuthDetailsSerializer(item as OpenApiAnonymousAuthDetails); - - case "project_connection": - return openApiProjectConnectionAuthDetailsSerializer( - item as OpenApiProjectConnectionAuthDetails, - ); - - case "managed_identity": - return openApiManagedAuthDetailsSerializer(item as OpenApiManagedAuthDetails); - - default: - return openApiAuthDetailsSerializer(item); - } +export function toolProjectConnectionArraySerializer(result: Array): any[] { + return result.map((item) => { + return toolProjectConnectionSerializer(item); + }); } -export function openApiAuthDetailsUnionDeserializer(item: any): OpenApiAuthDetailsUnion { - switch (item["type"]) { - case "anonymous": - return openApiAnonymousAuthDetailsDeserializer(item as OpenApiAnonymousAuthDetails); - - case "project_connection": - return openApiProjectConnectionAuthDetailsDeserializer( - item as OpenApiProjectConnectionAuthDetails, - ); - - case "managed_identity": - return openApiManagedAuthDetailsDeserializer(item as OpenApiManagedAuthDetails); - - default: - return openApiAuthDetailsDeserializer(item); - } +export function toolProjectConnectionArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return toolProjectConnectionDeserializer(item); + }); } -/** - * Authentication type for OpenApi endpoint. Allowed types are: - * - Anonymous (no authentication required) - * - Project Connection (requires project_connection_id to endpoint, as setup in AI Foundry) - * - Managed_Identity (requires audience for identity based auth) - */ -export type OpenApiAuthType = "anonymous" | "project_connection" | "managed_identity"; - -/** Security details for OpenApi anonymous authentication */ -export interface OpenApiAnonymousAuthDetails extends OpenApiAuthDetails { - /** The object type, which is always 'anonymous'. */ - type: "anonymous"; +/** A project connection resource. */ +export interface ToolProjectConnection { + /** A project connection in a ToolProjectConnectionList attached to this tool. */ + project_connection_id: string; } -export function openApiAnonymousAuthDetailsSerializer(item: OpenApiAnonymousAuthDetails): any { - return { type: item["type"] }; +export function toolProjectConnectionSerializer(item: ToolProjectConnection): any { + return { project_connection_id: item["project_connection_id"] }; } -export function openApiAnonymousAuthDetailsDeserializer(item: any): OpenApiAnonymousAuthDetails { +export function toolProjectConnectionDeserializer(item: any): ToolProjectConnection { return { - type: item["type"], + project_connection_id: item["project_connection_id"], }; } -/** Security details for OpenApi project connection authentication */ -export interface OpenApiProjectConnectionAuthDetails extends OpenApiAuthDetails { - /** The object type, which is always 'project_connection'. */ - type: "project_connection"; - /** Project connection auth security details */ - security_scheme: OpenApiProjectConnectionSecurityScheme; -} - -export function openApiProjectConnectionAuthDetailsSerializer( - item: OpenApiProjectConnectionAuthDetails, -): any { +/** The input definition information for a sharepoint tool as used to configure an agent. */ +export interface SharepointPreviewTool extends Tool { + /** The object type, which is always 'sharepoint_grounding_preview'. */ + type: "sharepoint_grounding_preview"; + /** The sharepoint grounding tool parameters. */ + sharepoint_grounding_preview: SharepointGroundingToolParameters; +} + +export function sharepointPreviewToolSerializer(item: SharepointPreviewTool): any { return { type: item["type"], - security_scheme: openApiProjectConnectionSecuritySchemeSerializer(item["security_scheme"]), + sharepoint_grounding_preview: sharepointGroundingToolParametersSerializer( + item["sharepoint_grounding_preview"], + ), }; } -export function openApiProjectConnectionAuthDetailsDeserializer( - item: any, -): OpenApiProjectConnectionAuthDetails { +export function sharepointPreviewToolDeserializer(item: any): SharepointPreviewTool { return { type: item["type"], - security_scheme: openApiProjectConnectionSecuritySchemeDeserializer(item["security_scheme"]), + sharepoint_grounding_preview: sharepointGroundingToolParametersDeserializer( + item["sharepoint_grounding_preview"], + ), }; } -/** Security scheme for OpenApi managed_identity authentication */ -export interface OpenApiProjectConnectionSecurityScheme { - /** Project connection id for Project Connection auth type */ - project_connection_id: string; +/** The sharepoint grounding tool parameters. */ +export interface SharepointGroundingToolParameters { + /** + * The project connections attached to this tool. There can be a maximum of 1 connection + * resource attached to the tool. + */ + project_connections?: ToolProjectConnection[]; } -export function openApiProjectConnectionSecuritySchemeSerializer( - item: OpenApiProjectConnectionSecurityScheme, +export function sharepointGroundingToolParametersSerializer( + item: SharepointGroundingToolParameters, ): any { - return { project_connection_id: item["project_connection_id"] }; + return { + project_connections: !item["project_connections"] + ? item["project_connections"] + : toolProjectConnectionArraySerializer(item["project_connections"]), + }; } -export function openApiProjectConnectionSecuritySchemeDeserializer( +export function sharepointGroundingToolParametersDeserializer( item: any, -): OpenApiProjectConnectionSecurityScheme { +): SharepointGroundingToolParameters { return { - project_connection_id: item["project_connection_id"], + project_connections: !item["project_connections"] + ? item["project_connections"] + : toolProjectConnectionArrayDeserializer(item["project_connections"]), }; } -/** Security details for OpenApi managed_identity authentication */ -export interface OpenApiManagedAuthDetails extends OpenApiAuthDetails { - /** The object type, which is always 'managed_identity'. */ - type: "managed_identity"; - /** Connection auth security details */ - security_scheme: OpenApiManagedSecurityScheme; +/** The input definition information for an Azure AI search tool as used to configure an agent. */ +export interface AzureAISearchTool extends Tool { + /** The object type, which is always 'azure_ai_search'. */ + type: "azure_ai_search"; + /** Deprecated. This property is deprecated and will be removed in a future version. */ + name?: string; + /** Deprecated. This property is deprecated and will be removed in a future version. */ + description?: string; + /** Deprecated. This property is deprecated and will be removed in a future version. */ + tool_configs?: Record; + /** The azure ai search index resource. */ + azure_ai_search: AzureAISearchToolResource; } -export function openApiManagedAuthDetailsSerializer(item: OpenApiManagedAuthDetails): any { +export function azureAISearchToolSerializer(item: AzureAISearchTool): any { return { type: item["type"], - security_scheme: openApiManagedSecuritySchemeSerializer(item["security_scheme"]), + name: item["name"], + description: item["description"], + tool_configs: !item["tool_configs"] + ? item["tool_configs"] + : toolConfigRecordSerializer(item["tool_configs"]), + azure_ai_search: azureAISearchToolResourceSerializer(item["azure_ai_search"]), }; } -export function openApiManagedAuthDetailsDeserializer(item: any): OpenApiManagedAuthDetails { +export function azureAISearchToolDeserializer(item: any): AzureAISearchTool { return { type: item["type"], - security_scheme: openApiManagedSecuritySchemeDeserializer(item["security_scheme"]), + name: item["name"], + description: item["description"], + tool_configs: !item["tool_configs"] + ? item["tool_configs"] + : toolConfigRecordDeserializer(item["tool_configs"]), + azure_ai_search: azureAISearchToolResourceDeserializer(item["azure_ai_search"]), }; } -/** Security scheme for OpenApi managed_identity authentication */ -export interface OpenApiManagedSecurityScheme { - /** Authentication scope for managed_identity auth type */ - audience: string; +/** A set of index resources used by the `azure_ai_search` tool. */ +export interface AzureAISearchToolResource { + /** + * The indices attached to this agent. There can be a maximum of 1 index + * resource attached to the agent. + */ + indexes: AISearchIndexResource[]; } -export function openApiManagedSecuritySchemeSerializer(item: OpenApiManagedSecurityScheme): any { - return { audience: item["audience"] }; +export function azureAISearchToolResourceSerializer(item: AzureAISearchToolResource): any { + return { indexes: aiSearchIndexResourceArraySerializer(item["indexes"]) }; } -export function openApiManagedSecuritySchemeDeserializer(item: any): OpenApiManagedSecurityScheme { +export function azureAISearchToolResourceDeserializer(item: any): AzureAISearchToolResource { return { - audience: item["audience"], + indexes: aiSearchIndexResourceArrayDeserializer(item["indexes"]), }; } -export function _openApiFunctionDefinitionFunctionArrayDeserializer( - result: Array<_OpenApiFunctionDefinitionFunction>, +export function aiSearchIndexResourceArraySerializer(result: Array): any[] { + return result.map((item) => { + return aiSearchIndexResourceSerializer(item); + }); +} + +export function aiSearchIndexResourceArrayDeserializer( + result: Array, ): any[] { return result.map((item) => { - return _openApiFunctionDefinitionFunctionDeserializer(item); + return aiSearchIndexResourceDeserializer(item); }); } -/** model interface _OpenApiFunctionDefinitionFunction */ -export interface _OpenApiFunctionDefinitionFunction { - /** 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: Record; +/** A AI Search Index resource. */ +export interface AISearchIndexResource { + /** An index connection ID in an IndexResource attached to this agent. */ + project_connection_id?: string; + /** The name of an index in an IndexResource attached to this agent. */ + index_name?: string; + /** Type of query in an AIIndexResource attached to this agent. */ + query_type?: AzureAISearchQueryType; + /** Number of documents to retrieve from search and present to the model. */ + top_k?: number; + /** filter string for search resource. [Learn more here](https://learn.microsoft.com/azure/search/search-filters). */ + filter?: string; + /** Index asset id for search resource. */ + index_asset_id?: string; } -export function _openApiFunctionDefinitionFunctionDeserializer( - item: any, -): _OpenApiFunctionDefinitionFunction { +export function aiSearchIndexResourceSerializer(item: AISearchIndexResource): any { return { - name: item["name"], - description: item["description"], - parameters: Object.fromEntries( - Object.entries(item["parameters"]).map(([k, p]: [string, any]) => [k, p]), - ), + project_connection_id: item["project_connection_id"], + index_name: item["index_name"], + query_type: item["query_type"], + top_k: item["top_k"], + filter: item["filter"], + index_asset_id: item["index_asset_id"], }; } -/** The input definition information for a Bing custom search tool as used to configure an agent. */ -export interface BingCustomSearchPreviewTool extends Tool { - /** The object type, which is always 'bing_custom_search_preview'. */ - type: "bing_custom_search_preview"; - /** Optional user-defined name for this tool or configuration. */ - name?: string; - /** Optional user-defined description for this tool or configuration. */ - description?: string; - /** - * Per-tool configuration map. Keys are tool names or `*` (catch-all default). - * Resolution order: exact tool name match takes priority over `*`. - * Unknown tool names are silently ignored at runtime. - */ +export function aiSearchIndexResourceDeserializer(item: any): AISearchIndexResource { + return { + project_connection_id: item["project_connection_id"], + index_name: item["index_name"], + query_type: item["query_type"], + top_k: item["top_k"], + filter: item["filter"], + index_asset_id: item["index_asset_id"], + }; +} + +/** Available query types for Azure AI Search tool. */ +export type AzureAISearchQueryType = + "simple" | "semantic" | "vector" | "vector_simple_hybrid" | "vector_semantic_hybrid"; + +/** The input definition information for an OpenAPI tool as used to configure an agent. */ +export interface OpenApiTool extends Tool { + /** The object type, which is always 'openapi'. */ + type: "openapi"; + /** Deprecated. This property is deprecated and will be removed in a future version. */ tool_configs?: Record; - /** The bing custom search tool parameters. */ - bing_custom_search_preview: BingCustomSearchToolParameters; + /** The openapi function definition. */ + openapi: OpenApiFunctionDefinition; } -export function bingCustomSearchPreviewToolSerializer(item: BingCustomSearchPreviewTool): any { +export function openApiToolSerializer(item: OpenApiTool): any { return { type: item["type"], - name: item["name"], - description: item["description"], tool_configs: !item["tool_configs"] ? item["tool_configs"] : toolConfigRecordSerializer(item["tool_configs"]), - bing_custom_search_preview: bingCustomSearchToolParametersSerializer( - item["bing_custom_search_preview"], - ), + openapi: openApiFunctionDefinitionSerializer(item["openapi"]), }; } -export function bingCustomSearchPreviewToolDeserializer(item: any): BingCustomSearchPreviewTool { +export function openApiToolDeserializer(item: any): OpenApiTool { return { type: item["type"], - name: item["name"], - description: item["description"], tool_configs: !item["tool_configs"] ? item["tool_configs"] : toolConfigRecordDeserializer(item["tool_configs"]), - bing_custom_search_preview: bingCustomSearchToolParametersDeserializer( - item["bing_custom_search_preview"], - ), + openapi: openApiFunctionDefinitionDeserializer(item["openapi"]), }; } -/** The bing custom search tool parameters. */ -export interface BingCustomSearchToolParameters { - /** - * The project connections attached to this tool. There can be a maximum of 1 connection - * resource attached to the tool. - */ - search_configurations: BingCustomSearchConfiguration[]; -} - -export function bingCustomSearchToolParametersSerializer( - item: BingCustomSearchToolParameters, -): any { - return { - search_configurations: bingCustomSearchConfigurationArraySerializer( - item["search_configurations"], - ), - }; +/** The input definition information for an openapi function. */ +export interface OpenApiFunctionDefinition { + /** 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 openapi function shape, described as a JSON Schema object. */ + spec: Record; + /** Open API authentication details */ + auth: OpenApiAuthDetailsUnion; + /** List of OpenAPI spec parameters that will use user-provided defaults */ + default_params?: string[]; + /** List of function definitions used by OpenApi tool */ + readonly functions?: { + name: string; + description?: string; + parameters: Record; + }[]; } -export function bingCustomSearchToolParametersDeserializer( - item: any, -): BingCustomSearchToolParameters { +export function openApiFunctionDefinitionSerializer(item: OpenApiFunctionDefinition): any { return { - search_configurations: bingCustomSearchConfigurationArrayDeserializer( - item["search_configurations"], - ), + name: item["name"], + description: item["description"], + spec: item["spec"], + auth: openApiAuthDetailsUnionSerializer(item["auth"]), + default_params: !item["default_params"] + ? item["default_params"] + : item["default_params"].map((p: any) => { + return p; + }), }; } -export function bingCustomSearchConfigurationArraySerializer( - result: Array, -): any[] { - return result.map((item) => { - return bingCustomSearchConfigurationSerializer(item); - }); +export function openApiFunctionDefinitionDeserializer(item: any): OpenApiFunctionDefinition { + return { + name: item["name"], + description: item["description"], + spec: Object.fromEntries(Object.entries(item["spec"]).map(([k, p]: [string, any]) => [k, p])), + auth: openApiAuthDetailsUnionDeserializer(item["auth"]), + default_params: !item["default_params"] + ? item["default_params"] + : item["default_params"].map((p: any) => { + return p; + }), + functions: !item["functions"] + ? item["functions"] + : _openApiFunctionDefinitionFunctionArrayDeserializer(item["functions"]), + }; } -export function bingCustomSearchConfigurationArrayDeserializer( - result: Array, -): any[] { - return result.map((item) => { - return bingCustomSearchConfigurationDeserializer(item); - }); +/** authentication details for OpenApiFunctionDefinition */ +export interface OpenApiAuthDetails { + /** The type of authentication, must be anonymous/project_connection/managed_identity */ + /** The discriminator possible values: anonymous, project_connection, managed_identity */ + type: OpenApiAuthType; } -/** A bing custom search configuration. */ -export interface BingCustomSearchConfiguration { - /** Project connection id for grounding with bing search */ - project_connection_id: string; - /** Name of the custom configuration instance given to config. */ - instance_name: string; - /** The market where the results come from. */ - market?: string; - /** The language to use for user interface strings when calling Bing API. */ - set_lang?: string; - /** The number of search results to return in the bing api response */ - count?: number; - /** Filter search results by a specific time range. See [accepted values here](https://learn.microsoft.com/bing/search-apis/bing-web-search/reference/query-parameters). */ - freshness?: string; +export function openApiAuthDetailsSerializer(item: OpenApiAuthDetails): any { + return { type: item["type"] }; } -export function bingCustomSearchConfigurationSerializer(item: BingCustomSearchConfiguration): any { +export function openApiAuthDetailsDeserializer(item: any): OpenApiAuthDetails { return { - project_connection_id: item["project_connection_id"], - instance_name: item["instance_name"], - market: item["market"], - set_lang: item["set_lang"], - count: item["count"], - freshness: item["freshness"], + type: item["type"], }; } -export function bingCustomSearchConfigurationDeserializer( - item: any, -): BingCustomSearchConfiguration { - return { - project_connection_id: item["project_connection_id"], - instance_name: item["instance_name"], - market: item["market"], - set_lang: item["set_lang"], - count: item["count"], - freshness: item["freshness"], - }; +/** Alias for OpenApiAuthDetailsUnion */ +export type OpenApiAuthDetailsUnion = + | OpenApiAnonymousAuthDetails + | OpenApiProjectConnectionAuthDetails + | OpenApiManagedAuthDetails + | OpenApiAuthDetails; + +export function openApiAuthDetailsUnionSerializer(item: OpenApiAuthDetailsUnion): any { + switch (item.type) { + case "anonymous": + return openApiAnonymousAuthDetailsSerializer(item as OpenApiAnonymousAuthDetails); + + case "project_connection": + return openApiProjectConnectionAuthDetailsSerializer( + item as OpenApiProjectConnectionAuthDetails, + ); + + case "managed_identity": + return openApiManagedAuthDetailsSerializer(item as OpenApiManagedAuthDetails); + + default: + return openApiAuthDetailsSerializer(item); + } } -/** The input definition information for a Browser Automation Tool, as used to configure an Agent. */ -export interface BrowserAutomationPreviewTool extends Tool { - /** The object type, which is always 'browser_automation_preview'. */ - type: "browser_automation_preview"; - /** Optional user-defined name for this tool or configuration. */ - name?: string; - /** Optional user-defined description for this tool or configuration. */ - description?: string; - /** - * Per-tool configuration map. Keys are tool names or `*` (catch-all default). - * Resolution order: exact tool name match takes priority over `*`. - * Unknown tool names are silently ignored at runtime. - */ - tool_configs?: Record; - /** The Browser Automation Tool parameters. */ - browser_automation_preview: BrowserAutomationToolParameters; +export function openApiAuthDetailsUnionDeserializer(item: any): OpenApiAuthDetailsUnion { + switch (item["type"]) { + case "anonymous": + return openApiAnonymousAuthDetailsDeserializer(item as OpenApiAnonymousAuthDetails); + + case "project_connection": + return openApiProjectConnectionAuthDetailsDeserializer( + item as OpenApiProjectConnectionAuthDetails, + ); + + case "managed_identity": + return openApiManagedAuthDetailsDeserializer(item as OpenApiManagedAuthDetails); + + default: + return openApiAuthDetailsDeserializer(item); + } } -export function browserAutomationPreviewToolSerializer(item: BrowserAutomationPreviewTool): any { - return { - type: item["type"], - name: item["name"], - description: item["description"], - tool_configs: !item["tool_configs"] - ? item["tool_configs"] - : toolConfigRecordSerializer(item["tool_configs"]), - browser_automation_preview: browserAutomationToolParametersSerializer( - item["browser_automation_preview"], - ), - }; +/** + * Authentication type for OpenApi endpoint. Allowed types are: + * - Anonymous (no authentication required) + * - Project Connection (requires project_connection_id to endpoint, as setup in AI Foundry) + * - Managed_Identity (requires audience for identity based auth) + */ +export type OpenApiAuthType = "anonymous" | "project_connection" | "managed_identity"; + +/** Security details for OpenApi anonymous authentication */ +export interface OpenApiAnonymousAuthDetails extends OpenApiAuthDetails { + /** The object type, which is always 'anonymous'. */ + type: "anonymous"; } -export function browserAutomationPreviewToolDeserializer(item: any): BrowserAutomationPreviewTool { +export function openApiAnonymousAuthDetailsSerializer(item: OpenApiAnonymousAuthDetails): any { + return { type: item["type"] }; +} + +export function openApiAnonymousAuthDetailsDeserializer(item: any): OpenApiAnonymousAuthDetails { return { type: item["type"], - name: item["name"], - description: item["description"], - tool_configs: !item["tool_configs"] - ? item["tool_configs"] - : toolConfigRecordDeserializer(item["tool_configs"]), - browser_automation_preview: browserAutomationToolParametersDeserializer( - item["browser_automation_preview"], - ), }; } -/** Definition of input parameters for the Browser Automation Tool. */ -export interface BrowserAutomationToolParameters { - /** The project connection parameters associated with the Browser Automation Tool. */ - connection: BrowserAutomationToolConnectionParameters; +/** Security details for OpenApi project connection authentication */ +export interface OpenApiProjectConnectionAuthDetails extends OpenApiAuthDetails { + /** The object type, which is always 'project_connection'. */ + type: "project_connection"; + /** Project connection auth security details */ + security_scheme: OpenApiProjectConnectionSecurityScheme; } -export function browserAutomationToolParametersSerializer( - item: BrowserAutomationToolParameters, +export function openApiProjectConnectionAuthDetailsSerializer( + item: OpenApiProjectConnectionAuthDetails, ): any { - return { connection: browserAutomationToolConnectionParametersSerializer(item["connection"]) }; + return { + type: item["type"], + security_scheme: openApiProjectConnectionSecuritySchemeSerializer(item["security_scheme"]), + }; } -export function browserAutomationToolParametersDeserializer( +export function openApiProjectConnectionAuthDetailsDeserializer( item: any, -): BrowserAutomationToolParameters { +): OpenApiProjectConnectionAuthDetails { return { - connection: browserAutomationToolConnectionParametersDeserializer(item["connection"]), + type: item["type"], + security_scheme: openApiProjectConnectionSecuritySchemeDeserializer(item["security_scheme"]), }; } -/** Definition of input parameters for the connection used by the Browser Automation Tool. */ -export interface BrowserAutomationToolConnectionParameters { - /** The ID of the project connection to your Azure Playwright resource. */ +/** Security scheme for OpenApi managed_identity authentication */ +export interface OpenApiProjectConnectionSecurityScheme { + /** Project connection id for Project Connection auth type */ project_connection_id: string; } -export function browserAutomationToolConnectionParametersSerializer( - item: BrowserAutomationToolConnectionParameters, +export function openApiProjectConnectionSecuritySchemeSerializer( + item: OpenApiProjectConnectionSecurityScheme, ): any { return { project_connection_id: item["project_connection_id"] }; } -export function browserAutomationToolConnectionParametersDeserializer( +export function openApiProjectConnectionSecuritySchemeDeserializer( item: any, -): BrowserAutomationToolConnectionParameters { +): OpenApiProjectConnectionSecurityScheme { return { project_connection_id: item["project_connection_id"], }; } -/** The input definition information for an Azure Function Tool, as used to configure an Agent. */ -export interface AzureFunctionTool extends Tool { - /** The object type, which is always 'browser_automation'. */ - type: "azure_function"; - /** The Azure Function Tool definition. */ - azure_function: AzureFunctionDefinition; - /** - * Per-tool configuration map. Keys are tool names or `*` (catch-all default). - * Resolution order: exact tool name match takes priority over `*`. - * Unknown tool names are silently ignored at runtime. - */ - tool_configs?: Record; +/** Security details for OpenApi managed_identity authentication */ +export interface OpenApiManagedAuthDetails extends OpenApiAuthDetails { + /** The object type, which is always 'managed_identity'. */ + type: "managed_identity"; + /** Connection auth security details */ + security_scheme: OpenApiManagedSecurityScheme; } -export function azureFunctionToolSerializer(item: AzureFunctionTool): any { +export function openApiManagedAuthDetailsSerializer(item: OpenApiManagedAuthDetails): any { return { type: item["type"], - azure_function: azureFunctionDefinitionSerializer(item["azure_function"]), - tool_configs: !item["tool_configs"] - ? item["tool_configs"] - : toolConfigRecordSerializer(item["tool_configs"]), + security_scheme: openApiManagedSecuritySchemeSerializer(item["security_scheme"]), }; } -export function azureFunctionToolDeserializer(item: any): AzureFunctionTool { +export function openApiManagedAuthDetailsDeserializer(item: any): OpenApiManagedAuthDetails { return { type: item["type"], - azure_function: azureFunctionDefinitionDeserializer(item["azure_function"]), - tool_configs: !item["tool_configs"] - ? item["tool_configs"] - : toolConfigRecordDeserializer(item["tool_configs"]), + security_scheme: openApiManagedSecuritySchemeDeserializer(item["security_scheme"]), }; } -/** The definition of Azure function. */ -export interface AzureFunctionDefinition { - /** The definition of azure function and its parameters. */ - function: { - name: string; - description?: string; - parameters: Record; - }; - /** Input storage queue. The queue storage trigger runs a function as messages are added to it. */ - input_binding: AzureFunctionBinding; - /** Output storage queue. The function writes output to this queue when the input items are processed. */ - output_binding: AzureFunctionBinding; +/** Security scheme for OpenApi managed_identity authentication */ +export interface OpenApiManagedSecurityScheme { + /** Authentication scope for managed_identity auth type */ + audience: string; } -export function azureFunctionDefinitionSerializer(item: AzureFunctionDefinition): any { - return { - function: _azureFunctionDefinitionFunctionSerializer(item["function"]), - input_binding: azureFunctionBindingSerializer(item["input_binding"]), - output_binding: azureFunctionBindingSerializer(item["output_binding"]), - }; +export function openApiManagedSecuritySchemeSerializer(item: OpenApiManagedSecurityScheme): any { + return { audience: item["audience"] }; } -export function azureFunctionDefinitionDeserializer(item: any): AzureFunctionDefinition { +export function openApiManagedSecuritySchemeDeserializer(item: any): OpenApiManagedSecurityScheme { return { - function: _azureFunctionDefinitionFunctionDeserializer(item["function"]), - input_binding: azureFunctionBindingDeserializer(item["input_binding"]), - output_binding: azureFunctionBindingDeserializer(item["output_binding"]), + audience: item["audience"], }; } -/** model interface _AzureFunctionDefinitionFunction */ -export interface _AzureFunctionDefinitionFunction { +export function _openApiFunctionDefinitionFunctionArrayDeserializer( + result: Array<_OpenApiFunctionDefinitionFunction>, +): any[] { + return result.map((item) => { + return _openApiFunctionDefinitionFunctionDeserializer(item); + }); +} + +/** model interface _OpenApiFunctionDefinitionFunction */ +export interface _OpenApiFunctionDefinitionFunction { /** 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. */ @@ -1618,15 +1671,9 @@ export interface _AzureFunctionDefinitionFunction { parameters: Record; } -export function _azureFunctionDefinitionFunctionSerializer( - item: _AzureFunctionDefinitionFunction, -): any { - return { name: item["name"], description: item["description"], parameters: item["parameters"] }; -} - -export function _azureFunctionDefinitionFunctionDeserializer( +export function _openApiFunctionDefinitionFunctionDeserializer( item: any, -): _AzureFunctionDefinitionFunction { +): _OpenApiFunctionDefinitionFunction { return { name: item["name"], description: item["description"], @@ -1636,445 +1683,327 @@ export function _azureFunctionDefinitionFunctionDeserializer( }; } -/** The structure for keeping storage queue name and URI. */ -export interface AzureFunctionBinding { - /** The type of binding, which is always 'storage_queue'. */ - type: "storage_queue"; - /** Storage queue. */ - storage_queue: AzureFunctionStorageQueue; +/** The input definition information for a Bing custom search tool as used to configure an agent. */ +export interface BingCustomSearchPreviewTool extends Tool { + /** The object type, which is always 'bing_custom_search_preview'. */ + type: "bing_custom_search_preview"; + /** The bing custom search tool parameters. */ + bing_custom_search_preview: BingCustomSearchToolParameters; } -export function azureFunctionBindingSerializer(item: AzureFunctionBinding): any { +export function bingCustomSearchPreviewToolSerializer(item: BingCustomSearchPreviewTool): any { return { type: item["type"], - storage_queue: azureFunctionStorageQueueSerializer(item["storage_queue"]), + bing_custom_search_preview: bingCustomSearchToolParametersSerializer( + item["bing_custom_search_preview"], + ), }; } -export function azureFunctionBindingDeserializer(item: any): AzureFunctionBinding { +export function bingCustomSearchPreviewToolDeserializer(item: any): BingCustomSearchPreviewTool { return { type: item["type"], - storage_queue: azureFunctionStorageQueueDeserializer(item["storage_queue"]), + bing_custom_search_preview: bingCustomSearchToolParametersDeserializer( + item["bing_custom_search_preview"], + ), }; } -/** The structure for keeping storage queue name and URI. */ -export interface AzureFunctionStorageQueue { - /** URI to the Azure Storage Queue service allowing you to manipulate a queue. */ - queue_service_endpoint: string; - /** The name of an Azure function storage queue. */ - queue_name: string; +/** The bing custom search tool parameters. */ +export interface BingCustomSearchToolParameters { + /** + * The project connections attached to this tool. There can be a maximum of 1 connection + * resource attached to the tool. + */ + search_configurations: BingCustomSearchConfiguration[]; } -export function azureFunctionStorageQueueSerializer(item: AzureFunctionStorageQueue): any { - return { queue_service_endpoint: item["queue_service_endpoint"], queue_name: item["queue_name"] }; +export function bingCustomSearchToolParametersSerializer( + item: BingCustomSearchToolParameters, +): any { + return { + search_configurations: bingCustomSearchConfigurationArraySerializer( + item["search_configurations"], + ), + }; } -export function azureFunctionStorageQueueDeserializer(item: any): AzureFunctionStorageQueue { +export function bingCustomSearchToolParametersDeserializer( + item: any, +): BingCustomSearchToolParameters { return { - queue_service_endpoint: item["queue_service_endpoint"], - queue_name: item["queue_name"], + search_configurations: bingCustomSearchConfigurationArrayDeserializer( + item["search_configurations"], + ), }; } -/** A tool for capturing structured outputs */ -export interface CaptureStructuredOutputsTool extends Tool { - /** The type of the tool. Always `capture_structured_outputs`. */ - type: "capture_structured_outputs"; - /** Optional user-defined name for this tool or configuration. */ - name?: string; - /** Optional user-defined description for this tool or configuration. */ - description?: string; - /** - * Per-tool configuration map. Keys are tool names or `*` (catch-all default). - * Resolution order: exact tool name match takes priority over `*`. - * Unknown tool names are silently ignored at runtime. - */ - tool_configs?: Record; - /** The structured outputs to capture from the model. */ - outputs: StructuredOutputDefinition; +export function bingCustomSearchConfigurationArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return bingCustomSearchConfigurationSerializer(item); + }); } -export function captureStructuredOutputsToolSerializer(item: CaptureStructuredOutputsTool): any { +export function bingCustomSearchConfigurationArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return bingCustomSearchConfigurationDeserializer(item); + }); +} + +/** A bing custom search configuration. */ +export interface BingCustomSearchConfiguration { + /** Project connection id for grounding with bing search */ + project_connection_id: string; + /** Name of the custom configuration instance given to config. */ + instance_name: string; + /** The market where the results come from. */ + market?: string; + /** The language to use for user interface strings when calling Bing API. */ + set_lang?: string; + /** The number of search results to return in the bing api response */ + count?: number; + /** Filter search results by a specific time range. See [accepted values here](https://learn.microsoft.com/bing/search-apis/bing-web-search/reference/query-parameters). */ + freshness?: string; +} + +export function bingCustomSearchConfigurationSerializer(item: BingCustomSearchConfiguration): any { return { - type: item["type"], - name: item["name"], - description: item["description"], - tool_configs: !item["tool_configs"] - ? item["tool_configs"] - : toolConfigRecordSerializer(item["tool_configs"]), - outputs: structuredOutputDefinitionSerializer(item["outputs"]), + project_connection_id: item["project_connection_id"], + instance_name: item["instance_name"], + market: item["market"], + set_lang: item["set_lang"], + count: item["count"], + freshness: item["freshness"], }; } -export function captureStructuredOutputsToolDeserializer(item: any): CaptureStructuredOutputsTool { +export function bingCustomSearchConfigurationDeserializer( + item: any, +): BingCustomSearchConfiguration { return { - type: item["type"], - name: item["name"], - description: item["description"], - tool_configs: !item["tool_configs"] - ? item["tool_configs"] - : toolConfigRecordDeserializer(item["tool_configs"]), - outputs: structuredOutputDefinitionDeserializer(item["outputs"]), + project_connection_id: item["project_connection_id"], + instance_name: item["instance_name"], + market: item["market"], + set_lang: item["set_lang"], + count: item["count"], + freshness: item["freshness"], }; } -/** A structured output that can be produced by the agent. */ -export interface StructuredOutputDefinition { - /** The name of the structured output. */ - name: string; - /** A description of the output to emit. Used by the model to determine when to emit the output. */ - description: string; - /** The JSON schema for the structured output. */ - schema: Record; - /** Whether to enforce strict validation. Default `true`. */ - strict: boolean | null; +/** The input definition information for a Browser Automation Tool, as used to configure an Agent. */ +export interface BrowserAutomationPreviewTool extends Tool { + /** The object type, which is always 'browser_automation_preview'. */ + type: "browser_automation_preview"; + /** The Browser Automation Tool parameters. */ + browser_automation_preview: BrowserAutomationToolParameters; } -export function structuredOutputDefinitionSerializer(item: StructuredOutputDefinition): any { +export function browserAutomationPreviewToolSerializer(item: BrowserAutomationPreviewTool): any { return { - name: item["name"], - description: item["description"], - schema: item["schema"], - strict: item["strict"], + type: item["type"], + browser_automation_preview: browserAutomationToolParametersSerializer( + item["browser_automation_preview"], + ), }; } -export function structuredOutputDefinitionDeserializer(item: any): StructuredOutputDefinition { +export function browserAutomationPreviewToolDeserializer(item: any): BrowserAutomationPreviewTool { return { - name: item["name"], - description: item["description"], - schema: Object.fromEntries( - Object.entries(item["schema"]).map(([k, p]: [string, any]) => [k, p]), + type: item["type"], + browser_automation_preview: browserAutomationToolParametersDeserializer( + item["browser_automation_preview"], ), - strict: item["strict"], }; } -/** An agent implementing the A2A protocol. */ -export interface A2APreviewTool extends Tool { - /** The type of the tool. Always `"a2a_preview`. */ - type: "a2a_preview"; - /** Optional user-defined name for this tool or configuration. */ - name?: string; - /** Optional user-defined description for this tool or configuration. */ - description?: string; - /** - * Per-tool configuration map. Keys are tool names or `*` (catch-all default). - * Resolution order: exact tool name match takes priority over `*`. - * Unknown tool names are silently ignored at runtime. - */ - tool_configs?: Record; - /** Base URL of the agent. */ - base_url?: string; - /** - * The path to the agent card relative to the `base_url`. - * If not provided, defaults to `/.well-known/agent-card.json` - */ - agent_card_path?: string; - /** - * The connection ID in the project for the A2A server. - * The connection stores authentication and other connection details needed to connect to the A2A server. - */ - project_connection_id?: string; +/** Definition of input parameters for the Browser Automation Tool. */ +export interface BrowserAutomationToolParameters { + /** The project connection parameters associated with the Browser Automation Tool. */ + connection: BrowserAutomationToolConnectionParameters; } -export function a2APreviewToolSerializer(item: A2APreviewTool): any { - return { - type: item["type"], - name: item["name"], - description: item["description"], - tool_configs: !item["tool_configs"] - ? item["tool_configs"] - : toolConfigRecordSerializer(item["tool_configs"]), - base_url: item["base_url"], - agent_card_path: item["agent_card_path"], - project_connection_id: item["project_connection_id"], - }; +export function browserAutomationToolParametersSerializer( + item: BrowserAutomationToolParameters, +): any { + return { connection: browserAutomationToolConnectionParametersSerializer(item["connection"]) }; } -export function a2APreviewToolDeserializer(item: any): A2APreviewTool { - return { - type: item["type"], - name: item["name"], - description: item["description"], - tool_configs: !item["tool_configs"] - ? item["tool_configs"] - : toolConfigRecordDeserializer(item["tool_configs"]), - base_url: item["base_url"], - agent_card_path: item["agent_card_path"], - project_connection_id: item["project_connection_id"], +export function browserAutomationToolParametersDeserializer( + item: any, +): BrowserAutomationToolParameters { + return { + connection: browserAutomationToolConnectionParametersDeserializer(item["connection"]), }; } -/** A WorkIQ server-side tool. */ -export interface WorkIQPreviewTool extends Tool { - /** The object type, which is always 'work_iq_preview'. */ - type: "work_iq_preview"; - /** The ID of the WorkIQ project connection. */ +/** Definition of input parameters for the connection used by the Browser Automation Tool. */ +export interface BrowserAutomationToolConnectionParameters { + /** The ID of the project connection to your Azure Playwright resource. */ project_connection_id: string; - /** Optional user-defined name for this tool or configuration. */ - name?: string; - /** Optional user-defined description for this tool or configuration. */ - description?: string; - /** - * Per-tool configuration map. Keys are tool names or `*` (catch-all default). - * Resolution order: exact tool name match takes priority over `*`. - * Unknown tool names are silently ignored at runtime. - */ - tool_configs?: Record; } -export function workIQPreviewToolSerializer(item: WorkIQPreviewTool): any { - return { - type: item["type"], - project_connection_id: item["project_connection_id"], - name: item["name"], - description: item["description"], - tool_configs: !item["tool_configs"] - ? item["tool_configs"] - : toolConfigRecordSerializer(item["tool_configs"]), - }; +export function browserAutomationToolConnectionParametersSerializer( + item: BrowserAutomationToolConnectionParameters, +): any { + return { project_connection_id: item["project_connection_id"] }; } -export function workIQPreviewToolDeserializer(item: any): WorkIQPreviewTool { +export function browserAutomationToolConnectionParametersDeserializer( + item: any, +): BrowserAutomationToolConnectionParameters { return { - type: item["type"], project_connection_id: item["project_connection_id"], - name: item["name"], - description: item["description"], - tool_configs: !item["tool_configs"] - ? item["tool_configs"] - : toolConfigRecordDeserializer(item["tool_configs"]), }; } -/** A FabricIQ server-side tool. */ -export interface FabricIQPreviewTool extends Tool { - /** The object type, which is always 'fabric_iq_preview'. */ - type: "fabric_iq_preview"; - /** The ID of the FabricIQ project connection. */ - project_connection_id: string; - /** (Optional) The label of the FabricIQ MCP server to connect to. */ - server_label?: string; - /** (Optional) The URL of the FabricIQ MCP server. If not provided, the URL from the project connection will be used. */ - server_url?: string; - /** (Optional) Whether the agent requires approval before executing actions. Default is always. */ - require_approval?: MCPToolRequireApproval | string; - /** Optional user-defined name for this tool or configuration. */ - name?: string; - /** Optional user-defined description for this tool or configuration. */ - description?: string; - /** - * Per-tool configuration map. Keys are tool names or `*` (catch-all default). - * Resolution order: exact tool name match takes priority over `*`. - * Unknown tool names are silently ignored at runtime. - */ +/** The input definition information for an Azure Function Tool, as used to configure an Agent. */ +export interface AzureFunctionTool extends Tool { + /** The object type, which is always 'browser_automation'. */ + type: "azure_function"; + /** Deprecated. This property is deprecated and will be removed in a future version. */ tool_configs?: Record; + /** The Azure Function Tool definition. */ + azure_function: AzureFunctionDefinition; } -export function fabricIQPreviewToolSerializer(item: FabricIQPreviewTool): any { +export function azureFunctionToolSerializer(item: AzureFunctionTool): any { return { type: item["type"], - project_connection_id: item["project_connection_id"], - server_label: item["server_label"], - server_url: item["server_url"], - require_approval: !item["require_approval"] - ? item["require_approval"] - : _fabricIQPreviewToolRequireApprovalSerializer(item["require_approval"]), - name: item["name"], - description: item["description"], tool_configs: !item["tool_configs"] ? item["tool_configs"] : toolConfigRecordSerializer(item["tool_configs"]), + azure_function: azureFunctionDefinitionSerializer(item["azure_function"]), }; } -export function fabricIQPreviewToolDeserializer(item: any): FabricIQPreviewTool { +export function azureFunctionToolDeserializer(item: any): AzureFunctionTool { return { type: item["type"], - project_connection_id: item["project_connection_id"], - server_label: item["server_label"], - server_url: item["server_url"], - require_approval: !item["require_approval"] - ? item["require_approval"] - : _fabricIQPreviewToolRequireApprovalDeserializer(item["require_approval"]), - name: item["name"], - description: item["description"], tool_configs: !item["tool_configs"] ? item["tool_configs"] : toolConfigRecordDeserializer(item["tool_configs"]), + azure_function: azureFunctionDefinitionDeserializer(item["azure_function"]), }; } -/** Alias for _FabricIQPreviewToolRequireApproval */ -export type _FabricIQPreviewToolRequireApproval = MCPToolRequireApproval | string; - -export function _fabricIQPreviewToolRequireApprovalSerializer( - item: _FabricIQPreviewToolRequireApproval, -): any { - return item; -} - -export function _fabricIQPreviewToolRequireApprovalDeserializer( - item: any, -): _FabricIQPreviewToolRequireApproval { - return item; -} - -/** model interface MCPToolRequireApproval */ -export interface MCPToolRequireApproval { - always?: MCPToolFilter; - never?: MCPToolFilter; +/** The definition of Azure function. */ +export interface AzureFunctionDefinition { + /** The definition of azure function and its parameters. */ + function: { + name: string; + description?: string; + parameters: Record; + }; + /** Input storage queue. The queue storage trigger runs a function as messages are added to it. */ + input_binding: AzureFunctionBinding; + /** Output storage queue. The function writes output to this queue when the input items are processed. */ + output_binding: AzureFunctionBinding; } -export function mcpToolRequireApprovalSerializer(item: MCPToolRequireApproval): any { +export function azureFunctionDefinitionSerializer(item: AzureFunctionDefinition): any { return { - always: !item["always"] ? item["always"] : mcpToolFilterSerializer(item["always"]), - never: !item["never"] ? item["never"] : mcpToolFilterSerializer(item["never"]), + function: _azureFunctionDefinitionFunctionSerializer(item["function"]), + input_binding: azureFunctionBindingSerializer(item["input_binding"]), + output_binding: azureFunctionBindingSerializer(item["output_binding"]), }; } -export function mcpToolRequireApprovalDeserializer(item: any): MCPToolRequireApproval { +export function azureFunctionDefinitionDeserializer(item: any): AzureFunctionDefinition { return { - always: !item["always"] ? item["always"] : mcpToolFilterDeserializer(item["always"]), - never: !item["never"] ? item["never"] : mcpToolFilterDeserializer(item["never"]), + function: _azureFunctionDefinitionFunctionDeserializer(item["function"]), + input_binding: azureFunctionBindingDeserializer(item["input_binding"]), + output_binding: azureFunctionBindingDeserializer(item["output_binding"]), }; } -/** A filter object to specify which tools are allowed. */ -export interface MCPToolFilter { - /** List of allowed tool names. */ - tool_names?: string[]; - /** - * Indicates whether or not a tool modifies data or is read-only. If an - * MCP server is [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint), - * it will match this filter. - */ - read_only?: boolean; +/** model interface _AzureFunctionDefinitionFunction */ +export interface _AzureFunctionDefinitionFunction { + /** 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: Record; } -export function mcpToolFilterSerializer(item: MCPToolFilter): any { - return { - tool_names: !item["tool_names"] - ? item["tool_names"] - : item["tool_names"].map((p: any) => { - return p; - }), - read_only: item["read_only"], - }; +export function _azureFunctionDefinitionFunctionSerializer( + item: _AzureFunctionDefinitionFunction, +): any { + return { name: item["name"], description: item["description"], parameters: item["parameters"] }; } -export function mcpToolFilterDeserializer(item: any): MCPToolFilter { +export function _azureFunctionDefinitionFunctionDeserializer( + item: any, +): _AzureFunctionDefinitionFunction { return { - tool_names: !item["tool_names"] - ? item["tool_names"] - : item["tool_names"].map((p: any) => { - return p; - }), - read_only: item["read_only"], + name: item["name"], + description: item["description"], + parameters: Object.fromEntries( + Object.entries(item["parameters"]).map(([k, p]: [string, any]) => [k, p]), + ), }; } -/** A tool for integrating memories into the agent. */ -export interface MemorySearchPreviewTool extends Tool { - /** The type of the tool. Always `memory_search_preview`. */ - type: "memory_search_preview"; - /** Optional user-defined name for this tool or configuration. */ - name?: string; - /** Optional user-defined description for this tool or configuration. */ - description?: string; - /** - * Per-tool configuration map. Keys are tool names or `*` (catch-all default). - * Resolution order: exact tool name match takes priority over `*`. - * Unknown tool names are silently ignored at runtime. - */ - tool_configs?: Record; - /** The name of the memory store to use. */ - memory_store_name: string; - /** - * The namespace used to group and isolate memories, such as a user ID. - * Limits which memories can be retrieved or updated. - * Use special variable `{{$userId}}` to scope memories to the current signed-in user. - */ - scope: string; - /** Options for searching the memory store. */ - search_options?: MemorySearchOptions; - /** Time to wait before updating memories after inactivity (seconds). Default 300. */ - update_delay?: number; +/** The structure for keeping storage queue name and URI. */ +export interface AzureFunctionBinding { + /** The type of binding, which is always 'storage_queue'. */ + type: "storage_queue"; + /** Storage queue. */ + storage_queue: AzureFunctionStorageQueue; } -export function memorySearchPreviewToolSerializer(item: MemorySearchPreviewTool): any { +export function azureFunctionBindingSerializer(item: AzureFunctionBinding): any { return { type: item["type"], - name: item["name"], - description: item["description"], - tool_configs: !item["tool_configs"] - ? item["tool_configs"] - : toolConfigRecordSerializer(item["tool_configs"]), - memory_store_name: item["memory_store_name"], - scope: item["scope"], - search_options: !item["search_options"] - ? item["search_options"] - : memorySearchOptionsSerializer(item["search_options"]), - update_delay: item["update_delay"], + storage_queue: azureFunctionStorageQueueSerializer(item["storage_queue"]), }; } -export function memorySearchPreviewToolDeserializer(item: any): MemorySearchPreviewTool { +export function azureFunctionBindingDeserializer(item: any): AzureFunctionBinding { return { type: item["type"], - name: item["name"], - description: item["description"], - tool_configs: !item["tool_configs"] - ? item["tool_configs"] - : toolConfigRecordDeserializer(item["tool_configs"]), - memory_store_name: item["memory_store_name"], - scope: item["scope"], - search_options: !item["search_options"] - ? item["search_options"] - : memorySearchOptionsDeserializer(item["search_options"]), - update_delay: item["update_delay"], + storage_queue: azureFunctionStorageQueueDeserializer(item["storage_queue"]), }; } -/** Memory search options. */ -export interface MemorySearchOptions { - /** Maximum number of memory items to return. */ - max_memories?: number; +/** The structure for keeping storage queue name and URI. */ +export interface AzureFunctionStorageQueue { + /** URI to the Azure Storage Queue service allowing you to manipulate a queue. */ + queue_service_endpoint: string; + /** The name of an Azure function storage queue. */ + queue_name: string; } -export function memorySearchOptionsSerializer(item: MemorySearchOptions): any { - return { max_memories: item["max_memories"] }; +export function azureFunctionStorageQueueSerializer(item: AzureFunctionStorageQueue): any { + return { queue_service_endpoint: item["queue_service_endpoint"], queue_name: item["queue_name"] }; } -export function memorySearchOptionsDeserializer(item: any): MemorySearchOptions { +export function azureFunctionStorageQueueDeserializer(item: any): AzureFunctionStorageQueue { return { - max_memories: item["max_memories"], + queue_service_endpoint: item["queue_service_endpoint"], + queue_name: item["queue_name"], }; } -/** - * A tool for searching over the agent's toolbox. - * When present, deferred tools are hidden from `tools/list` and only - * discoverable via `search_tools` queries at runtime. - */ -export interface ToolboxSearchPreviewTool extends Tool { - /** The type of the tool. Always `toolbox_search_preview`. */ - type: "toolbox_search_preview"; - /** Optional user-defined name for this tool or configuration. */ +/** A tool for capturing structured outputs */ +export interface CaptureStructuredOutputsTool extends Tool { + /** The type of the tool. Always `capture_structured_outputs`. */ + type: "capture_structured_outputs"; + /** Deprecated. This property is deprecated and will be removed in a future version. */ name?: string; - /** Optional user-defined description for this tool or configuration. */ + /** Deprecated. This property is deprecated and will be removed in a future version. */ description?: string; - /** - * Per-tool configuration map. Keys are tool names or `*` (catch-all default). - * Resolution order: exact tool name match takes priority over `*`. - * Unknown tool names are silently ignored at runtime. - */ + /** Deprecated. This property is deprecated and will be removed in a future version. */ tool_configs?: Record; + /** The structured outputs to capture from the model. */ + outputs: StructuredOutputDefinition; } -export function toolboxSearchPreviewToolSerializer(item: ToolboxSearchPreviewTool): any { +export function captureStructuredOutputsToolSerializer(item: CaptureStructuredOutputsTool): any { return { type: item["type"], name: item["name"], @@ -2082,10 +2011,11 @@ export function toolboxSearchPreviewToolSerializer(item: ToolboxSearchPreviewToo tool_configs: !item["tool_configs"] ? item["tool_configs"] : toolConfigRecordSerializer(item["tool_configs"]), + outputs: structuredOutputDefinitionSerializer(item["outputs"]), }; } -export function toolboxSearchPreviewToolDeserializer(item: any): ToolboxSearchPreviewTool { +export function captureStructuredOutputsToolDeserializer(item: any): CaptureStructuredOutputsTool { return { type: item["type"], name: item["name"], @@ -2093,2201 +2023,2019 @@ export function toolboxSearchPreviewToolDeserializer(item: any): ToolboxSearchPr tool_configs: !item["tool_configs"] ? item["tool_configs"] : toolConfigRecordDeserializer(item["tool_configs"]), + outputs: structuredOutputDefinitionDeserializer(item["outputs"]), }; } -/** A tool that runs Python code to help generate a response to a prompt. */ -export interface CodeInterpreterTool extends Tool { - /** The type of the code interpreter tool. Always `code_interpreter`. */ - type: "code_interpreter"; - /** Optional user-defined name for this tool or configuration. */ - name?: string; - /** Optional user-defined description for this tool or configuration. */ - description?: string; - /** - * Per-tool configuration map. Keys are tool names or `*` (catch-all default). - * Resolution order: exact tool name match takes priority over `*`. - * Unknown tool names are silently ignored at runtime. - */ - tool_configs?: Record; - /** - * The code interpreter container. Can be a container ID or an object that - * specifies uploaded file IDs to make available to your code, along with an - * optional `memory_limit` setting. - * If not provided, the service assumes auto. - */ - container?: string | AutoCodeInterpreterToolParam; +/** A structured output that can be produced by the agent. */ +export interface StructuredOutputDefinition { + /** The name of the structured output. */ + name: string; + /** A description of the output to emit. Used by the model to determine when to emit the output. */ + description: string; + /** The JSON schema for the structured output. */ + schema: Record; + /** Whether to enforce strict validation. Default `true`. */ + strict: boolean | null; } -export function codeInterpreterToolSerializer(item: CodeInterpreterTool): any { +export function structuredOutputDefinitionSerializer(item: StructuredOutputDefinition): any { return { - type: item["type"], name: item["name"], description: item["description"], - tool_configs: !item["tool_configs"] - ? item["tool_configs"] - : toolConfigRecordSerializer(item["tool_configs"]), - container: !item["container"] - ? item["container"] - : _codeInterpreterToolContainerSerializer(item["container"]), + schema: item["schema"], + strict: item["strict"], }; } -export function codeInterpreterToolDeserializer(item: any): CodeInterpreterTool { +export function structuredOutputDefinitionDeserializer(item: any): StructuredOutputDefinition { return { - type: item["type"], name: item["name"], description: item["description"], - tool_configs: !item["tool_configs"] - ? item["tool_configs"] - : toolConfigRecordDeserializer(item["tool_configs"]), - container: !item["container"] - ? item["container"] - : _codeInterpreterToolContainerDeserializer(item["container"]), + schema: Object.fromEntries( + Object.entries(item["schema"]).map(([k, p]: [string, any]) => [k, p]), + ), + strict: item["strict"], }; } -/** Alias for _CodeInterpreterToolContainer */ -export type _CodeInterpreterToolContainer = string | AutoCodeInterpreterToolParam; - -export function _codeInterpreterToolContainerSerializer(item: _CodeInterpreterToolContainer): any { - return item; -} - -export function _codeInterpreterToolContainerDeserializer( - item: any, -): _CodeInterpreterToolContainer { - return item; -} - -/** Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on. */ -export interface AutoCodeInterpreterToolParam { - /** Always `auto`. */ - type: "auto"; - /** An optional list of uploaded files to make available to your code. */ - file_ids?: string[]; - memory_limit?: ContainerMemoryLimit; - network_policy?: ContainerNetworkPolicyParamUnion; -} - -export function autoCodeInterpreterToolParamSerializer(item: AutoCodeInterpreterToolParam): any { - return { - type: item["type"], - file_ids: !item["file_ids"] - ? item["file_ids"] - : item["file_ids"].map((p: any) => { - return p; - }), - memory_limit: item["memory_limit"], - network_policy: !item["network_policy"] - ? item["network_policy"] - : containerNetworkPolicyParamUnionSerializer(item["network_policy"]), - }; +/** An agent implementing the A2A protocol. */ +export interface A2APreviewTool extends Tool { + /** The type of the tool. Always `"a2a_preview`. */ + type: "a2a_preview"; + /** Base URL of the agent. */ + base_url?: string; + /** + * The path to the agent card relative to the `base_url`. + * If not provided, defaults to `/.well-known/agent-card.json` + */ + agent_card_path?: string; + /** + * The connection ID in the project for the A2A server. + * The connection stores authentication and other connection details needed to connect to the A2A server. + */ + project_connection_id?: string; + /** + * When `true`, Foundry sends its credentials when fetching the remote + * agent's Agent Card. The service defaults to `false` if a value is not + * specified by the caller (anonymous fetch). + */ + send_credentials_for_agent_card?: boolean; } -export function autoCodeInterpreterToolParamDeserializer(item: any): AutoCodeInterpreterToolParam { +export function a2APreviewToolSerializer(item: A2APreviewTool): any { return { type: item["type"], - file_ids: !item["file_ids"] - ? item["file_ids"] - : item["file_ids"].map((p: any) => { - return p; - }), - memory_limit: item["memory_limit"], - network_policy: !item["network_policy"] - ? item["network_policy"] - : containerNetworkPolicyParamUnionDeserializer(item["network_policy"]), + base_url: item["base_url"], + agent_card_path: item["agent_card_path"], + project_connection_id: item["project_connection_id"], + send_credentials_for_agent_card: item["send_credentials_for_agent_card"], }; } -/** Type of ContainerMemoryLimit */ -export type ContainerMemoryLimit = "1g" | "4g" | "16g" | "64g"; - -/** Network access policy for the container. */ -export interface ContainerNetworkPolicyParam { - type: ContainerNetworkPolicyParamType; -} - -export function containerNetworkPolicyParamSerializer(item: ContainerNetworkPolicyParam): any { - return { type: item["type"] }; -} - -export function containerNetworkPolicyParamDeserializer(item: any): ContainerNetworkPolicyParam { +export function a2APreviewToolDeserializer(item: any): A2APreviewTool { return { type: item["type"], + base_url: item["base_url"], + agent_card_path: item["agent_card_path"], + project_connection_id: item["project_connection_id"], + send_credentials_for_agent_card: item["send_credentials_for_agent_card"], }; } -/** Alias for ContainerNetworkPolicyParamUnion */ -export type ContainerNetworkPolicyParamUnion = - | ContainerNetworkPolicyDisabledParam - | ContainerNetworkPolicyAllowlistParam - | ContainerNetworkPolicyParam; - -export function containerNetworkPolicyParamUnionSerializer( - item: ContainerNetworkPolicyParamUnion, -): any { - switch (item.type) { - case "disabled": - return containerNetworkPolicyDisabledParamSerializer( - item as ContainerNetworkPolicyDisabledParam, - ); - - case "allowlist": - return containerNetworkPolicyAllowlistParamSerializer( - item as ContainerNetworkPolicyAllowlistParam, - ); - - default: - return containerNetworkPolicyParamSerializer(item); - } -} - -export function containerNetworkPolicyParamUnionDeserializer( - item: any, -): ContainerNetworkPolicyParamUnion { - switch (item["type"]) { - case "disabled": - return containerNetworkPolicyDisabledParamDeserializer( - item as ContainerNetworkPolicyDisabledParam, - ); - - case "allowlist": - return containerNetworkPolicyAllowlistParamDeserializer( - item as ContainerNetworkPolicyAllowlistParam, - ); - - default: - return containerNetworkPolicyParamDeserializer(item); - } -} - -/** Type of ContainerNetworkPolicyParamType */ -export type ContainerNetworkPolicyParamType = "disabled" | "allowlist"; - -/** model interface ContainerNetworkPolicyDisabledParam */ -export interface ContainerNetworkPolicyDisabledParam extends ContainerNetworkPolicyParam { - /** Disable outbound network access. Always `disabled`. */ - type: "disabled"; +/** A WorkIQ server-side tool. */ +export interface WorkIQPreviewTool extends Tool { + /** The object type, which is always 'work_iq_preview'. */ + type: "work_iq_preview"; + /** The ID of the WorkIQ project connection. */ + project_connection_id: string; } -export function containerNetworkPolicyDisabledParamSerializer( - item: ContainerNetworkPolicyDisabledParam, -): any { - return { type: item["type"] }; +export function workIQPreviewToolSerializer(item: WorkIQPreviewTool): any { + return { type: item["type"], project_connection_id: item["project_connection_id"] }; } -export function containerNetworkPolicyDisabledParamDeserializer( - item: any, -): ContainerNetworkPolicyDisabledParam { +export function workIQPreviewToolDeserializer(item: any): WorkIQPreviewTool { return { type: item["type"], + project_connection_id: item["project_connection_id"], }; } -/** model interface ContainerNetworkPolicyAllowlistParam */ -export interface ContainerNetworkPolicyAllowlistParam extends ContainerNetworkPolicyParam { - /** Allow outbound network access only to specified domains. Always `allowlist`. */ - type: "allowlist"; - /** A list of allowed domains when type is `allowlist`. */ - allowed_domains: string[]; - /** Optional domain-scoped secrets for allowlisted domains. */ - domain_secrets?: ContainerNetworkPolicyDomainSecretParam[]; +/** A FabricIQ server-side tool. */ +export interface FabricIQPreviewTool extends Tool { + /** The object type, which is always 'fabric_iq_preview'. */ + type: "fabric_iq_preview"; + /** The ID of the FabricIQ project connection. */ + project_connection_id: string; + /** (Optional) The label of the FabricIQ MCP server to connect to. */ + server_label?: string; + /** (Optional) The URL of the FabricIQ MCP server. If not provided, the URL from the project connection will be used. */ + server_url?: string; + /** (Optional) Whether the agent requires approval before executing actions. Default is always. */ + require_approval?: MCPToolRequireApproval | string; } -export function containerNetworkPolicyAllowlistParamSerializer( - item: ContainerNetworkPolicyAllowlistParam, -): any { +export function fabricIQPreviewToolSerializer(item: FabricIQPreviewTool): any { return { type: item["type"], - allowed_domains: item["allowed_domains"].map((p: any) => { - return p; - }), - domain_secrets: !item["domain_secrets"] - ? item["domain_secrets"] - : containerNetworkPolicyDomainSecretParamArraySerializer(item["domain_secrets"]), + project_connection_id: item["project_connection_id"], + server_label: item["server_label"], + server_url: item["server_url"], + require_approval: !item["require_approval"] + ? item["require_approval"] + : _fabricIQPreviewToolRequireApprovalSerializer(item["require_approval"]), }; } -export function containerNetworkPolicyAllowlistParamDeserializer( - item: any, -): ContainerNetworkPolicyAllowlistParam { +export function fabricIQPreviewToolDeserializer(item: any): FabricIQPreviewTool { return { type: item["type"], - allowed_domains: item["allowed_domains"].map((p: any) => { - return p; - }), - domain_secrets: !item["domain_secrets"] - ? item["domain_secrets"] - : containerNetworkPolicyDomainSecretParamArrayDeserializer(item["domain_secrets"]), + project_connection_id: item["project_connection_id"], + server_label: item["server_label"], + server_url: item["server_url"], + require_approval: !item["require_approval"] + ? item["require_approval"] + : _fabricIQPreviewToolRequireApprovalDeserializer(item["require_approval"]), }; } -export function containerNetworkPolicyDomainSecretParamArraySerializer( - result: Array, -): any[] { - return result.map((item) => { - return containerNetworkPolicyDomainSecretParamSerializer(item); - }); +/** Alias for _FabricIQPreviewToolRequireApproval */ +export type _FabricIQPreviewToolRequireApproval = MCPToolRequireApproval | string; + +export function _fabricIQPreviewToolRequireApprovalSerializer( + item: _FabricIQPreviewToolRequireApproval, +): any { + return item; } -export function containerNetworkPolicyDomainSecretParamArrayDeserializer( - result: Array, -): any[] { - return result.map((item) => { - return containerNetworkPolicyDomainSecretParamDeserializer(item); - }); +export function _fabricIQPreviewToolRequireApprovalDeserializer( + item: any, +): _FabricIQPreviewToolRequireApproval { + return item; } -/** model interface ContainerNetworkPolicyDomainSecretParam */ -export interface ContainerNetworkPolicyDomainSecretParam { - /** The domain associated with the secret. */ - domain: string; - /** The name of the secret to inject for the domain. */ - name: string; - /** The secret value to inject for the domain. */ - value: string; +/** model interface MCPToolRequireApproval */ +export interface MCPToolRequireApproval { + always?: MCPToolFilter; + never?: MCPToolFilter; } -export function containerNetworkPolicyDomainSecretParamSerializer( - item: ContainerNetworkPolicyDomainSecretParam, -): any { - return { domain: item["domain"], name: item["name"], value: item["value"] }; +export function mcpToolRequireApprovalSerializer(item: MCPToolRequireApproval): any { + return { + always: !item["always"] ? item["always"] : mcpToolFilterSerializer(item["always"]), + never: !item["never"] ? item["never"] : mcpToolFilterSerializer(item["never"]), + }; } -export function containerNetworkPolicyDomainSecretParamDeserializer( - item: any, -): ContainerNetworkPolicyDomainSecretParam { +export function mcpToolRequireApprovalDeserializer(item: any): MCPToolRequireApproval { return { - domain: item["domain"], - name: item["name"], - value: item["value"], + always: !item["always"] ? item["always"] : mcpToolFilterDeserializer(item["always"]), + never: !item["never"] ? item["never"] : mcpToolFilterDeserializer(item["never"]), }; } -/** Defines a function in your own code the model can choose to call. Learn more about [function calling](https://platform.openai.com/docs/guides/function-calling). */ -export interface FunctionTool extends Tool { - /** The type of the function tool. Always `function`. */ - type: "function"; - /** The name of the function to call. */ - name: string; - description?: string; - parameters: Record | null; - strict: boolean | null; - /** Whether this function is deferred and loaded via tool search. */ - defer_loading?: boolean; +/** A filter object to specify which tools are allowed. */ +export interface MCPToolFilter { + /** List of allowed tool names. */ + tool_names?: string[]; + /** + * Indicates whether or not a tool modifies data or is read-only. If an + * MCP server is [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint), + * it will match this filter. + */ + read_only?: boolean; } -export function functionToolSerializer(item: FunctionTool): any { +export function mcpToolFilterSerializer(item: MCPToolFilter): any { return { - type: item["type"], - name: item["name"], - description: item["description"], - parameters: item["parameters"], - strict: item["strict"], - defer_loading: item["defer_loading"], + tool_names: !item["tool_names"] + ? item["tool_names"] + : item["tool_names"].map((p: any) => { + return p; + }), + read_only: item["read_only"], }; } -export function functionToolDeserializer(item: any): FunctionTool { +export function mcpToolFilterDeserializer(item: any): MCPToolFilter { return { - type: item["type"], - name: item["name"], - description: item["description"], - parameters: !item["parameters"] - ? item["parameters"] - : Object.fromEntries( - Object.entries(item["parameters"]).map(([k1, p1]: [string, any]) => [k1, p1]), - ), - strict: item["strict"], - defer_loading: item["defer_loading"], + tool_names: !item["tool_names"] + ? item["tool_names"] + : item["tool_names"].map((p: any) => { + return p; + }), + read_only: item["read_only"], }; } -/** A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](https://platform.openai.com/docs/guides/tools-file-search). */ -export interface FileSearchTool extends Tool { - /** The type of the file search tool. Always `file_search`. */ - type: "file_search"; - /** The IDs of the vector stores to search. */ - vector_store_ids: string[]; - /** The maximum number of results to return. This number should be between 1 and 50 inclusive. */ - max_num_results?: number; - /** Ranking options for search. */ - ranking_options?: RankingOptions; - filters?: Filters; - /** Optional user-defined name for this tool or configuration. */ - name?: string; - /** Optional user-defined description for this tool or configuration. */ - description?: string; +/** A tool for integrating memories into the agent. */ +export interface MemorySearchPreviewTool extends Tool { + /** The type of the tool. Always `memory_search_preview`. */ + type: "memory_search_preview"; + /** The name of the memory store to use. */ + memory_store_name: string; /** - * Per-tool configuration map. Keys are tool names or `*` (catch-all default). - * Resolution order: exact tool name match takes priority over `*`. - * Unknown tool names are silently ignored at runtime. + * The namespace used to group and isolate memories, such as a user ID. + * Limits which memories can be retrieved or updated. + * Use special variable `{{$userId}}` to scope memories to the current signed-in user. */ - tool_configs?: Record; + scope: string; + /** Options for searching the memory store. */ + search_options?: MemorySearchOptions; + /** Time to wait before updating memories after inactivity (seconds). Default 300. */ + update_delay?: number; } -export function fileSearchToolSerializer(item: FileSearchTool): any { +export function memorySearchPreviewToolSerializer(item: MemorySearchPreviewTool): any { return { type: item["type"], - vector_store_ids: item["vector_store_ids"].map((p: any) => { - return p; - }), - max_num_results: item["max_num_results"], - ranking_options: !item["ranking_options"] - ? item["ranking_options"] - : rankingOptionsSerializer(item["ranking_options"]), - filters: !item["filters"] ? item["filters"] : filtersSerializer(item["filters"]), - name: item["name"], - description: item["description"], - tool_configs: !item["tool_configs"] - ? item["tool_configs"] - : toolConfigRecordSerializer(item["tool_configs"]), + memory_store_name: item["memory_store_name"], + scope: item["scope"], + search_options: !item["search_options"] + ? item["search_options"] + : memorySearchOptionsSerializer(item["search_options"]), + update_delay: item["update_delay"], }; } -export function fileSearchToolDeserializer(item: any): FileSearchTool { +export function memorySearchPreviewToolDeserializer(item: any): MemorySearchPreviewTool { return { type: item["type"], - vector_store_ids: item["vector_store_ids"].map((p: any) => { - return p; - }), - max_num_results: item["max_num_results"], - ranking_options: !item["ranking_options"] - ? item["ranking_options"] - : rankingOptionsDeserializer(item["ranking_options"]), - filters: !item["filters"] ? item["filters"] : filtersDeserializer(item["filters"]), - name: item["name"], - description: item["description"], - tool_configs: !item["tool_configs"] - ? item["tool_configs"] - : toolConfigRecordDeserializer(item["tool_configs"]), + memory_store_name: item["memory_store_name"], + scope: item["scope"], + search_options: !item["search_options"] + ? item["search_options"] + : memorySearchOptionsDeserializer(item["search_options"]), + update_delay: item["update_delay"], }; } -/** model interface RankingOptions */ -export interface RankingOptions { - /** The ranker to use for the file search. */ - ranker?: RankerVersionType; - /** The score threshold for the file search, a number between 0 and 1. Numbers closer to 1 will attempt to return only the most relevant results, but may return fewer results. */ - score_threshold?: number; - /** Weights that control how reciprocal rank fusion balances semantic embedding matches versus sparse keyword matches when hybrid search is enabled. */ - hybrid_search?: HybridSearchOptions; +/** Memory search options. */ +export interface MemorySearchOptions { + /** Maximum number of memory items to return. */ + max_memories?: number; } -export function rankingOptionsSerializer(item: RankingOptions): any { - return { - ranker: item["ranker"], - score_threshold: item["score_threshold"], - hybrid_search: !item["hybrid_search"] - ? item["hybrid_search"] - : hybridSearchOptionsSerializer(item["hybrid_search"]), - }; +export function memorySearchOptionsSerializer(item: MemorySearchOptions): any { + return { max_memories: item["max_memories"] }; } -export function rankingOptionsDeserializer(item: any): RankingOptions { +export function memorySearchOptionsDeserializer(item: any): MemorySearchOptions { return { - ranker: item["ranker"], - score_threshold: item["score_threshold"], - hybrid_search: !item["hybrid_search"] - ? item["hybrid_search"] - : hybridSearchOptionsDeserializer(item["hybrid_search"]), + max_memories: item["max_memories"], }; } -/** Type of RankerVersionType */ -export type RankerVersionType = "auto" | "default-2024-11-15"; - -/** model interface HybridSearchOptions */ -export interface HybridSearchOptions { - /** The weight of the embedding in the reciprocal ranking fusion. */ - embedding_weight: number; - /** The weight of the text in the reciprocal ranking fusion. */ - text_weight: number; +/** A tool that runs Python code to help generate a response to a prompt. */ +export interface CodeInterpreterTool extends Tool { + /** The type of the code interpreter tool. Always `code_interpreter`. */ + type: "code_interpreter"; + /** Deprecated. This property is deprecated and will be removed in a future version. */ + name?: string; + /** Deprecated. This property is deprecated and will be removed in a future version. */ + description?: string; + /** Deprecated. This property is deprecated and will be removed in a future version. */ + tool_configs?: Record; + /** + * The code interpreter container. Can be a container ID or an object that + * specifies uploaded file IDs to make available to your code, along with an + * optional `memory_limit` setting. + * If not provided, the service assumes auto. + */ + container?: string | AutoCodeInterpreterToolParam; } -export function hybridSearchOptionsSerializer(item: HybridSearchOptions): any { - return { embedding_weight: item["embedding_weight"], text_weight: item["text_weight"] }; +export function codeInterpreterToolSerializer(item: CodeInterpreterTool): any { + return { + type: item["type"], + name: item["name"], + description: item["description"], + tool_configs: !item["tool_configs"] + ? item["tool_configs"] + : toolConfigRecordSerializer(item["tool_configs"]), + container: !item["container"] + ? item["container"] + : _codeInterpreterToolContainerSerializer(item["container"]), + }; } -export function hybridSearchOptionsDeserializer(item: any): HybridSearchOptions { +export function codeInterpreterToolDeserializer(item: any): CodeInterpreterTool { return { - embedding_weight: item["embedding_weight"], - text_weight: item["text_weight"], + type: item["type"], + name: item["name"], + description: item["description"], + tool_configs: !item["tool_configs"] + ? item["tool_configs"] + : toolConfigRecordDeserializer(item["tool_configs"]), + container: !item["container"] + ? item["container"] + : _codeInterpreterToolContainerDeserializer(item["container"]), }; } -/** Alias for Filters */ -export type Filters = ComparisonFilter | CompoundFilter; +/** Alias for _CodeInterpreterToolContainer */ +export type _CodeInterpreterToolContainer = string | AutoCodeInterpreterToolParam; -export function filtersSerializer(item: Filters): any { +export function _codeInterpreterToolContainerSerializer(item: _CodeInterpreterToolContainer): any { return item; } -export function filtersDeserializer(item: any): Filters { +export function _codeInterpreterToolContainerDeserializer( + item: any, +): _CodeInterpreterToolContainer { return item; } -/** A filter used to compare a specified attribute key to a given value using a defined comparison operation. */ -export interface ComparisonFilter { - /** - * Specifies the comparison operator: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`, `in`, `nin`. - * - `eq`: equals - * - `ne`: not equal - * - `gt`: greater than - * - `gte`: greater than or equal - * - `lt`: less than - * - `lte`: less than or equal - * - `in`: in - * - `nin`: not in - */ - type: "eq" | "ne" | "gt" | "gte" | "lt" | "lte" | "in" | "nin"; - /** The key to compare against the value. */ - key: string; - /** The value to compare against the attribute key; supports string, number, or boolean types. */ - value: string | number | boolean | (string | number)[]; +/** Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on. */ +export interface AutoCodeInterpreterToolParam { + /** Always `auto`. */ + type: "auto"; + /** An optional list of uploaded files to make available to your code. */ + file_ids?: string[]; + memory_limit?: ContainerMemoryLimit; + network_policy?: ContainerNetworkPolicyParamUnion; } -export function comparisonFilterSerializer(item: ComparisonFilter): any { +export function autoCodeInterpreterToolParamSerializer(item: AutoCodeInterpreterToolParam): any { return { type: item["type"], - key: item["key"], - value: _fileSearchToolFiltersValueSerializer(item["value"]), + file_ids: !item["file_ids"] + ? item["file_ids"] + : item["file_ids"].map((p: any) => { + return p; + }), + memory_limit: item["memory_limit"], + network_policy: !item["network_policy"] + ? item["network_policy"] + : containerNetworkPolicyParamUnionSerializer(item["network_policy"]), }; } -export function comparisonFilterDeserializer(item: any): ComparisonFilter { +export function autoCodeInterpreterToolParamDeserializer(item: any): AutoCodeInterpreterToolParam { return { type: item["type"], - key: item["key"], - value: _fileSearchToolFiltersValueDeserializer(item["value"]), + file_ids: !item["file_ids"] + ? item["file_ids"] + : item["file_ids"].map((p: any) => { + return p; + }), + memory_limit: item["memory_limit"], + network_policy: !item["network_policy"] + ? item["network_policy"] + : containerNetworkPolicyParamUnionDeserializer(item["network_policy"]), }; } -/** Alias for _FileSearchToolFiltersValue */ -export type _FileSearchToolFiltersValue = string | number | boolean | (string | number)[]; +/** Type of ContainerMemoryLimit */ +export type ContainerMemoryLimit = "1g" | "4g" | "16g" | "64g"; -export function _fileSearchToolFiltersValueSerializer(item: _FileSearchToolFiltersValue): any { - return item; +/** Network access policy for the container. */ +export interface ContainerNetworkPolicyParam { + type: ContainerNetworkPolicyParamType; } -export function _fileSearchToolFiltersValueDeserializer(item: any): _FileSearchToolFiltersValue { - return item; +export function containerNetworkPolicyParamSerializer(item: ContainerNetworkPolicyParam): any { + return { type: item["type"] }; } -export function _fileSearchToolFiltersValue1ArraySerializer( - result: Array<_FileSearchToolFiltersValue1>, -): any[] { - return result.map((item) => { - return _fileSearchToolFiltersValue1Serializer(item); - }); +export function containerNetworkPolicyParamDeserializer(item: any): ContainerNetworkPolicyParam { + return { + type: item["type"], + }; } -export function _fileSearchToolFiltersValue1ArrayDeserializer( - result: Array<_FileSearchToolFiltersValue1>, -): any[] { - return result.map((item) => { - return _fileSearchToolFiltersValue1Deserializer(item); - }); +/** Alias for ContainerNetworkPolicyParamUnion */ +export type ContainerNetworkPolicyParamUnion = + | ContainerNetworkPolicyDisabledParam + | ContainerNetworkPolicyAllowlistParam + | ContainerNetworkPolicyParam; + +export function containerNetworkPolicyParamUnionSerializer( + item: ContainerNetworkPolicyParamUnion, +): any { + switch (item.type) { + case "disabled": + return containerNetworkPolicyDisabledParamSerializer( + item as ContainerNetworkPolicyDisabledParam, + ); + + case "allowlist": + return containerNetworkPolicyAllowlistParamSerializer( + item as ContainerNetworkPolicyAllowlistParam, + ); + + default: + return containerNetworkPolicyParamSerializer(item); + } } -/** Alias for _FileSearchToolFiltersValue1 */ -export type _FileSearchToolFiltersValue1 = string | number; +export function containerNetworkPolicyParamUnionDeserializer( + item: any, +): ContainerNetworkPolicyParamUnion { + switch (item["type"]) { + case "disabled": + return containerNetworkPolicyDisabledParamDeserializer( + item as ContainerNetworkPolicyDisabledParam, + ); -export function _fileSearchToolFiltersValue1Serializer(item: _FileSearchToolFiltersValue1): any { - return item; + case "allowlist": + return containerNetworkPolicyAllowlistParamDeserializer( + item as ContainerNetworkPolicyAllowlistParam, + ); + + default: + return containerNetworkPolicyParamDeserializer(item); + } } -export function _fileSearchToolFiltersValue1Deserializer(item: any): _FileSearchToolFiltersValue1 { - return item; +/** Type of ContainerNetworkPolicyParamType */ +export type ContainerNetworkPolicyParamType = "disabled" | "allowlist"; + +/** model interface ContainerNetworkPolicyDisabledParam */ +export interface ContainerNetworkPolicyDisabledParam extends ContainerNetworkPolicyParam { + /** Disable outbound network access. Always `disabled`. */ + type: "disabled"; } -/** Combine multiple filters using `and` or `or`. */ -export interface CompoundFilter { - /** Type of operation: `and` or `or`. */ - type: "and" | "or"; - /** Array of filters to combine. Items can be `ComparisonFilter` or `CompoundFilter`. */ - filters: (ComparisonFilter | any)[]; +export function containerNetworkPolicyDisabledParamSerializer( + item: ContainerNetworkPolicyDisabledParam, +): any { + return { type: item["type"] }; } -export function compoundFilterSerializer(item: CompoundFilter): any { +export function containerNetworkPolicyDisabledParamDeserializer( + item: any, +): ContainerNetworkPolicyDisabledParam { return { type: item["type"], - filters: _fileSearchToolFiltersFilterArraySerializer(item["filters"]), }; } -export function compoundFilterDeserializer(item: any): CompoundFilter { +/** model interface ContainerNetworkPolicyAllowlistParam */ +export interface ContainerNetworkPolicyAllowlistParam extends ContainerNetworkPolicyParam { + /** Allow outbound network access only to specified domains. Always `allowlist`. */ + type: "allowlist"; + /** A list of allowed domains when type is `allowlist`. */ + allowed_domains: string[]; + /** Optional domain-scoped secrets for allowlisted domains. */ + domain_secrets?: ContainerNetworkPolicyDomainSecretParam[]; +} + +export function containerNetworkPolicyAllowlistParamSerializer( + item: ContainerNetworkPolicyAllowlistParam, +): any { return { type: item["type"], - filters: _fileSearchToolFiltersFilterArrayDeserializer(item["filters"]), + allowed_domains: item["allowed_domains"].map((p: any) => { + return p; + }), + domain_secrets: !item["domain_secrets"] + ? item["domain_secrets"] + : containerNetworkPolicyDomainSecretParamArraySerializer(item["domain_secrets"]), }; } -export function _fileSearchToolFiltersFilterArraySerializer( - result: Array<_FileSearchToolFiltersFilter>, -): any[] { - return result.map((item) => { - return _fileSearchToolFiltersFilterSerializer(item); - }); +export function containerNetworkPolicyAllowlistParamDeserializer( + item: any, +): ContainerNetworkPolicyAllowlistParam { + return { + type: item["type"], + allowed_domains: item["allowed_domains"].map((p: any) => { + return p; + }), + domain_secrets: !item["domain_secrets"] + ? item["domain_secrets"] + : containerNetworkPolicyDomainSecretParamArrayDeserializer(item["domain_secrets"]), + }; } -export function _fileSearchToolFiltersFilterArrayDeserializer( - result: Array<_FileSearchToolFiltersFilter>, +export function containerNetworkPolicyDomainSecretParamArraySerializer( + result: Array, ): any[] { return result.map((item) => { - return _fileSearchToolFiltersFilterDeserializer(item); + return containerNetworkPolicyDomainSecretParamSerializer(item); }); } -/** Alias for _FileSearchToolFiltersFilter */ -export type _FileSearchToolFiltersFilter = ComparisonFilter | any; - -export function _fileSearchToolFiltersFilterSerializer(item: _FileSearchToolFiltersFilter): any { - return item; -} - -export function _fileSearchToolFiltersFilterDeserializer(item: any): _FileSearchToolFiltersFilter { - return item; +export function containerNetworkPolicyDomainSecretParamArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return containerNetworkPolicyDomainSecretParamDeserializer(item); + }); } -/** A tool that controls a virtual computer. Learn more about the [computer tool](https://platform.openai.com/docs/guides/tools-computer-use). */ -export interface ComputerUsePreviewTool extends Tool { - /** The type of the computer use tool. Always `computer_use_preview`. */ - type: "computer_use_preview"; - /** The type of computer environment to control. */ - environment: ComputerEnvironment; - /** The width of the computer display. */ - display_width: number; - /** The height of the computer display. */ - display_height: number; +/** model interface ContainerNetworkPolicyDomainSecretParam */ +export interface ContainerNetworkPolicyDomainSecretParam { + /** The domain associated with the secret. */ + domain: string; + /** The name of the secret to inject for the domain. */ + name: string; + /** The secret value to inject for the domain. */ + value: string; } -export function computerUsePreviewToolSerializer(item: ComputerUsePreviewTool): any { - return { - type: item["type"], - environment: item["environment"], - display_width: item["display_width"], - display_height: item["display_height"], - }; +export function containerNetworkPolicyDomainSecretParamSerializer( + item: ContainerNetworkPolicyDomainSecretParam, +): any { + return { domain: item["domain"], name: item["name"], value: item["value"] }; } -export function computerUsePreviewToolDeserializer(item: any): ComputerUsePreviewTool { +export function containerNetworkPolicyDomainSecretParamDeserializer( + item: any, +): ContainerNetworkPolicyDomainSecretParam { return { - type: item["type"], - environment: item["environment"], - display_width: item["display_width"], - display_height: item["display_height"], + domain: item["domain"], + name: item["name"], + value: item["value"], }; } -/** Type of ComputerEnvironment */ -export type ComputerEnvironment = "windows" | "mac" | "linux" | "ubuntu" | "browser"; - -/** - * Search the Internet for sources related to the prompt. Learn more about the - * [web search tool](/docs/guides/tools-web-search). - */ -export interface WebSearchTool extends Tool { - /** The type of the web search tool. One of `web_search` or `web_search_2025_08_26`. */ - type: "web_search"; - filters?: WebSearchToolFilters; - user_location?: WebSearchApproximateLocation; - /** High level guidance for the amount of context window space to use for the search. One of `low`, `medium`, or `high`. `medium` is the default. */ - search_context_size?: "low" | "medium" | "high"; - /** Optional user-defined name for this tool or configuration. */ +/** A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](https://platform.openai.com/docs/guides/tools-file-search). */ +export interface FileSearchTool extends Tool { + /** The type of the file search tool. Always `file_search`. */ + type: "file_search"; + /** The IDs of the vector stores to search. */ + vector_store_ids: string[]; + /** The maximum number of results to return. This number should be between 1 and 50 inclusive. */ + max_num_results?: number; + /** Ranking options for search. */ + ranking_options?: RankingOptions; + filters?: Filters; + /** Deprecated. This property is deprecated and will be removed in a future version. */ name?: string; - /** Optional user-defined description for this tool or configuration. */ + /** Deprecated. This property is deprecated and will be removed in a future version. */ description?: string; - /** - * Per-tool configuration map. Keys are tool names or `*` (catch-all default). - * Resolution order: exact tool name match takes priority over `*`. - * Unknown tool names are silently ignored at runtime. - */ + /** Deprecated. This property is deprecated and will be removed in a future version. */ tool_configs?: Record; - /** - * The project connections attached to this tool. There can be a maximum of 1 connection - * resource attached to the tool. - */ - custom_search_configuration?: WebSearchConfiguration; } -export function webSearchToolSerializer(item: WebSearchTool): any { +export function fileSearchToolSerializer(item: FileSearchTool): any { return { type: item["type"], - filters: !item["filters"] ? item["filters"] : webSearchToolFiltersSerializer(item["filters"]), - user_location: !item["user_location"] - ? item["user_location"] - : webSearchApproximateLocationSerializer(item["user_location"]), - search_context_size: item["search_context_size"], + vector_store_ids: item["vector_store_ids"].map((p: any) => { + return p; + }), + max_num_results: item["max_num_results"], + ranking_options: !item["ranking_options"] + ? item["ranking_options"] + : rankingOptionsSerializer(item["ranking_options"]), + filters: !item["filters"] ? item["filters"] : filtersSerializer(item["filters"]), name: item["name"], description: item["description"], tool_configs: !item["tool_configs"] ? item["tool_configs"] : toolConfigRecordSerializer(item["tool_configs"]), - custom_search_configuration: !item["custom_search_configuration"] - ? item["custom_search_configuration"] - : webSearchConfigurationSerializer(item["custom_search_configuration"]), }; } -export function webSearchToolDeserializer(item: any): WebSearchTool { +export function fileSearchToolDeserializer(item: any): FileSearchTool { return { type: item["type"], - filters: !item["filters"] ? item["filters"] : webSearchToolFiltersDeserializer(item["filters"]), - user_location: !item["user_location"] - ? item["user_location"] - : webSearchApproximateLocationDeserializer(item["user_location"]), - search_context_size: item["search_context_size"], + vector_store_ids: item["vector_store_ids"].map((p: any) => { + return p; + }), + max_num_results: item["max_num_results"], + ranking_options: !item["ranking_options"] + ? item["ranking_options"] + : rankingOptionsDeserializer(item["ranking_options"]), + filters: !item["filters"] ? item["filters"] : filtersDeserializer(item["filters"]), name: item["name"], description: item["description"], tool_configs: !item["tool_configs"] ? item["tool_configs"] : toolConfigRecordDeserializer(item["tool_configs"]), - custom_search_configuration: !item["custom_search_configuration"] - ? item["custom_search_configuration"] - : webSearchConfigurationDeserializer(item["custom_search_configuration"]), }; } -/** model interface WebSearchToolFilters */ -export interface WebSearchToolFilters { - allowed_domains?: string[]; +/** model interface RankingOptions */ +export interface RankingOptions { + /** The ranker to use for the file search. */ + ranker?: RankerVersionType; + /** The score threshold for the file search, a number between 0 and 1. Numbers closer to 1 will attempt to return only the most relevant results, but may return fewer results. */ + score_threshold?: number; + /** Weights that control how reciprocal rank fusion balances semantic embedding matches versus sparse keyword matches when hybrid search is enabled. */ + hybrid_search?: HybridSearchOptions; } -export function webSearchToolFiltersSerializer(item: WebSearchToolFilters): any { +export function rankingOptionsSerializer(item: RankingOptions): any { return { - allowed_domains: !item["allowed_domains"] - ? item["allowed_domains"] - : item["allowed_domains"].map((p: any) => { - return p; - }), + ranker: item["ranker"], + score_threshold: item["score_threshold"], + hybrid_search: !item["hybrid_search"] + ? item["hybrid_search"] + : hybridSearchOptionsSerializer(item["hybrid_search"]), }; } -export function webSearchToolFiltersDeserializer(item: any): WebSearchToolFilters { +export function rankingOptionsDeserializer(item: any): RankingOptions { return { - allowed_domains: !item["allowed_domains"] - ? item["allowed_domains"] - : item["allowed_domains"].map((p1: any) => { - return p1; - }), + ranker: item["ranker"], + score_threshold: item["score_threshold"], + hybrid_search: !item["hybrid_search"] + ? item["hybrid_search"] + : hybridSearchOptionsDeserializer(item["hybrid_search"]), }; } -/** The approximate location of the user. */ -export interface WebSearchApproximateLocation { - /** The type of location approximation. Always `approximate`. */ - type: "approximate"; - country?: string; - region?: string; - city?: string; - timezone?: string; -} - -export function webSearchApproximateLocationSerializer(item: WebSearchApproximateLocation): any { - return { - type: item["type"], - country: item["country"], - region: item["region"], - city: item["city"], - timezone: item["timezone"], - }; -} +/** Type of RankerVersionType */ +export type RankerVersionType = "auto" | "default-2024-11-15"; -export function webSearchApproximateLocationDeserializer(item: any): WebSearchApproximateLocation { - return { - type: item["type"], - country: item["country"], - region: item["region"], - city: item["city"], - timezone: item["timezone"], - }; +/** model interface HybridSearchOptions */ +export interface HybridSearchOptions { + /** The weight of the embedding in the reciprocal ranking fusion. */ + embedding_weight: number; + /** The weight of the text in the reciprocal ranking fusion. */ + text_weight: number; } -/** A web search configuration for bing custom search */ -export interface WebSearchConfiguration { - /** Project connection id for grounding with bing custom search */ - project_connection_id: string; - /** Name of the custom configuration instance given to config. */ - instance_name: string; +export function hybridSearchOptionsSerializer(item: HybridSearchOptions): any { + return { embedding_weight: item["embedding_weight"], text_weight: item["text_weight"] }; } -export function webSearchConfigurationSerializer(item: WebSearchConfiguration): any { +export function hybridSearchOptionsDeserializer(item: any): HybridSearchOptions { return { - project_connection_id: item["project_connection_id"], - instance_name: item["instance_name"], + embedding_weight: item["embedding_weight"], + text_weight: item["text_weight"], }; } -export function webSearchConfigurationDeserializer(item: any): WebSearchConfiguration { - return { - project_connection_id: item["project_connection_id"], - instance_name: item["instance_name"], - }; +/** Alias for Filters */ +export type Filters = ComparisonFilter | CompoundFilter; + +export function filtersSerializer(item: Filters): any { + return item; } -/** - * Give the model access to additional tools via remote Model Context Protocol - * (MCP) servers. [Learn more about MCP](/docs/guides/tools-remote-mcp). - */ -export interface MCPTool extends Tool { - /** The type of the MCP tool. Always `mcp`. */ - type: "mcp"; - /** A label for this MCP server, used to identify it in tool calls. */ - server_label: string; - /** - * The URL for the MCP server. One of `server_url` or `connector_id` must be - * provided. - */ - server_url?: string; - /** - * Identifier for service connectors, like those available in ChatGPT. One of - * `server_url` or `connector_id` must be provided. Learn more about service - * connectors [here](/docs/guides/tools-remote-mcp#connectors). - * Currently supported `connector_id` values are: - * - Dropbox: `connector_dropbox` - * - Gmail: `connector_gmail` - * - Google Calendar: `connector_googlecalendar` - * - Google Drive: `connector_googledrive` - * - Microsoft Teams: `connector_microsoftteams` - * - Outlook Calendar: `connector_outlookcalendar` - * - Outlook Email: `connector_outlookemail` - * - SharePoint: `connector_sharepoint` - */ - connector_id?: - | "connector_dropbox" - | "connector_gmail" - | "connector_googlecalendar" - | "connector_googledrive" - | "connector_microsoftteams" - | "connector_outlookcalendar" - | "connector_outlookemail" - | "connector_sharepoint"; - /** - * An OAuth access token that can be used with a remote MCP server, either - * with a custom MCP server URL or a service connector. Your application - * must handle the OAuth authorization flow and provide the token here. - */ - authorization?: string; - /** Optional description of the MCP server, used to provide more context. */ - server_description?: string; - headers?: Record; - allowed_tools?: string[] | MCPToolFilter; - require_approval?: MCPToolRequireApproval | "always" | "never"; - /** Whether this MCP tool is deferred and discovered via tool search. */ - defer_loading?: boolean; - /** The connection ID in the project for the MCP server. The connection stores authentication and other connection details needed to connect to the MCP server. */ - project_connection_id?: string; +export function filtersDeserializer(item: any): Filters { + return item; +} + +/** A filter used to compare a specified attribute key to a given value using a defined comparison operation. */ +export interface ComparisonFilter { /** - * Per-tool configuration map. Keys are tool names or `*` (catch-all default). - * Resolution order: exact tool name match takes priority over `*`. - * Unknown tool names are silently ignored at runtime. + * Specifies the comparison operator: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`, `in`, `nin`. + * - `eq`: equals + * - `ne`: not equal + * - `gt`: greater than + * - `gte`: greater than or equal + * - `lt`: less than + * - `lte`: less than or equal + * - `in`: in + * - `nin`: not in */ - tool_configs?: Record; + type: "eq" | "ne" | "gt" | "gte" | "lt" | "lte" | "in" | "nin"; + /** The key to compare against the value. */ + key: string; + /** The value to compare against the attribute key; supports string, number, or boolean types. */ + value: string | number | boolean | (string | number)[]; } -export function mcpToolSerializer(item: MCPTool): any { +export function comparisonFilterSerializer(item: ComparisonFilter): any { return { type: item["type"], - server_label: item["server_label"], - server_url: item["server_url"], - connector_id: item["connector_id"], - authorization: item["authorization"], - server_description: item["server_description"], - headers: item["headers"], - allowed_tools: !item["allowed_tools"] - ? item["allowed_tools"] - : _mcpToolAllowedToolsSerializer(item["allowed_tools"]), - require_approval: !item["require_approval"] - ? item["require_approval"] - : _mcpToolRequireApprovalSerializer(item["require_approval"]), - defer_loading: item["defer_loading"], - project_connection_id: item["project_connection_id"], - tool_configs: !item["tool_configs"] - ? item["tool_configs"] - : toolConfigRecordSerializer(item["tool_configs"]), + key: item["key"], + value: _fileSearchToolFiltersValueSerializer(item["value"]), }; } -export function mcpToolDeserializer(item: any): MCPTool { +export function comparisonFilterDeserializer(item: any): ComparisonFilter { return { type: item["type"], - server_label: item["server_label"], - server_url: item["server_url"], - connector_id: item["connector_id"], - authorization: item["authorization"], - server_description: item["server_description"], - headers: !item["headers"] - ? item["headers"] - : Object.fromEntries( - Object.entries(item["headers"]).map(([k1, p1]: [string, any]) => [k1, p1]), - ), - allowed_tools: !item["allowed_tools"] - ? item["allowed_tools"] - : _mcpToolAllowedToolsDeserializer(item["allowed_tools"]), - require_approval: !item["require_approval"] - ? item["require_approval"] - : _mcpToolRequireApprovalDeserializer(item["require_approval"]), - defer_loading: item["defer_loading"], - project_connection_id: item["project_connection_id"], - tool_configs: !item["tool_configs"] - ? item["tool_configs"] - : toolConfigRecordDeserializer(item["tool_configs"]), + key: item["key"], + value: _fileSearchToolFiltersValueDeserializer(item["value"]), }; } -/** Alias for _MCPToolAllowedTools */ -export type _MCPToolAllowedTools = string[] | MCPToolFilter; +/** Alias for _FileSearchToolFiltersValue */ +export type _FileSearchToolFiltersValue = string | number | boolean | (string | number)[]; -export function _mcpToolAllowedToolsSerializer(item: _MCPToolAllowedTools): any { +export function _fileSearchToolFiltersValueSerializer(item: _FileSearchToolFiltersValue): any { return item; } -export function _mcpToolAllowedToolsDeserializer(item: any): _MCPToolAllowedTools { +export function _fileSearchToolFiltersValueDeserializer(item: any): _FileSearchToolFiltersValue { return item; } -/** Alias for _MCPToolRequireApproval */ -export type _MCPToolRequireApproval = MCPToolRequireApproval | "always" | "never"; +export function _fileSearchToolFiltersValue1ArraySerializer( + result: Array<_FileSearchToolFiltersValue1>, +): any[] { + return result.map((item) => { + return _fileSearchToolFiltersValue1Serializer(item); + }); +} -export function _mcpToolRequireApprovalSerializer(item: _MCPToolRequireApproval): any { +export function _fileSearchToolFiltersValue1ArrayDeserializer( + result: Array<_FileSearchToolFiltersValue1>, +): any[] { + return result.map((item) => { + return _fileSearchToolFiltersValue1Deserializer(item); + }); +} + +/** Alias for _FileSearchToolFiltersValue1 */ +export type _FileSearchToolFiltersValue1 = string | number; + +export function _fileSearchToolFiltersValue1Serializer(item: _FileSearchToolFiltersValue1): any { return item; } -export function _mcpToolRequireApprovalDeserializer(item: any): _MCPToolRequireApproval { +export function _fileSearchToolFiltersValue1Deserializer(item: any): _FileSearchToolFiltersValue1 { return item; } -/** A tool that generates images using the GPT image models. */ -export interface ImageGenTool extends Tool { - /** The type of the image generation tool. Always `image_generation`. */ - type: "image_generation"; - model?: "gpt-image-1" | "gpt-image-1-mini" | "gpt-image-1.5"; - /** - * The quality of the generated image. One of `low`, `medium`, `high`, - * or `auto`. Default: `auto`. - */ - quality?: "low" | "medium" | "high" | "auto"; - /** The size of the generated images. For `gpt-image-2` and `gpt-image-2-2026-04-21`, arbitrary resolutions are supported as `WIDTHxHEIGHT` strings, for example `1536x864`. Width and height must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, and the maximum supported resolution is `3840x2160`. The requested size must also satisfy the model's current pixel and edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are supported by the GPT image models; `auto` is supported for models that allow automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or `1024x1792`. */ - size?: "1024x1024" | "1024x1536" | "1536x1024" | "auto"; - /** - * The output format of the generated image. One of `png`, `webp`, or - * `jpeg`. Default: `png`. - */ - output_format?: "png" | "webp" | "jpeg"; - /** Compression level for the output image. Default: 100. */ - output_compression?: number; - /** Moderation level for the generated image. Default: `auto`. */ - moderation?: "auto" | "low"; - /** - * Background type for the generated image. One of `transparent`, - * `opaque`, or `auto`. Default: `auto`. - */ - background?: "transparent" | "opaque" | "auto"; - input_fidelity?: InputFidelity; - /** - * Optional mask for inpainting. Contains `image_url` - * (string, optional) and `file_id` (string, optional). - */ - input_image_mask?: ImageGenToolInputImageMask; - /** Number of partial images to generate in streaming mode, from 0 (default value) to 3. */ - partial_images?: number; - /** Whether to generate a new image or edit an existing image. Default: `auto`. */ - action?: ImageGenAction; - /** Optional user-defined name for this tool or configuration. */ - name?: string; - /** Optional user-defined description for this tool or configuration. */ - description?: string; - /** - * Per-tool configuration map. Keys are tool names or `*` (catch-all default). - * Resolution order: exact tool name match takes priority over `*`. - * Unknown tool names are silently ignored at runtime. - */ - tool_configs?: Record; +/** Combine multiple filters using `and` or `or`. */ +export interface CompoundFilter { + /** Type of operation: `and` or `or`. */ + type: "and" | "or"; + /** Array of filters to combine. Items can be `ComparisonFilter` or `CompoundFilter`. */ + filters: (ComparisonFilter | any)[]; } -export function imageGenToolSerializer(item: ImageGenTool): any { +export function compoundFilterSerializer(item: CompoundFilter): any { return { type: item["type"], - model: item["model"], - quality: item["quality"], - size: item["size"], - output_format: item["output_format"], - output_compression: item["output_compression"], - moderation: item["moderation"], - background: item["background"], - input_fidelity: item["input_fidelity"], - input_image_mask: !item["input_image_mask"] - ? item["input_image_mask"] - : imageGenToolInputImageMaskSerializer(item["input_image_mask"]), - partial_images: item["partial_images"], - action: item["action"], - name: item["name"], - description: item["description"], - tool_configs: !item["tool_configs"] - ? item["tool_configs"] - : toolConfigRecordSerializer(item["tool_configs"]), + filters: _fileSearchToolFiltersFilterArraySerializer(item["filters"]), }; } -export function imageGenToolDeserializer(item: any): ImageGenTool { +export function compoundFilterDeserializer(item: any): CompoundFilter { return { type: item["type"], - model: item["model"], - quality: item["quality"], - size: item["size"], - output_format: item["output_format"], - output_compression: item["output_compression"], - moderation: item["moderation"], - background: item["background"], - input_fidelity: item["input_fidelity"], - input_image_mask: !item["input_image_mask"] - ? item["input_image_mask"] - : imageGenToolInputImageMaskDeserializer(item["input_image_mask"]), - partial_images: item["partial_images"], - action: item["action"], - name: item["name"], - description: item["description"], - tool_configs: !item["tool_configs"] - ? item["tool_configs"] - : toolConfigRecordDeserializer(item["tool_configs"]), + filters: _fileSearchToolFiltersFilterArrayDeserializer(item["filters"]), }; } -/** Control how much effort the model will exert to match the style and features, especially facial features, of input images. This parameter is only supported for `gpt-image-1` and `gpt-image-1.5` and later models, unsupported for `gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`. */ -export type InputFidelity = "high" | "low"; - -/** model interface ImageGenToolInputImageMask */ -export interface ImageGenToolInputImageMask { - image_url?: string; - file_id?: string; +export function _fileSearchToolFiltersFilterArraySerializer( + result: Array<_FileSearchToolFiltersFilter>, +): any[] { + return result.map((item) => { + return _fileSearchToolFiltersFilterSerializer(item); + }); } -export function imageGenToolInputImageMaskSerializer(item: ImageGenToolInputImageMask): any { - return { image_url: item["image_url"], file_id: item["file_id"] }; +export function _fileSearchToolFiltersFilterArrayDeserializer( + result: Array<_FileSearchToolFiltersFilter>, +): any[] { + return result.map((item) => { + return _fileSearchToolFiltersFilterDeserializer(item); + }); } -export function imageGenToolInputImageMaskDeserializer(item: any): ImageGenToolInputImageMask { - return { - image_url: item["image_url"], - file_id: item["file_id"], - }; +/** Alias for _FileSearchToolFiltersFilter */ +export type _FileSearchToolFiltersFilter = ComparisonFilter | any; + +export function _fileSearchToolFiltersFilterSerializer(item: _FileSearchToolFiltersFilter): any { + return item; } -/** Type of ImageGenAction */ -export type ImageGenAction = "generate" | "edit" | "auto"; +export function _fileSearchToolFiltersFilterDeserializer(item: any): _FileSearchToolFiltersFilter { + return item; +} -/** A tool that allows the model to execute shell commands in a local environment. */ -export interface LocalShellToolParam extends Tool { - /** The type of the local shell tool. Always `local_shell`. */ - type: "local_shell"; - /** Optional user-defined name for this tool or configuration. */ +/** + * Search the Internet for sources related to the prompt. Learn more about the + * [web search tool](/docs/guides/tools-web-search). + */ +export interface WebSearchTool extends Tool { + /** The type of the web search tool. One of `web_search` or `web_search_2025_08_26`. */ + type: "web_search"; + filters?: WebSearchToolFilters; + user_location?: WebSearchApproximateLocation; + /** High level guidance for the amount of context window space to use for the search. One of `low`, `medium`, or `high`. `medium` is the default. */ + search_context_size?: "low" | "medium" | "high"; + /** Deprecated. This property is deprecated and will be removed in a future version. */ name?: string; - /** Optional user-defined description for this tool or configuration. */ + /** Deprecated. This property is deprecated and will be removed in a future version. */ description?: string; + /** Deprecated. This property is deprecated and will be removed in a future version. */ + tool_configs?: Record; /** - * Per-tool configuration map. Keys are tool names or `*` (catch-all default). - * Resolution order: exact tool name match takes priority over `*`. - * Unknown tool names are silently ignored at runtime. + * The project connections attached to this tool. There can be a maximum of 1 connection + * resource attached to the tool. */ - tool_configs?: Record; + custom_search_configuration?: WebSearchConfiguration; } -export function localShellToolParamSerializer(item: LocalShellToolParam): any { +export function webSearchToolSerializer(item: WebSearchTool): any { return { type: item["type"], + filters: !item["filters"] ? item["filters"] : webSearchToolFiltersSerializer(item["filters"]), + user_location: !item["user_location"] + ? item["user_location"] + : webSearchApproximateLocationSerializer(item["user_location"]), + search_context_size: item["search_context_size"], name: item["name"], description: item["description"], tool_configs: !item["tool_configs"] ? item["tool_configs"] : toolConfigRecordSerializer(item["tool_configs"]), + custom_search_configuration: !item["custom_search_configuration"] + ? item["custom_search_configuration"] + : webSearchConfigurationSerializer(item["custom_search_configuration"]), }; } -export function localShellToolParamDeserializer(item: any): LocalShellToolParam { +export function webSearchToolDeserializer(item: any): WebSearchTool { return { type: item["type"], + filters: !item["filters"] ? item["filters"] : webSearchToolFiltersDeserializer(item["filters"]), + user_location: !item["user_location"] + ? item["user_location"] + : webSearchApproximateLocationDeserializer(item["user_location"]), + search_context_size: item["search_context_size"], name: item["name"], description: item["description"], tool_configs: !item["tool_configs"] ? item["tool_configs"] : toolConfigRecordDeserializer(item["tool_configs"]), + custom_search_configuration: !item["custom_search_configuration"] + ? item["custom_search_configuration"] + : webSearchConfigurationDeserializer(item["custom_search_configuration"]), }; } -/** A tool that allows the model to execute shell commands. */ -export interface FunctionShellToolParam extends Tool { - /** The type of the shell tool. Always `shell`. */ - type: "shell"; - environment?: FunctionShellToolParamEnvironmentUnion; - /** Optional user-defined name for this tool or configuration. */ - name?: string; - /** Optional user-defined description for this tool or configuration. */ - description?: string; - /** - * Per-tool configuration map. Keys are tool names or `*` (catch-all default). - * Resolution order: exact tool name match takes priority over `*`. - * Unknown tool names are silently ignored at runtime. - */ - tool_configs?: Record; +/** model interface WebSearchToolFilters */ +export interface WebSearchToolFilters { + allowed_domains?: string[]; } -export function functionShellToolParamSerializer(item: FunctionShellToolParam): any { +export function webSearchToolFiltersSerializer(item: WebSearchToolFilters): any { return { - type: item["type"], - environment: !item["environment"] - ? item["environment"] - : functionShellToolParamEnvironmentUnionSerializer(item["environment"]), - name: item["name"], - description: item["description"], - tool_configs: !item["tool_configs"] - ? item["tool_configs"] - : toolConfigRecordSerializer(item["tool_configs"]), + allowed_domains: !item["allowed_domains"] + ? item["allowed_domains"] + : item["allowed_domains"].map((p: any) => { + return p; + }), }; } -export function functionShellToolParamDeserializer(item: any): FunctionShellToolParam { +export function webSearchToolFiltersDeserializer(item: any): WebSearchToolFilters { return { - type: item["type"], - environment: !item["environment"] - ? item["environment"] - : functionShellToolParamEnvironmentUnionDeserializer(item["environment"]), - name: item["name"], - description: item["description"], - tool_configs: !item["tool_configs"] - ? item["tool_configs"] - : toolConfigRecordDeserializer(item["tool_configs"]), + allowed_domains: !item["allowed_domains"] + ? item["allowed_domains"] + : item["allowed_domains"].map((p1: any) => { + return p1; + }), }; } -/** model interface FunctionShellToolParamEnvironment */ -export interface FunctionShellToolParamEnvironment { - type: FunctionShellToolParamEnvironmentType; +/** The approximate location of the user. */ +export interface WebSearchApproximateLocation { + /** The type of location approximation. Always `approximate`. */ + type: "approximate"; + country?: string; + region?: string; + city?: string; + timezone?: string; } -export function functionShellToolParamEnvironmentSerializer( - item: FunctionShellToolParamEnvironment, -): any { - return { type: item["type"] }; +export function webSearchApproximateLocationSerializer(item: WebSearchApproximateLocation): any { + return { + type: item["type"], + country: item["country"], + region: item["region"], + city: item["city"], + timezone: item["timezone"], + }; } -export function functionShellToolParamEnvironmentDeserializer( - item: any, -): FunctionShellToolParamEnvironment { +export function webSearchApproximateLocationDeserializer(item: any): WebSearchApproximateLocation { return { type: item["type"], + country: item["country"], + region: item["region"], + city: item["city"], + timezone: item["timezone"], }; } -/** Alias for FunctionShellToolParamEnvironmentUnion */ -export type FunctionShellToolParamEnvironmentUnion = - | FunctionShellToolParamEnvironmentLocalEnvironmentParam - | FunctionShellToolParamEnvironmentContainerReferenceParam - | ContainerAutoParam - | FunctionShellToolParamEnvironment; - -export function functionShellToolParamEnvironmentUnionSerializer( - item: FunctionShellToolParamEnvironmentUnion, -): any { - switch (item.type) { - case "local": - return functionShellToolParamEnvironmentLocalEnvironmentParamSerializer( - item as FunctionShellToolParamEnvironmentLocalEnvironmentParam, - ); - - case "container_reference": - return functionShellToolParamEnvironmentContainerReferenceParamSerializer( - item as FunctionShellToolParamEnvironmentContainerReferenceParam, - ); - - case "container_auto": - return containerAutoParamSerializer(item as ContainerAutoParam); +/** A web search configuration for bing custom search */ +export interface WebSearchConfiguration { + /** Project connection id for grounding with bing custom search */ + project_connection_id: string; + /** Name of the custom configuration instance given to config. */ + instance_name: string; +} - default: - return functionShellToolParamEnvironmentSerializer(item); - } +export function webSearchConfigurationSerializer(item: WebSearchConfiguration): any { + return { + project_connection_id: item["project_connection_id"], + instance_name: item["instance_name"], + }; } -export function functionShellToolParamEnvironmentUnionDeserializer( - item: any, -): FunctionShellToolParamEnvironmentUnion { - switch (item["type"]) { - case "local": - return functionShellToolParamEnvironmentLocalEnvironmentParamDeserializer( - item as FunctionShellToolParamEnvironmentLocalEnvironmentParam, - ); +export function webSearchConfigurationDeserializer(item: any): WebSearchConfiguration { + return { + project_connection_id: item["project_connection_id"], + instance_name: item["instance_name"], + }; +} - case "container_reference": - return functionShellToolParamEnvironmentContainerReferenceParamDeserializer( - item as FunctionShellToolParamEnvironmentContainerReferenceParam, - ); +/** + * Give the model access to additional tools via remote Model Context Protocol + * (MCP) servers. [Learn more about MCP](/docs/guides/tools-remote-mcp). + */ +export interface MCPTool extends Tool { + /** The type of the MCP tool. Always `mcp`. */ + type: "mcp"; + /** A label for this MCP server, used to identify it in tool calls. */ + server_label: string; + /** + * The URL for the MCP server. One of `server_url`, `connector_id`, or + * `tunnel_id` must be provided. + */ + server_url?: string; + /** + * Identifier for service connectors, like those available in ChatGPT. One of + * `server_url`, `connector_id`, or `tunnel_id` must be provided. Learn more + * about service connectors [here](/docs/guides/tools-remote-mcp#connectors). + * Currently supported `connector_id` values are: + * - Dropbox: `connector_dropbox` + * - Gmail: `connector_gmail` + * - Google Calendar: `connector_googlecalendar` + * - Google Drive: `connector_googledrive` + * - Microsoft Teams: `connector_microsoftteams` + * - Outlook Calendar: `connector_outlookcalendar` + * - Outlook Email: `connector_outlookemail` + * - SharePoint: `connector_sharepoint` + */ + connector_id?: + | "connector_dropbox" + | "connector_gmail" + | "connector_googlecalendar" + | "connector_googledrive" + | "connector_microsoftteams" + | "connector_outlookcalendar" + | "connector_outlookemail" + | "connector_sharepoint"; + /** + * The Secure MCP Tunnel ID to use instead of a direct server URL. One of + * `server_url`, `connector_id`, or `tunnel_id` must be provided. + */ + tunnel_id?: string; + /** + * An OAuth access token that can be used with a remote MCP server, either + * with a custom MCP server URL or a service connector. Your application + * must handle the OAuth authorization flow and provide the token here. + */ + authorization?: string; + /** Optional description of the MCP server, used to provide more context. */ + server_description?: string; + headers?: Record; + allowed_tools?: string[] | MCPToolFilter; + require_approval?: MCPToolRequireApproval | "always" | "never"; + /** Whether this MCP tool is deferred and discovered via tool search. */ + defer_loading?: boolean; + /** The connection ID in the project for the MCP server. The connection stores authentication and other connection details needed to connect to the MCP server. */ + project_connection_id?: string; + /** Deprecated. This property is deprecated and will be removed in a future version. */ + tool_configs?: Record; +} - case "container_auto": - return containerAutoParamDeserializer(item as ContainerAutoParam); +export function mcpToolSerializer(item: MCPTool): any { + return { + type: item["type"], + server_label: item["server_label"], + server_url: item["server_url"], + connector_id: item["connector_id"], + tunnel_id: item["tunnel_id"], + authorization: item["authorization"], + server_description: item["server_description"], + headers: item["headers"], + allowed_tools: !item["allowed_tools"] + ? item["allowed_tools"] + : _mcpToolAllowedToolsSerializer(item["allowed_tools"]), + require_approval: !item["require_approval"] + ? item["require_approval"] + : _mcpToolRequireApprovalSerializer(item["require_approval"]), + defer_loading: item["defer_loading"], + project_connection_id: item["project_connection_id"], + tool_configs: !item["tool_configs"] + ? item["tool_configs"] + : toolConfigRecordSerializer(item["tool_configs"]), + }; +} - default: - return functionShellToolParamEnvironmentDeserializer(item); - } +export function mcpToolDeserializer(item: any): MCPTool { + return { + type: item["type"], + server_label: item["server_label"], + server_url: item["server_url"], + connector_id: item["connector_id"], + tunnel_id: item["tunnel_id"], + authorization: item["authorization"], + server_description: item["server_description"], + headers: !item["headers"] + ? item["headers"] + : Object.fromEntries( + Object.entries(item["headers"]).map(([k1, p1]: [string, any]) => [k1, p1]), + ), + allowed_tools: !item["allowed_tools"] + ? item["allowed_tools"] + : _mcpToolAllowedToolsDeserializer(item["allowed_tools"]), + require_approval: !item["require_approval"] + ? item["require_approval"] + : _mcpToolRequireApprovalDeserializer(item["require_approval"]), + defer_loading: item["defer_loading"], + project_connection_id: item["project_connection_id"], + tool_configs: !item["tool_configs"] + ? item["tool_configs"] + : toolConfigRecordDeserializer(item["tool_configs"]), + }; } -/** Type of FunctionShellToolParamEnvironmentType */ -export type FunctionShellToolParamEnvironmentType = - | "container_auto" - | "local" - | "container_reference"; +/** Alias for _MCPToolAllowedTools */ +export type _MCPToolAllowedTools = string[] | MCPToolFilter; -/** model interface FunctionShellToolParamEnvironmentLocalEnvironmentParam */ -export interface FunctionShellToolParamEnvironmentLocalEnvironmentParam extends FunctionShellToolParamEnvironment { - /** Use a local computer environment. */ - type: "local"; - /** An optional list of skills. */ - skills?: LocalSkillParam[]; +export function _mcpToolAllowedToolsSerializer(item: _MCPToolAllowedTools): any { + return item; } -export function functionShellToolParamEnvironmentLocalEnvironmentParamSerializer( - item: FunctionShellToolParamEnvironmentLocalEnvironmentParam, -): any { - return { - type: item["type"], - skills: !item["skills"] ? item["skills"] : localSkillParamArraySerializer(item["skills"]), - }; +export function _mcpToolAllowedToolsDeserializer(item: any): _MCPToolAllowedTools { + return item; } -export function functionShellToolParamEnvironmentLocalEnvironmentParamDeserializer( - item: any, -): FunctionShellToolParamEnvironmentLocalEnvironmentParam { - return { - type: item["type"], - skills: !item["skills"] ? item["skills"] : localSkillParamArrayDeserializer(item["skills"]), - }; -} +/** Alias for _MCPToolRequireApproval */ +export type _MCPToolRequireApproval = MCPToolRequireApproval | "always" | "never"; -export function localSkillParamArraySerializer(result: Array): any[] { - return result.map((item) => { - return localSkillParamSerializer(item); - }); +export function _mcpToolRequireApprovalSerializer(item: _MCPToolRequireApproval): any { + return item; } -export function localSkillParamArrayDeserializer(result: Array): any[] { - return result.map((item) => { - return localSkillParamDeserializer(item); - }); +export function _mcpToolRequireApprovalDeserializer(item: any): _MCPToolRequireApproval { + return item; } -/** model interface LocalSkillParam */ -export interface LocalSkillParam { - /** The name of the skill. */ +/** Defines a function in your own code the model can choose to call. Learn more about [function calling](https://platform.openai.com/docs/guides/function-calling). */ +export interface FunctionTool extends Tool { + /** The type of the function tool. Always `function`. */ + type: "function"; + /** The name of the function to call. */ name: string; - /** The description of the skill. */ - description: string; - /** The path to the directory containing the skill. */ - path: string; -} - -export function localSkillParamSerializer(item: LocalSkillParam): any { - return { name: item["name"], description: item["description"], path: item["path"] }; + description?: string; + parameters: Record | null; + strict: boolean | null; + /** Whether this function is deferred and loaded via tool search. */ + defer_loading?: boolean; } -export function localSkillParamDeserializer(item: any): LocalSkillParam { +export function functionToolSerializer(item: FunctionTool): any { return { + type: item["type"], name: item["name"], description: item["description"], - path: item["path"], + parameters: item["parameters"], + strict: item["strict"], + defer_loading: item["defer_loading"], }; } -/** model interface FunctionShellToolParamEnvironmentContainerReferenceParam */ -export interface FunctionShellToolParamEnvironmentContainerReferenceParam extends FunctionShellToolParamEnvironment { - /** References a container created with the /v1/containers endpoint */ - type: "container_reference"; - /** The ID of the referenced container. */ - container_id: string; -} - -export function functionShellToolParamEnvironmentContainerReferenceParamSerializer( - item: FunctionShellToolParamEnvironmentContainerReferenceParam, -): any { - return { type: item["type"], container_id: item["container_id"] }; -} - -export function functionShellToolParamEnvironmentContainerReferenceParamDeserializer( - item: any, -): FunctionShellToolParamEnvironmentContainerReferenceParam { +export function functionToolDeserializer(item: any): FunctionTool { return { type: item["type"], - container_id: item["container_id"], + name: item["name"], + description: item["description"], + parameters: !item["parameters"] + ? item["parameters"] + : Object.fromEntries( + Object.entries(item["parameters"]).map(([k1, p1]: [string, any]) => [k1, p1]), + ), + strict: item["strict"], + defer_loading: item["defer_loading"], }; } -/** model interface ContainerAutoParam */ -export interface ContainerAutoParam extends FunctionShellToolParamEnvironment { - /** Automatically creates a container for this request */ - type: "container_auto"; - /** An optional list of uploaded files to make available to your code. */ - file_ids?: string[]; - memory_limit?: ContainerMemoryLimit; - /** An optional list of skills referenced by id or inline data. */ - skills?: ContainerSkillUnion[]; - network_policy?: ContainerNetworkPolicyParamUnion; +/** A tool that controls a virtual computer. Learn more about the [computer tool](https://platform.openai.com/docs/guides/tools-computer-use). */ +export interface ComputerUsePreviewTool extends Tool { + /** The type of the computer use tool. Always `computer_use_preview`. */ + type: "computer_use_preview"; + /** The type of computer environment to control. */ + environment: ComputerEnvironment; + /** The width of the computer display. */ + display_width: number; + /** The height of the computer display. */ + display_height: number; } -export function containerAutoParamSerializer(item: ContainerAutoParam): any { +export function computerUsePreviewToolSerializer(item: ComputerUsePreviewTool): any { return { type: item["type"], - file_ids: !item["file_ids"] - ? item["file_ids"] - : item["file_ids"].map((p: any) => { - return p; - }), - memory_limit: item["memory_limit"], - skills: !item["skills"] ? item["skills"] : containerSkillUnionArraySerializer(item["skills"]), - network_policy: !item["network_policy"] - ? item["network_policy"] - : containerNetworkPolicyParamUnionSerializer(item["network_policy"]), + environment: item["environment"], + display_width: item["display_width"], + display_height: item["display_height"], }; } -export function containerAutoParamDeserializer(item: any): ContainerAutoParam { +export function computerUsePreviewToolDeserializer(item: any): ComputerUsePreviewTool { return { type: item["type"], - file_ids: !item["file_ids"] - ? item["file_ids"] - : item["file_ids"].map((p: any) => { - return p; - }), - memory_limit: item["memory_limit"], - skills: !item["skills"] ? item["skills"] : containerSkillUnionArrayDeserializer(item["skills"]), - network_policy: !item["network_policy"] - ? item["network_policy"] - : containerNetworkPolicyParamUnionDeserializer(item["network_policy"]), + environment: item["environment"], + display_width: item["display_width"], + display_height: item["display_height"], }; } -export function containerSkillUnionArraySerializer(result: Array): any[] { - return result.map((item) => { - return containerSkillUnionSerializer(item); - }); -} - -export function containerSkillUnionArrayDeserializer(result: Array): any[] { - return result.map((item) => { - return containerSkillUnionDeserializer(item); - }); -} - -/** model interface ContainerSkill */ -export interface ContainerSkill { - type: ContainerSkillType; -} +/** Type of ComputerEnvironment */ +export type ComputerEnvironment = "windows" | "mac" | "linux" | "ubuntu" | "browser"; -export function containerSkillSerializer(item: ContainerSkill): any { - return { type: item["type"] }; +/** A tool that generates images using the GPT image models. */ +export interface ImageGenTool extends Tool { + /** The type of the image generation tool. Always `image_generation`. */ + type: "image_generation"; + model?: "gpt-image-1" | "gpt-image-1-mini" | "gpt-image-1.5"; + /** + * The quality of the generated image. One of `low`, `medium`, `high`, + * or `auto`. Default: `auto`. + */ + quality?: "low" | "medium" | "high" | "auto"; + /** The size of the generated images. For `gpt-image-2` and `gpt-image-2-2026-04-21`, arbitrary resolutions are supported as `WIDTHxHEIGHT` strings, for example `1536x864`. Width and height must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, and the maximum supported resolution is `3840x2160`. The requested size must also satisfy the model's current pixel and edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are supported by the GPT image models; `auto` is supported for models that allow automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or `1024x1792`. */ + size?: "1024x1024" | "1024x1536" | "1536x1024" | "auto"; + /** + * The output format of the generated image. One of `png`, `webp`, or + * `jpeg`. Default: `png`. + */ + output_format?: "png" | "webp" | "jpeg"; + /** Compression level for the output image. Default: 100. */ + output_compression?: number; + /** Moderation level for the generated image. Default: `auto`. */ + moderation?: "auto" | "low"; + /** + * Background type for the generated image. One of `transparent`, + * `opaque`, or `auto`. Default: `auto`. + */ + background?: "transparent" | "opaque" | "auto"; + input_fidelity?: InputFidelity; + /** + * Optional mask for inpainting. Contains `image_url` + * (string, optional) and `file_id` (string, optional). + */ + input_image_mask?: ImageGenToolInputImageMask; + /** Number of partial images to generate in streaming mode, from 0 (default value) to 3. */ + partial_images?: number; + /** Whether to generate a new image or edit an existing image. Default: `auto`. */ + action?: ImageGenAction; + /** Deprecated. This property is deprecated and will be removed in a future version. */ + name?: string; + /** Deprecated. This property is deprecated and will be removed in a future version. */ + description?: string; + /** Deprecated. This property is deprecated and will be removed in a future version. */ + tool_configs?: Record; } -export function containerSkillDeserializer(item: any): ContainerSkill { +export function imageGenToolSerializer(item: ImageGenTool): any { return { type: item["type"], - }; -} - -/** Alias for ContainerSkillUnion */ -export type ContainerSkillUnion = SkillReferenceParam | InlineSkillParam | ContainerSkill; - -export function containerSkillUnionSerializer(item: ContainerSkillUnion): any { - switch (item.type) { - case "skill_reference": - return skillReferenceParamSerializer(item as SkillReferenceParam); - - case "inline": - return inlineSkillParamSerializer(item as InlineSkillParam); - - default: - return containerSkillSerializer(item); - } -} - -export function containerSkillUnionDeserializer(item: any): ContainerSkillUnion { - switch (item["type"]) { - case "skill_reference": - return skillReferenceParamDeserializer(item as SkillReferenceParam); - - case "inline": - return inlineSkillParamDeserializer(item as InlineSkillParam); + model: item["model"], + quality: item["quality"], + size: item["size"], + output_format: item["output_format"], + output_compression: item["output_compression"], + moderation: item["moderation"], + background: item["background"], + input_fidelity: item["input_fidelity"], + input_image_mask: !item["input_image_mask"] + ? item["input_image_mask"] + : imageGenToolInputImageMaskSerializer(item["input_image_mask"]), + partial_images: item["partial_images"], + action: item["action"], + name: item["name"], + description: item["description"], + tool_configs: !item["tool_configs"] + ? item["tool_configs"] + : toolConfigRecordSerializer(item["tool_configs"]), + }; +} - default: - return containerSkillDeserializer(item); - } +export function imageGenToolDeserializer(item: any): ImageGenTool { + return { + type: item["type"], + model: item["model"], + quality: item["quality"], + size: item["size"], + output_format: item["output_format"], + output_compression: item["output_compression"], + moderation: item["moderation"], + background: item["background"], + input_fidelity: item["input_fidelity"], + input_image_mask: !item["input_image_mask"] + ? item["input_image_mask"] + : imageGenToolInputImageMaskDeserializer(item["input_image_mask"]), + partial_images: item["partial_images"], + action: item["action"], + name: item["name"], + description: item["description"], + tool_configs: !item["tool_configs"] + ? item["tool_configs"] + : toolConfigRecordDeserializer(item["tool_configs"]), + }; } -/** Type of ContainerSkillType */ -export type ContainerSkillType = "skill_reference" | "inline"; +/** Control how much effort the model will exert to match the style and features, especially facial features, of input images. This parameter is only supported for `gpt-image-1` and `gpt-image-1.5` and later models, unsupported for `gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`. */ +export type InputFidelity = "high" | "low"; -/** model interface SkillReferenceParam */ -export interface SkillReferenceParam extends ContainerSkill { - /** References a skill created with the /v1/skills endpoint. */ - type: "skill_reference"; - /** The ID of the referenced skill. */ - skill_id: string; - /** Optional skill version. Use a positive integer or 'latest'. Omit for default. */ - version?: string; +/** model interface ImageGenToolInputImageMask */ +export interface ImageGenToolInputImageMask { + image_url?: string; + file_id?: string; } -export function skillReferenceParamSerializer(item: SkillReferenceParam): any { - return { type: item["type"], skill_id: item["skill_id"], version: item["version"] }; +export function imageGenToolInputImageMaskSerializer(item: ImageGenToolInputImageMask): any { + return { image_url: item["image_url"], file_id: item["file_id"] }; } -export function skillReferenceParamDeserializer(item: any): SkillReferenceParam { +export function imageGenToolInputImageMaskDeserializer(item: any): ImageGenToolInputImageMask { return { - type: item["type"], - skill_id: item["skill_id"], - version: item["version"], + image_url: item["image_url"], + file_id: item["file_id"], }; } -/** model interface InlineSkillParam */ -export interface InlineSkillParam extends ContainerSkill { - /** Defines an inline skill for this request. */ - type: "inline"; - /** The name of the skill. */ - name: string; - /** The description of the skill. */ - description: string; - /** Inline skill payload */ - source: InlineSkillSourceParam; +/** Type of ImageGenAction */ +export type ImageGenAction = "generate" | "edit" | "auto"; + +/** A tool that allows the model to execute shell commands in a local environment. */ +export interface LocalShellToolParam extends Tool { + /** The type of the local shell tool. Always `local_shell`. */ + type: "local_shell"; + /** Deprecated. This property is deprecated and will be removed in a future version. */ + name?: string; + /** Deprecated. This property is deprecated and will be removed in a future version. */ + description?: string; + /** Deprecated. This property is deprecated and will be removed in a future version. */ + tool_configs?: Record; } -export function inlineSkillParamSerializer(item: InlineSkillParam): any { +export function localShellToolParamSerializer(item: LocalShellToolParam): any { return { type: item["type"], name: item["name"], description: item["description"], - source: inlineSkillSourceParamSerializer(item["source"]), + tool_configs: !item["tool_configs"] + ? item["tool_configs"] + : toolConfigRecordSerializer(item["tool_configs"]), }; } -export function inlineSkillParamDeserializer(item: any): InlineSkillParam { +export function localShellToolParamDeserializer(item: any): LocalShellToolParam { return { type: item["type"], name: item["name"], description: item["description"], - source: inlineSkillSourceParamDeserializer(item["source"]), - }; -} - -/** Inline skill payload */ -export interface InlineSkillSourceParam { - /** The type of the inline skill source. Must be `base64`. */ - type: "base64"; - /** The media type of the inline skill payload. Must be `application/zip`. */ - media_type: "application/zip"; - /** Base64-encoded skill zip bundle. */ - data: string; -} - -export function inlineSkillSourceParamSerializer(item: InlineSkillSourceParam): any { - return { type: item["type"], media_type: item["media_type"], data: item["data"] }; -} - -export function inlineSkillSourceParamDeserializer(item: any): InlineSkillSourceParam { - return { - type: item["type"], - media_type: item["media_type"], - data: item["data"], + tool_configs: !item["tool_configs"] + ? item["tool_configs"] + : toolConfigRecordDeserializer(item["tool_configs"]), }; } -/** A custom tool that processes input using a specified format. Learn more about [custom tools](/docs/guides/function-calling#custom-tools) */ -export interface CustomToolParam extends Tool { - /** The type of the custom tool. Always `custom`. */ - type: "custom"; - /** The name of the custom tool, used to identify it in tool calls. */ - name: string; - /** Optional description of the custom tool, used to provide more context. */ +/** A tool that allows the model to execute shell commands. */ +export interface FunctionShellToolParam extends Tool { + /** The type of the shell tool. Always `shell`. */ + type: "shell"; + environment?: FunctionShellToolParamEnvironmentUnion; + /** Deprecated. This property is deprecated and will be removed in a future version. */ + name?: string; + /** Deprecated. This property is deprecated and will be removed in a future version. */ description?: string; - /** The input format for the custom tool. Default is unconstrained text. */ - format?: CustomToolParamFormatUnion; - /** Whether this tool should be deferred and discovered via tool search. */ - defer_loading?: boolean; + /** Deprecated. This property is deprecated and will be removed in a future version. */ + tool_configs?: Record; } -export function customToolParamSerializer(item: CustomToolParam): any { +export function functionShellToolParamSerializer(item: FunctionShellToolParam): any { return { type: item["type"], + environment: !item["environment"] + ? item["environment"] + : functionShellToolParamEnvironmentUnionSerializer(item["environment"]), name: item["name"], description: item["description"], - format: !item["format"] ? item["format"] : customToolParamFormatUnionSerializer(item["format"]), - defer_loading: item["defer_loading"], + tool_configs: !item["tool_configs"] + ? item["tool_configs"] + : toolConfigRecordSerializer(item["tool_configs"]), }; } -export function customToolParamDeserializer(item: any): CustomToolParam { +export function functionShellToolParamDeserializer(item: any): FunctionShellToolParam { return { type: item["type"], + environment: !item["environment"] + ? item["environment"] + : functionShellToolParamEnvironmentUnionDeserializer(item["environment"]), name: item["name"], description: item["description"], - format: !item["format"] - ? item["format"] - : customToolParamFormatUnionDeserializer(item["format"]), - defer_loading: item["defer_loading"], + tool_configs: !item["tool_configs"] + ? item["tool_configs"] + : toolConfigRecordDeserializer(item["tool_configs"]), }; } -/** The input format for the custom tool. Default is unconstrained text. */ -export interface CustomToolParamFormat { - type: CustomToolParamFormatType; +/** model interface FunctionShellToolParamEnvironment */ +export interface FunctionShellToolParamEnvironment { + type: FunctionShellToolParamEnvironmentType; } -export function customToolParamFormatSerializer(item: CustomToolParamFormat): any { +export function functionShellToolParamEnvironmentSerializer( + item: FunctionShellToolParamEnvironment, +): any { return { type: item["type"] }; } -export function customToolParamFormatDeserializer(item: any): CustomToolParamFormat { +export function functionShellToolParamEnvironmentDeserializer( + item: any, +): FunctionShellToolParamEnvironment { return { type: item["type"], }; } -/** Alias for CustomToolParamFormatUnion */ -export type CustomToolParamFormatUnion = - | CustomTextFormatParam - | CustomGrammarFormatParam - | CustomToolParamFormat; +/** Alias for FunctionShellToolParamEnvironmentUnion */ +export type FunctionShellToolParamEnvironmentUnion = + | FunctionShellToolParamEnvironmentLocalEnvironmentParam + | FunctionShellToolParamEnvironmentContainerReferenceParam + | ContainerAutoParam + | FunctionShellToolParamEnvironment; -export function customToolParamFormatUnionSerializer(item: CustomToolParamFormatUnion): any { +export function functionShellToolParamEnvironmentUnionSerializer( + item: FunctionShellToolParamEnvironmentUnion, +): any { switch (item.type) { - case "text": - return customTextFormatParamSerializer(item as CustomTextFormatParam); + case "local": + return functionShellToolParamEnvironmentLocalEnvironmentParamSerializer( + item as FunctionShellToolParamEnvironmentLocalEnvironmentParam, + ); - case "grammar": - return customGrammarFormatParamSerializer(item as CustomGrammarFormatParam); + case "container_reference": + return functionShellToolParamEnvironmentContainerReferenceParamSerializer( + item as FunctionShellToolParamEnvironmentContainerReferenceParam, + ); + + case "container_auto": + return containerAutoParamSerializer(item as ContainerAutoParam); default: - return customToolParamFormatSerializer(item); + return functionShellToolParamEnvironmentSerializer(item); } } -export function customToolParamFormatUnionDeserializer(item: any): CustomToolParamFormatUnion { +export function functionShellToolParamEnvironmentUnionDeserializer( + item: any, +): FunctionShellToolParamEnvironmentUnion { switch (item["type"]) { - case "text": - return customTextFormatParamDeserializer(item as CustomTextFormatParam); + case "local": + return functionShellToolParamEnvironmentLocalEnvironmentParamDeserializer( + item as FunctionShellToolParamEnvironmentLocalEnvironmentParam, + ); - case "grammar": - return customGrammarFormatParamDeserializer(item as CustomGrammarFormatParam); + case "container_reference": + return functionShellToolParamEnvironmentContainerReferenceParamDeserializer( + item as FunctionShellToolParamEnvironmentContainerReferenceParam, + ); + + case "container_auto": + return containerAutoParamDeserializer(item as ContainerAutoParam); default: - return customToolParamFormatDeserializer(item); + return functionShellToolParamEnvironmentDeserializer(item); } } -/** Type of CustomToolParamFormatType */ -export type CustomToolParamFormatType = "text" | "grammar"; +/** Type of FunctionShellToolParamEnvironmentType */ +export type FunctionShellToolParamEnvironmentType = + "container_auto" | "local" | "container_reference"; + +/** model interface FunctionShellToolParamEnvironmentLocalEnvironmentParam */ +export interface FunctionShellToolParamEnvironmentLocalEnvironmentParam extends FunctionShellToolParamEnvironment { + /** Use a local computer environment. */ + type: "local"; + /** An optional list of skills. */ + skills?: LocalSkillParam[]; +} + +export function functionShellToolParamEnvironmentLocalEnvironmentParamSerializer( + item: FunctionShellToolParamEnvironmentLocalEnvironmentParam, +): any { + return { + type: item["type"], + skills: !item["skills"] ? item["skills"] : localSkillParamArraySerializer(item["skills"]), + }; +} + +export function functionShellToolParamEnvironmentLocalEnvironmentParamDeserializer( + item: any, +): FunctionShellToolParamEnvironmentLocalEnvironmentParam { + return { + type: item["type"], + skills: !item["skills"] ? item["skills"] : localSkillParamArrayDeserializer(item["skills"]), + }; +} + +export function localSkillParamArraySerializer(result: Array): any[] { + return result.map((item) => { + return localSkillParamSerializer(item); + }); +} + +export function localSkillParamArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return localSkillParamDeserializer(item); + }); +} -/** Unconstrained free-form text. */ -export interface CustomTextFormatParam extends CustomToolParamFormat { - /** Unconstrained text format. Always `text`. */ - type: "text"; +/** model interface LocalSkillParam */ +export interface LocalSkillParam { + /** The name of the skill. */ + name: string; + /** The description of the skill. */ + description: string; + /** The path to the directory containing the skill. */ + path: string; } -export function customTextFormatParamSerializer(item: CustomTextFormatParam): any { - return { type: item["type"] }; +export function localSkillParamSerializer(item: LocalSkillParam): any { + return { name: item["name"], description: item["description"], path: item["path"] }; } -export function customTextFormatParamDeserializer(item: any): CustomTextFormatParam { +export function localSkillParamDeserializer(item: any): LocalSkillParam { return { - type: item["type"], + name: item["name"], + description: item["description"], + path: item["path"], }; } -/** A grammar defined by the user. */ -export interface CustomGrammarFormatParam extends CustomToolParamFormat { - /** Grammar format. Always `grammar`. */ - type: "grammar"; - /** The syntax of the grammar definition. One of `lark` or `regex`. */ - syntax: GrammarSyntax1; - /** The grammar definition. */ - definition: string; +/** model interface FunctionShellToolParamEnvironmentContainerReferenceParam */ +export interface FunctionShellToolParamEnvironmentContainerReferenceParam extends FunctionShellToolParamEnvironment { + /** References a container created with the /v1/containers endpoint */ + type: "container_reference"; + /** The ID of the referenced container. */ + container_id: string; } -export function customGrammarFormatParamSerializer(item: CustomGrammarFormatParam): any { - return { type: item["type"], syntax: item["syntax"], definition: item["definition"] }; +export function functionShellToolParamEnvironmentContainerReferenceParamSerializer( + item: FunctionShellToolParamEnvironmentContainerReferenceParam, +): any { + return { type: item["type"], container_id: item["container_id"] }; } -export function customGrammarFormatParamDeserializer(item: any): CustomGrammarFormatParam { +export function functionShellToolParamEnvironmentContainerReferenceParamDeserializer( + item: any, +): FunctionShellToolParamEnvironmentContainerReferenceParam { return { type: item["type"], - syntax: item["syntax"], - definition: item["definition"], + container_id: item["container_id"], }; } -/** Type of GrammarSyntax1 */ -export type GrammarSyntax1 = "lark" | "regex"; - -/** This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](https://platform.openai.com/docs/guides/tools-web-search). */ -export interface WebSearchPreviewTool extends Tool { - /** The type of the web search tool. One of `web_search_preview` or `web_search_preview_2025_03_11`. */ - type: "web_search_preview"; - user_location?: ApproximateLocation; - /** High level guidance for the amount of context window space to use for the search. One of `low`, `medium`, or `high`. `medium` is the default. */ - search_context_size?: SearchContextSize; - search_content_types?: SearchContentType[]; +/** model interface ContainerAutoParam */ +export interface ContainerAutoParam extends FunctionShellToolParamEnvironment { + /** Automatically creates a container for this request */ + type: "container_auto"; + /** An optional list of uploaded files to make available to your code. */ + file_ids?: string[]; + memory_limit?: ContainerMemoryLimit; + /** An optional list of skills referenced by id or inline data. */ + skills?: ContainerSkillUnion[]; + network_policy?: ContainerNetworkPolicyParamUnion; } -export function webSearchPreviewToolSerializer(item: WebSearchPreviewTool): any { +export function containerAutoParamSerializer(item: ContainerAutoParam): any { return { type: item["type"], - user_location: !item["user_location"] - ? item["user_location"] - : approximateLocationSerializer(item["user_location"]), - search_context_size: item["search_context_size"], - search_content_types: !item["search_content_types"] - ? item["search_content_types"] - : item["search_content_types"].map((p: any) => { + file_ids: !item["file_ids"] + ? item["file_ids"] + : item["file_ids"].map((p: any) => { return p; }), + memory_limit: item["memory_limit"], + skills: !item["skills"] ? item["skills"] : containerSkillUnionArraySerializer(item["skills"]), + network_policy: !item["network_policy"] + ? item["network_policy"] + : containerNetworkPolicyParamUnionSerializer(item["network_policy"]), }; } -export function webSearchPreviewToolDeserializer(item: any): WebSearchPreviewTool { +export function containerAutoParamDeserializer(item: any): ContainerAutoParam { return { type: item["type"], - user_location: !item["user_location"] - ? item["user_location"] - : approximateLocationDeserializer(item["user_location"]), - search_context_size: item["search_context_size"], - search_content_types: !item["search_content_types"] - ? item["search_content_types"] - : item["search_content_types"].map((p: any) => { + file_ids: !item["file_ids"] + ? item["file_ids"] + : item["file_ids"].map((p: any) => { return p; }), + memory_limit: item["memory_limit"], + skills: !item["skills"] ? item["skills"] : containerSkillUnionArrayDeserializer(item["skills"]), + network_policy: !item["network_policy"] + ? item["network_policy"] + : containerNetworkPolicyParamUnionDeserializer(item["network_policy"]), }; } -/** model interface ApproximateLocation */ -export interface ApproximateLocation { - /** The type of location approximation. Always `approximate`. */ - type: "approximate"; - country?: string; - region?: string; - city?: string; - timezone?: string; -} - -export function approximateLocationSerializer(item: ApproximateLocation): any { - return { - type: item["type"], - country: item["country"], - region: item["region"], - city: item["city"], - timezone: item["timezone"], - }; +export function containerSkillUnionArraySerializer(result: Array): any[] { + return result.map((item) => { + return containerSkillUnionSerializer(item); + }); } -export function approximateLocationDeserializer(item: any): ApproximateLocation { - return { - type: item["type"], - country: item["country"], - region: item["region"], - city: item["city"], - timezone: item["timezone"], - }; +export function containerSkillUnionArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return containerSkillUnionDeserializer(item); + }); } -/** Type of SearchContextSize */ -export type SearchContextSize = "low" | "medium" | "high"; -/** Type of SearchContentType */ -export type SearchContentType = "text" | "image"; - -/** Allows the assistant to create, delete, or update files using unified diffs. */ -export interface ApplyPatchToolParam extends Tool { - /** The type of the tool. Always `apply_patch`. */ - type: "apply_patch"; +/** model interface ContainerSkill */ +export interface ContainerSkill { + type: ContainerSkillType; } -export function applyPatchToolParamSerializer(item: ApplyPatchToolParam): any { +export function containerSkillSerializer(item: ContainerSkill): any { return { type: item["type"] }; } -export function applyPatchToolParamDeserializer(item: any): ApplyPatchToolParam { +export function containerSkillDeserializer(item: any): ContainerSkill { return { type: item["type"], }; } -/** A tool that controls a virtual computer. Learn more about the [computer tool](https://platform.openai.com/docs/guides/tools-computer-use). */ -export interface ComputerTool extends Tool { - /** The type of the computer tool. Always `computer`. */ - type: "computer"; -} - -export function computerToolSerializer(item: ComputerTool): any { - return { type: item["type"] }; -} +/** Alias for ContainerSkillUnion */ +export type ContainerSkillUnion = SkillReferenceParam | InlineSkillParam | ContainerSkill; -export function computerToolDeserializer(item: any): ComputerTool { - return { - type: item["type"], - }; -} +export function containerSkillUnionSerializer(item: ContainerSkillUnion): any { + switch (item.type) { + case "skill_reference": + return skillReferenceParamSerializer(item as SkillReferenceParam); -/** Groups function/custom tools under a shared namespace. */ -export interface NamespaceToolParam extends Tool { - /** The type of the tool. Always `namespace`. */ - type: "namespace"; - /** The namespace name used in tool calls (for example, `crm`). */ - name: string; - /** A description of the namespace shown to the model. */ - description: string; - /** The function/custom tools available inside this namespace. */ - tools: (FunctionToolParam | CustomToolParam)[]; -} + case "inline": + return inlineSkillParamSerializer(item as InlineSkillParam); -export function namespaceToolParamSerializer(item: NamespaceToolParam): any { - return { - type: item["type"], - name: item["name"], - description: item["description"], - tools: _namespaceToolParamToolArraySerializer(item["tools"]), - }; + default: + return containerSkillSerializer(item); + } } -export function namespaceToolParamDeserializer(item: any): NamespaceToolParam { - return { - type: item["type"], - name: item["name"], - description: item["description"], - tools: _namespaceToolParamToolArrayDeserializer(item["tools"]), - }; -} +export function containerSkillUnionDeserializer(item: any): ContainerSkillUnion { + switch (item["type"]) { + case "skill_reference": + return skillReferenceParamDeserializer(item as SkillReferenceParam); -export function _namespaceToolParamToolArraySerializer( - result: Array<_NamespaceToolParamTool>, -): any[] { - return result.map((item) => { - return _namespaceToolParamToolSerializer(item); - }); -} + case "inline": + return inlineSkillParamDeserializer(item as InlineSkillParam); -export function _namespaceToolParamToolArrayDeserializer( - result: Array<_NamespaceToolParamTool>, -): any[] { - return result.map((item) => { - return _namespaceToolParamToolDeserializer(item); - }); + default: + return containerSkillDeserializer(item); + } } -/** Alias for _NamespaceToolParamTool */ -export type _NamespaceToolParamTool = FunctionToolParam | CustomToolParam; +/** Type of ContainerSkillType */ +export type ContainerSkillType = "skill_reference" | "inline"; -export function _namespaceToolParamToolSerializer(item: _NamespaceToolParamTool): any { - return item; +/** model interface SkillReferenceParam */ +export interface SkillReferenceParam extends ContainerSkill { + /** References a skill created with the /v1/skills endpoint. */ + type: "skill_reference"; + /** The ID of the referenced skill. */ + skill_id: string; + /** Optional skill version. Use a positive integer or 'latest'. Omit for default. */ + version?: string; } -export function _namespaceToolParamToolDeserializer(item: any): _NamespaceToolParamTool { - return item; +export function skillReferenceParamSerializer(item: SkillReferenceParam): any { + return { type: item["type"], skill_id: item["skill_id"], version: item["version"] }; } -/** model interface FunctionToolParam */ -export interface FunctionToolParam { +export function skillReferenceParamDeserializer(item: any): SkillReferenceParam { + return { + type: item["type"], + skill_id: item["skill_id"], + version: item["version"], + }; +} + +/** model interface InlineSkillParam */ +export interface InlineSkillParam extends ContainerSkill { + /** Defines an inline skill for this request. */ + type: "inline"; + /** The name of the skill. */ name: string; - description?: string; - parameters?: EmptyModelParam; - strict?: boolean; - type: "function"; - /** Whether this function should be deferred and discovered via tool search. */ - defer_loading?: boolean; + /** The description of the skill. */ + description: string; + /** Inline skill payload */ + source: InlineSkillSourceParam; } -export function functionToolParamSerializer(item: FunctionToolParam): any { +export function inlineSkillParamSerializer(item: InlineSkillParam): any { return { + type: item["type"], name: item["name"], description: item["description"], - parameters: !item["parameters"] - ? item["parameters"] - : emptyModelParamSerializer(item["parameters"]), - strict: item["strict"], - type: item["type"], - defer_loading: item["defer_loading"], + source: inlineSkillSourceParamSerializer(item["source"]), }; } -export function functionToolParamDeserializer(item: any): FunctionToolParam { +export function inlineSkillParamDeserializer(item: any): InlineSkillParam { return { + type: item["type"], name: item["name"], description: item["description"], - parameters: !item["parameters"] - ? item["parameters"] - : emptyModelParamDeserializer(item["parameters"]), - strict: item["strict"], - type: item["type"], - defer_loading: item["defer_loading"], + source: inlineSkillSourceParamDeserializer(item["source"]), }; } -/** model interface EmptyModelParam */ -export interface EmptyModelParam {} +/** Inline skill payload */ +export interface InlineSkillSourceParam { + /** The type of the inline skill source. Must be `base64`. */ + type: "base64"; + /** The media type of the inline skill payload. Must be `application/zip`. */ + media_type: "application/zip"; + /** Base64-encoded skill zip bundle. */ + data: string; +} -export function emptyModelParamSerializer(_item: EmptyModelParam): any { - return {}; +export function inlineSkillSourceParamSerializer(item: InlineSkillSourceParam): any { + return { type: item["type"], media_type: item["media_type"], data: item["data"] }; } -export function emptyModelParamDeserializer(item: any): EmptyModelParam { - return item; +export function inlineSkillSourceParamDeserializer(item: any): InlineSkillSourceParam { + return { + type: item["type"], + media_type: item["media_type"], + data: item["data"], + }; } -/** Hosted or BYOT tool search configuration for deferred tools. */ -export interface ToolSearchToolParam extends Tool { - /** The type of the tool. Always `tool_search`. */ - type: "tool_search"; - /** Whether tool search is executed by the server or by the client. */ - execution?: ToolSearchExecutionType; +/** A custom tool that processes input using a specified format. Learn more about [custom tools](/docs/guides/function-calling#custom-tools) */ +export interface CustomToolParam extends Tool { + /** The type of the custom tool. Always `custom`. */ + type: "custom"; + /** The name of the custom tool, used to identify it in tool calls. */ + name: string; + /** Optional description of the custom tool, used to provide more context. */ description?: string; - parameters?: EmptyModelParam; + /** The input format for the custom tool. Default is unconstrained text. */ + format?: CustomToolParamFormatUnion; + /** Whether this tool should be deferred and discovered via tool search. */ + defer_loading?: boolean; } -export function toolSearchToolParamSerializer(item: ToolSearchToolParam): any { +export function customToolParamSerializer(item: CustomToolParam): any { return { type: item["type"], - execution: item["execution"], + name: item["name"], description: item["description"], - parameters: !item["parameters"] - ? item["parameters"] - : emptyModelParamSerializer(item["parameters"]), + format: !item["format"] ? item["format"] : customToolParamFormatUnionSerializer(item["format"]), + defer_loading: item["defer_loading"], }; } -export function toolSearchToolParamDeserializer(item: any): ToolSearchToolParam { +export function customToolParamDeserializer(item: any): CustomToolParam { return { type: item["type"], - execution: item["execution"], + name: item["name"], description: item["description"], - parameters: !item["parameters"] - ? item["parameters"] - : emptyModelParamDeserializer(item["parameters"]), + format: !item["format"] + ? item["format"] + : customToolParamFormatUnionDeserializer(item["format"]), + defer_loading: item["defer_loading"], }; } -/** Type of ToolSearchExecutionType */ -export type ToolSearchExecutionType = "server" | "client"; - -/** Container-based deployment configuration for a hosted agent. */ -export interface ContainerConfiguration { - /** The container image for the hosted agent. */ - image: string; +/** The input format for the custom tool. Default is unconstrained text. */ +export interface CustomToolParamFormat { + type: CustomToolParamFormatType; } -export function containerConfigurationSerializer(item: ContainerConfiguration): any { - return { image: item["image"] }; +export function customToolParamFormatSerializer(item: CustomToolParamFormat): any { + return { type: item["type"] }; } -export function containerConfigurationDeserializer(item: any): ContainerConfiguration { +export function customToolParamFormatDeserializer(item: any): CustomToolParamFormat { return { - image: item["image"], + type: item["type"], }; } -export function protocolVersionRecordArraySerializer(result: Array): any[] { - return result.map((item) => { - return protocolVersionRecordSerializer(item); - }); -} +/** Alias for CustomToolParamFormatUnion */ +export type CustomToolParamFormatUnion = + CustomTextFormatParam | CustomGrammarFormatParam | CustomToolParamFormat; -export function protocolVersionRecordArrayDeserializer( - result: Array, -): any[] { - return result.map((item) => { - return protocolVersionRecordDeserializer(item); - }); -} +export function customToolParamFormatUnionSerializer(item: CustomToolParamFormatUnion): any { + switch (item.type) { + case "text": + return customTextFormatParamSerializer(item as CustomTextFormatParam); -/** A record mapping for a single protocol and its version. */ -export interface ProtocolVersionRecord { - /** The protocol type. */ - protocol: AgentProtocol; - /** The version string for the protocol, e.g. 'v0.1.1'. */ - version: string; -} + case "grammar": + return customGrammarFormatParamSerializer(item as CustomGrammarFormatParam); -export function protocolVersionRecordSerializer(item: ProtocolVersionRecord): any { - return { protocol: item["protocol"], version: item["version"] }; + default: + return customToolParamFormatSerializer(item); + } } -export function protocolVersionRecordDeserializer(item: any): ProtocolVersionRecord { - return { - protocol: item["protocol"], - version: item["version"], - }; +export function customToolParamFormatUnionDeserializer(item: any): CustomToolParamFormatUnion { + switch (item["type"]) { + case "text": + return customTextFormatParamDeserializer(item as CustomTextFormatParam); + + case "grammar": + return customGrammarFormatParamDeserializer(item as CustomGrammarFormatParam); + + default: + return customToolParamFormatDeserializer(item); + } } -/** Type of AgentProtocol */ -export type AgentProtocol = - | "activity_protocol" - | "responses" - | "mcp" - | "invocations" - | "invocations_ws"; +/** Type of CustomToolParamFormatType */ +export type CustomToolParamFormatType = "text" | "grammar"; -/** Code-based deployment configuration for a hosted agent. */ -export interface CodeConfiguration { - /** The runtime identifier for code execution (e.g., 'python_3_11', 'python_3_12', 'python_3_13'). */ - runtime: string; - /** The entry point command and arguments for the code execution. */ - entry_point: string[]; - /** - * How package dependencies are resolved at deployment time. Defaults to `bundled`, - * where the caller bundles all dependencies into the uploaded zip and the service - * performs no remote build. `remote_build` instructs the service to build - * dependencies remotely from the manifest included in the uploaded zip. - */ - dependency_resolution: CodeDependencyResolution; - /** The SHA-256 hex digest of the uploaded code zip. Set by the service from the `x-ms-code-zip-sha256` request header; read-only in responses and never accepted in request payloads. */ - readonly content_hash?: string; +/** Unconstrained free-form text. */ +export interface CustomTextFormatParam extends CustomToolParamFormat { + /** Unconstrained text format. Always `text`. */ + type: "text"; } -export function codeConfigurationSerializer(item: CodeConfiguration): any { - return { - runtime: item["runtime"], - entry_point: item["entry_point"].map((p: any) => { - return p; - }), - dependency_resolution: item["dependency_resolution"], - }; +export function customTextFormatParamSerializer(item: CustomTextFormatParam): any { + return { type: item["type"] }; } -export function codeConfigurationDeserializer(item: any): CodeConfiguration { +export function customTextFormatParamDeserializer(item: any): CustomTextFormatParam { return { - runtime: item["runtime"], - entry_point: item["entry_point"].map((p: any) => { - return p; - }), - dependency_resolution: item["dependency_resolution"], - content_hash: item["content_hash"], + type: item["type"], }; } -/** How package dependencies are resolved at deployment time for a code-based hosted agent. */ -export type CodeDependencyResolution = "bundled" | "remote_build"; - -/** Customer-supplied telemetry configuration for exporting container logs, traces, and metrics. */ -export interface TelemetryConfig { - /** Customer-supplied telemetry export endpoint configurations. */ - endpoints: TelemetryEndpointUnion[]; +/** A grammar defined by the user. */ +export interface CustomGrammarFormatParam extends CustomToolParamFormat { + /** Grammar format. Always `grammar`. */ + type: "grammar"; + /** The syntax of the grammar definition. One of `lark` or `regex`. */ + syntax: GrammarSyntax1; + /** The grammar definition. */ + definition: string; } -export function telemetryConfigSerializer(item: TelemetryConfig): any { - return { endpoints: telemetryEndpointUnionArraySerializer(item["endpoints"]) }; +export function customGrammarFormatParamSerializer(item: CustomGrammarFormatParam): any { + return { type: item["type"], syntax: item["syntax"], definition: item["definition"] }; } -export function telemetryConfigDeserializer(item: any): TelemetryConfig { +export function customGrammarFormatParamDeserializer(item: any): CustomGrammarFormatParam { return { - endpoints: telemetryEndpointUnionArrayDeserializer(item["endpoints"]), + type: item["type"], + syntax: item["syntax"], + definition: item["definition"], }; } -export function telemetryEndpointUnionArraySerializer( - result: Array, -): any[] { - return result.map((item) => { - return telemetryEndpointUnionSerializer(item); - }); -} - -export function telemetryEndpointUnionArrayDeserializer( - result: Array, -): any[] { - return result.map((item) => { - return telemetryEndpointUnionDeserializer(item); - }); -} +/** Type of GrammarSyntax1 */ +export type GrammarSyntax1 = "lark" | "regex"; -/** A telemetry export endpoint configuration. */ -export interface TelemetryEndpoint { - /** The telemetry export endpoint kind. */ - /** The discriminator possible values: OTLP */ - kind: TelemetryEndpointKind; - /** Data types to export to this endpoint. Use an empty array to export no data. */ - data: TelemetryDataKind[]; - /** Optional authentication configuration. */ - auth?: TelemetryEndpointAuthUnion; +/** This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](https://platform.openai.com/docs/guides/tools-web-search). */ +export interface WebSearchPreviewTool extends Tool { + /** The type of the web search tool. One of `web_search_preview` or `web_search_preview_2025_03_11`. */ + type: "web_search_preview"; + user_location?: ApproximateLocation; + /** High level guidance for the amount of context window space to use for the search. One of `low`, `medium`, or `high`. `medium` is the default. */ + search_context_size?: SearchContextSize; + search_content_types?: SearchContentType[]; } -export function telemetryEndpointSerializer(item: TelemetryEndpoint): any { +export function webSearchPreviewToolSerializer(item: WebSearchPreviewTool): any { return { - kind: item["kind"], - data: item["data"].map((p: any) => { - return p; - }), - auth: !item["auth"] ? item["auth"] : telemetryEndpointAuthUnionSerializer(item["auth"]), + type: item["type"], + user_location: !item["user_location"] + ? item["user_location"] + : approximateLocationSerializer(item["user_location"]), + search_context_size: item["search_context_size"], + search_content_types: !item["search_content_types"] + ? item["search_content_types"] + : item["search_content_types"].map((p: any) => { + return p; + }), }; } -export function telemetryEndpointDeserializer(item: any): TelemetryEndpoint { +export function webSearchPreviewToolDeserializer(item: any): WebSearchPreviewTool { return { - kind: item["kind"], - data: item["data"].map((p: any) => { - return p; - }), - auth: !item["auth"] ? item["auth"] : telemetryEndpointAuthUnionDeserializer(item["auth"]), + type: item["type"], + user_location: !item["user_location"] + ? item["user_location"] + : approximateLocationDeserializer(item["user_location"]), + search_context_size: item["search_context_size"], + search_content_types: !item["search_content_types"] + ? item["search_content_types"] + : item["search_content_types"].map((p: any) => { + return p; + }), }; } -/** Alias for TelemetryEndpointUnion */ -export type TelemetryEndpointUnion = OtlpTelemetryEndpoint | TelemetryEndpoint; - -export function telemetryEndpointUnionSerializer(item: TelemetryEndpointUnion): any { - switch (item.kind) { - case "OTLP": - return otlpTelemetryEndpointSerializer(item as OtlpTelemetryEndpoint); - - default: - return telemetryEndpointSerializer(item); - } +/** model interface ApproximateLocation */ +export interface ApproximateLocation { + /** The type of location approximation. Always `approximate`. */ + type: "approximate"; + country?: string; + region?: string; + city?: string; + timezone?: string; } -export function telemetryEndpointUnionDeserializer(item: any): TelemetryEndpointUnion { - switch (item["kind"]) { - case "OTLP": - return otlpTelemetryEndpointDeserializer(item as OtlpTelemetryEndpoint); +export function approximateLocationSerializer(item: ApproximateLocation): any { + return { + type: item["type"], + country: item["country"], + region: item["region"], + city: item["city"], + timezone: item["timezone"], + }; +} - default: - return telemetryEndpointDeserializer(item); - } +export function approximateLocationDeserializer(item: any): ApproximateLocation { + return { + type: item["type"], + country: item["country"], + region: item["region"], + city: item["city"], + timezone: item["timezone"], + }; } -/** The kind of telemetry export endpoint. */ -export type TelemetryEndpointKind = "OTLP"; -/** The type of telemetry data to export. */ -export type TelemetryDataKind = "ContainerStdoutStderr" | "ContainerOtel" | "Metrics"; +/** Type of SearchContextSize */ +export type SearchContextSize = "low" | "medium" | "high"; +/** Type of SearchContentType */ +export type SearchContentType = "text" | "image"; -/** Authentication configuration for a telemetry endpoint. */ -export interface TelemetryEndpointAuth { - /** The authentication type. */ - /** The discriminator possible values: header */ - type: TelemetryEndpointAuthType; +/** Allows the assistant to create, delete, or update files using unified diffs. */ +export interface ApplyPatchToolParam extends Tool { + /** The type of the tool. Always `apply_patch`. */ + type: "apply_patch"; } -export function telemetryEndpointAuthSerializer(item: TelemetryEndpointAuth): any { +export function applyPatchToolParamSerializer(item: ApplyPatchToolParam): any { return { type: item["type"] }; } -export function telemetryEndpointAuthDeserializer(item: any): TelemetryEndpointAuth { +export function applyPatchToolParamDeserializer(item: any): ApplyPatchToolParam { return { type: item["type"], }; } -/** Alias for TelemetryEndpointAuthUnion */ -export type TelemetryEndpointAuthUnion = HeaderTelemetryEndpointAuth | TelemetryEndpointAuth; - -export function telemetryEndpointAuthUnionSerializer(item: TelemetryEndpointAuthUnion): any { - switch (item.type) { - case "header": - return headerTelemetryEndpointAuthSerializer(item as HeaderTelemetryEndpointAuth); - - default: - return telemetryEndpointAuthSerializer(item); - } +/** A tool that controls a virtual computer. Learn more about the [computer tool](https://platform.openai.com/docs/guides/tools-computer-use). */ +export interface ComputerTool extends Tool { + /** The type of the computer tool. Always `computer`. */ + type: "computer"; } -export function telemetryEndpointAuthUnionDeserializer(item: any): TelemetryEndpointAuthUnion { - switch (item["type"]) { - case "header": - return headerTelemetryEndpointAuthDeserializer(item as HeaderTelemetryEndpointAuth); - - default: - return telemetryEndpointAuthDeserializer(item); - } +export function computerToolSerializer(item: ComputerTool): any { + return { type: item["type"] }; } -/** The type of authentication for a telemetry endpoint. */ -export type TelemetryEndpointAuthType = "header"; +export function computerToolDeserializer(item: any): ComputerTool { + return { + type: item["type"], + }; +} -/** Header-based secret authentication for a telemetry endpoint. The resolved secret value is injected as an HTTP header. */ -export interface HeaderTelemetryEndpointAuth extends TelemetryEndpointAuth { - /** The authentication type, always 'header' for header-based secret authentication. */ - type: "header"; - /** The name of the HTTP header to inject the secret value into. */ - header_name: string; - /** The identifier of the secret store or connection. */ - secret_id: string; - /** The key within the secret to retrieve the authentication value. */ - secret_key: string; +/** Groups function/custom tools under a shared namespace. */ +export interface NamespaceToolParam extends Tool { + /** The type of the tool. Always `namespace`. */ + type: "namespace"; + /** The namespace name used in tool calls (for example, `crm`). */ + name: string; + /** A description of the namespace shown to the model. */ + description: string; + /** The function/custom tools available inside this namespace. */ + tools: (FunctionToolParam | CustomToolParam)[]; } -export function headerTelemetryEndpointAuthSerializer(item: HeaderTelemetryEndpointAuth): any { +export function namespaceToolParamSerializer(item: NamespaceToolParam): any { return { type: item["type"], - header_name: item["header_name"], - secret_id: item["secret_id"], - secret_key: item["secret_key"], + name: item["name"], + description: item["description"], + tools: _namespaceToolParamToolArraySerializer(item["tools"]), }; } -export function headerTelemetryEndpointAuthDeserializer(item: any): HeaderTelemetryEndpointAuth { +export function namespaceToolParamDeserializer(item: any): NamespaceToolParam { return { type: item["type"], - header_name: item["header_name"], - secret_id: item["secret_id"], - secret_key: item["secret_key"], + name: item["name"], + description: item["description"], + tools: _namespaceToolParamToolArrayDeserializer(item["tools"]), }; } -/** An OTLP (OpenTelemetry Protocol) telemetry export endpoint. */ -export interface OtlpTelemetryEndpoint extends TelemetryEndpoint { - /** The endpoint kind, always 'OTLP' for OpenTelemetry Protocol endpoints. */ - kind: "OTLP"; - /** The OTLP collector endpoint URL. */ - endpoint: string; - /** The transport protocol for the OTLP endpoint. */ - protocol: TelemetryTransportProtocol; -} - -export function otlpTelemetryEndpointSerializer(item: OtlpTelemetryEndpoint): any { - return { - kind: item["kind"], - data: item["data"].map((p: any) => { - return p; - }), - auth: !item["auth"] ? item["auth"] : telemetryEndpointAuthUnionSerializer(item["auth"]), - endpoint: item["endpoint"], - protocol: item["protocol"], - }; +export function _namespaceToolParamToolArraySerializer( + result: Array<_NamespaceToolParamTool>, +): any[] { + return result.map((item) => { + return _namespaceToolParamToolSerializer(item); + }); } -export function otlpTelemetryEndpointDeserializer(item: any): OtlpTelemetryEndpoint { - return { - kind: item["kind"], - data: item["data"].map((p: any) => { - return p; - }), - auth: !item["auth"] ? item["auth"] : telemetryEndpointAuthUnionDeserializer(item["auth"]), - endpoint: item["endpoint"], - protocol: item["protocol"], - }; +export function _namespaceToolParamToolArrayDeserializer( + result: Array<_NamespaceToolParamTool>, +): any[] { + return result.map((item) => { + return _namespaceToolParamToolDeserializer(item); + }); } -/** The transport protocol for telemetry export. */ -export type TelemetryTransportProtocol = "Http" | "Grpc"; +/** Alias for _NamespaceToolParamTool */ +export type _NamespaceToolParamTool = FunctionToolParam | CustomToolParam; -/** The prompt agent definition */ -export interface PromptAgentDefinition extends AgentDefinition { - kind: "prompt"; - /** The model deployment to use for this agent. */ - model: string; - /** A system (or developer) message inserted into the model's context. */ - instructions?: string; - /** - * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. - * We generally recommend altering this or `top_p` but not both. Defaults to `1`. - */ - temperature?: number; - /** - * An alternative to sampling with temperature, called nucleus sampling, - * where the model considers the results of the tokens with top_p probability - * mass. So 0.1 means only the tokens comprising the top 10% probability mass - * are considered. We generally recommend altering this or `temperature` but not both. - * Defaults to `1`. - */ - top_p?: number; - reasoning?: Reasoning; - /** - * An array of tools the model may call while generating a response. You - * can specify which tool to use by setting the `tool_choice` parameter. - */ - tools?: ToolUnion[]; - /** - * How the model should select which tool (or tools) to use when generating a response. - * See the `tools` parameter to see how to specify which tools the model can call. - */ - tool_choice?: string | ToolChoiceParamUnion; - /** Configuration options for a text response from the model. Can be plain text or structured JSON data. */ - text?: PromptAgentDefinitionTextOptions; - /** Set of structured inputs that can participate in prompt template substitution or tool argument bindings. */ - structured_inputs?: Record; +export function _namespaceToolParamToolSerializer(item: _NamespaceToolParamTool): any { + return item; +} + +export function _namespaceToolParamToolDeserializer(item: any): _NamespaceToolParamTool { + return item; } -export function promptAgentDefinitionSerializer(item: PromptAgentDefinition): any { +/** model interface FunctionToolParam */ +export interface FunctionToolParam { + name: string; + description?: string; + parameters?: EmptyModelParam; + strict?: boolean; + type: "function"; + /** Whether this function should be deferred and discovered via tool search. */ + defer_loading?: boolean; +} + +export function functionToolParamSerializer(item: FunctionToolParam): any { return { - kind: item["kind"], - rai_config: !item["rai_config"] ? item["rai_config"] : raiConfigSerializer(item["rai_config"]), - model: item["model"], - instructions: item["instructions"], - temperature: item["temperature"], - top_p: item["top_p"], - reasoning: !item["reasoning"] ? item["reasoning"] : reasoningSerializer(item["reasoning"]), - tools: !item["tools"] ? item["tools"] : toolUnionArraySerializer(item["tools"]), - tool_choice: !item["tool_choice"] - ? item["tool_choice"] - : _promptAgentDefinitionToolChoiceSerializer(item["tool_choice"]), - text: !item["text"] ? item["text"] : promptAgentDefinitionTextOptionsSerializer(item["text"]), - structured_inputs: !item["structured_inputs"] - ? item["structured_inputs"] - : structuredInputDefinitionRecordSerializer(item["structured_inputs"]), + name: item["name"], + description: item["description"], + parameters: !item["parameters"] + ? item["parameters"] + : emptyModelParamSerializer(item["parameters"]), + strict: item["strict"], + type: item["type"], + defer_loading: item["defer_loading"], }; } -export function promptAgentDefinitionDeserializer(item: any): PromptAgentDefinition { +export function functionToolParamDeserializer(item: any): FunctionToolParam { return { - kind: item["kind"], - rai_config: !item["rai_config"] - ? item["rai_config"] - : raiConfigDeserializer(item["rai_config"]), - model: item["model"], - instructions: item["instructions"], - temperature: item["temperature"], - top_p: item["top_p"], - reasoning: !item["reasoning"] ? item["reasoning"] : reasoningDeserializer(item["reasoning"]), - tools: !item["tools"] ? item["tools"] : toolUnionArrayDeserializer(item["tools"]), - tool_choice: !item["tool_choice"] - ? item["tool_choice"] - : _promptAgentDefinitionToolChoiceDeserializer(item["tool_choice"]), - text: !item["text"] ? item["text"] : promptAgentDefinitionTextOptionsDeserializer(item["text"]), - structured_inputs: !item["structured_inputs"] - ? item["structured_inputs"] - : structuredInputDefinitionRecordDeserializer(item["structured_inputs"]), + name: item["name"], + description: item["description"], + parameters: !item["parameters"] + ? item["parameters"] + : emptyModelParamDeserializer(item["parameters"]), + strict: item["strict"], + type: item["type"], + defer_loading: item["defer_loading"], }; } -/** - * **gpt-5 and o-series models only** - * Configuration options for - * [reasoning models](https://platform.openai.com/docs/guides/reasoning). - */ -export interface Reasoning { - effort?: ReasoningEffort; - summary?: "auto" | "concise" | "detailed"; - generate_summary?: "auto" | "concise" | "detailed"; +/** model interface EmptyModelParam */ +export interface EmptyModelParam {} + +export function emptyModelParamSerializer(_item: EmptyModelParam): any { + return {}; } -export function reasoningSerializer(item: Reasoning): any { +export function emptyModelParamDeserializer(item: any): EmptyModelParam { + return item; +} + +/** Hosted or BYOT tool search configuration for deferred tools. */ +export interface ToolSearchToolParam extends Tool { + /** The type of the tool. Always `tool_search`. */ + type: "tool_search"; + /** Whether tool search is executed by the server or by the client. */ + execution?: ToolSearchExecutionType; + description?: string; + parameters?: EmptyModelParam; +} + +export function toolSearchToolParamSerializer(item: ToolSearchToolParam): any { return { - effort: item["effort"], - summary: item["summary"], - generate_summary: item["generate_summary"], + type: item["type"], + execution: item["execution"], + description: item["description"], + parameters: !item["parameters"] + ? item["parameters"] + : emptyModelParamSerializer(item["parameters"]), }; } -export function reasoningDeserializer(item: any): Reasoning { +export function toolSearchToolParamDeserializer(item: any): ToolSearchToolParam { return { - effort: item["effort"], - summary: item["summary"], - generate_summary: item["generate_summary"], + type: item["type"], + execution: item["execution"], + description: item["description"], + parameters: !item["parameters"] + ? item["parameters"] + : emptyModelParamDeserializer(item["parameters"]), }; } -/** - * Constrains effort on reasoning for - * [reasoning models](https://platform.openai.com/docs/guides/reasoning). - * Currently supported values are `none`, `minimal`, `low`, `medium`, `high`, and `xhigh`. Reducing - * reasoning effort can result in faster responses and fewer tokens used - * on reasoning in a response. - * - `gpt-5.1` defaults to `none`, which does not perform reasoning. The supported reasoning values for `gpt-5.1` are `none`, `low`, `medium`, and `high`. Tool calls are supported for all reasoning values in gpt-5.1. - * - All models before `gpt-5.1` default to `medium` reasoning effort, and do not support `none`. - * - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort. - * - `xhigh` is supported for all models after `gpt-5.1-codex-max`. - */ -export type ReasoningEffort = "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | null; +/** Type of ToolSearchExecutionType */ +export type ToolSearchExecutionType = "server" | "client"; /** Alias for _PromptAgentDefinitionToolChoice */ export type _PromptAgentDefinitionToolChoice = string | ToolChoiceParamUnion; @@ -5058,8 +4806,7 @@ export function agentBlueprintReferenceDeserializer(item: any): AgentBlueprintRe /** Alias for AgentBlueprintReferenceUnion */ export type AgentBlueprintReferenceUnion = - | ManagedAgentIdentityBlueprintReference - | AgentBlueprintReference; + ManagedAgentIdentityBlueprintReference | AgentBlueprintReference; export function agentBlueprintReferenceUnionSerializer(item: AgentBlueprintReferenceUnion): any { switch (item.type) { @@ -5114,8 +4861,8 @@ export function managedAgentIdentityBlueprintReferenceDeserializer( export interface AgentEndpointConfig { /** The version selector of the agent endpoint determines how traffic is routed to different versions of the agent. */ version_selector?: VersionSelector; - /** The protocols that the agent supports */ - protocols?: AgentEndpointProtocol[]; + /** Per-protocol configuration for the agent endpoint. */ + protocol_configuration?: ProtocolConfiguration; /** The authorization schemes supported by the agent endpoint */ authorization_schemes?: AgentEndpointAuthorizationSchemeUnion[]; } @@ -5125,11 +4872,9 @@ export function agentEndpointConfigSerializer(item: AgentEndpointConfig): any { version_selector: !item["version_selector"] ? item["version_selector"] : versionSelectorSerializer(item["version_selector"]), - protocols: !item["protocols"] - ? item["protocols"] - : item["protocols"].map((p: any) => { - return p; - }), + protocol_configuration: !item["protocol_configuration"] + ? item["protocol_configuration"] + : protocolConfigurationSerializer(item["protocol_configuration"]), authorization_schemes: !item["authorization_schemes"] ? item["authorization_schemes"] : agentEndpointAuthorizationSchemeUnionArraySerializer(item["authorization_schemes"]), @@ -5141,11 +4886,9 @@ export function agentEndpointConfigDeserializer(item: any): AgentEndpointConfig version_selector: !item["version_selector"] ? item["version_selector"] : versionSelectorDeserializer(item["version_selector"]), - protocols: !item["protocols"] - ? item["protocols"] - : item["protocols"].map((p: any) => { - return p; - }), + protocol_configuration: !item["protocol_configuration"] + ? item["protocol_configuration"] + : protocolConfigurationDeserializer(item["protocol_configuration"]), authorization_schemes: !item["authorization_schemes"] ? item["authorization_schemes"] : agentEndpointAuthorizationSchemeUnionArrayDeserializer(item["authorization_schemes"]), @@ -5260,14 +5003,144 @@ export function fixedRatioVersionSelectionRuleDeserializer( }; } -/** Type of AgentEndpointProtocol */ -export type AgentEndpointProtocol = - | "activity" - | "responses" - | "a2a" - | "mcp" - | "invocations" - | "invocations_ws"; +/** Per-protocol configuration for the agent endpoint. */ +export interface ProtocolConfiguration { + /** Configuration for the activity protocol. */ + activity?: ActivityProtocolConfiguration; + /** Configuration for the responses protocol. */ + responses?: ResponsesProtocolConfiguration; + /** Configuration for the A2A protocol. */ + a2a?: A2AProtocolConfiguration; + /** Configuration for the MCP protocol. */ + mcp?: McpProtocolConfiguration; + /** Configuration for the invocations protocol. */ + invocations?: InvocationsProtocolConfiguration; + /** Configuration for the WebSocket-based invocations protocol. */ + invocations_ws?: InvocationsWsProtocolConfiguration; +} + +export function protocolConfigurationSerializer(item: ProtocolConfiguration): any { + return { + activity: !item["activity"] + ? item["activity"] + : activityProtocolConfigurationSerializer(item["activity"]), + responses: !item["responses"] + ? item["responses"] + : responsesProtocolConfigurationSerializer(item["responses"]), + a2a: !item["a2a"] ? item["a2a"] : a2AProtocolConfigurationSerializer(item["a2a"]), + mcp: !item["mcp"] ? item["mcp"] : mcpProtocolConfigurationSerializer(item["mcp"]), + invocations: !item["invocations"] + ? item["invocations"] + : invocationsProtocolConfigurationSerializer(item["invocations"]), + invocations_ws: !item["invocations_ws"] + ? item["invocations_ws"] + : invocationsWsProtocolConfigurationSerializer(item["invocations_ws"]), + }; +} + +export function protocolConfigurationDeserializer(item: any): ProtocolConfiguration { + return { + activity: !item["activity"] + ? item["activity"] + : activityProtocolConfigurationDeserializer(item["activity"]), + responses: !item["responses"] + ? item["responses"] + : responsesProtocolConfigurationDeserializer(item["responses"]), + a2a: !item["a2a"] ? item["a2a"] : a2AProtocolConfigurationDeserializer(item["a2a"]), + mcp: !item["mcp"] ? item["mcp"] : mcpProtocolConfigurationDeserializer(item["mcp"]), + invocations: !item["invocations"] + ? item["invocations"] + : invocationsProtocolConfigurationDeserializer(item["invocations"]), + invocations_ws: !item["invocations_ws"] + ? item["invocations_ws"] + : invocationsWsProtocolConfigurationDeserializer(item["invocations_ws"]), + }; +} + +/** Configuration specific to the activity protocol. */ +export interface ActivityProtocolConfiguration { + /** Whether to enable the M365 public endpoint for the activity protocol. */ + enable_m365_public_endpoint?: boolean; +} + +export function activityProtocolConfigurationSerializer(item: ActivityProtocolConfiguration): any { + return { enable_m365_public_endpoint: item["enable_m365_public_endpoint"] }; +} + +export function activityProtocolConfigurationDeserializer( + item: any, +): ActivityProtocolConfiguration { + return { + enable_m365_public_endpoint: item["enable_m365_public_endpoint"], + }; +} + +/** Configuration specific to the responses protocol. */ +export interface ResponsesProtocolConfiguration {} + +export function responsesProtocolConfigurationSerializer( + _item: ResponsesProtocolConfiguration, +): any { + return {}; +} + +export function responsesProtocolConfigurationDeserializer( + item: any, +): ResponsesProtocolConfiguration { + return item; +} + +/** Configuration specific to the A2A protocol. */ +export interface A2AProtocolConfiguration {} + +export function a2AProtocolConfigurationSerializer(_item: A2AProtocolConfiguration): any { + return {}; +} + +export function a2AProtocolConfigurationDeserializer(item: any): A2AProtocolConfiguration { + return item; +} + +/** Configuration specific to the MCP protocol. */ +export interface McpProtocolConfiguration {} + +export function mcpProtocolConfigurationSerializer(_item: McpProtocolConfiguration): any { + return {}; +} + +export function mcpProtocolConfigurationDeserializer(item: any): McpProtocolConfiguration { + return item; +} + +/** Configuration specific to the invocations protocol. */ +export interface InvocationsProtocolConfiguration {} + +export function invocationsProtocolConfigurationSerializer( + _item: InvocationsProtocolConfiguration, +): any { + return {}; +} + +export function invocationsProtocolConfigurationDeserializer( + item: any, +): InvocationsProtocolConfiguration { + return item; +} + +/** Configuration specific to the WebSocket-based invocations protocol. */ +export interface InvocationsWsProtocolConfiguration {} + +export function invocationsWsProtocolConfigurationSerializer( + _item: InvocationsWsProtocolConfiguration, +): any { + return {}; +} + +export function invocationsWsProtocolConfigurationDeserializer( + item: any, +): InvocationsWsProtocolConfiguration { + return item; +} export function agentEndpointAuthorizationSchemeUnionArraySerializer( result: Array, @@ -5309,6 +5182,7 @@ export type AgentEndpointAuthorizationSchemeUnion = | EntraAuthorizationScheme | BotServiceAuthorizationScheme | BotServiceRbacAuthorizationScheme + | BotServiceTenantAuthorizationScheme | AgentEndpointAuthorizationScheme; export function agentEndpointAuthorizationSchemeUnionSerializer( @@ -5324,6 +5198,11 @@ export function agentEndpointAuthorizationSchemeUnionSerializer( case "BotServiceRbac": return botServiceRbacAuthorizationSchemeSerializer(item as BotServiceRbacAuthorizationScheme); + case "BotServiceTenant": + return botServiceTenantAuthorizationSchemeSerializer( + item as BotServiceTenantAuthorizationScheme, + ); + default: return agentEndpointAuthorizationSchemeSerializer(item); } @@ -5344,388 +5223,605 @@ export function agentEndpointAuthorizationSchemeUnionDeserializer( item as BotServiceRbacAuthorizationScheme, ); + case "BotServiceTenant": + return botServiceTenantAuthorizationSchemeDeserializer( + item as BotServiceTenantAuthorizationScheme, + ); + default: return agentEndpointAuthorizationSchemeDeserializer(item); } } -/** Type of AgentEndpointAuthorizationSchemeType */ -export type AgentEndpointAuthorizationSchemeType = "Entra" | "BotService" | "BotServiceRbac"; +/** Type of AgentEndpointAuthorizationSchemeType */ +export type AgentEndpointAuthorizationSchemeType = + "Entra" | "BotService" | "BotServiceRbac" | "BotServiceTenant"; + +/** model interface EntraAuthorizationScheme */ +export interface EntraAuthorizationScheme extends AgentEndpointAuthorizationScheme { + type: "Entra"; +} + +export function entraAuthorizationSchemeSerializer(item: EntraAuthorizationScheme): any { + return { type: item["type"] }; +} + +export function entraAuthorizationSchemeDeserializer(item: any): EntraAuthorizationScheme { + return { + type: item["type"], + }; +} + +/** model interface BotServiceAuthorizationScheme */ +export interface BotServiceAuthorizationScheme extends AgentEndpointAuthorizationScheme { + type: "BotService"; +} + +export function botServiceAuthorizationSchemeSerializer(item: BotServiceAuthorizationScheme): any { + return { type: item["type"] }; +} + +export function botServiceAuthorizationSchemeDeserializer( + item: any, +): BotServiceAuthorizationScheme { + return { + type: item["type"], + }; +} + +/** model interface BotServiceRbacAuthorizationScheme */ +export interface BotServiceRbacAuthorizationScheme extends AgentEndpointAuthorizationScheme { + type: "BotServiceRbac"; +} + +export function botServiceRbacAuthorizationSchemeSerializer( + item: BotServiceRbacAuthorizationScheme, +): any { + return { type: item["type"] }; +} + +export function botServiceRbacAuthorizationSchemeDeserializer( + item: any, +): BotServiceRbacAuthorizationScheme { + return { + type: item["type"], + }; +} + +/** model interface BotServiceTenantAuthorizationScheme */ +export interface BotServiceTenantAuthorizationScheme extends AgentEndpointAuthorizationScheme { + type: "BotServiceTenant"; +} + +export function botServiceTenantAuthorizationSchemeSerializer( + item: BotServiceTenantAuthorizationScheme, +): any { + return { type: item["type"] }; +} + +export function botServiceTenantAuthorizationSchemeDeserializer( + item: any, +): BotServiceTenantAuthorizationScheme { + return { + type: item["type"], + }; +} -/** model interface EntraAuthorizationScheme */ -export interface EntraAuthorizationScheme extends AgentEndpointAuthorizationScheme { - type: "Entra"; - /** The source from which the per-user isolation key is derived for requests authorized via this scheme. Defaults to Entra-based isolation when omitted. */ - isolation_key_source?: IsolationKeySourceUnion; +/** model interface AgentCard */ +export interface AgentCard { + /** The version of the agent card. */ + version: string; + /** The description of the agent card. */ + description?: string; + /** The set of skills that an agent can perform. */ + skills: AgentCardSkill[]; } -export function entraAuthorizationSchemeSerializer(item: EntraAuthorizationScheme): any { +export function agentCardSerializer(item: AgentCard): any { return { - type: item["type"], - isolation_key_source: !item["isolation_key_source"] - ? item["isolation_key_source"] - : isolationKeySourceUnionSerializer(item["isolation_key_source"]), + version: item["version"], + description: item["description"], + skills: agentCardSkillArraySerializer(item["skills"]), }; } -export function entraAuthorizationSchemeDeserializer(item: any): EntraAuthorizationScheme { +export function agentCardDeserializer(item: any): AgentCard { return { - type: item["type"], - isolation_key_source: !item["isolation_key_source"] - ? item["isolation_key_source"] - : isolationKeySourceUnionDeserializer(item["isolation_key_source"]), + version: item["version"], + description: item["description"], + skills: agentCardSkillArrayDeserializer(item["skills"]), }; } -/** model interface IsolationKeySource */ -export interface IsolationKeySource { - kind: IsolationKeySourceKind; +export function agentCardSkillArraySerializer(result: Array): any[] { + return result.map((item) => { + return agentCardSkillSerializer(item); + }); } -export function isolationKeySourceSerializer(item: IsolationKeySource): any { - return { kind: item["kind"] }; +export function agentCardSkillArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return agentCardSkillDeserializer(item); + }); +} + +/** model interface AgentCardSkill */ +export interface AgentCardSkill { + /** a unique identifier for the skill */ + id: string; + /** The name of the skill */ + name: string; + /** A description of the skill */ + description?: string; + /** set of tagwords describing classes of capabilities for the skill */ + tags?: string[]; + /** A list of example scenarios that the skill can perform. */ + examples?: string[]; } -export function isolationKeySourceDeserializer(item: any): IsolationKeySource { +export function agentCardSkillSerializer(item: AgentCardSkill): any { return { - kind: item["kind"], + id: item["id"], + name: item["name"], + description: item["description"], + tags: !item["tags"] + ? item["tags"] + : item["tags"].map((p: any) => { + return p; + }), + examples: !item["examples"] + ? item["examples"] + : item["examples"].map((p: any) => { + return p; + }), }; } -/** Alias for IsolationKeySourceUnion */ -export type IsolationKeySourceUnion = - | EntraIsolationKeySource - | HeaderIsolationKeySource - | IsolationKeySource; - -export function isolationKeySourceUnionSerializer(item: IsolationKeySourceUnion): any { - switch (item.kind) { - case "Entra": - return entraIsolationKeySourceSerializer(item as EntraIsolationKeySource); +export function agentCardSkillDeserializer(item: any): AgentCardSkill { + return { + id: item["id"], + name: item["name"], + description: item["description"], + tags: !item["tags"] + ? item["tags"] + : item["tags"].map((p: any) => { + return p; + }), + examples: !item["examples"] + ? item["examples"] + : item["examples"].map((p: any) => { + return p; + }), + }; +} - case "Header": - return headerIsolationKeySourceSerializer(item as HeaderIsolationKeySource); +/** Error response for API failures. */ +export interface ApiErrorResponse { + error: ApiError; +} - default: - return isolationKeySourceSerializer(item); - } +export function apiErrorResponseDeserializer(item: any): ApiErrorResponse { + return { + error: apiErrorDeserializer(item["error"]), + }; } -export function isolationKeySourceUnionDeserializer(item: any): IsolationKeySourceUnion { - switch (item["kind"]) { - case "Entra": - return entraIsolationKeySourceDeserializer(item as EntraIsolationKeySource); +/** model interface ApiError */ +export interface ApiError { + code: string | null; + message: string; + param?: string; + type?: string; + details?: ApiError[]; + additionalInfo?: Record; + debugInfo?: Record; +} - case "Header": - return headerIsolationKeySourceDeserializer(item as HeaderIsolationKeySource); +export function apiErrorDeserializer(item: any): ApiError { + return { + code: item["code"], + message: item["message"], + param: item["param"], + type: item["type"], + details: !item["details"] ? item["details"] : apiErrorArrayDeserializer(item["details"]), + additionalInfo: !item["additionalInfo"] + ? item["additionalInfo"] + : Object.fromEntries( + Object.entries(item["additionalInfo"]).map(([k, p]: [string, any]) => [k, p]), + ), + debugInfo: !item["debugInfo"] + ? item["debugInfo"] + : Object.fromEntries( + Object.entries(item["debugInfo"]).map(([k, p]: [string, any]) => [k, p]), + ), + }; +} - default: - return isolationKeySourceDeserializer(item); - } +export function apiErrorArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return apiErrorDeserializer(item); + }); } -/** Type of IsolationKeySourceKind */ -export type IsolationKeySourceKind = "Entra" | "Header"; +/** A deleted agent Object */ +export interface DeleteAgentResponse { + /** The object type. Always 'agent.deleted'. */ + object: "agent.deleted"; + /** The name of the agent. */ + name: string; + /** Whether the agent was successfully deleted. */ + deleted: boolean; +} -/** model interface EntraIsolationKeySource */ -export interface EntraIsolationKeySource extends IsolationKeySource { - kind: "Entra"; +export function deleteAgentResponseDeserializer(item: any): DeleteAgentResponse { + return { + object: item["object"], + name: item["name"], + deleted: item["deleted"], + }; } -export function entraIsolationKeySourceSerializer(item: EntraIsolationKeySource): any { - return { kind: item["kind"] }; +/** The response data for a requested list of items. */ +export interface _AgentsPagedResultAgentObject { + /** The requested list of items. */ + data: Agent[]; + /** The first ID represented in this list. */ + first_id?: string; + /** The last ID represented in this list. */ + last_id?: string; + /** A value indicating whether there are additional values available not captured in this list. */ + has_more: boolean; } -export function entraIsolationKeySourceDeserializer(item: any): EntraIsolationKeySource { +export function _agentsPagedResultAgentObjectDeserializer( + item: any, +): _AgentsPagedResultAgentObject { return { - kind: item["kind"], + data: agentArrayDeserializer(item["data"]), + first_id: item["first_id"], + last_id: item["last_id"], + has_more: item["has_more"], }; } -/** model interface HeaderIsolationKeySource */ -export interface HeaderIsolationKeySource extends IsolationKeySource { - kind: "Header"; +export function agentArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return agentDeserializer(item); + }); } -export function headerIsolationKeySourceSerializer(item: HeaderIsolationKeySource): any { - return { kind: item["kind"] }; +/** A deleted agent version Object */ +export interface DeleteAgentVersionResponse { + /** The object type. Always 'agent.version.deleted'. */ + object: "agent.version.deleted"; + /** The name of the agent. */ + name: string; + /** The version identifier of the agent. */ + version: string; + /** Whether the agent was successfully deleted. */ + deleted: boolean; } -export function headerIsolationKeySourceDeserializer(item: any): HeaderIsolationKeySource { +export function deleteAgentVersionResponseDeserializer(item: any): DeleteAgentVersionResponse { return { - kind: item["kind"], + object: item["object"], + name: item["name"], + version: item["version"], + deleted: item["deleted"], }; } -/** model interface BotServiceAuthorizationScheme */ -export interface BotServiceAuthorizationScheme extends AgentEndpointAuthorizationScheme { - type: "BotService"; +/** The response data for a requested list of items. */ +export interface _AgentsPagedResultAgentVersionObject { + /** The requested list of items. */ + data: AgentVersion[]; + /** The first ID represented in this list. */ + first_id?: string; + /** The last ID represented in this list. */ + last_id?: string; + /** A value indicating whether there are additional values available not captured in this list. */ + has_more: boolean; } -export function botServiceAuthorizationSchemeSerializer(item: BotServiceAuthorizationScheme): any { - return { type: item["type"] }; +export function _agentsPagedResultAgentVersionObjectDeserializer( + item: any, +): _AgentsPagedResultAgentVersionObject { + return { + data: agentVersionArrayDeserializer(item["data"]), + first_id: item["first_id"], + last_id: item["last_id"], + has_more: item["has_more"], + }; +} + +export function agentVersionArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return agentVersionDeserializer(item); + }); +} + +/** Multipart request body for updating or versioning a code-based agent (POST /agents/{name} and POST /agents/{name}/versions). */ +export interface CreateAgentVersionFromCodeContent { + /** JSON metadata including description and hosted definition. */ + metadata: CreateAgentVersionFromCodeMetadata; + /** The code zip file (max 250 MB). */ + code: FileContents | { contents: FileContents; contentType?: string; filename?: string }; +} + +export function createAgentVersionFromCodeContentSerializer( + item: CreateAgentVersionFromCodeContent, +): any { + return [ + { name: "metadata", body: createAgentVersionFromCodeMetadataSerializer(item["metadata"]) }, + createFilePartDescriptor("code", item["code"], "application/octet-stream"), + ]; +} + +/** + * JSON metadata for code-based agent operations (create, update, create version). + * The agent name comes from the URL path parameter or the `x-ms-agent-name` header, + * so it is not included in this model. + * The content hash (SHA-256 of the zip) is carried in the `x-ms-code-zip-sha256` header. + */ +export interface CreateAgentVersionFromCodeMetadata { + /** A human-readable description of the agent. */ + description?: string; + /** + * Set of 16 key-value pairs that can be attached to an object. This can be + * useful for storing additional information about the object in a structured + * format, and querying for objects via API or the dashboard. + * + * Keys are strings with a maximum length of 64 characters. Values are strings + * with a maximum length of 512 characters. + */ + metadata?: Record; + /** The hosted agent definition including code_configuration (runtime, entry_point), cpu, memory, and protocol_versions. */ + definition: HostedAgentDefinition; } -export function botServiceAuthorizationSchemeDeserializer( - item: any, -): BotServiceAuthorizationScheme { +export function createAgentVersionFromCodeMetadataSerializer( + item: CreateAgentVersionFromCodeMetadata, +): any { return { - type: item["type"], + description: item["description"], + metadata: item["metadata"], + definition: hostedAgentDefinitionSerializer(item["definition"]), }; } -/** model interface BotServiceRbacAuthorizationScheme */ -export interface BotServiceRbacAuthorizationScheme extends AgentEndpointAuthorizationScheme { - type: "BotServiceRbac"; +/** Version indicator determining which agent version backs the session. */ +export interface VersionIndicator { + /** The type of version indicator. */ + /** The discriminator possible values: version_ref */ + type: VersionIndicatorType; } -export function botServiceRbacAuthorizationSchemeSerializer( - item: BotServiceRbacAuthorizationScheme, -): any { +export function versionIndicatorSerializer(item: VersionIndicator): any { return { type: item["type"] }; } -export function botServiceRbacAuthorizationSchemeDeserializer( - item: any, -): BotServiceRbacAuthorizationScheme { +export function versionIndicatorDeserializer(item: any): VersionIndicator { return { type: item["type"], }; } -/** model interface AgentCard */ -export interface AgentCard { - /** The version of the agent card. */ - version: string; - /** The description of the agent card. */ - description?: string; - /** The set of skills that an agent can perform. */ - skills: AgentCardSkill[]; -} +/** Alias for VersionIndicatorUnion */ +export type VersionIndicatorUnion = VersionRefIndicator | VersionIndicator; -export function agentCardSerializer(item: AgentCard): any { - return { - version: item["version"], - description: item["description"], - skills: agentCardSkillArraySerializer(item["skills"]), - }; -} +export function versionIndicatorUnionSerializer(item: VersionIndicatorUnion): any { + switch (item.type) { + case "version_ref": + return versionRefIndicatorSerializer(item as VersionRefIndicator); -export function agentCardDeserializer(item: any): AgentCard { - return { - version: item["version"], - description: item["description"], - skills: agentCardSkillArrayDeserializer(item["skills"]), - }; + default: + return versionIndicatorSerializer(item); + } } -export function agentCardSkillArraySerializer(result: Array): any[] { - return result.map((item) => { - return agentCardSkillSerializer(item); - }); -} +export function versionIndicatorUnionDeserializer(item: any): VersionIndicatorUnion { + switch (item["type"]) { + case "version_ref": + return versionRefIndicatorDeserializer(item as VersionRefIndicator); -export function agentCardSkillArrayDeserializer(result: Array): any[] { - return result.map((item) => { - return agentCardSkillDeserializer(item); - }); + default: + return versionIndicatorDeserializer(item); + } } -/** model interface AgentCardSkill */ -export interface AgentCardSkill { - /** a unique identifier for the skill */ - id: string; - /** The name of the skill */ - name: string; - /** A description of the skill */ - description?: string; - /** set of tagwords describing classes of capabilities for the skill */ - tags?: string[]; - /** A list of example scenarios that the skill can perform. */ - examples?: string[]; +/** The type of version indicator used to determine the agent version backing a session. */ +export type VersionIndicatorType = "version_ref"; + +/** Version indicator that references a specific agent version by name. */ +export interface VersionRefIndicator extends VersionIndicator { + /** Discriminator value for version_ref. */ + type: "version_ref"; + /** The agent version identifier returned by the agent version APIs. */ + agent_version: string; } -export function agentCardSkillSerializer(item: AgentCardSkill): any { - return { - id: item["id"], - name: item["name"], - description: item["description"], - tags: !item["tags"] - ? item["tags"] - : item["tags"].map((p: any) => { - return p; - }), - examples: !item["examples"] - ? item["examples"] - : item["examples"].map((p: any) => { - return p; - }), - }; +export function versionRefIndicatorSerializer(item: VersionRefIndicator): any { + return { type: item["type"], agent_version: item["agent_version"] }; } -export function agentCardSkillDeserializer(item: any): AgentCardSkill { +export function versionRefIndicatorDeserializer(item: any): VersionRefIndicator { return { - id: item["id"], - name: item["name"], - description: item["description"], - tags: !item["tags"] - ? item["tags"] - : item["tags"].map((p: any) => { - return p; - }), - examples: !item["examples"] - ? item["examples"] - : item["examples"].map((p: any) => { - return p; - }), + type: item["type"], + agent_version: item["agent_version"], }; } -/** Error response for API failures. */ -export interface ApiErrorResponse { - error: ApiError; +/** An agent session providing a long-lived compute sandbox for hosted agent invocations. */ +export interface AgentSessionResource { + /** The session identifier. */ + agent_session_id: string; + /** The version indicator determining which agent version backs this session. */ + version_indicator: VersionIndicatorUnion; + /** The current status of the session. */ + status: AgentSessionStatus; + /** The Unix timestamp (in seconds) when the session was created. */ + readonly created_at: Date; + /** The Unix timestamp (in seconds) when the session was last accessed. */ + readonly last_accessed_at: Date; + /** The Unix timestamp (in seconds) when the session expires (rolling, 30 days from last activity). */ + readonly expires_at: Date; } -export function apiErrorResponseDeserializer(item: any): ApiErrorResponse { +export function agentSessionResourceDeserializer(item: any): AgentSessionResource { return { - error: apiErrorDeserializer(item["error"]), + agent_session_id: item["agent_session_id"], + version_indicator: versionIndicatorUnionDeserializer(item["version_indicator"]), + status: item["status"], + created_at: new Date(item["created_at"] * 1000), + last_accessed_at: new Date(item["last_accessed_at"] * 1000), + expires_at: new Date(item["expires_at"] * 1000), }; } -/** model interface ApiError */ -export interface ApiError { - code: string | null; - message: string; - param?: string; - type?: string; - details?: ApiError[]; - additionalInfo?: Record; - debugInfo?: Record; +/** The status of an agent session. */ +export type AgentSessionStatus = + "creating" | "active" | "idle" | "updating" | "failed" | "deleting" | "deleted" | "expired"; + +/** The response data for a requested list of items. */ +export interface _AgentsPagedResultAgentSessionResource { + /** The requested list of items. */ + data: AgentSessionResource[]; + /** The first ID represented in this list. */ + first_id?: string; + /** The last ID represented in this list. */ + last_id?: string; + /** A value indicating whether there are additional values available not captured in this list. */ + has_more: boolean; } -export function apiErrorDeserializer(item: any): ApiError { +export function _agentsPagedResultAgentSessionResourceDeserializer( + item: any, +): _AgentsPagedResultAgentSessionResource { return { - code: item["code"], - message: item["message"], - param: item["param"], - type: item["type"], - details: !item["details"] ? item["details"] : apiErrorArrayDeserializer(item["details"]), - additionalInfo: !item["additionalInfo"] - ? item["additionalInfo"] - : Object.fromEntries( - Object.entries(item["additionalInfo"]).map(([k, p]: [string, any]) => [k, p]), - ), - debugInfo: !item["debugInfo"] - ? item["debugInfo"] - : Object.fromEntries( - Object.entries(item["debugInfo"]).map(([k, p]: [string, any]) => [k, p]), - ), + data: agentSessionResourceArrayDeserializer(item["data"]), + first_id: item["first_id"], + last_id: item["last_id"], + has_more: item["has_more"], }; } -export function apiErrorArrayDeserializer(result: Array): any[] { +export function agentSessionResourceArrayDeserializer(result: Array): any[] { return result.map((item) => { - return apiErrorDeserializer(item); + return agentSessionResourceDeserializer(item); }); } -/** A deleted agent Object */ -export interface DeleteAgentResponse { - /** The object type. Always 'agent.deleted'. */ - object: "agent.deleted"; - /** The name of the agent. */ - name: string; - /** Whether the agent was successfully deleted. */ - deleted: boolean; +/** + * A single Server-Sent Event frame emitted by the hosted agent session log stream. + * + * Each frame contains an `event` field identifying the event type and a `data` + * field carrying the payload as plain text. Although the current `data` payload + * is JSON-formatted, its schema is not contractual — additional keys may appear + * and the format may change over time. Clients should treat `data` as an + * opaque string and optionally attempt JSON parsing. + * + * New event types may be added in the future. Clients should gracefully + * ignore unrecognized event types. + * + * Wire format: + * ``` + * event: log + * data: {"timestamp":"2026-03-10T09:33:17.121Z","stream":"stdout","message":"Starting server on port 18080"} + * + * event: log + * data: {"timestamp":"2026-03-10T09:34:52.714Z","stream":"status","message":"Successfully connected to container"} + * ``` + */ +export interface SessionLogEvent { + /** The SSE event type. Currently `log`, but additional event types may be added in the future. Clients should ignore unrecognized event types. */ + event: SessionLogEventType; + /** The event payload as plain text. Currently JSON-formatted but the schema is not contractual and may change. */ + data: string; +} + +export function sessionLogEventDeserializer(item: any): SessionLogEvent { + return { + event: item["event"], + data: item["data"], + }; +} + +/** + * Known SSE event types emitted by the hosted agent session log stream. + * Additional event types may be introduced in future versions. + */ +export type SessionLogEventType = "log"; + +/** Response from uploading a file to a session sandbox. */ +export interface SessionFileWriteResponse { + /** The path where the file was written, relative to the session home directory. */ + path: string; + /** Number of bytes written. */ + bytes_written: number; } -export function deleteAgentResponseDeserializer(item: any): DeleteAgentResponse { +export function sessionFileWriteResponseDeserializer(item: any): SessionFileWriteResponse { return { - object: item["object"], - name: item["name"], - deleted: item["deleted"], + path: item["path"], + bytes_written: item["bytes_written"], }; } -/** The response data for a requested list of items. */ -export interface _AgentsPagedResultAgentObject { - /** The requested list of items. */ - data: Agent[]; +/** model interface _SessionDirectoryListResponse */ +export interface _SessionDirectoryListResponse { /** The first ID represented in this list. */ first_id?: string; /** The last ID represented in this list. */ last_id?: string; /** A value indicating whether there are additional values available not captured in this list. */ has_more: boolean; + /** The path that was listed, relative to the session home directory. */ + path: string; + /** The directory entries. */ + entries: SessionDirectoryEntry[]; } -export function _agentsPagedResultAgentObjectDeserializer( +export function _sessionDirectoryListResponseDeserializer( item: any, -): _AgentsPagedResultAgentObject { +): _SessionDirectoryListResponse { return { - data: agentArrayDeserializer(item["data"]), first_id: item["first_id"], last_id: item["last_id"], has_more: item["has_more"], + path: item["path"], + entries: sessionDirectoryEntryArrayDeserializer(item["entries"]), }; } -export function agentArrayDeserializer(result: Array): any[] { +export function sessionDirectoryEntryArrayDeserializer( + result: Array, +): any[] { return result.map((item) => { - return agentDeserializer(item); + return sessionDirectoryEntryDeserializer(item); }); } -/** A deleted agent version Object */ -export interface DeleteAgentVersionResponse { - /** The object type. Always 'agent.version.deleted'. */ - object: "agent.version.deleted"; - /** The name of the agent. */ +/** A single entry in a directory listing. */ +export interface SessionDirectoryEntry { + /** The name of the file or directory. */ name: string; - /** The version identifier of the agent. */ - version: string; - /** Whether the agent was successfully deleted. */ - deleted: boolean; + /** The size in bytes (0 for directories). */ + size: number; + /** Whether this entry is a directory. */ + is_directory: boolean; + /** The Unix timestamp (in seconds) when the file was last modified. */ + modified_time: Date; } -export function deleteAgentVersionResponseDeserializer(item: any): DeleteAgentVersionResponse { +export function sessionDirectoryEntryDeserializer(item: any): SessionDirectoryEntry { return { - object: item["object"], name: item["name"], - version: item["version"], - deleted: item["deleted"], - }; -} - -/** The response data for a requested list of items. */ -export interface _AgentsPagedResultAgentVersionObject { - /** The requested list of items. */ - data: AgentVersion[]; - /** The first ID represented in this list. */ - first_id?: string; - /** The last ID represented in this list. */ - last_id?: string; - /** A value indicating whether there are additional values available not captured in this list. */ - has_more: boolean; -} - -export function _agentsPagedResultAgentVersionObjectDeserializer( - item: any, -): _AgentsPagedResultAgentVersionObject { - return { - data: agentVersionArrayDeserializer(item["data"]), - first_id: item["first_id"], - last_id: item["last_id"], - has_more: item["has_more"], + size: item["size"], + is_directory: item["is_directory"], + modified_time: new Date(item["modified_time"] * 1000), }; } -export function agentVersionArrayDeserializer(result: Array): any[] { - return result.map((item) => { - return agentVersionDeserializer(item); - }); -} - /** Evaluation rule model. */ export interface EvaluationRule { /** Unique identifier for the evaluation rule. */ @@ -5791,9 +5887,7 @@ export function evaluationRuleActionDeserializer(item: any): EvaluationRuleActio /** Alias for EvaluationRuleActionUnion */ export type EvaluationRuleActionUnion = - | ContinuousEvaluationRuleAction - | HumanEvaluationPreviewRuleAction - | EvaluationRuleAction; + ContinuousEvaluationRuleAction | HumanEvaluationPreviewRuleAction | EvaluationRuleAction; export function evaluationRuleActionUnionSerializer(item: EvaluationRuleActionUnion): any { switch (item.type) { @@ -6022,12 +6116,7 @@ export function baseCredentialsUnionDeserializer(item: any): BaseCredentialsUnio /** The credential type used by the connection */ export type CredentialType = - | "ApiKey" - | "AAD" - | "SAS" - | "CustomKeys" - | "None" - | "AgenticIdentityToken_Preview"; + "ApiKey" | "AAD" | "SAS" | "CustomKeys" | "None" | "AgenticIdentityToken_Preview"; /** API Key Credential definition */ export interface ApiKeyCredentials extends BaseCredentials { @@ -6759,745 +6848,929 @@ export function cosmosDBIndexSerializer(item: CosmosDBIndex): any { }; } -export function cosmosDBIndexDeserializer(item: any): CosmosDBIndex { +export function cosmosDBIndexDeserializer(item: any): CosmosDBIndex { + return { + type: item["type"], + id: item["id"], + name: item["name"], + version: item["version"], + description: item["description"], + tags: !item["tags"] + ? item["tags"] + : Object.fromEntries(Object.entries(item["tags"]).map(([k, p]: [string, any]) => [k, p])), + connectionName: item["connectionName"], + databaseName: item["databaseName"], + containerName: item["containerName"], + embeddingConfiguration: embeddingConfigurationDeserializer(item["embeddingConfiguration"]), + fieldMapping: fieldMappingDeserializer(item["fieldMapping"]), + }; +} + +/** Embedding configuration class */ +export interface EmbeddingConfiguration { + /** Deployment name of embedding model. It can point to a model deployment either in the parent AIServices or a connection. */ + modelDeploymentName: string; + /** Embedding field */ + embeddingField: string; +} + +export function embeddingConfigurationSerializer(item: EmbeddingConfiguration): any { + return { + modelDeploymentName: item["modelDeploymentName"], + embeddingField: item["embeddingField"], + }; +} + +export function embeddingConfigurationDeserializer(item: any): EmbeddingConfiguration { + return { + modelDeploymentName: item["modelDeploymentName"], + embeddingField: item["embeddingField"], + }; +} + +export function toolboxToolUnionArraySerializer(result: Array): any[] { + return result.map((item) => { + return toolboxToolUnionSerializer(item); + }); +} + +export function toolboxToolUnionArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return toolboxToolUnionDeserializer(item); + }); +} + +/** An abstract representation of a tool stored in a toolbox. */ +export interface ToolboxTool { + /** The type of tool. */ + /** The discriminator possible values: code_interpreter, file_search, web_search, mcp, azure_ai_search, openapi, a2a_preview, browser_automation_preview, reminder_preview, work_iq_preview, fabric_iq_preview, toolbox_search_preview */ + type: ToolboxToolType; + /** Optional user-defined name for this tool or configuration. */ + name?: string; + /** Optional user-defined description for this tool or configuration. */ + description?: string; + /** + * Per-tool configuration map. Keys are tool names or `*` (catch-all default). + * Resolution order: exact tool name match takes priority over `*`. + * Unknown tool names are silently ignored at runtime. + */ + tool_configs?: Record; +} + +export function toolboxToolSerializer(item: ToolboxTool): any { + return { + type: item["type"], + name: item["name"], + description: item["description"], + tool_configs: !item["tool_configs"] + ? item["tool_configs"] + : toolConfigRecordSerializer(item["tool_configs"]), + }; +} + +export function toolboxToolDeserializer(item: any): ToolboxTool { + return { + type: item["type"], + name: item["name"], + description: item["description"], + tool_configs: !item["tool_configs"] + ? item["tool_configs"] + : toolConfigRecordDeserializer(item["tool_configs"]), + }; +} + +/** Alias for ToolboxToolUnion */ +export type ToolboxToolUnion = + | CodeInterpreterToolboxTool + | FileSearchToolboxTool + | WebSearchToolboxTool + | MCPToolboxTool + | AzureAISearchToolboxTool + | OpenApiToolboxTool + | A2APreviewToolboxTool + | BrowserAutomationPreviewToolboxTool + | ReminderPreviewToolboxTool + | WorkIQPreviewToolboxTool + | FabricIQPreviewToolboxTool + | ToolboxSearchPreviewToolboxTool + | ToolboxTool; + +export function toolboxToolUnionSerializer(item: ToolboxToolUnion): any { + switch (item.type) { + case "code_interpreter": + return codeInterpreterToolboxToolSerializer(item as CodeInterpreterToolboxTool); + + case "file_search": + return fileSearchToolboxToolSerializer(item as FileSearchToolboxTool); + + case "web_search": + return webSearchToolboxToolSerializer(item as WebSearchToolboxTool); + + case "mcp": + return mcpToolboxToolSerializer(item as MCPToolboxTool); + + case "azure_ai_search": + return azureAISearchToolboxToolSerializer(item as AzureAISearchToolboxTool); + + case "openapi": + return openApiToolboxToolSerializer(item as OpenApiToolboxTool); + + case "a2a_preview": + return a2APreviewToolboxToolSerializer(item as A2APreviewToolboxTool); + + case "browser_automation_preview": + return browserAutomationPreviewToolboxToolSerializer( + item as BrowserAutomationPreviewToolboxTool, + ); + + case "reminder_preview": + return reminderPreviewToolboxToolSerializer(item as ReminderPreviewToolboxTool); + + case "work_iq_preview": + return workIQPreviewToolboxToolSerializer(item as WorkIQPreviewToolboxTool); + + case "fabric_iq_preview": + return fabricIQPreviewToolboxToolSerializer(item as FabricIQPreviewToolboxTool); + + case "toolbox_search_preview": + return toolboxSearchPreviewToolboxToolSerializer(item as ToolboxSearchPreviewToolboxTool); + + default: + return toolboxToolSerializer(item); + } +} + +export function toolboxToolUnionDeserializer(item: any): ToolboxToolUnion { + switch (item["type"]) { + case "code_interpreter": + return codeInterpreterToolboxToolDeserializer(item as CodeInterpreterToolboxTool); + + case "file_search": + return fileSearchToolboxToolDeserializer(item as FileSearchToolboxTool); + + case "web_search": + return webSearchToolboxToolDeserializer(item as WebSearchToolboxTool); + + case "mcp": + return mcpToolboxToolDeserializer(item as MCPToolboxTool); + + case "azure_ai_search": + return azureAISearchToolboxToolDeserializer(item as AzureAISearchToolboxTool); + + case "openapi": + return openApiToolboxToolDeserializer(item as OpenApiToolboxTool); + + case "a2a_preview": + return a2APreviewToolboxToolDeserializer(item as A2APreviewToolboxTool); + + case "browser_automation_preview": + return browserAutomationPreviewToolboxToolDeserializer( + item as BrowserAutomationPreviewToolboxTool, + ); + + case "reminder_preview": + return reminderPreviewToolboxToolDeserializer(item as ReminderPreviewToolboxTool); + + case "work_iq_preview": + return workIQPreviewToolboxToolDeserializer(item as WorkIQPreviewToolboxTool); + + case "fabric_iq_preview": + return fabricIQPreviewToolboxToolDeserializer(item as FabricIQPreviewToolboxTool); + + case "toolbox_search_preview": + return toolboxSearchPreviewToolboxToolDeserializer(item as ToolboxSearchPreviewToolboxTool); + + default: + return toolboxToolDeserializer(item); + } +} + +/** Supported tool types for tools stored in a toolbox. */ +export type ToolboxToolType = + | "code_interpreter" + | "file_search" + | "web_search" + | "mcp" + | "azure_ai_search" + | "openapi" + | "a2a_preview" + | "browser_automation_preview" + | "reminder_preview" + | "work_iq_preview" + | "fabric_iq_preview" + | "toolbox_search_preview"; + +/** A code interpreter tool stored in a toolbox. */ +export interface CodeInterpreterToolboxTool extends ToolboxTool { + type: "code_interpreter"; + /** + * The code interpreter container. Can be a container ID or an object that + * specifies uploaded file IDs to make available to your code, along with an + * optional `memory_limit` setting. + * If not provided, the service assumes auto. + */ + container?: string | AutoCodeInterpreterToolParam; +} + +export function codeInterpreterToolboxToolSerializer(item: CodeInterpreterToolboxTool): any { + return { + type: item["type"], + name: item["name"], + description: item["description"], + tool_configs: !item["tool_configs"] + ? item["tool_configs"] + : toolConfigRecordSerializer(item["tool_configs"]), + container: !item["container"] + ? item["container"] + : _codeInterpreterToolContainerSerializer(item["container"]), + }; +} + +export function codeInterpreterToolboxToolDeserializer(item: any): CodeInterpreterToolboxTool { return { type: item["type"], - id: item["id"], name: item["name"], - version: item["version"], description: item["description"], - tags: !item["tags"] - ? item["tags"] - : Object.fromEntries(Object.entries(item["tags"]).map(([k, p]: [string, any]) => [k, p])), - connectionName: item["connectionName"], - databaseName: item["databaseName"], - containerName: item["containerName"], - embeddingConfiguration: embeddingConfigurationDeserializer(item["embeddingConfiguration"]), - fieldMapping: fieldMappingDeserializer(item["fieldMapping"]), + tool_configs: !item["tool_configs"] + ? item["tool_configs"] + : toolConfigRecordDeserializer(item["tool_configs"]), + container: !item["container"] + ? item["container"] + : _codeInterpreterToolContainerDeserializer(item["container"]), }; } -/** Embedding configuration class */ -export interface EmbeddingConfiguration { - /** Deployment name of embedding model. It can point to a model deployment either in the parent AIServices or a connection. */ - modelDeploymentName: string; - /** Embedding field */ - embeddingField: string; +/** A file search tool stored in a toolbox. */ +export interface FileSearchToolboxTool extends ToolboxTool { + type: "file_search"; + /** The maximum number of results to return. This number should be between 1 and 50 inclusive. */ + max_num_results?: number; + /** Ranking options for search. */ + ranking_options?: RankingOptions; + filters?: Filters; + /** The IDs of the vector stores to search. */ + vector_store_ids?: string[]; } -export function embeddingConfigurationSerializer(item: EmbeddingConfiguration): any { +export function fileSearchToolboxToolSerializer(item: FileSearchToolboxTool): any { return { - modelDeploymentName: item["modelDeploymentName"], - embeddingField: item["embeddingField"], + type: item["type"], + name: item["name"], + description: item["description"], + tool_configs: !item["tool_configs"] + ? item["tool_configs"] + : toolConfigRecordSerializer(item["tool_configs"]), + max_num_results: item["max_num_results"], + ranking_options: !item["ranking_options"] + ? item["ranking_options"] + : rankingOptionsSerializer(item["ranking_options"]), + filters: !item["filters"] ? item["filters"] : filtersSerializer(item["filters"]), + vector_store_ids: !item["vector_store_ids"] + ? item["vector_store_ids"] + : item["vector_store_ids"].map((p: any) => { + return p; + }), }; } -export function embeddingConfigurationDeserializer(item: any): EmbeddingConfiguration { +export function fileSearchToolboxToolDeserializer(item: any): FileSearchToolboxTool { return { - modelDeploymentName: item["modelDeploymentName"], - embeddingField: item["embeddingField"], + type: item["type"], + name: item["name"], + description: item["description"], + tool_configs: !item["tool_configs"] + ? item["tool_configs"] + : toolConfigRecordDeserializer(item["tool_configs"]), + max_num_results: item["max_num_results"], + ranking_options: !item["ranking_options"] + ? item["ranking_options"] + : rankingOptionsDeserializer(item["ranking_options"]), + filters: !item["filters"] ? item["filters"] : filtersDeserializer(item["filters"]), + vector_store_ids: !item["vector_store_ids"] + ? item["vector_store_ids"] + : item["vector_store_ids"].map((p: any) => { + return p; + }), }; } -/** Multipart request body for updating or versioning a code-based agent (POST /agents/{name} and POST /agents/{name}/versions). */ -export interface CreateAgentVersionFromCodeContent { - /** JSON metadata including description and hosted definition. */ - metadata: CreateAgentVersionFromCodeMetadata; - /** The code zip file (max 250 MB). */ - code: FileContents | { contents: FileContents; contentType?: string; filename?: string }; -} - -export function createAgentVersionFromCodeContentSerializer( - item: CreateAgentVersionFromCodeContent, -): any { - return [ - { name: "metadata", body: createAgentVersionFromCodeMetadataSerializer(item["metadata"]) }, - createFilePartDescriptor("code", item["code"], "application/octet-stream"), - ]; -} - -/** - * JSON metadata for code-based agent operations (create, update, create version). - * The agent name comes from the URL path parameter or the `x-ms-agent-name` header, - * so it is not included in this model. - * The content hash (SHA-256 of the zip) is carried in the `x-ms-code-zip-sha256` header. - */ -export interface CreateAgentVersionFromCodeMetadata { - /** A human-readable description of the agent. */ - description?: string; +/** A web search tool stored in a toolbox. */ +export interface WebSearchToolboxTool extends ToolboxTool { + type: "web_search"; + filters?: WebSearchToolFilters; + user_location?: WebSearchApproximateLocation; + /** High level guidance for the amount of context window space to use for the search. One of `low`, `medium`, or `high`. `medium` is the default. */ + search_context_size?: "low" | "medium" | "high"; /** - * Set of 16 key-value pairs that can be attached to an object. This can be - * useful for storing additional information about the object in a structured - * format, and querying for objects via API or the dashboard. - * - * Keys are strings with a maximum length of 64 characters. Values are strings - * with a maximum length of 512 characters. + * The project connections attached to this tool. There can be a maximum of 1 connection + * resource attached to the tool. */ - metadata?: Record; - /** The hosted agent definition including code_configuration (runtime, entry_point), cpu, memory, and protocol_versions. */ - definition: HostedAgentDefinition; + custom_search_configuration?: WebSearchConfiguration; } -export function createAgentVersionFromCodeMetadataSerializer( - item: CreateAgentVersionFromCodeMetadata, -): any { +export function webSearchToolboxToolSerializer(item: WebSearchToolboxTool): any { return { + type: item["type"], + name: item["name"], description: item["description"], - metadata: item["metadata"], - definition: hostedAgentDefinitionSerializer(item["definition"]), + tool_configs: !item["tool_configs"] + ? item["tool_configs"] + : toolConfigRecordSerializer(item["tool_configs"]), + filters: !item["filters"] ? item["filters"] : webSearchToolFiltersSerializer(item["filters"]), + user_location: !item["user_location"] + ? item["user_location"] + : webSearchApproximateLocationSerializer(item["user_location"]), + search_context_size: item["search_context_size"], + custom_search_configuration: !item["custom_search_configuration"] + ? item["custom_search_configuration"] + : webSearchConfigurationSerializer(item["custom_search_configuration"]), }; } -/** Version indicator determining which agent version backs the session. */ -export interface VersionIndicator { - /** The type of version indicator. */ - /** The discriminator possible values: version_ref */ - type: VersionIndicatorType; -} - -export function versionIndicatorSerializer(item: VersionIndicator): any { - return { type: item["type"] }; -} - -export function versionIndicatorDeserializer(item: any): VersionIndicator { +export function webSearchToolboxToolDeserializer(item: any): WebSearchToolboxTool { return { type: item["type"], + name: item["name"], + description: item["description"], + tool_configs: !item["tool_configs"] + ? item["tool_configs"] + : toolConfigRecordDeserializer(item["tool_configs"]), + filters: !item["filters"] ? item["filters"] : webSearchToolFiltersDeserializer(item["filters"]), + user_location: !item["user_location"] + ? item["user_location"] + : webSearchApproximateLocationDeserializer(item["user_location"]), + search_context_size: item["search_context_size"], + custom_search_configuration: !item["custom_search_configuration"] + ? item["custom_search_configuration"] + : webSearchConfigurationDeserializer(item["custom_search_configuration"]), }; } -/** Alias for VersionIndicatorUnion */ -export type VersionIndicatorUnion = VersionRefIndicator | VersionIndicator; - -export function versionIndicatorUnionSerializer(item: VersionIndicatorUnion): any { - switch (item.type) { - case "version_ref": - return versionRefIndicatorSerializer(item as VersionRefIndicator); - - default: - return versionIndicatorSerializer(item); - } -} - -export function versionIndicatorUnionDeserializer(item: any): VersionIndicatorUnion { - switch (item["type"]) { - case "version_ref": - return versionRefIndicatorDeserializer(item as VersionRefIndicator); - - default: - return versionIndicatorDeserializer(item); - } -} - -/** The type of version indicator used to determine the agent version backing a session. */ -export type VersionIndicatorType = "version_ref"; - -/** Version indicator that references a specific agent version by name. */ -export interface VersionRefIndicator extends VersionIndicator { - /** Discriminator value for version_ref. */ - type: "version_ref"; - /** The agent version identifier returned by the agent version APIs. */ - agent_version: string; +/** An MCP tool stored in a toolbox. */ +export interface MCPToolboxTool extends ToolboxTool { + type: "mcp"; + /** A label for this MCP server, used to identify it in tool calls. */ + server_label: string; + /** + * The URL for the MCP server. One of `server_url`, `connector_id`, or + * `tunnel_id` must be provided. + */ + server_url?: string; + /** + * Identifier for service connectors, like those available in ChatGPT. One of + * `server_url`, `connector_id`, or `tunnel_id` must be provided. Learn more + * about service connectors [here](/docs/guides/tools-remote-mcp#connectors). + * Currently supported `connector_id` values are: + * - Dropbox: `connector_dropbox` + * - Gmail: `connector_gmail` + * - Google Calendar: `connector_googlecalendar` + * - Google Drive: `connector_googledrive` + * - Microsoft Teams: `connector_microsoftteams` + * - Outlook Calendar: `connector_outlookcalendar` + * - Outlook Email: `connector_outlookemail` + * - SharePoint: `connector_sharepoint` + */ + connector_id?: + | "connector_dropbox" + | "connector_gmail" + | "connector_googlecalendar" + | "connector_googledrive" + | "connector_microsoftteams" + | "connector_outlookcalendar" + | "connector_outlookemail" + | "connector_sharepoint"; + /** + * The Secure MCP Tunnel ID to use instead of a direct server URL. One of + * `server_url`, `connector_id`, or `tunnel_id` must be provided. + */ + tunnel_id?: string; + /** + * An OAuth access token that can be used with a remote MCP server, either + * with a custom MCP server URL or a service connector. Your application + * must handle the OAuth authorization flow and provide the token here. + */ + authorization?: string; + /** Optional description of the MCP server, used to provide more context. */ + server_description?: string; + headers?: Record; + allowed_tools?: string[] | MCPToolFilter; + require_approval?: MCPToolRequireApproval | "always" | "never"; + /** Whether this MCP tool is deferred and discovered via tool search. */ + defer_loading?: boolean; + /** The connection ID in the project for the MCP server. The connection stores authentication and other connection details needed to connect to the MCP server. */ + project_connection_id?: string; } -export function versionRefIndicatorSerializer(item: VersionRefIndicator): any { - return { type: item["type"], agent_version: item["agent_version"] }; +export function mcpToolboxToolSerializer(item: MCPToolboxTool): any { + return { + type: item["type"], + name: item["name"], + description: item["description"], + tool_configs: !item["tool_configs"] + ? item["tool_configs"] + : toolConfigRecordSerializer(item["tool_configs"]), + server_label: item["server_label"], + server_url: item["server_url"], + connector_id: item["connector_id"], + tunnel_id: item["tunnel_id"], + authorization: item["authorization"], + server_description: item["server_description"], + headers: item["headers"], + allowed_tools: !item["allowed_tools"] + ? item["allowed_tools"] + : _mcpToolAllowedToolsSerializer(item["allowed_tools"]), + require_approval: !item["require_approval"] + ? item["require_approval"] + : _mcpToolRequireApprovalSerializer(item["require_approval"]), + defer_loading: item["defer_loading"], + project_connection_id: item["project_connection_id"], + }; } -export function versionRefIndicatorDeserializer(item: any): VersionRefIndicator { +export function mcpToolboxToolDeserializer(item: any): MCPToolboxTool { return { type: item["type"], - agent_version: item["agent_version"], + name: item["name"], + description: item["description"], + tool_configs: !item["tool_configs"] + ? item["tool_configs"] + : toolConfigRecordDeserializer(item["tool_configs"]), + server_label: item["server_label"], + server_url: item["server_url"], + connector_id: item["connector_id"], + tunnel_id: item["tunnel_id"], + authorization: item["authorization"], + server_description: item["server_description"], + headers: !item["headers"] + ? item["headers"] + : Object.fromEntries( + Object.entries(item["headers"]).map(([k1, p1]: [string, any]) => [k1, p1]), + ), + allowed_tools: !item["allowed_tools"] + ? item["allowed_tools"] + : _mcpToolAllowedToolsDeserializer(item["allowed_tools"]), + require_approval: !item["require_approval"] + ? item["require_approval"] + : _mcpToolRequireApprovalDeserializer(item["require_approval"]), + defer_loading: item["defer_loading"], + project_connection_id: item["project_connection_id"], }; } -/** An agent session providing a long-lived compute sandbox for hosted agent invocations. */ -export interface AgentSessionResource { - /** The session identifier. */ - agent_session_id: string; - /** The version indicator determining which agent version backs this session. */ - version_indicator: VersionIndicatorUnion; - /** The current status of the session. */ - status: AgentSessionStatus; - /** The Unix timestamp (in seconds) when the session was created. */ - readonly created_at: Date; - /** The Unix timestamp (in seconds) when the session was last accessed. */ - readonly last_accessed_at: Date; - /** The Unix timestamp (in seconds) when the session expires (rolling, 30 days from last activity). */ - readonly expires_at: Date; +/** An Azure AI Search tool stored in a toolbox. */ +export interface AzureAISearchToolboxTool extends ToolboxTool { + type: "azure_ai_search"; + /** The azure ai search index resource. */ + azure_ai_search: AzureAISearchToolResource; } -export function agentSessionResourceDeserializer(item: any): AgentSessionResource { +export function azureAISearchToolboxToolSerializer(item: AzureAISearchToolboxTool): any { return { - agent_session_id: item["agent_session_id"], - version_indicator: versionIndicatorUnionDeserializer(item["version_indicator"]), - status: item["status"], - created_at: new Date(item["created_at"] * 1000), - last_accessed_at: new Date(item["last_accessed_at"] * 1000), - expires_at: new Date(item["expires_at"] * 1000), + type: item["type"], + name: item["name"], + description: item["description"], + tool_configs: !item["tool_configs"] + ? item["tool_configs"] + : toolConfigRecordSerializer(item["tool_configs"]), + azure_ai_search: azureAISearchToolResourceSerializer(item["azure_ai_search"]), }; } -/** The status of an agent session. */ -export type AgentSessionStatus = - | "creating" - | "active" - | "idle" - | "updating" - | "failed" - | "deleting" - | "deleted" - | "expired"; +export function azureAISearchToolboxToolDeserializer(item: any): AzureAISearchToolboxTool { + return { + type: item["type"], + name: item["name"], + description: item["description"], + tool_configs: !item["tool_configs"] + ? item["tool_configs"] + : toolConfigRecordDeserializer(item["tool_configs"]), + azure_ai_search: azureAISearchToolResourceDeserializer(item["azure_ai_search"]), + }; +} -/** The response data for a requested list of items. */ -export interface _AgentsPagedResultAgentSessionResource { - /** The requested list of items. */ - data: AgentSessionResource[]; - /** The first ID represented in this list. */ - first_id?: string; - /** The last ID represented in this list. */ - last_id?: string; - /** A value indicating whether there are additional values available not captured in this list. */ - has_more: boolean; +/** An OpenAPI tool stored in a toolbox. */ +export interface OpenApiToolboxTool extends ToolboxTool { + type: "openapi"; + /** The openapi function definition. */ + openapi: OpenApiFunctionDefinition; } -export function _agentsPagedResultAgentSessionResourceDeserializer( - item: any, -): _AgentsPagedResultAgentSessionResource { +export function openApiToolboxToolSerializer(item: OpenApiToolboxTool): any { return { - data: agentSessionResourceArrayDeserializer(item["data"]), - first_id: item["first_id"], - last_id: item["last_id"], - has_more: item["has_more"], + type: item["type"], + name: item["name"], + description: item["description"], + tool_configs: !item["tool_configs"] + ? item["tool_configs"] + : toolConfigRecordSerializer(item["tool_configs"]), + openapi: openApiFunctionDefinitionSerializer(item["openapi"]), }; } -export function agentSessionResourceArrayDeserializer(result: Array): any[] { - return result.map((item) => { - return agentSessionResourceDeserializer(item); - }); +export function openApiToolboxToolDeserializer(item: any): OpenApiToolboxTool { + return { + type: item["type"], + name: item["name"], + description: item["description"], + tool_configs: !item["tool_configs"] + ? item["tool_configs"] + : toolConfigRecordDeserializer(item["tool_configs"]), + openapi: openApiFunctionDefinitionDeserializer(item["openapi"]), + }; } -/** - * A single Server-Sent Event frame emitted by the hosted agent session log stream. - * - * Each frame contains an `event` field identifying the event type and a `data` - * field carrying the payload as plain text. Although the current `data` payload - * is JSON-formatted, its schema is not contractual — additional keys may appear - * and the format may change over time. Clients should treat `data` as an - * opaque string and optionally attempt JSON parsing. - * - * New event types may be added in the future. Clients should gracefully - * ignore unrecognized event types. - * - * Wire format: - * ``` - * event: log - * data: {"timestamp":"2026-03-10T09:33:17.121Z","stream":"stdout","message":"Starting server on port 18080"} - * - * event: log - * data: {"timestamp":"2026-03-10T09:34:52.714Z","stream":"status","message":"Successfully connected to container"} - * ``` - */ -export interface SessionLogEvent { - /** The SSE event type. Currently `log`, but additional event types may be added in the future. Clients should ignore unrecognized event types. */ - event: SessionLogEventType; - /** The event payload as plain text. Currently JSON-formatted but the schema is not contractual and may change. */ - data: string; +/** An A2A tool stored in a toolbox. */ +export interface A2APreviewToolboxTool extends ToolboxTool { + type: "a2a_preview"; + /** Base URL of the agent. */ + base_url?: string; + /** + * The path to the agent card relative to the `base_url`. + * If not provided, defaults to `/.well-known/agent-card.json` + */ + agent_card_path?: string; + /** + * The connection ID in the project for the A2A server. + * The connection stores authentication and other connection details needed to connect to the A2A server. + */ + project_connection_id?: string; + /** + * When `true`, Foundry sends its credentials when fetching the remote + * agent's Agent Card. The service defaults to `false` if a value is not + * specified by the caller (anonymous fetch). + */ + send_credentials_for_agent_card?: boolean; } -export function sessionLogEventDeserializer(item: any): SessionLogEvent { +export function a2APreviewToolboxToolSerializer(item: A2APreviewToolboxTool): any { return { - event: item["event"], - data: item["data"], + type: item["type"], + name: item["name"], + description: item["description"], + tool_configs: !item["tool_configs"] + ? item["tool_configs"] + : toolConfigRecordSerializer(item["tool_configs"]), + base_url: item["base_url"], + agent_card_path: item["agent_card_path"], + project_connection_id: item["project_connection_id"], + send_credentials_for_agent_card: item["send_credentials_for_agent_card"], }; } -/** - * Known SSE event types emitted by the hosted agent session log stream. - * Additional event types may be introduced in future versions. - */ -export type SessionLogEventType = "log"; +export function a2APreviewToolboxToolDeserializer(item: any): A2APreviewToolboxTool { + return { + type: item["type"], + name: item["name"], + description: item["description"], + tool_configs: !item["tool_configs"] + ? item["tool_configs"] + : toolConfigRecordDeserializer(item["tool_configs"]), + base_url: item["base_url"], + agent_card_path: item["agent_card_path"], + project_connection_id: item["project_connection_id"], + send_credentials_for_agent_card: item["send_credentials_for_agent_card"], + }; +} -/** Response from uploading a file to a session sandbox. */ -export interface SessionFileWriteResponse { - /** The path where the file was written, relative to the session home directory. */ - path: string; - /** Number of bytes written. */ - bytes_written: number; +/** A browser automation tool stored in a toolbox. */ +export interface BrowserAutomationPreviewToolboxTool extends ToolboxTool { + type: "browser_automation_preview"; + /** The Browser Automation Tool parameters. */ + browser_automation_preview: BrowserAutomationToolParameters; } -export function sessionFileWriteResponseDeserializer(item: any): SessionFileWriteResponse { +export function browserAutomationPreviewToolboxToolSerializer( + item: BrowserAutomationPreviewToolboxTool, +): any { return { - path: item["path"], - bytes_written: item["bytes_written"], + type: item["type"], + name: item["name"], + description: item["description"], + tool_configs: !item["tool_configs"] + ? item["tool_configs"] + : toolConfigRecordSerializer(item["tool_configs"]), + browser_automation_preview: browserAutomationToolParametersSerializer( + item["browser_automation_preview"], + ), }; } -/** model interface _SessionDirectoryListResponse */ -export interface _SessionDirectoryListResponse { - /** The first ID represented in this list. */ - first_id?: string; - /** The last ID represented in this list. */ - last_id?: string; - /** A value indicating whether there are additional values available not captured in this list. */ - has_more: boolean; - /** The path that was listed, relative to the session home directory. */ - path: string; - /** The directory entries. */ - entries: SessionDirectoryEntry[]; -} - -export function _sessionDirectoryListResponseDeserializer( +export function browserAutomationPreviewToolboxToolDeserializer( item: any, -): _SessionDirectoryListResponse { +): BrowserAutomationPreviewToolboxTool { return { - first_id: item["first_id"], - last_id: item["last_id"], - has_more: item["has_more"], - path: item["path"], - entries: sessionDirectoryEntryArrayDeserializer(item["entries"]), + type: item["type"], + name: item["name"], + description: item["description"], + tool_configs: !item["tool_configs"] + ? item["tool_configs"] + : toolConfigRecordDeserializer(item["tool_configs"]), + browser_automation_preview: browserAutomationToolParametersDeserializer( + item["browser_automation_preview"], + ), }; } -export function sessionDirectoryEntryArrayDeserializer( - result: Array, -): any[] { - return result.map((item) => { - return sessionDirectoryEntryDeserializer(item); - }); +/** A reminder tool stored in a toolbox. */ +export interface ReminderPreviewToolboxTool extends ToolboxTool { + type: "reminder_preview"; } -/** A single entry in a directory listing. */ -export interface SessionDirectoryEntry { - /** The name of the file or directory. */ - name: string; - /** The size in bytes (0 for directories). */ - size: number; - /** Whether this entry is a directory. */ - is_directory: boolean; - /** The Unix timestamp (in seconds) when the file was last modified. */ - modified_time: Date; +export function reminderPreviewToolboxToolSerializer(item: ReminderPreviewToolboxTool): any { + return { + type: item["type"], + name: item["name"], + description: item["description"], + tool_configs: !item["tool_configs"] + ? item["tool_configs"] + : toolConfigRecordSerializer(item["tool_configs"]), + }; } -export function sessionDirectoryEntryDeserializer(item: any): SessionDirectoryEntry { +export function reminderPreviewToolboxToolDeserializer(item: any): ReminderPreviewToolboxTool { return { + type: item["type"], name: item["name"], - size: item["size"], - is_directory: item["is_directory"], - modified_time: new Date(item["modified_time"] * 1000), + description: item["description"], + tool_configs: !item["tool_configs"] + ? item["tool_configs"] + : toolConfigRecordDeserializer(item["tool_configs"]), }; } -/** Caller-supplied inputs for an optimization job. */ -export interface OptimizationJobInputs { - /** The agent (and pinned version) being optimized. */ - agent: AgentIdentifier; - /** Reference to a registered training dataset (required). */ - train_dataset_reference: DatasetRef; - /** Optional held-out validation dataset for measuring generalization of the final candidate. */ - validation_dataset_reference?: DatasetRef; - /** Job-level evaluators (referenced by name). Per-task criteria may override. Default: ['task_adherence']. */ - evaluators?: string[]; - /** Tuning knobs and run-mode. */ - options?: OptimizationOptions; +/** A WorkIQ tool stored in a toolbox. */ +export interface WorkIQPreviewToolboxTool extends ToolboxTool { + type: "work_iq_preview"; + /** The ID of the WorkIQ project connection. */ + project_connection_id: string; } -export function optimizationJobInputsSerializer(item: OptimizationJobInputs): any { +export function workIQPreviewToolboxToolSerializer(item: WorkIQPreviewToolboxTool): any { return { - agent: agentIdentifierSerializer(item["agent"]), - train_dataset_reference: datasetRefSerializer(item["train_dataset_reference"]), - validation_dataset_reference: !item["validation_dataset_reference"] - ? item["validation_dataset_reference"] - : datasetRefSerializer(item["validation_dataset_reference"]), - evaluators: !item["evaluators"] - ? item["evaluators"] - : item["evaluators"].map((p: any) => { - return p; - }), - options: !item["options"] ? item["options"] : optimizationOptionsSerializer(item["options"]), + type: item["type"], + name: item["name"], + description: item["description"], + tool_configs: !item["tool_configs"] + ? item["tool_configs"] + : toolConfigRecordSerializer(item["tool_configs"]), + project_connection_id: item["project_connection_id"], }; } -export function optimizationJobInputsDeserializer(item: any): OptimizationJobInputs { +export function workIQPreviewToolboxToolDeserializer(item: any): WorkIQPreviewToolboxTool { return { - agent: agentIdentifierDeserializer(item["agent"]), - train_dataset_reference: datasetRefDeserializer(item["train_dataset_reference"]), - validation_dataset_reference: !item["validation_dataset_reference"] - ? item["validation_dataset_reference"] - : datasetRefDeserializer(item["validation_dataset_reference"]), - evaluators: !item["evaluators"] - ? item["evaluators"] - : item["evaluators"].map((p: any) => { - return p; - }), - options: !item["options"] ? item["options"] : optimizationOptionsDeserializer(item["options"]), + type: item["type"], + name: item["name"], + description: item["description"], + tool_configs: !item["tool_configs"] + ? item["tool_configs"] + : toolConfigRecordDeserializer(item["tool_configs"]), + project_connection_id: item["project_connection_id"], }; } -/** Identifies the registered Foundry agent to optimize (request-only). Skills, tools, and system_prompt are specified in options.optimization_config. */ -export interface AgentIdentifier { - /** Registered Foundry agent name (required). */ - agent_name: string; - /** Pinned agent version. Defaults to latest if omitted. */ - agent_version?: string; -} - -export function agentIdentifierSerializer(item: AgentIdentifier): any { - return { agent_name: item["agent_name"], agent_version: item["agent_version"] }; +/** A FabricIQ tool stored in a toolbox. */ +export interface FabricIQPreviewToolboxTool extends ToolboxTool { + type: "fabric_iq_preview"; + /** The ID of the FabricIQ project connection. */ + project_connection_id: string; + /** (Optional) The label of the FabricIQ MCP server to connect to. */ + server_label?: string; + /** (Optional) The URL of the FabricIQ MCP server. If not provided, the URL from the project connection will be used. */ + server_url?: string; + /** (Optional) Whether the agent requires approval before executing actions. Default is always. */ + require_approval?: MCPToolRequireApproval | string; } -export function agentIdentifierDeserializer(item: any): AgentIdentifier { +export function fabricIQPreviewToolboxToolSerializer(item: FabricIQPreviewToolboxTool): any { return { - agent_name: item["agent_name"], - agent_version: item["agent_version"], + type: item["type"], + name: item["name"], + description: item["description"], + tool_configs: !item["tool_configs"] + ? item["tool_configs"] + : toolConfigRecordSerializer(item["tool_configs"]), + project_connection_id: item["project_connection_id"], + server_label: item["server_label"], + server_url: item["server_url"], + require_approval: !item["require_approval"] + ? item["require_approval"] + : _fabricIQPreviewToolRequireApprovalSerializer(item["require_approval"]), }; } -/** Reference to a registered dataset in the Foundry Dataset Service. */ -export interface DatasetRef { - /** Dataset name. */ - name: string; - /** Dataset version. If not specified, the latest version is used. */ - version?: string; -} - -export function datasetRefSerializer(item: DatasetRef): any { - return { name: item["name"], version: item["version"] }; -} - -export function datasetRefDeserializer(item: any): DatasetRef { +export function fabricIQPreviewToolboxToolDeserializer(item: any): FabricIQPreviewToolboxTool { return { + type: item["type"], name: item["name"], - version: item["version"], + description: item["description"], + tool_configs: !item["tool_configs"] + ? item["tool_configs"] + : toolConfigRecordDeserializer(item["tool_configs"]), + project_connection_id: item["project_connection_id"], + server_label: item["server_label"], + server_url: item["server_url"], + require_approval: !item["require_approval"] + ? item["require_approval"] + : _fabricIQPreviewToolRequireApprovalDeserializer(item["require_approval"]), }; } -/** Tuning knobs and run-mode for an optimization job. */ -export interface OptimizationOptions { - /** Maximum optimization iterations per strategy. Must be >= 1. Default: 5. */ - max_iterations?: number; - /** Per-target-attribute configuration overrides. Contains skills, tools, system_prompt for the agent, plus model space for model optimization. */ - optimization_config?: Record; - /** Model deployment used for evaluation. Defaults to server config (typically 'gpt-4o'). */ - eval_model?: string; - /** Model deployment for optimization reasoning (must be gpt-5 family). Falls back to the default eval model when not set. */ - optimization_model?: string; - /** Evaluation granularity. Null/omitted means per-item single-turn. Set to 'conversation' for per-conversation multi-turn simulation scoring. */ - evaluation_level?: EvaluationLevel; +/** A toolbox search tool stored in a toolbox. */ +export interface ToolboxSearchPreviewToolboxTool extends ToolboxTool { + /** The type of the tool. Always `toolbox_search_preview`. */ + type: "toolbox_search_preview"; } -export function optimizationOptionsSerializer(item: OptimizationOptions): any { +export function toolboxSearchPreviewToolboxToolSerializer( + item: ToolboxSearchPreviewToolboxTool, +): any { return { - max_iterations: item["max_iterations"], - optimization_config: item["optimization_config"], - eval_model: item["eval_model"], - optimization_model: item["optimization_model"], - evaluation_level: item["evaluation_level"], + type: item["type"], + name: item["name"], + description: item["description"], + tool_configs: !item["tool_configs"] + ? item["tool_configs"] + : toolConfigRecordSerializer(item["tool_configs"]), }; } -export function optimizationOptionsDeserializer(item: any): OptimizationOptions { +export function toolboxSearchPreviewToolboxToolDeserializer( + item: any, +): ToolboxSearchPreviewToolboxTool { return { - max_iterations: item["max_iterations"], - optimization_config: !item["optimization_config"] - ? item["optimization_config"] - : Object.fromEntries( - Object.entries(item["optimization_config"]).map(([k, p]: [string, any]) => [k, p]), - ), - eval_model: item["eval_model"], - optimization_model: item["optimization_model"], - evaluation_level: item["evaluation_level"], + type: item["type"], + name: item["name"], + description: item["description"], + tool_configs: !item["tool_configs"] + ? item["tool_configs"] + : toolConfigRecordDeserializer(item["tool_configs"]), }; } -/** The level at which evaluation is performed. */ -export type EvaluationLevel = "turn" | "conversation"; - -/** Agent optimization job resource — a long-running job that optimizes an agent's configuration (instructions, model, skills, tools) to maximize evaluation scores. On success, the result contains scored candidates. */ -export interface OptimizationJob { - /** Server-assigned unique identifier. */ - readonly id: string; - /** Current lifecycle status. */ - readonly status: JobStatus; - /** Error details — populated only on failure. */ - readonly error?: ApiError; - /** Result produced on success. */ - readonly result?: OptimizationJobResult; - /** Caller-supplied inputs. */ - inputs?: OptimizationJobInputs; - /** The timestamp when the job was created, represented in Unix time. */ - readonly created_at: Date; - /** The timestamp when the job was last updated (status, progress, or result change), represented in Unix time. */ - readonly updated_at?: Date; - /** Progress while in flight. Absent in terminal states. */ - readonly progress?: OptimizationJobProgress; - /** Metadata about the dataset used for this optimization job. */ - readonly dataset?: DatasetInfo; +export function toolboxSkillUnionArraySerializer(result: Array): any[] { + return result.map((item) => { + return toolboxSkillUnionSerializer(item); + }); } -export function optimizationJobDeserializer(item: any): OptimizationJob { - return { - id: item["id"], - status: item["status"], - error: !item["error"] ? item["error"] : apiErrorDeserializer(item["error"]), - result: !item["result"] ? item["result"] : optimizationJobResultDeserializer(item["result"]), - inputs: !item["inputs"] ? item["inputs"] : optimizationJobInputsDeserializer(item["inputs"]), - created_at: new Date(item["created_at"] * 1000), - updated_at: !item["updated_at"] ? item["updated_at"] : new Date(item["updated_at"] * 1000), - progress: !item["progress"] - ? item["progress"] - : optimizationJobProgressDeserializer(item["progress"]), - dataset: !item["dataset"] ? item["dataset"] : datasetInfoDeserializer(item["dataset"]), - }; +export function toolboxSkillUnionArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return toolboxSkillUnionDeserializer(item); + }); } -/** Extensible status values shared by Foundry jobs. */ -export type JobStatus = "queued" | "in_progress" | "succeeded" | "failed" | "cancelled"; +/** A skill source included in a toolbox. */ +export interface ToolboxSkill { + /** The type of skill source. */ + /** The discriminator possible values: skill_reference */ + type: string; +} -/** Terminal-state result body. Populated when status is succeeded or failed. */ -export interface OptimizationJobResult { - /** Evaluation scores for the original (un-optimized) agent configuration. */ - baseline?: OptimizationCandidate; - /** The highest-scoring candidate found during optimization. */ - best?: OptimizationCandidate; - /** All evaluated candidates including baseline. */ - candidates?: OptimizationCandidate[]; - /** The options used for this optimization run. */ - options?: OptimizationOptions; - /** Non-fatal warnings from the optimization run (e.g., target attribute failures that were skipped). */ - warnings?: string[]; - /** True when all target attributes failed — only the baseline was evaluated. */ - all_target_attributes_failed?: boolean; +export function toolboxSkillSerializer(item: ToolboxSkill): any { + return { type: item["type"] }; } -export function optimizationJobResultDeserializer(item: any): OptimizationJobResult { +export function toolboxSkillDeserializer(item: any): ToolboxSkill { return { - baseline: !item["baseline"] - ? item["baseline"] - : optimizationCandidateDeserializer(item["baseline"]), - best: !item["best"] ? item["best"] : optimizationCandidateDeserializer(item["best"]), - candidates: !item["candidates"] - ? item["candidates"] - : optimizationCandidateArrayDeserializer(item["candidates"]), - options: !item["options"] ? item["options"] : optimizationOptionsDeserializer(item["options"]), - warnings: !item["warnings"] - ? item["warnings"] - : item["warnings"].map((p: any) => { - return p; - }), - all_target_attributes_failed: item["all_target_attributes_failed"], + type: item["type"], }; } -/** Aggregated evaluation result for a single candidate agent configuration across all tasks. */ -export interface OptimizationCandidate { - /** Server-assigned candidate identifier. Use with GET /candidates/{id} sub-endpoints. */ - candidate_id?: string; - /** Display name of the candidate (e.g., 'baseline', 'instruction-v2'). */ - name: string; - /** The agent configuration that produced this candidate. */ - config: OptimizationAgentDefinition; - /** What was mutated from the baseline (e.g., {system_prompt: 'new prompt'}). */ - mutations: Record; - /** Average composite score across all tasks. */ - avg_score: number; - /** Average token usage across all tasks. */ - avg_tokens: number; - /** Fraction of tasks that met the pass threshold. */ - pass_rate: number; - /** Individual task-level scores. */ - task_scores: OptimizationTaskResult[]; - /** Whether this candidate is on the Pareto frontier (score vs cost). */ - is_pareto_optimal: boolean; - /** Foundry evaluation identifier used to score this candidate. */ - eval_id?: string; - /** Foundry evaluation run identifier for this candidate's scoring run. */ - eval_run_id?: string; - /** Promotion metadata. Null if the candidate has not been promoted. */ - promotion?: PromotionInfo; -} +/** Alias for ToolboxSkillUnion */ +export type ToolboxSkillUnion = ToolboxSkillReference | ToolboxSkill; -export function optimizationCandidateDeserializer(item: any): OptimizationCandidate { - return { - candidate_id: item["candidate_id"], - name: item["name"], - config: optimizationAgentDefinitionDeserializer(item["config"]), - mutations: Object.fromEntries( - Object.entries(item["mutations"]).map(([k, p]: [string, any]) => [k, p]), - ), - avg_score: item["avg_score"], - avg_tokens: item["avg_tokens"], - pass_rate: item["pass_rate"], - task_scores: optimizationTaskResultArrayDeserializer(item["task_scores"]), - is_pareto_optimal: item["is_pareto_optimal"], - eval_id: item["eval_id"], - eval_run_id: item["eval_run_id"], - promotion: !item["promotion"] - ? item["promotion"] - : promotionInfoDeserializer(item["promotion"]), - }; -} +export function toolboxSkillUnionSerializer(item: ToolboxSkillUnion): any { + switch (item.type) { + case "skill_reference": + return toolboxSkillReferenceSerializer(item as ToolboxSkillReference); -/** Agent definition returned in response payloads (includes resolved config). */ -export interface OptimizationAgentDefinition { - /** Agent name. */ - agent_name?: string; - /** Agent version. */ - agent_version?: string; - /** Model deployment name. */ - model?: string; - /** System prompt / instructions. */ - system_prompt?: string; - /** Agent skills. */ - skills?: Record[]; - /** Agent tools. */ - tools?: Record[]; + default: + return toolboxSkillSerializer(item); + } } -export function optimizationAgentDefinitionDeserializer(item: any): OptimizationAgentDefinition { - return { - agent_name: item["agent_name"], - agent_version: item["agent_version"], - model: item["model"], - system_prompt: item["system_prompt"], - skills: !item["skills"] - ? item["skills"] - : item["skills"].map((p: any) => { - return Object.fromEntries(Object.entries(p).map(([k1, p1]: [string, any]) => [k1, p1])); - }), - tools: !item["tools"] - ? item["tools"] - : item["tools"].map((p: any) => { - return Object.fromEntries(Object.entries(p).map(([k1, p1]: [string, any]) => [k1, p1])); - }), - }; +export function toolboxSkillUnionDeserializer(item: any): ToolboxSkillUnion { + switch (item["type"]) { + case "skill_reference": + return toolboxSkillReferenceDeserializer(item as ToolboxSkillReference); + + default: + return toolboxSkillDeserializer(item); + } } -export function optimizationTaskResultArrayDeserializer( - result: Array, -): any[] { - return result.map((item) => { - return optimizationTaskResultDeserializer(item); - }); +/** A reference to an existing skill to include in a toolbox. */ +export interface ToolboxSkillReference extends ToolboxSkill { + /** The type of skill source. */ + type: "skill_reference"; + /** The name of the skill. */ + name: string; + /** The version of the skill. If not specified, the skill's default version is used. When a version is specified, the reference is pinned to that immutable version. */ + version?: string; } -/** Per-task evaluation result for a single candidate. */ -export interface OptimizationTaskResult { - /** Task name (from the dataset). */ - task_name: string; - /** The user query / input for the task. */ - query?: string; - /** Per-evaluator scores keyed by evaluator name. */ - scores: Record; - /** Composite score combining all evaluator scores. */ - composite_score: number; - /** Total tokens consumed during the agent run for this task. */ - tokens: number; - /** Wall-clock seconds for this task's agent execution. */ - duration_seconds: number; - /** Whether the task met the pass threshold. */ - passed: boolean; - /** Error message if the task failed during execution. */ - error_message?: string; - /** Per-evaluator reasoning keyed by evaluator name. */ - rationales?: Record; - /** Raw agent response text. */ - response?: string; - /** Identifier of the agent run that produced this result. */ - run_id?: string; +export function toolboxSkillReferenceSerializer(item: ToolboxSkillReference): any { + return { type: item["type"], name: item["name"], version: item["version"] }; } -export function optimizationTaskResultDeserializer(item: any): OptimizationTaskResult { +export function toolboxSkillReferenceDeserializer(item: any): ToolboxSkillReference { return { - task_name: item["task_name"], - query: item["query"], - scores: Object.fromEntries( - Object.entries(item["scores"]).map(([k, p]: [string, any]) => [k, p]), - ), - composite_score: item["composite_score"], - tokens: item["tokens"], - duration_seconds: item["duration_seconds"], - passed: item["passed"], - error_message: item["error_message"], - rationales: !item["rationales"] - ? item["rationales"] - : Object.fromEntries( - Object.entries(item["rationales"]).map(([k, p]: [string, any]) => [k, p]), - ), - response: item["response"], - run_id: item["run_id"], + type: item["type"], + name: item["name"], + version: item["version"], }; } -/** Promotion metadata recorded when a candidate is deployed to a Foundry agent. */ -export interface PromotionInfo { - /** Timestamp when promotion occurred, represented in Unix time. */ - promoted_at: Date; - /** Name of the Foundry agent this candidate was promoted to. */ - agent_name: string; - /** Version of the Foundry agent this candidate was promoted to. */ - agent_version: string; +/** Policy configuration for a toolbox, including content safety and other governance settings. */ +export interface ToolboxPolicies { + /** Responsible AI content filtering configuration. */ + rai_config?: RaiConfig; } -export function promotionInfoDeserializer(item: any): PromotionInfo { +export function toolboxPoliciesSerializer(item: ToolboxPolicies): any { return { - promoted_at: new Date(item["promoted_at"] * 1000), - agent_name: item["agent_name"], - agent_version: item["agent_version"], + rai_config: !item["rai_config"] ? item["rai_config"] : raiConfigSerializer(item["rai_config"]), }; } -export function optimizationCandidateArrayDeserializer( - result: Array, -): any[] { - return result.map((item) => { - return optimizationCandidateDeserializer(item); - }); +export function toolboxPoliciesDeserializer(item: any): ToolboxPolicies { + return { + rai_config: !item["rai_config"] + ? item["rai_config"] + : raiConfigDeserializer(item["rai_config"]), + }; } -/** In-flight progress; only populated while status is queued or in_progress. */ -export interface OptimizationJobProgress { - /** 1-based current iteration index. */ - current_iteration: number; - /** Best score observed so far across all candidates. */ - best_score: number; - /** Wall-clock time elapsed in seconds since the job began executing. */ - elapsed_seconds: number; +/** A specific version of a toolbox. */ +export interface ToolboxVersionObject { + /** + * Set of 16 key-value pairs that can be attached to an object. This can be + * useful for storing additional information about the object in a structured + * format, and querying for objects via API or the dashboard. + * + * Keys are strings with a maximum length of 64 characters. Values are strings + * with a maximum length of 512 characters. + */ + metadata: Record | null; + /** The unique identifier of the toolbox version. */ + id: string; + /** The name of the toolbox. */ + name: string; + /** The version identifier of the toolbox. Toolbox versions are immutable and every update creates a new version. */ + version: string; + /** A human-readable description of the toolbox. */ + description?: string; + /** The Unix timestamp (seconds) when the toolbox version was created. */ + created_at: Date; + /** The list of tools contained in this toolbox version. */ + tools: ToolboxToolUnion[]; + /** The list of skill sources included in this toolbox version. */ + skills?: ToolboxSkillUnion[]; + /** Policy configuration for the toolbox version. */ + policies?: ToolboxPolicies; } -export function optimizationJobProgressDeserializer(item: any): OptimizationJobProgress { +export function toolboxVersionObjectDeserializer(item: any): ToolboxVersionObject { return { - current_iteration: item["current_iteration"], - best_score: item["best_score"], - elapsed_seconds: item["elapsed_seconds"], + metadata: !item["metadata"] + ? item["metadata"] + : Object.fromEntries( + Object.entries(item["metadata"]).map(([k1, p1]: [string, any]) => [k1, p1]), + ), + id: item["id"], + name: item["name"], + version: item["version"], + description: item["description"], + created_at: new Date(item["created_at"] * 1000), + tools: toolboxToolUnionArrayDeserializer(item["tools"]), + skills: !item["skills"] ? item["skills"] : toolboxSkillUnionArrayDeserializer(item["skills"]), + policies: !item["policies"] ? item["policies"] : toolboxPoliciesDeserializer(item["policies"]), }; } -/** Metadata about the dataset used for optimization, surfaced in the response. */ -export interface DatasetInfo { - /** Dataset name when using a registered dataset reference. Null for inline datasets. */ - name?: string; - /** Dataset version when using a registered dataset reference. Null for inline datasets. */ - version?: string; - /** Number of tasks/rows in the dataset. */ - task_count: number; - /** True when the dataset was provided inline in the request body. */ - is_inline: boolean; +/** A toolbox that stores reusable tool definitions for agents. */ +export interface ToolboxObject { + /** The unique identifier of the toolbox. */ + id: string; + /** The name of the toolbox. */ + name: string; + /** The version identifier that the toolbox currently points to. Defaults to the latest version. Can be changed via updateToolbox. */ + default_version: string; } -export function datasetInfoDeserializer(item: any): DatasetInfo { +export function toolboxObjectDeserializer(item: any): ToolboxObject { return { + id: item["id"], name: item["name"], - version: item["version"], - task_count: item["task_count"], - is_inline: item["is_inline"], + default_version: item["default_version"], }; } /** The response data for a requested list of items. */ -export interface _AgentsPagedResultOptimizationJob { +export interface _AgentsPagedResultToolboxObject { /** The requested list of items. */ - data: OptimizationJob[]; + data: ToolboxObject[]; /** The first ID represented in this list. */ first_id?: string; /** The last ID represented in this list. */ @@ -7506,27 +7779,27 @@ export interface _AgentsPagedResultOptimizationJob { has_more: boolean; } -export function _agentsPagedResultOptimizationJobDeserializer( +export function _agentsPagedResultToolboxObjectDeserializer( item: any, -): _AgentsPagedResultOptimizationJob { +): _AgentsPagedResultToolboxObject { return { - data: optimizationJobArrayDeserializer(item["data"]), + data: toolboxObjectArrayDeserializer(item["data"]), first_id: item["first_id"], last_id: item["last_id"], has_more: item["has_more"], }; } -export function optimizationJobArrayDeserializer(result: Array): any[] { +export function toolboxObjectArrayDeserializer(result: Array): any[] { return result.map((item) => { - return optimizationJobDeserializer(item); + return toolboxObjectDeserializer(item); }); } /** The response data for a requested list of items. */ -export interface _AgentsPagedResultOptimizationCandidate { +export interface _AgentsPagedResultToolboxVersionObject { /** The requested list of items. */ - data: OptimizationCandidate[]; + data: ToolboxVersionObject[]; /** The first ID represented in this list. */ first_id?: string; /** The last ID represented in this list. */ @@ -7535,165 +7808,23 @@ export interface _AgentsPagedResultOptimizationCandidate { has_more: boolean; } -export function _agentsPagedResultOptimizationCandidateDeserializer( +export function _agentsPagedResultToolboxVersionObjectDeserializer( item: any, -): _AgentsPagedResultOptimizationCandidate { +): _AgentsPagedResultToolboxVersionObject { return { - data: optimizationCandidateArrayDeserializer(item["data"]), + data: toolboxVersionObjectArrayDeserializer(item["data"]), first_id: item["first_id"], last_id: item["last_id"], has_more: item["has_more"], }; } -/** Candidate metadata returned by GET /candidates/{id}. */ -export interface CandidateMetadata { - /** Server-assigned candidate identifier. */ - candidate_id: string; - /** Owning optimization job id. */ - job_id: string; - /** Display name of the candidate. */ - candidate_name: string; - /** Candidate lifecycle status. */ - status: string; - /** Candidate's aggregate score. */ - score?: number; - /** Whether detailed results are available for this candidate. */ - has_results: boolean; - /** Timestamp when the candidate was created, represented in Unix time. */ - created_at: Date; - /** Timestamp when the candidate was last updated, represented in Unix time. */ - updated_at: Date; - /** Promotion metadata. Null if not promoted. */ - promotion?: PromotionInfo; - /** Files in the candidate's blob directory. */ - files: CandidateFileInfo[]; -} - -export function candidateMetadataDeserializer(item: any): CandidateMetadata { - return { - candidate_id: item["candidate_id"], - job_id: item["job_id"], - candidate_name: item["candidate_name"], - status: item["status"], - score: item["score"], - has_results: item["has_results"], - created_at: new Date(item["created_at"] * 1000), - updated_at: new Date(item["updated_at"] * 1000), - promotion: !item["promotion"] - ? item["promotion"] - : promotionInfoDeserializer(item["promotion"]), - files: candidateFileInfoArrayDeserializer(item["files"]), - }; -} - -export function candidateFileInfoArrayDeserializer(result: Array): any[] { +export function toolboxVersionObjectArrayDeserializer(result: Array): any[] { return result.map((item) => { - return candidateFileInfoDeserializer(item); + return toolboxVersionObjectDeserializer(item); }); } -/** File entry in a candidate's blob directory. */ -export interface CandidateFileInfo { - /** Relative path of the file. */ - path: string; - /** File type category (e.g. 'config', 'results'). */ - type: string; - /** File size in bytes. */ - size_bytes: number; -} - -export function candidateFileInfoDeserializer(item: any): CandidateFileInfo { - return { - path: item["path"], - type: item["type"], - size_bytes: item["size_bytes"], - }; -} - -/** Deploy-config blob for a candidate. Suitable for setting OPTIMIZATION_CONFIG on a hosted-agent version. */ -export interface CandidateDeployConfig { - /** System prompt / instructions. */ - instructions?: string; - /** Foundry deployment name. */ - model?: string; - /** Optional sampling temperature. */ - temperature?: number; - /** Optional skill overrides. */ - skills?: Record[]; - /** Optional tool overrides. */ - tools?: Record[]; -} - -export function candidateDeployConfigDeserializer(item: any): CandidateDeployConfig { - return { - instructions: item["instructions"], - model: item["model"], - temperature: item["temperature"], - skills: !item["skills"] - ? item["skills"] - : item["skills"].map((p: any) => { - return Object.fromEntries(Object.entries(p).map(([k1, p1]: [string, any]) => [k1, p1])); - }), - tools: !item["tools"] - ? item["tools"] - : item["tools"].map((p: any) => { - return Object.fromEntries(Object.entries(p).map(([k1, p1]: [string, any]) => [k1, p1])); - }), - }; -} - -/** Full per-task evaluation results for a candidate, returned by GET /candidates/{id}/results. */ -export interface CandidateResults { - /** Owning candidate id. */ - candidate_id: string; - /** Per-task evaluation rows. */ - results: OptimizationTaskResult[]; -} - -export function candidateResultsDeserializer(item: any): CandidateResults { - return { - candidate_id: item["candidate_id"], - results: optimizationTaskResultArrayDeserializer(item["results"]), - }; -} - -/** Request body for promoting a candidate to a Foundry agent version. */ -export interface PromoteCandidateRequest { - /** Name of the Foundry agent to promote to. */ - agent_name: string; - /** Version of the Foundry agent to promote to. */ - agent_version: string; -} - -export function promoteCandidateRequestSerializer(item: PromoteCandidateRequest): any { - return { agent_name: item["agent_name"], agent_version: item["agent_version"] }; -} - -/** Response after successfully promoting a candidate. */ -export interface PromoteCandidateResponse { - /** The promoted candidate id. */ - candidate_id: string; - /** Status after promotion. */ - status: string; - /** Timestamp when promotion occurred, represented in Unix time. */ - promoted_at: Date; - /** Name of the Foundry agent promoted to. */ - agent_name: string; - /** Version of the Foundry agent promoted to. */ - agent_version: string; -} - -export function promoteCandidateResponseDeserializer(item: any): PromoteCandidateResponse { - return { - candidate_id: item["candidate_id"], - status: item["status"], - promoted_at: new Date(item["promoted_at"] * 1000), - agent_name: item["agent_name"], - agent_version: item["agent_version"], - }; -} - /** Evaluation Taxonomy Definition */ export interface EvaluationTaxonomy { /** Asset ID, a unique identifier for the asset */ @@ -8175,6 +8306,8 @@ export interface EvaluatorVersion { evaluator_type: EvaluatorType; /** The categories of the evaluator */ categories: EvaluatorCategory[]; + /** Evaluation levels this evaluator supports (e.g., `turn`, `conversation`). When omitted on create, the service defaults to `["turn"]`. On update, omitting this field leaves it unchanged; an empty list is rejected. Custom code-based evaluators support only `turn`; custom prompt-based evaluators support exactly one level (`turn` or `conversation`). */ + supported_evaluation_levels?: EvaluationLevel[]; /** Definition of the evaluator */ definition: EvaluatorDefinitionUnion; /** Provenance artifacts from the generation pipeline. Read-only; present only on evaluator versions created via an EvaluatorGenerationJob. Each artifact resolves to a versioned Foundry Dataset. */ @@ -8205,6 +8338,11 @@ export function evaluatorVersionSerializer(item: EvaluatorVersion): any { categories: item["categories"].map((p: any) => { return p; }), + supported_evaluation_levels: !item["supported_evaluation_levels"] + ? item["supported_evaluation_levels"] + : item["supported_evaluation_levels"].map((p: any) => { + return p; + }), definition: evaluatorDefinitionUnionSerializer(item["definition"]), description: item["description"], tags: item["tags"], @@ -8221,6 +8359,11 @@ export function evaluatorVersionDeserializer(item: any): EvaluatorVersion { categories: item["categories"].map((p: any) => { return p; }), + supported_evaluation_levels: !item["supported_evaluation_levels"] + ? item["supported_evaluation_levels"] + : item["supported_evaluation_levels"].map((p: any) => { + return p; + }), definition: evaluatorDefinitionUnionDeserializer(item["definition"]), generation_artifacts: !item["generation_artifacts"] ? item["generation_artifacts"] @@ -8242,11 +8385,13 @@ export function evaluatorVersionDeserializer(item: any): EvaluatorVersion { export type EvaluatorType = "builtin" | "custom"; /** The category of the evaluator */ export type EvaluatorCategory = "quality" | "safety" | "agents"; +/** The level at which evaluation is performed. */ +export type EvaluationLevel = "turn" | "conversation"; /** Base evaluator configuration with discriminator */ export interface EvaluatorDefinition { /** The type of evaluator definition */ - /** The discriminator possible values: code, prompt, rubric */ + /** The discriminator possible values: code, prompt, rubric, endpoint */ type: EvaluatorDefinitionType; /** The JSON schema (Draft 2020-12) for the evaluator's input parameters. This includes parameters like type, properties, required. */ init_parameters?: Record; @@ -8289,6 +8434,7 @@ export type EvaluatorDefinitionUnion = | CodeBasedEvaluatorDefinition | PromptBasedEvaluatorDefinition | RubricBasedEvaluatorDefinition + | EndpointBasedEvaluatorDefinition | EvaluatorDefinition; export function evaluatorDefinitionUnionSerializer(item: EvaluatorDefinitionUnion): any { @@ -8302,6 +8448,9 @@ export function evaluatorDefinitionUnionSerializer(item: EvaluatorDefinitionUnio case "rubric": return rubricBasedEvaluatorDefinitionSerializer(item as RubricBasedEvaluatorDefinition); + case "endpoint": + return endpointBasedEvaluatorDefinitionSerializer(item as EndpointBasedEvaluatorDefinition); + default: return evaluatorDefinitionSerializer(item); } @@ -8318,6 +8467,9 @@ export function evaluatorDefinitionUnionDeserializer(item: any): EvaluatorDefini case "rubric": return rubricBasedEvaluatorDefinitionDeserializer(item as RubricBasedEvaluatorDefinition); + case "endpoint": + return endpointBasedEvaluatorDefinitionDeserializer(item as EndpointBasedEvaluatorDefinition); + default: return evaluatorDefinitionDeserializer(item); } @@ -8325,12 +8477,7 @@ export function evaluatorDefinitionUnionDeserializer(item: any): EvaluatorDefini /** The type of evaluator definition */ export type EvaluatorDefinitionType = - | "prompt" - | "code" - | "prompt_and_code" - | "service" - | "openai_graders" - | "rubric"; + "prompt" | "code" | "prompt_and_code" | "service" | "openai_graders" | "rubric" | "endpoint"; export function evaluatorMetricRecordSerializer( item: Record, @@ -8572,6 +8719,47 @@ export function dimensionDeserializer(item: any): Dimension { }; } +/** Endpoint-based evaluator definition. The customer owns and hosts an HTTP endpoint that implements the evaluation contract. The evaluator references a Project Connection by name; the connection stores the endpoint URL and credentials (API Key or Entra ID). At execution time, the service resolves the connection to obtain the endpoint URL and authentication details, then calls the endpoint for each evaluation row. */ +export interface EndpointBasedEvaluatorDefinition extends EvaluatorDefinition { + type: "endpoint"; + /** Name of the Project Connection that stores the endpoint URL and credentials. The connection must exist on the project and have a non-empty target URL. Supported auth types: ApiKey (sends `api-key` header) and AAD/Entra ID (acquires a bearer token via the project's Managed Identity). */ + connection_name: string; +} + +export function endpointBasedEvaluatorDefinitionSerializer( + item: EndpointBasedEvaluatorDefinition, +): any { + return { + type: item["type"], + init_parameters: item["init_parameters"], + data_schema: item["data_schema"], + metrics: !item["metrics"] ? item["metrics"] : evaluatorMetricRecordSerializer(item["metrics"]), + connection_name: item["connection_name"], + }; +} + +export function endpointBasedEvaluatorDefinitionDeserializer( + item: any, +): EndpointBasedEvaluatorDefinition { + return { + type: item["type"], + init_parameters: !item["init_parameters"] + ? item["init_parameters"] + : Object.fromEntries( + Object.entries(item["init_parameters"]).map(([k, p]: [string, any]) => [k, p]), + ), + data_schema: !item["data_schema"] + ? item["data_schema"] + : Object.fromEntries( + Object.entries(item["data_schema"]).map(([k, p]: [string, any]) => [k, p]), + ), + metrics: !item["metrics"] + ? item["metrics"] + : evaluatorMetricRecordDeserializer(item["metrics"]), + connection_name: item["connection_name"], + }; +} + /** Service-managed provenance artifacts produced by an evaluator generation job. Present only on EvaluatorVersion resources created via the generation pipeline. The combined-JSONL Foundry Dataset is read-only and resolves to a versioned dataset in a service-reserved namespace. */ export interface EvaluatorGenerationArtifacts { /** Reference to the single Foundry Dataset (one combined JSONL file, version-aligned to `EvaluatorVersion.version`) holding all artifacts produced by the generation pipeline. Each row in the JSONL carries a `kind` field discriminating its content (e.g. `spec`, `tools`, `context`). */ @@ -8931,6 +9119,9 @@ export function datasetEvaluatorGenerationJobSourceDeserializer( }; } +/** Extensible status values shared by Foundry jobs. */ +export type JobStatus = "queued" | "in_progress" | "succeeded" | "failed" | "cancelled"; + /** Token consumption summary for an evaluator generation job. Populated when the job reaches a terminal state. */ export interface EvaluatorGenerationTokenUsage { /** Number of input (prompt) tokens consumed. */ @@ -9108,9 +9299,7 @@ export function insightRequestUnionDeserializer(item: any): InsightRequestUnion /** The request of the insights. */ export type InsightType = - | "EvaluationRunClusterInsight" - | "AgentClusterInsight" - | "EvaluationComparison"; + "EvaluationRunClusterInsight" | "AgentClusterInsight" | "EvaluationComparison"; /** Insights on set of Evaluation Results */ export interface EvaluationRunClusterInsightRequest extends InsightRequest { @@ -9385,11 +9574,7 @@ export function evalRunResultCompareItemDeserializer(item: any): EvalRunResultCo /** Treatment Effect Type. */ export type TreatmentEffectType = - | "TooFewSamples" - | "Inconclusive" - | "Changed" - | "Improved" - | "Degraded"; + "TooFewSamples" | "Inconclusive" | "Changed" | "Improved" | "Degraded"; /** Insights from the evaluation run cluster analysis. */ export interface EvaluationRunClusterInsightResult extends InsightResult { @@ -9947,10 +10132,7 @@ export function memoryItemDeserializer(item: any): MemoryItem { /** Alias for MemoryItemUnion */ export type MemoryItemUnion = - | UserProfileMemoryItem - | ChatSummaryMemoryItem - | ProceduralMemoryItem - | MemoryItem; + UserProfileMemoryItem | ChatSummaryMemoryItem | ProceduralMemoryItem | MemoryItem; export function memoryItemUnionDeserializer(item: any): MemoryItemUnion { switch (item["kind"]) { @@ -10102,11 +10284,7 @@ export function memoryStoreUpdateResponseDeserializer(item: any): MemoryStoreUpd /** Status of a memory store update operation. */ export type MemoryStoreUpdateStatus = - | "queued" - | "in_progress" - | "completed" - | "failed" - | "superseded"; + "queued" | "in_progress" | "completed" | "failed" | "superseded"; /** Memory update result. */ export interface MemoryStoreUpdateCompletedResult { @@ -10246,8 +10424,6 @@ export function modelVersionArrayDeserializer(result: Array): any[ /** Model Version Definition */ export interface ModelVersion { - /** System related metadata */ - readonly systemData?: SystemDataV3; /** URI of the model artifact in blob storage */ blobUri: string; /** The weight type of the model */ @@ -10288,9 +10464,6 @@ export function modelVersionSerializer(item: ModelVersion): any { export function modelVersionDeserializer(item: any): ModelVersion { return { - systemData: !item["systemData"] - ? item["systemData"] - : systemDataV3Deserializer(item["systemData"]), blobUri: item["blobUri"], weightType: item["weightType"], baseModel: item["baseModel"], @@ -10314,29 +10487,6 @@ export function modelVersionDeserializer(item: any): ModelVersion { }; } -/** System metadata for a resource */ -export interface SystemDataV3 { - /** Timestamp of resource creation */ - createdAt?: Date; - /** Identity that created the resource */ - createdBy?: string; - /** Type of identity that created the resource */ - createdByType?: string; - /** Timestamp of last resource modification */ - lastModifiedAt?: Date; -} - -export function systemDataV3Deserializer(item: any): SystemDataV3 { - return { - createdAt: !item["createdAt"] ? item["createdAt"] : new Date(item["createdAt"] * 1000), - createdBy: item["createdBy"], - createdByType: item["createdByType"], - lastModifiedAt: !item["lastModifiedAt"] - ? item["lastModifiedAt"] - : new Date(item["lastModifiedAt"] * 1000), - }; -} - /** The weight type of the model. */ export type FoundryModelWeightType = "FullWeight" | "LoRA" | "DraftModel"; @@ -10423,11 +10573,7 @@ export function artifactProfileDeserializer(item: any): ArtifactProfile { export type FoundryModelArtifactProfileCategory = "DataOnly" | "RuntimeDependent" | "Unknown"; /** Signals detected in the model artifact. */ export type FoundryModelArtifactProfileSignal = - | "PickleDeserialization" - | "CustomPythonCode" - | "DynamicOps" - | "NativeBinary" - | "UnknownFormat"; + "PickleDeserialization" | "CustomPythonCode" | "DynamicOps" | "NativeBinary" | "UnknownFormat"; export function foundryModelWarningArrayDeserializer(result: Array): any[] { return result.map((item) => { @@ -10846,13 +10992,13 @@ export interface TimerRoutineTrigger extends RoutineTrigger { } export function timerRoutineTriggerSerializer(item: TimerRoutineTrigger): any { - return { type: item["type"], at: !item["at"] ? item["at"] : item["at"].toISOString() }; + return { type: item["type"], at: !item["at"] ? item["at"] : (item["at"].getTime() / 1000) | 0 }; } export function timerRoutineTriggerDeserializer(item: any): TimerRoutineTrigger { return { type: item["type"], - at: !item["at"] ? item["at"] : new Date(item["at"]), + at: !item["at"] ? item["at"] : new Date(item["at"] * 1000), }; } @@ -10944,9 +11090,7 @@ export function routineActionDeserializer(item: any): RoutineAction { /** Alias for RoutineActionUnion */ export type RoutineActionUnion = - | InvokeAgentResponsesApiRoutineAction - | InvokeAgentInvocationsApiRoutineAction - | RoutineAction; + InvokeAgentResponsesApiRoutineAction | InvokeAgentInvocationsApiRoutineAction | RoutineAction; export function routineActionUnionSerializer(item: RoutineActionUnion): any { switch (item.type) { @@ -11152,13 +11296,15 @@ export interface RoutineRun { /** The unique run identifier for the routine attempt. */ readonly id: string; /** The run status. */ - status?: string; + status?: RoutineRunStatus; /** The AgentExtensions lifecycle phase for the routine attempt. */ phase?: RoutineRunPhase; /** The trigger type that produced the routine attempt. */ trigger_type?: RoutineTriggerType; /** The configured trigger name that produced the routine attempt. */ trigger_name?: string; + /** The event payload captured from the event that triggered the routine attempt, when available. */ + trigger_event_payload?: Record; /** The source path that created the routine attempt. */ attempt_source?: RoutineAttemptSource; /** The action type dispatched for the routine attempt. */ @@ -11198,10 +11344,15 @@ export interface RoutineRun { export function routineRunDeserializer(item: any): RoutineRun { return { id: item["id"], - status: item["status"], + status: !item["status"] ? item["status"] : routineRunStatusDeserializer(item["status"]), phase: item["phase"], trigger_type: item["trigger_type"], trigger_name: item["trigger_name"], + trigger_event_payload: !item["trigger_event_payload"] + ? item["trigger_event_payload"] + : Object.fromEntries( + Object.entries(item["trigger_event_payload"]).map(([k, p]: [string, any]) => [k, p]), + ), attempt_source: item["attempt_source"], action_type: item["action_type"], agent_id: item["agent_id"], @@ -11226,15 +11377,18 @@ export function routineRunDeserializer(item: any): RoutineRun { }; } +/** The status of a routine run. */ +export type RoutineRunStatus = string; + +export function routineRunStatusDeserializer(item: any): RoutineRunStatus { + return item; +} + /** Known lifecycle phases recorded for a routine run. */ export type RoutineRunPhase = "queued" | "dispatching" | "completed" | "failed"; /** Known source paths that can produce a routine run. */ export type RoutineAttemptSource = - | "event_fire" - | "manual_dispatch" - | "queued_dispatch" - | "schedule_delivery" - | "timer_delivery"; + "event_fire" | "manual_dispatch" | "queued_dispatch" | "schedule_delivery" | "timer_delivery"; /** Base model for a manual dispatch payload. */ export interface RoutineDispatchPayload { @@ -11272,8 +11426,7 @@ export function routineDispatchPayloadUnionSerializer(item: RoutineDispatchPaylo /** The discriminator values supported for manual routine dispatch payloads. */ export type RoutineDispatchPayloadType = - | "invoke_agent_responses_api" - | "invoke_agent_invocations_api"; + "invoke_agent_responses_api" | "invoke_agent_invocations_api"; /** A manual payload used to test a responses API routine dispatch. */ export interface InvokeAgentResponsesApiDispatchPayload extends RoutineDispatchPayload { @@ -11382,11 +11535,7 @@ export function scheduleDeserializer(item: any): Schedule { /** Schedule provisioning status. */ export type ScheduleProvisioningStatus = - | "Creating" - | "Updating" - | "Deleting" - | "Succeeded" - | "Failed"; + "Creating" | "Updating" | "Deleting" | "Succeeded" | "Failed"; /** Base model for Trigger of the schedule. */ export interface Trigger { @@ -11649,13 +11798,7 @@ export function weeklyRecurrenceScheduleDeserializer(item: any): WeeklyRecurrenc /** Days of the week for recurrence schedule. */ export type DayOfWeek = - | "Sunday" - | "Monday" - | "Tuesday" - | "Wednesday" - | "Thursday" - | "Friday" - | "Saturday"; + "Sunday" | "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday" | "Saturday"; /** Monthly recurrence schedule. */ export interface MonthlyRecurrenceSchedule extends RecurrenceSchedule { @@ -11863,1113 +12006,1396 @@ export interface ScheduleRun { readonly properties: Record; } -export function scheduleRunDeserializer(item: any): ScheduleRun { +export function scheduleRunDeserializer(item: any): ScheduleRun { + return { + runId: item["id"], + scheduleId: item["scheduleId"], + success: item["success"], + triggerTime: item["triggerTime"], + error: item["error"], + properties: Object.fromEntries( + Object.entries(item["properties"]).map(([k, p]: [string, any]) => [k, p]), + ), + }; +} + +/** Paged collection of ScheduleRun items */ +export interface _PagedScheduleRun { + /** The ScheduleRun items on this page */ + value: ScheduleRun[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _pagedScheduleRunDeserializer(item: any): _PagedScheduleRun { + return { + value: scheduleRunArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function scheduleRunArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return scheduleRunDeserializer(item); + }); +} + +/** A skill resource. */ +export interface Skill { + /** The unique identifier of the skill. */ + id: string; + /** The unique name of the skill. */ + name: string; + /** A human-readable description of the skill. */ + description: string; + /** The Unix timestamp (seconds) when the skill was created. */ + created_at: Date; + /** The default version for the skill. Can be changed via updateSkill. */ + default_version: string; + /** The latest version for the skill. */ + latest_version: string; +} + +export function skillDeserializer(item: any): Skill { + return { + id: item["id"], + name: item["name"], + description: item["description"], + created_at: new Date(item["created_at"] * 1000), + default_version: item["default_version"], + latest_version: item["latest_version"], + }; +} + +/** The response data for a requested list of items. */ +export interface _AgentsPagedResultSkill { + /** The requested list of items. */ + data: Skill[]; + /** The first ID represented in this list. */ + first_id?: string; + /** The last ID represented in this list. */ + last_id?: string; + /** A value indicating whether there are additional values available not captured in this list. */ + has_more: boolean; +} + +export function _agentsPagedResultSkillDeserializer(item: any): _AgentsPagedResultSkill { + return { + data: skillArrayDeserializer(item["data"]), + first_id: item["first_id"], + last_id: item["last_id"], + has_more: item["has_more"], + }; +} + +export function skillArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return skillDeserializer(item); + }); +} + +/** A deleted skill. */ +export interface DeleteSkillResponse { + /** The unique identifier of the deleted skill. */ + id: string; + /** The unique name of the skill. */ + name: string; + /** Whether the skill was successfully deleted. */ + deleted: boolean; +} + +export function deleteSkillResponseDeserializer(item: any): DeleteSkillResponse { + return { + id: item["id"], + name: item["name"], + deleted: item["deleted"], + }; +} + +/** Inline content for defining a simple skill without uploading files. Follows the agentskills.io SKILL.md specification. */ +export interface SkillInlineContent { + /** A human-readable description of what the skill does and when to use it. */ + description: string; + /** The skill instructions in markdown format. This is the body content of the SKILL.md file. */ + instructions: string; + /** License name or reference to a bundled license file. */ + license?: string; + /** Environment requirements or compatibility notes for the skill. */ + compatibility?: string; + /** Arbitrary key-value metadata for additional properties. */ + metadata?: Record; + /** List of pre-approved tools the skill may use. Experimental. */ + allowed_tools?: string[]; +} + +export function skillInlineContentSerializer(item: SkillInlineContent): any { + return { + description: item["description"], + instructions: item["instructions"], + license: item["license"], + compatibility: item["compatibility"], + metadata: item["metadata"], + allowed_tools: !item["allowed_tools"] + ? item["allowed_tools"] + : item["allowed_tools"].map((p: any) => { + return p; + }), + }; +} + +/** A specific version of a skill. */ +export interface SkillVersion { + /** The unique identifier of the skill version. */ + id: string; + /** The identifier of the parent skill. */ + skill_id: string; + /** The name of the skill version. */ + name: string; + /** The version identifier. Skill versions are immutable. */ + version: string; + /** A human-readable description of the skill version. */ + description: string; + /** The Unix timestamp (seconds) when the skill version was created. */ + created_at: Date; +} + +export function skillVersionDeserializer(item: any): SkillVersion { + return { + id: item["id"], + skill_id: item["skill_id"], + name: item["name"], + version: item["version"], + description: item["description"], + created_at: new Date(item["created_at"] * 1000), + }; +} + +/** Multipart request body for creating a skill version from files. Accepts either a single zip file or multiple individual skill files (directory upload). For zip uploads, the server extracts and validates contents. For directory uploads, files are validated as-is. */ +export interface CreateSkillVersionFromFilesBody { + /** Skill files to upload. Upload a single zip file or multiple individual files with relative paths. */ + files: Array; + /** Whether to set this version as the default. Defaults to false. */ + default?: boolean; +} + +export function createSkillVersionFromFilesBodySerializer( + item: CreateSkillVersionFromFilesBody, +): any { + return [ + ...item["files"].map((x: unknown) => createFilePartDescriptor("files", x)), + ...(item["default"] === undefined ? [] : [{ name: "default", body: item["default"] }]), + ]; +} + +/** The response data for a requested list of items. */ +export interface _AgentsPagedResultSkillVersion { + /** The requested list of items. */ + data: SkillVersion[]; + /** The first ID represented in this list. */ + first_id?: string; + /** The last ID represented in this list. */ + last_id?: string; + /** A value indicating whether there are additional values available not captured in this list. */ + has_more: boolean; +} + +export function _agentsPagedResultSkillVersionDeserializer( + item: any, +): _AgentsPagedResultSkillVersion { + return { + data: skillVersionArrayDeserializer(item["data"]), + first_id: item["first_id"], + last_id: item["last_id"], + has_more: item["has_more"], + }; +} + +export function skillVersionArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return skillVersionDeserializer(item); + }); +} + +/** A deleted skill version. */ +export interface DeleteSkillVersionResponse { + /** The unique identifier of the deleted skill version. */ + id: string; + /** The name of the skill. */ + name: string; + /** Whether the skill version was successfully deleted. */ + deleted: boolean; + /** The version that was deleted. */ + version: string; +} + +export function deleteSkillVersionResponseDeserializer(item: any): DeleteSkillVersionResponse { + return { + id: item["id"], + name: item["name"], + deleted: item["deleted"], + version: item["version"], + }; +} + +/** Data Generation Job resource. */ +export interface DataGenerationJob { + /** Server-assigned unique identifier. */ + readonly id: string; + /** Caller-supplied inputs. */ + inputs?: DataGenerationJobInputs; + /** Result produced on success. */ + readonly result?: DataGenerationJobResult; + /** Current lifecycle status. */ + readonly status: JobStatus; + /** Error details — populated only on failure. */ + readonly error?: ApiError; + /** The timestamp when the job was created, represented in Unix time (seconds since January 1, 1970). */ + readonly created_at: Date; + /** The timestamp when the job was finished, represented in Unix time (seconds since January 1, 1970). */ + readonly finished_at?: Date; +} + +export function dataGenerationJobSerializer(item: DataGenerationJob): any { + return { + inputs: !item["inputs"] ? item["inputs"] : dataGenerationJobInputsSerializer(item["inputs"]), + }; +} + +export function dataGenerationJobDeserializer(item: any): DataGenerationJob { return { - runId: item["id"], - scheduleId: item["scheduleId"], - success: item["success"], - triggerTime: item["triggerTime"], - error: item["error"], - properties: Object.fromEntries( - Object.entries(item["properties"]).map(([k, p]: [string, any]) => [k, p]), - ), + id: item["id"], + inputs: !item["inputs"] ? item["inputs"] : dataGenerationJobInputsDeserializer(item["inputs"]), + result: !item["result"] ? item["result"] : dataGenerationJobResultDeserializer(item["result"]), + status: item["status"], + error: !item["error"] ? item["error"] : apiErrorDeserializer(item["error"]), + created_at: new Date(item["created_at"] * 1000), + finished_at: !item["finished_at"] ? item["finished_at"] : new Date(item["finished_at"] * 1000), }; } -/** Paged collection of ScheduleRun items */ -export interface _PagedScheduleRun { - /** The ScheduleRun items on this page */ - value: ScheduleRun[]; - /** The link to the next page of items */ - nextLink?: string; +/** Caller-supplied inputs for a data generation job. */ +export interface DataGenerationJobInputs { + /** The display name of the data generation job. */ + name: string; + /** The sources used for the data generation job. */ + sources: DataGenerationJobSourceUnion[]; + /** The options for the data generation job. */ + options: DataGenerationJobOptionsUnion; + /** The scenario of the data generation job. Either for fine-tuning or evaluation. */ + scenario: DataGenerationJobScenario; + /** Optional caller-supplied metadata for the job's output. See individual fields for whether they apply to file outputs (fine-tuning scenarios), dataset outputs (evaluation scenario), or both. */ + output_options?: DataGenerationJobOutputOptions; } -export function _pagedScheduleRunDeserializer(item: any): _PagedScheduleRun { +export function dataGenerationJobInputsSerializer(item: DataGenerationJobInputs): any { return { - value: scheduleRunArrayDeserializer(item["value"]), - nextLink: item["nextLink"], + name: item["name"], + sources: dataGenerationJobSourceUnionArraySerializer(item["sources"]), + options: dataGenerationJobOptionsUnionSerializer(item["options"]), + scenario: item["scenario"], + output_options: !item["output_options"] + ? item["output_options"] + : dataGenerationJobOutputOptionsSerializer(item["output_options"]), }; } -export function scheduleRunArrayDeserializer(result: Array): any[] { - return result.map((item) => { - return scheduleRunDeserializer(item); - }); +export function dataGenerationJobInputsDeserializer(item: any): DataGenerationJobInputs { + return { + name: item["name"], + sources: dataGenerationJobSourceUnionArrayDeserializer(item["sources"]), + options: dataGenerationJobOptionsUnionDeserializer(item["options"]), + scenario: item["scenario"], + output_options: !item["output_options"] + ? item["output_options"] + : dataGenerationJobOutputOptionsDeserializer(item["output_options"]), + }; } -export function toolboxSkillUnionArraySerializer(result: Array): any[] { +export function dataGenerationJobSourceUnionArraySerializer( + result: Array, +): any[] { return result.map((item) => { - return toolboxSkillUnionSerializer(item); + return dataGenerationJobSourceUnionSerializer(item); }); } -export function toolboxSkillUnionArrayDeserializer(result: Array): any[] { +export function dataGenerationJobSourceUnionArrayDeserializer( + result: Array, +): any[] { return result.map((item) => { - return toolboxSkillUnionDeserializer(item); + return dataGenerationJobSourceUnionDeserializer(item); }); } -/** A skill source included in a toolbox. */ -export interface ToolboxSkill { - /** The type of skill source. */ - /** The discriminator possible values: skill_reference */ - type: string; +/** The base source model for data generation jobs. */ +export interface DataGenerationJobSource { + /** The type of source. */ + /** The discriminator possible values: prompt, agent, traces, file */ + type: DataGenerationJobSourceType; + /** Optional description of what this source represents — helps the pipeline interpret its content (e.g., 'Company refund policy document' or 'Describes the agent's core capabilities'). */ + description?: string; } -export function toolboxSkillSerializer(item: ToolboxSkill): any { - return { type: item["type"] }; +export function dataGenerationJobSourceSerializer(item: DataGenerationJobSource): any { + return { type: item["type"], description: item["description"] }; } -export function toolboxSkillDeserializer(item: any): ToolboxSkill { +export function dataGenerationJobSourceDeserializer(item: any): DataGenerationJobSource { return { type: item["type"], + description: item["description"], }; } -/** Alias for ToolboxSkillUnion */ -export type ToolboxSkillUnion = ToolboxSkillReference | ToolboxSkill; +/** Alias for DataGenerationJobSourceUnion */ +export type DataGenerationJobSourceUnion = + | PromptDataGenerationJobSource + | AgentDataGenerationJobSource + | TracesDataGenerationJobSource + | FileDataGenerationJobSource + | DataGenerationJobSource; -export function toolboxSkillUnionSerializer(item: ToolboxSkillUnion): any { +export function dataGenerationJobSourceUnionSerializer(item: DataGenerationJobSourceUnion): any { switch (item.type) { - case "skill_reference": - return toolboxSkillReferenceSerializer(item as ToolboxSkillReference); + case "prompt": + return promptDataGenerationJobSourceSerializer(item as PromptDataGenerationJobSource); - default: - return toolboxSkillSerializer(item); - } -} + case "agent": + return agentDataGenerationJobSourceSerializer(item as AgentDataGenerationJobSource); -export function toolboxSkillUnionDeserializer(item: any): ToolboxSkillUnion { - switch (item["type"]) { - case "skill_reference": - return toolboxSkillReferenceDeserializer(item as ToolboxSkillReference); + case "traces": + return tracesDataGenerationJobSourceSerializer(item as TracesDataGenerationJobSource); + + case "file": + return fileDataGenerationJobSourceSerializer(item as FileDataGenerationJobSource); default: - return toolboxSkillDeserializer(item); + return dataGenerationJobSourceSerializer(item); } } -/** A reference to an existing skill to include in a toolbox. */ -export interface ToolboxSkillReference extends ToolboxSkill { - /** The type of skill source. */ - type: "skill_reference"; - /** The name of the skill. */ - name: string; - /** The version of the skill. If not specified, the skill's default version is used. When a version is specified, the reference is pinned to that immutable version. */ - version?: string; -} - -export function toolboxSkillReferenceSerializer(item: ToolboxSkillReference): any { - return { type: item["type"], name: item["name"], version: item["version"] }; -} - -export function toolboxSkillReferenceDeserializer(item: any): ToolboxSkillReference { - return { - type: item["type"], - name: item["name"], - version: item["version"], - }; -} - -/** Policy configuration for a toolbox, including content safety and other governance settings. */ -export interface ToolboxPolicies { - /** Responsible AI content filtering configuration. */ - rai_config?: RaiConfig; -} - -export function toolboxPoliciesSerializer(item: ToolboxPolicies): any { - return { - rai_config: !item["rai_config"] ? item["rai_config"] : raiConfigSerializer(item["rai_config"]), - }; -} - -export function toolboxPoliciesDeserializer(item: any): ToolboxPolicies { - return { - rai_config: !item["rai_config"] - ? item["rai_config"] - : raiConfigDeserializer(item["rai_config"]), - }; -} - -/** A specific version of a toolbox. */ -export interface ToolboxVersionObject { - /** - * Set of 16 key-value pairs that can be attached to an object. This can be - * useful for storing additional information about the object in a structured - * format, and querying for objects via API or the dashboard. - * - * Keys are strings with a maximum length of 64 characters. Values are strings - * with a maximum length of 512 characters. - */ - metadata: Record | null; - /** The unique identifier of the toolbox version. */ - id: string; - /** The name of the toolbox. */ - name: string; - /** The version identifier of the toolbox. Toolbox versions are immutable and every update creates a new version. */ - version: string; - /** A human-readable description of the toolbox. */ - description?: string; - /** The Unix timestamp (seconds) when the toolbox version was created. */ - created_at: Date; - /** The list of tools contained in this toolbox version. */ - tools: ToolUnion[]; - /** The list of skill sources included in this toolbox version. */ - skills?: ToolboxSkillUnion[]; - /** Policy configuration for the toolbox version. */ - policies?: ToolboxPolicies; -} - -export function toolboxVersionObjectDeserializer(item: any): ToolboxVersionObject { - return { - metadata: !item["metadata"] - ? item["metadata"] - : Object.fromEntries( - Object.entries(item["metadata"]).map(([k1, p1]: [string, any]) => [k1, p1]), - ), - id: item["id"], - name: item["name"], - version: item["version"], - description: item["description"], - created_at: new Date(item["created_at"] * 1000), - tools: toolUnionArrayDeserializer(item["tools"]), - skills: !item["skills"] ? item["skills"] : toolboxSkillUnionArrayDeserializer(item["skills"]), - policies: !item["policies"] ? item["policies"] : toolboxPoliciesDeserializer(item["policies"]), - }; -} +export function dataGenerationJobSourceUnionDeserializer(item: any): DataGenerationJobSourceUnion { + switch (item["type"]) { + case "prompt": + return promptDataGenerationJobSourceDeserializer(item as PromptDataGenerationJobSource); -/** A toolbox that stores reusable tool definitions for agents. */ -export interface ToolboxObject { - /** The unique identifier of the toolbox. */ - id: string; - /** The name of the toolbox. */ - name: string; - /** The version identifier that the toolbox currently points to. Defaults to the latest version. Can be changed via updateToolbox. */ - default_version: string; -} + case "agent": + return agentDataGenerationJobSourceDeserializer(item as AgentDataGenerationJobSource); -export function toolboxObjectDeserializer(item: any): ToolboxObject { - return { - id: item["id"], - name: item["name"], - default_version: item["default_version"], - }; -} + case "traces": + return tracesDataGenerationJobSourceDeserializer(item as TracesDataGenerationJobSource); -/** The response data for a requested list of items. */ -export interface _AgentsPagedResultToolboxObject { - /** The requested list of items. */ - data: ToolboxObject[]; - /** The first ID represented in this list. */ - first_id?: string; - /** The last ID represented in this list. */ - last_id?: string; - /** A value indicating whether there are additional values available not captured in this list. */ - has_more: boolean; -} + case "file": + return fileDataGenerationJobSourceDeserializer(item as FileDataGenerationJobSource); -export function _agentsPagedResultToolboxObjectDeserializer( - item: any, -): _AgentsPagedResultToolboxObject { - return { - data: toolboxObjectArrayDeserializer(item["data"]), - first_id: item["first_id"], - last_id: item["last_id"], - has_more: item["has_more"], - }; + default: + return dataGenerationJobSourceDeserializer(item); + } } -export function toolboxObjectArrayDeserializer(result: Array): any[] { - return result.map((item) => { - return toolboxObjectDeserializer(item); - }); +/** The supported source types for data generation jobs. */ +export type DataGenerationJobSourceType = "prompt" | "agent" | "traces" | "file"; + +/** Prompt source for data generation jobs — inline text provided by the user. */ +export interface PromptDataGenerationJobSource extends DataGenerationJobSource { + /** Optional description of what this source represents — helps the pipeline interpret its content (e.g., 'Company refund policy document' or 'Describes the agent's core capabilities'). */ + description?: string; + /** The source type for this source, which is Prompt. */ + type: "prompt"; + /** Inline prompt text (e.g., agent description, policy text, supplementary context). */ + prompt: string; } -/** The response data for a requested list of items. */ -export interface _AgentsPagedResultToolboxVersionObject { - /** The requested list of items. */ - data: ToolboxVersionObject[]; - /** The first ID represented in this list. */ - first_id?: string; - /** The last ID represented in this list. */ - last_id?: string; - /** A value indicating whether there are additional values available not captured in this list. */ - has_more: boolean; +export function promptDataGenerationJobSourceSerializer(item: PromptDataGenerationJobSource): any { + return { type: item["type"], description: item["description"], prompt: item["prompt"] }; } -export function _agentsPagedResultToolboxVersionObjectDeserializer( +export function promptDataGenerationJobSourceDeserializer( item: any, -): _AgentsPagedResultToolboxVersionObject { +): PromptDataGenerationJobSource { return { - data: toolboxVersionObjectArrayDeserializer(item["data"]), - first_id: item["first_id"], - last_id: item["last_id"], - has_more: item["has_more"], + type: item["type"], + description: item["description"], + prompt: item["prompt"], }; } -export function toolboxVersionObjectArrayDeserializer(result: Array): any[] { - return result.map((item) => { - return toolboxVersionObjectDeserializer(item); - }); +/** Agent source for data generation jobs — references an agent to fetch instructions and metadata from. */ +export interface AgentDataGenerationJobSource extends DataGenerationJobSource { + /** Optional description of what this source represents — helps the pipeline interpret its content (e.g., 'Company refund policy document' or 'Describes the agent's core capabilities'). */ + description?: string; + /** The source type for this source, which is Agent. */ + type: "agent"; + /** The agent name to fetch instructions from. */ + agent_name: string; + /** The agent version. If not specified, the latest version is used. */ + agent_version?: string; } -/** A skill resource. */ -export interface Skill { - /** The unique identifier of the skill. */ - id: string; - /** The unique name of the skill. */ - name: string; - /** A human-readable description of the skill. */ - description: string; - /** The Unix timestamp (seconds) when the skill was created. */ - created_at: Date; - /** The default version for the skill. Can be changed via updateSkill. */ - default_version: string; - /** The latest version for the skill. */ - latest_version: string; +export function agentDataGenerationJobSourceSerializer(item: AgentDataGenerationJobSource): any { + return { + type: item["type"], + description: item["description"], + agent_name: item["agent_name"], + agent_version: item["agent_version"], + }; } -export function skillDeserializer(item: any): Skill { +export function agentDataGenerationJobSourceDeserializer(item: any): AgentDataGenerationJobSource { return { - id: item["id"], - name: item["name"], + type: item["type"], description: item["description"], - created_at: new Date(item["created_at"] * 1000), - default_version: item["default_version"], - latest_version: item["latest_version"], + agent_name: item["agent_name"], + agent_version: item["agent_version"], }; } -/** The response data for a requested list of items. */ -export interface _AgentsPagedResultSkill { - /** The requested list of items. */ - data: Skill[]; - /** The first ID represented in this list. */ - first_id?: string; - /** The last ID represented in this list. */ - last_id?: string; - /** A value indicating whether there are additional values available not captured in this list. */ - has_more: boolean; +/** Traces source for data generation jobs — conversation traces from Application Insights. */ +export interface TracesDataGenerationJobSource extends DataGenerationJobSource { + /** Optional description of what this source represents — helps the pipeline interpret its content (e.g., 'Company refund policy document' or 'Describes the agent's core capabilities'). */ + description?: string; + /** The source type for this source, which is Traces. */ + type: "traces"; + /** The unique agent ID used to filter traces. Provide either `agent_id` or `agent_name` — at least one is required. */ + agent_id?: string; + /** The agent name to fetch traces for. Provide either `agent_id` or `agent_name` — at least one is required. */ + agent_name?: string; + /** The agent version. If not specified, traces for ALL versions of the agent are included within the time window. */ + agent_version?: string; + /** Start of the time window (Unix timestamp in seconds) for fetching traces. */ + start_time: Date; + /** End of the time window (Unix timestamp in seconds). Defaults to current time. */ + end_time?: Date; } -export function _agentsPagedResultSkillDeserializer(item: any): _AgentsPagedResultSkill { +export function tracesDataGenerationJobSourceSerializer(item: TracesDataGenerationJobSource): any { return { - data: skillArrayDeserializer(item["data"]), - first_id: item["first_id"], - last_id: item["last_id"], - has_more: item["has_more"], + type: item["type"], + description: item["description"], + agent_id: item["agent_id"], + agent_name: item["agent_name"], + agent_version: item["agent_version"], + start_time: (item["start_time"].getTime() / 1000) | 0, + end_time: !item["end_time"] ? item["end_time"] : (item["end_time"].getTime() / 1000) | 0, }; } -export function skillArrayDeserializer(result: Array): any[] { - return result.map((item) => { - return skillDeserializer(item); - }); +export function tracesDataGenerationJobSourceDeserializer( + item: any, +): TracesDataGenerationJobSource { + return { + type: item["type"], + description: item["description"], + agent_id: item["agent_id"], + agent_name: item["agent_name"], + agent_version: item["agent_version"], + start_time: new Date(item["start_time"] * 1000), + end_time: !item["end_time"] ? item["end_time"] : new Date(item["end_time"] * 1000), + }; } -/** A deleted skill. */ -export interface DeleteSkillResponse { - /** The unique identifier of the deleted skill. */ +/** File source for data generation jobs — Azure OpenAI file input. */ +export interface FileDataGenerationJobSource extends DataGenerationJobSource { + /** The source type for this job, which is File. */ + type: "file"; + /** Input Azure Open AI file id used for data generation. */ id: string; - /** The unique name of the skill. */ - name: string; - /** Whether the skill was successfully deleted. */ - deleted: boolean; } -export function deleteSkillResponseDeserializer(item: any): DeleteSkillResponse { +export function fileDataGenerationJobSourceSerializer(item: FileDataGenerationJobSource): any { + return { type: item["type"], description: item["description"], id: item["id"] }; +} + +export function fileDataGenerationJobSourceDeserializer(item: any): FileDataGenerationJobSource { return { + type: item["type"], + description: item["description"], id: item["id"], - name: item["name"], - deleted: item["deleted"], }; } -/** Inline content for defining a simple skill without uploading files. Follows the agentskills.io SKILL.md specification. */ -export interface SkillInlineContent { - /** A human-readable description of what the skill does and when to use it. */ - description: string; - /** The skill instructions in markdown format. This is the body content of the SKILL.md file. */ - instructions: string; - /** License name or reference to a bundled license file. */ - license?: string; - /** Environment requirements or compatibility notes for the skill. */ - compatibility?: string; - /** Arbitrary key-value metadata for additional properties. */ - metadata?: Record; - /** List of pre-approved tools the skill may use. Experimental. */ - allowed_tools?: string[]; +/** Options for managing data generation jobs. */ +export interface DataGenerationJobOptions { + /** The data generation job type. */ + /** The discriminator possible values: simple_qna, traces, tool_use */ + type: DataGenerationJobType; + /** Maximum number of samples to generate. */ + max_samples: number; + /** The proportion of the generated data to be used for training when the data is used for fine-tuning. The rest will be used for validation. Value should be between 0 and 1. */ + train_split?: number; + /** The LLM model options. */ + model_options?: DataGenerationModelOptions; } -export function skillInlineContentSerializer(item: SkillInlineContent): any { +export function dataGenerationJobOptionsSerializer(item: DataGenerationJobOptions): any { return { - description: item["description"], - instructions: item["instructions"], - license: item["license"], - compatibility: item["compatibility"], - metadata: item["metadata"], - allowed_tools: !item["allowed_tools"] - ? item["allowed_tools"] - : item["allowed_tools"].map((p: any) => { - return p; - }), + type: item["type"], + max_samples: item["max_samples"], + train_split: item["train_split"], + model_options: !item["model_options"] + ? item["model_options"] + : dataGenerationModelOptionsSerializer(item["model_options"]), + }; +} + +export function dataGenerationJobOptionsDeserializer(item: any): DataGenerationJobOptions { + return { + type: item["type"], + max_samples: item["max_samples"], + train_split: item["train_split"], + model_options: !item["model_options"] + ? item["model_options"] + : dataGenerationModelOptionsDeserializer(item["model_options"]), }; } -/** A specific version of a skill. */ -export interface SkillVersion { - /** The unique identifier of the skill version. */ - id: string; - /** The identifier of the parent skill. */ - skill_id: string; - /** The name of the skill version. */ - name: string; - /** The version identifier. Skill versions are immutable. */ - version: string; - /** A human-readable description of the skill version. */ - description: string; - /** The Unix timestamp (seconds) when the skill version was created. */ - created_at: Date; +/** Alias for DataGenerationJobOptionsUnion */ +export type DataGenerationJobOptionsUnion = + | SimpleQnADataGenerationJobOptions + | TracesDataGenerationJobOptions + | ToolUseFineTuningDataGenerationJobOptions + | DataGenerationJobOptions; + +export function dataGenerationJobOptionsUnionSerializer(item: DataGenerationJobOptionsUnion): any { + switch (item.type) { + case "simple_qna": + return simpleQnADataGenerationJobOptionsSerializer(item as SimpleQnADataGenerationJobOptions); + + case "traces": + return tracesDataGenerationJobOptionsSerializer(item as TracesDataGenerationJobOptions); + + case "tool_use": + return toolUseFineTuningDataGenerationJobOptionsSerializer( + item as ToolUseFineTuningDataGenerationJobOptions, + ); + + default: + return dataGenerationJobOptionsSerializer(item); + } +} + +export function dataGenerationJobOptionsUnionDeserializer( + item: any, +): DataGenerationJobOptionsUnion { + switch (item["type"]) { + case "simple_qna": + return simpleQnADataGenerationJobOptionsDeserializer( + item as SimpleQnADataGenerationJobOptions, + ); + + case "traces": + return tracesDataGenerationJobOptionsDeserializer(item as TracesDataGenerationJobOptions); + + case "tool_use": + return toolUseFineTuningDataGenerationJobOptionsDeserializer( + item as ToolUseFineTuningDataGenerationJobOptions, + ); + + default: + return dataGenerationJobOptionsDeserializer(item); + } +} + +/** The supported data generation job types. */ +export type DataGenerationJobType = "simple_qna" | "traces" | "tool_use"; + +/** LLM model options for data generation jobs. */ +export interface DataGenerationModelOptions { + /** Base model name used to generate data. */ + model: string; } -export function skillVersionDeserializer(item: any): SkillVersion { +export function dataGenerationModelOptionsSerializer(item: DataGenerationModelOptions): any { + return { model: item["model"] }; +} + +export function dataGenerationModelOptionsDeserializer(item: any): DataGenerationModelOptions { return { - id: item["id"], - skill_id: item["skill_id"], - name: item["name"], - version: item["version"], - description: item["description"], - created_at: new Date(item["created_at"] * 1000), + model: item["model"], }; } -/** Multipart request body for creating a skill version from files. Accepts either a single zip file or multiple individual skill files (directory upload). For zip uploads, the server extracts and validates contents. For directory uploads, files are validated as-is. */ -export interface CreateSkillVersionFromFilesBody { - /** Skill files to upload. Upload a single zip file or multiple individual files with relative paths. */ - files: Array; - /** Whether to set this version as the default. Defaults to false. */ - default?: boolean; +/** The options for a data generation job with SimpleQnA type. */ +export interface SimpleQnADataGenerationJobOptions extends DataGenerationJobOptions { + /** The data generation job type, which is SimpleQnA for this model. */ + type: "simple_qna"; + /** The question types to generate. Used only for fine-tuning scenarios. */ + question_types?: SimpleQnAFineTuningQuestionType[]; } -export function createSkillVersionFromFilesBodySerializer( - item: CreateSkillVersionFromFilesBody, +export function simpleQnADataGenerationJobOptionsSerializer( + item: SimpleQnADataGenerationJobOptions, ): any { - return [ - ...item["files"].map((x: unknown) => createFilePartDescriptor("files", x)), - ...(item["default"] === undefined ? [] : [{ name: "default", body: item["default"] }]), - ]; -} - -/** The response data for a requested list of items. */ -export interface _AgentsPagedResultSkillVersion { - /** The requested list of items. */ - data: SkillVersion[]; - /** The first ID represented in this list. */ - first_id?: string; - /** The last ID represented in this list. */ - last_id?: string; - /** A value indicating whether there are additional values available not captured in this list. */ - has_more: boolean; + return { + type: item["type"], + max_samples: item["max_samples"], + train_split: item["train_split"], + model_options: !item["model_options"] + ? item["model_options"] + : dataGenerationModelOptionsSerializer(item["model_options"]), + question_types: !item["question_types"] + ? item["question_types"] + : item["question_types"].map((p: any) => { + return p; + }), + }; } -export function _agentsPagedResultSkillVersionDeserializer( +export function simpleQnADataGenerationJobOptionsDeserializer( item: any, -): _AgentsPagedResultSkillVersion { +): SimpleQnADataGenerationJobOptions { return { - data: skillVersionArrayDeserializer(item["data"]), - first_id: item["first_id"], - last_id: item["last_id"], - has_more: item["has_more"], + type: item["type"], + max_samples: item["max_samples"], + train_split: item["train_split"], + model_options: !item["model_options"] + ? item["model_options"] + : dataGenerationModelOptionsDeserializer(item["model_options"]), + question_types: !item["question_types"] + ? item["question_types"] + : item["question_types"].map((p: any) => { + return p; + }), }; } -export function skillVersionArrayDeserializer(result: Array): any[] { - return result.map((item) => { - return skillVersionDeserializer(item); - }); +/** The supported question types for SimpleQnA data generation jobs used for fine-tuning scenarios. */ +export type SimpleQnAFineTuningQuestionType = "short_answer" | "long_answer"; + +/** The options for a data generation job with Traces type. */ +export interface TracesDataGenerationJobOptions extends DataGenerationJobOptions { + /** The data generation job type, which is Traces for this model. */ + type: "traces"; } -/** A deleted skill version. */ -export interface DeleteSkillVersionResponse { - /** The unique identifier of the deleted skill version. */ - id: string; - /** The name of the skill. */ - name: string; - /** Whether the skill version was successfully deleted. */ - deleted: boolean; - /** The version that was deleted. */ - version: string; +export function tracesDataGenerationJobOptionsSerializer( + item: TracesDataGenerationJobOptions, +): any { + return { + type: item["type"], + max_samples: item["max_samples"], + train_split: item["train_split"], + model_options: !item["model_options"] + ? item["model_options"] + : dataGenerationModelOptionsSerializer(item["model_options"]), + }; } -export function deleteSkillVersionResponseDeserializer(item: any): DeleteSkillVersionResponse { +export function tracesDataGenerationJobOptionsDeserializer( + item: any, +): TracesDataGenerationJobOptions { return { - id: item["id"], - name: item["name"], - deleted: item["deleted"], - version: item["version"], + type: item["type"], + max_samples: item["max_samples"], + train_split: item["train_split"], + model_options: !item["model_options"] + ? item["model_options"] + : dataGenerationModelOptionsDeserializer(item["model_options"]), }; } -/** Data Generation Job resource. */ -export interface DataGenerationJob { - /** Server-assigned unique identifier. */ - readonly id: string; - /** Caller-supplied inputs. */ - inputs?: DataGenerationJobInputs; - /** Result produced on success. */ - readonly result?: DataGenerationJobResult; - /** Current lifecycle status. */ - readonly status: JobStatus; - /** Error details — populated only on failure. */ - readonly error?: ApiError; - /** The timestamp when the job was created, represented in Unix time (seconds since January 1, 1970). */ - readonly created_at: Date; - /** The timestamp when the job was finished, represented in Unix time (seconds since January 1, 1970). */ - readonly finished_at?: Date; +/** The options for a data generation job with ToolUse type. Used only for fine-tuning scenarios. */ +export interface ToolUseFineTuningDataGenerationJobOptions extends DataGenerationJobOptions { + /** The data generation job type, which is ToolUse for this model. */ + type: "tool_use"; } -export function dataGenerationJobSerializer(item: DataGenerationJob): any { +export function toolUseFineTuningDataGenerationJobOptionsSerializer( + item: ToolUseFineTuningDataGenerationJobOptions, +): any { return { - inputs: !item["inputs"] ? item["inputs"] : dataGenerationJobInputsSerializer(item["inputs"]), + type: item["type"], + max_samples: item["max_samples"], + train_split: item["train_split"], + model_options: !item["model_options"] + ? item["model_options"] + : dataGenerationModelOptionsSerializer(item["model_options"]), }; } -export function dataGenerationJobDeserializer(item: any): DataGenerationJob { +export function toolUseFineTuningDataGenerationJobOptionsDeserializer( + item: any, +): ToolUseFineTuningDataGenerationJobOptions { return { - id: item["id"], - inputs: !item["inputs"] ? item["inputs"] : dataGenerationJobInputsDeserializer(item["inputs"]), - result: !item["result"] ? item["result"] : dataGenerationJobResultDeserializer(item["result"]), - status: item["status"], - error: !item["error"] ? item["error"] : apiErrorDeserializer(item["error"]), - created_at: new Date(item["created_at"] * 1000), - finished_at: !item["finished_at"] ? item["finished_at"] : new Date(item["finished_at"] * 1000), + type: item["type"], + max_samples: item["max_samples"], + train_split: item["train_split"], + model_options: !item["model_options"] + ? item["model_options"] + : dataGenerationModelOptionsDeserializer(item["model_options"]), }; } -/** Caller-supplied inputs for a data generation job. */ -export interface DataGenerationJobInputs { - /** The display name of the data generation job. */ - name: string; - /** The sources used for the data generation job. */ - sources: DataGenerationJobSourceUnion[]; - /** The options for the data generation job. */ - options: DataGenerationJobOptionsUnion; - /** The scenario of the data generation job. Either for fine-tuning or evaluation. */ - scenario: DataGenerationJobScenario; - /** Optional caller-supplied metadata for the job's output. See individual fields for whether they apply to file outputs (fine-tuning scenarios), dataset outputs (evaluation scenario), or both. */ - output_options?: DataGenerationJobOutputOptions; +/** The supported scenarios for a data generation job. */ +export type DataGenerationJobScenario = + "supervised_finetuning" | "reinforcement_finetuning" | "evaluation"; + +/** Output options for data generation job. */ +export interface DataGenerationJobOutputOptions { + /** Name to assign to the output. Used as the filename for Azure OpenAI file outputs (fine-tuning scenarios) and as the dataset name for dataset outputs (evaluation scenario). */ + name?: string; + /** Description to assign to the output. Applies only to dataset outputs (evaluation scenario); ignored for Azure OpenAI file outputs. */ + description?: string; + /** Tags to assign to the output. Applies only to dataset outputs (evaluation scenario); ignored for Azure OpenAI file outputs. */ + tags?: Record; } -export function dataGenerationJobInputsSerializer(item: DataGenerationJobInputs): any { - return { - name: item["name"], - sources: dataGenerationJobSourceUnionArraySerializer(item["sources"]), - options: dataGenerationJobOptionsUnionSerializer(item["options"]), - scenario: item["scenario"], - output_options: !item["output_options"] - ? item["output_options"] - : dataGenerationJobOutputOptionsSerializer(item["output_options"]), - }; +export function dataGenerationJobOutputOptionsSerializer( + item: DataGenerationJobOutputOptions, +): any { + return { name: item["name"], description: item["description"], tags: item["tags"] }; } -export function dataGenerationJobInputsDeserializer(item: any): DataGenerationJobInputs { +export function dataGenerationJobOutputOptionsDeserializer( + item: any, +): DataGenerationJobOutputOptions { return { name: item["name"], - sources: dataGenerationJobSourceUnionArrayDeserializer(item["sources"]), - options: dataGenerationJobOptionsUnionDeserializer(item["options"]), - scenario: item["scenario"], - output_options: !item["output_options"] - ? item["output_options"] - : dataGenerationJobOutputOptionsDeserializer(item["output_options"]), + description: item["description"], + tags: !item["tags"] + ? item["tags"] + : Object.fromEntries(Object.entries(item["tags"]).map(([k, p]: [string, any]) => [k, p])), }; } -export function dataGenerationJobSourceUnionArraySerializer( - result: Array, -): any[] { - return result.map((item) => { - return dataGenerationJobSourceUnionSerializer(item); - }); +/** Result produced by a successful data generation job. */ +export interface DataGenerationJobResult { + /** The final job outputs: Azure OpenAI files for fine-tuning, or datasets for evaluation. */ + outputs?: DataGenerationJobOutputUnion[]; + /** The number of samples actually generated. */ + generated_samples: number; + /** The token usage information for the data generation job. */ + token_usage?: DataGenerationTokenUsage; +} + +export function dataGenerationJobResultDeserializer(item: any): DataGenerationJobResult { + return { + outputs: !item["outputs"] + ? item["outputs"] + : dataGenerationJobOutputUnionArrayDeserializer(item["outputs"]), + generated_samples: item["generated_samples"], + token_usage: !item["token_usage"] + ? item["token_usage"] + : dataGenerationTokenUsageDeserializer(item["token_usage"]), + }; } -export function dataGenerationJobSourceUnionArrayDeserializer( - result: Array, +export function dataGenerationJobOutputUnionArrayDeserializer( + result: Array, ): any[] { return result.map((item) => { - return dataGenerationJobSourceUnionDeserializer(item); + return dataGenerationJobOutputUnionDeserializer(item); }); } -/** The base source model for data generation jobs. */ -export interface DataGenerationJobSource { - /** The type of source. */ - /** The discriminator possible values: prompt, agent, traces, file */ - type: DataGenerationJobSourceType; - /** Optional description of what this source represents — helps the pipeline interpret its content (e.g., 'Company refund policy document' or 'Describes the agent's core capabilities'). */ - description?: string; -} - -export function dataGenerationJobSourceSerializer(item: DataGenerationJobSource): any { - return { type: item["type"], description: item["description"] }; +/** Output information for a data generation job. */ +export interface DataGenerationJobOutput { + /** The type of the output. */ + /** The discriminator possible values: file, dataset */ + type: DataGenerationJobOutputType; } -export function dataGenerationJobSourceDeserializer(item: any): DataGenerationJobSource { +export function dataGenerationJobOutputDeserializer(item: any): DataGenerationJobOutput { return { type: item["type"], - description: item["description"], }; } -/** Alias for DataGenerationJobSourceUnion */ -export type DataGenerationJobSourceUnion = - | PromptDataGenerationJobSource - | AgentDataGenerationJobSource - | TracesDataGenerationJobSource - | FileDataGenerationJobSource - | DataGenerationJobSource; - -export function dataGenerationJobSourceUnionSerializer(item: DataGenerationJobSourceUnion): any { - switch (item.type) { - case "prompt": - return promptDataGenerationJobSourceSerializer(item as PromptDataGenerationJobSource); - - case "agent": - return agentDataGenerationJobSourceSerializer(item as AgentDataGenerationJobSource); - - case "traces": - return tracesDataGenerationJobSourceSerializer(item as TracesDataGenerationJobSource); +/** Alias for DataGenerationJobOutputUnion */ +export type DataGenerationJobOutputUnion = + FileDataGenerationJobOutput | DatasetDataGenerationJobOutput | DataGenerationJobOutput; +export function dataGenerationJobOutputUnionDeserializer(item: any): DataGenerationJobOutputUnion { + switch (item["type"]) { case "file": - return fileDataGenerationJobSourceSerializer(item as FileDataGenerationJobSource); + return fileDataGenerationJobOutputDeserializer(item as FileDataGenerationJobOutput); + + case "dataset": + return datasetDataGenerationJobOutputDeserializer(item as DatasetDataGenerationJobOutput); default: - return dataGenerationJobSourceSerializer(item); + return dataGenerationJobOutputDeserializer(item); } } -export function dataGenerationJobSourceUnionDeserializer(item: any): DataGenerationJobSourceUnion { - switch (item["type"]) { - case "prompt": - return promptDataGenerationJobSourceDeserializer(item as PromptDataGenerationJobSource); - - case "agent": - return agentDataGenerationJobSourceDeserializer(item as AgentDataGenerationJobSource); - - case "traces": - return tracesDataGenerationJobSourceDeserializer(item as TracesDataGenerationJobSource); - - case "file": - return fileDataGenerationJobSourceDeserializer(item as FileDataGenerationJobSource); +/** The supported output file types for a data generation job. */ +export type DataGenerationJobOutputType = "file" | "dataset"; - default: - return dataGenerationJobSourceDeserializer(item); - } +/** Azure OpenAI file output for a data generation job. */ +export interface FileDataGenerationJobOutput extends DataGenerationJobOutput { + /** Azure OpenAI file output. */ + type: "file"; + /** The id of the output Azure OpenAI file. */ + readonly id: string; + /** The filename of the output Azure OpenAI file. */ + readonly filename: string; } -/** The supported source types for data generation jobs. */ -export type DataGenerationJobSourceType = "prompt" | "agent" | "traces" | "file"; - -/** Prompt source for data generation jobs — inline text provided by the user. */ -export interface PromptDataGenerationJobSource extends DataGenerationJobSource { - /** Optional description of what this source represents — helps the pipeline interpret its content (e.g., 'Company refund policy document' or 'Describes the agent's core capabilities'). */ - description?: string; - /** The source type for this source, which is Prompt. */ - type: "prompt"; - /** Inline prompt text (e.g., agent description, policy text, supplementary context). */ - prompt: string; +export function fileDataGenerationJobOutputDeserializer(item: any): FileDataGenerationJobOutput { + return { + type: item["type"], + id: item["id"], + filename: item["filename"], + }; } -export function promptDataGenerationJobSourceSerializer(item: PromptDataGenerationJobSource): any { - return { type: item["type"], description: item["description"], prompt: item["prompt"] }; +/** Dataset output for a data generation job. */ +export interface DatasetDataGenerationJobOutput extends DataGenerationJobOutput { + /** Dataset output. */ + type: "dataset"; + /** The id of the output dataset created. */ + readonly id?: string; + /** The name of the output dataset. */ + readonly name?: string; + /** The version of the output dataset. */ + readonly version?: string; + /** Description of the output dataset. */ + readonly description?: string; + /** Tag dictionary of the output dataset. */ + readonly tags?: Record; } -export function promptDataGenerationJobSourceDeserializer( +export function datasetDataGenerationJobOutputDeserializer( item: any, -): PromptDataGenerationJobSource { +): DatasetDataGenerationJobOutput { return { type: item["type"], + id: item["id"], + name: item["name"], + version: item["version"], description: item["description"], - prompt: item["prompt"], + tags: !item["tags"] + ? item["tags"] + : Object.fromEntries(Object.entries(item["tags"]).map(([k, p]: [string, any]) => [k, p])), }; } -/** Agent source for data generation jobs — references an agent to fetch instructions and metadata from. */ -export interface AgentDataGenerationJobSource extends DataGenerationJobSource { - /** Optional description of what this source represents — helps the pipeline interpret its content (e.g., 'Company refund policy document' or 'Describes the agent's core capabilities'). */ - description?: string; - /** The source type for this source, which is Agent. */ - type: "agent"; - /** The agent name to fetch instructions from. */ - agent_name: string; - /** The agent version. If not specified, the latest version is used. */ - agent_version?: string; +/** Token usage information for a data generation job. */ +export interface DataGenerationTokenUsage { + /** The number of prompt tokens used. */ + readonly prompt_tokens: number; + /** The number of completion tokens generated. */ + readonly completion_tokens: number; + /** Total number of tokens used. */ + readonly total_tokens: number; } -export function agentDataGenerationJobSourceSerializer(item: AgentDataGenerationJobSource): any { +export function dataGenerationTokenUsageDeserializer(item: any): DataGenerationTokenUsage { return { - type: item["type"], - description: item["description"], - agent_name: item["agent_name"], - agent_version: item["agent_version"], + prompt_tokens: item["prompt_tokens"], + completion_tokens: item["completion_tokens"], + total_tokens: item["total_tokens"], }; } -export function agentDataGenerationJobSourceDeserializer(item: any): AgentDataGenerationJobSource { +/** The response data for a requested list of items. */ +export interface _AgentsPagedResultDataGenerationJob { + /** The requested list of items. */ + data: DataGenerationJob[]; + /** The first ID represented in this list. */ + first_id?: string; + /** The last ID represented in this list. */ + last_id?: string; + /** A value indicating whether there are additional values available not captured in this list. */ + has_more: boolean; +} + +export function _agentsPagedResultDataGenerationJobDeserializer( + item: any, +): _AgentsPagedResultDataGenerationJob { return { - type: item["type"], - description: item["description"], - agent_name: item["agent_name"], - agent_version: item["agent_version"], + data: dataGenerationJobArrayDeserializer(item["data"]), + first_id: item["first_id"], + last_id: item["last_id"], + has_more: item["has_more"], }; } -/** Traces source for data generation jobs — conversation traces from Application Insights. */ -export interface TracesDataGenerationJobSource extends DataGenerationJobSource { - /** Optional description of what this source represents — helps the pipeline interpret its content (e.g., 'Company refund policy document' or 'Describes the agent's core capabilities'). */ - description?: string; - /** The source type for this source, which is Traces. */ - type: "traces"; - /** The unique agent ID used to filter traces. Provide either `agent_id` or `agent_name` — at least one is required. */ - agent_id?: string; - /** The agent name to fetch traces for. Provide either `agent_id` or `agent_name` — at least one is required. */ - agent_name?: string; - /** The agent version. If not specified, traces for ALL versions of the agent are included within the time window. */ - agent_version?: string; - /** Start of the time window (Unix timestamp in seconds) for fetching traces. */ - start_time: Date; - /** End of the time window (Unix timestamp in seconds). Defaults to current time. */ - end_time?: Date; +export function dataGenerationJobArraySerializer(result: Array): any[] { + return result.map((item) => { + return dataGenerationJobSerializer(item); + }); +} + +export function dataGenerationJobArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return dataGenerationJobDeserializer(item); + }); +} + +/** Agent optimization job resource — a long-running job that optimizes an agent's configuration (instructions, model, skills, tools) to maximize evaluation scores. On success, the result contains scored candidates. */ +export interface OptimizationJob { + /** Server-assigned unique identifier. */ + readonly id: string; + /** Caller-supplied inputs. */ + inputs?: OptimizationJobInputs; + /** Result produced on success. */ + readonly result?: OptimizationJobResult; + /** Current lifecycle status. */ + readonly status: JobStatus; + /** Error details — populated only on failure. */ + readonly error?: ApiError; + /** The timestamp when the job was created, represented in Unix time. */ + readonly created_at: Date; + /** The timestamp when the job was last updated, represented in Unix time. */ + readonly updated_at: Date; + /** Progress snapshot. May be present in terminal states reflecting last-known progress. */ + readonly progress?: OptimizationJobProgress; + /** Non-fatal warnings emitted at any point during optimization. */ + readonly warnings?: string[]; +} + +export function optimizationJobSerializer(item: OptimizationJob): any { + return { + inputs: !item["inputs"] ? item["inputs"] : optimizationJobInputsSerializer(item["inputs"]), + }; +} + +export function optimizationJobDeserializer(item: any): OptimizationJob { + return { + id: item["id"], + inputs: !item["inputs"] ? item["inputs"] : optimizationJobInputsDeserializer(item["inputs"]), + result: !item["result"] ? item["result"] : optimizationJobResultDeserializer(item["result"]), + status: item["status"], + error: !item["error"] ? item["error"] : apiErrorDeserializer(item["error"]), + created_at: new Date(item["created_at"] * 1000), + updated_at: new Date(item["updated_at"] * 1000), + progress: !item["progress"] + ? item["progress"] + : optimizationJobProgressDeserializer(item["progress"]), + warnings: !item["warnings"] + ? item["warnings"] + : item["warnings"].map((p: any) => { + return p; + }), + }; } -export function tracesDataGenerationJobSourceSerializer(item: TracesDataGenerationJobSource): any { +/** Caller-supplied inputs for an optimization job. */ +export interface OptimizationJobInputs { + /** The agent (and pinned version) being optimized. */ + agent: OptimizationAgentIdentifier; + /** Training dataset — either inline items or a reference to a registered dataset. Required. */ + train_dataset: OptimizationDatasetInputUnion; + /** Optional held-out validation dataset for measuring generalization of the final candidate. */ + validation_dataset?: OptimizationDatasetInputUnion; + /** Job-level evaluators referenced by name and optional version. Required; at least one must be provided. */ + evaluators: OptimizationEvaluatorRef[]; + /** Tuning knobs and run-mode. */ + options?: OptimizationOptions; +} + +export function optimizationJobInputsSerializer(item: OptimizationJobInputs): any { return { - type: item["type"], - description: item["description"], - agent_id: item["agent_id"], - agent_name: item["agent_name"], - agent_version: item["agent_version"], - start_time: (item["start_time"].getTime() / 1000) | 0, - end_time: !item["end_time"] ? item["end_time"] : (item["end_time"].getTime() / 1000) | 0, + agent: optimizationAgentIdentifierSerializer(item["agent"]), + train_dataset: optimizationDatasetInputUnionSerializer(item["train_dataset"]), + validation_dataset: !item["validation_dataset"] + ? item["validation_dataset"] + : optimizationDatasetInputUnionSerializer(item["validation_dataset"]), + evaluators: optimizationEvaluatorRefArraySerializer(item["evaluators"]), + options: !item["options"] ? item["options"] : optimizationOptionsSerializer(item["options"]), }; } -export function tracesDataGenerationJobSourceDeserializer( - item: any, -): TracesDataGenerationJobSource { +export function optimizationJobInputsDeserializer(item: any): OptimizationJobInputs { return { - type: item["type"], - description: item["description"], - agent_id: item["agent_id"], - agent_name: item["agent_name"], - agent_version: item["agent_version"], - start_time: new Date(item["start_time"] * 1000), - end_time: !item["end_time"] ? item["end_time"] : new Date(item["end_time"] * 1000), + agent: optimizationAgentIdentifierDeserializer(item["agent"]), + train_dataset: optimizationDatasetInputUnionDeserializer(item["train_dataset"]), + validation_dataset: !item["validation_dataset"] + ? item["validation_dataset"] + : optimizationDatasetInputUnionDeserializer(item["validation_dataset"]), + evaluators: optimizationEvaluatorRefArrayDeserializer(item["evaluators"]), + options: !item["options"] ? item["options"] : optimizationOptionsDeserializer(item["options"]), }; } -/** File source for data generation jobs — Azure OpenAI file input. */ -export interface FileDataGenerationJobSource extends DataGenerationJobSource { - /** The source type for this job, which is File. */ - type: "file"; - /** Input Azure Open AI file id used for data generation. */ - id: string; +/** Identifies the registered Foundry agent to optimize (request-only). Skills, tools, and system_prompt are specified in options.optimization_config. */ +export interface OptimizationAgentIdentifier { + /** Registered Foundry agent name (required). */ + agent_name: string; + /** Pinned agent version. Defaults to latest if omitted. */ + agent_version?: string; } -export function fileDataGenerationJobSourceSerializer(item: FileDataGenerationJobSource): any { - return { type: item["type"], description: item["description"], id: item["id"] }; +export function optimizationAgentIdentifierSerializer(item: OptimizationAgentIdentifier): any { + return { agent_name: item["agent_name"], agent_version: item["agent_version"] }; } -export function fileDataGenerationJobSourceDeserializer(item: any): FileDataGenerationJobSource { +export function optimizationAgentIdentifierDeserializer(item: any): OptimizationAgentIdentifier { return { - type: item["type"], - description: item["description"], - id: item["id"], + agent_name: item["agent_name"], + agent_version: item["agent_version"], }; } -/** Options for managing data generation jobs. */ -export interface DataGenerationJobOptions { - /** The data generation job type. */ - /** The discriminator possible values: simple_qna, traces, tool_use */ - type: DataGenerationJobType; - /** Maximum number of samples to generate. */ - max_samples: number; - /** The proportion of the generated data to be used for training when the data is used for fine-tuning. The rest will be used for validation. Value should be between 0 and 1. */ - train_split?: number; - /** The LLM model options. */ - model_options?: DataGenerationModelOptions; +/** Base discriminated model for dataset input. Either inline items or a registered reference. */ +export interface OptimizationDatasetInput { + /** Dataset input type discriminator. */ + /** The discriminator possible values: inline, reference */ + type: OptimizationDatasetInputType; } -export function dataGenerationJobOptionsSerializer(item: DataGenerationJobOptions): any { - return { - type: item["type"], - max_samples: item["max_samples"], - train_split: item["train_split"], - model_options: !item["model_options"] - ? item["model_options"] - : dataGenerationModelOptionsSerializer(item["model_options"]), - }; +export function optimizationDatasetInputSerializer(item: OptimizationDatasetInput): any { + return { type: item["type"] }; } -export function dataGenerationJobOptionsDeserializer(item: any): DataGenerationJobOptions { +export function optimizationDatasetInputDeserializer(item: any): OptimizationDatasetInput { return { type: item["type"], - max_samples: item["max_samples"], - train_split: item["train_split"], - model_options: !item["model_options"] - ? item["model_options"] - : dataGenerationModelOptionsDeserializer(item["model_options"]), }; } -/** Alias for DataGenerationJobOptionsUnion */ -export type DataGenerationJobOptionsUnion = - | SimpleQnADataGenerationJobOptions - | TracesDataGenerationJobOptions - | ToolUseFineTuningDataGenerationJobOptions - | DataGenerationJobOptions; +/** Alias for OptimizationDatasetInputUnion */ +export type OptimizationDatasetInputUnion = + OptimizationInlineDatasetInput | OptimizationReferenceDatasetInput | OptimizationDatasetInput; -export function dataGenerationJobOptionsUnionSerializer(item: DataGenerationJobOptionsUnion): any { +export function optimizationDatasetInputUnionSerializer(item: OptimizationDatasetInputUnion): any { switch (item.type) { - case "simple_qna": - return simpleQnADataGenerationJobOptionsSerializer(item as SimpleQnADataGenerationJobOptions); - - case "traces": - return tracesDataGenerationJobOptionsSerializer(item as TracesDataGenerationJobOptions); + case "inline": + return optimizationInlineDatasetInputSerializer(item as OptimizationInlineDatasetInput); - case "tool_use": - return toolUseFineTuningDataGenerationJobOptionsSerializer( - item as ToolUseFineTuningDataGenerationJobOptions, - ); + case "reference": + return optimizationReferenceDatasetInputSerializer(item as OptimizationReferenceDatasetInput); default: - return dataGenerationJobOptionsSerializer(item); + return optimizationDatasetInputSerializer(item); } } -export function dataGenerationJobOptionsUnionDeserializer( +export function optimizationDatasetInputUnionDeserializer( item: any, -): DataGenerationJobOptionsUnion { +): OptimizationDatasetInputUnion { switch (item["type"]) { - case "simple_qna": - return simpleQnADataGenerationJobOptionsDeserializer( - item as SimpleQnADataGenerationJobOptions, - ); - - case "traces": - return tracesDataGenerationJobOptionsDeserializer(item as TracesDataGenerationJobOptions); + case "inline": + return optimizationInlineDatasetInputDeserializer(item as OptimizationInlineDatasetInput); - case "tool_use": - return toolUseFineTuningDataGenerationJobOptionsDeserializer( - item as ToolUseFineTuningDataGenerationJobOptions, + case "reference": + return optimizationReferenceDatasetInputDeserializer( + item as OptimizationReferenceDatasetInput, ); default: - return dataGenerationJobOptionsDeserializer(item); + return optimizationDatasetInputDeserializer(item); } } -/** The supported data generation job types. */ -export type DataGenerationJobType = "simple_qna" | "traces" | "tool_use"; +/** Discriminator values for the dataset input union. */ +export type OptimizationDatasetInputType = "inline" | "reference"; -/** LLM model options for data generation jobs. */ -export interface DataGenerationModelOptions { - /** Base model name used to generate data. */ - model: string; +/** Inline dataset — items supplied directly in the request body. */ +export interface OptimizationInlineDatasetInput extends OptimizationDatasetInput { + /** Dataset input type discriminator. */ + type: "inline"; + /** Dataset items. */ + items: OptimizationDatasetItem[]; } -export function dataGenerationModelOptionsSerializer(item: DataGenerationModelOptions): any { - return { model: item["model"] }; +export function optimizationInlineDatasetInputSerializer( + item: OptimizationInlineDatasetInput, +): any { + return { type: item["type"], items: optimizationDatasetItemArraySerializer(item["items"]) }; } -export function dataGenerationModelOptionsDeserializer(item: any): DataGenerationModelOptions { +export function optimizationInlineDatasetInputDeserializer( + item: any, +): OptimizationInlineDatasetInput { return { - model: item["model"], + type: item["type"], + items: optimizationDatasetItemArrayDeserializer(item["items"]), }; } -/** The options for a data generation job with SimpleQnA type. */ -export interface SimpleQnADataGenerationJobOptions extends DataGenerationJobOptions { - /** The data generation job type, which is SimpleQnA for this model. */ - type: "simple_qna"; - /** The question types to generate. Used only for fine-tuning scenarios. */ - question_types?: SimpleQnAFineTuningQuestionType[]; +export function optimizationDatasetItemArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return optimizationDatasetItemSerializer(item); + }); } -export function simpleQnADataGenerationJobOptionsSerializer( - item: SimpleQnADataGenerationJobOptions, -): any { +export function optimizationDatasetItemArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return optimizationDatasetItemDeserializer(item); + }); +} + +/** A single item in an inline dataset. */ +export interface OptimizationDatasetItem { + /** The user query / prompt. */ + query?: string; + /** Expected ground truth answer. */ + ground_truth?: string; + /** Desired number of conversation turns for simulation mode (1-20). */ + desired_num_turns?: number; + /** Per-item evaluation criteria. */ + criteria?: OptimizationDatasetCriterion[]; +} + +export function optimizationDatasetItemSerializer(item: OptimizationDatasetItem): any { return { - type: item["type"], - max_samples: item["max_samples"], - train_split: item["train_split"], - model_options: !item["model_options"] - ? item["model_options"] - : dataGenerationModelOptionsSerializer(item["model_options"]), - question_types: !item["question_types"] - ? item["question_types"] - : item["question_types"].map((p: any) => { - return p; - }), + query: item["query"], + ground_truth: item["ground_truth"], + desired_num_turns: item["desired_num_turns"], + criteria: !item["criteria"] + ? item["criteria"] + : optimizationDatasetCriterionArraySerializer(item["criteria"]), }; } -export function simpleQnADataGenerationJobOptionsDeserializer( - item: any, -): SimpleQnADataGenerationJobOptions { +export function optimizationDatasetItemDeserializer(item: any): OptimizationDatasetItem { return { - type: item["type"], - max_samples: item["max_samples"], - train_split: item["train_split"], - model_options: !item["model_options"] - ? item["model_options"] - : dataGenerationModelOptionsDeserializer(item["model_options"]), - question_types: !item["question_types"] - ? item["question_types"] - : item["question_types"].map((p: any) => { - return p; - }), + query: item["query"], + ground_truth: item["ground_truth"], + desired_num_turns: item["desired_num_turns"], + criteria: !item["criteria"] + ? item["criteria"] + : optimizationDatasetCriterionArrayDeserializer(item["criteria"]), }; } -/** The supported question types for SimpleQnA data generation jobs used for fine-tuning scenarios. */ -export type SimpleQnAFineTuningQuestionType = "short_answer" | "long_answer"; +export function optimizationDatasetCriterionArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return optimizationDatasetCriterionSerializer(item); + }); +} -/** The options for a data generation job with Traces type. */ -export interface TracesDataGenerationJobOptions extends DataGenerationJobOptions { - /** The data generation job type, which is Traces for this model. */ - type: "traces"; +export function optimizationDatasetCriterionArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return optimizationDatasetCriterionDeserializer(item); + }); } -export function tracesDataGenerationJobOptionsSerializer( - item: TracesDataGenerationJobOptions, -): any { - return { - type: item["type"], - max_samples: item["max_samples"], - train_split: item["train_split"], - model_options: !item["model_options"] - ? item["model_options"] - : dataGenerationModelOptionsSerializer(item["model_options"]), - }; +/** Evaluation criterion: a name + instruction pair used for per-item scoring. */ +export interface OptimizationDatasetCriterion { + /** Criterion name. */ + name: string; + /** Criterion instruction / description. */ + instruction: string; } -export function tracesDataGenerationJobOptionsDeserializer( - item: any, -): TracesDataGenerationJobOptions { +export function optimizationDatasetCriterionSerializer(item: OptimizationDatasetCriterion): any { + return { name: item["name"], instruction: item["instruction"] }; +} + +export function optimizationDatasetCriterionDeserializer(item: any): OptimizationDatasetCriterion { return { - type: item["type"], - max_samples: item["max_samples"], - train_split: item["train_split"], - model_options: !item["model_options"] - ? item["model_options"] - : dataGenerationModelOptionsDeserializer(item["model_options"]), + name: item["name"], + instruction: item["instruction"], }; } -/** The options for a data generation job with ToolUse type. Used only for fine-tuning scenarios. */ -export interface ToolUseFineTuningDataGenerationJobOptions extends DataGenerationJobOptions { - /** The data generation job type, which is ToolUse for this model. */ - type: "tool_use"; +/** Reference to a registered Foundry dataset. */ +export interface OptimizationReferenceDatasetInput extends OptimizationDatasetInput { + /** Dataset input type discriminator. */ + type: "reference"; + /** Registered dataset name. */ + name: string; + /** Dataset version. If not specified, the latest version is used. */ + version?: string; } -export function toolUseFineTuningDataGenerationJobOptionsSerializer( - item: ToolUseFineTuningDataGenerationJobOptions, +export function optimizationReferenceDatasetInputSerializer( + item: OptimizationReferenceDatasetInput, ): any { - return { - type: item["type"], - max_samples: item["max_samples"], - train_split: item["train_split"], - model_options: !item["model_options"] - ? item["model_options"] - : dataGenerationModelOptionsSerializer(item["model_options"]), - }; + return { type: item["type"], name: item["name"], version: item["version"] }; } -export function toolUseFineTuningDataGenerationJobOptionsDeserializer( +export function optimizationReferenceDatasetInputDeserializer( item: any, -): ToolUseFineTuningDataGenerationJobOptions { +): OptimizationReferenceDatasetInput { return { type: item["type"], - max_samples: item["max_samples"], - train_split: item["train_split"], - model_options: !item["model_options"] - ? item["model_options"] - : dataGenerationModelOptionsDeserializer(item["model_options"]), + name: item["name"], + version: item["version"], }; } -/** The supported scenarios for a data generation job. */ -export type DataGenerationJobScenario = - | "supervised_finetuning" - | "reinforcement_finetuning" - | "evaluation"; +export function optimizationEvaluatorRefArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return optimizationEvaluatorRefSerializer(item); + }); +} -/** Output options for data generation job. */ -export interface DataGenerationJobOutputOptions { - /** Name to assign to the output. Used as the filename for Azure OpenAI file outputs (fine-tuning scenarios) and as the dataset name for dataset outputs (evaluation scenario). */ - name?: string; - /** Description to assign to the output. Applies only to dataset outputs (evaluation scenario); ignored for Azure OpenAI file outputs. */ - description?: string; - /** Tags to assign to the output. Applies only to dataset outputs (evaluation scenario); ignored for Azure OpenAI file outputs. */ - tags?: Record; +export function optimizationEvaluatorRefArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return optimizationEvaluatorRefDeserializer(item); + }); } -export function dataGenerationJobOutputOptionsSerializer( - item: DataGenerationJobOutputOptions, -): any { - return { name: item["name"], description: item["description"], tags: item["tags"] }; +/** Reference to a named evaluator, optionally pinned to a version. */ +export interface OptimizationEvaluatorRef { + /** Evaluator name. */ + name: string; + /** Evaluator version. If not specified, the latest version is used. */ + version?: string; } -export function dataGenerationJobOutputOptionsDeserializer( - item: any, -): DataGenerationJobOutputOptions { +export function optimizationEvaluatorRefSerializer(item: OptimizationEvaluatorRef): any { + return { name: item["name"], version: item["version"] }; +} + +export function optimizationEvaluatorRefDeserializer(item: any): OptimizationEvaluatorRef { return { name: item["name"], - description: item["description"], - tags: !item["tags"] - ? item["tags"] - : Object.fromEntries(Object.entries(item["tags"]).map(([k, p]: [string, any]) => [k, p])), + version: item["version"], }; } -/** Result produced by a successful data generation job. */ -export interface DataGenerationJobResult { - /** The final job outputs: Azure OpenAI files for fine-tuning, or datasets for evaluation. */ - outputs?: DataGenerationJobOutputUnion[]; - /** The number of samples actually generated. */ - generated_samples: number; - /** The token usage information for the data generation job. */ - token_usage?: DataGenerationTokenUsage; +/** Tuning knobs and run-mode for an optimization job. */ +export interface OptimizationOptions { + /** Maximum number of optimization candidates to generate. Must be >= 1. Default: 5. */ + max_candidates?: number; + /** Per-target-attribute configuration overrides. Contains skills, tools, system_prompt for the agent, plus model space for model optimization. */ + optimization_config?: Record; + /** Model deployment used for evaluation. Defaults to server config (typically 'gpt-4o'). */ + eval_model?: string; + /** Model deployment for optimization reasoning (must be gpt-5 family). Falls back to the default eval model when not set. */ + optimization_model?: string; + /** Evaluation granularity. Null/omitted means per-item single-turn. Set to 'conversation' for per-conversation multi-turn simulation scoring. */ + evaluation_level?: EvaluationLevel; } -export function dataGenerationJobResultDeserializer(item: any): DataGenerationJobResult { +export function optimizationOptionsSerializer(item: OptimizationOptions): any { return { - outputs: !item["outputs"] - ? item["outputs"] - : dataGenerationJobOutputUnionArrayDeserializer(item["outputs"]), - generated_samples: item["generated_samples"], - token_usage: !item["token_usage"] - ? item["token_usage"] - : dataGenerationTokenUsageDeserializer(item["token_usage"]), + max_candidates: item["max_candidates"], + optimization_config: item["optimization_config"], + eval_model: item["eval_model"], + optimization_model: item["optimization_model"], + evaluation_level: item["evaluation_level"], }; } -export function dataGenerationJobOutputUnionArrayDeserializer( - result: Array, -): any[] { - return result.map((item) => { - return dataGenerationJobOutputUnionDeserializer(item); - }); +export function optimizationOptionsDeserializer(item: any): OptimizationOptions { + return { + max_candidates: item["max_candidates"], + optimization_config: !item["optimization_config"] + ? item["optimization_config"] + : Object.fromEntries( + Object.entries(item["optimization_config"]).map(([k, p]: [string, any]) => [k, p]), + ), + eval_model: item["eval_model"], + optimization_model: item["optimization_model"], + evaluation_level: item["evaluation_level"], + }; } -/** Output information for a data generation job. */ -export interface DataGenerationJobOutput { - /** The type of the output. */ - /** The discriminator possible values: file, dataset */ - type: DataGenerationJobOutputType; +/** Terminal-state result body. Populated when status is succeeded or failed. */ +export interface OptimizationJobResult { + /** Candidate ID of the original (un-optimized) baseline evaluation. */ + baseline?: string; + /** Candidate ID of the highest-scoring candidate found during optimization. */ + best?: string; + /** All evaluated candidates including baseline. */ + candidates?: OptimizationCandidate[]; } -export function dataGenerationJobOutputDeserializer(item: any): DataGenerationJobOutput { +export function optimizationJobResultDeserializer(item: any): OptimizationJobResult { return { - type: item["type"], + baseline: item["baseline"], + best: item["best"], + candidates: !item["candidates"] + ? item["candidates"] + : optimizationCandidateArrayDeserializer(item["candidates"]), }; } -/** Alias for DataGenerationJobOutputUnion */ -export type DataGenerationJobOutputUnion = - | FileDataGenerationJobOutput - | DatasetDataGenerationJobOutput - | DataGenerationJobOutput; - -export function dataGenerationJobOutputUnionDeserializer(item: any): DataGenerationJobOutputUnion { - switch (item["type"]) { - case "file": - return fileDataGenerationJobOutputDeserializer(item as FileDataGenerationJobOutput); - - case "dataset": - return datasetDataGenerationJobOutputDeserializer(item as DatasetDataGenerationJobOutput); - - default: - return dataGenerationJobOutputDeserializer(item); - } +export function optimizationCandidateArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return optimizationCandidateDeserializer(item); + }); } -/** The supported output file types for a data generation job. */ -export type DataGenerationJobOutputType = "file" | "dataset"; - -/** Azure OpenAI file output for a data generation job. */ -export interface FileDataGenerationJobOutput extends DataGenerationJobOutput { - /** Azure OpenAI file output. */ - type: "file"; - /** The id of the output Azure OpenAI file. */ - readonly id: string; - /** The filename of the output Azure OpenAI file. */ - readonly filename: string; +/** Aggregated evaluation result for a single candidate agent configuration across all tasks. */ +export interface OptimizationCandidate { + /** Server-assigned candidate identifier. Use with GET /candidates/{id} sub-endpoints. */ + candidate_id?: string; + /** Display name of the candidate (e.g., 'baseline', 'instruction-v2'). */ + name: string; + /** What was mutated from the baseline (e.g., {system_prompt: 'new prompt'}). */ + mutations?: Record; + /** Average composite score across all tasks. */ + avg_score: number; + /** Average token usage across all tasks. */ + avg_tokens: number; + /** Foundry evaluation identifier used to score this candidate. */ + eval_id?: string; + /** Foundry evaluation run identifier for this candidate's scoring run. */ + eval_run_id?: string; + /** Promotion metadata. Null if the candidate has not been promoted. */ + promotion?: PromotionInfo; } -export function fileDataGenerationJobOutputDeserializer(item: any): FileDataGenerationJobOutput { +export function optimizationCandidateDeserializer(item: any): OptimizationCandidate { return { - type: item["type"], - id: item["id"], - filename: item["filename"], + candidate_id: item["candidate_id"], + name: item["name"], + mutations: !item["mutations"] + ? item["mutations"] + : Object.fromEntries( + Object.entries(item["mutations"]).map(([k, p]: [string, any]) => [k, p]), + ), + avg_score: item["avg_score"], + avg_tokens: item["avg_tokens"], + eval_id: item["eval_id"], + eval_run_id: item["eval_run_id"], + promotion: !item["promotion"] + ? item["promotion"] + : promotionInfoDeserializer(item["promotion"]), }; } -/** Dataset output for a data generation job. */ -export interface DatasetDataGenerationJobOutput extends DataGenerationJobOutput { - /** Dataset output. */ - type: "dataset"; - /** The id of the output dataset created. */ - readonly id?: string; - /** The name of the output dataset. */ - readonly name?: string; - /** The version of the output dataset. */ - readonly version?: string; - /** Description of the output dataset. */ - readonly description?: string; - /** Tag dictionary of the output dataset. */ - readonly tags?: Record; +/** Promotion metadata recorded when a candidate is deployed to a Foundry agent. */ +export interface PromotionInfo { + /** Timestamp when promotion occurred, represented in Unix time. */ + promoted_at: Date; + /** Name of the Foundry agent this candidate was promoted to. */ + agent_name: string; + /** Version of the Foundry agent this candidate was promoted to. */ + agent_version: string; } -export function datasetDataGenerationJobOutputDeserializer( - item: any, -): DatasetDataGenerationJobOutput { +export function promotionInfoDeserializer(item: any): PromotionInfo { return { - type: item["type"], - id: item["id"], - name: item["name"], - version: item["version"], - description: item["description"], - tags: !item["tags"] - ? item["tags"] - : Object.fromEntries(Object.entries(item["tags"]).map(([k, p]: [string, any]) => [k, p])), + promoted_at: new Date(item["promoted_at"] * 1000), + agent_name: item["agent_name"], + agent_version: item["agent_version"], }; } -/** Token usage information for a data generation job. */ -export interface DataGenerationTokenUsage { - /** The number of prompt tokens used. */ - readonly prompt_tokens: number; - /** The number of completion tokens generated. */ - readonly completion_tokens: number; - /** Total number of tokens used. */ - readonly total_tokens: number; +/** In-flight progress; only populated while status is queued or in_progress. */ +export interface OptimizationJobProgress { + /** Number of candidates whose evaluation has completed so far. */ + candidates_completed: number; + /** Best score observed so far across all candidates. */ + best_score: number; + /** Wall-clock time elapsed in seconds since the job began executing. */ + elapsed_seconds: number; } -export function dataGenerationTokenUsageDeserializer(item: any): DataGenerationTokenUsage { +export function optimizationJobProgressDeserializer(item: any): OptimizationJobProgress { return { - prompt_tokens: item["prompt_tokens"], - completion_tokens: item["completion_tokens"], - total_tokens: item["total_tokens"], + candidates_completed: item["candidates_completed"], + best_score: item["best_score"], + elapsed_seconds: item["elapsed_seconds"], }; } /** The response data for a requested list of items. */ -export interface _AgentsPagedResultDataGenerationJob { +export interface _AgentsPagedResultOptimizationJobListItem { /** The requested list of items. */ - data: DataGenerationJob[]; + data: OptimizationJobListItem[]; /** The first ID represented in this list. */ first_id?: string; /** The last ID represented in this list. */ @@ -12978,27 +13404,55 @@ export interface _AgentsPagedResultDataGenerationJob { has_more: boolean; } -export function _agentsPagedResultDataGenerationJobDeserializer( +export function _agentsPagedResultOptimizationJobListItemDeserializer( item: any, -): _AgentsPagedResultDataGenerationJob { +): _AgentsPagedResultOptimizationJobListItem { return { - data: dataGenerationJobArrayDeserializer(item["data"]), + data: optimizationJobListItemArrayDeserializer(item["data"]), first_id: item["first_id"], last_id: item["last_id"], has_more: item["has_more"], }; } -export function dataGenerationJobArraySerializer(result: Array): any[] { +export function optimizationJobListItemArrayDeserializer( + result: Array, +): any[] { return result.map((item) => { - return dataGenerationJobSerializer(item); + return optimizationJobListItemDeserializer(item); }); } -export function dataGenerationJobArrayDeserializer(result: Array): any[] { - return result.map((item) => { - return dataGenerationJobDeserializer(item); - }); +/** Slim job representation returned by the LIST endpoint. */ +export interface OptimizationJobListItem { + /** Server-assigned unique identifier. */ + readonly id: string; + /** Current lifecycle status. */ + readonly status: JobStatus; + /** Error details — populated only on failure. */ + readonly error?: ApiError; + /** The timestamp when the job was created, represented in Unix time. */ + readonly created_at: Date; + /** The timestamp when the job was last updated, represented in Unix time. */ + readonly updated_at: Date; + /** Progress snapshot. May be present in terminal states reflecting last-known progress. */ + readonly progress?: OptimizationJobProgress; + /** The agent targeted by this optimization job. */ + readonly agent?: OptimizationAgentIdentifier; +} + +export function optimizationJobListItemDeserializer(item: any): OptimizationJobListItem { + return { + id: item["id"], + status: item["status"], + error: !item["error"] ? item["error"] : apiErrorDeserializer(item["error"]), + created_at: new Date(item["created_at"] * 1000), + updated_at: new Date(item["updated_at"] * 1000), + progress: !item["progress"] + ? item["progress"] + : optimizationJobProgressDeserializer(item["progress"]), + agent: !item["agent"] ? item["agent"] : optimizationAgentIdentifierDeserializer(item["agent"]), + }; } /** model interface UpdateToolboxRequest */ @@ -13022,18 +13476,10 @@ export function _listVersionsRequestTypeSerializer(item: _ListVersionsRequestTyp /** Type of AgentObjectType */ export type AgentObjectType = - | "agent" - | "agent.version" - | "agent.deleted" - | "agent.version.deleted" - | "agent.container"; + "agent" | "agent.version" | "agent.deleted" | "agent.version.deleted" | "agent.container"; /** Feature opt-in keys for agent definition operations supporting hosted or workflow agents. */ export type AgentDefinitionOptInKeys = - | "HostedAgents=V1Preview" - | "WorkflowAgents=V1Preview" - | "AgentEndpoints=V1Preview" - | "CodeAgents=V1Preview" - | "ExternalAgents=V1Preview"; + "WorkflowAgents=V1Preview" | "ExternalAgents=V1Preview" | "DraftAgents=V1Preview"; /** Type of PageOrder */ export type PageOrder = "asc" | "desc"; /** Type of FoundryFeaturesOptInKeys */ @@ -13044,11 +13490,10 @@ export type FoundryFeaturesOptInKeys = | "Insights=V1Preview" | "MemoryStores=V1Preview" | "Routines=V1Preview" - | "Toolboxes=V1Preview" | "Skills=V1Preview" | "DataGenerationJobs=V1Preview" | "Models=V1Preview" - | "AgentsOptimization=V1Preview"; + | "AgentsOptimization=V2Preview"; /** The type of pending upload. */ export type PendingUploadType = "None" | "BlobReference" | "TemporaryBlobReference"; /** Type of MemoryStoreObjectType */ @@ -13064,24 +13509,7 @@ export enum KnownVersions { v1 = "v1", } -export type DownloadVersionResponse = { - /** - * BROWSER ONLY - * - * The response body as a browser Blob. - * Always `undefined` in node.js. - */ - blobBody?: Promise; - /** - * NODEJS ONLY - * - * The response body as a node.js Readable stream. - * Always `undefined` in the browser. - */ - readableStreamBody?: NodeReadableStream; -}; - -export type BetaSkillsDownloadResponse = { +export type AgentsDownloadSessionFileResponse = { /** * BROWSER ONLY * @@ -13098,7 +13526,7 @@ export type BetaSkillsDownloadResponse = { readableStreamBody?: NodeReadableStream; }; -export type BetaAgentsGetCandidateFileResponse = { +export type AgentsDownloadAgentCodeResponse = { /** * BROWSER ONLY * @@ -13115,7 +13543,7 @@ export type BetaAgentsGetCandidateFileResponse = { readableStreamBody?: NodeReadableStream; }; -export type BetaAgentsDownloadSessionFileResponse = { +export type DownloadVersionResponse = { /** * BROWSER ONLY * @@ -13132,7 +13560,7 @@ export type BetaAgentsDownloadSessionFileResponse = { readableStreamBody?: NodeReadableStream; }; -export type BetaAgentsDownloadAgentCodeResponse = { +export type BetaSkillsDownloadResponse = { /** * BROWSER ONLY * diff --git a/sdk/ai/ai-projects/generated/restorePollerHelpers.ts b/sdk/ai/ai-projects/generated/restorePollerHelpers.ts index 75a4f25d9821..c1ed13c1f7c0 100644 --- a/sdk/ai/ai-projects/generated/restorePollerHelpers.ts +++ b/sdk/ai/ai-projects/generated/restorePollerHelpers.ts @@ -46,8 +46,7 @@ export function restorePoller( ); } const resourceLocationConfig = metadata?.["resourceLocationConfig"] as - | ResourceLocationConfig - | undefined; + ResourceLocationConfig | undefined; const { deserializer, expectedStatuses = [] } = getDeserializationHelper(initialRequestUrl, requestMethod) ?? {}; const deserializeHelper = options?.processResponseBody ?? deserializer; diff --git a/sdk/ai/ai-projects/generated/static-helpers/multipartHelpers.ts b/sdk/ai/ai-projects/generated/static-helpers/multipartHelpers.ts index 94a5d2f26325..2107d2aae839 100644 --- a/sdk/ai/ai-projects/generated/static-helpers/multipartHelpers.ts +++ b/sdk/ai/ai-projects/generated/static-helpers/multipartHelpers.ts @@ -7,11 +7,7 @@ import { NodeReadableStream } from "#platform/static-helpers/platform-types"; * Valid values for the contents of a binary file. */ export type FileContents = - | string - | NodeReadableStream - | ReadableStream - | Uint8Array - | Blob; + string | NodeReadableStream | ReadableStream | Uint8Array | Blob; export function createFilePartDescriptor( partName: string, diff --git a/sdk/ai/ai-projects/tsp-location.saved.yaml b/sdk/ai/ai-projects/tsp-location.saved.yaml index 67e0e9843970..07c3dc1d0895 100644 --- a/sdk/ai/ai-projects/tsp-location.saved.yaml +++ b/sdk/ai/ai-projects/tsp-location.saved.yaml @@ -1,5 +1,5 @@ directory: specification/ai-foundry/data-plane/Foundry/src/sdk-python-js-azure-ai-projects -commit: a2fcf49bf294ab729b3b297e48c570c2e0affb65 +commit: 16c414eadcbafafd88f5d8237729e80b95db99ae repo: Azure/azure-rest-api-specs additionalDirectories: - specification/ai-foundry/data-plane/Foundry/src/agents @@ -17,15 +17,16 @@ additionalDirectories: - specification/ai-foundry/data-plane/Foundry/src/insights - specification/ai-foundry/data-plane/Foundry/src/memory-stores - specification/ai-foundry/data-plane/Foundry/src/models - - specification/ai-foundry/data-plane/Foundry/src/openai-conversations - - specification/ai-foundry/data-plane/Foundry/src/openai-evaluations - - specification/ai-foundry/data-plane/Foundry/src/openai-responses + - specification/ai-foundry/data-plane/Foundry/src/openai + - specification/ai-foundry/data-plane/Foundry/src/openai/conversations + - specification/ai-foundry/data-plane/Foundry/src/openai/evaluations + - specification/ai-foundry/data-plane/Foundry/src/openai/responses - specification/ai-foundry/data-plane/Foundry/src/red-teams - specification/ai-foundry/data-plane/Foundry/src/routines - specification/ai-foundry/data-plane/Foundry/src/schedules - specification/ai-foundry/data-plane/Foundry/src/sdk-common - - specification/ai-foundry/data-plane/Foundry/src/servicepatterns.tsp + - specification/ai-foundry/data-plane/Foundry/src/common/servicepatterns.tsp - specification/ai-foundry/data-plane/Foundry/src/skills - specification/ai-foundry/data-plane/Foundry/src/toolboxes - specification/ai-foundry/data-plane/Foundry/src/tools - - specification/ai-foundry/data-plane/Foundry/src/error.default.tsp + - specification/ai-foundry/data-plane/Foundry/src/sdk-common/error.default.tsp From f102070a96ef0ea743e292288e7912ca2d1f7e10 Mon Sep 17 00:00:00 2001 From: Glenn Harper Date: Fri, 10 Jul 2026 12:30:35 -0400 Subject: [PATCH 2/6] [ai-projects] regen: post-emitter edits --- sdk/ai/ai-projects/review/ai-projects-node.api.md | 4 ++++ sdk/ai/ai-projects/src/api/agents/index.ts | 2 ++ sdk/ai/ai-projects/src/api/agents/operations.ts | 10 ++++++++++ sdk/ai/ai-projects/src/api/agents/options.ts | 3 +++ .../src/api/beta/evaluationTaxonomies/operations.ts | 2 +- .../ai-projects/src/api/beta/evaluators/operations.ts | 2 +- sdk/ai/ai-projects/src/api/beta/models/operations.ts | 2 +- sdk/ai/ai-projects/src/classic/agents/index.ts | 9 +++++++++ .../src/classic/beta/evaluationTaxonomies/index.ts | 2 +- .../ai-projects/src/classic/beta/evaluators/index.ts | 2 +- sdk/ai/ai-projects/src/index.ts | 1 + 11 files changed, 34 insertions(+), 5 deletions(-) diff --git a/sdk/ai/ai-projects/review/ai-projects-node.api.md b/sdk/ai/ai-projects/review/ai-projects-node.api.md index 4e622df2eeb4..ff6d99f9864a 100644 --- a/sdk/ai/ai-projects/review/ai-projects-node.api.md +++ b/sdk/ai/ai-projects/review/ai-projects-node.api.md @@ -344,6 +344,7 @@ export interface AgentsOperations { listSessionFiles: (agentName: string, sessionId: string, options?: AgentsListSessionFilesOptionalParams) => PagedAsyncIterableIterator; listSessions: (agentName: string, options?: AgentsListSessionsOptionalParams) => PagedAsyncIterableIterator; listVersions: (agentName: string, options?: AgentsListVersionsOptionalParams) => PagedAsyncIterableIterator; + patchAgentObject: (agentName: string, options?: AgentsPatchAgentObjectOptionalParams) => Promise; stopSession: (agentName: string, sessionId: string, options?: AgentsStopSessionOptionalParams) => Promise; update(agentName: string, manifestId: string, parameterValues: Record, options?: AgentsUpdateAgentFromManifestOptionalParams): Promise; update(agentName: string, definition: AgentDefinitionUnion, options?: AgentsUpdateOptionalParams): Promise; @@ -351,6 +352,9 @@ export interface AgentsOperations { uploadSessionFile: (agentName: string, sessionId: string, path: string, content: Uint8Array, options?: AgentsUploadSessionFileOptionalParams) => Promise; } +// @public +export type AgentsPatchAgentObjectOptionalParams = AgentsUpdateAgentObjectOptionalParams; + // @public export interface AgentsStopSessionOptionalParams extends OperationOptions { } diff --git a/sdk/ai/ai-projects/src/api/agents/index.ts b/sdk/ai/ai-projects/src/api/agents/index.ts index bd31c50cfda6..52e00f351845 100644 --- a/sdk/ai/ai-projects/src/api/agents/index.ts +++ b/sdk/ai/ai-projects/src/api/agents/index.ts @@ -17,6 +17,7 @@ export { downloadAgentCode, createVersionFromCode, updateAgentObject, + patchAgentObject, listVersions, deleteVersion, getVersion, @@ -46,6 +47,7 @@ export type { AgentsDownloadAgentCodeOptionalParams, AgentsCreateVersionFromCodeOptionalParams, AgentsUpdateAgentObjectOptionalParams, + AgentsPatchAgentObjectOptionalParams, AgentsListVersionsOptionalParams, AgentsDeleteVersionOptionalParams, AgentsGetVersionOptionalParams, diff --git a/sdk/ai/ai-projects/src/api/agents/operations.ts b/sdk/ai/ai-projects/src/api/agents/operations.ts index 7df4abae531a..595bc261492e 100644 --- a/sdk/ai/ai-projects/src/api/agents/operations.ts +++ b/sdk/ai/ai-projects/src/api/agents/operations.ts @@ -59,6 +59,7 @@ import type { AgentsDownloadAgentCodeOptionalParams, AgentsCreateVersionFromCodeOptionalParams, AgentsUpdateAgentObjectOptionalParams, + AgentsPatchAgentObjectOptionalParams, AgentsListVersionsOptionalParams, AgentsDeleteVersionOptionalParams, AgentsGetVersionOptionalParams, @@ -980,6 +981,15 @@ export async function updateAgentObject( return _patchAgentObjectDeserialize(result); } +/** Modifies an existing agent. */ +export async function patchAgentObject( + context: Client, + agentName: string, + options: AgentsPatchAgentObjectOptionalParams = { requestOptions: {} }, +): Promise { + return updateAgentObject(context, agentName, options); +} + export function _listVersionsSend( context: Client, agentName: string, diff --git a/sdk/ai/ai-projects/src/api/agents/options.ts b/sdk/ai/ai-projects/src/api/agents/options.ts index 38389b38e29a..e29a40080e6e 100644 --- a/sdk/ai/ai-projects/src/api/agents/options.ts +++ b/sdk/ai/ai-projects/src/api/agents/options.ts @@ -122,6 +122,9 @@ export interface AgentsUpdateAgentObjectOptionalParams extends OperationOptions agentCard?: AgentCard; } +/** Optional parameters. */ +export type AgentsPatchAgentObjectOptionalParams = AgentsUpdateAgentObjectOptionalParams; + /** Optional parameters. */ export interface AgentsListVersionsOptionalParams extends OperationOptions { /** diff --git a/sdk/ai/ai-projects/src/api/beta/evaluationTaxonomies/operations.ts b/sdk/ai/ai-projects/src/api/beta/evaluationTaxonomies/operations.ts index c3fd41baf025..0f3cf257408e 100644 --- a/sdk/ai/ai-projects/src/api/beta/evaluationTaxonomies/operations.ts +++ b/sdk/ai/ai-projects/src/api/beta/evaluationTaxonomies/operations.ts @@ -61,7 +61,7 @@ export async function _updateDeserialize( return evaluationTaxonomyDeserializer(result.body); } -/** Update an evaluation taxonomy. */ +/** Modifies the specified evaluation taxonomy with the provided changes. */ export async function update( context: Client, name: string, diff --git a/sdk/ai/ai-projects/src/api/beta/evaluators/operations.ts b/sdk/ai/ai-projects/src/api/beta/evaluators/operations.ts index 94484350a479..dd2b9157aa71 100644 --- a/sdk/ai/ai-projects/src/api/beta/evaluators/operations.ts +++ b/sdk/ai/ai-projects/src/api/beta/evaluators/operations.ts @@ -671,7 +671,7 @@ export async function _listDeserialize( return _pagedEvaluatorVersionDeserializer(result.body); } -/** Lists the latest version of each evaluator */ +/** Lists the latest version of each evaluator. */ export function list( context: Client, options: BetaEvaluatorsListOptionalParams = { requestOptions: {} }, diff --git a/sdk/ai/ai-projects/src/api/beta/models/operations.ts b/sdk/ai/ai-projects/src/api/beta/models/operations.ts index 6d2e3f622910..30627c17503e 100644 --- a/sdk/ai/ai-projects/src/api/beta/models/operations.ts +++ b/sdk/ai/ai-projects/src/api/beta/models/operations.ts @@ -248,7 +248,7 @@ export async function _updateDeserialize(result: PathUncheckedResponse): Promise return modelVersionDeserializer(result.body); } -/** Update an existing ModelVersion with the given version id */ +/** Updates an existing model version identified by its version ID. */ export async function update( context: Client, name: string, diff --git a/sdk/ai/ai-projects/src/classic/agents/index.ts b/sdk/ai/ai-projects/src/classic/agents/index.ts index 28ddbf3efd31..fe2efb661899 100644 --- a/sdk/ai/ai-projects/src/classic/agents/index.ts +++ b/sdk/ai/ai-projects/src/classic/agents/index.ts @@ -19,6 +19,7 @@ import { downloadAgentCode, createVersionFromCode, updateAgentObject, + patchAgentObject, listVersions, deleteVersion, getVersion, @@ -48,6 +49,7 @@ import type { AgentsDownloadAgentCodeOptionalParams, AgentsCreateVersionFromCodeOptionalParams, AgentsUpdateAgentObjectOptionalParams, + AgentsPatchAgentObjectOptionalParams, AgentsListVersionsOptionalParams, AgentsDeleteVersionOptionalParams, AgentsGetVersionOptionalParams, @@ -232,6 +234,11 @@ export interface AgentsOperations { agentName: string, options?: AgentsUpdateAgentObjectOptionalParams, ) => Promise; + /** Modifies an existing agent. */ + patchAgentObject: ( + agentName: string, + options?: AgentsPatchAgentObjectOptionalParams, + ) => Promise; /** Returns the list of versions of an agent. */ listVersions: ( agentName: string, @@ -375,6 +382,8 @@ function _getAgents(context: AIProjectContext, tracingConfig?: ResolvedTracingCo ) => createVersionFromCode(context, agentName, codeZipSha256, content, options), updateAgent: (agentName: string, options?: AgentsUpdateAgentObjectOptionalParams) => updateAgentObject(context, agentName, options), + patchAgentObject: (agentName: string, options?: AgentsPatchAgentObjectOptionalParams) => + patchAgentObject(context, agentName, options), listVersions: (agentName: string, options?: AgentsListVersionsOptionalParams) => listVersions(context, agentName, options), deleteVersion: ( diff --git a/sdk/ai/ai-projects/src/classic/beta/evaluationTaxonomies/index.ts b/sdk/ai/ai-projects/src/classic/beta/evaluationTaxonomies/index.ts index 002f49b3c56b..559fc80b347a 100644 --- a/sdk/ai/ai-projects/src/classic/beta/evaluationTaxonomies/index.ts +++ b/sdk/ai/ai-projects/src/classic/beta/evaluationTaxonomies/index.ts @@ -21,7 +21,7 @@ import type { PagedAsyncIterableIterator } from "@azure/core-paging"; /** Interface representing a BetaEvaluationTaxonomies operations. */ export interface BetaEvaluationTaxonomiesOperations { - /** Update an evaluation taxonomy. */ + /** Modifies the specified evaluation taxonomy with the provided changes. */ update: ( name: string, taxonomy: EvaluationTaxonomy, diff --git a/sdk/ai/ai-projects/src/classic/beta/evaluators/index.ts b/sdk/ai/ai-projects/src/classic/beta/evaluators/index.ts index 03051daae946..de1e9e4540d3 100644 --- a/sdk/ai/ai-projects/src/classic/beta/evaluators/index.ts +++ b/sdk/ai/ai-projects/src/classic/beta/evaluators/index.ts @@ -118,7 +118,7 @@ export interface BetaEvaluatorsOperations { version: string, options?: BetaEvaluatorsGetVersionOptionalParams, ) => Promise; - /** Lists the latest version of each evaluator */ + /** Lists the latest version of each evaluator. */ list: ( options?: BetaEvaluatorsListOptionalParams, ) => PagedAsyncIterableIterator; diff --git a/sdk/ai/ai-projects/src/index.ts b/sdk/ai/ai-projects/src/index.ts index dbe181e736df..e31f98f1178e 100644 --- a/sdk/ai/ai-projects/src/index.ts +++ b/sdk/ai/ai-projects/src/index.ts @@ -521,6 +521,7 @@ export type { AgentsDownloadAgentCodeOptionalParams, AgentsCreateVersionFromCodeOptionalParams, AgentsUpdateAgentObjectOptionalParams, + AgentsPatchAgentObjectOptionalParams, AgentsListVersionsOptionalParams, AgentsDeleteVersionOptionalParams, AgentsGetVersionOptionalParams, From 436d40d19349385847cd20d3e1f279b27eac58fd Mon Sep 17 00:00:00 2001 From: Glenn Harper Date: Fri, 10 Jul 2026 12:30:37 -0400 Subject: [PATCH 3/6] [ai-projects] regen: samples for new features --- .../agents/hostedAgents/createHostedAgentFromImage.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/ai/ai-projects/samples-dev/agents/hostedAgents/createHostedAgentFromImage.ts b/sdk/ai/ai-projects/samples-dev/agents/hostedAgents/createHostedAgentFromImage.ts index 64240564fefe..44edcf75e3e6 100644 --- a/sdk/ai/ai-projects/samples-dev/agents/hostedAgents/createHostedAgentFromImage.ts +++ b/sdk/ai/ai-projects/samples-dev/agents/hostedAgents/createHostedAgentFromImage.ts @@ -58,7 +58,7 @@ export async function main(): Promise { } } - // ── Route the agent endpoint to the new version ─────────────────────── + // ── Patch the agent endpoint to route to the new version ───────────── const endpointConfig: AgentEndpointConfig = { version_selector: { version_selection_rules: [ @@ -71,7 +71,7 @@ export async function main(): Promise { }, protocol_configuration: { responses: {} }, }; - await project.agents.updateAgent(agentName, { agentEndpoint: endpointConfig }); + await project.agents.patchAgentObject(agentName, { agentEndpoint: endpointConfig }); console.log(`Agent endpoint configured for version ${created.version}`); const fetched = await project.agents.getVersion(agentName, created.version); From 8806fc7b038f2baf474cb6a4cbdecfe5ac5341bc Mon Sep 17 00:00:00 2001 From: Glenn Harper Date: Fri, 10 Jul 2026 12:30:39 -0400 Subject: [PATCH 4/6] [ai-projects] regen: tests for new GA features --- .../public/agents/patchAgentObject.spec.ts | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 sdk/ai/ai-projects/test/public/agents/patchAgentObject.spec.ts diff --git a/sdk/ai/ai-projects/test/public/agents/patchAgentObject.spec.ts b/sdk/ai/ai-projects/test/public/agents/patchAgentObject.spec.ts new file mode 100644 index 000000000000..51a1ebfad883 --- /dev/null +++ b/sdk/ai/ai-projects/test/public/agents/patchAgentObject.spec.ts @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { Recorder, VitestTestContext } from "@azure-tools/test-recorder"; +import { assertEnvironmentVariable } from "@azure-tools/test-recorder"; +import { createProjectsClient, createRecorder } from "../utils/createClient.js"; +import { afterEach, assert, beforeEach, describe, it } from "vitest"; +import type { AIProjectClient } from "../../../src/index.js"; + +describe("agents - patch agent object", function () { + let recorder: Recorder; + let project: AIProjectClient; + + beforeEach(async function (context: VitestTestContext) { + recorder = await createRecorder(context); + project = createProjectsClient(recorder); + }); + + afterEach(async function () { + await recorder.stop(); + }); + + // TODO(patchAgentObject): unskip after recording added. + it.skip("patches an agent endpoint configuration", async function () { + const agentName = assertEnvironmentVariable("FOUNDRY_HOSTED_AGENT_NAME"); + const agent = await project.agents.patchAgentObject(agentName, { + agentEndpoint: { + protocol_configuration: { responses: {} }, + }, + }); + + assert.equal(agent.name, agentName); + }); +}); From f15e503f03d7c84804d3400e580cb5ed3acd6ab3 Mon Sep 17 00:00:00 2001 From: Glenn Harper Date: Fri, 10 Jul 2026 12:30:41 -0400 Subject: [PATCH 5/6] [ai-projects] regen: changelog --- sdk/ai/ai-projects/CHANGELOG.md | 6 ++++++ sdk/ai/ai-projects/package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/sdk/ai/ai-projects/CHANGELOG.md b/sdk/ai/ai-projects/CHANGELOG.md index b784098c95f9..c45383be086e 100644 --- a/sdk/ai/ai-projects/CHANGELOG.md +++ b/sdk/ai/ai-projects/CHANGELOG.md @@ -1,5 +1,11 @@ # Release History +## 2.4.0 (Unreleased) + +### Features Added + +- Added `project.agents.patchAgentObject` for merge-patching agent endpoint configuration and agent card metadata. + ## 2.3.1 (2026-07-09) ### Other Changes diff --git a/sdk/ai/ai-projects/package.json b/sdk/ai/ai-projects/package.json index 611fb923b7d9..6df6e16be66e 100644 --- a/sdk/ai/ai-projects/package.json +++ b/sdk/ai/ai-projects/package.json @@ -1,6 +1,6 @@ { "name": "@azure/ai-projects", - "version": "2.3.1", + "version": "2.4.0", "description": "Azure AI Projects client library.", "engines": { "node": ">=22.0.0" From 7ee97284c7f1490cd4dd2320ee4bd2304a2422b8 Mon Sep 17 00:00:00 2001 From: Glenn Harper Date: Fri, 10 Jul 2026 12:30:42 -0400 Subject: [PATCH 6/6] [ai-projects] regen: skills for the regeneration workflow --- .../skills/apply-post-emitter-edits/SKILL.md | 71 ++++++++++++++++--- 1 file changed, 62 insertions(+), 9 deletions(-) diff --git a/sdk/ai/ai-projects/.github/skills/apply-post-emitter-edits/SKILL.md b/sdk/ai/ai-projects/.github/skills/apply-post-emitter-edits/SKILL.md index f17fbf745fc9..ecdce5f28a52 100644 --- a/sdk/ai/ai-projects/.github/skills/apply-post-emitter-edits/SKILL.md +++ b/sdk/ai/ai-projects/.github/skills/apply-post-emitter-edits/SKILL.md @@ -1,6 +1,6 @@ --- name: apply-post-emitter-edits -description: 'Apply language-specific post-emitter fixes to ai-projects after a TypeSpec regeneration writes directly into src/ and generated/. Use when reviewing the working-tree diff from `npm run generate:client`, validating the SDK diff against upstream TypeSpec commit descriptions, enforcing protected-file rules, reverting unwanted emitter changes (renames, parameter shapes, model deletions), and preparing the package for build verification. Runs after the regenerate-from-typespec skill.' +description: "Apply language-specific post-emitter fixes to ai-projects after a TypeSpec regeneration writes directly into src/ and generated/. Use when reviewing the working-tree diff from `npm run generate:client`, validating the SDK diff against upstream TypeSpec commit descriptions, enforcing protected-file rules, reverting unwanted emitter changes (renames, parameter shapes, model deletions), and preparing the package for build verification. Runs after the regenerate-from-typespec skill." --- # Apply Post-Emitter Edits to ai-projects @@ -31,12 +31,26 @@ Run from `sdk/ai/ai-projects/`. Use this phase order to avoid mixing unrelated decisions: -| Phase | Steps | Exit point | -| --- | --- | --- | -| Cleanup | Step -1, Step 0, Step 1 | Upstream intent is known, conflict markers are gone, protected files are restored. | -| Public surface | Step 2, Step 2b, Step 3 | Genuine generated additions are copied into `src/`; existing models keep additions-only behavior unless upstream commits explicitly say otherwise. | -| Workarounds | Step 4, Step 5, Step 5b, Step 5c | Known emitter drift, style drift, renamed body parameters, and scratch files are cleaned up. | -| Verification | Step 6 | Build, API extraction, API report spot-checks, and formatting all pass. | +| Phase | Steps | Exit point | +| -------------- | -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | +| Cleanup | Step -1, Step 0, Step 1 | Upstream intent is known, conflict markers are gone, protected files are restored. | +| Public surface | Step 2, Step 2b, Step 3 | Genuine generated additions are copied into `src/`; existing models keep additions-only behavior unless upstream commits explicitly say otherwise. | +| Workarounds | Step 4, Step 5, Step 5b, Step 5c | Known emitter drift, style drift, renamed body parameters, and scratch files are cleaned up. | +| Verification | Step 6 | Build, API extraction, API report spot-checks, and formatting all pass. | + +### Recovery: customization stopped on a dirty target + +`npm run generate:client` runs formatting before `dev-tool customization apply`. If the active formatter rewrites committed `src/` files, customization can stop with `Uncommitted changes were detected in the target directory` after generation has already updated `generated/`. + +Do not regenerate again and do not restore all of `src/`. First confirm that regeneration preflight recorded a clean `src/` tree, inspect every current `src/` diff, and identify changes that are formatter-only. Restore only those proven formatter-created files, then apply customization to the already-emitted `generated/` tree: + +```powershell +git diff -- src +git restore --source=HEAD -- +npx dev-tool customization apply +``` + +If any affected file had a user change before regeneration, stop and recover that change instead of restoring the file. After customization completes, continue with Step 0 and repeat the protected-file audit in Step 1. ### Step -1: Read the upstream validation guide @@ -65,6 +79,8 @@ Get-ChildItem -Recurse -File src -Include *.ts | If the custom side is missing a type that the spec side adds (common when the spec introduces a brand-new model type like `SessionLogEvent`), Step 2 will catch it. Don't try to merge sides by hand here. +Treat custom-side conflict resolution as syntax cleanup, not proof that the file is semantically merged. A large diff3 conflict can retain duplicated model regions or remove existing exports even after all markers are gone. Immediately after resolving markers, run the duplicate scan from Step 2b and compare the exported names in `src/models/models.ts` with `HEAD`. If dozens of duplicates or removals appear, do not repair the merged file declaration by declaration: restore the affected additions-only file from `HEAD`, then use Step 2 to reapply only genuine generated additions. + ### Step 1: Pre-flight — verify protected files are intact Inspect `git diff` for the protected paths listed in [references/post-emitter-workarounds.md](./references/post-emitter-workarounds.md). If the emitter touched any of them, **revert those files and surface to a human**: @@ -88,14 +104,16 @@ $protected = @( 'src/api/datasets/operations.ts','src/classic/telemetry/index.ts', 'src/classic/datasets/index.ts','src/classic/index.ts' ) -$changed = git diff --name-only HEAD -- src +$changed = git diff --name-only --relative HEAD -- src $violations = $changed | Where-Object { $protected -contains $_ -or $_ -like 'src/static-helpers/*' } if ($violations) { Write-Warning "Protected files modified by emitter; reverting:`n$($violations -join "`n")" - $violations | ForEach-Object { git checkout HEAD -- $_ } + $violations | ForEach-Object { git restore --source=HEAD -- $_ } } ``` +`--relative` is required when this command runs from the package directory. Without it, Git may return paths such as `sdk/ai/ai-projects/src/aiProjectClient.ts`, which do not match the package-relative protected list and produce a false zero-violation result. + ### Step 2: Propagate new public-surface additions from generated/ to src/ **Critical**: `dev-tool customization apply` does **not** automatically copy newly emitted public types/operations into `src/` for files that have an existing customization layer. You must do this by hand. @@ -151,6 +169,26 @@ Then, for each genuine addition: If nothing is missing, this step is a no-op — confirm and move on. +#### Distinguish emitter additions from customization renames + +Do not classify additions from only the current `generated/` versus current `src/` comparison. Conflict cleanup can make `src/` temporarily incomplete, and the customization layer intentionally keeps many symbols under names that differ from generated output. + +Use this three-way test: + +1. **Current `generated/` versus `HEAD:generated/`** identifies what the emitter actually added or removed in this regeneration. +2. **Current `generated/` versus `HEAD:src/`** identifies which emitted symbols were already represented by the committed customization layer. +3. **Current `generated/` versus cleaned current `src/`** identifies what still needs propagation after conflict cleanup. + +A symbol is a genuine addition only when it is new relative to committed generated output, has no same-purpose symbol in committed customized source, and is still absent from cleaned current source. This prevents propagating known rename pairs and avoids copying `ApiError` merely because the generated name differs from the maintained `ErrorModel` surface. + +For files with severe conflict churn, restore these additions-only/public-export files before running the three-way test: + +```powershell +git restore --source=HEAD -- src/models/models.ts src/models/index.ts src/index.ts +``` + +Restore only files proven clean before regeneration. Never use this recovery on a file that contained user changes at preflight. + #### Step 2b: Detect and dedupe redeclared symbols When a model moves locations between regens, the customization layer can leave both copies in place. Before moving on, scan for duplicate top-level exports in `src/models/models.ts`: @@ -197,6 +235,7 @@ From [references/post-emitter-workarounds.md](./references/post-emitter-workarou # Find local-const cases (allowed pattern, for reference): git diff HEAD -- src | Select-String 'const foundryFeatures =' ``` + - **`BetaEvaluatorsOperations.list` must keep its name.** If the emitter renamed it to `listLatestVersions`, revert the rename (method name, all call sites, and any related type names). ```powershell git diff HEAD -- src | Select-String 'listLatestVersions' @@ -245,11 +284,15 @@ Remove-Item -ErrorAction SilentlyContinue ` src/restorePollerHelpers.ts, ` metadata.json, ` agent_version_lines.txt, ` + review/ai-projects-browser.api.diff.md, ` + review/ai-projects-react-native.api.diff.md, ` src/**/*.tmp, src/**/*.tmp2, src/**/*.bak ``` `src/restorePollerHelpers.ts` should not exist — there's a single `restorePollerHelpers.ts` under `generated/` only. `.tmp`, `.tmp2`, and `.bak` files are subagent scratch from earlier in the workflow. +Do not run `scripts/post-emitter.mjs` as a substitute for the per-rule checks without auditing its output. It currently also rewrites user-agent construction in protected client/context files. If it is run, immediately repeat Step 1 and restore every protected-file change before building. + ### Step 6: Build and surface verification ```powershell @@ -258,6 +301,14 @@ npx dev-tool run build-package All four targets (browser, react-native, esm, commonjs) must succeed. +If `dev-tool` or one of its workspace dependencies is missing because a prior install was interrupted, recover the package dependency closure rather than reinstalling all workspace projects mid-regen: + +```powershell +pnpm install --filter @azure/ai-projects... +``` + +If the repository's configured Azure Artifacts feed returns `401`, do not change or print credentials. After confirming the required packages are public or local workspace packages, retry the same filtered install with `--registry=https://registry.npmjs.org/`. Avoid an unfiltered `pnpm install` during post-emitter work: it can remove existing module directories before a feed failure and leave `dev-tool` only partially installed. + Then regenerate the API report and confirm the new public surface is present in it: ```powershell @@ -287,3 +338,5 @@ Once the build is green, hand off to the `author-samples` skill. - Do **not** use unbounded `(Get-Content X) -replace 'old', 'new' | Set-Content X` for parameter renames — it silently corrupts substrings (`name` → `toolboxName` produced `toolboxtoolboxName`). Always use `(?