@azure/ai-agents 1.1.0 → 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 (274) hide show
  1. package/dist/browser/api/agentsContext.js +3 -3
  2. package/dist/browser/api/agentsContext.js.map +1 -1
  3. package/dist/browser/api/messages/index.d.ts +2 -2
  4. package/dist/browser/api/messages/index.d.ts.map +1 -1
  5. package/dist/browser/api/messages/index.js +1 -1
  6. package/dist/browser/api/messages/index.js.map +1 -1
  7. package/dist/browser/api/messages/operations.d.ts +6 -2
  8. package/dist/browser/api/messages/operations.d.ts.map +1 -1
  9. package/dist/browser/api/messages/operations.js +31 -1
  10. package/dist/browser/api/messages/operations.js.map +1 -1
  11. package/dist/browser/api/messages/options.d.ts +3 -0
  12. package/dist/browser/api/messages/options.d.ts.map +1 -1
  13. package/dist/browser/api/messages/options.js.map +1 -1
  14. package/dist/browser/api/operations.d.ts +1 -2
  15. package/dist/browser/api/operations.d.ts.map +1 -1
  16. package/dist/browser/api/operations.js +2 -2
  17. package/dist/browser/api/operations.js.map +1 -1
  18. package/dist/browser/api/runSteps/operations.js +3 -3
  19. package/dist/browser/api/runSteps/operations.js.map +1 -1
  20. package/dist/browser/api/runs/operations.d.ts +3 -3
  21. package/dist/browser/api/runs/operations.d.ts.map +1 -1
  22. package/dist/browser/api/runs/operations.js +13 -8
  23. package/dist/browser/api/runs/operations.js.map +1 -1
  24. package/dist/browser/api/runs/options.d.ts +5 -1
  25. package/dist/browser/api/runs/options.d.ts.map +1 -1
  26. package/dist/browser/api/runs/options.js.map +1 -1
  27. package/dist/browser/api/vectorStoreFiles/operations.js +4 -4
  28. package/dist/browser/api/vectorStoreFiles/operations.js.map +1 -1
  29. package/dist/browser/api/vectorStores/operations.js +4 -4
  30. package/dist/browser/api/vectorStores/operations.js.map +1 -1
  31. package/dist/browser/classic/messages/index.d.ts +4 -2
  32. package/dist/browser/classic/messages/index.d.ts.map +1 -1
  33. package/dist/browser/classic/messages/index.js +2 -1
  34. package/dist/browser/classic/messages/index.js.map +1 -1
  35. package/dist/browser/classic/runs/index.d.ts.map +1 -1
  36. package/dist/browser/classic/runs/index.js +4 -1
  37. package/dist/browser/classic/runs/index.js.map +1 -1
  38. package/dist/browser/constants.d.ts +1 -1
  39. package/dist/browser/constants.d.ts.map +1 -1
  40. package/dist/browser/constants.js +1 -1
  41. package/dist/browser/constants.js.map +1 -1
  42. package/dist/browser/index.d.ts +4 -2
  43. package/dist/browser/index.d.ts.map +1 -1
  44. package/dist/browser/index.js +2 -0
  45. package/dist/browser/index.js.map +1 -1
  46. package/dist/browser/models/index.d.ts +1 -1
  47. package/dist/browser/models/index.d.ts.map +1 -1
  48. package/dist/browser/models/index.js.map +1 -1
  49. package/dist/browser/models/models.d.ts +544 -18
  50. package/dist/browser/models/models.d.ts.map +1 -1
  51. package/dist/browser/models/models.js +653 -0
  52. package/dist/browser/models/models.js.map +1 -1
  53. package/dist/browser/models/streamingModels.d.ts +18 -18
  54. package/dist/browser/models/streamingModels.d.ts.map +1 -1
  55. package/dist/browser/models/streamingModels.js.map +1 -1
  56. package/dist/browser/static-helpers/urlTemplate.js.map +1 -1
  57. package/dist/browser/utils/MCPTool.d.ts +89 -0
  58. package/dist/browser/utils/MCPTool.d.ts.map +1 -0
  59. package/dist/browser/utils/MCPTool.js +160 -0
  60. package/dist/browser/utils/MCPTool.js.map +1 -0
  61. package/dist/browser/utils/OpenApiTool.d.ts +46 -0
  62. package/dist/browser/utils/OpenApiTool.d.ts.map +1 -0
  63. package/dist/browser/utils/OpenApiTool.js +84 -0
  64. package/dist/browser/utils/OpenApiTool.js.map +1 -0
  65. package/dist/browser/utils/utils.d.ts +25 -1
  66. package/dist/browser/utils/utils.d.ts.map +1 -1
  67. package/dist/browser/utils/utils.js +22 -10
  68. package/dist/browser/utils/utils.js.map +1 -1
  69. package/dist/commonjs/api/agentsContext.js +3 -3
  70. package/dist/commonjs/api/agentsContext.js.map +1 -1
  71. package/dist/commonjs/api/messages/index.d.ts +2 -2
  72. package/dist/commonjs/api/messages/index.d.ts.map +1 -1
  73. package/dist/commonjs/api/messages/index.js +2 -1
  74. package/dist/commonjs/api/messages/index.js.map +1 -1
  75. package/dist/commonjs/api/messages/operations.d.ts +6 -2
  76. package/dist/commonjs/api/messages/operations.d.ts.map +1 -1
  77. package/dist/commonjs/api/messages/operations.js +33 -0
  78. package/dist/commonjs/api/messages/operations.js.map +1 -1
  79. package/dist/commonjs/api/messages/options.d.ts +3 -0
  80. package/dist/commonjs/api/messages/options.d.ts.map +1 -1
  81. package/dist/commonjs/api/messages/options.js.map +1 -1
  82. package/dist/commonjs/api/operations.d.ts +1 -2
  83. package/dist/commonjs/api/operations.d.ts.map +1 -1
  84. package/dist/commonjs/api/operations.js +2 -2
  85. package/dist/commonjs/api/operations.js.map +1 -1
  86. package/dist/commonjs/api/runSteps/operations.js +3 -3
  87. package/dist/commonjs/api/runSteps/operations.js.map +1 -1
  88. package/dist/commonjs/api/runs/operations.d.ts +3 -3
  89. package/dist/commonjs/api/runs/operations.d.ts.map +1 -1
  90. package/dist/commonjs/api/runs/operations.js +12 -7
  91. package/dist/commonjs/api/runs/operations.js.map +1 -1
  92. package/dist/commonjs/api/runs/options.d.ts +5 -1
  93. package/dist/commonjs/api/runs/options.d.ts.map +1 -1
  94. package/dist/commonjs/api/runs/options.js.map +1 -1
  95. package/dist/commonjs/api/vectorStoreFiles/operations.js +4 -4
  96. package/dist/commonjs/api/vectorStoreFiles/operations.js.map +1 -1
  97. package/dist/commonjs/api/vectorStores/operations.js +4 -4
  98. package/dist/commonjs/api/vectorStores/operations.js.map +1 -1
  99. package/dist/commonjs/classic/messages/index.d.ts +4 -2
  100. package/dist/commonjs/classic/messages/index.d.ts.map +1 -1
  101. package/dist/commonjs/classic/messages/index.js +1 -0
  102. package/dist/commonjs/classic/messages/index.js.map +1 -1
  103. package/dist/commonjs/classic/runs/index.d.ts.map +1 -1
  104. package/dist/commonjs/classic/runs/index.js +4 -1
  105. package/dist/commonjs/classic/runs/index.js.map +1 -1
  106. package/dist/commonjs/constants.d.ts +1 -1
  107. package/dist/commonjs/constants.d.ts.map +1 -1
  108. package/dist/commonjs/constants.js +1 -1
  109. package/dist/commonjs/constants.js.map +1 -1
  110. package/dist/commonjs/index.d.ts +4 -2
  111. package/dist/commonjs/index.d.ts.map +1 -1
  112. package/dist/commonjs/index.js +5 -1
  113. package/dist/commonjs/index.js.map +1 -1
  114. package/dist/commonjs/models/index.d.ts +1 -1
  115. package/dist/commonjs/models/index.d.ts.map +1 -1
  116. package/dist/commonjs/models/index.js.map +1 -1
  117. package/dist/commonjs/models/models.d.ts +544 -18
  118. package/dist/commonjs/models/models.d.ts.map +1 -1
  119. package/dist/commonjs/models/models.js +741 -0
  120. package/dist/commonjs/models/models.js.map +1 -1
  121. package/dist/commonjs/models/streamingModels.d.ts +18 -18
  122. package/dist/commonjs/models/streamingModels.d.ts.map +1 -1
  123. package/dist/commonjs/models/streamingModels.js.map +1 -1
  124. package/dist/commonjs/static-helpers/urlTemplate.js.map +1 -1
  125. package/dist/commonjs/tsdoc-metadata.json +1 -1
  126. package/dist/commonjs/utils/MCPTool.d.ts +89 -0
  127. package/dist/commonjs/utils/MCPTool.d.ts.map +1 -0
  128. package/dist/commonjs/utils/MCPTool.js +164 -0
  129. package/dist/commonjs/utils/MCPTool.js.map +1 -0
  130. package/dist/commonjs/utils/OpenApiTool.d.ts +46 -0
  131. package/dist/commonjs/utils/OpenApiTool.d.ts.map +1 -0
  132. package/dist/commonjs/utils/OpenApiTool.js +88 -0
  133. package/dist/commonjs/utils/OpenApiTool.js.map +1 -0
  134. package/dist/commonjs/utils/utils.d.ts +25 -1
  135. package/dist/commonjs/utils/utils.d.ts.map +1 -1
  136. package/dist/commonjs/utils/utils.js +22 -10
  137. package/dist/commonjs/utils/utils.js.map +1 -1
  138. package/dist/esm/api/agentsContext.js +3 -3
  139. package/dist/esm/api/agentsContext.js.map +1 -1
  140. package/dist/esm/api/messages/index.d.ts +2 -2
  141. package/dist/esm/api/messages/index.d.ts.map +1 -1
  142. package/dist/esm/api/messages/index.js +1 -1
  143. package/dist/esm/api/messages/index.js.map +1 -1
  144. package/dist/esm/api/messages/operations.d.ts +6 -2
  145. package/dist/esm/api/messages/operations.d.ts.map +1 -1
  146. package/dist/esm/api/messages/operations.js +31 -1
  147. package/dist/esm/api/messages/operations.js.map +1 -1
  148. package/dist/esm/api/messages/options.d.ts +3 -0
  149. package/dist/esm/api/messages/options.d.ts.map +1 -1
  150. package/dist/esm/api/messages/options.js.map +1 -1
  151. package/dist/esm/api/operations.d.ts +1 -2
  152. package/dist/esm/api/operations.d.ts.map +1 -1
  153. package/dist/esm/api/operations.js +2 -2
  154. package/dist/esm/api/operations.js.map +1 -1
  155. package/dist/esm/api/runSteps/operations.js +3 -3
  156. package/dist/esm/api/runSteps/operations.js.map +1 -1
  157. package/dist/esm/api/runs/operations.d.ts +3 -3
  158. package/dist/esm/api/runs/operations.d.ts.map +1 -1
  159. package/dist/esm/api/runs/operations.js +13 -8
  160. package/dist/esm/api/runs/operations.js.map +1 -1
  161. package/dist/esm/api/runs/options.d.ts +5 -1
  162. package/dist/esm/api/runs/options.d.ts.map +1 -1
  163. package/dist/esm/api/runs/options.js.map +1 -1
  164. package/dist/esm/api/vectorStoreFiles/operations.js +4 -4
  165. package/dist/esm/api/vectorStoreFiles/operations.js.map +1 -1
  166. package/dist/esm/api/vectorStores/operations.js +4 -4
  167. package/dist/esm/api/vectorStores/operations.js.map +1 -1
  168. package/dist/esm/classic/messages/index.d.ts +4 -2
  169. package/dist/esm/classic/messages/index.d.ts.map +1 -1
  170. package/dist/esm/classic/messages/index.js +2 -1
  171. package/dist/esm/classic/messages/index.js.map +1 -1
  172. package/dist/esm/classic/runs/index.d.ts.map +1 -1
  173. package/dist/esm/classic/runs/index.js +4 -1
  174. package/dist/esm/classic/runs/index.js.map +1 -1
  175. package/dist/esm/constants.d.ts +1 -1
  176. package/dist/esm/constants.d.ts.map +1 -1
  177. package/dist/esm/constants.js +1 -1
  178. package/dist/esm/constants.js.map +1 -1
  179. package/dist/esm/index.d.ts +4 -2
  180. package/dist/esm/index.d.ts.map +1 -1
  181. package/dist/esm/index.js +2 -0
  182. package/dist/esm/index.js.map +1 -1
  183. package/dist/esm/models/index.d.ts +1 -1
  184. package/dist/esm/models/index.d.ts.map +1 -1
  185. package/dist/esm/models/index.js.map +1 -1
  186. package/dist/esm/models/models.d.ts +544 -18
  187. package/dist/esm/models/models.d.ts.map +1 -1
  188. package/dist/esm/models/models.js +653 -0
  189. package/dist/esm/models/models.js.map +1 -1
  190. package/dist/esm/models/streamingModels.d.ts +18 -18
  191. package/dist/esm/models/streamingModels.d.ts.map +1 -1
  192. package/dist/esm/models/streamingModels.js.map +1 -1
  193. package/dist/esm/static-helpers/urlTemplate.js.map +1 -1
  194. package/dist/esm/utils/MCPTool.d.ts +89 -0
  195. package/dist/esm/utils/MCPTool.d.ts.map +1 -0
  196. package/dist/esm/utils/MCPTool.js +160 -0
  197. package/dist/esm/utils/MCPTool.js.map +1 -0
  198. package/dist/esm/utils/OpenApiTool.d.ts +46 -0
  199. package/dist/esm/utils/OpenApiTool.d.ts.map +1 -0
  200. package/dist/esm/utils/OpenApiTool.js +84 -0
  201. package/dist/esm/utils/OpenApiTool.js.map +1 -0
  202. package/dist/esm/utils/utils.d.ts +25 -1
  203. package/dist/esm/utils/utils.d.ts.map +1 -1
  204. package/dist/esm/utils/utils.js +22 -10
  205. package/dist/esm/utils/utils.js.map +1 -1
  206. package/dist/react-native/api/agentsContext.js +3 -3
  207. package/dist/react-native/api/agentsContext.js.map +1 -1
  208. package/dist/react-native/api/messages/index.d.ts +2 -2
  209. package/dist/react-native/api/messages/index.d.ts.map +1 -1
  210. package/dist/react-native/api/messages/index.js +1 -1
  211. package/dist/react-native/api/messages/index.js.map +1 -1
  212. package/dist/react-native/api/messages/operations.d.ts +6 -2
  213. package/dist/react-native/api/messages/operations.d.ts.map +1 -1
  214. package/dist/react-native/api/messages/operations.js +31 -1
  215. package/dist/react-native/api/messages/operations.js.map +1 -1
  216. package/dist/react-native/api/messages/options.d.ts +3 -0
  217. package/dist/react-native/api/messages/options.d.ts.map +1 -1
  218. package/dist/react-native/api/messages/options.js.map +1 -1
  219. package/dist/react-native/api/operations.d.ts +1 -2
  220. package/dist/react-native/api/operations.d.ts.map +1 -1
  221. package/dist/react-native/api/operations.js +2 -2
  222. package/dist/react-native/api/operations.js.map +1 -1
  223. package/dist/react-native/api/runSteps/operations.js +3 -3
  224. package/dist/react-native/api/runSteps/operations.js.map +1 -1
  225. package/dist/react-native/api/runs/operations.d.ts +3 -3
  226. package/dist/react-native/api/runs/operations.d.ts.map +1 -1
  227. package/dist/react-native/api/runs/operations.js +13 -8
  228. package/dist/react-native/api/runs/operations.js.map +1 -1
  229. package/dist/react-native/api/runs/options.d.ts +5 -1
  230. package/dist/react-native/api/runs/options.d.ts.map +1 -1
  231. package/dist/react-native/api/runs/options.js.map +1 -1
  232. package/dist/react-native/api/vectorStoreFiles/operations.js +4 -4
  233. package/dist/react-native/api/vectorStoreFiles/operations.js.map +1 -1
  234. package/dist/react-native/api/vectorStores/operations.js +4 -4
  235. package/dist/react-native/api/vectorStores/operations.js.map +1 -1
  236. package/dist/react-native/classic/messages/index.d.ts +4 -2
  237. package/dist/react-native/classic/messages/index.d.ts.map +1 -1
  238. package/dist/react-native/classic/messages/index.js +2 -1
  239. package/dist/react-native/classic/messages/index.js.map +1 -1
  240. package/dist/react-native/classic/runs/index.d.ts.map +1 -1
  241. package/dist/react-native/classic/runs/index.js +4 -1
  242. package/dist/react-native/classic/runs/index.js.map +1 -1
  243. package/dist/react-native/constants.d.ts +1 -1
  244. package/dist/react-native/constants.d.ts.map +1 -1
  245. package/dist/react-native/constants.js +1 -1
  246. package/dist/react-native/constants.js.map +1 -1
  247. package/dist/react-native/index.d.ts +4 -2
  248. package/dist/react-native/index.d.ts.map +1 -1
  249. package/dist/react-native/index.js +2 -0
  250. package/dist/react-native/index.js.map +1 -1
  251. package/dist/react-native/models/index.d.ts +1 -1
  252. package/dist/react-native/models/index.d.ts.map +1 -1
  253. package/dist/react-native/models/index.js.map +1 -1
  254. package/dist/react-native/models/models.d.ts +544 -18
  255. package/dist/react-native/models/models.d.ts.map +1 -1
  256. package/dist/react-native/models/models.js +653 -0
  257. package/dist/react-native/models/models.js.map +1 -1
  258. package/dist/react-native/models/streamingModels.d.ts +18 -18
  259. package/dist/react-native/models/streamingModels.d.ts.map +1 -1
  260. package/dist/react-native/models/streamingModels.js.map +1 -1
  261. package/dist/react-native/static-helpers/urlTemplate.js.map +1 -1
  262. package/dist/react-native/utils/MCPTool.d.ts +89 -0
  263. package/dist/react-native/utils/MCPTool.d.ts.map +1 -0
  264. package/dist/react-native/utils/MCPTool.js +160 -0
  265. package/dist/react-native/utils/MCPTool.js.map +1 -0
  266. package/dist/react-native/utils/OpenApiTool.d.ts +46 -0
  267. package/dist/react-native/utils/OpenApiTool.d.ts.map +1 -0
  268. package/dist/react-native/utils/OpenApiTool.js +84 -0
  269. package/dist/react-native/utils/OpenApiTool.js.map +1 -0
  270. package/dist/react-native/utils/utils.d.ts +25 -1
  271. package/dist/react-native/utils/utils.d.ts.map +1 -1
  272. package/dist/react-native/utils/utils.js +22 -10
  273. package/dist/react-native/utils/utils.js.map +1 -1
  274. package/package.json +36 -37
