@azure/ai-agents 1.0.0 → 1.1.0-beta.2
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 +104 -1
- package/dist/browser/agentsClient.js +24 -3
- package/dist/browser/agentsClient.js.map +1 -1
- package/dist/browser/api/agentsContext.js +13 -10
- package/dist/browser/api/agentsContext.js.map +1 -1
- package/dist/browser/api/files/operations.js +51 -26
- package/dist/browser/api/files/operations.js.map +1 -1
- package/dist/browser/api/messages/operations.js +54 -30
- package/dist/browser/api/messages/operations.js.map +1 -1
- package/dist/browser/api/operations.d.ts.map +1 -1
- package/dist/browser/api/operations.js +147 -134
- package/dist/browser/api/operations.js.map +1 -1
- package/dist/browser/api/poller.js +12 -15
- package/dist/browser/api/poller.js.map +1 -1
- package/dist/browser/api/runSteps/operations.js +30 -20
- package/dist/browser/api/runSteps/operations.js.map +1 -1
- package/dist/browser/api/runs/operations.d.ts.map +1 -1
- package/dist/browser/api/runs/operations.js +108 -67
- package/dist/browser/api/runs/operations.js.map +1 -1
- package/dist/browser/api/runs/options.d.ts +7 -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/api/threads/operations.js +71 -42
- package/dist/browser/api/threads/operations.js.map +1 -1
- package/dist/browser/api/vectorStoreFileBatches/operations.d.ts +2 -2
- package/dist/browser/api/vectorStoreFileBatches/operations.d.ts.map +1 -1
- package/dist/browser/api/vectorStoreFileBatches/operations.js +50 -33
- package/dist/browser/api/vectorStoreFileBatches/operations.js.map +1 -1
- package/dist/browser/api/vectorStoreFiles/operations.js +49 -29
- package/dist/browser/api/vectorStoreFiles/operations.js.map +1 -1
- package/dist/browser/api/vectorStores/operations.js +68 -44
- package/dist/browser/api/vectorStores/operations.js.map +1 -1
- package/dist/browser/classic/files/index.js +3 -1
- package/dist/browser/classic/files/index.js.map +1 -1
- package/dist/browser/classic/messages/index.js +3 -1
- package/dist/browser/classic/messages/index.js.map +1 -1
- package/dist/browser/classic/runSteps/index.js +3 -1
- package/dist/browser/classic/runSteps/index.js.map +1 -1
- package/dist/browser/classic/runs/index.js +3 -1
- package/dist/browser/classic/runs/index.js.map +1 -1
- package/dist/browser/classic/threads/index.js +3 -1
- package/dist/browser/classic/threads/index.js.map +1 -1
- package/dist/browser/classic/vectorStoreFileBatches/index.d.ts +2 -2
- package/dist/browser/classic/vectorStoreFileBatches/index.d.ts.map +1 -1
- package/dist/browser/classic/vectorStoreFileBatches/index.js +3 -1
- package/dist/browser/classic/vectorStoreFileBatches/index.js.map +1 -1
- package/dist/browser/classic/vectorStoreFiles/index.js +3 -1
- package/dist/browser/classic/vectorStoreFiles/index.js.map +1 -1
- package/dist/browser/classic/vectorStores/index.js +3 -1
- package/dist/browser/classic/vectorStores/index.js.map +1 -1
- package/dist/browser/constants.d.ts +1 -1
- package/dist/browser/constants.d.ts.map +1 -1
- package/dist/browser/constants.js +1 -1
- package/dist/browser/constants.js.map +1 -1
- package/dist/browser/index.d.ts +3 -2
- package/dist/browser/index.d.ts.map +1 -1
- package/dist/browser/index.js +2 -1
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/models/index.d.ts +1 -1
- package/dist/browser/models/index.d.ts.map +1 -1
- package/dist/browser/models/index.js.map +1 -1
- package/dist/browser/models/models.d.ts +260 -22
- package/dist/browser/models/models.d.ts.map +1 -1
- package/dist/browser/models/models.js +337 -14
- package/dist/browser/models/models.js.map +1 -1
- package/dist/browser/static-helpers/multipartHelpers.js +1 -2
- package/dist/browser/static-helpers/multipartHelpers.js.map +1 -1
- package/dist/browser/static-helpers/pagingHelpers.js +31 -50
- package/dist/browser/static-helpers/pagingHelpers.js.map +1 -1
- package/dist/browser/static-helpers/urlTemplate.js +2 -2
- package/dist/browser/static-helpers/urlTemplate.js.map +1 -1
- package/dist/browser/utils/MCPTool.d.ts +78 -0
- package/dist/browser/utils/MCPTool.d.ts.map +1 -0
- package/dist/browser/utils/MCPTool.js +133 -0
- package/dist/browser/utils/MCPTool.js.map +1 -0
- package/dist/browser/{utils.d.ts → utils/utils.d.ts} +61 -1
- package/dist/browser/utils/utils.d.ts.map +1 -0
- package/dist/{esm → browser/utils}/utils.js +104 -16
- package/dist/browser/utils/utils.js.map +1 -0
- package/dist/commonjs/agentsClient.js +24 -3
- package/dist/commonjs/agentsClient.js.map +1 -1
- package/dist/commonjs/api/agentsContext.js +13 -10
- package/dist/commonjs/api/agentsContext.js.map +1 -1
- package/dist/commonjs/api/files/operations.js +51 -26
- package/dist/commonjs/api/files/operations.js.map +1 -1
- package/dist/commonjs/api/messages/operations.js +54 -30
- package/dist/commonjs/api/messages/operations.js.map +1 -1
- package/dist/commonjs/api/operations.d.ts.map +1 -1
- package/dist/commonjs/api/operations.js +146 -133
- package/dist/commonjs/api/operations.js.map +1 -1
- package/dist/commonjs/api/poller.js +12 -15
- package/dist/commonjs/api/poller.js.map +1 -1
- package/dist/commonjs/api/runSteps/operations.js +30 -20
- package/dist/commonjs/api/runSteps/operations.js.map +1 -1
- package/dist/commonjs/api/runs/operations.d.ts.map +1 -1
- package/dist/commonjs/api/runs/operations.js +107 -66
- package/dist/commonjs/api/runs/operations.js.map +1 -1
- package/dist/commonjs/api/runs/options.d.ts +7 -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/api/threads/operations.js +71 -42
- package/dist/commonjs/api/threads/operations.js.map +1 -1
- package/dist/commonjs/api/vectorStoreFileBatches/operations.d.ts +2 -2
- package/dist/commonjs/api/vectorStoreFileBatches/operations.d.ts.map +1 -1
- package/dist/commonjs/api/vectorStoreFileBatches/operations.js +50 -33
- package/dist/commonjs/api/vectorStoreFileBatches/operations.js.map +1 -1
- package/dist/commonjs/api/vectorStoreFiles/operations.js +49 -29
- package/dist/commonjs/api/vectorStoreFiles/operations.js.map +1 -1
- package/dist/commonjs/api/vectorStores/operations.js +68 -44
- package/dist/commonjs/api/vectorStores/operations.js.map +1 -1
- package/dist/commonjs/classic/files/index.js +3 -1
- package/dist/commonjs/classic/files/index.js.map +1 -1
- package/dist/commonjs/classic/messages/index.js +3 -1
- package/dist/commonjs/classic/messages/index.js.map +1 -1
- package/dist/commonjs/classic/runSteps/index.js +3 -1
- package/dist/commonjs/classic/runSteps/index.js.map +1 -1
- package/dist/commonjs/classic/runs/index.js +3 -1
- package/dist/commonjs/classic/runs/index.js.map +1 -1
- package/dist/commonjs/classic/threads/index.js +3 -1
- package/dist/commonjs/classic/threads/index.js.map +1 -1
- package/dist/commonjs/classic/vectorStoreFileBatches/index.d.ts +2 -2
- package/dist/commonjs/classic/vectorStoreFileBatches/index.d.ts.map +1 -1
- package/dist/commonjs/classic/vectorStoreFileBatches/index.js +3 -1
- package/dist/commonjs/classic/vectorStoreFileBatches/index.js.map +1 -1
- package/dist/commonjs/classic/vectorStoreFiles/index.js +3 -1
- package/dist/commonjs/classic/vectorStoreFiles/index.js.map +1 -1
- package/dist/commonjs/classic/vectorStores/index.js +3 -1
- package/dist/commonjs/classic/vectorStores/index.js.map +1 -1
- package/dist/commonjs/constants.d.ts +1 -1
- package/dist/commonjs/constants.d.ts.map +1 -1
- package/dist/commonjs/constants.js +1 -1
- package/dist/commonjs/constants.js.map +1 -1
- package/dist/commonjs/index.d.ts +3 -2
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +4 -2
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/models/index.d.ts +1 -1
- package/dist/commonjs/models/index.d.ts.map +1 -1
- package/dist/commonjs/models/index.js.map +1 -1
- package/dist/commonjs/models/models.d.ts +260 -22
- package/dist/commonjs/models/models.d.ts.map +1 -1
- package/dist/commonjs/models/models.js +382 -16
- package/dist/commonjs/models/models.js.map +1 -1
- package/dist/commonjs/static-helpers/multipartHelpers.js +1 -2
- package/dist/commonjs/static-helpers/multipartHelpers.js.map +1 -1
- package/dist/commonjs/static-helpers/pagingHelpers.js +31 -50
- package/dist/commonjs/static-helpers/pagingHelpers.js.map +1 -1
- package/dist/commonjs/static-helpers/urlTemplate.js +2 -2
- package/dist/commonjs/static-helpers/urlTemplate.js.map +1 -1
- package/dist/commonjs/tsdoc-metadata.json +11 -11
- package/dist/commonjs/utils/MCPTool.d.ts +78 -0
- package/dist/commonjs/utils/MCPTool.d.ts.map +1 -0
- package/dist/commonjs/utils/MCPTool.js +137 -0
- package/dist/commonjs/utils/MCPTool.js.map +1 -0
- package/dist/commonjs/{utils.d.ts → utils/utils.d.ts} +61 -1
- package/dist/commonjs/utils/utils.d.ts.map +1 -0
- package/dist/commonjs/{utils.js → utils/utils.js} +104 -16
- package/dist/commonjs/utils/utils.js.map +1 -0
- package/dist/esm/agentsClient.js +24 -3
- package/dist/esm/agentsClient.js.map +1 -1
- package/dist/esm/api/agentsContext.js +13 -10
- package/dist/esm/api/agentsContext.js.map +1 -1
- package/dist/esm/api/files/operations.js +51 -26
- package/dist/esm/api/files/operations.js.map +1 -1
- package/dist/esm/api/messages/operations.js +54 -30
- package/dist/esm/api/messages/operations.js.map +1 -1
- package/dist/esm/api/operations.d.ts.map +1 -1
- package/dist/esm/api/operations.js +147 -134
- package/dist/esm/api/operations.js.map +1 -1
- package/dist/esm/api/poller.js +12 -15
- package/dist/esm/api/poller.js.map +1 -1
- package/dist/esm/api/runSteps/operations.js +30 -20
- package/dist/esm/api/runSteps/operations.js.map +1 -1
- package/dist/esm/api/runs/operations.d.ts.map +1 -1
- package/dist/esm/api/runs/operations.js +108 -67
- package/dist/esm/api/runs/operations.js.map +1 -1
- package/dist/esm/api/runs/options.d.ts +7 -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/api/threads/operations.js +71 -42
- package/dist/esm/api/threads/operations.js.map +1 -1
- package/dist/esm/api/vectorStoreFileBatches/operations.d.ts +2 -2
- package/dist/esm/api/vectorStoreFileBatches/operations.d.ts.map +1 -1
- package/dist/esm/api/vectorStoreFileBatches/operations.js +50 -33
- package/dist/esm/api/vectorStoreFileBatches/operations.js.map +1 -1
- package/dist/esm/api/vectorStoreFiles/operations.js +49 -29
- package/dist/esm/api/vectorStoreFiles/operations.js.map +1 -1
- package/dist/esm/api/vectorStores/operations.js +68 -44
- package/dist/esm/api/vectorStores/operations.js.map +1 -1
- package/dist/esm/classic/files/index.js +3 -1
- package/dist/esm/classic/files/index.js.map +1 -1
- package/dist/esm/classic/messages/index.js +3 -1
- package/dist/esm/classic/messages/index.js.map +1 -1
- package/dist/esm/classic/runSteps/index.js +3 -1
- package/dist/esm/classic/runSteps/index.js.map +1 -1
- package/dist/esm/classic/runs/index.js +3 -1
- package/dist/esm/classic/runs/index.js.map +1 -1
- package/dist/esm/classic/threads/index.js +3 -1
- package/dist/esm/classic/threads/index.js.map +1 -1
- package/dist/esm/classic/vectorStoreFileBatches/index.d.ts +2 -2
- package/dist/esm/classic/vectorStoreFileBatches/index.d.ts.map +1 -1
- package/dist/esm/classic/vectorStoreFileBatches/index.js +3 -1
- package/dist/esm/classic/vectorStoreFileBatches/index.js.map +1 -1
- package/dist/esm/classic/vectorStoreFiles/index.js +3 -1
- package/dist/esm/classic/vectorStoreFiles/index.js.map +1 -1
- package/dist/esm/classic/vectorStores/index.js +3 -1
- package/dist/esm/classic/vectorStores/index.js.map +1 -1
- package/dist/esm/constants.d.ts +1 -1
- package/dist/esm/constants.d.ts.map +1 -1
- package/dist/esm/constants.js +1 -1
- package/dist/esm/constants.js.map +1 -1
- package/dist/esm/index.d.ts +3 -2
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/models/index.d.ts +1 -1
- package/dist/esm/models/index.d.ts.map +1 -1
- package/dist/esm/models/index.js.map +1 -1
- package/dist/esm/models/models.d.ts +260 -22
- package/dist/esm/models/models.d.ts.map +1 -1
- package/dist/esm/models/models.js +337 -14
- package/dist/esm/models/models.js.map +1 -1
- package/dist/esm/static-helpers/multipartHelpers.js +1 -2
- package/dist/esm/static-helpers/multipartHelpers.js.map +1 -1
- package/dist/esm/static-helpers/pagingHelpers.js +31 -50
- package/dist/esm/static-helpers/pagingHelpers.js.map +1 -1
- package/dist/esm/static-helpers/urlTemplate.js +2 -2
- package/dist/esm/static-helpers/urlTemplate.js.map +1 -1
- package/dist/esm/utils/MCPTool.d.ts +78 -0
- package/dist/esm/utils/MCPTool.d.ts.map +1 -0
- package/dist/esm/utils/MCPTool.js +133 -0
- package/dist/esm/utils/MCPTool.js.map +1 -0
- package/dist/{react-native → esm/utils}/utils.d.ts +61 -1
- package/dist/esm/utils/utils.d.ts.map +1 -0
- package/dist/{react-native → esm/utils}/utils.js +104 -16
- package/dist/esm/utils/utils.js.map +1 -0
- package/dist/react-native/agentsClient.js +24 -3
- package/dist/react-native/agentsClient.js.map +1 -1
- package/dist/react-native/api/agentsContext.js +13 -10
- package/dist/react-native/api/agentsContext.js.map +1 -1
- package/dist/react-native/api/files/operations.js +51 -26
- package/dist/react-native/api/files/operations.js.map +1 -1
- package/dist/react-native/api/messages/operations.js +54 -30
- package/dist/react-native/api/messages/operations.js.map +1 -1
- package/dist/react-native/api/operations.d.ts.map +1 -1
- package/dist/react-native/api/operations.js +147 -134
- package/dist/react-native/api/operations.js.map +1 -1
- package/dist/react-native/api/poller.js +12 -15
- package/dist/react-native/api/poller.js.map +1 -1
- package/dist/react-native/api/runSteps/operations.js +30 -20
- package/dist/react-native/api/runSteps/operations.js.map +1 -1
- package/dist/react-native/api/runs/operations.d.ts.map +1 -1
- package/dist/react-native/api/runs/operations.js +108 -67
- package/dist/react-native/api/runs/operations.js.map +1 -1
- package/dist/react-native/api/runs/options.d.ts +7 -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/api/threads/operations.js +71 -42
- package/dist/react-native/api/threads/operations.js.map +1 -1
- package/dist/react-native/api/vectorStoreFileBatches/operations.d.ts +2 -2
- package/dist/react-native/api/vectorStoreFileBatches/operations.d.ts.map +1 -1
- package/dist/react-native/api/vectorStoreFileBatches/operations.js +50 -33
- package/dist/react-native/api/vectorStoreFileBatches/operations.js.map +1 -1
- package/dist/react-native/api/vectorStoreFiles/operations.js +49 -29
- package/dist/react-native/api/vectorStoreFiles/operations.js.map +1 -1
- package/dist/react-native/api/vectorStores/operations.js +68 -44
- package/dist/react-native/api/vectorStores/operations.js.map +1 -1
- package/dist/react-native/classic/files/index.js +3 -1
- package/dist/react-native/classic/files/index.js.map +1 -1
- package/dist/react-native/classic/messages/index.js +3 -1
- package/dist/react-native/classic/messages/index.js.map +1 -1
- package/dist/react-native/classic/runSteps/index.js +3 -1
- package/dist/react-native/classic/runSteps/index.js.map +1 -1
- package/dist/react-native/classic/runs/index.js +3 -1
- package/dist/react-native/classic/runs/index.js.map +1 -1
- package/dist/react-native/classic/threads/index.js +3 -1
- package/dist/react-native/classic/threads/index.js.map +1 -1
- package/dist/react-native/classic/vectorStoreFileBatches/index.d.ts +2 -2
- package/dist/react-native/classic/vectorStoreFileBatches/index.d.ts.map +1 -1
- package/dist/react-native/classic/vectorStoreFileBatches/index.js +3 -1
- package/dist/react-native/classic/vectorStoreFileBatches/index.js.map +1 -1
- package/dist/react-native/classic/vectorStoreFiles/index.js +3 -1
- package/dist/react-native/classic/vectorStoreFiles/index.js.map +1 -1
- package/dist/react-native/classic/vectorStores/index.js +3 -1
- package/dist/react-native/classic/vectorStores/index.js.map +1 -1
- package/dist/react-native/constants.d.ts +1 -1
- package/dist/react-native/constants.d.ts.map +1 -1
- package/dist/react-native/constants.js +1 -1
- package/dist/react-native/constants.js.map +1 -1
- package/dist/react-native/index.d.ts +3 -2
- package/dist/react-native/index.d.ts.map +1 -1
- package/dist/react-native/index.js +2 -1
- package/dist/react-native/index.js.map +1 -1
- package/dist/react-native/models/index.d.ts +1 -1
- package/dist/react-native/models/index.d.ts.map +1 -1
- package/dist/react-native/models/index.js.map +1 -1
- package/dist/react-native/models/models.d.ts +260 -22
- package/dist/react-native/models/models.d.ts.map +1 -1
- package/dist/react-native/models/models.js +337 -14
- package/dist/react-native/models/models.js.map +1 -1
- package/dist/react-native/static-helpers/multipartHelpers.js +1 -2
- package/dist/react-native/static-helpers/multipartHelpers.js.map +1 -1
- package/dist/react-native/static-helpers/pagingHelpers.js +31 -50
- package/dist/react-native/static-helpers/pagingHelpers.js.map +1 -1
- package/dist/react-native/static-helpers/urlTemplate.js +2 -2
- package/dist/react-native/static-helpers/urlTemplate.js.map +1 -1
- package/dist/react-native/utils/MCPTool.d.ts +78 -0
- package/dist/react-native/utils/MCPTool.d.ts.map +1 -0
- package/dist/react-native/utils/MCPTool.js +133 -0
- package/dist/react-native/utils/MCPTool.js.map +1 -0
- package/dist/{esm → react-native/utils}/utils.d.ts +61 -1
- package/dist/react-native/utils/utils.d.ts.map +1 -0
- package/dist/{browser → react-native/utils}/utils.js +104 -16
- package/dist/react-native/utils/utils.js.map +1 -0
- package/package.json +2 -2
- package/dist/browser/utils.d.ts.map +0 -1
- package/dist/browser/utils.js.map +0 -1
- package/dist/commonjs/utils.d.ts.map +0 -1
- package/dist/commonjs/utils.js.map +0 -1
- package/dist/esm/utils.d.ts.map +0 -1
- package/dist/esm/utils.js.map +0 -1
- package/dist/react-native/utils.d.ts.map +0 -1
- package/dist/react-native/utils.js.map +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
|
+
import { MCPTool } from "./MCPTool.js";
|
|
3
4
|
/**
|
|
4
5
|
* Determines if the given output is of the specified type.
|
|
5
6
|
*
|
|
@@ -53,6 +54,28 @@ export class ToolUtility {
|
|
|
53
54
|
},
|
|
54
55
|
};
|
|
55
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* Creates a sharepoint grounding search tool
|
|
59
|
+
*
|
|
60
|
+
* @param connectionId - The ID of the sharepoint search connection.
|
|
61
|
+
*
|
|
62
|
+
* @returns An object containing the definition and resources for the sharepoint grounding search tool
|
|
63
|
+
*
|
|
64
|
+
*/
|
|
65
|
+
static createSharepointGroundingTool(connectionId) {
|
|
66
|
+
return {
|
|
67
|
+
definition: {
|
|
68
|
+
type: "sharepoint_grounding",
|
|
69
|
+
sharepointGrounding: {
|
|
70
|
+
connectionList: [
|
|
71
|
+
{
|
|
72
|
+
connectionId: connectionId,
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
}
|
|
56
79
|
/**
|
|
57
80
|
* Creates a bing grounding search tool
|
|
58
81
|
*
|
|
@@ -70,10 +93,30 @@ export class ToolUtility {
|
|
|
70
93
|
bingGrounding: {
|
|
71
94
|
searchConfigurations: configs.map((searchConfiguration) => ({
|
|
72
95
|
connectionId: searchConfiguration.connectionId,
|
|
73
|
-
market: searchConfiguration
|
|
74
|
-
setLang: searchConfiguration
|
|
75
|
-
count: searchConfiguration
|
|
76
|
-
freshness: searchConfiguration
|
|
96
|
+
market: searchConfiguration?.market,
|
|
97
|
+
setLang: searchConfiguration?.setLang,
|
|
98
|
+
count: searchConfiguration?.count,
|
|
99
|
+
freshness: searchConfiguration?.freshness,
|
|
100
|
+
})),
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Creates a bing custom search tool
|
|
107
|
+
*
|
|
108
|
+
* @param searchConfigurations - The ID of bing search connection and instanceName.
|
|
109
|
+
*
|
|
110
|
+
* @returns An object containing the definition and resources for the bing custom search tool
|
|
111
|
+
*/
|
|
112
|
+
static createBingCustomSearchTool(searchConfigurations) {
|
|
113
|
+
return {
|
|
114
|
+
definition: {
|
|
115
|
+
type: "bing_custom_search",
|
|
116
|
+
bingCustomSearch: {
|
|
117
|
+
searchConfigurations: searchConfigurations.map((searchConfiguration) => ({
|
|
118
|
+
connectionId: searchConfiguration.connectionId,
|
|
119
|
+
instanceName: searchConfiguration.instanceName,
|
|
77
120
|
})),
|
|
78
121
|
},
|
|
79
122
|
},
|
|
@@ -128,9 +171,9 @@ export class ToolUtility {
|
|
|
128
171
|
{
|
|
129
172
|
indexConnectionId: indexConnectionId,
|
|
130
173
|
indexName: indexName,
|
|
131
|
-
queryType: options
|
|
132
|
-
topK: options
|
|
133
|
-
filter: options
|
|
174
|
+
queryType: options?.queryType,
|
|
175
|
+
topK: options?.topK,
|
|
176
|
+
filter: options?.filter,
|
|
134
177
|
},
|
|
135
178
|
],
|
|
136
179
|
},
|
|
@@ -154,6 +197,22 @@ export class ToolUtility {
|
|
|
154
197
|
},
|
|
155
198
|
};
|
|
156
199
|
}
|
|
200
|
+
/**
|
|
201
|
+
* Creates a Microsoft Fabric tool
|
|
202
|
+
*
|
|
203
|
+
* @param connectionIds - A list of the IDs of the Fabric connections to use.
|
|
204
|
+
* @returns An object containing the definition for the Microsoft Fabric tool
|
|
205
|
+
*/
|
|
206
|
+
static createFabricTool(connectionId) {
|
|
207
|
+
return {
|
|
208
|
+
definition: {
|
|
209
|
+
type: "fabric_dataagent",
|
|
210
|
+
fabricDataagent: {
|
|
211
|
+
connectionList: [{ connectionId: connectionId }],
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
};
|
|
215
|
+
}
|
|
157
216
|
/**
|
|
158
217
|
* Creates a function tool
|
|
159
218
|
*
|
|
@@ -190,17 +249,23 @@ export class ToolUtility {
|
|
|
190
249
|
},
|
|
191
250
|
};
|
|
192
251
|
}
|
|
252
|
+
/**
|
|
253
|
+
* Creates an MCP tool with the provided configuration.
|
|
254
|
+
* @param options - Configuration options for the MCP tool
|
|
255
|
+
* @returns A new MCPTool instance
|
|
256
|
+
*/
|
|
257
|
+
static createMCPTool(options) {
|
|
258
|
+
return new MCPTool(options.serverLabel, options.serverUrl, options.allowedTools);
|
|
259
|
+
}
|
|
193
260
|
}
|
|
194
261
|
/**
|
|
195
262
|
* Represents a set of tools with their definitions and resources.
|
|
196
263
|
*/
|
|
197
264
|
export class ToolSet {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
this.toolResources = {};
|
|
203
|
-
}
|
|
265
|
+
/** A list of tool definitions that have been added to the tool set. */
|
|
266
|
+
toolDefinitions = [];
|
|
267
|
+
/** A collection of resources associated with the tools in the tool set. */
|
|
268
|
+
toolResources = {};
|
|
204
269
|
/**
|
|
205
270
|
* Adds a connection tool to the tool set.
|
|
206
271
|
*
|
|
@@ -226,7 +291,7 @@ export class ToolSet {
|
|
|
226
291
|
addFileSearchTool(vectorStoreIds, vectorStores, definitionDetails) {
|
|
227
292
|
const tool = ToolUtility.createFileSearchTool(vectorStoreIds, vectorStores, definitionDetails);
|
|
228
293
|
this.toolDefinitions.push(tool.definition);
|
|
229
|
-
this.toolResources =
|
|
294
|
+
this.toolResources = { ...this.toolResources, ...tool.resources };
|
|
230
295
|
return tool;
|
|
231
296
|
}
|
|
232
297
|
/**
|
|
@@ -240,7 +305,7 @@ export class ToolSet {
|
|
|
240
305
|
addCodeInterpreterTool(fileIds, dataSources) {
|
|
241
306
|
const tool = ToolUtility.createCodeInterpreterTool(fileIds, dataSources);
|
|
242
307
|
this.toolDefinitions.push(tool.definition);
|
|
243
|
-
this.toolResources =
|
|
308
|
+
this.toolResources = { ...this.toolResources, ...tool.resources };
|
|
244
309
|
return tool;
|
|
245
310
|
}
|
|
246
311
|
/**
|
|
@@ -254,7 +319,7 @@ export class ToolSet {
|
|
|
254
319
|
addAzureAISearchTool(indexConnectionId, indexName) {
|
|
255
320
|
const tool = ToolUtility.createAzureAISearchTool(indexConnectionId, indexName);
|
|
256
321
|
this.toolDefinitions.push(tool.definition);
|
|
257
|
-
this.toolResources =
|
|
322
|
+
this.toolResources = { ...this.toolResources, ...tool.resources };
|
|
258
323
|
return tool;
|
|
259
324
|
}
|
|
260
325
|
/**
|
|
@@ -294,5 +359,28 @@ export class ToolSet {
|
|
|
294
359
|
this.toolDefinitions.push(tool.definition);
|
|
295
360
|
return tool;
|
|
296
361
|
}
|
|
362
|
+
/**
|
|
363
|
+
* Adds a Microsoft Fabric tool to the tool set.
|
|
364
|
+
*
|
|
365
|
+
* @param connectionId - The ID of the Fabric connection to use.
|
|
366
|
+
* @returns An object containing the definition for the Microsoft Fabric tool
|
|
367
|
+
*/
|
|
368
|
+
addFabricTool(connectionId) {
|
|
369
|
+
const tool = ToolUtility.createFabricTool(connectionId);
|
|
370
|
+
this.toolDefinitions.push(tool.definition);
|
|
371
|
+
return tool;
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* Adds sharepoint grounding search tool to the tool set.
|
|
375
|
+
*
|
|
376
|
+
* @param connectionId - The ID of the sharepoint search connection.
|
|
377
|
+
*
|
|
378
|
+
* @returns An object containing the definition and resources for the sharepoint grounding search tool
|
|
379
|
+
*/
|
|
380
|
+
addSharepointGroundingTool(connectionId) {
|
|
381
|
+
const tool = ToolUtility.createSharepointGroundingTool(connectionId);
|
|
382
|
+
this.toolDefinitions.push(tool.definition);
|
|
383
|
+
return tool;
|
|
384
|
+
}
|
|
297
385
|
}
|
|
298
386
|
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/utils/utils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AA2BlC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAC5B,MAA+D,EAC/D,IAAY;IAEZ,OAAO,MAAM,CAAC,IAAI,KAAK,IAAI,CAAC;AAC9B,CAAC;AAED,2DAA2D;AAC3D,MAAM,CAAN,IAAY,kBAWX;AAXD,WAAY,kBAAkB;IAC5B,iCAAiC;IACjC,sDAAgC,CAAA;IAChC,4BAA4B;IAC5B,0DAAoC,CAAA;IACpC,sBAAsB;IACtB,kEAA4C,CAAA;IAC5C,0BAA0B;IAC1B,sDA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AC,UAAU,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;OAKG;IACH,aAAa,CAAC,YAAoB;QAChC,MAAM,IAAI,GAAG,WAAW,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;QACxD,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;OAMG;IACH,0BAA0B,CAAC,YAAoB;QAC7C,MAAM,IAAI,GAAG,WAAW,CAAC,6BAA6B,CAAC,YAAY,CAAC,CAAC;QACrE,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n AzureAISearchToolDefinition,\n CodeInterpreterToolDefinition,\n FileSearchToolDefinition,\n FileSearchToolDefinitionDetails,\n FunctionDefinition,\n FunctionToolDefinition,\n OpenApiToolDefinition,\n RequiredAction,\n RequiredToolCall,\n ToolDefinition,\n ToolDefinitionUnion,\n ToolResources,\n VectorStoreConfigurations,\n VectorStoreDataSource,\n OpenApiFunctionDefinition,\n AISearchIndexResource,\n BingCustomSearchConfiguration,\n BingCustomSearchToolDefinition,\n BingGroundingToolDefinition,\n BingGroundingSearchConfiguration,\n ConnectedAgentToolDefinition,\n MicrosoftFabricToolDefinition,\n SharepointToolDefinition,\n} from \"../index.js\";\nimport { MCPTool } from \"./MCPTool.js\";\n\n/**\n * Determines if the given output is of the specified type.\n *\n * @typeParam T - The type to check against, which extends one of the possible output parent types.\n * @param output - The action to check, which can be of type `RequiredAction`, `RequiredToolCall`, or `ToolDefinitionUnion`.\n * @param type - The type to check the action against.\n * @returns A boolean indicating whether the action is of the specified type.\n */\nexport function isOutputOfType<T extends { type: string }>(\n output: RequiredAction | RequiredToolCall | ToolDefinitionUnion,\n type: string,\n): output is T {\n return output.type === type;\n}\n\n/** Types of connection tools used to configure an agent */\nexport enum connectionToolType {\n /** Bing grounding search tool */\n BingGrounding = \"bing_grounding\",\n /** Microsoft Fabric tool */\n MicrosoftFabric = \"fabric_dataagent\",\n /** Sharepoint tool */\n SharepointGrounding = \"sharepoint_grounding\",\n /** Azure Function tool */\n AzureFunction = \"azure_function\",\n /** Bing custom search tool */\n BingCustomSearch = \"bing_custom_search\",\n}\n\nconst toolMap = {\n bing_grounding: \"bingGrounding\",\n fabric_dataagent: \"fabric_dataagent\",\n sharepoint_grounding: \"sharepointGrounding\",\n azure_function: \"azureFunction\",\n bing_custom_search: \"bingCustomSearch\",\n};\n\n/**\n * Utility class for creating various tools.\n */\nexport class ToolUtility {\n /**\n * Creates a connection tool\n *\n * @param toolType - The type of the connection tool.\n * @param connectionIds - A list of the IDs of the connections to use.\n * @returns An object containing the definition for the connection tool\n */\n static createConnectionTool(\n toolType: connectionToolType,\n connectionIds: string[],\n ): { definition: ToolDefinitionUnion } {\n return {\n definition: {\n type: toolType,\n [toolMap[toolType]]: {\n connections: connectionIds.map((connectionId) => ({ connectionId: connectionId })),\n },\n },\n };\n }\n\n /**\n * Creates a sharepoint grounding search tool\n *\n * @param connectionId - The ID of the sharepoint search connection.\n *\n * @returns An object containing the definition and resources for the sharepoint grounding search tool\n *\n */\n static createSharepointGroundingTool(connectionId: string): {\n definition: SharepointToolDefinition;\n } {\n return {\n definition: {\n type: \"sharepoint_grounding\",\n sharepointGrounding: {\n connectionList: [\n {\n connectionId: connectionId,\n },\n ],\n },\n },\n };\n }\n\n /**\n * Creates a bing grounding search tool\n *\n * @param connectionId - The ID of the bing search connection.\n *\n * @returns An object containing the definition and resources for the bing grounding search tool\n *\n */\n static createBingGroundingTool(searchConfigurations: BingGroundingSearchConfiguration[]): {\n definition: BingGroundingToolDefinition;\n } {\n // Ensure searchConfigurations is an array even if it's undefined\n const configs = searchConfigurations || [];\n return {\n definition: {\n type: \"bing_grounding\",\n bingGrounding: {\n searchConfigurations: configs.map((searchConfiguration) => ({\n connectionId: searchConfiguration.connectionId,\n market: searchConfiguration?.market,\n setLang: searchConfiguration?.setLang,\n count: searchConfiguration?.count,\n freshness: searchConfiguration?.freshness,\n })),\n },\n },\n };\n }\n\n /**\n * Creates a bing custom search tool\n *\n * @param searchConfigurations - The ID of bing search connection and instanceName.\n *\n * @returns An object containing the definition and resources for the bing custom search tool\n */\n\n static createBingCustomSearchTool(searchConfigurations: BingCustomSearchConfiguration[]): {\n definition: BingCustomSearchToolDefinition;\n } {\n return {\n definition: {\n type: \"bing_custom_search\",\n bingCustomSearch: {\n searchConfigurations: searchConfigurations.map((searchConfiguration) => ({\n connectionId: searchConfiguration.connectionId,\n instanceName: searchConfiguration.instanceName,\n })),\n },\n },\n };\n }\n\n /**\n * Creates a file search tool\n *\n * @param vectorStoreIds - The ID of the vector store attached to this agent. There can be a maximum of 1 vector store attached to the agent.\n * @param vectorStores - The list of vector store configuration objects from Azure. This list is limited to one element. The only element of this list contains the list of azure asset IDs used by the search tool.\n * @param definitionDetails - The input definition information for a file search tool as used to configure an agent.\n *\n * @returns An object containing the definition and resources for the file search tool\n */\n static createFileSearchTool(\n vectorStoreIds?: string[],\n vectorStores?: Array<VectorStoreConfigurations>,\n definitionDetails?: FileSearchToolDefinitionDetails,\n ): { definition: FileSearchToolDefinition; resources: ToolResources } {\n return {\n definition: { type: \"file_search\", fileSearch: definitionDetails },\n resources: { fileSearch: { vectorStoreIds: vectorStoreIds, vectorStores: vectorStores } },\n };\n }\n\n /**\n * Creates a code interpreter tool\n *\n * @param fileIds - A list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n * @param dataSources - The data sources to be used. This option is mutually exclusive with fileIds.\n *\n * @returns An object containing the definition and resources for the code interpreter tool.\n */\n static createCodeInterpreterTool(\n fileIds?: string[],\n dataSources?: Array<VectorStoreDataSource>,\n ): { definition: CodeInterpreterToolDefinition; resources: ToolResources } {\n if (fileIds && dataSources) {\n throw new Error(\"Cannot specify both fileIds and dataSources\");\n }\n\n return {\n definition: { type: \"code_interpreter\" },\n resources: { codeInterpreter: { fileIds: fileIds, dataSources: dataSources } },\n };\n }\n\n /**\n * Creates an Azure AI search tool\n *\n * @param indexConnectionId - The connection ID of the Azure AI search index.\n * @param indexName - The name of the Azure AI search index.\n *\n * @returns An object containing the definition and resources for the Azure AI search tool.\n */\n static createAzureAISearchTool(\n indexConnectionId: string,\n indexName: string,\n options?: AISearchIndexResource,\n ): { definition: AzureAISearchToolDefinition; resources: ToolResources } {\n return {\n definition: { type: \"azure_ai_search\" },\n resources: {\n azureAISearch: {\n indexList: [\n {\n indexConnectionId: indexConnectionId,\n indexName: indexName,\n queryType: options?.queryType,\n topK: options?.topK,\n filter: options?.filter,\n },\n ],\n },\n },\n };\n }\n\n /**\n * Creates a connected agent tool\n *\n * @returns An object containing the definition for the connected agent tool.\n */\n static createConnectedAgentTool(\n id: string,\n name: string,\n description: string,\n ): { definition: ConnectedAgentToolDefinition } {\n return {\n definition: {\n type: \"connected_agent\",\n connectedAgent: {\n id: id,\n name: name,\n description: description,\n },\n },\n };\n }\n\n /**\n * Creates a Microsoft Fabric tool\n *\n * @param connectionIds - A list of the IDs of the Fabric connections to use.\n * @returns An object containing the definition for the Microsoft Fabric tool\n */\n static createFabricTool(connectionId: string): { definition: MicrosoftFabricToolDefinition } {\n return {\n definition: {\n type: \"fabric_dataagent\",\n fabricDataagent: {\n connectionList: [{ connectionId: connectionId }],\n },\n },\n };\n }\n\n /**\n * Creates a function tool\n *\n * @param functionDefinition - The function definition to use.\n *\n * @returns An object containing the definition for the function tool.\n */\n static createFunctionTool(functionDefinition: FunctionDefinition): {\n definition: FunctionToolDefinition;\n } {\n return {\n definition: {\n type: \"function\",\n function: functionDefinition,\n },\n };\n }\n\n /**\n * Creates an OpenApi tool\n *\n * @param openApiFunctionDefinition - The OpenApi function definition to use.\n *\n * @returns An object containing the definition for the OpenApi tool.\n */\n static createOpenApiTool(openApiFunctionDefinition: OpenApiFunctionDefinition): {\n definition: OpenApiToolDefinition;\n } {\n return {\n definition: {\n type: \"openapi\",\n openapi: {\n name: openApiFunctionDefinition.name,\n spec: openApiFunctionDefinition.spec,\n description: openApiFunctionDefinition.description,\n auth: openApiFunctionDefinition.auth,\n defaultParams: openApiFunctionDefinition.defaultParams,\n },\n },\n };\n }\n /**\n * Creates an MCP tool with the provided configuration.\n * @param options - Configuration options for the MCP tool\n * @returns A new MCPTool instance\n */\n static createMCPTool(options: {\n serverLabel: string;\n serverUrl: string;\n allowedTools?: string[];\n }): MCPTool {\n return new MCPTool(options.serverLabel, options.serverUrl, options.allowedTools);\n }\n}\n\n/**\n * Represents a set of tools with their definitions and resources.\n */\nexport class ToolSet {\n /** A list of tool definitions that have been added to the tool set. */\n toolDefinitions: ToolDefinition[] = [];\n\n /** A collection of resources associated with the tools in the tool set. */\n toolResources: ToolResources = {};\n\n /**\n * Adds a connection tool to the tool set.\n *\n * @param toolType - The type of the connection tool.\n * @param connectionIds - A list of the IDs of the connections to use.\n *\n * @returns An object containing the definition for the connection tool\n */\n addConnectionTool(\n toolType: connectionToolType,\n connectionIds: string[],\n ): { definition: ToolDefinition } {\n const tool = ToolUtility.createConnectionTool(toolType, connectionIds);\n this.toolDefinitions.push(tool.definition);\n return tool;\n }\n\n /**\n * Adds a file search tool to the tool set.\n *\n * @param vectorStoreIds - The ID of the vector store attached to this agent. There can be a maximum of 1 vector store attached to the agent.\n * @param vectorStores - The list of vector store configuration objects from Azure. This list is limited to one element. The only element of this list contains the list of azure asset IDs used by the search tool.\n * @param definitionDetails - The input definition information for a file search tool as used to configure an agent.\n *\n * @returns An object containing the definition and resources for the file search tool\n */\n addFileSearchTool(\n vectorStoreIds?: string[],\n vectorStores?: Array<VectorStoreConfigurations>,\n definitionDetails?: FileSearchToolDefinitionDetails,\n ): { definition: FileSearchToolDefinition; resources: ToolResources } {\n const tool = ToolUtility.createFileSearchTool(vectorStoreIds, vectorStores, definitionDetails);\n this.toolDefinitions.push(tool.definition);\n this.toolResources = { ...this.toolResources, ...tool.resources };\n return tool;\n }\n\n /**\n * Adds a code interpreter tool to the tool set.\n *\n * @param fileIds - A list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n * @param dataSources - The data sources to be used. This option is mutually exclusive with fileIds.\n *\n * @returns An object containing the definition and resources for the code interpreter tool\n */\n addCodeInterpreterTool(\n fileIds?: string[],\n dataSources?: Array<VectorStoreDataSource>,\n ): { definition: CodeInterpreterToolDefinition; resources: ToolResources } {\n const tool = ToolUtility.createCodeInterpreterTool(fileIds, dataSources);\n this.toolDefinitions.push(tool.definition);\n this.toolResources = { ...this.toolResources, ...tool.resources };\n return tool;\n }\n\n /**\n * Adds an Azure AI search tool to the tool set.\n *\n * @param indexConnectionId - The connection ID of the Azure AI search index.\n * @param indexName - The name of the Azure AI search index.\n *\n * @returns An object containing the definition and resources for the Azure AI search tool\n */\n addAzureAISearchTool(\n indexConnectionId: string,\n indexName: string,\n ): { definition: AzureAISearchToolDefinition; resources: ToolResources } {\n const tool = ToolUtility.createAzureAISearchTool(indexConnectionId, indexName);\n this.toolDefinitions.push(tool.definition);\n this.toolResources = { ...this.toolResources, ...tool.resources };\n return tool;\n }\n\n /**\n * Adds an OpenApi tool to the tool set.\n *\n * @param openApiFunctionDefinition - The OpenApi function definition to use.\n *\n * @returns An object containing the definition for the OpenApi tool\n */\n addOpenApiTool(openApiFunctionDefinition: OpenApiFunctionDefinition): {\n definition: OpenApiToolDefinition;\n } {\n const tool = ToolUtility.createOpenApiTool(openApiFunctionDefinition);\n this.toolDefinitions.push(tool.definition);\n return tool;\n }\n\n /**\n * Adds a bing grounding search tool to the tool set.\n *\n * @param connectionId - The ID of the bing search connection.\n *\n * @returns An object containing the definition and resources for the bing grounding search tool\n */\n addBingGroundingTool(searchConfigurations: BingGroundingSearchConfiguration[]): {\n definition: BingGroundingToolDefinition;\n } {\n const tool = ToolUtility.createBingGroundingTool(searchConfigurations);\n this.toolDefinitions.push(tool.definition);\n return tool;\n }\n\n /**\n * Adds a connected agent tool to the tool set.\n *\n * @param id - The ID of the connected agent.\n * @param name - The name of the connected agent.\n * @param description - The description of the connected agent.\n * @returns An object containing the definition for the connected agent tool\n */\n addConnectedAgentTool(\n id: string,\n name: string,\n description: string,\n ): { definition: ConnectedAgentToolDefinition } {\n const tool = ToolUtility.createConnectedAgentTool(id, name, description);\n this.toolDefinitions.push(tool.definition);\n return tool;\n }\n\n /**\n * Adds a Microsoft Fabric tool to the tool set.\n *\n * @param connectionId - The ID of the Fabric connection to use.\n * @returns An object containing the definition for the Microsoft Fabric tool\n */\n addFabricTool(connectionId: string): { definition: MicrosoftFabricToolDefinition } {\n const tool = ToolUtility.createFabricTool(connectionId);\n this.toolDefinitions.push(tool.definition);\n return tool;\n }\n\n /**\n * Adds sharepoint grounding search tool to the tool set.\n *\n * @param connectionId - The ID of the sharepoint search connection.\n *\n * @returns An object containing the definition and resources for the sharepoint grounding search tool\n */\n addSharepointGroundingTool(connectionId: string): { definition: SharepointToolDefinition } {\n const tool = ToolUtility.createSharepointGroundingTool(connectionId);\n this.toolDefinitions.push(tool.definition);\n return tool;\n }\n}\n"]}
|
|
@@ -11,13 +11,18 @@ import { _getRunsOperations } from "./classic/runs/index.js";
|
|
|
11
11
|
import { _getMessagesOperations } from "./classic/messages/index.js";
|
|
12
12
|
import { _getThreadsOperations } from "./classic/threads/index.js";
|
|
13
13
|
export class AgentsClient {
|
|
14
|
+
_client;
|
|
15
|
+
/** The pipeline used by this client to make requests */
|
|
16
|
+
pipeline;
|
|
14
17
|
constructor(endpointParam, credential, options = {}) {
|
|
15
|
-
|
|
16
|
-
const prefixFromOptions = (_a = options === null || options === void 0 ? void 0 : options.userAgentOptions) === null || _a === void 0 ? void 0 : _a.userAgentPrefix;
|
|
18
|
+
const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix;
|
|
17
19
|
const userAgentPrefix = prefixFromOptions
|
|
18
20
|
? `${prefixFromOptions} azsdk-js-client`
|
|
19
21
|
: `azsdk-js-client`;
|
|
20
|
-
this._client = createAgents(endpointParam, credential,
|
|
22
|
+
this._client = createAgents(endpointParam, credential, {
|
|
23
|
+
...options,
|
|
24
|
+
userAgentOptions: { userAgentPrefix },
|
|
25
|
+
});
|
|
21
26
|
this.pipeline = this._client.pipeline;
|
|
22
27
|
this.vectorStoreFileBatches = _getVectorStoreFileBatchesOperations(this._client);
|
|
23
28
|
this.vectorStoreFiles = _getVectorStoreFilesOperations(this._client);
|
|
@@ -28,6 +33,22 @@ export class AgentsClient {
|
|
|
28
33
|
this.messages = _getMessagesOperations(this._client);
|
|
29
34
|
this.threads = _getThreadsOperations(this._client);
|
|
30
35
|
}
|
|
36
|
+
/** The operation groups for vectorStoreFileBatches */
|
|
37
|
+
vectorStoreFileBatches;
|
|
38
|
+
/** The operation groups for vectorStoreFiles */
|
|
39
|
+
vectorStoreFiles;
|
|
40
|
+
/** The operation groups for vectorStores */
|
|
41
|
+
vectorStores;
|
|
42
|
+
/** The operation groups for files */
|
|
43
|
+
files;
|
|
44
|
+
/** The operation groups for runSteps */
|
|
45
|
+
runSteps;
|
|
46
|
+
/** The operation groups for runs */
|
|
47
|
+
runs;
|
|
48
|
+
/** The operation groups for messages */
|
|
49
|
+
messages;
|
|
50
|
+
/** The operation groups for threads */
|
|
51
|
+
threads;
|
|
31
52
|
/** Deletes an agent. */
|
|
32
53
|
deleteAgent(assistantId, options = { requestOptions: {} }) {
|
|
33
54
|
return deleteAgent(this._client, assistantId, options);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agentsClient.js","sourceRoot":"","sources":["../../src/agentsClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAS9C,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAA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C;IACpB,IAAI,CAAiB;IACrC,wCAAwC;IACxB,QAAQ,CAAqB;IAC7C,uCAAuC;IACvB,OAAO,CAAoB;IAE3C,wBAAwB;IACxB,WAAW,CACT,WAAmB,EACnB,UAAqC,EAAE,cAAc,EAAE,EAAE,EAAE;QAE3D,OAAO,WAAW,CAAC,IAAI,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;IACzD,CAAC;IAED,kCAAkC;IAClC,WAAW,CACT,WAAmB,EACnB,UAAqC,EAAE,cAAc,EAAE,EAAE,EAAE;QAE3D,OAAO,WAAW,CAAC,IAAI,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;IACzD,CAAC;IAED,mCAAmC;IACnC,QAAQ,CACN,WAAmB,EACnB,UAAkC,EAAE,cAAc,EAAE,EAAE,EAAE;QAExD,OAAO,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;IACtD,CAAC;IAED,0DAA0D;IAC1D,UAAU,CACR,UAAoC,EAAE,cAAc,EAAE,EAAE,EAAE;QAE1D,OAAO,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC3C,CAAC;IAED,2BAA2B;IAC3B,WAAW,CACT,KAAa,EACb,UAAqC,EAAE,cAAc,EAAE,EAAE,EAAE;QAE3D,OAAO,WAAW,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IACnD,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AgentsContext, AgentsClientOptionalParams } from \"./api/index.js\";\nimport { createAgents } from \"./api/index.js\";\nimport type { Agent, AgentDeletionStatus } from \"./models/models.js\";\nimport type {\n DeleteAgentOptionalParams,\n UpdateAgentOptionalParams,\n GetAgentOptionalParams,\n ListAgentsOptionalParams,\n CreateAgentOptionalParams,\n} from \"./api/options.js\";\nimport { deleteAgent, updateAgent, getAgent, listAgents, createAgent } from \"./api/operations.js\";\nimport type { VectorStoreFileBatchesOperations } from \"./classic/vectorStoreFileBatches/index.js\";\nimport { _getVectorStoreFileBatchesOperations } from \"./classic/vectorStoreFileBatches/index.js\";\nimport type { VectorStoreFilesOperations } from \"./classic/vectorStoreFiles/index.js\";\nimport { _getVectorStoreFilesOperations } from \"./classic/vectorStoreFiles/index.js\";\nimport type { VectorStoresOperations } from \"./classic/vectorStores/index.js\";\nimport { _getVectorStoresOperations } from \"./classic/vectorStores/index.js\";\nimport type { FilesOperations } from \"./classic/files/index.js\";\nimport { _getFilesOperations } from \"./classic/files/index.js\";\nimport type { RunStepsOperations } from \"./classic/runSteps/index.js\";\nimport { _getRunStepsOperations } from \"./classic/runSteps/index.js\";\nimport type { RunsOperations } from \"./classic/runs/index.js\";\nimport { _getRunsOperations } from \"./classic/runs/index.js\";\nimport type { MessagesOperations } from \"./classic/messages/index.js\";\nimport { _getMessagesOperations } from \"./classic/messages/index.js\";\nimport type { ThreadsOperations } from \"./classic/threads/index.js\";\nimport { _getThreadsOperations } from \"./classic/threads/index.js\";\nimport type { PagedAsyncIterableIterator } from \"./static-helpers/pagingHelpers.js\";\nimport type { Pipeline } from \"@azure/core-rest-pipeline\";\nimport type { TokenCredential } from \"@azure/core-auth\";\n\nexport { AgentsClientOptionalParams } from \"./api/agentsContext.js\";\n\nexport class AgentsClient {\n private _client: AgentsContext;\n /** The pipeline used by this client to make requests */\n public readonly pipeline: Pipeline;\n\n constructor(\n endpointParam: string,\n credential: TokenCredential,\n options: AgentsClientOptionalParams = {},\n ) {\n const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix;\n const userAgentPrefix = prefixFromOptions\n ? `${prefixFromOptions} azsdk-js-client`\n : `azsdk-js-client`;\n this._client = createAgents(endpointParam, credential, {\n ...options,\n userAgentOptions: { userAgentPrefix },\n });\n this.pipeline = this._client.pipeline;\n this.vectorStoreFileBatches = _getVectorStoreFileBatchesOperations(this._client);\n this.vectorStoreFiles = _getVectorStoreFilesOperations(this._client);\n this.vectorStores = _getVectorStoresOperations(this._client);\n this.files = _getFilesOperations(this._client);\n this.runSteps = _getRunStepsOperations(this._client);\n this.runs = _getRunsOperations(this._client);\n this.messages = _getMessagesOperations(this._client);\n this.threads = _getThreadsOperations(this._client);\n }\n\n /** The operation groups for vectorStoreFileBatches */\n public readonly vectorStoreFileBatches: VectorStoreFileBatchesOperations;\n /** The operation groups for vectorStoreFiles */\n public readonly vectorStoreFiles: VectorStoreFilesOperations;\n /** The operation groups for vectorStores */\n public readonly vectorStores: VectorStoresOperations;\n /** The operation groups for files */\n public readonly files: FilesOperations;\n /** The operation groups for runSteps */\n public readonly runSteps: RunStepsOperations;\n /** The operation groups for runs */\n public readonly runs: RunsOperations;\n /** The operation groups for messages */\n public readonly messages: MessagesOperations;\n /** The operation groups for threads */\n public readonly threads: ThreadsOperations;\n\n /** Deletes an agent. */\n deleteAgent(\n assistantId: string,\n options: DeleteAgentOptionalParams = { requestOptions: {} },\n ): Promise<AgentDeletionStatus> {\n return deleteAgent(this._client, assistantId, options);\n }\n\n /** Modifies an existing agent. */\n updateAgent(\n assistantId: string,\n options: UpdateAgentOptionalParams = { requestOptions: {} },\n ): Promise<Agent> {\n return updateAgent(this._client, assistantId, options);\n }\n\n /** Retrieves an existing agent. */\n getAgent(\n assistantId: string,\n options: GetAgentOptionalParams = { requestOptions: {} },\n ): Promise<Agent> {\n return getAgent(this._client, assistantId, options);\n }\n\n /** Gets a list of agents that were previously created. */\n listAgents(\n options: ListAgentsOptionalParams = { requestOptions: {} },\n ): PagedAsyncIterableIterator<Agent> {\n return listAgents(this._client, options);\n }\n\n /** Creates a new agent. */\n createAgent(\n model: string,\n options: CreateAgentOptionalParams = { requestOptions: {} },\n ): Promise<Agent> {\n return createAgent(this._client, model, options);\n }\n}\n"]}
|
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
|
-
import { __rest } from "tslib";
|
|
4
3
|
import { logger } from "../logger.js";
|
|
5
4
|
import { getClient } from "@azure-rest/core-client";
|
|
6
5
|
export function createAgents(endpointParam, credential, options = {}) {
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const userAgentInfo = `azsdk-js-ai-agents/1.0.0`;
|
|
6
|
+
const endpointUrl = options.endpoint ?? options.baseUrl ?? String(endpointParam);
|
|
7
|
+
const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix;
|
|
8
|
+
const userAgentInfo = `azsdk-js-ai-agents/1.1.0-beta.1`;
|
|
11
9
|
const userAgentPrefix = prefixFromOptions
|
|
12
10
|
? `${prefixFromOptions} azsdk-js-api ${userAgentInfo}`
|
|
13
11
|
: `azsdk-js-api ${userAgentInfo}`;
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
const { apiVersion: _, ...updatedOptions } = {
|
|
13
|
+
...options,
|
|
14
|
+
userAgentOptions: { userAgentPrefix },
|
|
15
|
+
loggingOptions: { logger: options.loggingOptions?.logger ?? logger.info },
|
|
16
|
+
credentials: {
|
|
17
|
+
scopes: options.credentials?.scopes ?? ["https://ai.azure.com/.default"],
|
|
18
|
+
},
|
|
19
|
+
};
|
|
17
20
|
const clientContext = getClient(endpointUrl, credential, updatedOptions);
|
|
18
21
|
clientContext.pipeline.removePolicy({ name: "ApiVersionPolicy" });
|
|
19
|
-
const apiVersion =
|
|
22
|
+
const apiVersion = options.apiVersion ?? "2025-05-15-preview";
|
|
20
23
|
clientContext.pipeline.addPolicy({
|
|
21
24
|
name: "ClientApiVersionPolicy",
|
|
22
25
|
sendRequest: (req, next) => {
|
|
@@ -29,6 +32,6 @@ export function createAgents(endpointParam, credential, options = {}) {
|
|
|
29
32
|
return next(req);
|
|
30
33
|
},
|
|
31
34
|
});
|
|
32
|
-
return
|
|
35
|
+
return { ...clientContext, apiVersion };
|
|
33
36
|
}
|
|
34
37
|
//# sourceMappingURL=agentsContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agentsContext.js","sourceRoot":"","sources":["../../../src/api/agentsContext.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC
|
|
1
|
+
{"version":3,"file":"agentsContext.js","sourceRoot":"","sources":["../../../src/api/agentsContext.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAyB,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAgB3E,MAAM,UAAU,YAAY,CAC1B,aAAqB,EACrB,UAA2B,EAC3B,UAAsC,EAAE;IAExC,MAAM,WAAW,GAAG,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,OAAO,IAAI,MAAM,CAAC,aAAa,CAAC,CAAC;IACjF,MAAM,iBAAiB,GAAG,OAAO,EAAE,gBAAgB,EAAE,eAAe,CAAC;IACrE,MAAM,aAAa,GAAG,iCAAiC,CAAC;IACxD,MAAM,eAAe,GAAG,iBAAiB;QACvC,CAAC,CAAC,GAAG,iBAAiB,iBAAiB,aAAa,EAAE;QACtD,CAAC,CAAC,gBAAgB,aAAa,EAAE,CAAC;IACpC,MAAM,EAAE,UAAU,EAAE,CAAC,EAAE,GAAG,cAAc,EAAE,GAAG;QAC3C,GAAG,OAAO;QACV,gBAAgB,EAAE,EAAE,eAAe,EAAE;QACrC,cAAc,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,cAAc,EAAE,MAAM,IAAI,MAAM,CAAC,IAAI,EAAE;QACzE,WAAW,EAAE;YACX,MAAM,EAAE,OAAO,CAAC,WAAW,EAAE,MAAM,IAAI,CAAC,+BAA+B,CAAC;SACzE;KACF,CAAC;IACF,MAAM,aAAa,GAAG,SAAS,CAAC,WAAW,EAAE,UAAU,EAAE,cAAc,CAAC,CAAC;IACzE,aAAa,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,CAAC,CAAC;IAClE,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,oBAAoB,CAAC;IAC9D,aAAa,CAAC,QAAQ,CAAC,SAAS,CAAC;QAC/B,IAAI,EAAE,wBAAwB;QAC9B,WAAW,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;YACzB,qDAAqD;YACrD,yEAAyE;YACzE,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAC7B,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,CAAC;gBACzC,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,GAAG,GAClB,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GACzD,eAAe,UAAU,EAAE,CAAC;YAC9B,CAAC;YAED,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;KACF,CAAC,CAAC;IACH,OAAO,EAAE,GAAG,aAAa,EAAE,UAAU,EAAmB,CAAC;AAC3D,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { logger } from \"../logger.js\";\nimport { KnownVersions } from \"../models/models.js\";\nimport { Client, ClientOptions, getClient } from \"@azure-rest/core-client\";\nimport { TokenCredential } from \"@azure/core-auth\";\n\nexport interface AgentsContext extends Client {\n /** The API version to use for this operation. */\n /** Known values of {@link KnownVersions} that the service accepts. */\n apiVersion: string;\n}\n\n/** Optional parameters for the client. */\nexport interface AgentsClientOptionalParams extends ClientOptions {\n /** The API version to use for this operation. */\n /** Known values of {@link KnownVersions} that the service accepts. */\n apiVersion?: string;\n}\n\nexport function createAgents(\n endpointParam: string,\n credential: TokenCredential,\n options: AgentsClientOptionalParams = {},\n): AgentsContext {\n const endpointUrl = options.endpoint ?? options.baseUrl ?? String(endpointParam);\n const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix;\n const userAgentInfo = `azsdk-js-ai-agents/1.1.0-beta.1`;\n const userAgentPrefix = prefixFromOptions\n ? `${prefixFromOptions} azsdk-js-api ${userAgentInfo}`\n : `azsdk-js-api ${userAgentInfo}`;\n const { apiVersion: _, ...updatedOptions } = {\n ...options,\n userAgentOptions: { userAgentPrefix },\n loggingOptions: { logger: options.loggingOptions?.logger ?? logger.info },\n credentials: {\n scopes: options.credentials?.scopes ?? [\"https://ai.azure.com/.default\"],\n },\n };\n const clientContext = getClient(endpointUrl, credential, updatedOptions);\n clientContext.pipeline.removePolicy({ name: \"ApiVersionPolicy\" });\n const apiVersion = options.apiVersion ?? \"2025-05-15-preview\";\n clientContext.pipeline.addPolicy({\n name: \"ClientApiVersionPolicy\",\n sendRequest: (req, next) => {\n // Use the apiVersion defined in request url directly\n // Append one if there is no apiVersion and we have one at client options\n const url = new URL(req.url);\n if (!url.searchParams.get(\"api-version\")) {\n req.url = `${req.url}${\n Array.from(url.searchParams.keys()).length > 0 ? \"&\" : \"?\"\n }api-version=${apiVersion}`;\n }\n\n return next(req);\n },\n });\n return { ...clientContext, apiVersion } as AgentsContext;\n}\n"]}
|
|
@@ -5,14 +5,19 @@ import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js";
|
|
|
5
5
|
import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client";
|
|
6
6
|
import { createPoller } from "../poller.js";
|
|
7
7
|
export function _getFileContentSend(context, fileId, options = { requestOptions: {} }) {
|
|
8
|
-
|
|
9
|
-
const path = expandUrlTemplate("/files/{fileId}/content{?api%2Dversion}", {
|
|
8
|
+
const path = expandUrlTemplate("/files/{fileId}/content{?api-version}", {
|
|
10
9
|
fileId: fileId,
|
|
11
|
-
"api
|
|
10
|
+
"api-version": context.apiVersion,
|
|
12
11
|
}, {
|
|
13
|
-
allowReserved:
|
|
12
|
+
allowReserved: options?.requestOptions?.skipUrlEncoding,
|
|
13
|
+
});
|
|
14
|
+
return context.path(path).get({
|
|
15
|
+
...operationOptionsToRequestParameters(options),
|
|
16
|
+
headers: {
|
|
17
|
+
accept: "application/octet-stream",
|
|
18
|
+
...options.requestOptions?.headers,
|
|
19
|
+
},
|
|
14
20
|
});
|
|
15
|
-
return context.path(path).get(Object.assign(Object.assign({}, operationOptionsToRequestParameters(options)), { headers: Object.assign({ accept: "application/octet-stream" }, (_b = options.requestOptions) === null || _b === void 0 ? void 0 : _b.headers) }));
|
|
16
21
|
}
|
|
17
22
|
/** Retrieves the raw content of a specific file. */
|
|
18
23
|
export function getFileContent(context, fileId, options = { requestOptions: {} }) {
|
|
@@ -20,14 +25,19 @@ export function getFileContent(context, fileId, options = { requestOptions: {} }
|
|
|
20
25
|
return result;
|
|
21
26
|
}
|
|
22
27
|
export function _getFileSend(context, fileId, options = { requestOptions: {} }) {
|
|
23
|
-
|
|
24
|
-
const path = expandUrlTemplate("/files/{fileId}{?api%2Dversion}", {
|
|
28
|
+
const path = expandUrlTemplate("/files/{fileId}{?api-version}", {
|
|
25
29
|
fileId: fileId,
|
|
26
|
-
"api
|
|
30
|
+
"api-version": context.apiVersion,
|
|
27
31
|
}, {
|
|
28
|
-
allowReserved:
|
|
32
|
+
allowReserved: options?.requestOptions?.skipUrlEncoding,
|
|
33
|
+
});
|
|
34
|
+
return context.path(path).get({
|
|
35
|
+
...operationOptionsToRequestParameters(options),
|
|
36
|
+
headers: {
|
|
37
|
+
accept: "application/json",
|
|
38
|
+
...options.requestOptions?.headers,
|
|
39
|
+
},
|
|
29
40
|
});
|
|
30
|
-
return context.path(path).get(Object.assign(Object.assign({}, operationOptionsToRequestParameters(options)), { headers: Object.assign({ accept: "application/json" }, (_b = options.requestOptions) === null || _b === void 0 ? void 0 : _b.headers) }));
|
|
31
41
|
}
|
|
32
42
|
export async function _getFileDeserialize(result) {
|
|
33
43
|
const expectedStatuses = ["200"];
|
|
@@ -44,14 +54,19 @@ export async function getFile(context, fileId, options = { requestOptions: {} })
|
|
|
44
54
|
return _getFileDeserialize(result);
|
|
45
55
|
}
|
|
46
56
|
export function _deleteFileSend(context, fileId, options = { requestOptions: {} }) {
|
|
47
|
-
var _a, _b;
|
|
48
57
|
const path = expandUrlTemplate("/files/{fileId}{?api%2Dversion}", {
|
|
49
58
|
fileId: fileId,
|
|
50
59
|
"api%2Dversion": context.apiVersion,
|
|
51
60
|
}, {
|
|
52
|
-
allowReserved:
|
|
61
|
+
allowReserved: options?.requestOptions?.skipUrlEncoding,
|
|
62
|
+
});
|
|
63
|
+
return context.path(path).delete({
|
|
64
|
+
...operationOptionsToRequestParameters(options),
|
|
65
|
+
headers: {
|
|
66
|
+
accept: "application/json",
|
|
67
|
+
...options.requestOptions?.headers,
|
|
68
|
+
},
|
|
53
69
|
});
|
|
54
|
-
return context.path(path).delete(Object.assign(Object.assign({}, operationOptionsToRequestParameters(options)), { headers: Object.assign({ accept: "application/json" }, (_b = options.requestOptions) === null || _b === void 0 ? void 0 : _b.headers) }));
|
|
55
70
|
}
|
|
56
71
|
export async function _deleteFileDeserialize(result) {
|
|
57
72
|
const expectedStatuses = ["200"];
|
|
@@ -68,13 +83,20 @@ export async function deleteFile(context, fileId, options = { requestOptions: {}
|
|
|
68
83
|
return _deleteFileDeserialize(result);
|
|
69
84
|
}
|
|
70
85
|
export function _uploadFileSend(context, body, options = { requestOptions: {} }) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
"api%2Dversion": context.apiVersion,
|
|
86
|
+
const path = expandUrlTemplate("/files{?api-version}", {
|
|
87
|
+
"api-version": context.apiVersion,
|
|
74
88
|
}, {
|
|
75
|
-
allowReserved:
|
|
89
|
+
allowReserved: options?.requestOptions?.skipUrlEncoding,
|
|
90
|
+
});
|
|
91
|
+
return context.path(path).post({
|
|
92
|
+
...operationOptionsToRequestParameters(options),
|
|
93
|
+
contentType: "multipart/form-data",
|
|
94
|
+
headers: {
|
|
95
|
+
accept: "application/json",
|
|
96
|
+
...options.requestOptions?.headers,
|
|
97
|
+
},
|
|
98
|
+
body: _uploadFileRequestSerializer(body),
|
|
76
99
|
});
|
|
77
|
-
return context.path(path).post(Object.assign(Object.assign({}, operationOptionsToRequestParameters(options)), { contentType: "multipart/form-data", headers: Object.assign({ accept: "application/json" }, (_b = options.requestOptions) === null || _b === void 0 ? void 0 : _b.headers), body: _uploadFileRequestSerializer(body) }));
|
|
78
100
|
}
|
|
79
101
|
export async function _uploadFileDeserialize(result) {
|
|
80
102
|
const expectedStatuses = ["200"];
|
|
@@ -92,7 +114,6 @@ export async function uploadFileInternal(context, body, options = { requestOptio
|
|
|
92
114
|
}
|
|
93
115
|
/** Uploads a file for use by other operations. */
|
|
94
116
|
export function uploadFile(context, body, options = { requestOptions: {} }) {
|
|
95
|
-
var _a;
|
|
96
117
|
return createPoller({
|
|
97
118
|
initOperation: async () => {
|
|
98
119
|
return uploadFileInternal(context, body, options);
|
|
@@ -106,12 +127,11 @@ export function uploadFile(context, body, options = { requestOptions: {} }) {
|
|
|
106
127
|
? new Error(`Operation failed: ${result.statusDetails}`)
|
|
107
128
|
: undefined;
|
|
108
129
|
},
|
|
109
|
-
intervalInMs:
|
|
130
|
+
intervalInMs: options.pollingOptions?.intervalInMs,
|
|
110
131
|
});
|
|
111
132
|
}
|
|
112
133
|
/** Uploads a file for use by other operations with polling */
|
|
113
134
|
export function uploadFileAndPoll(context, body, options = { requestOptions: {} }) {
|
|
114
|
-
var _a;
|
|
115
135
|
return createPoller({
|
|
116
136
|
initOperation: async () => {
|
|
117
137
|
return uploadFileInternal(context, body, options);
|
|
@@ -125,18 +145,23 @@ export function uploadFileAndPoll(context, body, options = { requestOptions: {}
|
|
|
125
145
|
? new Error(`Operation failed: ${result.statusDetails}`)
|
|
126
146
|
: undefined;
|
|
127
147
|
},
|
|
128
|
-
intervalInMs:
|
|
148
|
+
intervalInMs: options.pollingOptions?.intervalInMs,
|
|
129
149
|
});
|
|
130
150
|
}
|
|
131
151
|
export function _listFilesSend(context, options = { requestOptions: {} }) {
|
|
132
|
-
var _a, _b;
|
|
133
152
|
const path = expandUrlTemplate("/files{?api%2Dversion,purpose}", {
|
|
134
153
|
"api%2Dversion": context.apiVersion,
|
|
135
|
-
purpose: options
|
|
154
|
+
purpose: options?.purpose,
|
|
136
155
|
}, {
|
|
137
|
-
allowReserved:
|
|
156
|
+
allowReserved: options?.requestOptions?.skipUrlEncoding,
|
|
157
|
+
});
|
|
158
|
+
return context.path(path).get({
|
|
159
|
+
...operationOptionsToRequestParameters(options),
|
|
160
|
+
headers: {
|
|
161
|
+
accept: "application/json",
|
|
162
|
+
...options.requestOptions?.headers,
|
|
163
|
+
},
|
|
138
164
|
});
|
|
139
|
-
return context.path(path).get(Object.assign(Object.assign({}, operationOptionsToRequestParameters(options)), { headers: Object.assign({ accept: "application/json" }, (_b = options.requestOptions) === null || _b === void 0 ? void 0 : _b.headers) }));
|
|
140
165
|
}
|
|
141
166
|
export async function _listFilesDeserialize(result) {
|
|
142
167
|
const expectedStatuses = ["200"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations.js","sourceRoot":"","sources":["../../../../src/api/files/operations.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AASlC,OAAO,EACL,wBAAwB,EACxB,4BAA4B,EAC5B,oBAAoB,EACpB,4BAA4B,EAC5B,8BAA8B,GAC/B,MAAM,wBAAwB,CAAC;AAQhC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAExE,OAAO,EAAE,eAAe,EAAE,mCAAmC,EAAE,MAAM,yBAAyB,CAAC;AAE/F,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,MAAM,UAAU,mBAAmB,CACjC,OAAe,EACf,MAAc,EACd,UAA6C,EAAE,cAAc,EAAE,EAAE,EAAE;;IAEnE,MAAM,IAAI,GAAG,iBAAiB,CAC5B,yCAAyC,EACzC;QACE,MAAM,EAAE,MAAM;QACd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AO,KAEpC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,MAA6B;IAE7B,MAAM,gBAAgB,GAAG,CAAC,KAAK,CAAC,CAAC;IACjC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;QAC9C,MAAM,KAAK,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;QACtC,KAAK,CAAC,OAAO,GAAG,wBAAwB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACtD,MAAM,KAAK,CAAC;IACd,CAAC;IAED,OAAO,4BAA4B,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACnD,CAAC;AAED,gDAAgD;AAChD,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,OAAe,EACf,UAAwC,EAAE,cAAc,EAAE,EAAE,EAAE;IAE9D,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACtD,OAAO,qBAAqB,CAAC,MAAM,CAAC,CAAC;AACvC,CAAC;AAED,SAAS,qBAAqB,CAAC,MAAgB;IAC7C,QAAQ,MAAM,CAAC,MAAM,EAAE,CAAC;QACtB,KAAK,SAAS,CAAC;QACf,KAAK,SAAS;YACZ,OAAO,SAAS,CAAC;QACnB,KAAK,UAAU,CAAC;QAChB,KAAK,WAAW;YACd,OAAO,WAAW,CAAC;QACrB;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 {\n FileListResponse,\n FileInfo,\n FilePurpose,\n FileDeletionStatus,\n} from \"../../models/models.js\";\nimport {\n agentV1ErrorDeserializer,\n fileListResponseDeserializer,\n fileInfoDeserializer,\n _uploadFileRequestSerializer,\n fileDeletionStatusDeserializer,\n} from \"../../models/models.js\";\nimport type {\n FilesGetFileContentOptionalParams,\n FilesGetFileOptionalParams,\n FilesDeleteFileOptionalParams,\n FilesUploadFileOptionalParams,\n FilesListFilesOptionalParams,\n} from \"./options.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 { OperationState, OperationStatus, PollerLike } from \"@azure/core-lro\";\nimport { createPoller } from \"../poller.js\";\n\nexport function _getFileContentSend(\n context: Client,\n fileId: string,\n options: FilesGetFileContentOptionalParams = { requestOptions: {} },\n): StreamableMethod<string | Uint8Array> {\n const path = expandUrlTemplate(\n \"/files/{fileId}/content{?api%2Dversion}\",\n {\n fileId: fileId,\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/octet-stream\",\n ...options.requestOptions?.headers,\n },\n });\n}\n\n/** Retrieves the raw content of a specific file. */\nexport function getFileContent(\n context: Client,\n fileId: string,\n options: FilesGetFileContentOptionalParams = { requestOptions: {} },\n): StreamableMethod<string | Uint8Array> {\n const result = _getFileContentSend(context, fileId, options);\n return result;\n}\n\nexport function _getFileSend(\n context: Client,\n fileId: string,\n options: FilesGetFileOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/files/{fileId}{?api%2Dversion}\",\n {\n fileId: fileId,\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 _getFileDeserialize(result: PathUncheckedResponse): Promise<FileInfo> {\n const expectedStatuses = [\"200\"];\n if (!expectedStatuses.includes(result.status)) {\n const error = createRestError(result);\n error.details = agentV1ErrorDeserializer(result.body);\n throw error;\n }\n\n return fileInfoDeserializer(result.body);\n}\n\n/** Returns information about a specific file. Does not retrieve file content. */\nexport async function getFile(\n context: Client,\n fileId: string,\n options: FilesGetFileOptionalParams = { requestOptions: {} },\n): Promise<FileInfo> {\n const result = await _getFileSend(context, fileId, options);\n return _getFileDeserialize(result);\n}\n\nexport function _deleteFileSend(\n context: Client,\n fileId: string,\n options: FilesDeleteFileOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/files/{fileId}{?api%2Dversion}\",\n {\n fileId: fileId,\n \"api%2Dversion\": context.apiVersion,\n },\n {\n allowReserved: options?.requestOptions?.skipUrlEncoding,\n },\n );\n return context.path(path).delete({\n ...operationOptionsToRequestParameters(options),\n headers: {\n accept: \"application/json\",\n ...options.requestOptions?.headers,\n },\n });\n}\n\nexport async function _deleteFileDeserialize(\n result: PathUncheckedResponse,\n): Promise<FileDeletionStatus> {\n const expectedStatuses = [\"200\"];\n if (!expectedStatuses.includes(result.status)) {\n const error = createRestError(result);\n error.details = agentV1ErrorDeserializer(result.body);\n throw error;\n }\n\n return fileDeletionStatusDeserializer(result.body);\n}\n\n/** Delete a previously uploaded file. */\nexport async function deleteFile(\n context: Client,\n fileId: string,\n options: FilesDeleteFileOptionalParams = { requestOptions: {} },\n): Promise<FileDeletionStatus> {\n const result = await _deleteFileSend(context, fileId, options);\n return _deleteFileDeserialize(result);\n}\n\nexport function _uploadFileSend(\n context: Client,\n body: {\n file: ReadableStream<Uint8Array> | NodeJS.ReadableStream;\n purpose: FilePurpose;\n filename?: string;\n },\n options: FilesUploadFileOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/files{?api%2Dversion}\",\n {\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: \"multipart/form-data\",\n headers: {\n accept: \"application/json\",\n ...options.requestOptions?.headers,\n },\n body: _uploadFileRequestSerializer(body),\n });\n}\n\nexport async function _uploadFileDeserialize(result: PathUncheckedResponse): Promise<FileInfo> {\n const expectedStatuses = [\"200\"];\n if (!expectedStatuses.includes(result.status)) {\n const error = createRestError(result);\n error.details = agentV1ErrorDeserializer(result.body);\n throw error;\n }\n\n return fileInfoDeserializer(result.body);\n}\n\n/** Uploads a file for use by other operations. */\nexport async function uploadFileInternal(\n context: Client,\n body: {\n file: ReadableStream<Uint8Array> | NodeJS.ReadableStream;\n purpose: FilePurpose;\n filename?: string;\n },\n options: FilesUploadFileOptionalParams = { requestOptions: {} },\n): Promise<FileInfo> {\n const result = await _uploadFileSend(context, body, options);\n return _uploadFileDeserialize(result);\n}\n\n/** Uploads a file for use by other operations. */\nexport function uploadFile(\n context: Client,\n body: {\n file: ReadableStream<Uint8Array> | NodeJS.ReadableStream;\n purpose: FilePurpose;\n filename?: string;\n },\n options: FilesUploadFileOptionalParams = { requestOptions: {} },\n): PollerLike<OperationState<FileInfo>, FileInfo> {\n return createPoller<FileInfo>({\n initOperation: async () => {\n return uploadFileInternal(context, body, options);\n },\n pollOperation: async (currentResult: FileInfo) => {\n return getFile(context, currentResult.id, options);\n },\n getOperationStatus: getLroOperationStatus,\n getOperationError: (result: FileInfo) => {\n return getLroOperationStatus(result) === \"failed\" && result.statusDetails\n ? new Error(`Operation failed: ${result.statusDetails}`)\n : undefined;\n },\n intervalInMs: options.pollingOptions?.intervalInMs,\n });\n}\n\n/** Uploads a file for use by other operations with polling */\nexport function uploadFileAndPoll(\n context: Client,\n body: {\n file: ReadableStream<Uint8Array> | NodeJS.ReadableStream;\n purpose: FilePurpose;\n filename?: string;\n },\n options: FilesUploadFileOptionalParams = { requestOptions: {} },\n): PollerLike<OperationState<FileInfo>, FileInfo> {\n return createPoller<FileInfo>({\n initOperation: async () => {\n return uploadFileInternal(context, body, options);\n },\n pollOperation: async (currentResult: FileInfo) => {\n return getFile(context, currentResult.id, options);\n },\n getOperationStatus: getLroOperationStatus,\n getOperationError: (result: FileInfo) => {\n return getLroOperationStatus(result) === \"failed\" && result.statusDetails\n ? new Error(`Operation failed: ${result.statusDetails}`)\n : undefined;\n },\n intervalInMs: options.pollingOptions?.intervalInMs,\n });\n}\n\nexport function _listFilesSend(\n context: Client,\n options: FilesListFilesOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/files{?api%2Dversion,purpose}\",\n {\n \"api%2Dversion\": context.apiVersion,\n purpose: options?.purpose,\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 _listFilesDeserialize(\n result: PathUncheckedResponse,\n): Promise<FileListResponse> {\n const expectedStatuses = [\"200\"];\n if (!expectedStatuses.includes(result.status)) {\n const error = createRestError(result);\n error.details = agentV1ErrorDeserializer(result.body);\n throw error;\n }\n\n return fileListResponseDeserializer(result.body);\n}\n\n/** Gets a list of previously uploaded files. */\nexport async function listFiles(\n context: Client,\n options: FilesListFilesOptionalParams = { requestOptions: {} },\n): Promise<FileListResponse> {\n const result = await _listFilesSend(context, options);\n return _listFilesDeserialize(result);\n}\n\nfunction getLroOperationStatus(result: FileInfo): OperationStatus {\n switch (result.status) {\n case \"running\":\n case \"pending\":\n return \"running\";\n case \"uploaded\":\n case \"processed\":\n return \"succeeded\";\n default:\n return \"failed\";\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"operations.js","sourceRoot":"","sources":["../../../../src/api/files/operations.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AASlC,OAAO,EACL,wBAAwB,EACxB,4BAA4B,EAC5B,oBAAoB,EACpB,4BAA4B,EAC5B,8BAA8B,GAC/B,MAAM,wBAAwB,CAAC;AAQhC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAExE,OAAO,EAA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OAAO,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC;QAC5B,GAAG,mCAAmC,CAAC,OAAO,CAAC;QAC/C,OAAO,EAAE;YACP,MAAM,EAAE,kBAAkB;YAC1B,GAAG,OAAO,CAAC,cAAc,EAAE,OAAO;SACnC;KACF,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,MAA6B;IAE7B,MAAM,gBAAgB,GAAG,CAAC,KAAK,CAAC,CAAC;IACjC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;QAC9C,MAAM,KAAK,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;QACtC,KAAK,CAAC,OAAO,GAAG,wBAAwB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACtD,MAAM,KAAK,CAAC;IACd,CAAC;IAED,OAAO,4BAA4B,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACnD,CAAC;AAED,gDAAgD;AAChD,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,OAAe,EACf,UAAwC,EAAE,cAAc,EAAE,EAAE,EAAE;IAE9D,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACtD,OAAO,qBAAqB,CAAC,MAAM,CAAC,CAAC;AACvC,CAAC;AAED,SAAS,qBAAqB,CAAC,MAAgB;IAC7C,QAAQ,MAAM,CAAC,MAAM,EAAE,CAAC;QACtB,KAAK,SAAS,CAAC;QACf,KAAK,SAAS;YACZ,OAAO,SAAS,CAAC;QACnB,KAAK,UAAU,CAAC;QAChB,KAAK,WAAW;YACd,OAAO,WAAW,CAAC;QACrB;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 {\n FileListResponse,\n FileInfo,\n FilePurpose,\n FileDeletionStatus,\n} from \"../../models/models.js\";\nimport {\n agentV1ErrorDeserializer,\n fileListResponseDeserializer,\n fileInfoDeserializer,\n _uploadFileRequestSerializer,\n fileDeletionStatusDeserializer,\n} from \"../../models/models.js\";\nimport type {\n FilesGetFileContentOptionalParams,\n FilesGetFileOptionalParams,\n FilesDeleteFileOptionalParams,\n FilesUploadFileOptionalParams,\n FilesListFilesOptionalParams,\n} from \"./options.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 { OperationState, OperationStatus, PollerLike } from \"@azure/core-lro\";\nimport { createPoller } from \"../poller.js\";\n\nexport function _getFileContentSend(\n context: Client,\n fileId: string,\n options: FilesGetFileContentOptionalParams = { requestOptions: {} },\n): StreamableMethod<string | Uint8Array> {\n const path = expandUrlTemplate(\n \"/files/{fileId}/content{?api-version}\",\n {\n fileId: fileId,\n \"api-version\": 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/octet-stream\",\n ...options.requestOptions?.headers,\n },\n });\n}\n\n/** Retrieves the raw content of a specific file. */\nexport function getFileContent(\n context: Client,\n fileId: string,\n options: FilesGetFileContentOptionalParams = { requestOptions: {} },\n): StreamableMethod<string | Uint8Array> {\n const result = _getFileContentSend(context, fileId, options);\n return result;\n}\n\nexport function _getFileSend(\n context: Client,\n fileId: string,\n options: FilesGetFileOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/files/{fileId}{?api-version}\",\n {\n fileId: fileId,\n \"api-version\": 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 _getFileDeserialize(result: PathUncheckedResponse): Promise<FileInfo> {\n const expectedStatuses = [\"200\"];\n if (!expectedStatuses.includes(result.status)) {\n const error = createRestError(result);\n error.details = agentV1ErrorDeserializer(result.body);\n throw error;\n }\n\n return fileInfoDeserializer(result.body);\n}\n\n/** Returns information about a specific file. Does not retrieve file content. */\nexport async function getFile(\n context: Client,\n fileId: string,\n options: FilesGetFileOptionalParams = { requestOptions: {} },\n): Promise<FileInfo> {\n const result = await _getFileSend(context, fileId, options);\n return _getFileDeserialize(result);\n}\n\nexport function _deleteFileSend(\n context: Client,\n fileId: string,\n options: FilesDeleteFileOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/files/{fileId}{?api%2Dversion}\",\n {\n fileId: fileId,\n \"api%2Dversion\": context.apiVersion,\n },\n {\n allowReserved: options?.requestOptions?.skipUrlEncoding,\n },\n );\n return context.path(path).delete({\n ...operationOptionsToRequestParameters(options),\n headers: {\n accept: \"application/json\",\n ...options.requestOptions?.headers,\n },\n });\n}\n\nexport async function _deleteFileDeserialize(\n result: PathUncheckedResponse,\n): Promise<FileDeletionStatus> {\n const expectedStatuses = [\"200\"];\n if (!expectedStatuses.includes(result.status)) {\n const error = createRestError(result);\n error.details = agentV1ErrorDeserializer(result.body);\n throw error;\n }\n\n return fileDeletionStatusDeserializer(result.body);\n}\n\n/** Delete a previously uploaded file. */\nexport async function deleteFile(\n context: Client,\n fileId: string,\n options: FilesDeleteFileOptionalParams = { requestOptions: {} },\n): Promise<FileDeletionStatus> {\n const result = await _deleteFileSend(context, fileId, options);\n return _deleteFileDeserialize(result);\n}\n\nexport function _uploadFileSend(\n context: Client,\n body: {\n file: ReadableStream<Uint8Array> | NodeJS.ReadableStream;\n purpose: FilePurpose;\n filename?: string;\n },\n options: FilesUploadFileOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/files{?api-version}\",\n {\n \"api-version\": context.apiVersion,\n },\n {\n allowReserved: options?.requestOptions?.skipUrlEncoding,\n },\n );\n return context.path(path).post({\n ...operationOptionsToRequestParameters(options),\n contentType: \"multipart/form-data\",\n headers: {\n accept: \"application/json\",\n ...options.requestOptions?.headers,\n },\n body: _uploadFileRequestSerializer(body),\n });\n}\n\nexport async function _uploadFileDeserialize(result: PathUncheckedResponse): Promise<FileInfo> {\n const expectedStatuses = [\"200\"];\n if (!expectedStatuses.includes(result.status)) {\n const error = createRestError(result);\n error.details = agentV1ErrorDeserializer(result.body);\n throw error;\n }\n\n return fileInfoDeserializer(result.body);\n}\n\n/** Uploads a file for use by other operations. */\nexport async function uploadFileInternal(\n context: Client,\n body: {\n file: ReadableStream<Uint8Array> | NodeJS.ReadableStream;\n purpose: FilePurpose;\n filename?: string;\n },\n options: FilesUploadFileOptionalParams = { requestOptions: {} },\n): Promise<FileInfo> {\n const result = await _uploadFileSend(context, body, options);\n return _uploadFileDeserialize(result);\n}\n\n/** Uploads a file for use by other operations. */\nexport function uploadFile(\n context: Client,\n body: {\n file: ReadableStream<Uint8Array> | NodeJS.ReadableStream;\n purpose: FilePurpose;\n filename?: string;\n },\n options: FilesUploadFileOptionalParams = { requestOptions: {} },\n): PollerLike<OperationState<FileInfo>, FileInfo> {\n return createPoller<FileInfo>({\n initOperation: async () => {\n return uploadFileInternal(context, body, options);\n },\n pollOperation: async (currentResult: FileInfo) => {\n return getFile(context, currentResult.id, options);\n },\n getOperationStatus: getLroOperationStatus,\n getOperationError: (result: FileInfo) => {\n return getLroOperationStatus(result) === \"failed\" && result.statusDetails\n ? new Error(`Operation failed: ${result.statusDetails}`)\n : undefined;\n },\n intervalInMs: options.pollingOptions?.intervalInMs,\n });\n}\n\n/** Uploads a file for use by other operations with polling */\nexport function uploadFileAndPoll(\n context: Client,\n body: {\n file: ReadableStream<Uint8Array> | NodeJS.ReadableStream;\n purpose: FilePurpose;\n filename?: string;\n },\n options: FilesUploadFileOptionalParams = { requestOptions: {} },\n): PollerLike<OperationState<FileInfo>, FileInfo> {\n return createPoller<FileInfo>({\n initOperation: async () => {\n return uploadFileInternal(context, body, options);\n },\n pollOperation: async (currentResult: FileInfo) => {\n return getFile(context, currentResult.id, options);\n },\n getOperationStatus: getLroOperationStatus,\n getOperationError: (result: FileInfo) => {\n return getLroOperationStatus(result) === \"failed\" && result.statusDetails\n ? new Error(`Operation failed: ${result.statusDetails}`)\n : undefined;\n },\n intervalInMs: options.pollingOptions?.intervalInMs,\n });\n}\n\nexport function _listFilesSend(\n context: Client,\n options: FilesListFilesOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/files{?api%2Dversion,purpose}\",\n {\n \"api%2Dversion\": context.apiVersion,\n purpose: options?.purpose,\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 _listFilesDeserialize(\n result: PathUncheckedResponse,\n): Promise<FileListResponse> {\n const expectedStatuses = [\"200\"];\n if (!expectedStatuses.includes(result.status)) {\n const error = createRestError(result);\n error.details = agentV1ErrorDeserializer(result.body);\n throw error;\n }\n\n return fileListResponseDeserializer(result.body);\n}\n\n/** Gets a list of previously uploaded files. */\nexport async function listFiles(\n context: Client,\n options: FilesListFilesOptionalParams = { requestOptions: {} },\n): Promise<FileListResponse> {\n const result = await _listFilesSend(context, options);\n return _listFilesDeserialize(result);\n}\n\nfunction getLroOperationStatus(result: FileInfo): OperationStatus {\n switch (result.status) {\n case \"running\":\n case \"pending\":\n return \"running\";\n case \"uploaded\":\n case \"processed\":\n return \"succeeded\";\n default:\n return \"failed\";\n }\n}\n"]}
|