@azure/ai-agents 1.1.0-beta.3 → 1.2.0-alpha.20250923.1

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.
Files changed (259) hide show
  1. package/README.md +0 -76
  2. package/dist/browser/api/agentsContext.js +2 -2
  3. package/dist/browser/api/agentsContext.js.map +1 -1
  4. package/dist/browser/api/messages/index.d.ts +2 -2
  5. package/dist/browser/api/messages/index.d.ts.map +1 -1
  6. package/dist/browser/api/messages/index.js +1 -1
  7. package/dist/browser/api/messages/index.js.map +1 -1
  8. package/dist/browser/api/messages/operations.d.ts +6 -2
  9. package/dist/browser/api/messages/operations.d.ts.map +1 -1
  10. package/dist/browser/api/messages/operations.js +31 -1
  11. package/dist/browser/api/messages/operations.js.map +1 -1
  12. package/dist/browser/api/messages/options.d.ts +3 -0
  13. package/dist/browser/api/messages/options.d.ts.map +1 -1
  14. package/dist/browser/api/messages/options.js.map +1 -1
  15. package/dist/browser/api/operations.d.ts +1 -2
  16. package/dist/browser/api/operations.d.ts.map +1 -1
  17. package/dist/browser/api/operations.js +2 -2
  18. package/dist/browser/api/operations.js.map +1 -1
  19. package/dist/browser/api/runSteps/operations.js +3 -3
  20. package/dist/browser/api/runSteps/operations.js.map +1 -1
  21. package/dist/browser/api/runs/operations.d.ts +3 -3
  22. package/dist/browser/api/runs/operations.d.ts.map +1 -1
  23. package/dist/browser/api/runs/operations.js +12 -10
  24. package/dist/browser/api/runs/operations.js.map +1 -1
  25. package/dist/browser/api/vectorStoreFiles/operations.js +4 -4
  26. package/dist/browser/api/vectorStoreFiles/operations.js.map +1 -1
  27. package/dist/browser/api/vectorStores/operations.js +4 -4
  28. package/dist/browser/api/vectorStores/operations.js.map +1 -1
  29. package/dist/browser/classic/messages/index.d.ts +4 -2
  30. package/dist/browser/classic/messages/index.d.ts.map +1 -1
  31. package/dist/browser/classic/messages/index.js +2 -1
  32. package/dist/browser/classic/messages/index.js.map +1 -1
  33. package/dist/browser/classic/runs/index.d.ts.map +1 -1
  34. package/dist/browser/classic/runs/index.js +4 -1
  35. package/dist/browser/classic/runs/index.js.map +1 -1
  36. package/dist/browser/constants.d.ts +1 -1
  37. package/dist/browser/constants.js +1 -1
  38. package/dist/browser/constants.js.map +1 -1
  39. package/dist/browser/index.d.ts +3 -2
  40. package/dist/browser/index.d.ts.map +1 -1
  41. package/dist/browser/index.js +1 -0
  42. package/dist/browser/index.js.map +1 -1
  43. package/dist/browser/models/index.d.ts +1 -1
  44. package/dist/browser/models/index.d.ts.map +1 -1
  45. package/dist/browser/models/index.js.map +1 -1
  46. package/dist/browser/models/models.d.ts +309 -31
  47. package/dist/browser/models/models.d.ts.map +1 -1
  48. package/dist/browser/models/models.js +341 -14
  49. package/dist/browser/models/models.js.map +1 -1
  50. package/dist/browser/models/streamingModels.d.ts +18 -18
  51. package/dist/browser/models/streamingModels.d.ts.map +1 -1
  52. package/dist/browser/models/streamingModels.js.map +1 -1
  53. package/dist/browser/static-helpers/urlTemplate.js.map +1 -1
  54. package/dist/browser/utils/MCPTool.d.ts +12 -1
  55. package/dist/browser/utils/MCPTool.d.ts.map +1 -1
  56. package/dist/browser/utils/MCPTool.js +29 -2
  57. package/dist/browser/utils/MCPTool.js.map +1 -1
  58. package/dist/browser/utils/OpenApiTool.d.ts +46 -0
  59. package/dist/browser/utils/OpenApiTool.d.ts.map +1 -0
  60. package/dist/browser/utils/OpenApiTool.js +84 -0
  61. package/dist/browser/utils/OpenApiTool.js.map +1 -0
  62. package/dist/browser/utils/utils.d.ts +14 -50
  63. package/dist/browser/utils/utils.d.ts.map +1 -1
  64. package/dist/browser/utils/utils.js +13 -91
  65. package/dist/browser/utils/utils.js.map +1 -1
  66. package/dist/commonjs/api/agentsContext.js +2 -2
  67. package/dist/commonjs/api/agentsContext.js.map +1 -1
  68. package/dist/commonjs/api/messages/index.d.ts +2 -2
  69. package/dist/commonjs/api/messages/index.d.ts.map +1 -1
  70. package/dist/commonjs/api/messages/index.js +2 -1
  71. package/dist/commonjs/api/messages/index.js.map +1 -1
  72. package/dist/commonjs/api/messages/operations.d.ts +6 -2
  73. package/dist/commonjs/api/messages/operations.d.ts.map +1 -1
  74. package/dist/commonjs/api/messages/operations.js +33 -0
  75. package/dist/commonjs/api/messages/operations.js.map +1 -1
  76. package/dist/commonjs/api/messages/options.d.ts +3 -0
  77. package/dist/commonjs/api/messages/options.d.ts.map +1 -1
  78. package/dist/commonjs/api/messages/options.js.map +1 -1
  79. package/dist/commonjs/api/operations.d.ts +1 -2
  80. package/dist/commonjs/api/operations.d.ts.map +1 -1
  81. package/dist/commonjs/api/operations.js +2 -2
  82. package/dist/commonjs/api/operations.js.map +1 -1
  83. package/dist/commonjs/api/runSteps/operations.js +3 -3
  84. package/dist/commonjs/api/runSteps/operations.js.map +1 -1
  85. package/dist/commonjs/api/runs/operations.d.ts +3 -3
  86. package/dist/commonjs/api/runs/operations.d.ts.map +1 -1
  87. package/dist/commonjs/api/runs/operations.js +12 -10
  88. package/dist/commonjs/api/runs/operations.js.map +1 -1
  89. package/dist/commonjs/api/vectorStoreFiles/operations.js +4 -4
  90. package/dist/commonjs/api/vectorStoreFiles/operations.js.map +1 -1
  91. package/dist/commonjs/api/vectorStores/operations.js +4 -4
  92. package/dist/commonjs/api/vectorStores/operations.js.map +1 -1
  93. package/dist/commonjs/classic/messages/index.d.ts +4 -2
  94. package/dist/commonjs/classic/messages/index.d.ts.map +1 -1
  95. package/dist/commonjs/classic/messages/index.js +1 -0
  96. package/dist/commonjs/classic/messages/index.js.map +1 -1
  97. package/dist/commonjs/classic/runs/index.d.ts.map +1 -1
  98. package/dist/commonjs/classic/runs/index.js +4 -1
  99. package/dist/commonjs/classic/runs/index.js.map +1 -1
  100. package/dist/commonjs/constants.d.ts +1 -1
  101. package/dist/commonjs/constants.js +1 -1
  102. package/dist/commonjs/constants.js.map +1 -1
  103. package/dist/commonjs/index.d.ts +3 -2
  104. package/dist/commonjs/index.d.ts.map +1 -1
  105. package/dist/commonjs/index.js +3 -1
  106. package/dist/commonjs/index.js.map +1 -1
  107. package/dist/commonjs/models/index.d.ts +1 -1
  108. package/dist/commonjs/models/index.d.ts.map +1 -1
  109. package/dist/commonjs/models/index.js.map +1 -1
  110. package/dist/commonjs/models/models.d.ts +309 -31
  111. package/dist/commonjs/models/models.d.ts.map +1 -1
  112. package/dist/commonjs/models/models.js +385 -15
  113. package/dist/commonjs/models/models.js.map +1 -1
  114. package/dist/commonjs/models/streamingModels.d.ts +18 -18
  115. package/dist/commonjs/models/streamingModels.d.ts.map +1 -1
  116. package/dist/commonjs/models/streamingModels.js.map +1 -1
  117. package/dist/commonjs/static-helpers/urlTemplate.js.map +1 -1
  118. package/dist/commonjs/tsdoc-metadata.json +1 -1
  119. package/dist/commonjs/utils/MCPTool.d.ts +12 -1
  120. package/dist/commonjs/utils/MCPTool.d.ts.map +1 -1
  121. package/dist/commonjs/utils/MCPTool.js +29 -2
  122. package/dist/commonjs/utils/MCPTool.js.map +1 -1
  123. package/dist/commonjs/utils/OpenApiTool.d.ts +46 -0
  124. package/dist/commonjs/utils/OpenApiTool.d.ts.map +1 -0
  125. package/dist/commonjs/utils/OpenApiTool.js +88 -0
  126. package/dist/commonjs/utils/OpenApiTool.js.map +1 -0
  127. package/dist/commonjs/utils/utils.d.ts +14 -50
  128. package/dist/commonjs/utils/utils.d.ts.map +1 -1
  129. package/dist/commonjs/utils/utils.js +13 -91
  130. package/dist/commonjs/utils/utils.js.map +1 -1
  131. package/dist/esm/api/agentsContext.js +2 -2
  132. package/dist/esm/api/agentsContext.js.map +1 -1
  133. package/dist/esm/api/messages/index.d.ts +2 -2
  134. package/dist/esm/api/messages/index.d.ts.map +1 -1
  135. package/dist/esm/api/messages/index.js +1 -1
  136. package/dist/esm/api/messages/index.js.map +1 -1
  137. package/dist/esm/api/messages/operations.d.ts +6 -2
  138. package/dist/esm/api/messages/operations.d.ts.map +1 -1
  139. package/dist/esm/api/messages/operations.js +31 -1
  140. package/dist/esm/api/messages/operations.js.map +1 -1
  141. package/dist/esm/api/messages/options.d.ts +3 -0
  142. package/dist/esm/api/messages/options.d.ts.map +1 -1
  143. package/dist/esm/api/messages/options.js.map +1 -1
  144. package/dist/esm/api/operations.d.ts +1 -2
  145. package/dist/esm/api/operations.d.ts.map +1 -1
  146. package/dist/esm/api/operations.js +2 -2
  147. package/dist/esm/api/operations.js.map +1 -1
  148. package/dist/esm/api/runSteps/operations.js +3 -3
  149. package/dist/esm/api/runSteps/operations.js.map +1 -1
  150. package/dist/esm/api/runs/operations.d.ts +3 -3
  151. package/dist/esm/api/runs/operations.d.ts.map +1 -1
  152. package/dist/esm/api/runs/operations.js +12 -10
  153. package/dist/esm/api/runs/operations.js.map +1 -1
  154. package/dist/esm/api/vectorStoreFiles/operations.js +4 -4
  155. package/dist/esm/api/vectorStoreFiles/operations.js.map +1 -1
  156. package/dist/esm/api/vectorStores/operations.js +4 -4
  157. package/dist/esm/api/vectorStores/operations.js.map +1 -1
  158. package/dist/esm/classic/messages/index.d.ts +4 -2
  159. package/dist/esm/classic/messages/index.d.ts.map +1 -1
  160. package/dist/esm/classic/messages/index.js +2 -1
  161. package/dist/esm/classic/messages/index.js.map +1 -1
  162. package/dist/esm/classic/runs/index.d.ts.map +1 -1
  163. package/dist/esm/classic/runs/index.js +4 -1
  164. package/dist/esm/classic/runs/index.js.map +1 -1
  165. package/dist/esm/constants.d.ts +1 -1
  166. package/dist/esm/constants.js +1 -1
  167. package/dist/esm/constants.js.map +1 -1
  168. package/dist/esm/index.d.ts +3 -2
  169. package/dist/esm/index.d.ts.map +1 -1
  170. package/dist/esm/index.js +1 -0
  171. package/dist/esm/index.js.map +1 -1
  172. package/dist/esm/models/index.d.ts +1 -1
  173. package/dist/esm/models/index.d.ts.map +1 -1
  174. package/dist/esm/models/index.js.map +1 -1
  175. package/dist/esm/models/models.d.ts +309 -31
  176. package/dist/esm/models/models.d.ts.map +1 -1
  177. package/dist/esm/models/models.js +341 -14
  178. package/dist/esm/models/models.js.map +1 -1
  179. package/dist/esm/models/streamingModels.d.ts +18 -18
  180. package/dist/esm/models/streamingModels.d.ts.map +1 -1
  181. package/dist/esm/models/streamingModels.js.map +1 -1
  182. package/dist/esm/static-helpers/urlTemplate.js.map +1 -1
  183. package/dist/esm/utils/MCPTool.d.ts +12 -1
  184. package/dist/esm/utils/MCPTool.d.ts.map +1 -1
  185. package/dist/esm/utils/MCPTool.js +29 -2
  186. package/dist/esm/utils/MCPTool.js.map +1 -1
  187. package/dist/esm/utils/OpenApiTool.d.ts +46 -0
  188. package/dist/esm/utils/OpenApiTool.d.ts.map +1 -0
  189. package/dist/esm/utils/OpenApiTool.js +84 -0
  190. package/dist/esm/utils/OpenApiTool.js.map +1 -0
  191. package/dist/esm/utils/utils.d.ts +14 -50
  192. package/dist/esm/utils/utils.d.ts.map +1 -1
  193. package/dist/esm/utils/utils.js +13 -91
  194. package/dist/esm/utils/utils.js.map +1 -1
  195. package/dist/react-native/api/agentsContext.js +2 -2
  196. package/dist/react-native/api/agentsContext.js.map +1 -1
  197. package/dist/react-native/api/messages/index.d.ts +2 -2
  198. package/dist/react-native/api/messages/index.d.ts.map +1 -1
  199. package/dist/react-native/api/messages/index.js +1 -1
  200. package/dist/react-native/api/messages/index.js.map +1 -1
  201. package/dist/react-native/api/messages/operations.d.ts +6 -2
  202. package/dist/react-native/api/messages/operations.d.ts.map +1 -1
  203. package/dist/react-native/api/messages/operations.js +31 -1
  204. package/dist/react-native/api/messages/operations.js.map +1 -1
  205. package/dist/react-native/api/messages/options.d.ts +3 -0
  206. package/dist/react-native/api/messages/options.d.ts.map +1 -1
  207. package/dist/react-native/api/messages/options.js.map +1 -1
  208. package/dist/react-native/api/operations.d.ts +1 -2
  209. package/dist/react-native/api/operations.d.ts.map +1 -1
  210. package/dist/react-native/api/operations.js +2 -2
  211. package/dist/react-native/api/operations.js.map +1 -1
  212. package/dist/react-native/api/runSteps/operations.js +3 -3
  213. package/dist/react-native/api/runSteps/operations.js.map +1 -1
  214. package/dist/react-native/api/runs/operations.d.ts +3 -3
  215. package/dist/react-native/api/runs/operations.d.ts.map +1 -1
  216. package/dist/react-native/api/runs/operations.js +12 -10
  217. package/dist/react-native/api/runs/operations.js.map +1 -1
  218. package/dist/react-native/api/vectorStoreFiles/operations.js +4 -4
  219. package/dist/react-native/api/vectorStoreFiles/operations.js.map +1 -1
  220. package/dist/react-native/api/vectorStores/operations.js +4 -4
  221. package/dist/react-native/api/vectorStores/operations.js.map +1 -1
  222. package/dist/react-native/classic/messages/index.d.ts +4 -2
  223. package/dist/react-native/classic/messages/index.d.ts.map +1 -1
  224. package/dist/react-native/classic/messages/index.js +2 -1
  225. package/dist/react-native/classic/messages/index.js.map +1 -1
  226. package/dist/react-native/classic/runs/index.d.ts.map +1 -1
  227. package/dist/react-native/classic/runs/index.js +4 -1
  228. package/dist/react-native/classic/runs/index.js.map +1 -1
  229. package/dist/react-native/constants.d.ts +1 -1
  230. package/dist/react-native/constants.js +1 -1
  231. package/dist/react-native/constants.js.map +1 -1
  232. package/dist/react-native/index.d.ts +3 -2
  233. package/dist/react-native/index.d.ts.map +1 -1
  234. package/dist/react-native/index.js +1 -0
  235. package/dist/react-native/index.js.map +1 -1
  236. package/dist/react-native/models/index.d.ts +1 -1
  237. package/dist/react-native/models/index.d.ts.map +1 -1
  238. package/dist/react-native/models/index.js.map +1 -1
  239. package/dist/react-native/models/models.d.ts +309 -31
  240. package/dist/react-native/models/models.d.ts.map +1 -1
  241. package/dist/react-native/models/models.js +341 -14
  242. package/dist/react-native/models/models.js.map +1 -1
  243. package/dist/react-native/models/streamingModels.d.ts +18 -18
  244. package/dist/react-native/models/streamingModels.d.ts.map +1 -1
  245. package/dist/react-native/models/streamingModels.js.map +1 -1
  246. package/dist/react-native/static-helpers/urlTemplate.js.map +1 -1
  247. package/dist/react-native/utils/MCPTool.d.ts +12 -1
  248. package/dist/react-native/utils/MCPTool.d.ts.map +1 -1
  249. package/dist/react-native/utils/MCPTool.js +29 -2
  250. package/dist/react-native/utils/MCPTool.js.map +1 -1
  251. package/dist/react-native/utils/OpenApiTool.d.ts +46 -0
  252. package/dist/react-native/utils/OpenApiTool.d.ts.map +1 -0
  253. package/dist/react-native/utils/OpenApiTool.js +84 -0
  254. package/dist/react-native/utils/OpenApiTool.js.map +1 -0
  255. package/dist/react-native/utils/utils.d.ts +14 -50
  256. package/dist/react-native/utils/utils.d.ts.map +1 -1
  257. package/dist/react-native/utils/utils.js +13 -91
  258. package/dist/react-native/utils/utils.js.map +1 -1
  259. package/package.json +36 -37