@@ -1,5 +1,7 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT License.
3
+ import { OpenApiTool } from "./OpenApiTool.js";
4
+ import { MCPTool } from "./MCPTool.js";
3
5
  /**
4
6
  * Determines if the given output is of the specified type.
5
7
  *
@@ -178,18 +180,17 @@ export class ToolUtility {
178
180
  */
179
181
  static createOpenApiTool(openApiFunctionDefinition) {
180
182
  return {
181
- definition: {
182
- type: "openapi",
183
- openapi: {
184
- name: openApiFunctionDefinition.name,
185
- spec: openApiFunctionDefinition.spec,
186
- description: openApiFunctionDefinition.description,
187
- auth: openApiFunctionDefinition.auth,
188
- defaultParams: openApiFunctionDefinition.defaultParams,
189
- },
190
- },
183
+ definition: OpenApiTool.createDefinition(openApiFunctionDefinition),
191
184
  };
192
185
  }
186
+ /**
187
+ * Creates an MCP tool with the provided configuration.
188
+ * @param options - Configuration options for the MCP tool
189
+ * @returns A new MCPTool instance
190
+ */
191
+ static createMCPTool(options) {
192
+ return new MCPTool(options.serverLabel, options.serverUrl, options.allowedTools);
193
+ }
193
194
  }
