@azure/ai-agents 1.0.0-beta.2 → 1.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -16
- package/dist/browser/api/agentsContext.d.ts.map +1 -1
- package/dist/browser/api/agentsContext.js +7 -4
- package/dist/browser/api/agentsContext.js.map +1 -1
- package/dist/browser/api/operations.js +6 -6
- package/dist/browser/api/operations.js.map +1 -1
- package/dist/browser/api/poller.d.ts +7 -2
- package/dist/browser/api/poller.d.ts.map +1 -1
- package/dist/browser/api/poller.js +31 -9
- package/dist/browser/api/poller.js.map +1 -1
- package/dist/browser/api/runs/operations.d.ts +9 -7
- package/dist/browser/api/runs/operations.d.ts.map +1 -1
- package/dist/browser/api/runs/operations.js +47 -7
- package/dist/browser/api/runs/operations.js.map +1 -1
- package/dist/browser/api/runs/options.d.ts +2 -1
- package/dist/browser/api/runs/options.d.ts.map +1 -1
- package/dist/browser/api/runs/options.js.map +1 -1
- package/dist/browser/classic/runs/index.d.ts +4 -1
- package/dist/browser/classic/runs/index.d.ts.map +1 -1
- package/dist/browser/classic/runs/index.js +2 -1
- package/dist/browser/classic/runs/index.js.map +1 -1
- package/dist/browser/constants.d.ts +1 -1
- package/dist/browser/constants.js +1 -1
- package/dist/browser/constants.js.map +1 -1
- package/dist/browser/models/models.d.ts +6 -2
- package/dist/browser/models/models.d.ts.map +1 -1
- package/dist/browser/models/models.js +8 -0
- package/dist/browser/models/models.js.map +1 -1
- package/dist/browser/utils.d.ts.map +1 -1
- package/dist/browser/utils.js +3 -1
- package/dist/browser/utils.js.map +1 -1
- package/dist/commonjs/api/agentsContext.d.ts.map +1 -1
- package/dist/commonjs/api/agentsContext.js +7 -4
- package/dist/commonjs/api/agentsContext.js.map +1 -1
- package/dist/commonjs/api/operations.js +6 -6
- package/dist/commonjs/api/operations.js.map +1 -1
- package/dist/commonjs/api/poller.d.ts +7 -2
- package/dist/commonjs/api/poller.d.ts.map +1 -1
- package/dist/commonjs/api/poller.js +32 -9
- package/dist/commonjs/api/poller.js.map +1 -1
- package/dist/commonjs/api/runs/operations.d.ts +9 -7
- package/dist/commonjs/api/runs/operations.d.ts.map +1 -1
- package/dist/commonjs/api/runs/operations.js +45 -4
- package/dist/commonjs/api/runs/operations.js.map +1 -1
- package/dist/commonjs/api/runs/options.d.ts +2 -1
- package/dist/commonjs/api/runs/options.d.ts.map +1 -1
- package/dist/commonjs/api/runs/options.js.map +1 -1
- package/dist/commonjs/classic/runs/index.d.ts +4 -1
- package/dist/commonjs/classic/runs/index.d.ts.map +1 -1
- package/dist/commonjs/classic/runs/index.js +1 -0
- package/dist/commonjs/classic/runs/index.js.map +1 -1
- package/dist/commonjs/constants.d.ts +1 -1
- package/dist/commonjs/constants.js +1 -1
- package/dist/commonjs/constants.js.map +1 -1
- package/dist/commonjs/models/models.d.ts +6 -2
- package/dist/commonjs/models/models.d.ts.map +1 -1
- package/dist/commonjs/models/models.js +8 -0
- package/dist/commonjs/models/models.js.map +1 -1
- package/dist/commonjs/tsdoc-metadata.json +1 -1
- package/dist/commonjs/utils.d.ts.map +1 -1
- package/dist/commonjs/utils.js +3 -1
- package/dist/commonjs/utils.js.map +1 -1
- package/dist/esm/api/agentsContext.d.ts.map +1 -1
- package/dist/esm/api/agentsContext.js +7 -4
- package/dist/esm/api/agentsContext.js.map +1 -1
- package/dist/esm/api/operations.js +6 -6
- package/dist/esm/api/operations.js.map +1 -1
- package/dist/esm/api/poller.d.ts +7 -2
- package/dist/esm/api/poller.d.ts.map +1 -1
- package/dist/esm/api/poller.js +31 -9
- package/dist/esm/api/poller.js.map +1 -1
- package/dist/esm/api/runs/operations.d.ts +9 -7
- package/dist/esm/api/runs/operations.d.ts.map +1 -1
- package/dist/esm/api/runs/operations.js +47 -7
- package/dist/esm/api/runs/operations.js.map +1 -1
- package/dist/esm/api/runs/options.d.ts +2 -1
- package/dist/esm/api/runs/options.d.ts.map +1 -1
- package/dist/esm/api/runs/options.js.map +1 -1
- package/dist/esm/classic/runs/index.d.ts +4 -1
- package/dist/esm/classic/runs/index.d.ts.map +1 -1
- package/dist/esm/classic/runs/index.js +2 -1
- package/dist/esm/classic/runs/index.js.map +1 -1
- package/dist/esm/constants.d.ts +1 -1
- package/dist/esm/constants.js +1 -1
- package/dist/esm/constants.js.map +1 -1
- package/dist/esm/models/models.d.ts +6 -2
- package/dist/esm/models/models.d.ts.map +1 -1
- package/dist/esm/models/models.js +8 -0
- package/dist/esm/models/models.js.map +1 -1
- package/dist/esm/utils.d.ts.map +1 -1
- package/dist/esm/utils.js +3 -1
- package/dist/esm/utils.js.map +1 -1
- package/dist/react-native/api/agentsContext.d.ts.map +1 -1
- package/dist/react-native/api/agentsContext.js +7 -4
- package/dist/react-native/api/agentsContext.js.map +1 -1
- package/dist/react-native/api/operations.js +6 -6
- package/dist/react-native/api/operations.js.map +1 -1
- package/dist/react-native/api/poller.d.ts +7 -2
- package/dist/react-native/api/poller.d.ts.map +1 -1
- package/dist/react-native/api/poller.js +31 -9
- package/dist/react-native/api/poller.js.map +1 -1
- package/dist/react-native/api/runs/operations.d.ts +9 -7
- package/dist/react-native/api/runs/operations.d.ts.map +1 -1
- package/dist/react-native/api/runs/operations.js +47 -7
- package/dist/react-native/api/runs/operations.js.map +1 -1
- package/dist/react-native/api/runs/options.d.ts +2 -1
- package/dist/react-native/api/runs/options.d.ts.map +1 -1
- package/dist/react-native/api/runs/options.js.map +1 -1
- package/dist/react-native/classic/runs/index.d.ts +4 -1
- package/dist/react-native/classic/runs/index.d.ts.map +1 -1
- package/dist/react-native/classic/runs/index.js +2 -1
- package/dist/react-native/classic/runs/index.js.map +1 -1
- package/dist/react-native/constants.d.ts +1 -1
- package/dist/react-native/constants.js +1 -1
- package/dist/react-native/constants.js.map +1 -1
- package/dist/react-native/models/models.d.ts +6 -2
- package/dist/react-native/models/models.d.ts.map +1 -1
- package/dist/react-native/models/models.js +8 -0
- package/dist/react-native/models/models.js.map +1 -1
- package/dist/react-native/utils.d.ts.map +1 -1
- package/dist/react-native/utils.js +3 -1
- package/dist/react-native/utils.js.map +1 -1
- package/package.json +1 -1
|
@@ -20,11 +20,13 @@ exports.listRuns = listRuns;
|
|
|
20
20
|
exports._createRunSend = _createRunSend;
|
|
21
21
|
exports._createRunDeserialize = _createRunDeserialize;
|
|
22
22
|
exports.createRun = createRun;
|
|
23
|
+
exports.createRunAndPoll = createRunAndPoll;
|
|
23
24
|
const models_js_1 = require("../../models/models.js");
|
|
24
25
|
const pagingHelpers_js_1 = require("../../static-helpers/pagingHelpers.js");
|
|
25
26
|
const urlTemplate_js_1 = require("../../static-helpers/urlTemplate.js");
|
|
26
27
|
const core_client_1 = require("@azure-rest/core-client");
|
|
27
28
|
const operations_js_1 = require("../operations.js");
|
|
29
|
+
const poller_js_1 = require("../poller.js");
|
|
28
30
|
function _cancelRunSend(context, threadId, runId, options = { requestOptions: {} }) {
|
|
29
31
|
var _a, _b;
|
|
30
32
|
const path = (0, urlTemplate_js_1.expandUrlTemplate)("/threads/{threadId}/runs/{runId}/cancel{?api%2Dversion}", {
|
|
@@ -59,7 +61,7 @@ function _submitToolOutputsToRunSend(context, threadId, runId, toolOutputs, opti
|
|
|
59
61
|
});
|
|
60
62
|
return context.path(path).post(Object.assign(Object.assign({}, (0, core_client_1.operationOptionsToRequestParameters)(options)), { contentType: "application/json", headers: Object.assign({ accept: "application/json" }, (_b = options.requestOptions) === null || _b === void 0 ? void 0 : _b.headers), body: {
|
|
61
63
|
tool_outputs: (0, models_js_1.toolOutputArraySerializer)(toolOutputs),
|
|
62
|
-
stream:
|
|
64
|
+
stream: false,
|
|
63
65
|
} }));
|
|
64
66
|
}
|
|
65
67
|
async function _submitToolOutputsToRunDeserialize(result) {
|
|
@@ -70,9 +72,19 @@ async function _submitToolOutputsToRunDeserialize(result) {
|
|
|
70
72
|
return (0, models_js_1.threadRunDeserializer)(result.body);
|
|
71
73
|
}
|
|
72
74
|
/** Submits outputs from tools as requested by tool calls in a run. */
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
75
|
+
function submitToolOutputsToRun(context, threadId, runId, toolOutputs, options = { requestOptions: {} }) {
|
|
76
|
+
async function executeSubmitToolOutputsToRun() {
|
|
77
|
+
const result = await _submitToolOutputsToRunSend(context, threadId, runId, toolOutputs, options);
|
|
78
|
+
return _submitToolOutputsToRunDeserialize(result);
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
then: function (onFulfilled, onRejected) {
|
|
82
|
+
return executeSubmitToolOutputsToRun().then(onFulfilled, onRejected).catch(onRejected);
|
|
83
|
+
},
|
|
84
|
+
async stream() {
|
|
85
|
+
return (0, operations_js_1.submitToolOutputsToRunStreaming)(context, threadId, runId, options);
|
|
86
|
+
},
|
|
87
|
+
};
|
|
76
88
|
}
|
|
77
89
|
function _updateRunSend(context, threadId, runId, options = { requestOptions: {} }) {
|
|
78
90
|
var _a, _b;
|
|
@@ -207,4 +219,33 @@ function createRun(context, threadId, assistantId, options = { requestOptions: {
|
|
|
207
219
|
},
|
|
208
220
|
};
|
|
209
221
|
}
|
|
222
|
+
function createRunAndPoll(context, threadId, assistantId, options = { requestOptions: {} }) {
|
|
223
|
+
var _a;
|
|
224
|
+
return (0, poller_js_1.createPoller)({
|
|
225
|
+
initOperation: async () => {
|
|
226
|
+
const runResponse = createRun(context, threadId, assistantId, options);
|
|
227
|
+
return runResponse;
|
|
228
|
+
},
|
|
229
|
+
pollOperation: async (currentRun) => {
|
|
230
|
+
return getRun(context, threadId, currentRun.id, options);
|
|
231
|
+
},
|
|
232
|
+
getOperationStatus: getLroOperationStatus,
|
|
233
|
+
intervalInMs: (_a = options.pollingOptions) === null || _a === void 0 ? void 0 : _a.intervalInMs,
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
function getLroOperationStatus(result) {
|
|
237
|
+
switch (result.status) {
|
|
238
|
+
case "queued":
|
|
239
|
+
return "notStarted";
|
|
240
|
+
case "in_progress":
|
|
241
|
+
case "requires_action":
|
|
242
|
+
return "running";
|
|
243
|
+
case "completed":
|
|
244
|
+
return "succeeded";
|
|
245
|
+
case "cancelled":
|
|
246
|
+
case "expired":
|
|
247
|
+
default:
|
|
248
|
+
return "failed";
|
|
249
|
+
}
|
|
250
|
+
}
|
|
210
251
|
//# sourceMappingURL=operations.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations.js","sourceRoot":"","sources":["../../../../src/api/runs/operations.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAsClC,wCAwBC;AAED,sDAOC;AAGD,8BAQC;AAED,kEA8BC;AAED,gFASC;AAGD,wDASC;AAED,wCA0BC;AAED,sDAOC;AAGD,8BAQC;AAED,kCAwBC;AAED,gDAOC;AAGD,wBAQC;AAED,sCA0BC;AAED,oDASC;AAGD,4BAYC;AAED,wCAuDC;AAED,sDAOC;AAGD,8BAmBC;AAlXD,sDAYgC;AAShC,4EAG+C;AAC/C,wEAAwE;AACxE,yDAKiC;AAEjC,oDAAsD;AAEtD,SAAgB,cAAc,CAC5B,OAAe,EACf,QAAgB,EAChB,KAAa,EACb,UAAuC,EAAE,cAAc,EAAE,EAAE,EAAE;;IAE7D,MAAM,IAAI,GAAG,IAAA,kCAAiB,EAC5B,yDAAyD,EACzD;QACE,QAAQ,EAAE,QAAQ;QAClB,KAAK,EAAE,KAAK;QACZ,eAAe,EAAE,OAAO,CAAC,UAAU;KACpC,EACD;QACE,aAAa,EAAE,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,cAAc,0CAAE,eAAe;KACxD,CACF,CAAC;IACF,OAAO,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,iCACzB,IAAA,iDAAmC,EAAC,OAAO,CAAC,KAC/C,OAAO,kBACL,MAAM,EAAE,kBAAkB,IACvB,MAAA,OAAO,CAAC,cAAc,0CAAE,OAAO,KAEpC,CAAC;AACL,CAAC;AAEM,KAAK,UAAU,qBAAqB,CAAC,MAA6B;I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;IAED,OAAO,IAAA,iCAAqB,EAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAC5C,CAAC;AAED,6CAA6C;AAC7C,SAAgB,SAAS,CACvB,OAAe,EACf,QAAgB,EAChB,WAAmB,EACnB,UAAuC,EAAE,cAAc,EAAE,EAAE,EAAE;IAE7D,KAAK,UAAU,gBAAgB;QAC7B,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;QAC7E,OAAO,qBAAqB,CAAC,MAAM,CAAC,CAAC;IACvC,CAAC;IAED,OAAO;QACL,IAAI,EAAE,UAAU,WAAW,EAAE,UAAU;YACrC,OAAO,gBAAgB,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAC5E,CAAC;QACD,KAAK,CAAC,MAAM;YACV,OAAO,IAAA,kCAAkB,EAAC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;QACrE,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { AgentsContext as Client } from \"../index.js\";\nimport {\n toolDefinitionUnionArraySerializer,\n agentsResponseFormatOptionSerializer,\n threadMessageOptionsArraySerializer,\n truncationObjectSerializer,\n agentsToolChoiceOptionSerializer,\n ThreadRun,\n threadRunDeserializer,\n _AgentsPagedResultThreadRun,\n _agentsPagedResultThreadRunDeserializer,\n ToolOutput,\n toolOutputArraySerializer,\n} from \"../../models/models.js\";\nimport {\n RunsCancelRunOptionalParams,\n RunsSubmitToolOutputsToRunOptionalParams,\n RunsUpdateRunOptionalParams,\n RunsGetRunOptionalParams,\n RunsListRunsOptionalParams,\n RunsCreateRunOptionalParams,\n} from \"./options.js\";\nimport {\n PagedAsyncIterableIterator,\n buildPagedAsyncIterator,\n} from \"../../static-helpers/pagingHelpers.js\";\nimport { expandUrlTemplate } from \"../../static-helpers/urlTemplate.js\";\nimport {\n StreamableMethod,\n PathUncheckedResponse,\n createRestError,\n operationOptionsToRequestParameters,\n} from \"@azure-rest/core-client\";\nimport { AgentRunResponse, AgentEventMessageStream } from \"../../models/streamingModels.js\";\nimport { createRunStreaming } from \"../operations.js\";\n\nexport function _cancelRunSend(\n context: Client,\n threadId: string,\n runId: string,\n options: RunsCancelRunOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/threads/{threadId}/runs/{runId}/cancel{?api%2Dversion}\",\n {\n threadId: threadId,\n runId: runId,\n \"api%2Dversion\": context.apiVersion,\n },\n {\n allowReserved: options?.requestOptions?.skipUrlEncoding,\n },\n );\n return context.path(path).post({\n ...operationOptionsToRequestParameters(options),\n headers: {\n accept: \"application/json\",\n ...options.requestOptions?.headers,\n },\n });\n}\n\nexport async function _cancelRunDeserialize(result: PathUncheckedResponse): Promise<ThreadRun> {\n const expectedStatuses = [\"200\"];\n if (!expectedStatuses.includes(result.status)) {\n throw createRestError(result);\n }\n\n return threadRunDeserializer(result.body);\n}\n\n/** Cancels a run of an in‐progress thread. */\nexport async function cancelRun(\n context: Client,\n threadId: string,\n runId: string,\n options: RunsCancelRunOptionalParams = { requestOptions: {} },\n): Promise<ThreadRun> {\n const result = await _cancelRunSend(context, threadId, runId, options);\n return _cancelRunDeserialize(result);\n}\n\nexport function _submitToolOutputsToRunSend(\n context: Client,\n threadId: string,\n runId: string,\n toolOutputs: ToolOutput[],\n options: RunsSubmitToolOutputsToRunOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/threads/{threadId}/runs/{runId}/submit_tool_outputs{?api%2Dversion}\",\n {\n threadId: threadId,\n runId: runId,\n \"api%2Dversion\": context.apiVersion,\n },\n {\n allowReserved: options?.requestOptions?.skipUrlEncoding,\n },\n );\n return context.path(path).post({\n ...operationOptionsToRequestParameters(options),\n contentType: \"application/json\",\n headers: {\n accept: \"application/json\",\n ...options.requestOptions?.headers,\n },\n body: {\n tool_outputs: toolOutputArraySerializer(toolOutputs),\n stream: options?.stream,\n },\n });\n}\n\nexport async function _submitToolOutputsToRunDeserialize(\n result: PathUncheckedResponse,\n): Promise<ThreadRun> {\n const expectedStatuses = [\"200\"];\n if (!expectedStatuses.includes(result.status)) {\n throw createRestError(result);\n }\n\n return threadRunDeserializer(result.body);\n}\n\n/** Submits outputs from tools as requested by tool calls in a run. */\nexport async function submitToolOutputsToRun(\n context: Client,\n threadId: string,\n runId: string,\n toolOutputs: ToolOutput[],\n options: RunsSubmitToolOutputsToRunOptionalParams = { requestOptions: {} },\n): Promise<ThreadRun> {\n const result = await _submitToolOutputsToRunSend(context, threadId, runId, toolOutputs, options);\n return _submitToolOutputsToRunDeserialize(result);\n}\n\nexport function _updateRunSend(\n context: Client,\n threadId: string,\n runId: string,\n options: RunsUpdateRunOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/threads/{threadId}/runs/{runId}{?api%2Dversion}\",\n {\n threadId: threadId,\n runId: runId,\n \"api%2Dversion\": context.apiVersion,\n },\n {\n allowReserved: options?.requestOptions?.skipUrlEncoding,\n },\n );\n return context.path(path).post({\n ...operationOptionsToRequestParameters(options),\n contentType: \"application/json\",\n headers: {\n accept: \"application/json\",\n ...options.requestOptions?.headers,\n },\n body: { metadata: options?.metadata },\n });\n}\n\nexport async function _updateRunDeserialize(result: PathUncheckedResponse): Promise<ThreadRun> {\n const expectedStatuses = [\"200\"];\n if (!expectedStatuses.includes(result.status)) {\n throw createRestError(result);\n }\n\n return threadRunDeserializer(result.body);\n}\n\n/** Modifies an existing thread run. */\nexport async function updateRun(\n context: Client,\n threadId: string,\n runId: string,\n options: RunsUpdateRunOptionalParams = { requestOptions: {} },\n): Promise<ThreadRun> {\n const result = await _updateRunSend(context, threadId, runId, options);\n return _updateRunDeserialize(result);\n}\n\nexport function _getRunSend(\n context: Client,\n threadId: string,\n runId: string,\n options: RunsGetRunOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/threads/{threadId}/runs/{runId}{?api%2Dversion}\",\n {\n threadId: threadId,\n runId: runId,\n \"api%2Dversion\": context.apiVersion,\n },\n {\n allowReserved: options?.requestOptions?.skipUrlEncoding,\n },\n );\n return context.path(path).get({\n ...operationOptionsToRequestParameters(options),\n headers: {\n accept: \"application/json\",\n ...options.requestOptions?.headers,\n },\n });\n}\n\nexport async function _getRunDeserialize(result: PathUncheckedResponse): Promise<ThreadRun> {\n const expectedStatuses = [\"200\"];\n if (!expectedStatuses.includes(result.status)) {\n throw createRestError(result);\n }\n\n return threadRunDeserializer(result.body);\n}\n\n/** Gets an existing run from an existing thread. */\nexport async function getRun(\n context: Client,\n threadId: string,\n runId: string,\n options: RunsGetRunOptionalParams = { requestOptions: {} },\n): Promise<ThreadRun> {\n const result = await _getRunSend(context, threadId, runId, options);\n return _getRunDeserialize(result);\n}\n\nexport function _listRunsSend(\n context: Client,\n threadId: string,\n options: RunsListRunsOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/threads/{threadId}/runs{?api%2Dversion,limit,order,after,before}\",\n {\n threadId: threadId,\n \"api%2Dversion\": context.apiVersion,\n limit: options?.limit,\n order: options?.order,\n after: options?.after,\n before: options?.before,\n },\n {\n allowReserved: options?.requestOptions?.skipUrlEncoding,\n },\n );\n return context.path(path).get({\n ...operationOptionsToRequestParameters(options),\n headers: {\n accept: \"application/json\",\n ...options.requestOptions?.headers,\n },\n });\n}\n\nexport async function _listRunsDeserialize(\n result: PathUncheckedResponse,\n): Promise<_AgentsPagedResultThreadRun> {\n const expectedStatuses = [\"200\"];\n if (!expectedStatuses.includes(result.status)) {\n throw createRestError(result);\n }\n\n return _agentsPagedResultThreadRunDeserializer(result.body);\n}\n\n/** Gets a list of runs for a specified thread. */\nexport function listRuns(\n context: Client,\n threadId: string,\n options: RunsListRunsOptionalParams = { requestOptions: {} },\n): PagedAsyncIterableIterator<ThreadRun> {\n return buildPagedAsyncIterator(\n context,\n () => _listRunsSend(context, threadId, options),\n _listRunsDeserialize,\n [\"200\"],\n { itemName: \"data\" },\n );\n}\n\nexport function _createRunSend(\n context: Client,\n threadId: string,\n assistantId: string,\n options: RunsCreateRunOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/threads/{threadId}/runs{?api%2Dversion,include%5B%5D}\",\n {\n threadId: threadId,\n \"api%2Dversion\": context.apiVersion,\n \"include%5B%5D\": !options?.include\n ? options?.include\n : options?.include.map((p: any) => {\n return p;\n }),\n },\n {\n allowReserved: options?.requestOptions?.skipUrlEncoding,\n },\n );\n return context.path(path).post({\n ...operationOptionsToRequestParameters(options),\n contentType: \"application/json\",\n headers: {\n accept: \"application/json\",\n ...options.requestOptions?.headers,\n },\n body: {\n assistant_id: assistantId,\n model: options?.model,\n instructions: options?.instructions,\n additional_instructions: options?.additionalInstructions,\n additional_messages: !options?.additionalMessages\n ? options?.additionalMessages\n : threadMessageOptionsArraySerializer(options?.additionalMessages),\n tools: !options?.tools ? options?.tools : toolDefinitionUnionArraySerializer(options?.tools),\n stream: options?.stream,\n temperature: options?.temperature,\n top_p: options?.topP,\n max_prompt_tokens: options?.maxPromptTokens,\n max_completion_tokens: options?.maxCompletionTokens,\n truncation_strategy: !options?.truncationStrategy\n ? options?.truncationStrategy\n : truncationObjectSerializer(options?.truncationStrategy),\n tool_choice: !options?.toolChoice\n ? options?.toolChoice\n : agentsToolChoiceOptionSerializer(options?.toolChoice),\n response_format: !options?.responseFormat\n ? options?.responseFormat\n : agentsResponseFormatOptionSerializer(options?.responseFormat),\n parallel_tool_calls: options?.parallelToolCalls,\n metadata: options?.metadata,\n },\n });\n}\n\nexport async function _createRunDeserialize(result: PathUncheckedResponse): Promise<ThreadRun> {\n const expectedStatuses = [\"200\"];\n if (!expectedStatuses.includes(result.status)) {\n throw createRestError(result);\n }\n\n return threadRunDeserializer(result.body);\n}\n\n/** Creates a new run for an agent thread. */\nexport function createRun(\n context: Client,\n threadId: string,\n assistantId: string,\n options: RunsCreateRunOptionalParams = { requestOptions: {} },\n): AgentRunResponse {\n async function executeCreateRun(): Promise<ThreadRun> {\n const result = await _createRunSend(context, threadId, assistantId, options);\n return _createRunDeserialize(result);\n }\n\n return {\n then: function (onFulfilled, onRejected) {\n return executeCreateRun().then(onFulfilled, onRejected).catch(onRejected);\n },\n async stream(): Promise<AgentEventMessageStream> {\n return createRunStreaming(context, assistantId, threadId, options);\n },\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"operations.js","sourceRoot":"","sources":["../../../../src/api/runs/operations.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAgClC,wCAwBC;AAED,sDAOC;AAGD,8BAQC;AAED,kEA8BC;AAED,gFASC;AAGD,wDA0BC;AAED,wCA0BC;AAED,sDAOC;AAGD,8BAQC;AAED,kCAwBC;AAED,gDAOC;AAGD,wBAQC;AAED,sCA0BC;AAED,oDASC;AAGD,4BAYC;AAED,wCAuDC;AAED,sDAOC;AAGD,8BAmBC;AAED,4CAiBC;AA/YD,sDASgC;AAUhC,4EAAgF;AAChF,wEAAwE;AAExE,yDAA+F;AAE/F,oDAAuF;AAEvF,4CAA4C;AAE5C,SAAgB,cAAc,CAC5B,OAAe,EACf,QAAgB,EAChB,KAAa,EACb,UAAuC,EAAE,cAAc,EAAE,EAAE,EAAE;;IAE7D,MAAM,IAAI,GAAG,IAAA,kCAAiB,EAC5B,yDAAyD,EACzD;QACE,QAAQ,EAAE,QAAQ;QAClB,KAAK,EAAE,KAAK;QACZ,eAAe,EAAE,OAAO,CAAC,UAAU;KACpC,EACD;QACE,aAAa,EAAE,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,cAAc,0CAAE,eAAe;KACxD,CACF,CAAC;IACF,OAAO,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,iCACzB,IAAA,iDAAmC,EAAC,OAA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AAE;;IAE7D,OAAO,IAAA,wBAAY,EAAY;QAC7B,aAAa,EAAE,KAAK,IAAI,EAAE;YACxB,MAAM,WAAW,GAAG,SAAS,CAAC,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;YACvE,OAAO,WAAW,CAAC;QACrB,CAAC;QACD,aAAa,EAAE,KAAK,EAAE,UAAqB,EAAE,EAAE;YAC7C,OAAO,MAAM,CAAC,OAAO,EAAE,QAAQ,EAAE,UAAU,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;QAC3D,CAAC;QACD,kBAAkB,EAAE,qBAAqB;QACzC,YAAY,EAAE,MAAA,OAAO,CAAC,cAAc,0CAAE,YAAY;KACnD,CAAC,CAAC;AACL,CAAC;AAED,SAAS,qBAAqB,CAAC,MAAiB;IAC9C,QAAQ,MAAM,CAAC,MAAM,EAAE,CAAC;QACtB,KAAK,QAAQ;YACX,OAAO,YAAY,CAAC;QACtB,KAAK,aAAa,CAAC;QACnB,KAAK,iBAAiB;YACpB,OAAO,SAAS,CAAC;QACnB,KAAK,WAAW;YACd,OAAO,WAAW,CAAC;QACrB,KAAK,WAAW,CAAC;QACjB,KAAK,SAAS,CAAC;QACf;YACE,OAAO,QAAQ,CAAC;IACpB,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AgentsContext as Client } from \"../index.js\";\nimport type { ThreadRun, _AgentsPagedResultThreadRun, ToolOutput } from \"../../models/models.js\";\nimport {\n toolDefinitionUnionArraySerializer,\n agentsResponseFormatOptionSerializer,\n threadMessageOptionsArraySerializer,\n truncationObjectSerializer,\n agentsToolChoiceOptionSerializer,\n threadRunDeserializer,\n _agentsPagedResultThreadRunDeserializer,\n toolOutputArraySerializer,\n} from \"../../models/models.js\";\nimport type {\n RunsCancelRunOptionalParams,\n RunsSubmitToolOutputsToRunOptionalParams,\n RunsUpdateRunOptionalParams,\n RunsGetRunOptionalParams,\n RunsListRunsOptionalParams,\n RunsCreateRunOptionalParams,\n} from \"./options.js\";\nimport type { PagedAsyncIterableIterator } from \"../../static-helpers/pagingHelpers.js\";\nimport { buildPagedAsyncIterator } from \"../../static-helpers/pagingHelpers.js\";\nimport { expandUrlTemplate } from \"../../static-helpers/urlTemplate.js\";\nimport type { StreamableMethod, PathUncheckedResponse } from \"@azure-rest/core-client\";\nimport { createRestError, operationOptionsToRequestParameters } from \"@azure-rest/core-client\";\nimport type { AgentRunResponse, AgentEventMessageStream } from \"../../models/streamingModels.js\";\nimport { createRunStreaming, submitToolOutputsToRunStreaming } from \"../operations.js\";\nimport type { OperationState, OperationStatus, PollerLike } from \"@azure/core-lro\";\nimport { createPoller } from \"../poller.js\";\n\nexport function _cancelRunSend(\n context: Client,\n threadId: string,\n runId: string,\n options: RunsCancelRunOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/threads/{threadId}/runs/{runId}/cancel{?api%2Dversion}\",\n {\n threadId: threadId,\n runId: runId,\n \"api%2Dversion\": context.apiVersion,\n },\n {\n allowReserved: options?.requestOptions?.skipUrlEncoding,\n },\n );\n return context.path(path).post({\n ...operationOptionsToRequestParameters(options),\n headers: {\n accept: \"application/json\",\n ...options.requestOptions?.headers,\n },\n });\n}\n\nexport async function _cancelRunDeserialize(result: PathUncheckedResponse): Promise<ThreadRun> {\n const expectedStatuses = [\"200\"];\n if (!expectedStatuses.includes(result.status)) {\n throw createRestError(result);\n }\n\n return threadRunDeserializer(result.body);\n}\n\n/** Cancels a run of an in‐progress thread. */\nexport async function cancelRun(\n context: Client,\n threadId: string,\n runId: string,\n options: RunsCancelRunOptionalParams = { requestOptions: {} },\n): Promise<ThreadRun> {\n const result = await _cancelRunSend(context, threadId, runId, options);\n return _cancelRunDeserialize(result);\n}\n\nexport function _submitToolOutputsToRunSend(\n context: Client,\n threadId: string,\n runId: string,\n toolOutputs: ToolOutput[],\n options: RunsSubmitToolOutputsToRunOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/threads/{threadId}/runs/{runId}/submit_tool_outputs{?api%2Dversion}\",\n {\n threadId: threadId,\n runId: runId,\n \"api%2Dversion\": context.apiVersion,\n },\n {\n allowReserved: options?.requestOptions?.skipUrlEncoding,\n },\n );\n return context.path(path).post({\n ...operationOptionsToRequestParameters(options),\n contentType: \"application/json\",\n headers: {\n accept: \"application/json\",\n ...options.requestOptions?.headers,\n },\n body: {\n tool_outputs: toolOutputArraySerializer(toolOutputs),\n stream: false,\n },\n });\n}\n\nexport async function _submitToolOutputsToRunDeserialize(\n result: PathUncheckedResponse,\n): Promise<ThreadRun> {\n const expectedStatuses = [\"200\"];\n if (!expectedStatuses.includes(result.status)) {\n throw createRestError(result);\n }\n\n return threadRunDeserializer(result.body);\n}\n\n/** Submits outputs from tools as requested by tool calls in a run. */\nexport function submitToolOutputsToRun(\n context: Client,\n threadId: string,\n runId: string,\n toolOutputs: ToolOutput[],\n options: RunsSubmitToolOutputsToRunOptionalParams = { requestOptions: {} },\n): AgentRunResponse {\n async function executeSubmitToolOutputsToRun(): Promise<ThreadRun> {\n const result = await _submitToolOutputsToRunSend(\n context,\n threadId,\n runId,\n toolOutputs,\n options,\n );\n return _submitToolOutputsToRunDeserialize(result);\n }\n\n return {\n then: function (onFulfilled, onRejected) {\n return executeSubmitToolOutputsToRun().then(onFulfilled, onRejected).catch(onRejected);\n },\n async stream(): Promise<AgentEventMessageStream> {\n return submitToolOutputsToRunStreaming(context, threadId, runId, options);\n },\n };\n}\n\nexport function _updateRunSend(\n context: Client,\n threadId: string,\n runId: string,\n options: RunsUpdateRunOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/threads/{threadId}/runs/{runId}{?api%2Dversion}\",\n {\n threadId: threadId,\n runId: runId,\n \"api%2Dversion\": context.apiVersion,\n },\n {\n allowReserved: options?.requestOptions?.skipUrlEncoding,\n },\n );\n return context.path(path).post({\n ...operationOptionsToRequestParameters(options),\n contentType: \"application/json\",\n headers: {\n accept: \"application/json\",\n ...options.requestOptions?.headers,\n },\n body: { metadata: options?.metadata },\n });\n}\n\nexport async function _updateRunDeserialize(result: PathUncheckedResponse): Promise<ThreadRun> {\n const expectedStatuses = [\"200\"];\n if (!expectedStatuses.includes(result.status)) {\n throw createRestError(result);\n }\n\n return threadRunDeserializer(result.body);\n}\n\n/** Modifies an existing thread run. */\nexport async function updateRun(\n context: Client,\n threadId: string,\n runId: string,\n options: RunsUpdateRunOptionalParams = { requestOptions: {} },\n): Promise<ThreadRun> {\n const result = await _updateRunSend(context, threadId, runId, options);\n return _updateRunDeserialize(result);\n}\n\nexport function _getRunSend(\n context: Client,\n threadId: string,\n runId: string,\n options: RunsGetRunOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/threads/{threadId}/runs/{runId}{?api%2Dversion}\",\n {\n threadId: threadId,\n runId: runId,\n \"api%2Dversion\": context.apiVersion,\n },\n {\n allowReserved: options?.requestOptions?.skipUrlEncoding,\n },\n );\n return context.path(path).get({\n ...operationOptionsToRequestParameters(options),\n headers: {\n accept: \"application/json\",\n ...options.requestOptions?.headers,\n },\n });\n}\n\nexport async function _getRunDeserialize(result: PathUncheckedResponse): Promise<ThreadRun> {\n const expectedStatuses = [\"200\"];\n if (!expectedStatuses.includes(result.status)) {\n throw createRestError(result);\n }\n\n return threadRunDeserializer(result.body);\n}\n\n/** Gets an existing run from an existing thread. */\nexport async function getRun(\n context: Client,\n threadId: string,\n runId: string,\n options: RunsGetRunOptionalParams = { requestOptions: {} },\n): Promise<ThreadRun> {\n const result = await _getRunSend(context, threadId, runId, options);\n return _getRunDeserialize(result);\n}\n\nexport function _listRunsSend(\n context: Client,\n threadId: string,\n options: RunsListRunsOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/threads/{threadId}/runs{?api%2Dversion,limit,order,after,before}\",\n {\n threadId: threadId,\n \"api%2Dversion\": context.apiVersion,\n limit: options?.limit,\n order: options?.order,\n after: options?.after,\n before: options?.before,\n },\n {\n allowReserved: options?.requestOptions?.skipUrlEncoding,\n },\n );\n return context.path(path).get({\n ...operationOptionsToRequestParameters(options),\n headers: {\n accept: \"application/json\",\n ...options.requestOptions?.headers,\n },\n });\n}\n\nexport async function _listRunsDeserialize(\n result: PathUncheckedResponse,\n): Promise<_AgentsPagedResultThreadRun> {\n const expectedStatuses = [\"200\"];\n if (!expectedStatuses.includes(result.status)) {\n throw createRestError(result);\n }\n\n return _agentsPagedResultThreadRunDeserializer(result.body);\n}\n\n/** Gets a list of runs for a specified thread. */\nexport function listRuns(\n context: Client,\n threadId: string,\n options: RunsListRunsOptionalParams = { requestOptions: {} },\n): PagedAsyncIterableIterator<ThreadRun> {\n return buildPagedAsyncIterator(\n context,\n () => _listRunsSend(context, threadId, options),\n _listRunsDeserialize,\n [\"200\"],\n { itemName: \"data\" },\n );\n}\n\nexport function _createRunSend(\n context: Client,\n threadId: string,\n assistantId: string,\n options: RunsCreateRunOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/threads/{threadId}/runs{?api%2Dversion,include%5B%5D}\",\n {\n threadId: threadId,\n \"api%2Dversion\": context.apiVersion,\n \"include%5B%5D\": !options?.include\n ? options?.include\n : options?.include.map((p: any) => {\n return p;\n }),\n },\n {\n allowReserved: options?.requestOptions?.skipUrlEncoding,\n },\n );\n return context.path(path).post({\n ...operationOptionsToRequestParameters(options),\n contentType: \"application/json\",\n headers: {\n accept: \"application/json\",\n ...options.requestOptions?.headers,\n },\n body: {\n assistant_id: assistantId,\n model: options?.model,\n instructions: options?.instructions,\n additional_instructions: options?.additionalInstructions,\n additional_messages: !options?.additionalMessages\n ? options?.additionalMessages\n : threadMessageOptionsArraySerializer(options?.additionalMessages),\n tools: !options?.tools ? options?.tools : toolDefinitionUnionArraySerializer(options?.tools),\n stream: options?.stream,\n temperature: options?.temperature,\n top_p: options?.topP,\n max_prompt_tokens: options?.maxPromptTokens,\n max_completion_tokens: options?.maxCompletionTokens,\n truncation_strategy: !options?.truncationStrategy\n ? options?.truncationStrategy\n : truncationObjectSerializer(options?.truncationStrategy),\n tool_choice: !options?.toolChoice\n ? options?.toolChoice\n : agentsToolChoiceOptionSerializer(options?.toolChoice),\n response_format: !options?.responseFormat\n ? options?.responseFormat\n : agentsResponseFormatOptionSerializer(options?.responseFormat),\n parallel_tool_calls: options?.parallelToolCalls,\n metadata: options?.metadata,\n },\n });\n}\n\nexport async function _createRunDeserialize(result: PathUncheckedResponse): Promise<ThreadRun> {\n const expectedStatuses = [\"200\"];\n if (!expectedStatuses.includes(result.status)) {\n throw createRestError(result);\n }\n\n return threadRunDeserializer(result.body);\n}\n\n/** Creates a new run for an agent thread. */\nexport function createRun(\n context: Client,\n threadId: string,\n assistantId: string,\n options: RunsCreateRunOptionalParams = { requestOptions: {} },\n): AgentRunResponse {\n async function executeCreateRun(): Promise<ThreadRun> {\n const result = await _createRunSend(context, threadId, assistantId, options);\n return _createRunDeserialize(result);\n }\n\n return {\n then: function (onFulfilled, onRejected) {\n return executeCreateRun().then(onFulfilled, onRejected).catch(onRejected);\n },\n async stream(): Promise<AgentEventMessageStream> {\n return createRunStreaming(context, assistantId, threadId, options);\n },\n };\n}\n\nexport function createRunAndPoll(\n context: Client,\n threadId: string,\n assistantId: string,\n options: RunsCreateRunOptionalParams = { requestOptions: {} },\n): PollerLike<OperationState<ThreadRun>, ThreadRun> {\n return createPoller<ThreadRun>({\n initOperation: async () => {\n const runResponse = createRun(context, threadId, assistantId, options);\n return runResponse;\n },\n pollOperation: async (currentRun: ThreadRun) => {\n return getRun(context, threadId, currentRun.id, options);\n },\n getOperationStatus: getLroOperationStatus,\n intervalInMs: options.pollingOptions?.intervalInMs,\n });\n}\n\nfunction getLroOperationStatus(result: ThreadRun): OperationStatus {\n switch (result.status) {\n case \"queued\":\n return \"notStarted\";\n case \"in_progress\":\n case \"requires_action\":\n return \"running\";\n case \"completed\":\n return \"succeeded\";\n case \"cancelled\":\n case \"expired\":\n default:\n return \"failed\";\n }\n}\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ToolDefinitionUnion, AgentsResponseFormatOption, ThreadMessageOptions, TruncationObject, AgentsToolChoiceOption, ListSortOrder, RunAdditionalFieldList } from "../../models/models.js";
|
|
2
2
|
import { OperationOptions } from "@azure-rest/core-client";
|
|
3
|
+
import { PollingOptionsParams } from "../options.js";
|
|
3
4
|
/** Optional parameters. */
|
|
4
5
|
export interface RunsCancelRunOptionalParams extends OperationOptions {
|
|
5
6
|
}
|
|
@@ -28,7 +29,7 @@ export interface RunsListRunsOptionalParams extends OperationOptions {
|
|
|
28
29
|
before?: string;
|
|
29
30
|
}
|
|
30
31
|
/** Optional parameters. */
|
|
31
|
-
export interface RunsCreateRunOptionalParams extends OperationOptions {
|
|
32
|
+
export interface RunsCreateRunOptionalParams extends OperationOptions, PollingOptionsParams {
|
|
32
33
|
/**
|
|
33
34
|
* A list of additional fields to include in the response.
|
|
34
35
|
* Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../../src/api/runs/options.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,mBAAmB,EACnB,0BAA0B,EAC1B,oBAAoB,EACpB,gBAAgB,EAChB,sBAAsB,EACtB,aAAa,EACb,sBAAsB,EACvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../../src/api/runs/options.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,mBAAmB,EACnB,0BAA0B,EAC1B,oBAAoB,EACpB,gBAAgB,EAChB,sBAAsB,EACtB,aAAa,EACb,sBAAsB,EACvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,gBAAgB,EAAE,MAA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M,CAAC,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,sFAAsF;IACtF,kBAAkB,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAC7C,qEAAqE;IACrE,UAAU,CAAC,EAAE,sBAAsB,GAAG,IAAI,CAAC;IAC3C,uDAAuD;IACvD,cAAc,CAAC,EAAE,0BAA0B,GAAG,IAAI,CAAC;IACnD,gEAAgE;IAChE,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,yPAAyP;IACzP,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;CAC1C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../../../src/api/runs/options.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n ToolDefinitionUnion,\n AgentsResponseFormatOption,\n ThreadMessageOptions,\n TruncationObject,\n AgentsToolChoiceOption,\n ListSortOrder,\n RunAdditionalFieldList,\n} from \"../../models/models.js\";\nimport { OperationOptions } from \"@azure-rest/core-client\";\n\n/** Optional parameters. */\nexport interface RunsCancelRunOptionalParams extends OperationOptions {}\n\n/** Optional parameters. */\nexport interface RunsSubmitToolOutputsToRunOptionalParams extends OperationOptions {\n /** If true, returns a stream of events that happen during the Run as SSE, terminating at `[DONE]`. */\n stream?: boolean | null;\n}\n\n/** Optional parameters. */\nexport interface RunsUpdateRunOptionalParams extends OperationOptions {\n /** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */\n metadata?: Record<string, string> | null;\n}\n\n/** Optional parameters. */\nexport interface RunsGetRunOptionalParams extends OperationOptions {}\n\n/** Optional parameters. */\nexport interface RunsListRunsOptionalParams extends OperationOptions {\n /** A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. */\n limit?: number;\n /** Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. */\n order?: ListSortOrder;\n /** 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. */\n after?: string;\n /** 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. */\n before?: string;\n}\n\n/** Optional parameters. */\nexport interface RunsCreateRunOptionalParams extends OperationOptions {\n /**\n * A list of additional fields to include in the response.\n * Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content`\n * to fetch the file search result content.\n */\n include?: RunAdditionalFieldList[];\n /** The overridden model name that the agent should use to run the thread. */\n model?: string | null;\n /** The overridden system instructions that the agent should use to run the thread. */\n instructions?: string | null;\n /**\n * Additional instructions to append at the end of the instructions for the run. This is useful for modifying the behavior\n * on a per-run basis without overriding other instructions.\n */\n additionalInstructions?: string | null;\n /** Adds additional messages to the thread before creating the run. */\n additionalMessages?: ThreadMessageOptions[] | null;\n /** The overridden list of enabled tools that the agent should use to run the thread. */\n tools?: ToolDefinitionUnion[] | null;\n /**\n * If `true`, returns a stream of events that happen during the Run as server-sent events,\n * terminating when the Run enters a terminal state with a `data: [DONE]` message.\n */\n stream?: boolean;\n /**\n * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output\n * more random, while lower values like 0.2 will make it more focused and deterministic.\n */\n temperature?: number | null;\n /**\n * An alternative to sampling with temperature, called nucleus sampling, where the model\n * considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens\n * comprising the top 10% probability mass are considered.\n *\n * We generally recommend altering this or temperature but not both.\n */\n topP?: number | null;\n /**\n * The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only\n * the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified,\n * the run will end with status `incomplete`. See `incomplete_details` for more info.\n */\n maxPromptTokens?: number | null;\n /**\n * The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort\n * to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of\n * completion tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info.\n */\n maxCompletionTokens?: number | null;\n /** The strategy to use for dropping messages as the context windows moves forward. */\n truncationStrategy?: TruncationObject | null;\n /** Controls whether or not and which tool is called by the model. */\n toolChoice?: AgentsToolChoiceOption | null;\n /** Specifies the format that the model must output. */\n responseFormat?: AgentsResponseFormatOption | null;\n /** If `true` functions will run in parallel during tool use. */\n parallelToolCalls?: boolean;\n /** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */\n metadata?: Record<string, string> | null;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../../../src/api/runs/options.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n ToolDefinitionUnion,\n AgentsResponseFormatOption,\n ThreadMessageOptions,\n TruncationObject,\n AgentsToolChoiceOption,\n ListSortOrder,\n RunAdditionalFieldList,\n} from \"../../models/models.js\";\nimport { OperationOptions } from \"@azure-rest/core-client\";\nimport { PollingOptionsParams } from \"../options.js\";\n\n/** Optional parameters. */\nexport interface RunsCancelRunOptionalParams extends OperationOptions {}\n\n/** Optional parameters. */\nexport interface RunsSubmitToolOutputsToRunOptionalParams extends OperationOptions {\n /** If true, returns a stream of events that happen during the Run as SSE, terminating at `[DONE]`. */\n stream?: boolean | null;\n}\n\n/** Optional parameters. */\nexport interface RunsUpdateRunOptionalParams extends OperationOptions {\n /** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */\n metadata?: Record<string, string> | null;\n}\n\n/** Optional parameters. */\nexport interface RunsGetRunOptionalParams extends OperationOptions {}\n\n/** Optional parameters. */\nexport interface RunsListRunsOptionalParams extends OperationOptions {\n /** A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. */\n limit?: number;\n /** Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. */\n order?: ListSortOrder;\n /** 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. */\n after?: string;\n /** 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. */\n before?: string;\n}\n\n/** Optional parameters. */\nexport interface RunsCreateRunOptionalParams extends OperationOptions, PollingOptionsParams {\n /**\n * A list of additional fields to include in the response.\n * Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content`\n * to fetch the file search result content.\n */\n include?: RunAdditionalFieldList[];\n /** The overridden model name that the agent should use to run the thread. */\n model?: string | null;\n /** The overridden system instructions that the agent should use to run the thread. */\n instructions?: string | null;\n /**\n * Additional instructions to append at the end of the instructions for the run. This is useful for modifying the behavior\n * on a per-run basis without overriding other instructions.\n */\n additionalInstructions?: string | null;\n /** Adds additional messages to the thread before creating the run. */\n additionalMessages?: ThreadMessageOptions[] | null;\n /** The overridden list of enabled tools that the agent should use to run the thread. */\n tools?: ToolDefinitionUnion[] | null;\n /**\n * If `true`, returns a stream of events that happen during the Run as server-sent events,\n * terminating when the Run enters a terminal state with a `data: [DONE]` message.\n */\n stream?: boolean;\n /**\n * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output\n * more random, while lower values like 0.2 will make it more focused and deterministic.\n */\n temperature?: number | null;\n /**\n * An alternative to sampling with temperature, called nucleus sampling, where the model\n * considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens\n * comprising the top 10% probability mass are considered.\n *\n * We generally recommend altering this or temperature but not both.\n */\n topP?: number | null;\n /**\n * The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only\n * the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified,\n * the run will end with status `incomplete`. See `incomplete_details` for more info.\n */\n maxPromptTokens?: number | null;\n /**\n * The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort\n * to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of\n * completion tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info.\n */\n maxCompletionTokens?: number | null;\n /** The strategy to use for dropping messages as the context windows moves forward. */\n truncationStrategy?: TruncationObject | null;\n /** Controls whether or not and which tool is called by the model. */\n toolChoice?: AgentsToolChoiceOption | null;\n /** Specifies the format that the model must output. */\n responseFormat?: AgentsResponseFormatOption | null;\n /** If `true` functions will run in parallel during tool use. */\n parallelToolCalls?: boolean;\n /** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */\n metadata?: Record<string, string> | null;\n}\n"]}
|
|
@@ -4,12 +4,13 @@ import { RunsCancelRunOptionalParams, RunsSubmitToolOutputsToRunOptionalParams,
|
|
|
4
4
|
import { AgentRunResponse } from "../../models/streamingModels.js";
|
|
5
5
|
import { CreateThreadAndRunOptionalParams } from "../../api/options.js";
|
|
6
6
|
import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js";
|
|
7
|
+
import { PollerLike, OperationState } from "@azure/core-lro";
|
|
7
8
|
/** Interface representing a Runs operations. */
|
|
8
9
|
export interface RunsOperations {
|
|
9
10
|
/** Cancels a run of an in‐progress thread. */
|
|
10
11
|
cancel: (threadId: string, runId: string, options?: RunsCancelRunOptionalParams) => Promise<ThreadRun>;
|
|
11
12
|
/** Submits outputs from tools as requested by tool calls in a run. */
|
|
12
|
-
submitToolOutputs: (threadId: string, runId: string, toolOutputs: ToolOutput[], options?: RunsSubmitToolOutputsToRunOptionalParams) =>
|
|
13
|
+
submitToolOutputs: (threadId: string, runId: string, toolOutputs: ToolOutput[], options?: RunsSubmitToolOutputsToRunOptionalParams) => AgentRunResponse;
|
|
13
14
|
/** Modifies an existing thread run. */
|
|
14
15
|
update: (threadId: string, runId: string, options?: RunsUpdateRunOptionalParams) => Promise<ThreadRun>;
|
|
15
16
|
/** Gets an existing run from an existing thread. */
|
|
@@ -18,6 +19,8 @@ export interface RunsOperations {
|
|
|
18
19
|
list: (threadId: string, options?: RunsListRunsOptionalParams) => PagedAsyncIterableIterator<ThreadRun>;
|
|
19
20
|
/** Creates a new run for an agent thread. */
|
|
20
21
|
create: (threadId: string, assistantId: string, options?: RunsCreateRunOptionalParams) => AgentRunResponse;
|
|
22
|
+
/** Creates a new run for an agent thread with polling. */
|
|
23
|
+
createAndPoll: (threadId: string, assistantId: string, options?: RunsCreateRunOptionalParams) => PollerLike<OperationState<ThreadRun>, ThreadRun>;
|
|
21
24
|
/** Creates a new thread and run for an agent. */
|
|
22
25
|
createThreadAndRun: (assistantId: string, options?: CreateThreadAndRunOptionalParams) => AgentRunResponse;
|
|
23
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/classic/runs/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EACL,2BAA2B,EAC3B,wCAAwC,EACxC,2BAA2B,EAC3B,wBAAwB,EACxB,0BAA0B,EAC1B,2BAA2B,EAC5B,MAAM,2BAA2B,CAAC;
|
|
1
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CACJ,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,0BAA0B,KACjC,0BAA0B,CAAC,SAAS,CAAC,CAAC;IAC3C,6CAA6C;IAC7C,MAAM,EAAE,CACN,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE,2BAA2B,KAClC,gBAAgB,CAAC;IACtB,0DAA0D;IAC1D,aAAa,EAAE,CACb,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE,2BAA2B,KAClC,UAAU,CAAC,cAAc,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC,CAAC;IACtD,iDAAiD;IACjD,kBAAkB,EAAE,CAClB,WAAW,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE,gCAAgC,KACvC,gBAAgB,CAAC;CACvB;AA2BD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,aAAa,GAAG,cAAc,CAIzE"}
|
|
@@ -13,6 +13,7 @@ function _getRuns(context) {
|
|
|
13
13
|
get: (threadId, runId, options) => (0, operations_js_1.getRun)(context, threadId, runId, options),
|
|
14
14
|
list: (threadId, options) => (0, operations_js_1.listRuns)(context, threadId, options),
|
|
15
15
|
create: (threadId, assistantId, options) => (0, operations_js_1.createRun)(context, threadId, assistantId, options),
|
|
16
|
+
createAndPoll: (threadId, assistantId, options) => (0, operations_js_1.createRunAndPoll)(context, threadId, assistantId, options),
|
|
16
17
|
createThreadAndRun: (assistantId, options) => (0, operations_js_2.createThreadAndRun)(context, assistantId, options),
|
|
17
18
|
};
|
|
18
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/classic/runs/index.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/classic/runs/index.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAA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,CAAC;KACpD,CAAC;AACJ,CAAC;AAED,SAAgB,kBAAkB,CAAC,OAAsB;IACvD,yBACK,QAAQ,CAAC,OAAO,CAAC,EACpB;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { AgentsContext } from \"../../api/agentsContext.js\";\nimport { ThreadRun, ToolOutput } from \"../../models/models.js\";\nimport {\n RunsCancelRunOptionalParams,\n RunsSubmitToolOutputsToRunOptionalParams,\n RunsUpdateRunOptionalParams,\n RunsGetRunOptionalParams,\n RunsListRunsOptionalParams,\n RunsCreateRunOptionalParams,\n} from \"../../api/runs/options.js\";\nimport {\n cancelRun,\n submitToolOutputsToRun,\n updateRun,\n getRun,\n listRuns,\n createRun,\n createRunAndPoll,\n} from \"../../api/runs/operations.js\";\nimport { AgentRunResponse } from \"../../models/streamingModels.js\";\nimport { createThreadAndRun } from \"../../api/operations.js\";\nimport { CreateThreadAndRunOptionalParams } from \"../../api/options.js\";\nimport { PagedAsyncIterableIterator } from \"../../static-helpers/pagingHelpers.js\";\nimport { PollerLike, OperationState } from \"@azure/core-lro\";\n\n/** Interface representing a Runs operations. */\nexport interface RunsOperations {\n /** Cancels a run of an in‐progress thread. */\n cancel: (\n threadId: string,\n runId: string,\n options?: RunsCancelRunOptionalParams,\n ) => Promise<ThreadRun>;\n /** Submits outputs from tools as requested by tool calls in a run. */\n submitToolOutputs: (\n threadId: string,\n runId: string,\n toolOutputs: ToolOutput[],\n options?: RunsSubmitToolOutputsToRunOptionalParams,\n ) => AgentRunResponse;\n /** Modifies an existing thread run. */\n update: (\n threadId: string,\n runId: string,\n options?: RunsUpdateRunOptionalParams,\n ) => Promise<ThreadRun>;\n /** Gets an existing run from an existing thread. */\n get: (threadId: string, runId: string, options?: RunsGetRunOptionalParams) => Promise<ThreadRun>;\n /** Gets a list of runs for a specified thread. */\n list: (\n threadId: string,\n options?: RunsListRunsOptionalParams,\n ) => PagedAsyncIterableIterator<ThreadRun>;\n /** Creates a new run for an agent thread. */\n create: (\n threadId: string,\n assistantId: string,\n options?: RunsCreateRunOptionalParams,\n ) => AgentRunResponse;\n /** Creates a new run for an agent thread with polling. */\n createAndPoll: (\n threadId: string,\n assistantId: string,\n options?: RunsCreateRunOptionalParams,\n ) => PollerLike<OperationState<ThreadRun>, ThreadRun>;\n /** Creates a new thread and run for an agent. */\n createThreadAndRun: (\n assistantId: string,\n options?: CreateThreadAndRunOptionalParams,\n ) => AgentRunResponse;\n}\n\nfunction _getRuns(context: AgentsContext) {\n return {\n cancel: (threadId: string, runId: string, options?: RunsCancelRunOptionalParams) =>\n cancelRun(context, threadId, runId, options),\n submitToolOutputs: (\n threadId: string,\n runId: string,\n toolOutputs: ToolOutput[],\n options?: RunsSubmitToolOutputsToRunOptionalParams,\n ) => submitToolOutputsToRun(context, threadId, runId, toolOutputs, options),\n update: (threadId: string, runId: string, options?: RunsUpdateRunOptionalParams) =>\n updateRun(context, threadId, runId, options),\n get: (threadId: string, runId: string, options?: RunsGetRunOptionalParams) =>\n getRun(context, threadId, runId, options),\n list: (threadId: string, options?: RunsListRunsOptionalParams) =>\n listRuns(context, threadId, options),\n create: (threadId: string, assistantId: string, options?: RunsCreateRunOptionalParams) =>\n createRun(context, threadId, assistantId, options),\n createAndPoll: (threadId: string, assistantId: string, options?: RunsCreateRunOptionalParams) =>\n createRunAndPoll(context, threadId, assistantId, options),\n createThreadAndRun: (assistantId: string, options?: RunsCreateRunOptionalParams) =>\n createThreadAndRun(context, assistantId, options),\n };\n}\n\nexport function _getRunsOperations(context: AgentsContext): RunsOperations {\n return {\n ..._getRuns(context),\n };\n}\n"]}
|
|
@@ -6,7 +6,7 @@ exports.PACKAGE_NAME = exports.SDK_VERSION = void 0;
|
|
|
6
6
|
/**
|
|
7
7
|
* Current version of the `@azure/ai-agents` package.
|
|
8
8
|
*/
|
|
9
|
-
exports.SDK_VERSION = `1.0.0-beta.
|
|
9
|
+
exports.SDK_VERSION = `1.0.0-beta.3`;
|
|
10
10
|
/**
|
|
11
11
|
* The package name of the `@azure/ai-agents` package.
|
|
12
12
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC;;GAEG;AACU,QAAA,WAAW,GAAG,cAAc,CAAC;AAE1C;;GAEG;AACU,QAAA,YAAY,GAAG,kBAAkB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * Current version of the `@azure/ai-agents` package.\n */\nexport const SDK_VERSION = `1.0.0-beta.
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC;;GAEG;AACU,QAAA,WAAW,GAAG,cAAc,CAAC;AAE1C;;GAEG;AACU,QAAA,YAAY,GAAG,kBAAkB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * Current version of the `@azure/ai-agents` package.\n */\nexport const SDK_VERSION = `1.0.0-beta.3`;\n\n/**\n * The package name of the `@azure/ai-agents` package.\n */\nexport const PACKAGE_NAME = \"@azure/ai-agents\";\n"]}
|
|
@@ -89,7 +89,7 @@ export interface BingGroundingSearchConfigurationList {
|
|
|
89
89
|
export declare function bingGroundingSearchConfigurationListSerializer(item: BingGroundingSearchConfigurationList): any;
|
|
90
90
|
export declare function bingGroundingSearchConfigurationListDeserializer(item: any): BingGroundingSearchConfigurationList;
|
|
91
91
|
export declare function bingGroundingSearchConfigurationArraySerializer(result: Array<BingGroundingSearchConfiguration>): any[];
|
|
92
|
-
export declare function bingGroundingSearchConfigurationArrayDeserializer(result: Array<BingGroundingSearchConfiguration>): any[];
|
|
92
|
+
export declare function bingGroundingSearchConfigurationArrayDeserializer(result: Array<BingGroundingSearchConfiguration> | undefined): any[];
|
|
93
93
|
/** Search configuration for Bing Grounding */
|
|
94
94
|
export interface BingGroundingSearchConfiguration {
|
|
95
95
|
/** Connection id for grounding with bing search */
|
|
@@ -1453,7 +1453,11 @@ export interface _UploadFileRequest {
|
|
|
1453
1453
|
/** The name of the file. */
|
|
1454
1454
|
filename?: string;
|
|
1455
1455
|
}
|
|
1456
|
-
export declare function _uploadFileRequestSerializer(item: _UploadFileRequest):
|
|
1456
|
+
export declare function _uploadFileRequestSerializer(item: _UploadFileRequest): Array<{
|
|
1457
|
+
name: "file" | "purpose";
|
|
1458
|
+
body: any;
|
|
1459
|
+
filename?: string;
|
|
1460
|
+
}>;
|
|
1457
1461
|
/** A status response from a file deletion operation. */
|
|
1458
1462
|
export interface FileDeletionStatus {
|
|
1459
1463
|
/** The ID of the resource specified for deletion. */
|