@@ -1,5 +1,6 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT License.
3
+ import { OpenApiTool } from "./OpenApiTool.js";
3
4
  import { MCPTool } from "./MCPTool.js";
4
5
  /**
5
6
  * Determines if the given output is of the specified type.
@@ -54,28 +55,6 @@ export class ToolUtility {
54
55
  },
55
56
  };
56
57
  }
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
- }
79
58
  /**
80
59
  * Creates a bing grounding search tool
81
60
  *
@@ -102,26 +81,6 @@ export class ToolUtility {
102
81
  },
103
82
  };
104
83
  }
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,
120
- })),
121
- },
122
- },
123
- };
124
- }
125
84
  /**
126
85
  * Creates a file search tool
127
86
  *
@@ -197,22 +156,6 @@ export class ToolUtility {
197
156
  },
198
157
  };
199
158
  }
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
- }
216
159
  /**
217
160
  * Creates a function tool
218
161
  *
@@ -237,16 +180,7 @@ export class ToolUtility {
237
180
  */
238
181
  static createOpenApiTool(openApiFunctionDefinition) {
239
182
  return {
240
- definition: {
241
- type: "openapi",
242
- openapi: {
243
- name: openApiFunctionDefinition.name,
244
- spec: openApiFunctionDefinition.spec,
245
- description: openApiFunctionDefinition.description,
246
- auth: openApiFunctionDefinition.auth,
247
- defaultParams: openApiFunctionDefinition.defaultParams,
248
- },
249
- },
183
+ definition: OpenApiTool.createDefinition(openApiFunctionDefinition),
250
184
  };
251
185
  }