194
195
  /**
195
196
  * Represents a set of tools with their definitions and resources.
@@ -267,6 +268,17 @@ export class ToolSet {
267
268
  this.toolDefinitions.push(tool.definition);
268
269
  return tool;
269
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
+ }
270
282
  /**
271
283
  * Adds a bing grounding search tool to the tool set.
272
284
  *
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/utils/utils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAwBlC;;;;;;;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,QA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,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} from \"../index.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 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: {\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\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"]}
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;AACH,MAAM,OAAO,WAAW;IACtB;;;;;;OAMG;IACH,MAAM,CAAC,oBAAoB,CACzB,QAA4B,EAC5B,aAAuB;QAEvB,OAAO;YACL,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE;oBACnB,WAAW,EAAE,aAAa,CAAC,GAAG,CAAC,CAAC,YAAY,EAAE,EAAE,C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,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"]}
@@ -3,9 +3,9 @@
3
3
  import { logger } from "../logger.js";
4
4
  import { getClient } from "@azure-rest/core-client";
5
5
  export function createAgents(endpointParam, credential, options = {}) {
6
- const endpointUrl = options.endpoint ?? options.baseUrl ?? String(endpointParam);
6
+ const endpointUrl = options.endpoint ?? String(endpointParam);
7
7
  const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix;
8
- const userAgentInfo = `azsdk-js-ai-agents/1.1.0`;
8
+ const userAgentInfo = `azsdk-js-ai-agents/1.2.0-beta.1`;
9
9
  const userAgentPrefix = prefixFromOptions
10
10
  ? `${prefixFromOptions} azsdk-js-api ${userAgentInfo}`
11
11
  : `azsdk-js-api ${userAgentInfo}`;
@@ -19,7 +19,7 @@ export function createAgents(endpointParam, credential, options = {}) {
19
19
  };
20
20
  const clientContext = getClient(endpointUrl, credential, updatedOptions);
21
21
  clientContext.pipeline.removePolicy({ name: "ApiVersionPolicy" });
22
- const apiVersion = options.apiVersion ?? "v1";
22
+ const apiVersion = options.apiVersion ?? "2025-05-15-preview";
23
23
  clientContext.pipeline.addPolicy({
24
24
  name: "ClientApiVersionPolicy",
25
25
  sendRequest: (req, next) => {
@@ -1 +1 @@
1
- {"version":3,"file":"agentsContext.js","sourceRoot":"","sources":["../../../src/api/agentsContext.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,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,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`;\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 ?? \"v1\";\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"]}
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,MAAM,CAAC,aAAa,CAAC,CAAC;IAC9D,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 ?? String(endpointParam);\n const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix;\n const userAgentInfo = `azsdk-js-ai-agents/1.2.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"]}
@@ -1,3 +1,3 @@
1
- export { updateMessage, getMessage, listMessages, createMessage } from "./operations.js";
2
- export { MessagesUpdateMessageOptionalParams, MessagesGetMessageOptionalParams, MessagesListMessagesOptionalParams, MessagesCreateMessageOptionalParams, } from "./options.js";
1
+ export { $delete, updateMessage, getMessage, listMessages, createMessage } from "./operations.js";
2
+ export { MessagesDeleteOptionalParams, MessagesUpdateMessageOptionalParams, MessagesGetMessageOptionalParams, MessagesListMessagesOptionalParams, MessagesCreateMessageOptionalParams, } from "./options.js";
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/api/messages/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACzF,OAAO,EACL,mCAAmC,EACnC,gCAAgC,EAChC,kCAAkC,EAClC,mCAAmC,GACpC,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/api/messages/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAClG,OAAO,EACL,4BAA4B,EAC5B,mCAAmC,EACnC,gCAAgC,EAChC,kCAAkC,EAClC,mCAAmC,GACpC,MAAM,cAAc,CAAC"}
@@ -1,4 +1,4 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT License.
3
- export { updateMessage, getMessage, listMessages, createMessage } from "./operations.js";
3
+ export { $delete, updateMessage, getMessage, listMessages, createMessage } from "./operations.js";
4
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/api/messages/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport { updateMessage, getMessage, listMessages, createMessage } from \"./operations.js\";\nexport {\n MessagesUpdateMessageOptionalParams,\n MessagesGetMessageOptionalParams,\n MessagesListMessagesOptionalParams,\n MessagesCreateMessageOptionalParams,\n} from \"./options.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/api/messages/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport { $delete, updateMessage, getMessage, listMessages, createMessage } from \"./operations.js\";\nexport {\n MessagesDeleteOptionalParams,\n MessagesUpdateMessageOptionalParams,\n MessagesGetMessageOptionalParams,\n MessagesListMessagesOptionalParams,\n MessagesCreateMessageOptionalParams,\n} from \"./options.js\";\n"]}
@@ -1,8 +1,12 @@
1
1
  import { AgentsContext as Client } from "../index.js";
2
- import { MessageRole, MessageInputContent, ThreadMessage, _AgentsPagedResultThreadMessage } from "../../models/models.js";
3
- import { MessagesUpdateMessageOptionalParams, MessagesGetMessageOptionalParams, MessagesListMessagesOptionalParams, MessagesCreateMessageOptionalParams } from "./options.js";
2
+ import { MessageRole, MessageInputContent, ThreadMessage, _AgentsPagedResultThreadMessage, MessageDeletionStatus } from "../../models/models.js";
3
+ import { MessagesDeleteOptionalParams, MessagesUpdateMessageOptionalParams, MessagesGetMessageOptionalParams, MessagesListMessagesOptionalParams, MessagesCreateMessageOptionalParams } from "./options.js";
4
4
  import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js";
5
5
  import { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client";
6
+ export declare function _$deleteSend(context: Client, threadId: string, messageId: string, options?: MessagesDeleteOptionalParams): StreamableMethod;
7
+ export declare function _$deleteDeserialize(result: PathUncheckedResponse): Promise<MessageDeletionStatus>;
8
+ /** Deletes an existing message on an existing thread. */
9
+ export declare function $delete(context: Client, threadId: string, messageId: string, options?: MessagesDeleteOptionalParams): Promise<MessageDeletionStatus>;
6
10
  export declare function _updateMessageSend(context: Client, threadId: string, messageId: string, options?: MessagesUpdateMessageOptionalParams): StreamableMethod;
7
11
  export declare function _updateMessageDeserialize(result: PathUncheckedResponse): Promise<ThreadMessage>;
8
12
  /** Modifies an existing message on an existing thread. */
