@azure/ai-agents 1.0.0-alpha.20250505.3 → 1.0.0-alpha.20250509.4

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 (702) hide show
  1. package/README.md +196 -214
  2. package/dist/browser/agentsClient.d.ts +31 -93
  3. package/dist/browser/agentsClient.d.ts.map +1 -1
  4. package/dist/browser/agentsClient.js +17 -168
  5. package/dist/browser/agentsClient.js.map +1 -1
  6. package/dist/browser/api/agentsContext.d.ts.map +1 -1
  7. package/dist/browser/api/agentsContext.js +7 -19
  8. package/dist/browser/api/agentsContext.js.map +1 -1
  9. package/dist/browser/api/files/index.d.ts +3 -0
  10. package/dist/browser/api/files/index.d.ts.map +1 -0
  11. package/dist/browser/api/files/index.js +4 -0
  12. package/dist/browser/api/files/index.js.map +1 -0
  13. package/dist/browser/api/files/operations.d.ts +45 -0
  14. package/dist/browser/api/files/operations.d.ts.map +1 -0
  15. package/dist/browser/api/files/operations.js +154 -0
  16. package/dist/browser/api/files/operations.js.map +1 -0
  17. package/dist/browser/api/files/options.d.ts +23 -0
  18. package/dist/browser/api/files/options.d.ts.map +1 -0
  19. package/dist/browser/api/files/options.js +4 -0
  20. package/dist/browser/api/files/options.js.map +1 -0
  21. package/dist/browser/api/index.d.ts +2 -2
  22. package/dist/browser/api/index.d.ts.map +1 -1
  23. package/dist/browser/api/index.js +1 -1
  24. package/dist/browser/api/index.js.map +1 -1
  25. package/dist/browser/api/messages/index.d.ts +3 -0
  26. package/dist/browser/api/messages/index.d.ts.map +1 -0
  27. package/dist/browser/api/messages/index.js +4 -0
  28. package/dist/browser/api/messages/index.js.map +1 -0
  29. package/dist/browser/api/messages/operations.d.ts +22 -0
  30. package/dist/browser/api/messages/operations.d.ts.map +1 -0
  31. package/dist/browser/api/messages/operations.js +108 -0
  32. package/dist/browser/api/messages/operations.js.map +1 -0
  33. package/dist/browser/api/messages/options.d.ts +31 -0
  34. package/dist/browser/api/messages/options.d.ts.map +1 -0
  35. package/dist/browser/api/messages/options.js +4 -0
  36. package/dist/browser/api/messages/options.js.map +1 -0
  37. package/dist/browser/api/operations.d.ts +8 -183
  38. package/dist/browser/api/operations.d.ts.map +1 -1
  39. package/dist/browser/api/operations.js +14 -1063
  40. package/dist/browser/api/operations.js.map +1 -1
  41. package/dist/browser/api/options.d.ts +25 -322
  42. package/dist/browser/api/options.d.ts.map +1 -1
  43. package/dist/browser/api/options.js.map +1 -1
  44. package/dist/browser/api/runSteps/index.d.ts +3 -0
  45. package/dist/browser/api/runSteps/index.d.ts.map +1 -0
  46. package/dist/browser/api/runSteps/index.js +4 -0
  47. package/dist/browser/api/runSteps/index.js.map +1 -0
  48. package/dist/browser/api/runSteps/operations.d.ts +14 -0
  49. package/dist/browser/api/runSteps/operations.d.ts.map +1 -0
  50. package/dist/browser/api/runSteps/operations.js +67 -0
  51. package/dist/browser/api/runSteps/operations.js.map +1 -0
  52. package/dist/browser/api/runSteps/options.d.ts +27 -0
  53. package/dist/browser/api/runSteps/options.d.ts.map +1 -0
  54. package/dist/browser/api/runSteps/options.js +4 -0
  55. package/dist/browser/api/runSteps/options.js.map +1 -0
  56. package/dist/browser/api/runs/index.d.ts +3 -0
  57. package/dist/browser/api/runs/index.d.ts.map +1 -0
  58. package/dist/browser/api/runs/index.js +4 -0
  59. package/dist/browser/api/runs/index.js.map +1 -0
  60. package/dist/browser/api/runs/operations.d.ts +31 -0
  61. package/dist/browser/api/runs/operations.d.ts.map +1 -0
  62. package/dist/browser/api/runs/operations.js +190 -0
  63. package/dist/browser/api/runs/operations.js.map +1 -0
  64. package/dist/browser/api/runs/options.d.ts +92 -0
  65. package/dist/browser/api/runs/options.d.ts.map +1 -0
  66. package/dist/browser/api/runs/options.js +4 -0
  67. package/dist/browser/api/runs/options.js.map +1 -0
  68. package/dist/browser/api/threads/index.d.ts +3 -0
  69. package/dist/browser/api/threads/index.d.ts.map +1 -0
  70. package/dist/browser/api/threads/index.js +4 -0
  71. package/dist/browser/api/threads/index.js.map +1 -0
  72. package/dist/browser/api/threads/operations.d.ts +26 -0
  73. package/dist/browser/api/threads/operations.d.ts.map +1 -0
  74. package/dist/browser/api/threads/operations.js +131 -0
  75. package/dist/browser/api/threads/operations.js.map +1 -0
  76. package/dist/browser/api/threads/options.d.ts +44 -0
  77. package/dist/browser/api/threads/options.d.ts.map +1 -0
  78. package/dist/browser/api/threads/options.js +4 -0
  79. package/dist/browser/api/threads/options.js.map +1 -0
  80. package/dist/browser/api/vectorStoreFileBatches/index.d.ts +3 -0
  81. package/dist/browser/api/vectorStoreFileBatches/index.d.ts.map +1 -0
  82. package/dist/browser/api/vectorStoreFileBatches/index.js +4 -0
  83. package/dist/browser/api/vectorStoreFileBatches/index.js.map +1 -0
  84. package/dist/browser/api/vectorStoreFileBatches/operations.d.ts +27 -0
  85. package/dist/browser/api/vectorStoreFileBatches/operations.d.ts.map +1 -0
  86. package/dist/browser/api/vectorStoreFileBatches/operations.js +161 -0
  87. package/dist/browser/api/vectorStoreFileBatches/operations.js.map +1 -0
  88. package/dist/browser/api/vectorStoreFileBatches/options.d.ts +32 -0
  89. package/dist/browser/api/vectorStoreFileBatches/options.d.ts.map +1 -0
  90. package/dist/browser/api/vectorStoreFileBatches/options.js +4 -0
  91. package/dist/browser/api/vectorStoreFileBatches/options.js.map +1 -0
  92. package/dist/browser/api/vectorStoreFiles/index.d.ts +3 -0
  93. package/dist/browser/api/vectorStoreFiles/index.d.ts.map +1 -0
  94. package/dist/browser/api/vectorStoreFiles/index.js +4 -0
  95. package/dist/browser/api/vectorStoreFiles/index.js.map +1 -0
  96. package/dist/browser/api/vectorStoreFiles/operations.d.ts +27 -0
  97. package/dist/browser/api/vectorStoreFiles/operations.d.ts.map +1 -0
  98. package/dist/browser/api/vectorStoreFiles/operations.js +176 -0
  99. package/dist/browser/api/vectorStoreFiles/operations.js.map +1 -0
  100. package/dist/browser/api/vectorStoreFiles/options.d.ts +32 -0
  101. package/dist/browser/api/vectorStoreFiles/options.d.ts.map +1 -0
  102. package/dist/browser/api/vectorStoreFiles/options.js +4 -0
  103. package/dist/browser/api/vectorStoreFiles/options.js.map +1 -0
  104. package/dist/browser/api/vectorStores/index.d.ts +3 -0
  105. package/dist/browser/api/vectorStores/index.d.ts.map +1 -0
  106. package/dist/browser/api/vectorStores/index.js +4 -0
  107. package/dist/browser/api/vectorStores/index.js.map +1 -0
  108. package/dist/browser/api/vectorStores/operations.d.ts +33 -0
  109. package/dist/browser/api/vectorStores/operations.d.ts.map +1 -0
  110. package/dist/browser/api/vectorStores/operations.js +184 -0
  111. package/dist/browser/api/vectorStores/operations.js.map +1 -0
  112. package/dist/browser/api/vectorStores/options.d.ts +45 -0
  113. package/dist/browser/api/vectorStores/options.d.ts.map +1 -0
  114. package/dist/browser/api/vectorStores/options.js +4 -0
  115. package/dist/browser/api/vectorStores/options.js.map +1 -0
  116. package/dist/browser/classic/files/index.d.ts +22 -0
  117. package/dist/browser/classic/files/index.d.ts.map +1 -0
  118. package/dist/browser/classic/files/index.js +17 -0
  119. package/dist/browser/classic/files/index.js.map +1 -0
  120. package/dist/browser/classic/index.d.ts +9 -0
  121. package/dist/browser/classic/index.d.ts.map +1 -0
  122. package/dist/browser/classic/index.js +4 -0
  123. package/dist/browser/classic/index.js.map +1 -0
  124. package/dist/browser/classic/messages/index.d.ts +17 -0
  125. package/dist/browser/classic/messages/index.d.ts.map +1 -0
  126. package/dist/browser/classic/messages/index.js +15 -0
  127. package/dist/browser/classic/messages/index.js.map +1 -0
  128. package/dist/browser/classic/runSteps/index.d.ts +14 -0
  129. package/dist/browser/classic/runSteps/index.d.ts.map +1 -0
  130. package/dist/browser/classic/runSteps/index.js +13 -0
  131. package/dist/browser/classic/runSteps/index.js.map +1 -0
  132. package/dist/browser/classic/runs/index.d.ts +25 -0
  133. package/dist/browser/classic/runs/index.d.ts.map +1 -0
  134. package/dist/browser/classic/runs/index.js +19 -0
  135. package/dist/browser/classic/runs/index.js.map +1 -0
  136. package/dist/browser/classic/threads/index.d.ts +19 -0
  137. package/dist/browser/classic/threads/index.d.ts.map +1 -0
  138. package/dist/browser/classic/threads/index.js +16 -0
  139. package/dist/browser/classic/threads/index.js.map +1 -0
  140. package/dist/browser/classic/vectorStoreFileBatches/index.d.ts +20 -0
  141. package/dist/browser/classic/vectorStoreFileBatches/index.d.ts.map +1 -0
  142. package/dist/browser/classic/vectorStoreFileBatches/index.js +16 -0
  143. package/dist/browser/classic/vectorStoreFileBatches/index.js.map +1 -0
  144. package/dist/browser/classic/vectorStoreFiles/index.d.ts +20 -0
  145. package/dist/browser/classic/vectorStoreFiles/index.d.ts.map +1 -0
  146. package/dist/browser/classic/vectorStoreFiles/index.js +14 -0
  147. package/dist/browser/classic/vectorStoreFiles/index.js.map +1 -0
  148. package/dist/browser/classic/vectorStores/index.d.ts +22 -0
  149. package/dist/browser/classic/vectorStores/index.d.ts.map +1 -0
  150. package/dist/browser/classic/vectorStores/index.js +17 -0
  151. package/dist/browser/classic/vectorStores/index.js.map +1 -0
  152. package/dist/browser/index.d.ts +14 -3
  153. package/dist/browser/index.d.ts.map +1 -1
  154. package/dist/browser/index.js +2 -2
  155. package/dist/browser/index.js.map +1 -1
  156. package/dist/browser/models/index.d.ts +1 -1
  157. package/dist/browser/models/index.d.ts.map +1 -1
  158. package/dist/browser/models/index.js +1 -1
  159. package/dist/browser/models/index.js.map +1 -1
  160. package/dist/browser/models/models.d.ts +389 -337
  161. package/dist/browser/models/models.d.ts.map +1 -1
  162. package/dist/browser/models/models.js +378 -296
  163. package/dist/browser/models/models.js.map +1 -1
  164. package/dist/browser/static-helpers/multipartHelpers.d.ts +1 -1
  165. package/dist/browser/static-helpers/multipartHelpers.d.ts.map +1 -1
  166. package/dist/browser/static-helpers/multipartHelpers.js.map +1 -1
  167. package/dist/browser/static-helpers/pagingHelpers.d.ts +72 -0
  168. package/dist/browser/static-helpers/pagingHelpers.d.ts.map +1 -0
  169. package/dist/browser/static-helpers/pagingHelpers.js +137 -0
  170. package/dist/browser/static-helpers/pagingHelpers.js.map +1 -0
  171. package/dist/browser/static-helpers/urlTemplate.d.ts.map +1 -1
  172. package/dist/browser/static-helpers/urlTemplate.js.map +1 -1
  173. package/dist/browser/utils.d.ts +26 -5
  174. package/dist/browser/utils.d.ts.map +1 -1
  175. package/dist/browser/utils.js +44 -8
  176. package/dist/browser/utils.js.map +1 -1
  177. package/dist/commonjs/agentsClient.d.ts +31 -93
  178. package/dist/commonjs/agentsClient.d.ts.map +1 -1
  179. package/dist/commonjs/agentsClient.js +16 -167
  180. package/dist/commonjs/agentsClient.js.map +1 -1
  181. package/dist/commonjs/api/agentsContext.d.ts.map +1 -1
  182. package/dist/commonjs/api/agentsContext.js +7 -19
  183. package/dist/commonjs/api/agentsContext.js.map +1 -1
  184. package/dist/commonjs/api/files/index.d.ts +3 -0
  185. package/dist/commonjs/api/files/index.d.ts.map +1 -0
  186. package/dist/commonjs/api/files/index.js +12 -0
  187. package/dist/commonjs/api/files/index.js.map +1 -0
  188. package/dist/commonjs/api/files/operations.d.ts +45 -0
  189. package/dist/commonjs/api/files/operations.d.ts.map +1 -0
  190. package/dist/commonjs/api/files/operations.js +172 -0
  191. package/dist/commonjs/api/files/operations.js.map +1 -0
  192. package/dist/commonjs/api/files/options.d.ts +23 -0
  193. package/dist/commonjs/api/files/options.d.ts.map +1 -0
  194. package/dist/commonjs/api/files/options.js +5 -0
  195. package/dist/commonjs/api/files/options.js.map +1 -0
  196. package/dist/commonjs/api/index.d.ts +2 -2
  197. package/dist/commonjs/api/index.d.ts.map +1 -1
  198. package/dist/commonjs/api/index.js +2 -38
  199. package/dist/commonjs/api/index.js.map +1 -1
  200. package/dist/commonjs/api/messages/index.d.ts +3 -0
  201. package/dist/commonjs/api/messages/index.d.ts.map +1 -0
  202. package/dist/commonjs/api/messages/index.js +11 -0
  203. package/dist/commonjs/api/messages/index.js.map +1 -0
  204. package/dist/commonjs/api/messages/operations.d.ts +22 -0
  205. package/dist/commonjs/api/messages/operations.d.ts.map +1 -0
  206. package/dist/commonjs/api/messages/operations.js +122 -0
  207. package/dist/commonjs/api/messages/operations.js.map +1 -0
  208. package/dist/commonjs/api/messages/options.d.ts +31 -0
  209. package/dist/commonjs/api/messages/options.d.ts.map +1 -0
  210. package/dist/commonjs/api/messages/options.js +5 -0
  211. package/dist/commonjs/api/messages/options.js.map +1 -0
  212. package/dist/commonjs/api/operations.d.ts +8 -183
  213. package/dist/commonjs/api/operations.d.ts.map +1 -1
  214. package/dist/commonjs/api/operations.js +14 -1176
  215. package/dist/commonjs/api/operations.js.map +1 -1
  216. package/dist/commonjs/api/options.d.ts +25 -322
  217. package/dist/commonjs/api/options.d.ts.map +1 -1
  218. package/dist/commonjs/api/options.js.map +1 -1
  219. package/dist/commonjs/api/runSteps/index.d.ts +3 -0
  220. package/dist/commonjs/api/runSteps/index.d.ts.map +1 -0
  221. package/dist/commonjs/api/runSteps/index.js +9 -0
  222. package/dist/commonjs/api/runSteps/index.js.map +1 -0
  223. package/dist/commonjs/api/runSteps/operations.d.ts +14 -0
  224. package/dist/commonjs/api/runSteps/operations.d.ts.map +1 -0
  225. package/dist/commonjs/api/runSteps/operations.js +75 -0
  226. package/dist/commonjs/api/runSteps/operations.js.map +1 -0
  227. package/dist/commonjs/api/runSteps/options.d.ts +27 -0
  228. package/dist/commonjs/api/runSteps/options.d.ts.map +1 -0
  229. package/dist/commonjs/api/runSteps/options.js +5 -0
  230. package/dist/commonjs/api/runSteps/options.js.map +1 -0
  231. package/dist/commonjs/api/runs/index.d.ts +3 -0
  232. package/dist/commonjs/api/runs/index.d.ts.map +1 -0
  233. package/dist/commonjs/api/runs/index.js +13 -0
  234. package/dist/commonjs/api/runs/index.js.map +1 -0
  235. package/dist/commonjs/api/runs/operations.d.ts +31 -0
  236. package/dist/commonjs/api/runs/operations.d.ts.map +1 -0
  237. package/dist/commonjs/api/runs/operations.js +210 -0
  238. package/dist/commonjs/api/runs/operations.js.map +1 -0
  239. package/dist/commonjs/api/runs/options.d.ts +92 -0
  240. package/dist/commonjs/api/runs/options.d.ts.map +1 -0
  241. package/dist/commonjs/api/runs/options.js +5 -0
  242. package/dist/commonjs/api/runs/options.js.map +1 -0
  243. package/dist/commonjs/api/threads/index.d.ts +3 -0
  244. package/dist/commonjs/api/threads/index.d.ts.map +1 -0
  245. package/dist/commonjs/api/threads/index.js +12 -0
  246. package/dist/commonjs/api/threads/index.js.map +1 -0
  247. package/dist/commonjs/api/threads/operations.d.ts +26 -0
  248. package/dist/commonjs/api/threads/operations.d.ts.map +1 -0
  249. package/dist/commonjs/api/threads/operations.js +148 -0
  250. package/dist/commonjs/api/threads/operations.js.map +1 -0
  251. package/dist/commonjs/api/threads/options.d.ts +44 -0
  252. package/dist/commonjs/api/threads/options.d.ts.map +1 -0
  253. package/dist/commonjs/api/threads/options.js +5 -0
  254. package/dist/commonjs/api/threads/options.js.map +1 -0
  255. package/dist/commonjs/api/vectorStoreFileBatches/index.d.ts +3 -0
  256. package/dist/commonjs/api/vectorStoreFileBatches/index.d.ts.map +1 -0
  257. package/dist/commonjs/api/vectorStoreFileBatches/index.js +11 -0
  258. package/dist/commonjs/api/vectorStoreFileBatches/index.js.map +1 -0
  259. package/dist/commonjs/api/vectorStoreFileBatches/operations.d.ts +27 -0
  260. package/dist/commonjs/api/vectorStoreFileBatches/operations.d.ts.map +1 -0
  261. package/dist/commonjs/api/vectorStoreFileBatches/operations.js +177 -0
  262. package/dist/commonjs/api/vectorStoreFileBatches/operations.js.map +1 -0
  263. package/dist/commonjs/api/vectorStoreFileBatches/options.d.ts +32 -0
  264. package/dist/commonjs/api/vectorStoreFileBatches/options.d.ts.map +1 -0
  265. package/dist/commonjs/api/vectorStoreFileBatches/options.js +5 -0
  266. package/dist/commonjs/api/vectorStoreFileBatches/options.js.map +1 -0
  267. package/dist/commonjs/api/vectorStoreFiles/index.d.ts +3 -0
  268. package/dist/commonjs/api/vectorStoreFiles/index.d.ts.map +1 -0
  269. package/dist/commonjs/api/vectorStoreFiles/index.js +11 -0
  270. package/dist/commonjs/api/vectorStoreFiles/index.js.map +1 -0
  271. package/dist/commonjs/api/vectorStoreFiles/operations.d.ts +27 -0
  272. package/dist/commonjs/api/vectorStoreFiles/operations.d.ts.map +1 -0
  273. package/dist/commonjs/api/vectorStoreFiles/operations.js +192 -0
  274. package/dist/commonjs/api/vectorStoreFiles/operations.js.map +1 -0
  275. package/dist/commonjs/api/vectorStoreFiles/options.d.ts +32 -0
  276. package/dist/commonjs/api/vectorStoreFiles/options.d.ts.map +1 -0
  277. package/dist/commonjs/api/vectorStoreFiles/options.js +5 -0
  278. package/dist/commonjs/api/vectorStoreFiles/options.js.map +1 -0
  279. package/dist/commonjs/api/vectorStores/index.d.ts +3 -0
  280. package/dist/commonjs/api/vectorStores/index.d.ts.map +1 -0
  281. package/dist/commonjs/api/vectorStores/index.js +12 -0
  282. package/dist/commonjs/api/vectorStores/index.js.map +1 -0
  283. package/dist/commonjs/api/vectorStores/operations.d.ts +33 -0
  284. package/dist/commonjs/api/vectorStores/operations.d.ts.map +1 -0
  285. package/dist/commonjs/api/vectorStores/operations.js +203 -0
  286. package/dist/commonjs/api/vectorStores/operations.js.map +1 -0
  287. package/dist/commonjs/api/vectorStores/options.d.ts +45 -0
  288. package/dist/commonjs/api/vectorStores/options.d.ts.map +1 -0
  289. package/dist/commonjs/api/vectorStores/options.js +5 -0
  290. package/dist/commonjs/api/vectorStores/options.js.map +1 -0
  291. package/dist/commonjs/classic/files/index.d.ts +22 -0
  292. package/dist/commonjs/classic/files/index.d.ts.map +1 -0
  293. package/dist/commonjs/classic/files/index.js +20 -0
  294. package/dist/commonjs/classic/files/index.js.map +1 -0
  295. package/dist/commonjs/classic/index.d.ts +9 -0
  296. package/dist/commonjs/classic/index.d.ts.map +1 -0
  297. package/dist/commonjs/classic/index.js +5 -0
  298. package/dist/commonjs/classic/index.js.map +1 -0
  299. package/dist/commonjs/classic/messages/index.d.ts +17 -0
  300. package/dist/commonjs/classic/messages/index.d.ts.map +1 -0
  301. package/dist/commonjs/classic/messages/index.js +18 -0
  302. package/dist/commonjs/classic/messages/index.js.map +1 -0
  303. package/dist/commonjs/classic/runSteps/index.d.ts +14 -0
  304. package/dist/commonjs/classic/runSteps/index.d.ts.map +1 -0
  305. package/dist/commonjs/classic/runSteps/index.js +16 -0
  306. package/dist/commonjs/classic/runSteps/index.js.map +1 -0
  307. package/dist/commonjs/classic/runs/index.d.ts +25 -0
  308. package/dist/commonjs/classic/runs/index.d.ts.map +1 -0
  309. package/dist/commonjs/classic/runs/index.js +22 -0
  310. package/dist/commonjs/classic/runs/index.js.map +1 -0
  311. package/dist/commonjs/classic/threads/index.d.ts +19 -0
  312. package/dist/commonjs/classic/threads/index.d.ts.map +1 -0
  313. package/dist/commonjs/classic/threads/index.js +19 -0
  314. package/dist/commonjs/classic/threads/index.js.map +1 -0
  315. package/dist/commonjs/classic/vectorStoreFileBatches/index.d.ts +20 -0
  316. package/dist/commonjs/classic/vectorStoreFileBatches/index.d.ts.map +1 -0
  317. package/dist/commonjs/classic/vectorStoreFileBatches/index.js +19 -0
  318. package/dist/commonjs/classic/vectorStoreFileBatches/index.js.map +1 -0
  319. package/dist/commonjs/classic/vectorStoreFiles/index.d.ts +20 -0
  320. package/dist/commonjs/classic/vectorStoreFiles/index.d.ts.map +1 -0
  321. package/dist/commonjs/classic/vectorStoreFiles/index.js +17 -0
  322. package/dist/commonjs/classic/vectorStoreFiles/index.js.map +1 -0
  323. package/dist/commonjs/classic/vectorStores/index.d.ts +22 -0
  324. package/dist/commonjs/classic/vectorStores/index.d.ts.map +1 -0
  325. package/dist/commonjs/classic/vectorStores/index.js +20 -0
  326. package/dist/commonjs/classic/vectorStores/index.js.map +1 -0
  327. package/dist/commonjs/index.d.ts +14 -3
  328. package/dist/commonjs/index.d.ts.map +1 -1
  329. package/dist/commonjs/index.js +6 -3
  330. package/dist/commonjs/index.js.map +1 -1
  331. package/dist/commonjs/models/index.d.ts +1 -1
  332. package/dist/commonjs/models/index.d.ts.map +1 -1
  333. package/dist/commonjs/models/index.js +6 -3
  334. package/dist/commonjs/models/index.js.map +1 -1
  335. package/dist/commonjs/models/models.d.ts +389 -337
  336. package/dist/commonjs/models/models.d.ts.map +1 -1
  337. package/dist/commonjs/models/models.js +446 -358
  338. package/dist/commonjs/models/models.js.map +1 -1
  339. package/dist/commonjs/static-helpers/multipartHelpers.d.ts +1 -1
  340. package/dist/commonjs/static-helpers/multipartHelpers.d.ts.map +1 -1
  341. package/dist/commonjs/static-helpers/multipartHelpers.js.map +1 -1
  342. package/dist/commonjs/static-helpers/pagingHelpers.d.ts +72 -0
  343. package/dist/commonjs/static-helpers/pagingHelpers.d.ts.map +1 -0
  344. package/dist/commonjs/static-helpers/pagingHelpers.js +140 -0
  345. package/dist/commonjs/static-helpers/pagingHelpers.js.map +1 -0
  346. package/dist/commonjs/static-helpers/urlTemplate.d.ts.map +1 -1
  347. package/dist/commonjs/static-helpers/urlTemplate.js.map +1 -1
  348. package/dist/commonjs/utils.d.ts +26 -5
  349. package/dist/commonjs/utils.d.ts.map +1 -1
  350. package/dist/commonjs/utils.js +44 -8
  351. package/dist/commonjs/utils.js.map +1 -1
  352. package/dist/esm/agentsClient.d.ts +31 -93
  353. package/dist/esm/agentsClient.d.ts.map +1 -1
  354. package/dist/esm/agentsClient.js +17 -168
  355. package/dist/esm/agentsClient.js.map +1 -1
  356. package/dist/esm/api/agentsContext.d.ts.map +1 -1
  357. package/dist/esm/api/agentsContext.js +7 -19
  358. package/dist/esm/api/agentsContext.js.map +1 -1
  359. package/dist/esm/api/files/index.d.ts +3 -0
  360. package/dist/esm/api/files/index.d.ts.map +1 -0
  361. package/dist/esm/api/files/index.js +4 -0
  362. package/dist/esm/api/files/index.js.map +1 -0
  363. package/dist/esm/api/files/operations.d.ts +45 -0
  364. package/dist/esm/api/files/operations.d.ts.map +1 -0
  365. package/dist/esm/api/files/operations.js +154 -0
  366. package/dist/esm/api/files/operations.js.map +1 -0
  367. package/dist/esm/api/files/options.d.ts +23 -0
  368. package/dist/esm/api/files/options.d.ts.map +1 -0
  369. package/dist/esm/api/files/options.js +4 -0
  370. package/dist/esm/api/files/options.js.map +1 -0
  371. package/dist/esm/api/index.d.ts +2 -2
  372. package/dist/esm/api/index.d.ts.map +1 -1
  373. package/dist/esm/api/index.js +1 -1
  374. package/dist/esm/api/index.js.map +1 -1
  375. package/dist/esm/api/messages/index.d.ts +3 -0
  376. package/dist/esm/api/messages/index.d.ts.map +1 -0
  377. package/dist/esm/api/messages/index.js +4 -0
  378. package/dist/esm/api/messages/index.js.map +1 -0
  379. package/dist/esm/api/messages/operations.d.ts +22 -0
  380. package/dist/esm/api/messages/operations.d.ts.map +1 -0
  381. package/dist/esm/api/messages/operations.js +108 -0
  382. package/dist/esm/api/messages/operations.js.map +1 -0
  383. package/dist/esm/api/messages/options.d.ts +31 -0
  384. package/dist/esm/api/messages/options.d.ts.map +1 -0
  385. package/dist/esm/api/messages/options.js +4 -0
  386. package/dist/esm/api/messages/options.js.map +1 -0
  387. package/dist/esm/api/operations.d.ts +8 -183
  388. package/dist/esm/api/operations.d.ts.map +1 -1
  389. package/dist/esm/api/operations.js +14 -1063
  390. package/dist/esm/api/operations.js.map +1 -1
  391. package/dist/esm/api/options.d.ts +25 -322
  392. package/dist/esm/api/options.d.ts.map +1 -1
  393. package/dist/esm/api/options.js.map +1 -1
  394. package/dist/esm/api/runSteps/index.d.ts +3 -0
  395. package/dist/esm/api/runSteps/index.d.ts.map +1 -0
  396. package/dist/esm/api/runSteps/index.js +4 -0
  397. package/dist/esm/api/runSteps/index.js.map +1 -0
  398. package/dist/esm/api/runSteps/operations.d.ts +14 -0
  399. package/dist/esm/api/runSteps/operations.d.ts.map +1 -0
  400. package/dist/esm/api/runSteps/operations.js +67 -0
  401. package/dist/esm/api/runSteps/operations.js.map +1 -0
  402. package/dist/esm/api/runSteps/options.d.ts +27 -0
  403. package/dist/esm/api/runSteps/options.d.ts.map +1 -0
  404. package/dist/esm/api/runSteps/options.js +4 -0
  405. package/dist/esm/api/runSteps/options.js.map +1 -0
  406. package/dist/esm/api/runs/index.d.ts +3 -0
  407. package/dist/esm/api/runs/index.d.ts.map +1 -0
  408. package/dist/esm/api/runs/index.js +4 -0
  409. package/dist/esm/api/runs/index.js.map +1 -0
  410. package/dist/esm/api/runs/operations.d.ts +31 -0
  411. package/dist/esm/api/runs/operations.d.ts.map +1 -0
  412. package/dist/esm/api/runs/operations.js +190 -0
  413. package/dist/esm/api/runs/operations.js.map +1 -0
  414. package/dist/esm/api/runs/options.d.ts +92 -0
  415. package/dist/esm/api/runs/options.d.ts.map +1 -0
  416. package/dist/esm/api/runs/options.js +4 -0
  417. package/dist/esm/api/runs/options.js.map +1 -0
  418. package/dist/esm/api/threads/index.d.ts +3 -0
  419. package/dist/esm/api/threads/index.d.ts.map +1 -0
  420. package/dist/esm/api/threads/index.js +4 -0
  421. package/dist/esm/api/threads/index.js.map +1 -0
  422. package/dist/esm/api/threads/operations.d.ts +26 -0
  423. package/dist/esm/api/threads/operations.d.ts.map +1 -0
  424. package/dist/esm/api/threads/operations.js +131 -0
  425. package/dist/esm/api/threads/operations.js.map +1 -0
  426. package/dist/esm/api/threads/options.d.ts +44 -0
  427. package/dist/esm/api/threads/options.d.ts.map +1 -0
  428. package/dist/esm/api/threads/options.js +4 -0
  429. package/dist/esm/api/threads/options.js.map +1 -0
  430. package/dist/esm/api/vectorStoreFileBatches/index.d.ts +3 -0
  431. package/dist/esm/api/vectorStoreFileBatches/index.d.ts.map +1 -0
  432. package/dist/esm/api/vectorStoreFileBatches/index.js +4 -0
  433. package/dist/esm/api/vectorStoreFileBatches/index.js.map +1 -0
  434. package/dist/esm/api/vectorStoreFileBatches/operations.d.ts +27 -0
  435. package/dist/esm/api/vectorStoreFileBatches/operations.d.ts.map +1 -0
  436. package/dist/esm/api/vectorStoreFileBatches/operations.js +161 -0
  437. package/dist/esm/api/vectorStoreFileBatches/operations.js.map +1 -0
  438. package/dist/esm/api/vectorStoreFileBatches/options.d.ts +32 -0
  439. package/dist/esm/api/vectorStoreFileBatches/options.d.ts.map +1 -0
  440. package/dist/esm/api/vectorStoreFileBatches/options.js +4 -0
  441. package/dist/esm/api/vectorStoreFileBatches/options.js.map +1 -0
  442. package/dist/esm/api/vectorStoreFiles/index.d.ts +3 -0
  443. package/dist/esm/api/vectorStoreFiles/index.d.ts.map +1 -0
  444. package/dist/esm/api/vectorStoreFiles/index.js +4 -0
  445. package/dist/esm/api/vectorStoreFiles/index.js.map +1 -0
  446. package/dist/esm/api/vectorStoreFiles/operations.d.ts +27 -0
  447. package/dist/esm/api/vectorStoreFiles/operations.d.ts.map +1 -0
  448. package/dist/esm/api/vectorStoreFiles/operations.js +176 -0
  449. package/dist/esm/api/vectorStoreFiles/operations.js.map +1 -0
  450. package/dist/esm/api/vectorStoreFiles/options.d.ts +32 -0
  451. package/dist/esm/api/vectorStoreFiles/options.d.ts.map +1 -0
  452. package/dist/esm/api/vectorStoreFiles/options.js +4 -0
  453. package/dist/esm/api/vectorStoreFiles/options.js.map +1 -0
  454. package/dist/esm/api/vectorStores/index.d.ts +3 -0
  455. package/dist/esm/api/vectorStores/index.d.ts.map +1 -0
  456. package/dist/esm/api/vectorStores/index.js +4 -0
  457. package/dist/esm/api/vectorStores/index.js.map +1 -0
  458. package/dist/esm/api/vectorStores/operations.d.ts +33 -0
  459. package/dist/esm/api/vectorStores/operations.d.ts.map +1 -0
  460. package/dist/esm/api/vectorStores/operations.js +184 -0
  461. package/dist/esm/api/vectorStores/operations.js.map +1 -0
  462. package/dist/esm/api/vectorStores/options.d.ts +45 -0
  463. package/dist/esm/api/vectorStores/options.d.ts.map +1 -0
  464. package/dist/esm/api/vectorStores/options.js +4 -0
  465. package/dist/esm/api/vectorStores/options.js.map +1 -0
  466. package/dist/esm/classic/files/index.d.ts +22 -0
  467. package/dist/esm/classic/files/index.d.ts.map +1 -0
  468. package/dist/esm/classic/files/index.js +17 -0
  469. package/dist/esm/classic/files/index.js.map +1 -0
  470. package/dist/esm/classic/index.d.ts +9 -0
  471. package/dist/esm/classic/index.d.ts.map +1 -0
  472. package/dist/esm/classic/index.js +4 -0
  473. package/dist/esm/classic/index.js.map +1 -0
  474. package/dist/esm/classic/messages/index.d.ts +17 -0
  475. package/dist/esm/classic/messages/index.d.ts.map +1 -0
  476. package/dist/esm/classic/messages/index.js +15 -0
  477. package/dist/esm/classic/messages/index.js.map +1 -0
  478. package/dist/esm/classic/runSteps/index.d.ts +14 -0
  479. package/dist/esm/classic/runSteps/index.d.ts.map +1 -0
  480. package/dist/esm/classic/runSteps/index.js +13 -0
  481. package/dist/esm/classic/runSteps/index.js.map +1 -0
  482. package/dist/esm/classic/runs/index.d.ts +25 -0
  483. package/dist/esm/classic/runs/index.d.ts.map +1 -0
  484. package/dist/esm/classic/runs/index.js +19 -0
  485. package/dist/esm/classic/runs/index.js.map +1 -0
  486. package/dist/esm/classic/threads/index.d.ts +19 -0
  487. package/dist/esm/classic/threads/index.d.ts.map +1 -0
  488. package/dist/esm/classic/threads/index.js +16 -0
  489. package/dist/esm/classic/threads/index.js.map +1 -0
  490. package/dist/esm/classic/vectorStoreFileBatches/index.d.ts +20 -0
  491. package/dist/esm/classic/vectorStoreFileBatches/index.d.ts.map +1 -0
  492. package/dist/esm/classic/vectorStoreFileBatches/index.js +16 -0
  493. package/dist/esm/classic/vectorStoreFileBatches/index.js.map +1 -0
  494. package/dist/esm/classic/vectorStoreFiles/index.d.ts +20 -0
  495. package/dist/esm/classic/vectorStoreFiles/index.d.ts.map +1 -0
  496. package/dist/esm/classic/vectorStoreFiles/index.js +14 -0
  497. package/dist/esm/classic/vectorStoreFiles/index.js.map +1 -0
  498. package/dist/esm/classic/vectorStores/index.d.ts +22 -0
  499. package/dist/esm/classic/vectorStores/index.d.ts.map +1 -0
  500. package/dist/esm/classic/vectorStores/index.js +17 -0
  501. package/dist/esm/classic/vectorStores/index.js.map +1 -0
  502. package/dist/esm/index.d.ts +14 -3
  503. package/dist/esm/index.d.ts.map +1 -1
  504. package/dist/esm/index.js +2 -2
  505. package/dist/esm/index.js.map +1 -1
  506. package/dist/esm/models/index.d.ts +1 -1
  507. package/dist/esm/models/index.d.ts.map +1 -1
  508. package/dist/esm/models/index.js +1 -1
  509. package/dist/esm/models/index.js.map +1 -1
  510. package/dist/esm/models/models.d.ts +389 -337
  511. package/dist/esm/models/models.d.ts.map +1 -1
  512. package/dist/esm/models/models.js +378 -296
  513. package/dist/esm/models/models.js.map +1 -1
  514. package/dist/esm/static-helpers/multipartHelpers.d.ts +1 -1
  515. package/dist/esm/static-helpers/multipartHelpers.d.ts.map +1 -1
  516. package/dist/esm/static-helpers/multipartHelpers.js.map +1 -1
  517. package/dist/esm/static-helpers/pagingHelpers.d.ts +72 -0
  518. package/dist/esm/static-helpers/pagingHelpers.d.ts.map +1 -0
  519. package/dist/esm/static-helpers/pagingHelpers.js +137 -0
  520. package/dist/esm/static-helpers/pagingHelpers.js.map +1 -0
  521. package/dist/esm/static-helpers/urlTemplate.d.ts.map +1 -1
  522. package/dist/esm/static-helpers/urlTemplate.js.map +1 -1
  523. package/dist/esm/utils.d.ts +26 -5
  524. package/dist/esm/utils.d.ts.map +1 -1
  525. package/dist/esm/utils.js +44 -8
  526. package/dist/esm/utils.js.map +1 -1
  527. package/dist/react-native/agentsClient.d.ts +31 -93
  528. package/dist/react-native/agentsClient.d.ts.map +1 -1
  529. package/dist/react-native/agentsClient.js +17 -168
  530. package/dist/react-native/agentsClient.js.map +1 -1
  531. package/dist/react-native/api/agentsContext.d.ts.map +1 -1
  532. package/dist/react-native/api/agentsContext.js +7 -19
  533. package/dist/react-native/api/agentsContext.js.map +1 -1
  534. package/dist/react-native/api/files/index.d.ts +3 -0
  535. package/dist/react-native/api/files/index.d.ts.map +1 -0
  536. package/dist/react-native/api/files/index.js +4 -0
  537. package/dist/react-native/api/files/index.js.map +1 -0
  538. package/dist/react-native/api/files/operations.d.ts +45 -0
  539. package/dist/react-native/api/files/operations.d.ts.map +1 -0
  540. package/dist/react-native/api/files/operations.js +154 -0
  541. package/dist/react-native/api/files/operations.js.map +1 -0
  542. package/dist/react-native/api/files/options.d.ts +23 -0
  543. package/dist/react-native/api/files/options.d.ts.map +1 -0
  544. package/dist/react-native/api/files/options.js +4 -0
  545. package/dist/react-native/api/files/options.js.map +1 -0
  546. package/dist/react-native/api/index.d.ts +2 -2
  547. package/dist/react-native/api/index.d.ts.map +1 -1
  548. package/dist/react-native/api/index.js +1 -1
  549. package/dist/react-native/api/index.js.map +1 -1
  550. package/dist/react-native/api/messages/index.d.ts +3 -0
  551. package/dist/react-native/api/messages/index.d.ts.map +1 -0
  552. package/dist/react-native/api/messages/index.js +4 -0
  553. package/dist/react-native/api/messages/index.js.map +1 -0
  554. package/dist/react-native/api/messages/operations.d.ts +22 -0
  555. package/dist/react-native/api/messages/operations.d.ts.map +1 -0
  556. package/dist/react-native/api/messages/operations.js +108 -0
  557. package/dist/react-native/api/messages/operations.js.map +1 -0
  558. package/dist/react-native/api/messages/options.d.ts +31 -0
  559. package/dist/react-native/api/messages/options.d.ts.map +1 -0
  560. package/dist/react-native/api/messages/options.js +4 -0
  561. package/dist/react-native/api/messages/options.js.map +1 -0
  562. package/dist/react-native/api/operations.d.ts +8 -183
  563. package/dist/react-native/api/operations.d.ts.map +1 -1
  564. package/dist/react-native/api/operations.js +14 -1063
  565. package/dist/react-native/api/operations.js.map +1 -1
  566. package/dist/react-native/api/options.d.ts +25 -322
  567. package/dist/react-native/api/options.d.ts.map +1 -1
  568. package/dist/react-native/api/options.js.map +1 -1
  569. package/dist/react-native/api/runSteps/index.d.ts +3 -0
  570. package/dist/react-native/api/runSteps/index.d.ts.map +1 -0
  571. package/dist/react-native/api/runSteps/index.js +4 -0
  572. package/dist/react-native/api/runSteps/index.js.map +1 -0
  573. package/dist/react-native/api/runSteps/operations.d.ts +14 -0
  574. package/dist/react-native/api/runSteps/operations.d.ts.map +1 -0
  575. package/dist/react-native/api/runSteps/operations.js +67 -0
  576. package/dist/react-native/api/runSteps/operations.js.map +1 -0
  577. package/dist/react-native/api/runSteps/options.d.ts +27 -0
  578. package/dist/react-native/api/runSteps/options.d.ts.map +1 -0
  579. package/dist/react-native/api/runSteps/options.js +4 -0
  580. package/dist/react-native/api/runSteps/options.js.map +1 -0
  581. package/dist/react-native/api/runs/index.d.ts +3 -0
  582. package/dist/react-native/api/runs/index.d.ts.map +1 -0
  583. package/dist/react-native/api/runs/index.js +4 -0
  584. package/dist/react-native/api/runs/index.js.map +1 -0
  585. package/dist/react-native/api/runs/operations.d.ts +31 -0
  586. package/dist/react-native/api/runs/operations.d.ts.map +1 -0
  587. package/dist/react-native/api/runs/operations.js +190 -0
  588. package/dist/react-native/api/runs/operations.js.map +1 -0
  589. package/dist/react-native/api/runs/options.d.ts +92 -0
  590. package/dist/react-native/api/runs/options.d.ts.map +1 -0
  591. package/dist/react-native/api/runs/options.js +4 -0
  592. package/dist/react-native/api/runs/options.js.map +1 -0
  593. package/dist/react-native/api/threads/index.d.ts +3 -0
  594. package/dist/react-native/api/threads/index.d.ts.map +1 -0
  595. package/dist/react-native/api/threads/index.js +4 -0
  596. package/dist/react-native/api/threads/index.js.map +1 -0
  597. package/dist/react-native/api/threads/operations.d.ts +26 -0
  598. package/dist/react-native/api/threads/operations.d.ts.map +1 -0
  599. package/dist/react-native/api/threads/operations.js +131 -0
  600. package/dist/react-native/api/threads/operations.js.map +1 -0
  601. package/dist/react-native/api/threads/options.d.ts +44 -0
  602. package/dist/react-native/api/threads/options.d.ts.map +1 -0
  603. package/dist/react-native/api/threads/options.js +4 -0
  604. package/dist/react-native/api/threads/options.js.map +1 -0
  605. package/dist/react-native/api/vectorStoreFileBatches/index.d.ts +3 -0
  606. package/dist/react-native/api/vectorStoreFileBatches/index.d.ts.map +1 -0
  607. package/dist/react-native/api/vectorStoreFileBatches/index.js +4 -0
  608. package/dist/react-native/api/vectorStoreFileBatches/index.js.map +1 -0
  609. package/dist/react-native/api/vectorStoreFileBatches/operations.d.ts +27 -0
  610. package/dist/react-native/api/vectorStoreFileBatches/operations.d.ts.map +1 -0
  611. package/dist/react-native/api/vectorStoreFileBatches/operations.js +161 -0
  612. package/dist/react-native/api/vectorStoreFileBatches/operations.js.map +1 -0
  613. package/dist/react-native/api/vectorStoreFileBatches/options.d.ts +32 -0
  614. package/dist/react-native/api/vectorStoreFileBatches/options.d.ts.map +1 -0
  615. package/dist/react-native/api/vectorStoreFileBatches/options.js +4 -0
  616. package/dist/react-native/api/vectorStoreFileBatches/options.js.map +1 -0
  617. package/dist/react-native/api/vectorStoreFiles/index.d.ts +3 -0
  618. package/dist/react-native/api/vectorStoreFiles/index.d.ts.map +1 -0
  619. package/dist/react-native/api/vectorStoreFiles/index.js +4 -0
  620. package/dist/react-native/api/vectorStoreFiles/index.js.map +1 -0
  621. package/dist/react-native/api/vectorStoreFiles/operations.d.ts +27 -0
  622. package/dist/react-native/api/vectorStoreFiles/operations.d.ts.map +1 -0
  623. package/dist/react-native/api/vectorStoreFiles/operations.js +176 -0
  624. package/dist/react-native/api/vectorStoreFiles/operations.js.map +1 -0
  625. package/dist/react-native/api/vectorStoreFiles/options.d.ts +32 -0
  626. package/dist/react-native/api/vectorStoreFiles/options.d.ts.map +1 -0
  627. package/dist/react-native/api/vectorStoreFiles/options.js +4 -0
  628. package/dist/react-native/api/vectorStoreFiles/options.js.map +1 -0
  629. package/dist/react-native/api/vectorStores/index.d.ts +3 -0
  630. package/dist/react-native/api/vectorStores/index.d.ts.map +1 -0
  631. package/dist/react-native/api/vectorStores/index.js +4 -0
  632. package/dist/react-native/api/vectorStores/index.js.map +1 -0
  633. package/dist/react-native/api/vectorStores/operations.d.ts +33 -0
  634. package/dist/react-native/api/vectorStores/operations.d.ts.map +1 -0
  635. package/dist/react-native/api/vectorStores/operations.js +184 -0
  636. package/dist/react-native/api/vectorStores/operations.js.map +1 -0
  637. package/dist/react-native/api/vectorStores/options.d.ts +45 -0
  638. package/dist/react-native/api/vectorStores/options.d.ts.map +1 -0
  639. package/dist/react-native/api/vectorStores/options.js +4 -0
  640. package/dist/react-native/api/vectorStores/options.js.map +1 -0
  641. package/dist/react-native/classic/files/index.d.ts +22 -0
  642. package/dist/react-native/classic/files/index.d.ts.map +1 -0
  643. package/dist/react-native/classic/files/index.js +17 -0
  644. package/dist/react-native/classic/files/index.js.map +1 -0
  645. package/dist/react-native/classic/index.d.ts +9 -0
  646. package/dist/react-native/classic/index.d.ts.map +1 -0
  647. package/dist/react-native/classic/index.js +4 -0
  648. package/dist/react-native/classic/index.js.map +1 -0
  649. package/dist/react-native/classic/messages/index.d.ts +17 -0
  650. package/dist/react-native/classic/messages/index.d.ts.map +1 -0
  651. package/dist/react-native/classic/messages/index.js +15 -0
  652. package/dist/react-native/classic/messages/index.js.map +1 -0
  653. package/dist/react-native/classic/runSteps/index.d.ts +14 -0
  654. package/dist/react-native/classic/runSteps/index.d.ts.map +1 -0
  655. package/dist/react-native/classic/runSteps/index.js +13 -0
  656. package/dist/react-native/classic/runSteps/index.js.map +1 -0
  657. package/dist/react-native/classic/runs/index.d.ts +25 -0
  658. package/dist/react-native/classic/runs/index.d.ts.map +1 -0
  659. package/dist/react-native/classic/runs/index.js +19 -0
  660. package/dist/react-native/classic/runs/index.js.map +1 -0
  661. package/dist/react-native/classic/threads/index.d.ts +19 -0
  662. package/dist/react-native/classic/threads/index.d.ts.map +1 -0
  663. package/dist/react-native/classic/threads/index.js +16 -0
  664. package/dist/react-native/classic/threads/index.js.map +1 -0
  665. package/dist/react-native/classic/vectorStoreFileBatches/index.d.ts +20 -0
  666. package/dist/react-native/classic/vectorStoreFileBatches/index.d.ts.map +1 -0
  667. package/dist/react-native/classic/vectorStoreFileBatches/index.js +16 -0
  668. package/dist/react-native/classic/vectorStoreFileBatches/index.js.map +1 -0
  669. package/dist/react-native/classic/vectorStoreFiles/index.d.ts +20 -0
  670. package/dist/react-native/classic/vectorStoreFiles/index.d.ts.map +1 -0
  671. package/dist/react-native/classic/vectorStoreFiles/index.js +14 -0
  672. package/dist/react-native/classic/vectorStoreFiles/index.js.map +1 -0
  673. package/dist/react-native/classic/vectorStores/index.d.ts +22 -0
  674. package/dist/react-native/classic/vectorStores/index.d.ts.map +1 -0
  675. package/dist/react-native/classic/vectorStores/index.js +17 -0
  676. package/dist/react-native/classic/vectorStores/index.js.map +1 -0
  677. package/dist/react-native/index.d.ts +14 -3
  678. package/dist/react-native/index.d.ts.map +1 -1
  679. package/dist/react-native/index.js +2 -2
  680. package/dist/react-native/index.js.map +1 -1
  681. package/dist/react-native/models/index.d.ts +1 -1
  682. package/dist/react-native/models/index.d.ts.map +1 -1
  683. package/dist/react-native/models/index.js +1 -1
  684. package/dist/react-native/models/index.js.map +1 -1
  685. package/dist/react-native/models/models.d.ts +389 -337
  686. package/dist/react-native/models/models.d.ts.map +1 -1
  687. package/dist/react-native/models/models.js +378 -296
  688. package/dist/react-native/models/models.js.map +1 -1
  689. package/dist/react-native/static-helpers/multipartHelpers.d.ts +1 -1
  690. package/dist/react-native/static-helpers/multipartHelpers.d.ts.map +1 -1
  691. package/dist/react-native/static-helpers/multipartHelpers.js.map +1 -1
  692. package/dist/react-native/static-helpers/pagingHelpers.d.ts +72 -0
  693. package/dist/react-native/static-helpers/pagingHelpers.d.ts.map +1 -0
  694. package/dist/react-native/static-helpers/pagingHelpers.js +137 -0
  695. package/dist/react-native/static-helpers/pagingHelpers.js.map +1 -0
  696. package/dist/react-native/static-helpers/urlTemplate.d.ts.map +1 -1
  697. package/dist/react-native/static-helpers/urlTemplate.js.map +1 -1
  698. package/dist/react-native/utils.d.ts +26 -5
  699. package/dist/react-native/utils.d.ts.map +1 -1
  700. package/dist/react-native/utils.js +44 -8
  701. package/dist/react-native/utils.js.map +1 -1
  702. package/package.json +2 -2
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Valid values for the contents of a binary file.
3
3
  */