252
186
  /**
@@ -334,6 +268,17 @@ export class ToolSet {
334
268
  this.toolDefinitions.push(tool.definition);
335
269
  return tool;
336
270
  }
271
+ /**
272
+ * Adds a Model Context Protocol (MCP) tool to the tool set.
273
+ * @param options - The options for configuring the MCP tool.
274
+ * @returns An object containing the definition and resources for the MCP tool
275
+ */
276
+ addMCPTool(options) {
277
+ const tool = ToolUtility.createMCPTool(options);
278
+ this.toolDefinitions.push(tool.definition);
279
+ this.toolResources = { ...this.toolResources, ...tool.resources };
280
+ return tool;
281
+ }
337
282
  /**
338
283
  * Adds a bing grounding search tool to the tool set.
339
284
  *
@@ -359,28 +304,5 @@ export class ToolSet {
359
304
  this.toolDefinitions.push(tool.definition);
360
305
  return tool;
361
306
  }
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
- }
385
307
  }
386
308
  //# sourceMappingURL=utils.js.map
@@ -1 +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,sDAAgC,CAAA;IAChC,8BAA8B;IAC9B,6DAAuC,CAAA;AACzC,CAAC,EAXW,kBAAkB,KAAlB,kBAAkB,QAW7B;AAED,MAAM,OAAO,GAAG;IACd,cAAc,EAAE,eAAe;IAC/B,gBAAgB,EAAE,kBAAkB;IACpC,oBAAoB,EAAE,qBAAqB;IAC3C,cAAc,EAAE,eAAe;IAC/B,kBAAkB,EAAE,kBAAkB;CACvC,CAAC;AAEF;;GAEG;AACH,MAAM,OAAO,WAAW;IACtB;;;;;;OAMG;IACH,MAA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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"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/utils/utils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAwBlC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC;;;;;;;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,sDAAgC,CAAA;IAChC,8BAA8B;IAC9B,6DAAuC,CAAA;AACzC,CAAC,EAXW,kBAAkB,KAAlB,kBAAkB,QAW7B;AAED,MAAM,OAAO,GAAG;IACd,cAAc,EAAE,eAAe;IAC/B,gBAAgB,EAAE,kBAAkB;IACpC,oBAAoB,EAAE,qBAAqB;IAC3C,cAAc,EAAE,eAAe;IAC/B,kBAAkB,EAAE,kBAAkB;CACvC,CAAC;AAEF;;GAEG;A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AO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;OAOG;IACH,qBAAqB,CACnB,EAAU,EACV,IAAY,EACZ,WAAmB;QAEnB,MAAM,IAAI,GAAG,WAAW,CAAC,wBAAwB,CAAC,EAAE,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;QACzE,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 BingGroundingToolDefinition,\n BingGroundingSearchConfiguration,\n ConnectedAgentToolDefinition,\n MCPToolDefinition,\n} from \"../index.js\";\nimport { OpenApiTool } from \"./OpenApiTool.js\";\nimport { MCPTool } from \"./MCPTool.js\";\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 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 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 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: OpenApiTool.createDefinition(openApiFunctionDefinition),\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 Model Context Protocol (MCP) tool to the tool set.\n * @param options - The options for configuring the MCP tool.\n * @returns An object containing the definition and resources for the MCP tool\n */\n addMCPTool(options: { serverLabel: string; serverUrl: string; allowedTools?: string[] }): {\n definition: MCPToolDefinition;\n resources: ToolResources;\n } {\n const tool = ToolUtility.createMCPTool(options);\n this.toolDefinitions.push(tool.definition);\n this.toolResources = { ...this.toolResources, ...tool.resources };\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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azure/ai-agents",
3
- "version": "1.1.0-beta.3",
3
+ "version": "1.2.0-alpha.20250923.1",
4
4
  "description": "Azure AI Agents client library.",
5
5
  "engines": {
6
6
  "node": ">=20.0.0"
@@ -71,48 +71,27 @@
71
71
  "@azure/core-tracing": "^1.2.0"
72
72
  },
73
73
  "devDependencies": {
74
- "@azure/dev-tool": "^1.0.0",
75
- "@azure/eslint-plugin-azure-sdk": "^3.0.0",
76
- "@azure/identity": "^4.3.0",
74
+ "@azure/identity": "4.11.1",
77
75
  "@azure/opentelemetry-instrumentation-azure-sdk": "^1.0.0-beta.7",
78
76
  "@azure/monitor-opentelemetry": "^1.11.1",
79
77
  "@azure/monitor-opentelemetry-exporter": "^1.0.0-beta.31",
80
- "@azure-tools/test-credential": "^2.0.0",
81
- "@azure-tools/test-recorder": "^4.1.0",
82
- "@azure-tools/test-utils-vitest": "^1.0.0",
83
78
  "@opentelemetry/api": "^1.9.0",
84
79
  "@opentelemetry/instrumentation": "0.57.0",
85
80
  "@opentelemetry/sdk-trace-node": "^1.30.0",
86
- "@vitest/browser": "^3.0.9",
87
- "@vitest/coverage-istanbul": "^3.0.9",
88
- "@types/node": "^20.0.0",
81
+ "@vitest/browser": "^3.2.3",
82
+ "@vitest/coverage-istanbul": "^3.2.3",
83
+ "@types/node": "^20.19.0",
89
84
  "dotenv": "^16.0.0",
90
- "eslint": "^9.9.0",
85
+ "eslint": "^9.33.0",
91
86
  "prettier": "^3.2.5",
92
- "playwright": "^1.41.2",
93
- "typescript": "~5.8.2",
94
- "vitest": "^3.0.9"
95
- },
96
- "scripts": {
97
- "build": "npm run clean && dev-tool run build-package && dev-tool run vendored mkdirp ./review && dev-tool run extract-api",
98
- "build:samples": "echo skipped",
99
- "check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"samples-dev/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\" ",
100
- "clean": "dev-tool run vendored rimraf --glob dist dist-* test-dist temp types *.tgz *.log",
101
- "copy:yaml": "copy tsp-location.yaml .\\src\\generated\\tsp-location.yaml",
102
- "execute:samples": "dev-tool samples run samples-dev",
103
- "extract-api": "dev-tool run vendored rimraf review && dev-tool run vendored mkdirp ./review && dev-tool run extract-api",
104
- "format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"samples-dev/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\" ",
105
- "generate": "dev-tool run vendored rimraf ./src/generated && dev-tool run vendored mkdirp ./src/generated && npm run copy:yaml && npm run tsp:update && dev-tool run vendored rimraf ./src/generated/test && dev-tool run vendored rimraf ./src/generated/tsp-location.yaml",
106
- "generate-samples": "dev-tool samples publish -f",
107
- "lint": "eslint package.json src test",
108
- "lint:fix": "eslint package.json src test --fix --fix-type [problem,suggestion]",
109
- "pack": "npm pack 2>&1",
110
- "test": "npm run test:node && npm run test:browser",
111
- "test:browser": "dev-tool run build-test && dev-tool run test:vitest --browser",
112
- "test:node": "dev-tool run test:vitest",
113
- "test:node:esm": "dev-tool run test:vitest --esm --no-test-proxy",
114
- "tsp:update": "tsp-client update -o ./src/generated",
115
- "update-snippets": "dev-tool run update-snippets"
87
+ "playwright": "^1.50.1",
88
+ "typescript": "~5.8.3",
89
+ "vitest": "^3.2.3",
90
+ "@azure/dev-tool": "^1.0.0",
91
+ "@azure/eslint-plugin-azure-sdk": "^3.0.0",
92
+ "@azure-tools/test-recorder": "^4.1.1",
93
+ "@azure-tools/test-utils-vitest": "^2.0.1",
94
+ "@azure-tools/test-credential": "^2.1.2"
116
95
  },
117
96
  "exports": {
118
97
  "./package.json": "./package.json",
@@ -150,5 +129,25 @@
150
129
  },
151
130
  "main": "./dist/commonjs/index.js",
152
131
  "types": "./dist/commonjs/index.d.ts",
153
- "module": "./dist/esm/index.js"
154
- }
132
+ "module": "./dist/esm/index.js",
133
+ "scripts": {
134
+ "build": "npm run clean && dev-tool run build-package && dev-tool run vendored mkdirp ./review && dev-tool run extract-api",
135
+ "build:samples": "tsc -p tsconfig.samples.json",
136
+ "check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"samples-dev/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\" ",
137
+ "clean": "dev-tool run vendored rimraf --glob dist dist-* test-dist temp types *.tgz *.log",
138
+ "copy:yaml": "copy tsp-location.yaml .\\src\\generated\\tsp-location.yaml",
139
+ "execute:samples": "dev-tool samples run samples-dev",
140
+ "extract-api": "dev-tool run vendored rimraf review && dev-tool run vendored mkdirp ./review && dev-tool run extract-api",
141
+ "format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"samples-dev/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\" ",
142
+ "generate": "dev-tool run vendored rimraf ./src/generated && dev-tool run vendored mkdirp ./src/generated && npm run copy:yaml && npm run tsp:update && dev-tool run vendored rimraf ./src/generated/test && dev-tool run vendored rimraf ./src/generated/tsp-location.yaml",
143
+ "generate-samples": "dev-tool samples publish -f",
144
+ "lint": "eslint package.json src test",
145
+ "lint:fix": "eslint package.json src test --fix --fix-type [problem,suggestion]",
146
+ "pack": "pnpm pack 2>&1",
147
+ "test": "npm run test:node && npm run test:browser",
148
+ "test:browser": "dev-tool run build-test && dev-tool run test:vitest --browser",
149
+ "test:node": "dev-tool run build-test --no-browser-test && dev-tool run test:vitest",
150
+ "tsp:update": "tsp-client update -o ./src/generated",
151
+ "update-snippets": "dev-tool run update-snippets"
152
+ }
153
+ }