@@ -1 +1 @@
1
- {"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../../../../src/api/messages/operations.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,IAAI,MAAM,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAEL,WAAW,EACX,mBAAmB,EAGnB,aAAa,EAEb,+BAA+B,EAEhC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,mCAAmC,EACnC,gCAAgC,EAChC,kCAAkC,EAClC,mCAAmC,EACpC,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,0BAA0B,EAE3B,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EAGtB,MAAM,yBAAyB,CAAC;AAEjC,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,mCAA4D,GACpE,gBAAgB,CAqBlB;AAED,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,aAAa,CAAC,CASxB;AAED,0DAA0D;AAC1D,wBAAsB,aAAa,CACjC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,mCAA4D,GACpE,OAAO,CAAC,aAAa,CAAC,CAGxB;AAED,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,gC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er, messageInputContentSerializer, messageAttachmentArraySerializer, threadMessageDeserializer, _agentsPagedResultThreadMessageDeserializer, } from "../../models/models.js";
3
+ import { agentV1ErrorDeserializer, messageInputContentSerializer, messageAttachmentArraySerializer, threadMessageDeserializer, _agentsPagedResultThreadMessageDeserializer, messageDeletionStatusDeserializer, } from "../../models/models.js";
4
4
  import { buildPagedAsyncIterator, } from "../../static-helpers/pagingHelpers.js";
5
5
  import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js";
6
6
  import { createRestError, operationOptionsToRequestParameters, } from "@azure-rest/core-client";
7
+ export function _$deleteSend(context, threadId, messageId, options = { requestOptions: {} }) {
8
+ const path = expandUrlTemplate("/threads/{threadId}/messages/{messageId}{?api-version}", {
9
+ threadId: threadId,
10
+ messageId: messageId,
11
+ "api-version": context.apiVersion,
12
+ }, {
13
+ allowReserved: options?.requestOptions?.skipUrlEncoding,
14
+ });
15
+ return context.path(path).delete({
16
+ ...operationOptionsToRequestParameters(options),
17
+ headers: {
18
+ accept: "application/json",
19
+ ...options.requestOptions?.headers,
20
+ },
21
+ });
22
+ }
23
+ export async function _$deleteDeserialize(result) {
24
+ const expectedStatuses = ["200"];
25
+ if (!expectedStatuses.includes(result.status)) {
26
+ const error = createRestError(result);
27
+ error.details = agentV1ErrorDeserializer(result.body);
28
+ throw error;
29
+ }
30
+ return messageDeletionStatusDeserializer(result.body);
31
+ }
32
+ /** Deletes an existing message on an existing thread. */
33
+ export async function $delete(context, threadId, messageId, options = { requestOptions: {} }) {
34
+ const result = await _$deleteSend(context, threadId, messageId, options);
35
+ return _$deleteDeserialize(result);
36
+ }
7
37
  export function _updateMessageSend(context, threadId, messageId, options = { requestOptions: {} }) {
8
38
  const path = expandUrlTemplate("/threads/{threadId}/messages/{messageId}{?api-version}", {
9
39
  threadId: threadId,
@@ -1 +1 @@
1
- {"version":3,"file":"operations.js","sourceRoot":"","sources":["../../../../src/api/messages/operations.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAA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AgC,CAAC,OAAO,EAAE,WAAW,CAAC;YAC1D,QAAQ,EAAE,OAAO,EAAE,QAAQ;SAC5B;KACF,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC7C,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,yBAAyB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAChD,CAAC;AAED,mDAAmD;AACnD,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,OAAe,EACf,QAAgB,EAChB,IAAiB,EACjB,OAA4B,EAC5B,UAA+C,EAAE,cAAc,EAAE,EAAE,EAAE;IAErE,MAAM,MAAM,GAAG,MAAM,kBAAkB,CAAC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IACnF,OAAO,yBAAyB,CAAC,MAAM,CAAC,CAAC;AAC3C,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { AgentsContext as Client } from \"../index.js\";\nimport {\n agentV1ErrorDeserializer,\n MessageRole,\n MessageInputContent,\n messageInputContentSerializer,\n messageAttachmentArraySerializer,\n ThreadMessage,\n threadMessageDeserializer,\n _AgentsPagedResultThreadMessage,\n _agentsPagedResultThreadMessageDeserializer,\n} from \"../../models/models.js\";\nimport {\n MessagesUpdateMessageOptionalParams,\n MessagesGetMessageOptionalParams,\n MessagesListMessagesOptionalParams,\n MessagesCreateMessageOptionalParams,\n} from \"./options.js\";\nimport {\n PagedAsyncIterableIterator,\n buildPagedAsyncIterator,\n} from \"../../static-helpers/pagingHelpers.js\";\nimport { expandUrlTemplate } from \"../../static-helpers/urlTemplate.js\";\nimport {\n StreamableMethod,\n PathUncheckedResponse,\n createRestError,\n operationOptionsToRequestParameters,\n} from \"@azure-rest/core-client\";\n\nexport function _updateMessageSend(\n context: Client,\n threadId: string,\n messageId: string,\n options: MessagesUpdateMessageOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/threads/{threadId}/messages/{messageId}{?api-version}\",\n {\n threadId: threadId,\n messageId: messageId,\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: \"application/json\",\n headers: {\n accept: \"application/json\",\n ...options.requestOptions?.headers,\n },\n body: { metadata: options?.metadata },\n });\n}\n\nexport async function _updateMessageDeserialize(\n result: PathUncheckedResponse,\n): Promise<ThreadMessage> {\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 threadMessageDeserializer(result.body);\n}\n\n/** Modifies an existing message on an existing thread. */\nexport async function updateMessage(\n context: Client,\n threadId: string,\n messageId: string,\n options: MessagesUpdateMessageOptionalParams = { requestOptions: {} },\n): Promise<ThreadMessage> {\n const result = await _updateMessageSend(context, threadId, messageId, options);\n return _updateMessageDeserialize(result);\n}\n\nexport function _getMessageSend(\n context: Client,\n threadId: string,\n messageId: string,\n options: MessagesGetMessageOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/threads/{threadId}/messages/{messageId}{?api-version}\",\n {\n threadId: threadId,\n messageId: messageId,\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 _getMessageDeserialize(\n result: PathUncheckedResponse,\n): Promise<ThreadMessage> {\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 threadMessageDeserializer(result.body);\n}\n\n/** Retrieves an existing message. */\nexport async function getMessage(\n context: Client,\n threadId: string,\n messageId: string,\n options: MessagesGetMessageOptionalParams = { requestOptions: {} },\n): Promise<ThreadMessage> {\n const result = await _getMessageSend(context, threadId, messageId, options);\n return _getMessageDeserialize(result);\n}\n\nexport function _listMessagesSend(\n context: Client,\n threadId: string,\n options: MessagesListMessagesOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/threads/{threadId}/messages{?run_id,api-version,limit,order,after,before}\",\n {\n threadId: threadId,\n run_id: options?.runId,\n \"api-version\": context.apiVersion,\n limit: options?.limit,\n order: options?.order,\n after: options?.after,\n before: options?.before,\n },\n {\n allowReserved: options?.requestOptions?.skipUrlEncoding,\n },\n );\n return context.path(path).get({\n ...operationOptionsToRequestParameters(options),\n headers: {\n accept: \"application/json\",\n ...options.requestOptions?.headers,\n },\n });\n}\n\nexport async function _listMessagesDeserialize(\n result: PathUncheckedResponse,\n): Promise<_AgentsPagedResultThreadMessage> {\n const expectedStatuses = [\"200\"];\n if (!expectedStatuses.includes(result.status)) {\n throw createRestError(result);\n }\n\n return _agentsPagedResultThreadMessageDeserializer(result.body);\n}\n\n/** Gets a list of messages that exist on a thread. */\nexport function listMessages(\n context: Client,\n threadId: string,\n options: MessagesListMessagesOptionalParams = { requestOptions: {} },\n): PagedAsyncIterableIterator<ThreadMessage> {\n return buildPagedAsyncIterator(\n context,\n () => _listMessagesSend(context, threadId, options),\n _listMessagesDeserialize,\n [\"200\"],\n { itemName: \"data\" },\n );\n}\n\nexport function _createMessageSend(\n context: Client,\n threadId: string,\n role: MessageRole,\n content: MessageInputContent,\n options: MessagesCreateMessageOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/threads/{threadId}/messages{?api-version}\",\n {\n threadId: threadId,\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: \"application/json\",\n headers: {\n accept: \"application/json\",\n ...options.requestOptions?.headers,\n },\n body: {\n role: role,\n content: messageInputContentSerializer(content),\n attachments: !options?.attachments\n ? options?.attachments\n : messageAttachmentArraySerializer(options?.attachments),\n metadata: options?.metadata,\n },\n });\n}\n\nexport async function _createMessageDeserialize(\n result: PathUncheckedResponse,\n): Promise<ThreadMessage> {\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 threadMessageDeserializer(result.body);\n}\n\n/** Creates a new message on a specified thread. */\nexport async function createMessage(\n context: Client,\n threadId: string,\n role: MessageRole,\n content: MessageInputContent,\n options: MessagesCreateMessageOptionalParams = { requestOptions: {} },\n): Promise<ThreadMessage> {\n const result = await _createMessageSend(context, threadId, role, content, options);\n return _createMessageDeserialize(result);\n}\n"]}
1
+ {"version":3,"file":"operations.js","sourceRoot":"","sources":["../../../../src/api/messages/operations.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EACL,wBAAwB,EAGxB,6BAA6B,EAC7B,gCAAgC,EAEhC,yBAAyB,EAEzB,2CAA2C,EAE3C,iCAAiC,GAClC,MAAM,wBAAwB,CAAC;AAQhC,OAAO,EAEL,uBAAuB,GACxB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAGL,eAAe,EACf,mCAAmC,GACpC,MAAM,yBAAyB,CAAC;AAEjC,MAAM,UAAU,YAAY,CAC1B,OAAe,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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,yBAAyB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAChD,CAAC;AAED,mDAAmD;AACnD,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,OAAe,EACf,QAAgB,EAChB,IAAiB,EACjB,OAA4B,EAC5B,UAA+C,EAAE,cAAc,EAAE,EAAE,EAAE;IAErE,MAAM,MAAM,GAAG,MAAM,kBAAkB,CAAC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IACnF,OAAO,yBAAyB,CAAC,MAAM,CAAC,CAAC;AAC3C,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { AgentsContext as Client } from \"../index.js\";\nimport {\n agentV1ErrorDeserializer,\n MessageRole,\n MessageInputContent,\n messageInputContentSerializer,\n messageAttachmentArraySerializer,\n ThreadMessage,\n threadMessageDeserializer,\n _AgentsPagedResultThreadMessage,\n _agentsPagedResultThreadMessageDeserializer,\n MessageDeletionStatus,\n messageDeletionStatusDeserializer,\n} from \"../../models/models.js\";\nimport {\n MessagesDeleteOptionalParams,\n MessagesUpdateMessageOptionalParams,\n MessagesGetMessageOptionalParams,\n MessagesListMessagesOptionalParams,\n MessagesCreateMessageOptionalParams,\n} from \"./options.js\";\nimport {\n PagedAsyncIterableIterator,\n buildPagedAsyncIterator,\n} from \"../../static-helpers/pagingHelpers.js\";\nimport { expandUrlTemplate } from \"../../static-helpers/urlTemplate.js\";\nimport {\n StreamableMethod,\n PathUncheckedResponse,\n createRestError,\n operationOptionsToRequestParameters,\n} from \"@azure-rest/core-client\";\n\nexport function _$deleteSend(\n context: Client,\n threadId: string,\n messageId: string,\n options: MessagesDeleteOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/threads/{threadId}/messages/{messageId}{?api-version}\",\n {\n threadId: threadId,\n messageId: messageId,\n \"api-version\": 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 _$deleteDeserialize(\n result: PathUncheckedResponse,\n): Promise<MessageDeletionStatus> {\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 messageDeletionStatusDeserializer(result.body);\n}\n\n/** Deletes an existing message on an existing thread. */\nexport async function $delete(\n context: Client,\n threadId: string,\n messageId: string,\n options: MessagesDeleteOptionalParams = { requestOptions: {} },\n): Promise<MessageDeletionStatus> {\n const result = await _$deleteSend(context, threadId, messageId, options);\n return _$deleteDeserialize(result);\n}\n\nexport function _updateMessageSend(\n context: Client,\n threadId: string,\n messageId: string,\n options: MessagesUpdateMessageOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/threads/{threadId}/messages/{messageId}{?api-version}\",\n {\n threadId: threadId,\n messageId: messageId,\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: \"application/json\",\n headers: {\n accept: \"application/json\",\n ...options.requestOptions?.headers,\n },\n body: { metadata: options?.metadata },\n });\n}\n\nexport async function _updateMessageDeserialize(\n result: PathUncheckedResponse,\n): Promise<ThreadMessage> {\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 threadMessageDeserializer(result.body);\n}\n\n/** Modifies an existing message on an existing thread. */\nexport async function updateMessage(\n context: Client,\n threadId: string,\n messageId: string,\n options: MessagesUpdateMessageOptionalParams = { requestOptions: {} },\n): Promise<ThreadMessage> {\n const result = await _updateMessageSend(context, threadId, messageId, options);\n return _updateMessageDeserialize(result);\n}\n\nexport function _getMessageSend(\n context: Client,\n threadId: string,\n messageId: string,\n options: MessagesGetMessageOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/threads/{threadId}/messages/{messageId}{?api-version}\",\n {\n threadId: threadId,\n messageId: messageId,\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 _getMessageDeserialize(\n result: PathUncheckedResponse,\n): Promise<ThreadMessage> {\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 threadMessageDeserializer(result.body);\n}\n\n/** Retrieves an existing message. */\nexport async function getMessage(\n context: Client,\n threadId: string,\n messageId: string,\n options: MessagesGetMessageOptionalParams = { requestOptions: {} },\n): Promise<ThreadMessage> {\n const result = await _getMessageSend(context, threadId, messageId, options);\n return _getMessageDeserialize(result);\n}\n\nexport function _listMessagesSend(\n context: Client,\n threadId: string,\n options: MessagesListMessagesOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/threads/{threadId}/messages{?run_id,api-version,limit,order,after,before}\",\n {\n threadId: threadId,\n run_id: options?.runId,\n \"api-version\": context.apiVersion,\n limit: options?.limit,\n order: options?.order,\n after: options?.after,\n before: options?.before,\n },\n {\n allowReserved: options?.requestOptions?.skipUrlEncoding,\n },\n );\n return context.path(path).get({\n ...operationOptionsToRequestParameters(options),\n headers: {\n accept: \"application/json\",\n ...options.requestOptions?.headers,\n },\n });\n}\n\nexport async function _listMessagesDeserialize(\n result: PathUncheckedResponse,\n): Promise<_AgentsPagedResultThreadMessage> {\n const expectedStatuses = [\"200\"];\n if (!expectedStatuses.includes(result.status)) {\n throw createRestError(result);\n }\n\n return _agentsPagedResultThreadMessageDeserializer(result.body);\n}\n\n/** Gets a list of messages that exist on a thread. */\nexport function listMessages(\n context: Client,\n threadId: string,\n options: MessagesListMessagesOptionalParams = { requestOptions: {} },\n): PagedAsyncIterableIterator<ThreadMessage> {\n return buildPagedAsyncIterator(\n context,\n () => _listMessagesSend(context, threadId, options),\n _listMessagesDeserialize,\n [\"200\"],\n { itemName: \"data\" },\n );\n}\n\nexport function _createMessageSend(\n context: Client,\n threadId: string,\n role: MessageRole,\n content: MessageInputContent,\n options: MessagesCreateMessageOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/threads/{threadId}/messages{?api-version}\",\n {\n threadId: threadId,\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: \"application/json\",\n headers: {\n accept: \"application/json\",\n ...options.requestOptions?.headers,\n },\n body: {\n role: role,\n content: messageInputContentSerializer(content),\n attachments: !options?.attachments\n ? options?.attachments\n : messageAttachmentArraySerializer(options?.attachments),\n metadata: options?.metadata,\n },\n });\n}\n\nexport async function _createMessageDeserialize(\n result: PathUncheckedResponse,\n): Promise<ThreadMessage> {\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 threadMessageDeserializer(result.body);\n}\n\n/** Creates a new message on a specified thread. */\nexport async function createMessage(\n context: Client,\n threadId: string,\n role: MessageRole,\n content: MessageInputContent,\n options: MessagesCreateMessageOptionalParams = { requestOptions: {} },\n): Promise<ThreadMessage> {\n const result = await _createMessageSend(context, threadId, role, content, options);\n return _createMessageDeserialize(result);\n}\n"]}
@@ -1,6 +1,9 @@
1
1
  import { MessageAttachment, ListSortOrder } from "../../models/models.js";
2
2
  import { OperationOptions } from "@azure-rest/core-client";
3
3
  /** Optional parameters. */
4
+ export interface MessagesDeleteOptionalParams extends OperationOptions {
5
+ }
6
+ /** Optional parameters. */
4
7
  export interface MessagesUpdateMessageOptionalParams extends OperationOptions {
5
8
  /** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */
6
9
  metadata?: Record<string, string> | null;
@@ -1 +1 @@
1
- {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../../src/api/messages/options.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,2BAA2B;AAC3B,MAAM,WAAW,mCAAoC,SAAQ,gBAAgB;IAC3E,yPAAyP;IACzP,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;CAC1C;AAED,2BAA2B;AAC3B,MAAM,WAAW,gCAAiC,SAAQ,gBAAgB;CAAG;AAE7E,2BAA2B;AAC3B,MAAM,WAAW,kCAAmC,SAAQ,gBAAgB;IAC1E,yDAAyD;IACzD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iHAAiH;IACjH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oHAAoH;IACpH,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,oRAAoR;IACpR,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0RAA0R;IAC1R,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,2BAA2B;AAC3B,MAAM,WAAW,mCAAoC,SAAQ,gBAAgB;IAC3E,sFAAsF;IACtF,WAAW,CAAC,EAAE,iBAAiB,EAAE,GAAG,IAAI,CAAC;IACzC,yPAAyP;IACzP,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;CAC1C"}
1
+ {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../../src/api/messages/options.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,2BAA2B;AAC3B,MAAM,WAAW,4BAA6B,SAAQ,gBAAgB;CAAG;AAEzE,2BAA2B;AAC3B,MAAM,WAAW,mCAAoC,SAAQ,gBAAgB;IAC3E,yPAAyP;IACzP,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;CAC1C;AAED,2BAA2B;AAC3B,MAAM,WAAW,gCAAiC,SAAQ,gBAAgB;CAAG;AAE7E,2BAA2B;AAC3B,MAAM,WAAW,kCAAmC,SAAQ,gBAAgB;IAC1E,yDAAyD;IACzD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iHAAiH;IACjH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oHAAoH;IACpH,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,oRAAoR;IACpR,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0RAA0R;IAC1R,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,2BAA2B;AAC3B,MAAM,WAAW,mCAAoC,SAAQ,gBAAgB;IAC3E,sFAAsF;IACtF,WAAW,CAAC,EAAE,iBAAiB,EAAE,GAAG,IAAI,CAAC;IACzC,yPAAyP;IACzP,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;CAC1C"}
@@ -1 +1 @@
1
- {"version":3,"file":"options.js","sourceRoot":"","sources":["../../../../src/api/messages/options.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { MessageAttachment, ListSortOrder } from \"../../models/models.js\";\nimport { OperationOptions } from \"@azure-rest/core-client\";\n\n/** Optional parameters. */\nexport interface MessagesUpdateMessageOptionalParams extends OperationOptions {\n /** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */\n metadata?: Record<string, string> | null;\n}\n\n/** Optional parameters. */\nexport interface MessagesGetMessageOptionalParams extends OperationOptions {}\n\n/** Optional parameters. */\nexport interface MessagesListMessagesOptionalParams extends OperationOptions {\n /** Filter messages by the run ID that generated them. */\n runId?: string;\n /** A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. */\n limit?: number;\n /** Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. */\n order?: ListSortOrder;\n /** A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. */\n after?: string;\n /** A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. */\n before?: string;\n}\n\n/** Optional parameters. */\nexport interface MessagesCreateMessageOptionalParams extends OperationOptions {\n /** A list of files attached to the message, and the tools they should be added to. */\n attachments?: MessageAttachment[] | null;\n /** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */\n metadata?: Record<string, string> | null;\n}\n"]}
1
+ {"version":3,"file":"options.js","sourceRoot":"","sources":["../../../../src/api/messages/options.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { MessageAttachment, ListSortOrder } from \"../../models/models.js\";\nimport { OperationOptions } from \"@azure-rest/core-client\";\n\n/** Optional parameters. */\nexport interface MessagesDeleteOptionalParams extends OperationOptions {}\n\n/** Optional parameters. */\nexport interface MessagesUpdateMessageOptionalParams extends OperationOptions {\n /** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */\n metadata?: Record<string, string> | null;\n}\n\n/** Optional parameters. */\nexport interface MessagesGetMessageOptionalParams extends OperationOptions {}\n\n/** Optional parameters. */\nexport interface MessagesListMessagesOptionalParams extends OperationOptions {\n /** Filter messages by the run ID that generated them. */\n runId?: string;\n /** A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. */\n limit?: number;\n /** Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. */\n order?: ListSortOrder;\n /** A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. */\n after?: string;\n /** A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. */\n before?: string;\n}\n\n/** Optional parameters. */\nexport interface MessagesCreateMessageOptionalParams extends OperationOptions {\n /** A list of files attached to the message, and the tools they should be added to. */\n attachments?: MessageAttachment[] | null;\n /** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */\n metadata?: Record<string, string> | null;\n}\n"]}
@@ -1,6 +1,5 @@
1
1
  import type { AgentsContext as Client } from "./index.js";
2
2
  import type { Agent, _AgentsPagedResultAgent, AgentDeletionStatus, ThreadRun } from "../models/models.js";
3
- import { ToolOutput } from "../models/models.js";
4
3
  import type { CreateThreadAndRunOptionalParams, DeleteAgentOptionalParams, UpdateAgentOptionalParams, GetAgentOptionalParams, ListAgentsOptionalParams, CreateAgentOptionalParams } from "./options.js";
5
4
  import type { PagedAsyncIterableIterator } from "../static-helpers/pagingHelpers.js";
6
5
  import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client";
@@ -34,5 +33,5 @@ export declare function createAgent(context: Client, model: string, options?: Cr
34
33
  export declare function createRunStreaming(context: Client, assistantId: string, threadId: string, options?: RunsCreateRunOptionalParams): Promise<AgentEventMessageStream>;
35
34
  /** Create a thread and run and stream the events */
36
35
  export declare function createThreadAndRunStreaming(context: Client, assistantId: string, options?: CreateThreadAndRunOptionalParams): Promise<AgentEventMessageStream>;
37
- export declare function submitToolOutputsToRunStreaming(context: Client, threadId: string, runId: string, toolOutputs: ToolOutput[], options?: RunsSubmitToolOutputsToRunOptionalParams): Promise<AgentEventMessageStream>;
36
+ export declare function submitToolOutputsToRunStreaming(context: Client, threadId: string, runId: string, options?: RunsSubmitToolOutputsToRunOptionalParams): Promise<AgentEventMessageStream>;
38
37
  //# sourceMappingURL=operations.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../../../src/api/operations.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,IAAI,MAAM,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,KAAK,EACV,KAAK,EACL,uBAAuB,EACvB,mBAAmB,EACnB,SAAS,EACV,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAeL,UAAU,EAKX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EACV,gCAAgC,EAChC,yBAAyB,EACzB,yBAAyB,EACzB,sBAAsB,EACtB,wBAAwB,EACxB,yBAAyB,EAC1B,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAGrF,OAAO,KAAK,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEvF,OAAO,KAAK,EAEV,uBAAuB,EAEvB,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EACV,2BAA2B,EAC3B,wCA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AC,KAAK,CAAC,CAQnC;AAED,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,yBAAkD,GAC1D,gBAAgB,CAkClB;AAED,wBAAsB,uBAAuB,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,KAAK,CAAC,CAS3F;AAED,2BAA2B;AAC3B,wBAAsB,WAAW,CAC/B,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,yBAAkD,GAC1D,OAAO,CAAC,KAAK,CAAC,CAGhB;AA2DD,yCAAyC;AACzC,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,2BAAoD,GAC5D,OAAO,CAAC,uBAAuB,CAAC,CAIlC;AAED,oDAAoD;AACpD,wBAAsB,2BAA2B,CAC/C,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,gCAAyD,GACjE,OAAO,CAAC,uBAAuB,CAAC,CAGlC;AAED,wBAAsB,+BAA+B,CACnD,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,wCAAiE,GACzE,OAAO,CAAC,uBAAuB,CAAC,CAIlC"}
@@ -317,8 +317,8 @@ export async function createThreadAndRunStreaming(context, assistantId, options
317
317
  const streamOptions = { ...options, stream: true };
318
318
  return processStream(_createThreadAndRunSend(context, assistantId, streamOptions));
319
319
  }
320
- export async function submitToolOutputsToRunStreaming(context, threadId, runId, toolOutputs, options = { requestOptions: {} }) {
320
+ export async function submitToolOutputsToRunStreaming(context, threadId, runId, options = { requestOptions: {} }) {
321
321
  const streamOptions = { ...options, stream: true };
322
- return processStream(_submitToolOutputsToRunSend(context, threadId, runId, toolOutputs, streamOptions));
322
+ return processStream(_submitToolOutputsToRunSend(context, threadId, runId, streamOptions));
323
323
  }
324
324
  //# sourceMappingURL=operations.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"operations.js","sourceRoot":"","sources":["../../../src/api/operations.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AASlC,OAAO,EACL,uBAAuB,EACvB,kCAAkC,EAClC,oCAAoC,EACpC,iBAAiB,EACjB,wBAAwB,EACxB,mCAAmC,EACnC,+BAA+B,EAC/B,oCAAoC,EACpC,0BAA0B,EAC1B,gCAAgC,EAChC,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EAEd,6BAA6B,EAC7B,6BAA6B,EAC7B,mBAAmB,EACnB,yBAAyB,GAC1B,MAAM,qBAAqB,CAAC;AAU7B,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAErE,OAAO,EAAE,eAAe,EAAE,mCAAmC,EAAE,MAAM,yBAAyB,CAAC;AAY/F,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AAEnF,MAAM,UAAU,uBAAuB,CACrC,OAAe,EACf,WAAmB,EACnB,UAA4C,EAAE,cAAc,EAAE,EAAE,EAAE;IAElE,MAAM,IAAI,GAAG,iBAAiB,CAC5B,6BAA6B,EAC7B;QACE,aAAa,EAAE,OAAO,CAAC,UAAU;KAClC,EACD;QACE,aAAa,EAAE,OAAO,EAAE,cAAc,EAAE,eAAe;KACxD,CACF,CAAC;IACF,OAAO,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC;QAC7B,GAAG,mCAAmC,CAAC,OAAO,CAAC;QAC/C,WAAW,EAAE,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W,EAAE,aAAa,CAAC,CAAC,CAAC;AACtF,CAAC;AAED,oDAAoD;AACpD,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAC/C,OAAe,EACf,WAAmB,EACnB,UAA4C,EAAE,cAAc,EAAE,EAAE,EAAE;IAElE,MAAM,aAAa,GAAG,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IACnD,OAAO,aAAa,CAAC,uBAAuB,CAAC,OAAO,EAAE,WAAW,EAAE,aAAa,CAAC,CAAC,CAAC;AACrF,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,+BAA+B,CACnD,OAAe,EACf,QAAgB,EAChB,KAAa,EACb,WAAyB,EACzB,UAAoD,EAAE,cAAc,EAAE,EAAE,EAAE;IAE1E,MAAM,aAAa,GAAG,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IAEnD,OAAO,aAAa,CAClB,2BAA2B,CAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,aAAa,CAAC,CAClF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AgentsContext as Client } from \"./index.js\";\nimport type {\n Agent,\n _AgentsPagedResultAgent,\n AgentDeletionStatus,\n ThreadRun,\n} from \"../models/models.js\";\nimport {\n toolResourcesSerializer,\n toolDefinitionUnionArraySerializer,\n agentsResponseFormatOptionSerializer,\n agentDeserializer,\n agentV1ErrorDeserializer,\n _agentsPagedResultAgentDeserializer,\n agentDeletionStatusDeserializer,\n agentThreadCreationOptionsSerializer,\n truncationObjectSerializer,\n agentsToolChoiceOptionSerializer,\n threadRunDeserializer,\n MessageStreamEvent,\n RunStepStreamEvent,\n RunStreamEvent,\n ToolOutput,\n messageDeltaChunkDeserializer,\n runStepDeltaChunkDeserializer,\n runStepDeserializer,\n threadMessageDeserializer,\n} from \"../models/models.js\";\nimport type {\n CreateThreadAndRunOptionalParams,\n DeleteAgentOptionalParams,\n UpdateAgentOptionalParams,\n GetAgentOptionalParams,\n ListAgentsOptionalParams,\n CreateAgentOptionalParams,\n} from \"./options.js\";\nimport type { PagedAsyncIterableIterator } from \"../static-helpers/pagingHelpers.js\";\nimport { buildPagedAsyncIterator } from \"../static-helpers/pagingHelpers.js\";\nimport { expandUrlTemplate } from \"../static-helpers/urlTemplate.js\";\nimport type { StreamableMethod, PathUncheckedResponse } from \"@azure-rest/core-client\";\nimport { createRestError, operationOptionsToRequestParameters } from \"@azure-rest/core-client\";\nimport type {\n AgentEventMessage,\n AgentEventMessageStream,\n AgentEventStreamData,\n AgentRunResponse,\n} from \"../models/streamingModels.js\";\nimport type {\n RunsCreateRunOptionalParams,\n RunsSubmitToolOutputsToRunOptionalParams,\n} from \"./runs/options.js\";\nimport type { EventMessageStream, EventMessage } from \"@azure/core-sse\";\nimport { createSseStream } from \"@azure/core-sse\";\nimport { isNodeLike } from \"@azure/core-util\";\nimport type { IncomingMessage } from \"http\";\nimport { logger } from \"../logger.js\";\nimport { _createRunSend, _submitToolOutputsToRunSend } from \"./runs/operations.js\";\n\nexport function _createThreadAndRunSend(\n context: Client,\n assistantId: string,\n options: CreateThreadAndRunOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/threads/runs{?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: \"application/json\",\n headers: {\n accept: \"application/json\",\n ...options.requestOptions?.headers,\n },\n body: {\n assistant_id: assistantId,\n thread: !options?.thread\n ? options?.thread\n : agentThreadCreationOptionsSerializer(options?.thread),\n model: options?.model,\n instructions: options?.instructions,\n tools: !options?.tools ? options?.tools : toolDefinitionUnionArraySerializer(options?.tools),\n tool_resources: !options?.toolResources\n ? options?.toolResources\n : toolResourcesSerializer(options?.toolResources),\n stream: options?.stream,\n temperature: options?.temperature,\n top_p: options?.topP,\n max_prompt_tokens: options?.maxPromptTokens,\n max_completion_tokens: options?.maxCompletionTokens,\n truncation_strategy: !options?.truncationStrategy\n ? options?.truncationStrategy\n : truncationObjectSerializer(options?.truncationStrategy),\n tool_choice: !options?.toolChoice\n ? options?.toolChoice\n : agentsToolChoiceOptionSerializer(options?.toolChoice),\n response_format: !options?.responseFormat\n ? options?.responseFormat\n : agentsResponseFormatOptionSerializer(options?.responseFormat),\n parallel_tool_calls: options?.parallelToolCalls,\n metadata: options?.metadata,\n },\n });\n}\n\nexport async function _createThreadAndRunDeserialize(\n result: PathUncheckedResponse,\n): Promise<ThreadRun> {\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 threadRunDeserializer(result.body);\n}\n\n/** Creates a new agent thread and immediately starts a run using that new thread. */\nexport function createThreadAndRun(\n context: Client,\n assistantId: string,\n options: CreateThreadAndRunOptionalParams = { requestOptions: {} },\n): AgentRunResponse {\n async function executeCreateThreadAndRun(): Promise<ThreadRun> {\n const result = await _createThreadAndRunSend(context, assistantId, options);\n return _createThreadAndRunDeserialize(result);\n }\n\n return {\n then: function (onFulfilled, onRejected) {\n return executeCreateThreadAndRun().then(onFulfilled, onRejected).catch(onRejected);\n },\n async stream(): Promise<AgentEventMessageStream> {\n return createThreadAndRunStreaming(context, assistantId, options);\n },\n };\n}\n\nexport function _deleteAgentSend(\n context: Client,\n assistantId: string,\n options: DeleteAgentOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/assistants/{assistantId}{?api-version}\",\n {\n assistantId: assistantId,\n \"api-version\": 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 _deleteAgentDeserialize(\n result: PathUncheckedResponse,\n): Promise<AgentDeletionStatus> {\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 agentDeletionStatusDeserializer(result.body);\n}\n\n/** Deletes an agent. */\nexport async function deleteAgent(\n context: Client,\n assistantId: string,\n options: DeleteAgentOptionalParams = { requestOptions: {} },\n): Promise<AgentDeletionStatus> {\n const result = await _deleteAgentSend(context, assistantId, options);\n return _deleteAgentDeserialize(result);\n}\n\nexport function _updateAgentSend(\n context: Client,\n assistantId: string,\n options: UpdateAgentOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/assistants/{assistantId}{?api-version}\",\n {\n assistantId: assistantId,\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: \"application/json\",\n headers: {\n accept: \"application/json\",\n ...options.requestOptions?.headers,\n },\n body: {\n model: options?.model,\n name: options?.name,\n description: options?.description,\n instructions: options?.instructions,\n tools: !options?.tools ? options?.tools : toolDefinitionUnionArraySerializer(options?.tools),\n tool_resources: !options?.toolResources\n ? options?.toolResources\n : toolResourcesSerializer(options?.toolResources),\n temperature: options?.temperature,\n top_p: options?.topP,\n response_format: !options?.responseFormat\n ? options?.responseFormat\n : agentsResponseFormatOptionSerializer(options?.responseFormat),\n metadata: options?.metadata,\n },\n });\n}\n\nexport async function _updateAgentDeserialize(result: PathUncheckedResponse): Promise<Agent> {\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 agentDeserializer(result.body);\n}\n\n/** Modifies an existing agent. */\nexport async function updateAgent(\n context: Client,\n assistantId: string,\n options: UpdateAgentOptionalParams = { requestOptions: {} },\n): Promise<Agent> {\n const result = await _updateAgentSend(context, assistantId, options);\n return _updateAgentDeserialize(result);\n}\n\nexport function _getAgentSend(\n context: Client,\n assistantId: string,\n options: GetAgentOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/assistants/{assistantId}{?api-version}\",\n {\n assistantId: assistantId,\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 _getAgentDeserialize(result: PathUncheckedResponse): Promise<Agent> {\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 agentDeserializer(result.body);\n}\n\n/** Retrieves an existing agent. */\nexport async function getAgent(\n context: Client,\n assistantId: string,\n options: GetAgentOptionalParams = { requestOptions: {} },\n): Promise<Agent> {\n const result = await _getAgentSend(context, assistantId, options);\n return _getAgentDeserialize(result);\n}\n\nexport function _listAgentsSend(\n context: Client,\n options: ListAgentsOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/assistants{?api-version,limit,order,after,before}\",\n {\n \"api-version\": context.apiVersion,\n limit: options?.limit,\n order: options?.order,\n after: options?.after,\n before: options?.before,\n },\n {\n allowReserved: options?.requestOptions?.skipUrlEncoding,\n },\n );\n return context.path(path).get({\n ...operationOptionsToRequestParameters(options),\n headers: {\n accept: \"application/json\",\n ...options.requestOptions?.headers,\n },\n });\n}\n\nexport async function _listAgentsDeserialize(\n result: PathUncheckedResponse,\n): Promise<_AgentsPagedResultAgent> {\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 _agentsPagedResultAgentDeserializer(result.body);\n}\n\n/** Gets a list of agents that were previously created. */\nexport function listAgents(\n context: Client,\n options: ListAgentsOptionalParams = { requestOptions: {} },\n): PagedAsyncIterableIterator<Agent> {\n return buildPagedAsyncIterator(\n context,\n () => _listAgentsSend(context, options),\n _listAgentsDeserialize,\n [\"200\"],\n { itemName: \"data\" },\n );\n}\n\nexport function _createAgentSend(\n context: Client,\n model: string,\n options: CreateAgentOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/assistants{?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: \"application/json\",\n headers: {\n accept: \"application/json\",\n ...options.requestOptions?.headers,\n },\n body: {\n model: model,\n name: options?.name,\n description: options?.description,\n instructions: options?.instructions,\n tools: !options?.tools ? options?.tools : toolDefinitionUnionArraySerializer(options?.tools),\n tool_resources: !options?.toolResources\n ? options?.toolResources\n : toolResourcesSerializer(options?.toolResources),\n temperature: options?.temperature,\n top_p: options?.topP,\n response_format: !options?.responseFormat\n ? options?.responseFormat\n : agentsResponseFormatOptionSerializer(options?.responseFormat),\n metadata: options?.metadata,\n },\n });\n}\n\nexport async function _createAgentDeserialize(result: PathUncheckedResponse): Promise<Agent> {\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 agentDeserializer(result.body);\n}\n\n/** Creates a new agent. */\nexport async function createAgent(\n context: Client,\n model: string,\n options: CreateAgentOptionalParams = { requestOptions: {} },\n): Promise<Agent> {\n const result = await _createAgentSend(context, model, options);\n return _createAgentDeserialize(result);\n}\n\nfunction createAgentStream(stream: EventMessageStream): AgentEventMessageStream {\n const asyncIterator = toAsyncIterable(stream);\n const asyncDisposable = stream as AsyncDisposable;\n return Object.assign(asyncIterator, asyncDisposable);\n}\n\nasync function* toAsyncIterable(stream: EventMessageStream): AsyncIterable<AgentEventMessage> {\n for await (const event of stream) {\n const data = deserializeEventData(event);\n yield { data: data, event: event.event };\n }\n}\n\nfunction deserializeEventData(event: EventMessage): AgentEventStreamData {\n try {\n const jsonData = JSON.parse(event.data);\n if (Object.values(RunStepStreamEvent).includes(event.event as RunStepStreamEvent)) {\n if (event.event === RunStepStreamEvent.ThreadRunStepDelta) {\n return runStepDeltaChunkDeserializer(jsonData);\n }\n return runStepDeserializer(jsonData);\n }\n if (Object.values(MessageStreamEvent).includes(event.event as MessageStreamEvent)) {\n if (event.event === MessageStreamEvent.ThreadMessageDelta) {\n return messageDeltaChunkDeserializer(jsonData);\n }\n return threadMessageDeserializer(jsonData);\n }\n if (Object.values(RunStreamEvent).includes(event.event as RunStreamEvent)) {\n return threadRunDeserializer(jsonData);\n }\n return jsonData;\n } catch (ex) {\n logger.error(`Failed to parse event data ${event.event} - error: ${ex}`);\n return event.data;\n }\n}\n\nasync function processStream(streamResponse: StreamableMethod): Promise<AgentEventMessageStream> {\n const expectedStatuses = [\"200\"];\n const result = isNodeLike\n ? await streamResponse.asNodeStream()\n : await streamResponse.asBrowserStream();\n\n if (!expectedStatuses.includes(result.status)) {\n throw createRestError(result);\n }\n if (!result.body) {\n throw new Error(\"No body in response\");\n }\n\n const stream = isNodeLike\n ? createSseStream(result.body as IncomingMessage)\n : createSseStream(result.body as ReadableStream);\n return createAgentStream(stream);\n}\n\n/** Create a run and stream the events */\nexport async function createRunStreaming(\n context: Client,\n assistantId: string,\n threadId: string,\n options: RunsCreateRunOptionalParams = { requestOptions: {} },\n): Promise<AgentEventMessageStream> {\n const streamOptions = { ...options, stream: true };\n\n return processStream(_createRunSend(context, threadId, assistantId, streamOptions));\n}\n\n/** Create a thread and run and stream the events */\nexport async function createThreadAndRunStreaming(\n context: Client,\n assistantId: string,\n options: CreateThreadAndRunOptionalParams = { requestOptions: {} },\n): Promise<AgentEventMessageStream> {\n const streamOptions = { ...options, stream: true };\n return processStream(_createThreadAndRunSend(context, assistantId, streamOptions));\n}\n\nexport async function submitToolOutputsToRunStreaming(\n context: Client,\n threadId: string,\n runId: string,\n toolOutputs: ToolOutput[],\n options: RunsSubmitToolOutputsToRunOptionalParams = { requestOptions: {} },\n): Promise<AgentEventMessageStream> {\n const streamOptions = { ...options, stream: true };\n\n return processStream(\n _submitToolOutputsToRunSend(context, threadId, runId, toolOutputs, streamOptions),\n );\n}\n"]}
1
+ {"version":3,"file":"operations.js","sourceRoot":"","sources":["../../../src/api/operations.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AASlC,OAAO,EACL,uBAAuB,EACvB,kCAAkC,EAClC,oCAAoC,EACpC,iBAAiB,EACjB,wBAAwB,EACxB,mCAAmC,EACnC,+BAA+B,EAC/B,oCAAoC,EACpC,0BAA0B,EAC1B,gCAAgC,EAChC,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACd,6BAA6B,EAC7B,6BAA6B,EAC7B,mBAAmB,EACnB,yBAAyB,GAC1B,MAAM,qBAAqB,CAAC;AAU7B,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAErE,OAAO,EAAE,eAAe,EAAE,mCAAmC,EAAE,MAAM,yBAAyB,CAAC;AAY/F,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AAEnF,MAAM,UAAU,uBAAuB,CACrC,OAAe,EACf,WAAmB,EACnB,UAA4C,EAAE,cAAc,EAAE,EAAE,EAAE;IAElE,MAAM,IAAI,GAAG,iBAAiB,CAC5B,6BAA6B,EAC7B;QACE,aAAa,EAAE,OAAO,CAAC,UAAU;KAClC,EACD;QACE,a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AAuC,EAAE,cAAc,EAAE,EAAE,EAAE;IAE7D,MAAM,aAAa,GAAG,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IAEnD,OAAO,aAAa,CAAC,cAAc,CAAC,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,aAAa,CAAC,CAAC,CAAC;AACtF,CAAC;AAED,oDAAoD;AACpD,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAC/C,OAAe,EACf,WAAmB,EACnB,UAA4C,EAAE,cAAc,EAAE,EAAE,EAAE;IAElE,MAAM,aAAa,GAAG,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IACnD,OAAO,aAAa,CAAC,uBAAuB,CAAC,OAAO,EAAE,WAAW,EAAE,aAAa,CAAC,CAAC,CAAC;AACrF,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,+BAA+B,CACnD,OAAe,EACf,QAAgB,EAChB,KAAa,EACb,UAAoD,EAAE,cAAc,EAAE,EAAE,EAAE;IAE1E,MAAM,aAAa,GAAG,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IAEnD,OAAO,aAAa,CAAC,2BAA2B,CAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC;AAC7F,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AgentsContext as Client } from \"./index.js\";\nimport type {\n Agent,\n _AgentsPagedResultAgent,\n AgentDeletionStatus,\n ThreadRun,\n} from \"../models/models.js\";\nimport {\n toolResourcesSerializer,\n toolDefinitionUnionArraySerializer,\n agentsResponseFormatOptionSerializer,\n agentDeserializer,\n agentV1ErrorDeserializer,\n _agentsPagedResultAgentDeserializer,\n agentDeletionStatusDeserializer,\n agentThreadCreationOptionsSerializer,\n truncationObjectSerializer,\n agentsToolChoiceOptionSerializer,\n threadRunDeserializer,\n MessageStreamEvent,\n RunStepStreamEvent,\n RunStreamEvent,\n messageDeltaChunkDeserializer,\n runStepDeltaChunkDeserializer,\n runStepDeserializer,\n threadMessageDeserializer,\n} from \"../models/models.js\";\nimport type {\n CreateThreadAndRunOptionalParams,\n DeleteAgentOptionalParams,\n UpdateAgentOptionalParams,\n GetAgentOptionalParams,\n ListAgentsOptionalParams,\n CreateAgentOptionalParams,\n} from \"./options.js\";\nimport type { PagedAsyncIterableIterator } from \"../static-helpers/pagingHelpers.js\";\nimport { buildPagedAsyncIterator } from \"../static-helpers/pagingHelpers.js\";\nimport { expandUrlTemplate } from \"../static-helpers/urlTemplate.js\";\nimport type { StreamableMethod, PathUncheckedResponse } from \"@azure-rest/core-client\";\nimport { createRestError, operationOptionsToRequestParameters } from \"@azure-rest/core-client\";\nimport type {\n AgentEventMessage,\n AgentEventMessageStream,\n AgentEventStreamData,\n AgentRunResponse,\n} from \"../models/streamingModels.js\";\nimport type {\n RunsCreateRunOptionalParams,\n RunsSubmitToolOutputsToRunOptionalParams,\n} from \"./runs/options.js\";\nimport type { EventMessageStream, EventMessage } from \"@azure/core-sse\";\nimport { createSseStream } from \"@azure/core-sse\";\nimport { isNodeLike } from \"@azure/core-util\";\nimport type { IncomingMessage } from \"http\";\nimport { logger } from \"../logger.js\";\nimport { _createRunSend, _submitToolOutputsToRunSend } from \"./runs/operations.js\";\n\nexport function _createThreadAndRunSend(\n context: Client,\n assistantId: string,\n options: CreateThreadAndRunOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/threads/runs{?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: \"application/json\",\n headers: {\n accept: \"application/json\",\n ...options.requestOptions?.headers,\n },\n body: {\n assistant_id: assistantId,\n thread: !options?.thread\n ? options?.thread\n : agentThreadCreationOptionsSerializer(options?.thread),\n model: options?.model,\n instructions: options?.instructions,\n tools: !options?.tools ? options?.tools : toolDefinitionUnionArraySerializer(options?.tools),\n tool_resources: !options?.toolResources\n ? options?.toolResources\n : toolResourcesSerializer(options?.toolResources),\n stream: options?.stream,\n temperature: options?.temperature,\n top_p: options?.topP,\n max_prompt_tokens: options?.maxPromptTokens,\n max_completion_tokens: options?.maxCompletionTokens,\n truncation_strategy: !options?.truncationStrategy\n ? options?.truncationStrategy\n : truncationObjectSerializer(options?.truncationStrategy),\n tool_choice: !options?.toolChoice\n ? options?.toolChoice\n : agentsToolChoiceOptionSerializer(options?.toolChoice),\n response_format: !options?.responseFormat\n ? options?.responseFormat\n : agentsResponseFormatOptionSerializer(options?.responseFormat),\n parallel_tool_calls: options?.parallelToolCalls,\n metadata: options?.metadata,\n },\n });\n}\n\nexport async function _createThreadAndRunDeserialize(\n result: PathUncheckedResponse,\n): Promise<ThreadRun> {\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 threadRunDeserializer(result.body);\n}\n\n/** Creates a new agent thread and immediately starts a run using that new thread. */\nexport function createThreadAndRun(\n context: Client,\n assistantId: string,\n options: CreateThreadAndRunOptionalParams = { requestOptions: {} },\n): AgentRunResponse {\n async function executeCreateThreadAndRun(): Promise<ThreadRun> {\n const result = await _createThreadAndRunSend(context, assistantId, options);\n return _createThreadAndRunDeserialize(result);\n }\n\n return {\n then: function (onFulfilled, onRejected) {\n return executeCreateThreadAndRun().then(onFulfilled, onRejected).catch(onRejected);\n },\n async stream(): Promise<AgentEventMessageStream> {\n return createThreadAndRunStreaming(context, assistantId, options);\n },\n };\n}\n\nexport function _deleteAgentSend(\n context: Client,\n assistantId: string,\n options: DeleteAgentOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/assistants/{assistantId}{?api-version}\",\n {\n assistantId: assistantId,\n \"api-version\": 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 _deleteAgentDeserialize(\n result: PathUncheckedResponse,\n): Promise<AgentDeletionStatus> {\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 agentDeletionStatusDeserializer(result.body);\n}\n\n/** Deletes an agent. */\nexport async function deleteAgent(\n context: Client,\n assistantId: string,\n options: DeleteAgentOptionalParams = { requestOptions: {} },\n): Promise<AgentDeletionStatus> {\n const result = await _deleteAgentSend(context, assistantId, options);\n return _deleteAgentDeserialize(result);\n}\n\nexport function _updateAgentSend(\n context: Client,\n assistantId: string,\n options: UpdateAgentOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/assistants/{assistantId}{?api-version}\",\n {\n assistantId: assistantId,\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: \"application/json\",\n headers: {\n accept: \"application/json\",\n ...options.requestOptions?.headers,\n },\n body: {\n model: options?.model,\n name: options?.name,\n description: options?.description,\n instructions: options?.instructions,\n tools: !options?.tools ? options?.tools : toolDefinitionUnionArraySerializer(options?.tools),\n tool_resources: !options?.toolResources\n ? options?.toolResources\n : toolResourcesSerializer(options?.toolResources),\n temperature: options?.temperature,\n top_p: options?.topP,\n response_format: !options?.responseFormat\n ? options?.responseFormat\n : agentsResponseFormatOptionSerializer(options?.responseFormat),\n metadata: options?.metadata,\n },\n });\n}\n\nexport async function _updateAgentDeserialize(result: PathUncheckedResponse): Promise<Agent> {\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 agentDeserializer(result.body);\n}\n\n/** Modifies an existing agent. */\nexport async function updateAgent(\n context: Client,\n assistantId: string,\n options: UpdateAgentOptionalParams = { requestOptions: {} },\n): Promise<Agent> {\n const result = await _updateAgentSend(context, assistantId, options);\n return _updateAgentDeserialize(result);\n}\n\nexport function _getAgentSend(\n context: Client,\n assistantId: string,\n options: GetAgentOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/assistants/{assistantId}{?api-version}\",\n {\n assistantId: assistantId,\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 _getAgentDeserialize(result: PathUncheckedResponse): Promise<Agent> {\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 agentDeserializer(result.body);\n}\n\n/** Retrieves an existing agent. */\nexport async function getAgent(\n context: Client,\n assistantId: string,\n options: GetAgentOptionalParams = { requestOptions: {} },\n): Promise<Agent> {\n const result = await _getAgentSend(context, assistantId, options);\n return _getAgentDeserialize(result);\n}\n\nexport function _listAgentsSend(\n context: Client,\n options: ListAgentsOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/assistants{?api-version,limit,order,after,before}\",\n {\n \"api-version\": context.apiVersion,\n limit: options?.limit,\n order: options?.order,\n after: options?.after,\n before: options?.before,\n },\n {\n allowReserved: options?.requestOptions?.skipUrlEncoding,\n },\n );\n return context.path(path).get({\n ...operationOptionsToRequestParameters(options),\n headers: {\n accept: \"application/json\",\n ...options.requestOptions?.headers,\n },\n });\n}\n\nexport async function _listAgentsDeserialize(\n result: PathUncheckedResponse,\n): Promise<_AgentsPagedResultAgent> {\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 _agentsPagedResultAgentDeserializer(result.body);\n}\n\n/** Gets a list of agents that were previously created. */\nexport function listAgents(\n context: Client,\n options: ListAgentsOptionalParams = { requestOptions: {} },\n): PagedAsyncIterableIterator<Agent> {\n return buildPagedAsyncIterator(\n context,\n () => _listAgentsSend(context, options),\n _listAgentsDeserialize,\n [\"200\"],\n { itemName: \"data\" },\n );\n}\n\nexport function _createAgentSend(\n context: Client,\n model: string,\n options: CreateAgentOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/assistants{?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: \"application/json\",\n headers: {\n accept: \"application/json\",\n ...options.requestOptions?.headers,\n },\n body: {\n model: model,\n name: options?.name,\n description: options?.description,\n instructions: options?.instructions,\n tools: !options?.tools ? options?.tools : toolDefinitionUnionArraySerializer(options?.tools),\n tool_resources: !options?.toolResources\n ? options?.toolResources\n : toolResourcesSerializer(options?.toolResources),\n temperature: options?.temperature,\n top_p: options?.topP,\n response_format: !options?.responseFormat\n ? options?.responseFormat\n : agentsResponseFormatOptionSerializer(options?.responseFormat),\n metadata: options?.metadata,\n },\n });\n}\n\nexport async function _createAgentDeserialize(result: PathUncheckedResponse): Promise<Agent> {\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 agentDeserializer(result.body);\n}\n\n/** Creates a new agent. */\nexport async function createAgent(\n context: Client,\n model: string,\n options: CreateAgentOptionalParams = { requestOptions: {} },\n): Promise<Agent> {\n const result = await _createAgentSend(context, model, options);\n return _createAgentDeserialize(result);\n}\n\nfunction createAgentStream(stream: EventMessageStream): AgentEventMessageStream {\n const asyncIterator = toAsyncIterable(stream);\n const asyncDisposable = stream as AsyncDisposable;\n return Object.assign(asyncIterator, asyncDisposable);\n}\n\nasync function* toAsyncIterable(stream: EventMessageStream): AsyncIterable<AgentEventMessage> {\n for await (const event of stream) {\n const data = deserializeEventData(event);\n yield { data: data, event: event.event };\n }\n}\n\nfunction deserializeEventData(event: EventMessage): AgentEventStreamData {\n try {\n const jsonData = JSON.parse(event.data);\n if (Object.values(RunStepStreamEvent).includes(event.event as RunStepStreamEvent)) {\n if (event.event === RunStepStreamEvent.ThreadRunStepDelta) {\n return runStepDeltaChunkDeserializer(jsonData);\n }\n return runStepDeserializer(jsonData);\n }\n if (Object.values(MessageStreamEvent).includes(event.event as MessageStreamEvent)) {\n if (event.event === MessageStreamEvent.ThreadMessageDelta) {\n return messageDeltaChunkDeserializer(jsonData);\n }\n return threadMessageDeserializer(jsonData);\n }\n if (Object.values(RunStreamEvent).includes(event.event as RunStreamEvent)) {\n return threadRunDeserializer(jsonData);\n }\n return jsonData;\n } catch (ex) {\n logger.error(`Failed to parse event data ${event.event} - error: ${ex}`);\n return event.data;\n }\n}\n\nasync function processStream(streamResponse: StreamableMethod): Promise<AgentEventMessageStream> {\n const expectedStatuses = [\"200\"];\n const result = isNodeLike\n ? await streamResponse.asNodeStream()\n : await streamResponse.asBrowserStream();\n\n if (!expectedStatuses.includes(result.status)) {\n throw createRestError(result);\n }\n if (!result.body) {\n throw new Error(\"No body in response\");\n }\n\n const stream = isNodeLike\n ? createSseStream(result.body as IncomingMessage)\n : createSseStream(result.body as ReadableStream);\n return createAgentStream(stream);\n}\n\n/** Create a run and stream the events */\nexport async function createRunStreaming(\n context: Client,\n assistantId: string,\n threadId: string,\n options: RunsCreateRunOptionalParams = { requestOptions: {} },\n): Promise<AgentEventMessageStream> {\n const streamOptions = { ...options, stream: true };\n\n return processStream(_createRunSend(context, threadId, assistantId, streamOptions));\n}\n\n/** Create a thread and run and stream the events */\nexport async function createThreadAndRunStreaming(\n context: Client,\n assistantId: string,\n options: CreateThreadAndRunOptionalParams = { requestOptions: {} },\n): Promise<AgentEventMessageStream> {\n const streamOptions = { ...options, stream: true };\n return processStream(_createThreadAndRunSend(context, assistantId, streamOptions));\n}\n\nexport async function submitToolOutputsToRunStreaming(\n context: Client,\n threadId: string,\n runId: string,\n options: RunsSubmitToolOutputsToRunOptionalParams = { requestOptions: {} },\n): Promise<AgentEventMessageStream> {\n const streamOptions = { ...options, stream: true };\n\n return processStream(_submitToolOutputsToRunSend(context, threadId, runId, streamOptions));\n}\n"]}