4
- export type FileContents = string | NodeJS.ReadableStream | ReadableStream | Uint8Array | Blob;
4
+ export type FileContents = string | NodeJS.ReadableStream | ReadableStream<Uint8Array> | Uint8Array | Blob;
5
5
  export declare function createFilePartDescriptor(partName: string, fileInput: any, defaultContentType?: string): any;
6
6
  //# sourceMappingURL=multipartHelpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"multipartHelpers.d.ts","sourceRoot":"","sources":["../../../src/static-helpers/multipartHelpers.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,MAAM,CAAC,cAAc,GAAG,cAAc,GAAG,UAAU,GAAG,IAAI,CAAC;AAE/F,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,MAAM,EAEhB,SAAS,EAAE,GAAG,EACd,kBAAkB,CAAC,EAAE,MAAM,GAC1B,GAAG,CAeL"}
1
+ {"version":3,"file":"multipartHelpers.d.ts","sourceRoot":"","sources":["../../../src/static-helpers/multipartHelpers.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,MAAM,YAAY,GACpB,MAAM,GACN,MAAM,CAAC,cAAc,GACrB,cAAc,CAAC,UAAU,CAAC,GAC1B,UAAU,GACV,IAAI,CAAC;AAET,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,MAAM,EAEhB,SAAS,EAAE,GAAG,EACd,kBAAkB,CAAC,EAAE,MAAM,GAC1B,GAAG,CAeL"}
@@ -1 +1 @@
1
- {"version":3,"file":"multipartHelpers.js","sourceRoot":"","sources":["../../../src/static-helpers/multipartHelpers.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAOlC,MAAM,UAAU,wBAAwB,CACtC,QAAgB;AAChB,6EAA6E;AAC7E,SAAc,EACd,kBAA2B;;IAE3B,IAAI,SAAS,CAAC,QAAQ,EAAE,CAAC;QACvB,OAAO;YACL,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,SAAS,CAAC,QAAQ;YACxB,WAAW,EAAE,MAAA,SAAS,CAAC,WAAW,mCAAI,kBAAkB;YACxD,QAAQ,EAAE,SAAS,CAAC,QAAQ;SAC7B,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,OAAO;YACL,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,SAAS;YACf,WAAW,EAAE,kBAAkB;SAChC,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * Valid values for the contents of a binary file.\n */\nexport type FileContents = string | NodeJS.ReadableStream | ReadableStream | Uint8Array | Blob;\n\nexport function createFilePartDescriptor(\n partName: string,\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n fileInput: any,\n defaultContentType?: string,\n): any {\n if (fileInput.contents) {\n return {\n name: partName,\n body: fileInput.contents,\n contentType: fileInput.contentType ?? defaultContentType,\n filename: fileInput.filename,\n };\n } else {\n return {\n name: partName,\n body: fileInput,\n contentType: defaultContentType,\n };\n }\n}\n"]}
1
+ {"version":3,"file":"multipartHelpers.js","sourceRoot":"","sources":["../../../src/static-helpers/multipartHelpers.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAYlC,MAAM,UAAU,wBAAwB,CACtC,QAAgB;AAChB,6EAA6E;AAC7E,SAAc,EACd,kBAA2B;;IAE3B,IAAI,SAAS,CAAC,QAAQ,EAAE,CAAC;QACvB,OAAO;YACL,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,SAAS,CAAC,QAAQ;YACxB,WAAW,EAAE,MAAA,SAAS,CAAC,WAAW,mCAAI,kBAAkB;YACxD,QAAQ,EAAE,SAAS,CAAC,QAAQ;SAC7B,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,OAAO;YACL,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,SAAS;YACf,WAAW,EAAE,kBAAkB;SAChC,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * Valid values for the contents of a binary file.\n */\nexport type FileContents =\n | string\n | NodeJS.ReadableStream\n | ReadableStream<Uint8Array>\n | Uint8Array\n | Blob;\n\nexport function createFilePartDescriptor(\n partName: string,\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n fileInput: any,\n defaultContentType?: string,\n): any {\n if (fileInput.contents) {\n return {\n name: partName,\n body: fileInput.contents,\n contentType: fileInput.contentType ?? defaultContentType,\n filename: fileInput.filename,\n };\n } else {\n return {\n name: partName,\n body: fileInput,\n contentType: defaultContentType,\n };\n }\n}\n"]}
@@ -0,0 +1,72 @@
1
+ import { Client, PathUncheckedResponse } from "@azure-rest/core-client";
2
+ /**
3
+ * Options for the byPage method
4
+ */
5
+ export interface PageSettings {
6
+ /**
7
+ * A reference to a specific page to start iterating from.
8
+ */
9
+ continuationToken?: string;
10
+ }
11
+ /**
12
+ * An interface that describes a page of results.
13
+ */
14
+ export type ContinuablePage<TElement, TPage = TElement[]> = TPage & {
15
+ /**
16
+ * The token that keeps track of where to continue the iterator
17
+ */
18
+ continuationToken?: string;
19
+ };
20
+ /**
21
+ * An interface that allows async iterable iteration both to completion and by page.
22
+ */
23
+ export interface PagedAsyncIterableIterator<TElement, TPage = TElement[], TPageSettings extends PageSettings = PageSettings> {
24
+ /**
25
+ * The next method, part of the iteration protocol
26
+ */
27
+ next(): Promise<IteratorResult<TElement>>;
28
+ /**
29
+ * The connection to the async iterator, part of the iteration protocol
30
+ */
31
+ [Symbol.asyncIterator](): PagedAsyncIterableIterator<TElement, TPage, TPageSettings>;
32
+ /**
33
+ * Return an AsyncIterableIterator that works a page at a time
34
+ */
35
+ byPage: (settings?: TPageSettings) => AsyncIterableIterator<ContinuablePage<TElement, TPage>>;
36
+ }
37
+ /**
38
+ * An interface that describes how to communicate with the service.
39
+ */
40
+ export interface PagedResult<TElement, TPage = TElement[], TPageSettings extends PageSettings = PageSettings> {
41
+ /**
42
+ * Link to the first page of results.
43
+ */
44
+ firstPageLink?: string;
45
+ /**
46
+ * A method that returns a page of results.
47
+ */
48
+ getPage: (pageLink?: string) => Promise<{
49
+ page: TPage;
50
+ nextPageLink?: string;
51
+ } | undefined>;
52
+ /**
53
+ * a function to implement the `byPage` method on the paged async iterator.
54
+ */
55
+ byPage?: (settings?: TPageSettings) => AsyncIterableIterator<ContinuablePage<TElement, TPage>>;
56
+ /**
57
+ * A function to extract elements from a page.
58
+ */
59
+ toElements?: (page: TPage) => TElement[];
60
+ }
61
+ /**
62
+ * Options for the paging helper
63
+ */
64
+ export interface BuildPagedAsyncIteratorOptions {
65
+ itemName?: string;
66
+ nextLinkName?: string;
67
+ }
68
+ /**
69
+ * Helper to paginate results in a generic way and return a PagedAsyncIterableIterator
70
+ */
71
+ export declare function buildPagedAsyncIterator<TElement, TPage = TElement[], TPageSettings extends PageSettings = PageSettings, TResponse extends PathUncheckedResponse = PathUncheckedResponse>(client: Client, getInitialResponse: () => PromiseLike<TResponse>, processResponseBody: (result: TResponse) => PromiseLike<unknown>, expectedStatuses: string[], options?: BuildPagedAsyncIteratorOptions): PagedAsyncIterableIterator<TElement, TPage, TPageSettings>;
72
+ //# sourceMappingURL=pagingHelpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pagingHelpers.d.ts","sourceRoot":"","sources":["../../../src/static-helpers/pagingHelpers.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAmB,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAGzF;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,CAAC,QAAQ,EAAE,KAAK,GAAG,QAAQ,EAAE,IAAI,KAAK,GAAG;IAClE;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,0BAA0B,CACzC,QAAQ,EACR,KAAK,GAAG,QAAQ,EAAE,EAClB,aAAa,SAAS,YAAY,GAAG,YAAY;IAEjD;;OAEG;IACH,IAAI,IAAI,OAAO,CAAC,cAAc,CAAC,QAAQ,CA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AAK,WAAW,CAAC,OAAO,CAAC,EAChE,gBAAgB,EAAE,MAAM,EAAE,EAC1B,OAAO,GAAE,8BAAmC,GAC3C,0BAA0B,CAAC,QAAQ,EAAE,KAAK,EAAE,aAAa,CAAC,CA0B5D"}
@@ -0,0 +1,137 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ import { __asyncDelegator, __asyncGenerator, __asyncValues, __await } from "tslib";
4
+ import { createRestError } from "@azure-rest/core-client";
5
+ import { RestError } from "@azure/core-rest-pipeline";
6
+ /**
7
+ * Helper to paginate results in a generic way and return a PagedAsyncIterableIterator
8
+ */
9
+ export function buildPagedAsyncIterator(client, getInitialResponse, processResponseBody, expectedStatuses, options = {}) {
10
+ var _a, _b;
11
+ const itemName = (_a = options.itemName) !== null && _a !== void 0 ? _a : "value";
12
+ const nextLinkName = (_b = options.nextLinkName) !== null && _b !== void 0 ? _b : "nextLink";
13
+ const pagedResult = {
14
+ getPage: async (pageLink) => {
15
+ const result = pageLink === undefined
16
+ ? await getInitialResponse()
17
+ : await client.pathUnchecked(pageLink).get();
18
+ checkPagingRequest(result, expectedStatuses);
19
+ const results = await processResponseBody(result);
20
+ const nextLink = getNextLink(results, nextLinkName);
21
+ const values = getElements(results, itemName);
22
+ return {
23
+ page: values,
24
+ nextPageLink: nextLink,
25
+ };
26
+ },
27
+ byPage: (settings) => {
28
+ const { continuationToken } = settings !== null && settings !== void 0 ? settings : {};
29
+ return getPageAsyncIterator(pagedResult, {
30
+ pageLink: continuationToken,
31
+ });
32
+ },
33
+ };
34
+ return getPagedAsyncIterator(pagedResult);
35
+ }
36
+ /**
37
+ * returns an async iterator that iterates over results. It also has a `byPage`
38
+ * method that returns pages of items at once.
39
+ *
40
+ * @param pagedResult - an object that specifies how to get pages.
41
+ * @returns a paged async iterator that iterates over results.
42
+ */
43
+ function getPagedAsyncIterator(pagedResult) {
44
+ var _a;
45
+ const iter = getItemAsyncIterator(pagedResult);
46
+ return {
47
+ next() {
48
+ return iter.next();
49
+ },
50
+ [Symbol.asyncIterator]() {
51
+ return this;
52
+ },
53
+ byPage: (_a = pagedResult === null || pagedResult === void 0 ? void 0 : pagedResult.byPage) !== null && _a !== void 0 ? _a : ((settings) => {
54
+ const { continuationToken } = settings !== null && settings !== void 0 ? settings : {};
55
+ return getPageAsyncIterator(pagedResult, {
56
+ pageLink: continuationToken,
57
+ });
58
+ }),
59
+ };
60
+ }
61
+ function getItemAsyncIterator(pagedResult) {
62
+ return __asyncGenerator(this, arguments, function* getItemAsyncIterator_1() {
63
+ var _a, e_1, _b, _c;
64
+ const pages = getPageAsyncIterator(pagedResult);
65
+ try {
66
+ for (var _d = true, pages_1 = __asyncValues(pages), pages_1_1; pages_1_1 = yield __await(pages_1.next()), _a = pages_1_1.done, !_a; _d = true) {
67
+ _c = pages_1_1.value;
68
+ _d = false;
69
+ const page = _c;
70
+ yield __await(yield* __asyncDelegator(__asyncValues(page)));
71
+ }
72
+ }
73
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
74
+ finally {
75
+ try {
76
+ if (!_d && !_a && (_b = pages_1.return)) yield __await(_b.call(pages_1));
77
+ }
78
+ finally { if (e_1) throw e_1.error; }
79
+ }
80
+ });
81
+ }
82
+ function getPageAsyncIterator(pagedResult_1) {
83
+ return __asyncGenerator(this, arguments, function* getPageAsyncIterator_1(pagedResult, options = {}) {
84
+ const { pageLink } = options;
85
+ let response = yield __await(pagedResult.getPage(pageLink !== null && pageLink !== void 0 ? pageLink : pagedResult.firstPageLink));
86
+ if (!response) {
87
+ return yield __await(void 0);
88
+ }
89
+ let result = response.page;
90
+ result.continuationToken = response.nextPageLink;
91
+ yield yield __await(result);
92
+ while (response.nextPageLink) {
93
+ response = yield __await(pagedResult.getPage(response.nextPageLink));
94
+ if (!response) {
95
+ return yield __await(void 0);
96
+ }
97
+ result = response.page;
98
+ result.continuationToken = response.nextPageLink;
99
+ yield yield __await(result);
100
+ }
101
+ });
102
+ }
103
+ /**
104
+ * Gets for the value of nextLink in the body
105
+ */
106
+ function getNextLink(body, nextLinkName) {
107
+ if (!nextLinkName) {
108
+ return undefined;
109
+ }
110
+ const nextLink = body[nextLinkName];
111
+ if (typeof nextLink !== "string" && typeof nextLink !== "undefined" && nextLink !== null) {
112
+ throw new RestError(`Body Property ${nextLinkName} should be a string or undefined or null but got ${typeof nextLink}`);
113
+ }
114
+ if (nextLink === null) {
115
+ return undefined;
116
+ }
117
+ return nextLink;
118
+ }
119
+ /**
120
+ * Gets the elements of the current request in the body.
121
+ */
122
+ function getElements(body, itemName) {
123
+ const value = body[itemName];
124
+ if (!Array.isArray(value)) {
125
+ throw new RestError(`Couldn't paginate response\n Body doesn't contain an array property with name: ${itemName}`);
126
+ }
127
+ return value !== null && value !== void 0 ? value : [];
128
+ }
129
+ /**
130
+ * Checks if a request failed
131
+ */
132
+ function checkPagingRequest(response, expectedStatuses) {
133
+ if (!expectedStatuses.includes(response.status)) {
134
+ throw createRestError(`Pagination failed with unexpected statusCode ${response.status}`, response);
135
+ }
136
+ }
137
+ //# sourceMappingURL=pagingHelpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pagingHelpers.js","sourceRoot":"","sources":["../../../src/static-helpers/pagingHelpers.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAElC,OAAO,EAAU,eAAe,EAAyB,MAAM,yBAAyB,CAAC;AACzF,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AA+EtD;;GAEG;AACH,MAAM,UAAU,uBAAuB,CAMrC,MAAc,EACd,kBAAgD,EAChD,mBAAgE,EAChE,gBAA0B,EAC1B,UAA0C,EAAE;;IAE5C,MAAM,QAAQ,GAAG,MAAA,OAAO,CAAC,QAAQ,mCAAI,OAAO,CAAC;IAC7C,MAAM,YAAY,GAAG,MAAA,OAAO,CAAC,YAAY,mCAAI,UAAU,CAAC;IACxD,MAAM,WAAW,GAAgD;QAC/D,OAAO,EAAE,KAAK,EAAE,QAAiB,E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D,oBAAM,MAAM,CAAA,CAAC;QACf,CAAC;IACH,CAAC;CAAA;AAED;;GAEG;AACH,SAAS,WAAW,CAAC,IAAa,EAAE,YAAqB;IACvD,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,QAAQ,GAAI,IAAgC,CAAC,YAAY,CAAC,CAAC;IAEjE,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,OAAO,QAAQ,KAAK,WAAW,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;QACzF,MAAM,IAAI,SAAS,CACjB,iBAAiB,YAAY,oDAAoD,OAAO,QAAQ,EAAE,CACnG,CAAC;IACJ,CAAC;IAED,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;QACtB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;GAEG;AACH,SAAS,WAAW,CAAc,IAAa,EAAE,QAAgB;IAC/D,MAAM,KAAK,GAAI,IAAgC,CAAC,QAAQ,CAAQ,CAAC;IACjE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,SAAS,CACjB,kFAAkF,QAAQ,EAAE,CAC7F,CAAC;IACJ,CAAC;IAED,OAAO,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,EAAE,CAAC;AACrB,CAAC;AAED;;GAEG;AACH,SAAS,kBAAkB,CAAC,QAA+B,EAAE,gBAA0B;IACrF,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAChD,MAAM,eAAe,CACnB,gDAAgD,QAAQ,CAAC,MAAM,EAAE,EACjE,QAAQ,CACT,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { Client, createRestError, PathUncheckedResponse } from \"@azure-rest/core-client\";\nimport { RestError } from \"@azure/core-rest-pipeline\";\n\n/**\n * Options for the byPage method\n */\nexport interface PageSettings {\n /**\n * A reference to a specific page to start iterating from.\n */\n continuationToken?: string;\n}\n\n/**\n * An interface that describes a page of results.\n */\nexport type ContinuablePage<TElement, TPage = TElement[]> = TPage & {\n /**\n * The token that keeps track of where to continue the iterator\n */\n continuationToken?: string;\n};\n\n/**\n * An interface that allows async iterable iteration both to completion and by page.\n */\nexport interface PagedAsyncIterableIterator<\n TElement,\n TPage = TElement[],\n TPageSettings extends PageSettings = PageSettings,\n> {\n /**\n * The next method, part of the iteration protocol\n */\n next(): Promise<IteratorResult<TElement>>;\n /**\n * The connection to the async iterator, part of the iteration protocol\n */\n [Symbol.asyncIterator](): PagedAsyncIterableIterator<TElement, TPage, TPageSettings>;\n /**\n * Return an AsyncIterableIterator that works a page at a time\n */\n byPage: (settings?: TPageSettings) => AsyncIterableIterator<ContinuablePage<TElement, TPage>>;\n}\n\n/**\n * An interface that describes how to communicate with the service.\n */\nexport interface PagedResult<\n TElement,\n TPage = TElement[],\n TPageSettings extends PageSettings = PageSettings,\n> {\n /**\n * Link to the first page of results.\n */\n firstPageLink?: string;\n /**\n * A method that returns a page of results.\n */\n getPage: (pageLink?: string) => Promise<{ page: TPage; nextPageLink?: string } | undefined>;\n /**\n * a function to implement the `byPage` method on the paged async iterator.\n */\n byPage?: (settings?: TPageSettings) => AsyncIterableIterator<ContinuablePage<TElement, TPage>>;\n\n /**\n * A function to extract elements from a page.\n */\n toElements?: (page: TPage) => TElement[];\n}\n\n/**\n * Options for the paging helper\n */\nexport interface BuildPagedAsyncIteratorOptions {\n itemName?: string;\n nextLinkName?: string;\n}\n\n/**\n * Helper to paginate results in a generic way and return a PagedAsyncIterableIterator\n */\nexport function buildPagedAsyncIterator<\n TElement,\n TPage = TElement[],\n TPageSettings extends PageSettings = PageSettings,\n TResponse extends PathUncheckedResponse = PathUncheckedResponse,\n>(\n client: Client,\n getInitialResponse: () => PromiseLike<TResponse>,\n processResponseBody: (result: TResponse) => PromiseLike<unknown>,\n expectedStatuses: string[],\n options: BuildPagedAsyncIteratorOptions = {},\n): PagedAsyncIterableIterator<TElement, TPage, TPageSettings> {\n const itemName = options.itemName ?? \"value\";\n const nextLinkName = options.nextLinkName ?? \"nextLink\";\n const pagedResult: PagedResult<TElement, TPage, TPageSettings> = {\n getPage: async (pageLink?: string) => {\n const result =\n pageLink === undefined\n ? await getInitialResponse()\n : await client.pathUnchecked(pageLink).get();\n checkPagingRequest(result, expectedStatuses);\n const results = await processResponseBody(result as TResponse);\n const nextLink = getNextLink(results, nextLinkName);\n const values = getElements<TElement>(results, itemName) as TPage;\n return {\n page: values,\n nextPageLink: nextLink,\n };\n },\n byPage: (settings?: TPageSettings) => {\n const { continuationToken } = settings ?? {};\n return getPageAsyncIterator(pagedResult, {\n pageLink: continuationToken,\n });\n },\n };\n return getPagedAsyncIterator(pagedResult);\n}\n\n/**\n * returns an async iterator that iterates over results. It also has a `byPage`\n * method that returns pages of items at once.\n *\n * @param pagedResult - an object that specifies how to get pages.\n * @returns a paged async iterator that iterates over results.\n */\n\nfunction getPagedAsyncIterator<\n TElement,\n TPage = TElement[],\n TPageSettings extends PageSettings = PageSettings,\n>(\n pagedResult: PagedResult<TElement, TPage, TPageSettings>,\n): PagedAsyncIterableIterator<TElement, TPage, TPageSettings> {\n const iter = getItemAsyncIterator<TElement, TPage, TPageSettings>(pagedResult);\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage:\n pagedResult?.byPage ??\n ((settings?: TPageSettings) => {\n const { continuationToken } = settings ?? {};\n return getPageAsyncIterator(pagedResult, {\n pageLink: continuationToken,\n });\n }),\n };\n}\n\nasync function* getItemAsyncIterator<TElement, TPage, TPageSettings extends PageSettings>(\n pagedResult: PagedResult<TElement, TPage, TPageSettings>,\n): AsyncIterableIterator<TElement> {\n const pages = getPageAsyncIterator(pagedResult);\n for await (const page of pages) {\n yield* page as unknown as TElement[];\n }\n}\n\nasync function* getPageAsyncIterator<TElement, TPage, TPageSettings extends PageSettings>(\n pagedResult: PagedResult<TElement, TPage, TPageSettings>,\n options: {\n pageLink?: string;\n } = {},\n): AsyncIterableIterator<ContinuablePage<TElement, TPage>> {\n const { pageLink } = options;\n let response = await pagedResult.getPage(pageLink ?? pagedResult.firstPageLink);\n if (!response) {\n return;\n }\n let result = response.page as ContinuablePage<TElement, TPage>;\n result.continuationToken = response.nextPageLink;\n yield result;\n while (response.nextPageLink) {\n response = await pagedResult.getPage(response.nextPageLink);\n if (!response) {\n return;\n }\n result = response.page as ContinuablePage<TElement, TPage>;\n result.continuationToken = response.nextPageLink;\n yield result;\n }\n}\n\n/**\n * Gets for the value of nextLink in the body\n */\nfunction getNextLink(body: unknown, nextLinkName?: string): string | undefined {\n if (!nextLinkName) {\n return undefined;\n }\n\n const nextLink = (body as Record<string, unknown>)[nextLinkName];\n\n if (typeof nextLink !== \"string\" && typeof nextLink !== \"undefined\" && nextLink !== null) {\n throw new RestError(\n `Body Property ${nextLinkName} should be a string or undefined or null but got ${typeof nextLink}`,\n );\n }\n\n if (nextLink === null) {\n return undefined;\n }\n\n return nextLink;\n}\n\n/**\n * Gets the elements of the current request in the body.\n */\nfunction getElements<T = unknown>(body: unknown, itemName: string): T[] {\n const value = (body as Record<string, unknown>)[itemName] as T[];\n if (!Array.isArray(value)) {\n throw new RestError(\n `Couldn't paginate response\\n Body doesn't contain an array property with name: ${itemName}`,\n );\n }\n\n return value ?? [];\n}\n\n/**\n * Checks if a request failed\n */\nfunction checkPagingRequest(response: PathUncheckedResponse, expectedStatuses: string[]): void {\n if (!expectedStatuses.includes(response.status)) {\n throw createRestError(\n `Pagination failed with unexpected statusCode ${response.status}`,\n response,\n );\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"urlTemplate.d.ts","sourceRoot":"","sources":["../../../src/static-helpers/urlTemplate.ts"],"names":[],"mappings":"AAmBA,MAAM,WAAW,kBAAkB;IAEjC,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAgJD,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC5B,MAAM,CAAC,EAAE,kBAAkB,GAC1B,MAAM,CA8BR"}
1
+ {"version":3,"file":"urlTemplate.d.ts","sourceRoot":"","sources":["../../../src/static-helpers/urlTemplate.ts"],"names":[],"mappings":"AAkBA,MAAM,WAAW,kBAAkB;IAEjC,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAgJD,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC5B,MAAM,CAAC,EAAE,kBAAkB,GAC1B,MAAM,CA8BR"}
@@ -1 +1 @@
1
- {"version":3,"file":"urlTemplate.js","sourceRoot":"","sources":["../../../src/static-helpers/urlTemplate.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAuBlC,wBAAwB;AACxB,UAAU;AACV,wBAAwB;AACxB,SAAS,eAAe,CAAC,GAAW,EAAE,QAAkB,EAAE,EAAW;IACnE,OAAO,CAAC,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,EAAE,KAAK,GAAG,CAAC,IAAI,EAAE,KAAK,GAAG;QAC3C,CAAC,CAAC,uBAAuB,CAAC,GAAG,CAAC;QAC9B,CAAC,CAAC,yBAAyB,CAAC,GAAG,CAAC,CAAC;AACrC,CAAC;AAED,SAAS,uBAAuB,CAAC,GAAW;IAC1C,OAAO,GAAG;SACP,KAAK,CAAC,oBAAoB,CAAC;SAC3B,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;SACpE,IAAI,CAAC,EAAE,CAAC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CAAC,CAAC;YACH,IAAI,QAAQ,EAAE,CAAC;gBACb,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACxB,CAAC;QACH,CAAC;QACD,OAAO,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACzB,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/* eslint-disable no-unused-expressions */\n// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n// ---------------------\n// interfaces\n// ---------------------\ninterface ValueOptions {\n isFirst: boolean; // is first value in the expression\n op?: string; // operator\n varValue?: any; // variable value\n varName?: string; // variable name\n modifier?: string; // modifier e.g *\n reserved?: boolean; // if true we'll keep reserved words with not encoding\n}\n\nexport interface UrlTemplateOptions {\n // if set to true, reserved characters will not be encoded\n allowReserved?: boolean;\n}\n\n// ---------------------\n// helpers\n// ---------------------\nfunction encodeComponent(val: string, reserved?: boolean, op?: string) {\n return (reserved ?? op === \"+\") || op === \"#\"\n ? encodeReservedComponent(val)\n : encodeRFC3986URIComponent(val);\n}\n\nfunction encodeReservedComponent(str: string) {\n return str\n .split(/(%[0-9A-Fa-f]{2})/g)\n .map((part) => (!/%[0-9A-Fa-f]/.test(part) ? encodeURI(part) : part))\n .join(\"\");\n}\n\nfunction encodeRFC3986URIComponent(str: string) {\n return encodeURIComponent(str).replace(\n /[!'()*]/g,\n (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`,\n );\n}\n\nfunction isDefined(val: any) {\n return val !== undefined && val !== null;\n}\n\nfunction getNamedAndIfEmpty(op?: string): [boolean, string] {\n return [!!op && [\";\", \"?\", \"&\"].includes(op), !!op && [\"?\", \"&\"].includes(op) ? \"=\" : \"\"];\n}\n\nfunction getFirstOrSep(op?: string, isFirst = false) {\n if (isFirst) {\n return !op || op === \"+\" ? \"\" : op;\n } else if (!op || op === \"+\" || op === \"#\") {\n return \",\";\n } else if (op === \"?\") {\n return \"&\";\n } else {\n return op;\n }\n}\n\nfunction getExpandedValue(option: ValueOptions) {\n let isFirst = option.isFirst;\n const { op, varName, varValue: value, reserved } = option;\n const vals: string[] = [];\n const [named, ifEmpty] = getNamedAndIfEmpty(op);\n\n if (Array.isArray(value)) {\n for (const val of value.filter(isDefined)) {\n // prepare the following parts: separator, varName, value\n vals.push(`${getFirstOrSep(op, isFirst)}`);\n if (named && varName) {\n vals.push(`${encodeURIComponent(varName)}`);\n val === \"\" ? vals.push(ifEmpty) : vals.push(\"=\");\n }\n vals.push(encodeComponent(val, reserved, op));\n isFirst = false;\n }\n } else if (typeof value === \"object\") {\n for (const key of Object.keys(value)) {\n const val = value[key];\n if (!isDefined(val)) {\n continue;\n }\n // prepare the following parts: separator, key, value\n vals.push(`${getFirstOrSep(op, isFirst)}`);\n if (key) {\n vals.push(`${encodeURIComponent(key)}`);\n named && val === \"\" ? vals.push(ifEmpty) : vals.push(\"=\");\n }\n vals.push(encodeComponent(val, reserved, op));\n isFirst = false;\n }\n }\n return vals.join(\"\");\n}\n\nfunction getNonExpandedValue(option: ValueOptions) {\n const { op, varName, varValue: value, isFirst, reserved } = option;\n const vals: string[] = [];\n const first = getFirstOrSep(op, isFirst);\n const [named, ifEmpty] = getNamedAndIfEmpty(op);\n if (named && varName) {\n vals.push(encodeComponent(varName, reserved, op));\n if (value === \"\") {\n if (!ifEmpty) {\n vals.push(ifEmpty);\n }\n return !vals.join(\"\") ? undefined : `${first}${vals.join(\"\")}`;\n }\n vals.push(\"=\");\n }\n\n const items = [];\n if (Array.isArray(value)) {\n for (const val of value.filter(isDefined)) {\n items.push(encodeComponent(val, reserved, op));\n }\n } else if (typeof value === \"object\") {\n for (const key of Object.keys(value)) {\n if (!isDefined(value[key])) {\n continue;\n }\n items.push(encodeRFC3986URIComponent(key));\n items.push(encodeComponent(value[key], reserved, op));\n }\n }\n vals.push(items.join(\",\"));\n return !vals.join(\",\") ? undefined : `${first}${vals.join(\"\")}`;\n}\n\nfunction getVarValue(option: ValueOptions): string | undefined {\n const { op, varName, modifier, isFirst, reserved, varValue: value } = option;\n\n if (!isDefined(value)) {\n return undefined;\n } else if ([\"string\", \"number\", \"boolean\"].includes(typeof value)) {\n let val = value.toString();\n const [named, ifEmpty] = getNamedAndIfEmpty(op);\n const vals: string[] = [getFirstOrSep(op, isFirst)];\n if (named && varName) {\n // No need to encode varName considering it is already encoded\n vals.push(varName);\n val === \"\" ? vals.push(ifEmpty) : vals.push(\"=\");\n }\n if (modifier && modifier !== \"*\") {\n val = val.substring(0, parseInt(modifier, 10));\n }\n vals.push(encodeComponent(val, reserved, op));\n return vals.join(\"\");\n } else if (modifier === \"*\") {\n return getExpandedValue(option);\n } else {\n return getNonExpandedValue(option);\n }\n}\n\n// ---------------------------------------------------------------------------------------------------\n// This is an implementation of RFC 6570 URI Template: https://datatracker.ietf.org/doc/html/rfc6570.\n// ---------------------------------------------------------------------------------------------------\nexport function expandUrlTemplate(\n template: string,\n context: Record<string, any>,\n option?: UrlTemplateOptions,\n): string {\n return template.replace(/\\{([^{}]+)\\}|([^{}]+)/g, (_, expr, text) => {\n if (!expr) {\n return encodeReservedComponent(text);\n }\n let op;\n if ([\"+\", \"#\", \".\", \"/\", \";\", \"?\", \"&\"].includes(expr[0])) {\n (op = expr[0]), (expr = expr.slice(1));\n }\n const varList = expr.split(/,/g);\n const result = [];\n for (const varSpec of varList) {\n const varMatch = /([^:*]*)(?::(\\d+)|(\\*))?/.exec(varSpec);\n if (!varMatch || !varMatch[1]) {\n continue;\n }\n const varValue = getVarValue({\n isFirst: result.length === 0,\n op,\n varValue: context[varMatch[1]],\n varName: varMatch[1],\n modifier: varMatch[2] || varMatch[3],\n reserved: option?.allowReserved,\n });\n if (varValue) {\n result.push(varValue);\n }\n }\n return result.join(\"\");\n });\n}\n"]}
1
+ {"version":3,"file":"urlTemplate.js","sourceRoot":"","sources":["../../../src/static-helpers/urlTemplate.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAsB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GAAG,EAAE,CAAC;QAClB,KAAK,MAAM,OAAO,IAAI,OAAO,EAAE,CAAC;YAC9B,MAAM,QAAQ,GAAG,0BAA0B,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC1D,IAAI,CAAC,QAAQ,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC9B,SAAS;YACX,CAAC;YACD,MAAM,QAAQ,GAAG,WAAW,CAAC;gBAC3B,OAAO,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC;gBAC5B,EAAE;gBACF,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;gBAC9B,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;gBACpB,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC;gBACpC,QAAQ,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,aAAa;aAChC,CAAC,CAAC;YACH,IAAI,QAAQ,EAAE,CAAC;gBACb,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACxB,CAAC;QACH,CAAC;QACD,OAAO,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACzB,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/* eslint-disable no-unused-expressions */\n/* eslint-disable no-param-reassign */\n\n// ---------------------\n// interfaces\n// ---------------------\ninterface ValueOptions {\n isFirst: boolean; // is first value in the expression\n op?: string; // operator\n varValue?: any; // variable value\n varName?: string; // variable name\n modifier?: string; // modifier e.g *\n reserved?: boolean; // if true we'll keep reserved words with not encoding\n}\n\nexport interface UrlTemplateOptions {\n // if set to true, reserved characters will not be encoded\n allowReserved?: boolean;\n}\n\n// ---------------------\n// helpers\n// ---------------------\nfunction encodeComponent(val: string, reserved?: boolean, op?: string) {\n return (reserved ?? op === \"+\") || op === \"#\"\n ? encodeReservedComponent(val)\n : encodeRFC3986URIComponent(val);\n}\n\nfunction encodeReservedComponent(str: string) {\n return str\n .split(/(%[0-9A-Fa-f]{2})/g)\n .map((part) => (!/%[0-9A-Fa-f]/.test(part) ? encodeURI(part) : part))\n .join(\"\");\n}\n\nfunction encodeRFC3986URIComponent(str: string) {\n return encodeURIComponent(str).replace(\n /[!'()*]/g,\n (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`,\n );\n}\n\nfunction isDefined(val: any) {\n return val !== undefined && val !== null;\n}\n\nfunction getNamedAndIfEmpty(op?: string): [boolean, string] {\n return [!!op && [\";\", \"?\", \"&\"].includes(op), !!op && [\"?\", \"&\"].includes(op) ? \"=\" : \"\"];\n}\n\nfunction getFirstOrSep(op?: string, isFirst = false) {\n if (isFirst) {\n return !op || op === \"+\" ? \"\" : op;\n } else if (!op || op === \"+\" || op === \"#\") {\n return \",\";\n } else if (op === \"?\") {\n return \"&\";\n } else {\n return op;\n }\n}\n\nfunction getExpandedValue(option: ValueOptions) {\n let isFirst = option.isFirst;\n const { op, varName, varValue: value, reserved } = option;\n const vals: string[] = [];\n const [named, ifEmpty] = getNamedAndIfEmpty(op);\n\n if (Array.isArray(value)) {\n for (const val of value.filter(isDefined)) {\n // prepare the following parts: separator, varName, value\n vals.push(`${getFirstOrSep(op, isFirst)}`);\n if (named && varName) {\n vals.push(`${encodeURIComponent(varName)}`);\n val === \"\" ? vals.push(ifEmpty) : vals.push(\"=\");\n }\n vals.push(encodeComponent(val, reserved, op));\n isFirst = false;\n }\n } else if (typeof value === \"object\") {\n for (const key of Object.keys(value)) {\n const val = value[key];\n if (!isDefined(val)) {\n continue;\n }\n // prepare the following parts: separator, key, value\n vals.push(`${getFirstOrSep(op, isFirst)}`);\n if (key) {\n vals.push(`${encodeURIComponent(key)}`);\n named && val === \"\" ? vals.push(ifEmpty) : vals.push(\"=\");\n }\n vals.push(encodeComponent(val, reserved, op));\n isFirst = false;\n }\n }\n return vals.join(\"\");\n}\n\nfunction getNonExpandedValue(option: ValueOptions) {\n const { op, varName, varValue: value, isFirst, reserved } = option;\n const vals: string[] = [];\n const first = getFirstOrSep(op, isFirst);\n const [named, ifEmpty] = getNamedAndIfEmpty(op);\n if (named && varName) {\n vals.push(encodeComponent(varName, reserved, op));\n if (value === \"\") {\n if (!ifEmpty) {\n vals.push(ifEmpty);\n }\n return !vals.join(\"\") ? undefined : `${first}${vals.join(\"\")}`;\n }\n vals.push(\"=\");\n }\n\n const items = [];\n if (Array.isArray(value)) {\n for (const val of value.filter(isDefined)) {\n items.push(encodeComponent(val, reserved, op));\n }\n } else if (typeof value === \"object\") {\n for (const key of Object.keys(value)) {\n if (!isDefined(value[key])) {\n continue;\n }\n items.push(encodeRFC3986URIComponent(key));\n items.push(encodeComponent(value[key], reserved, op));\n }\n }\n vals.push(items.join(\",\"));\n return !vals.join(\",\") ? undefined : `${first}${vals.join(\"\")}`;\n}\n\nfunction getVarValue(option: ValueOptions): string | undefined {\n const { op, varName, modifier, isFirst, reserved, varValue: value } = option;\n\n if (!isDefined(value)) {\n return undefined;\n } else if ([\"string\", \"number\", \"boolean\"].includes(typeof value)) {\n let val = value.toString();\n const [named, ifEmpty] = getNamedAndIfEmpty(op);\n const vals: string[] = [getFirstOrSep(op, isFirst)];\n if (named && varName) {\n // No need to encode varName considering it is already encoded\n vals.push(varName);\n val === \"\" ? vals.push(ifEmpty) : vals.push(\"=\");\n }\n if (modifier && modifier !== \"*\") {\n val = val.substring(0, parseInt(modifier, 10));\n }\n vals.push(encodeComponent(val, reserved, op));\n return vals.join(\"\");\n } else if (modifier === \"*\") {\n return getExpandedValue(option);\n } else {\n return getNonExpandedValue(option);\n }\n}\n\n// ---------------------------------------------------------------------------------------------------\n// This is an implementation of RFC 6570 URI Template: https://datatracker.ietf.org/doc/html/rfc6570.\n// ---------------------------------------------------------------------------------------------------\nexport function expandUrlTemplate(\n template: string,\n context: Record<string, any>,\n option?: UrlTemplateOptions,\n): string {\n return template.replace(/\\{([^{}]+)\\}|([^{}]+)/g, (_, expr, text) => {\n if (!expr) {\n return encodeReservedComponent(text);\n }\n let op;\n if ([\"+\", \"#\", \".\", \"/\", \";\", \"?\", \"&\"].includes(expr[0])) {\n (op = expr[0]), (expr = expr.slice(1));\n }\n const varList = expr.split(/,/g);\n const result = [];\n for (const varSpec of varList) {\n const varMatch = /([^:*]*)(?::(\\d+)|(\\*))?/.exec(varSpec);\n if (!varMatch || !varMatch[1]) {\n continue;\n }\n const varValue = getVarValue({\n isFirst: result.length === 0,\n op,\n varValue: context[varMatch[1]],\n varName: varMatch[1],\n modifier: varMatch[2] || varMatch[3],\n reserved: option?.allowReserved,\n });\n if (varValue) {\n result.push(varValue);\n }\n }\n return result.join(\"\");\n });\n}\n"]}
@@ -1,4 +1,4 @@
1
- import type { AzureAISearchToolDefinition, CodeInterpreterToolDefinition, FileSearchToolDefinition, FileSearchToolDefinitionDetails, FunctionDefinition, FunctionToolDefinition, SearchConfiguration, OpenApiToolDefinition, RequiredAction, RequiredToolCall, ToolDefinition, ToolDefinitionUnion, ToolResources, VectorStoreConfigurations, VectorStoreDataSource, OpenApiFunctionDefinition, AISearchIndexResource, BingGroundingToolDefinition, MicrosoftFabricToolDefinition } from "./index.js";
1
+ import type { AzureAISearchToolDefinition, CodeInterpreterToolDefinition, FileSearchToolDefinition, FileSearchToolDefinitionDetails, FunctionDefinition, FunctionToolDefinition, OpenApiToolDefinition, RequiredAction, RequiredToolCall, ToolDefinition, ToolDefinitionUnion, ToolResources, VectorStoreConfigurations, VectorStoreDataSource, OpenApiFunctionDefinition, AISearchIndexResource, BingGroundingToolDefinition, MicrosoftFabricToolDefinition, BingCustomSearchToolDefinition, BingCustomSearchConfiguration, SharepointToolDefinition, BingGroundingSearchConfiguration } from "./index.js";
2
2
  /**
3
3
  * Determines if the given output is of the specified type.
4
4
  *
@@ -37,6 +37,17 @@ export declare class ToolUtility {
37
37
  static createConnectionTool(toolType: connectionToolType, connectionIds: string[]): {
38
38
  definition: ToolDefinitionUnion;
39
39
  };
40
+ /**
41
+ * Creates a sharepoint grounding search tool
42
+ *
43
+ * @param connectionId - The ID of the sharepoint search connection.
44
+ *
45
+ * @returns An object containing the definition and resources for the sharepoint grounding search tool
46
+ *
47
+ */
48
+ static createSharepointGroundingTool(connectionId: string): {
49
+ definition: SharepointToolDefinition;
50
+ };
40
51
  /**
41
52
  * Creates a bing grounding search tool
42
53
  *
@@ -45,7 +56,7 @@ export declare class ToolUtility {
45
56
  * @returns An object containing the definition and resources for the bing grounding search tool
46
57
  *
47
58
  */
48
- static createBingGroundingTool(connectionId: string): {
59
+ static createBingGroundingTool(searchConfigurations: BingGroundingSearchConfiguration[]): {
49
60
  definition: BingGroundingToolDefinition;
50
61
  };
51
62
  /**
@@ -55,8 +66,8 @@ export declare class ToolUtility {
55
66
  *
56
67
  * @returns An object containing the definition and resources for the bing custom search tool
57
68
  */
58
- static createBingCustomSearchTool(searchConfigurations: SearchConfiguration[]): {
59
- definition: ToolDefinitionUnion;
69
+ static createBingCustomSearchTool(searchConfigurations: BingCustomSearchConfiguration[]): {
70
+ definition: BingCustomSearchToolDefinition;
60
71
  };
61
72
  /**
62
73
  * Creates a file search tool
@@ -198,7 +209,7 @@ export declare class ToolSet {
198
209
  *
199
210
  * @returns An object containing the definition and resources for the bing grounding search tool
200
211
  */
201
- addBingGroundingTool(connectionId: string): {
212
+ addBingGroundingTool(searchConfigurations: BingGroundingSearchConfiguration[]): {
202
213
  definition: BingGroundingToolDefinition;
203
214
  };
204
215
  /**
@@ -210,5 +221,15 @@ export declare class ToolSet {
210
221
  addFabricTool(connectionId: string): {
211
222
  definition: MicrosoftFabricToolDefinition;
212
223
  };
224
+ /**
225
+ * Adds sharepoint grounding search tool to the tool set.
226
+ *
227
+ * @param connectionId - The ID of the sharepoint search connection.
228
+ *
229
+ * @returns An object containing the definition and resources for the sharepoint grounding search tool
230
+ */
231
+ addSharepointGroundingTool(connectionId: string): {
232
+ definition: SharepointToolDefinition;
233
+ };
213
234
  }
214
235
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,EAAE,EACzB,YAAY,CAAC,EAAE,KAAK,CAAC,yBAAyB,CAAC,EAC/C,iBAAiB,CAAC,EAAE,+BAA+B,GAClD;QAAE,UAAU,EAAE,wBAAwB,CAAC;QAAC,SAAS,EAAE,aAAa,CAAA;KAAE;IAOrE;;;;;;;OAOG;IACH,sBAAsB,CACpB,OAAO,CAAC,EAAE,MAAM,EAAE,EAClB,WAAW,CAAC,EAAE,KAAK,CAAC,qBAAqB,CAAC,GACzC;QAAE,UAAU,EAAE,6BAA6B,CAAC;QAAC,SAAS,EAAE,aAAa,CAAA;KAAE;IAO1E;;;;;;;OAOG;IACH,oBAAoB,CAClB,iBAAiB,EAAE,MAAM,EACzB,SAAS,EAAE,MAAM,GAChB;QAAE,UAAU,EAAE,2BAA2B,CAAC;QAAC,SAAS,EAAE,aAAa,CAAA;KAAE;IAOxE;;;;;;OAMG;IACH,cAAc,CAAC,yBAAyB,EAAE,yBAAyB,GAAG;QACpE,UAAU,EAAE,qBAAqB,CAAC;KACnC;IAMD;;;;;;OAMG;IACH,oBAAoB,CAAC,oBAAoB,EAAE,gCAAgC,EAAE,GAAG;QAC9E,UAAU,EAAE,2BAA2B,CAAC;KACzC;IAMD;;;;;OAKG;IACH,aAAa,CAAC,YAAY,EAAE,MAAM,GAAG;QAAE,UAAU,EAAE,6BAA6B,CAAA;KAAE;IAMlF;;;;;;OAMG;IACH,0BAA0B,CAAC,YAAY,EAAE,MAAM,GAAG;QAAE,UAAU,EAAE,wBAAwB,CAAA;KAAE;CAK3F"}
@@ -54,18 +54,18 @@ export class ToolUtility {
54
54
  };
55
55
  }
56
56
  /**
57
- * Creates a bing grounding search tool
57
+ * Creates a sharepoint grounding search tool
58
58
  *
59
- * @param connectionId - The ID of the bing search connection.
59
+ * @param connectionId - The ID of the sharepoint search connection.
60
60
  *
61
- * @returns An object containing the definition and resources for the bing grounding search tool
61
+ * @returns An object containing the definition and resources for the sharepoint grounding search tool
62
62
  *
63
63
  */
64
- static createBingGroundingTool(connectionId) {
64
+ static createSharepointGroundingTool(connectionId) {
65
65
  return {
66
66
  definition: {
67
- type: "bing_grounding",
68
- bingGrounding: {
67
+ type: "sharepoint_grounding",
68
+ sharepointGrounding: {
69
69
  connectionList: [
70
70
  {
71
71
  connectionId: connectionId,
@@ -75,6 +75,30 @@ export class ToolUtility {
75
75
  },
76
76
  };
77
77
  }
78
+ /**
79
+ * Creates a bing grounding search tool
80
+ *
81
+ * @param connectionId - The ID of the bing search connection.
82
+ *
83
+ * @returns An object containing the definition and resources for the bing grounding search tool
84
+ *
85
+ */
86
+ static createBingGroundingTool(searchConfigurations) {
87
+ return {
88
+ definition: {
89
+ type: "bing_grounding",
90
+ bingGrounding: {
91
+ searchConfigurations: searchConfigurations.map((searchConfiguration) => ({
92
+ connectionId: searchConfiguration.connectionId,
93
+ market: searchConfiguration === null || searchConfiguration === void 0 ? void 0 : searchConfiguration.market,
94
+ setLang: searchConfiguration === null || searchConfiguration === void 0 ? void 0 : searchConfiguration.setLang,
95
+ count: searchConfiguration === null || searchConfiguration === void 0 ? void 0 : searchConfiguration.count,
96
+ freshness: searchConfiguration === null || searchConfiguration === void 0 ? void 0 : searchConfiguration.freshness,
97
+ })),
98
+ },
99
+ },
100
+ };
101
+ }
78
102
  /**
79
103
  * Creates a bing custom search tool
80
104
  *
@@ -291,8 +315,8 @@ export class ToolSet {
291
315
  *
292
316
  * @returns An object containing the definition and resources for the bing grounding search tool
293
317
  */
294
- addBingGroundingTool(connectionId) {
295
- const tool = ToolUtility.createBingGroundingTool(connectionId);
318
+ addBingGroundingTool(searchConfigurations) {
319
+ const tool = ToolUtility.createBingGroundingTool(searchConfigurations);
296
320
  this.toolDefinitions.push(tool.definition);
297
321
  return tool;
298
322
  }
@@ -307,5 +331,17 @@ export class ToolSet {
307
331
  this.toolDefinitions.push(tool.definition);
308
332
  return tool;
309
333
  }
334
+ /**
335
+ * Adds sharepoint grounding search tool to the tool set.
336
+ *
337
+ * @param connectionId - The ID of the sharepoint search connection.
338
+ *
339
+ * @returns An object containing the definition and resources for the sharepoint grounding search tool
340
+ */
341
+ addSharepointGroundingTool(connectionId) {
342
+ const tool = ToolUtility.createSharepointGroundingTool(connectionId);
343
+ this.toolDefinitions.push(tool.definition);
344
+ return tool;
345
+ }
310
346
  }
311
347
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/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,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,CAAC,CAAC,EAAE,YAAY,EAAE,YAAY,EAAE,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EACzB,SAAiB;QAEjB,MAAM,IAAI,GAAG,WAAW,CAAC,uBAAuB,CAAC,iBAAiB,EAAE,SAAS,CAAC,CAAC;QAC/E,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3C,IAAI,CAAC,aAAa,mCAAQ,IAAI,CAAC,aAAa,GAAK,IAAI,CAAC,SAAS,CAAE,CAAC;QAClE,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;OAMG;IACH,cAAc,CAAC,yBAAoD;QAGjE,MAAM,IAAI,GAAG,WAAW,CAAC,iBAAiB,CAAC,yBAAyB,CAAC,CAAC;QACtE,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;OAMG;IACH,oBAAoB,CAAC,YAAoB;QACvC,MAAM,IAAI,GAAG,WAAW,CAAC,uBAAuB,CAAC,YAAY,CAAC,CAAC;QAC/D,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;OAKG;IACH,aAAa,CAAC,YAAoB;QAChC,MAAM,IAAI,GAAG,WAAW,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;QACxD,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;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 SearchConfiguration,\n OpenApiToolDefinition,\n RequiredAction,\n RequiredToolCall,\n ToolDefinition,\n ToolDefinitionUnion,\n ToolResources,\n VectorStoreConfigurations,\n VectorStoreDataSource,\n OpenApiFunctionDefinition,\n AISearchIndexResource,\n BingGroundingToolDefinition,\n MicrosoftFabricToolDefinition,\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(connectionId: string): {\n definition: BingGroundingToolDefinition;\n } {\n return {\n definition: {\n type: \"bing_grounding\",\n bingGrounding: {\n connectionList: [\n {\n connectionId: connectionId,\n },\n ],\n },\n },\n };\n }\n\n /**\n * Creates a bing custom search tool\n *\n * @param searchConfigurations - The ID of bing search connection and instanceName.\n *\n * @returns An object containing the definition and resources for the bing custom search tool\n */\n\n static createBingCustomSearchTool(searchConfigurations: SearchConfiguration[]): {\n definition: ToolDefinitionUnion;\n } {\n return {\n definition: {\n type: \"bing_custom_search\",\n bingCustomSearch: {\n searchConfigurations: searchConfigurations.map((searchConfiguration) => ({\n connectionId: searchConfiguration.connectionId,\n instanceName: searchConfiguration.instanceName,\n })),\n },\n },\n };\n }\n\n /**\n * Creates a file search tool\n *\n * @param vectorStoreIds - The ID of the vector store attached to this agent. There can be a maximum of 1 vector store attached to the agent.\n * @param vectorStores - The list of vector store configuration objects from Azure. This list is limited to one element. The only element of this list contains the list of azure asset IDs used by the search tool.\n * @param definitionDetails - The input definition information for a file search tool as used to configure an agent.\n *\n * @returns An object containing the definition and resources for the file search tool\n */\n static createFileSearchTool(\n vectorStoreIds?: string[],\n vectorStores?: Array<VectorStoreConfigurations>,\n definitionDetails?: FileSearchToolDefinitionDetails,\n ): { definition: FileSearchToolDefinition; resources: ToolResources } {\n return {\n definition: { type: \"file_search\", fileSearch: definitionDetails },\n resources: { fileSearch: { vectorStoreIds: vectorStoreIds, vectorStores: vectorStores } },\n };\n }\n\n /**\n * Creates a code interpreter tool\n *\n * @param fileIds - A list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n * @param dataSources - The data sources to be used. This option is mutually exclusive with fileIds.\n *\n * @returns An object containing the definition and resources for the code interpreter tool.\n */\n static createCodeInterpreterTool(\n fileIds?: string[],\n dataSources?: Array<VectorStoreDataSource>,\n ): { definition: CodeInterpreterToolDefinition; resources: ToolResources } {\n if (fileIds && dataSources) {\n throw new Error(\"Cannot specify both fileIds and dataSources\");\n }\n\n return {\n definition: { type: \"code_interpreter\" },\n resources: { codeInterpreter: { fileIds: fileIds, dataSources: dataSources } },\n };\n }\n\n /**\n * Creates an Azure AI search tool\n *\n * @param indexConnectionId - The connection ID of the Azure AI search index.\n * @param indexName - The name of the Azure AI search index.\n *\n * @returns An object containing the definition and resources for the Azure AI search tool.\n */\n static createAzureAISearchTool(\n indexConnectionId: string,\n indexName: string,\n options?: AISearchIndexResource,\n ): { definition: AzureAISearchToolDefinition; resources: ToolResources } {\n return {\n definition: { type: \"azure_ai_search\" },\n resources: {\n azureAISearch: {\n indexList: [\n {\n indexConnectionId: indexConnectionId,\n indexName: indexName,\n queryType: options?.queryType,\n topK: options?.topK,\n filter: options?.filter,\n },\n ],\n },\n },\n };\n }\n\n /**\n * Creates a Microsoft Fabric tool\n *\n * @param connectionIds - A list of the IDs of the Fabric connections to use.\n * @returns An object containing the definition for the Microsoft Fabric tool\n */\n static createFabricTool(connectionId: string): { definition: MicrosoftFabricToolDefinition } {\n return {\n definition: {\n type: \"fabric_dataagent\",\n fabricDataagent: {\n connectionList: [{ connectionId: connectionId }],\n },\n },\n };\n }\n\n /**\n * Creates a function tool\n *\n * @param functionDefinition - The function definition to use.\n *\n * @returns An object containing the definition for the function tool.\n */\n static createFunctionTool(functionDefinition: FunctionDefinition): {\n definition: FunctionToolDefinition;\n } {\n return {\n definition: {\n type: \"function\",\n function: functionDefinition,\n },\n };\n }\n\n /**\n * Creates an OpenApi tool\n *\n * @param openApiFunctionDefinition - The OpenApi function definition to use.\n *\n * @returns An object containing the definition for the OpenApi tool.\n */\n static createOpenApiTool(openApiFunctionDefinition: OpenApiFunctionDefinition): {\n definition: OpenApiToolDefinition;\n } {\n return {\n definition: {\n type: \"openapi\",\n openapi: {\n name: openApiFunctionDefinition.name,\n spec: openApiFunctionDefinition.spec,\n description: openApiFunctionDefinition.description,\n auth: openApiFunctionDefinition.auth,\n defaultParams: openApiFunctionDefinition.defaultParams,\n },\n },\n };\n }\n}\n/**\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(connectionId: string): { definition: BingGroundingToolDefinition } {\n const tool = ToolUtility.createBingGroundingTool(connectionId);\n this.toolDefinitions.push(tool.definition);\n return tool;\n }\n\n /**\n * Adds a Microsoft Fabric tool to the tool set.\n *\n * @param connectionId - The ID of the Fabric connection to use.\n * @returns An object containing the definition for the Microsoft Fabric tool\n */\n addFabricTool(connectionId: string): { definition: MicrosoftFabricToolDefinition } {\n const tool = ToolUtility.createFabricTool(connectionId);\n this.toolDefinitions.push(tool.definition);\n return tool;\n }\n}\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AA2BlC;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAC5B,MAA+D,EAC/D,IAAY;IAEZ,OAAO,MAAM,CAAC,IAAI,KAAK,IAAI,CAAC;AAC9B,CAAC;AAED,2DAA2D;AAC3D,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C,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 MicrosoftFabricToolDefinition,\n BingCustomSearchToolDefinition,\n BingCustomSearchConfiguration,\n SharepointToolDefinition,\n BingGroundingSearchConfiguration,\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 sharepoint grounding search tool\n *\n * @param connectionId - The ID of the sharepoint search connection.\n *\n * @returns An object containing the definition and resources for the sharepoint grounding search tool\n *\n */\n static createSharepointGroundingTool(connectionId: string): {\n definition: SharepointToolDefinition;\n } {\n return {\n definition: {\n type: \"sharepoint_grounding\",\n sharepointGrounding: {\n connectionList: [\n {\n connectionId: connectionId,\n },\n ],\n },\n },\n };\n }\n\n /**\n * Creates a bing grounding search tool\n *\n * @param connectionId - The ID of the bing search connection.\n *\n * @returns An object containing the definition and resources for the bing grounding search tool\n *\n */\n static createBingGroundingTool(searchConfigurations: BingGroundingSearchConfiguration[]): {\n definition: BingGroundingToolDefinition;\n } {\n return {\n definition: {\n type: \"bing_grounding\",\n bingGrounding: {\n searchConfigurations: searchConfigurations.map((searchConfiguration) => ({\n connectionId: searchConfiguration.connectionId,\n market: searchConfiguration?.market,\n setLang: searchConfiguration?.setLang,\n count: searchConfiguration?.count,\n freshness: searchConfiguration?.freshness,\n })),\n },\n },\n };\n }\n\n /**\n * Creates a bing custom search tool\n *\n * @param searchConfigurations - The ID of bing search connection and instanceName.\n *\n * @returns An object containing the definition and resources for the bing custom search tool\n */\n\n static createBingCustomSearchTool(searchConfigurations: BingCustomSearchConfiguration[]): {\n definition: BingCustomSearchToolDefinition;\n } {\n return {\n definition: {\n type: \"bing_custom_search\",\n bingCustomSearch: {\n searchConfigurations: searchConfigurations.map((searchConfiguration) => ({\n connectionId: searchConfiguration.connectionId,\n instanceName: searchConfiguration.instanceName,\n })),\n },\n },\n };\n }\n\n /**\n * Creates a file search tool\n *\n * @param vectorStoreIds - The ID of the vector store attached to this agent. There can be a maximum of 1 vector store attached to the agent.\n * @param vectorStores - The list of vector store configuration objects from Azure. This list is limited to one element. The only element of this list contains the list of azure asset IDs used by the search tool.\n * @param definitionDetails - The input definition information for a file search tool as used to configure an agent.\n *\n * @returns An object containing the definition and resources for the file search tool\n */\n static createFileSearchTool(\n vectorStoreIds?: string[],\n vectorStores?: Array<VectorStoreConfigurations>,\n definitionDetails?: FileSearchToolDefinitionDetails,\n ): { definition: FileSearchToolDefinition; resources: ToolResources } {\n return {\n definition: { type: \"file_search\", fileSearch: definitionDetails },\n resources: { fileSearch: { vectorStoreIds: vectorStoreIds, vectorStores: vectorStores } },\n };\n }\n\n /**\n * Creates a code interpreter tool\n *\n * @param fileIds - A list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n * @param dataSources - The data sources to be used. This option is mutually exclusive with fileIds.\n *\n * @returns An object containing the definition and resources for the code interpreter tool.\n */\n static createCodeInterpreterTool(\n fileIds?: string[],\n dataSources?: Array<VectorStoreDataSource>,\n ): { definition: CodeInterpreterToolDefinition; resources: ToolResources } {\n if (fileIds && dataSources) {\n throw new Error(\"Cannot specify both fileIds and dataSources\");\n }\n\n return {\n definition: { type: \"code_interpreter\" },\n resources: { codeInterpreter: { fileIds: fileIds, dataSources: dataSources } },\n };\n }\n\n /**\n * Creates an Azure AI search tool\n *\n * @param indexConnectionId - The connection ID of the Azure AI search index.\n * @param indexName - The name of the Azure AI search index.\n *\n * @returns An object containing the definition and resources for the Azure AI search tool.\n */\n static createAzureAISearchTool(\n indexConnectionId: string,\n indexName: string,\n options?: AISearchIndexResource,\n ): { definition: AzureAISearchToolDefinition; resources: ToolResources } {\n return {\n definition: { type: \"azure_ai_search\" },\n resources: {\n azureAISearch: {\n indexList: [\n {\n indexConnectionId: indexConnectionId,\n indexName: indexName,\n queryType: options?.queryType,\n topK: options?.topK,\n filter: options?.filter,\n },\n ],\n },\n },\n };\n }\n\n /**\n * Creates a Microsoft Fabric tool\n *\n * @param connectionIds - A list of the IDs of the Fabric connections to use.\n * @returns An object containing the definition for the Microsoft Fabric tool\n */\n static createFabricTool(connectionId: string): { definition: MicrosoftFabricToolDefinition } {\n return {\n definition: {\n type: \"fabric_dataagent\",\n fabricDataagent: {\n connectionList: [{ connectionId: connectionId }],\n },\n },\n };\n }\n\n /**\n * Creates a function tool\n *\n * @param functionDefinition - The function definition to use.\n *\n * @returns An object containing the definition for the function tool.\n */\n static createFunctionTool(functionDefinition: FunctionDefinition): {\n definition: FunctionToolDefinition;\n } {\n return {\n definition: {\n type: \"function\",\n function: functionDefinition,\n },\n };\n }\n\n /**\n * Creates an OpenApi tool\n *\n * @param openApiFunctionDefinition - The OpenApi function definition to use.\n *\n * @returns An object containing the definition for the OpenApi tool.\n */\n static createOpenApiTool(openApiFunctionDefinition: OpenApiFunctionDefinition): {\n definition: OpenApiToolDefinition;\n } {\n return {\n definition: {\n type: \"openapi\",\n openapi: {\n name: openApiFunctionDefinition.name,\n spec: openApiFunctionDefinition.spec,\n description: openApiFunctionDefinition.description,\n auth: openApiFunctionDefinition.auth,\n defaultParams: openApiFunctionDefinition.defaultParams,\n },\n },\n };\n }\n}\n/**\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 Microsoft Fabric tool to the tool set.\n *\n * @param connectionId - The ID of the Fabric connection to use.\n * @returns An object containing the definition for the Microsoft Fabric tool\n */\n addFabricTool(connectionId: string): { definition: MicrosoftFabricToolDefinition } {\n const tool = ToolUtility.createFabricTool(connectionId);\n this.toolDefinitions.push(tool.definition);\n return tool;\n }\n\n /**\n * Adds sharepoint grounding search tool to the tool set.\n *\n * @param connectionId - The ID of the sharepoint search connection.\n *\n * @returns An object containing the definition and resources for the sharepoint grounding search tool\n */\n addSharepointGroundingTool(connectionId: string): { definition: SharepointToolDefinition } {\n const tool = ToolUtility.createSharepointGroundingTool(connectionId);\n this.toolDefinitions.push(tool.definition);\n return tool;\n }\n}\n"]}