@azure/ai-projects 1.0.0-beta.2 → 1.0.0-beta.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 (392) hide show
  1. package/LICENSE +4 -4
  2. package/README.md +270 -186
  3. package/dist/browser/agents/assistants.d.ts.map +1 -1
  4. package/dist/browser/agents/assistants.js +4 -2
  5. package/dist/browser/agents/assistants.js.map +1 -1
  6. package/dist/browser/agents/customModels.d.ts +4 -29
  7. package/dist/browser/agents/customModels.d.ts.map +1 -1
  8. package/dist/browser/agents/customModels.js.map +1 -1
  9. package/dist/browser/agents/files.d.ts +5 -4
  10. package/dist/browser/agents/files.d.ts.map +1 -1
  11. package/dist/browser/agents/files.js +55 -27
  12. package/dist/browser/agents/files.js.map +1 -1
  13. package/dist/browser/agents/index.d.ts +10 -10
  14. package/dist/browser/agents/index.d.ts.map +1 -1
  15. package/dist/browser/agents/index.js.map +1 -1
  16. package/dist/browser/agents/inputOutputs.d.ts +3 -3
  17. package/dist/browser/agents/inputOutputs.d.ts.map +1 -1
  18. package/dist/browser/agents/inputOutputs.js.map +1 -1
  19. package/dist/browser/agents/inputValidations.d.ts.map +1 -1
  20. package/dist/browser/agents/inputValidations.js +3 -2
  21. package/dist/browser/agents/inputValidations.js.map +1 -1
  22. package/dist/browser/agents/messages.js +2 -2
  23. package/dist/browser/agents/messages.js.map +1 -1
  24. package/dist/browser/agents/poller.d.ts +8 -33
  25. package/dist/browser/agents/poller.d.ts.map +1 -1
  26. package/dist/browser/agents/poller.js +130 -53
  27. package/dist/browser/agents/poller.js.map +1 -1
  28. package/dist/browser/agents/streamingModels.d.ts +17 -15
  29. package/dist/browser/agents/streamingModels.d.ts.map +1 -1
  30. package/dist/browser/agents/streamingModels.js.map +1 -1
  31. package/dist/browser/agents/traceUtility.d.ts +3 -3
  32. package/dist/browser/agents/traceUtility.d.ts.map +1 -1
  33. package/dist/browser/agents/traceUtility.js.map +1 -1
  34. package/dist/browser/agents/utils.d.ts +72 -4
  35. package/dist/browser/agents/utils.d.ts.map +1 -1
  36. package/dist/browser/agents/utils.js +100 -3
  37. package/dist/browser/agents/utils.js.map +1 -1
  38. package/dist/browser/agents/vectorStores.d.ts +3 -4
  39. package/dist/browser/agents/vectorStores.d.ts.map +1 -1
  40. package/dist/browser/agents/vectorStores.js +44 -26
  41. package/dist/browser/agents/vectorStores.js.map +1 -1
  42. package/dist/browser/agents/vectorStoresFileBatches.d.ts +5 -4
  43. package/dist/browser/agents/vectorStoresFileBatches.d.ts.map +1 -1
  44. package/dist/browser/agents/vectorStoresFileBatches.js +46 -32
  45. package/dist/browser/agents/vectorStoresFileBatches.js.map +1 -1
  46. package/dist/browser/agents/vectorStoresFiles.d.ts +4 -4
  47. package/dist/browser/agents/vectorStoresFiles.d.ts.map +1 -1
  48. package/dist/browser/agents/vectorStoresFiles.js +57 -28
  49. package/dist/browser/agents/vectorStoresFiles.js.map +1 -1
  50. package/dist/browser/constants.d.ts +1 -1
  51. package/dist/browser/constants.js +1 -1
  52. package/dist/browser/constants.js.map +1 -1
  53. package/dist/browser/customization/convertModelsToWrite.d.ts.map +1 -1
  54. package/dist/browser/customization/convertModelsToWrite.js +43 -94
  55. package/dist/browser/customization/convertModelsToWrite.js.map +1 -1
  56. package/dist/browser/customization/convertOutputModelsFromWire.d.ts.map +1 -1
  57. package/dist/browser/customization/convertOutputModelsFromWire.js +53 -11
  58. package/dist/browser/customization/convertOutputModelsFromWire.js.map +1 -1
  59. package/dist/browser/customization/convertParametersToWire.d.ts +1 -1
  60. package/dist/browser/customization/convertParametersToWire.d.ts.map +1 -1
  61. package/dist/browser/customization/convertParametersToWire.js.map +1 -1
  62. package/dist/browser/customization/models.d.ts +146 -151
  63. package/dist/browser/customization/models.d.ts.map +1 -1
  64. package/dist/browser/customization/models.js.map +1 -1
  65. package/dist/browser/customization/outputModels.d.ts +188 -37
  66. package/dist/browser/customization/outputModels.d.ts.map +1 -1
  67. package/dist/browser/customization/outputModels.js.map +1 -1
  68. package/dist/browser/customization/streamingModels.d.ts +2 -1
  69. package/dist/browser/customization/streamingModels.d.ts.map +1 -1
  70. package/dist/browser/customization/streamingModels.js.map +1 -1
  71. package/dist/browser/customization/streamingWireModels.d.ts +2 -1
  72. package/dist/browser/customization/streamingWireModels.d.ts.map +1 -1
  73. package/dist/browser/customization/streamingWireModels.js.map +1 -1
  74. package/dist/browser/generated/src/clientDefinitions.d.ts +3 -3
  75. package/dist/browser/generated/src/clientDefinitions.d.ts.map +1 -1
  76. package/dist/browser/generated/src/clientDefinitions.js.map +1 -1
  77. package/dist/browser/generated/src/isUnexpected.d.ts +1 -1
  78. package/dist/browser/generated/src/isUnexpected.d.ts.map +1 -1
  79. package/dist/browser/generated/src/isUnexpected.js.map +1 -1
  80. package/dist/browser/generated/src/models.d.ts +191 -157
  81. package/dist/browser/generated/src/models.d.ts.map +1 -1
  82. package/dist/browser/generated/src/models.js.map +1 -1
  83. package/dist/browser/generated/src/outputModels.d.ts +277 -47
  84. package/dist/browser/generated/src/outputModels.d.ts.map +1 -1
  85. package/dist/browser/generated/src/outputModels.js.map +1 -1
  86. package/dist/browser/generated/src/paginateHelper.d.ts +28 -3
  87. package/dist/browser/generated/src/paginateHelper.d.ts.map +1 -1
  88. package/dist/browser/generated/src/paginateHelper.js +99 -2
  89. package/dist/browser/generated/src/paginateHelper.js.map +1 -1
  90. package/dist/browser/generated/src/parameters.d.ts +67 -10
  91. package/dist/browser/generated/src/parameters.d.ts.map +1 -1
  92. package/dist/browser/generated/src/parameters.js.map +1 -1
  93. package/dist/browser/generated/src/projectsClient.d.ts +5 -5
  94. package/dist/browser/generated/src/projectsClient.d.ts.map +1 -1
  95. package/dist/browser/generated/src/projectsClient.js +3 -3
  96. package/dist/browser/generated/src/projectsClient.js.map +1 -1
  97. package/dist/browser/generated/src/responses.d.ts +5 -4
  98. package/dist/browser/generated/src/responses.d.ts.map +1 -1
  99. package/dist/browser/generated/src/responses.js.map +1 -1
  100. package/dist/commonjs/agents/assistants.d.ts.map +1 -1
  101. package/dist/commonjs/agents/assistants.js +4 -2
  102. package/dist/commonjs/agents/assistants.js.map +1 -1
  103. package/dist/commonjs/agents/customModels.d.ts +4 -29
  104. package/dist/commonjs/agents/customModels.d.ts.map +1 -1
  105. package/dist/commonjs/agents/customModels.js.map +1 -1
  106. package/dist/commonjs/agents/files.d.ts +5 -4
  107. package/dist/commonjs/agents/files.d.ts.map +1 -1
  108. package/dist/commonjs/agents/files.js +55 -26
  109. package/dist/commonjs/agents/files.js.map +1 -1
  110. package/dist/commonjs/agents/index.d.ts +10 -10
  111. package/dist/commonjs/agents/index.d.ts.map +1 -1
  112. package/dist/commonjs/agents/index.js.map +1 -1
  113. package/dist/commonjs/agents/inputOutputs.d.ts +3 -3
  114. package/dist/commonjs/agents/inputOutputs.d.ts.map +1 -1
  115. package/dist/commonjs/agents/inputOutputs.js.map +1 -1
  116. package/dist/commonjs/agents/inputValidations.d.ts.map +1 -1
  117. package/dist/commonjs/agents/inputValidations.js +3 -2
  118. package/dist/commonjs/agents/inputValidations.js.map +1 -1
  119. package/dist/commonjs/agents/messages.js +2 -2
  120. package/dist/commonjs/agents/messages.js.map +1 -1
  121. package/dist/commonjs/agents/poller.d.ts +8 -33
  122. package/dist/commonjs/agents/poller.d.ts.map +1 -1
  123. package/dist/commonjs/agents/poller.js +131 -55
  124. package/dist/commonjs/agents/poller.js.map +1 -1
  125. package/dist/commonjs/agents/streamingModels.d.ts +17 -15
  126. package/dist/commonjs/agents/streamingModels.d.ts.map +1 -1
  127. package/dist/commonjs/agents/streamingModels.js.map +1 -1
  128. package/dist/commonjs/agents/traceUtility.d.ts +3 -3
  129. package/dist/commonjs/agents/traceUtility.d.ts.map +1 -1
  130. package/dist/commonjs/agents/traceUtility.js.map +1 -1
  131. package/dist/commonjs/agents/utils.d.ts +72 -4
  132. package/dist/commonjs/agents/utils.d.ts.map +1 -1
  133. package/dist/commonjs/agents/utils.js +100 -3
  134. package/dist/commonjs/agents/utils.js.map +1 -1
  135. package/dist/commonjs/agents/vectorStores.d.ts +3 -4
  136. package/dist/commonjs/agents/vectorStores.d.ts.map +1 -1
  137. package/dist/commonjs/agents/vectorStores.js +43 -25
  138. package/dist/commonjs/agents/vectorStores.js.map +1 -1
  139. package/dist/commonjs/agents/vectorStoresFileBatches.d.ts +5 -4
  140. package/dist/commonjs/agents/vectorStoresFileBatches.d.ts.map +1 -1
  141. package/dist/commonjs/agents/vectorStoresFileBatches.js +46 -31
  142. package/dist/commonjs/agents/vectorStoresFileBatches.js.map +1 -1
  143. package/dist/commonjs/agents/vectorStoresFiles.d.ts +4 -4
  144. package/dist/commonjs/agents/vectorStoresFiles.d.ts.map +1 -1
  145. package/dist/commonjs/agents/vectorStoresFiles.js +56 -27
  146. package/dist/commonjs/agents/vectorStoresFiles.js.map +1 -1
  147. package/dist/commonjs/constants.d.ts +1 -1
  148. package/dist/commonjs/constants.js +1 -1
  149. package/dist/commonjs/constants.js.map +1 -1
  150. package/dist/commonjs/customization/convertModelsToWrite.d.ts.map +1 -1
  151. package/dist/commonjs/customization/convertModelsToWrite.js +43 -94
  152. package/dist/commonjs/customization/convertModelsToWrite.js.map +1 -1
  153. package/dist/commonjs/customization/convertOutputModelsFromWire.d.ts.map +1 -1
  154. package/dist/commonjs/customization/convertOutputModelsFromWire.js +53 -11
  155. package/dist/commonjs/customization/convertOutputModelsFromWire.js.map +1 -1
  156. package/dist/commonjs/customization/convertParametersToWire.d.ts +1 -1
  157. package/dist/commonjs/customization/convertParametersToWire.d.ts.map +1 -1
  158. package/dist/commonjs/customization/convertParametersToWire.js.map +1 -1
  159. package/dist/commonjs/customization/models.d.ts +146 -151
  160. package/dist/commonjs/customization/models.d.ts.map +1 -1
  161. package/dist/commonjs/customization/models.js.map +1 -1
  162. package/dist/commonjs/customization/outputModels.d.ts +188 -37
  163. package/dist/commonjs/customization/outputModels.d.ts.map +1 -1
  164. package/dist/commonjs/customization/outputModels.js.map +1 -1
  165. package/dist/commonjs/customization/streamingModels.d.ts +2 -1
  166. package/dist/commonjs/customization/streamingModels.d.ts.map +1 -1
  167. package/dist/commonjs/customization/streamingModels.js.map +1 -1
  168. package/dist/commonjs/customization/streamingWireModels.d.ts +2 -1
  169. package/dist/commonjs/customization/streamingWireModels.d.ts.map +1 -1
  170. package/dist/commonjs/customization/streamingWireModels.js.map +1 -1
  171. package/dist/commonjs/generated/src/clientDefinitions.d.ts +3 -3
  172. package/dist/commonjs/generated/src/clientDefinitions.d.ts.map +1 -1
  173. package/dist/commonjs/generated/src/clientDefinitions.js.map +1 -1
  174. package/dist/commonjs/generated/src/isUnexpected.d.ts +1 -1
  175. package/dist/commonjs/generated/src/isUnexpected.d.ts.map +1 -1
  176. package/dist/commonjs/generated/src/isUnexpected.js.map +1 -1
  177. package/dist/commonjs/generated/src/models.d.ts +191 -157
  178. package/dist/commonjs/generated/src/models.d.ts.map +1 -1
  179. package/dist/commonjs/generated/src/models.js.map +1 -1
  180. package/dist/commonjs/generated/src/outputModels.d.ts +277 -47
  181. package/dist/commonjs/generated/src/outputModels.d.ts.map +1 -1
  182. package/dist/commonjs/generated/src/outputModels.js.map +1 -1
  183. package/dist/commonjs/generated/src/paginateHelper.d.ts +28 -3
  184. package/dist/commonjs/generated/src/paginateHelper.d.ts.map +1 -1
  185. package/dist/commonjs/generated/src/paginateHelper.js +99 -2
  186. package/dist/commonjs/generated/src/paginateHelper.js.map +1 -1
  187. package/dist/commonjs/generated/src/parameters.d.ts +67 -10
  188. package/dist/commonjs/generated/src/parameters.d.ts.map +1 -1
  189. package/dist/commonjs/generated/src/parameters.js.map +1 -1
  190. package/dist/commonjs/generated/src/projectsClient.d.ts +5 -5
  191. package/dist/commonjs/generated/src/projectsClient.d.ts.map +1 -1
  192. package/dist/commonjs/generated/src/projectsClient.js +3 -3
  193. package/dist/commonjs/generated/src/projectsClient.js.map +1 -1
  194. package/dist/commonjs/generated/src/responses.d.ts +5 -4
  195. package/dist/commonjs/generated/src/responses.d.ts.map +1 -1
  196. package/dist/commonjs/generated/src/responses.js.map +1 -1
  197. package/dist/commonjs/tsdoc-metadata.json +1 -1
  198. package/dist/esm/agents/assistants.d.ts.map +1 -1
  199. package/dist/esm/agents/assistants.js +4 -2
  200. package/dist/esm/agents/assistants.js.map +1 -1
  201. package/dist/esm/agents/customModels.d.ts +4 -29
  202. package/dist/esm/agents/customModels.d.ts.map +1 -1
  203. package/dist/esm/agents/customModels.js.map +1 -1
  204. package/dist/esm/agents/files.d.ts +5 -4
  205. package/dist/esm/agents/files.d.ts.map +1 -1
  206. package/dist/esm/agents/files.js +55 -27
  207. package/dist/esm/agents/files.js.map +1 -1
  208. package/dist/esm/agents/index.d.ts +10 -10
  209. package/dist/esm/agents/index.d.ts.map +1 -1
  210. package/dist/esm/agents/index.js.map +1 -1
  211. package/dist/esm/agents/inputOutputs.d.ts +3 -3
  212. package/dist/esm/agents/inputOutputs.d.ts.map +1 -1
  213. package/dist/esm/agents/inputOutputs.js.map +1 -1
  214. package/dist/esm/agents/inputValidations.d.ts.map +1 -1
  215. package/dist/esm/agents/inputValidations.js +3 -2
  216. package/dist/esm/agents/inputValidations.js.map +1 -1
  217. package/dist/esm/agents/messages.js +2 -2
  218. package/dist/esm/agents/messages.js.map +1 -1
  219. package/dist/esm/agents/poller.d.ts +8 -33
  220. package/dist/esm/agents/poller.d.ts.map +1 -1
  221. package/dist/esm/agents/poller.js +130 -53
  222. package/dist/esm/agents/poller.js.map +1 -1
  223. package/dist/esm/agents/streamingModels.d.ts +17 -15
  224. package/dist/esm/agents/streamingModels.d.ts.map +1 -1
  225. package/dist/esm/agents/streamingModels.js.map +1 -1
  226. package/dist/esm/agents/traceUtility.d.ts +3 -3
  227. package/dist/esm/agents/traceUtility.d.ts.map +1 -1
  228. package/dist/esm/agents/traceUtility.js.map +1 -1
  229. package/dist/esm/agents/utils.d.ts +72 -4
  230. package/dist/esm/agents/utils.d.ts.map +1 -1
  231. package/dist/esm/agents/utils.js +100 -3
  232. package/dist/esm/agents/utils.js.map +1 -1
  233. package/dist/esm/agents/vectorStores.d.ts +3 -4
  234. package/dist/esm/agents/vectorStores.d.ts.map +1 -1
  235. package/dist/esm/agents/vectorStores.js +44 -26
  236. package/dist/esm/agents/vectorStores.js.map +1 -1
  237. package/dist/esm/agents/vectorStoresFileBatches.d.ts +5 -4
  238. package/dist/esm/agents/vectorStoresFileBatches.d.ts.map +1 -1
  239. package/dist/esm/agents/vectorStoresFileBatches.js +46 -32
  240. package/dist/esm/agents/vectorStoresFileBatches.js.map +1 -1
  241. package/dist/esm/agents/vectorStoresFiles.d.ts +4 -4
  242. package/dist/esm/agents/vectorStoresFiles.d.ts.map +1 -1
  243. package/dist/esm/agents/vectorStoresFiles.js +57 -28
  244. package/dist/esm/agents/vectorStoresFiles.js.map +1 -1
  245. package/dist/esm/constants.d.ts +1 -1
  246. package/dist/esm/constants.js +1 -1
  247. package/dist/esm/constants.js.map +1 -1
  248. package/dist/esm/customization/convertModelsToWrite.d.ts.map +1 -1
  249. package/dist/esm/customization/convertModelsToWrite.js +43 -94
  250. package/dist/esm/customization/convertModelsToWrite.js.map +1 -1
  251. package/dist/esm/customization/convertOutputModelsFromWire.d.ts.map +1 -1
  252. package/dist/esm/customization/convertOutputModelsFromWire.js +53 -11
  253. package/dist/esm/customization/convertOutputModelsFromWire.js.map +1 -1
  254. package/dist/esm/customization/convertParametersToWire.d.ts +1 -1
  255. package/dist/esm/customization/convertParametersToWire.d.ts.map +1 -1
  256. package/dist/esm/customization/convertParametersToWire.js.map +1 -1
  257. package/dist/esm/customization/models.d.ts +146 -151
  258. package/dist/esm/customization/models.d.ts.map +1 -1
  259. package/dist/esm/customization/models.js.map +1 -1
  260. package/dist/esm/customization/outputModels.d.ts +188 -37
  261. package/dist/esm/customization/outputModels.d.ts.map +1 -1
  262. package/dist/esm/customization/outputModels.js.map +1 -1
  263. package/dist/esm/customization/streamingModels.d.ts +2 -1
  264. package/dist/esm/customization/streamingModels.d.ts.map +1 -1
  265. package/dist/esm/customization/streamingModels.js.map +1 -1
  266. package/dist/esm/customization/streamingWireModels.d.ts +2 -1
  267. package/dist/esm/customization/streamingWireModels.d.ts.map +1 -1
  268. package/dist/esm/customization/streamingWireModels.js.map +1 -1
  269. package/dist/esm/generated/src/clientDefinitions.d.ts +3 -3
  270. package/dist/esm/generated/src/clientDefinitions.d.ts.map +1 -1
  271. package/dist/esm/generated/src/clientDefinitions.js.map +1 -1
  272. package/dist/esm/generated/src/isUnexpected.d.ts +1 -1
  273. package/dist/esm/generated/src/isUnexpected.d.ts.map +1 -1
  274. package/dist/esm/generated/src/isUnexpected.js.map +1 -1
  275. package/dist/esm/generated/src/models.d.ts +191 -157
  276. package/dist/esm/generated/src/models.d.ts.map +1 -1
  277. package/dist/esm/generated/src/models.js.map +1 -1
  278. package/dist/esm/generated/src/outputModels.d.ts +277 -47
  279. package/dist/esm/generated/src/outputModels.d.ts.map +1 -1
  280. package/dist/esm/generated/src/outputModels.js.map +1 -1
  281. package/dist/esm/generated/src/paginateHelper.d.ts +28 -3
  282. package/dist/esm/generated/src/paginateHelper.d.ts.map +1 -1
  283. package/dist/esm/generated/src/paginateHelper.js +99 -2
  284. package/dist/esm/generated/src/paginateHelper.js.map +1 -1
  285. package/dist/esm/generated/src/parameters.d.ts +67 -10
  286. package/dist/esm/generated/src/parameters.d.ts.map +1 -1
  287. package/dist/esm/generated/src/parameters.js.map +1 -1
  288. package/dist/esm/generated/src/projectsClient.d.ts +5 -5
  289. package/dist/esm/generated/src/projectsClient.d.ts.map +1 -1
  290. package/dist/esm/generated/src/projectsClient.js +3 -3
  291. package/dist/esm/generated/src/projectsClient.js.map +1 -1
  292. package/dist/esm/generated/src/responses.d.ts +5 -4
  293. package/dist/esm/generated/src/responses.d.ts.map +1 -1
  294. package/dist/esm/generated/src/responses.js.map +1 -1
  295. package/dist/react-native/agents/assistants.d.ts.map +1 -1
  296. package/dist/react-native/agents/assistants.js +4 -2
  297. package/dist/react-native/agents/assistants.js.map +1 -1
  298. package/dist/react-native/agents/customModels.d.ts +4 -29
  299. package/dist/react-native/agents/customModels.d.ts.map +1 -1
  300. package/dist/react-native/agents/customModels.js.map +1 -1
  301. package/dist/react-native/agents/files.d.ts +5 -4
  302. package/dist/react-native/agents/files.d.ts.map +1 -1
  303. package/dist/react-native/agents/files.js +55 -27
  304. package/dist/react-native/agents/files.js.map +1 -1
  305. package/dist/react-native/agents/index.d.ts +10 -10
  306. package/dist/react-native/agents/index.d.ts.map +1 -1
  307. package/dist/react-native/agents/index.js.map +1 -1
  308. package/dist/react-native/agents/inputOutputs.d.ts +3 -3
  309. package/dist/react-native/agents/inputOutputs.d.ts.map +1 -1
  310. package/dist/react-native/agents/inputOutputs.js.map +1 -1
  311. package/dist/react-native/agents/inputValidations.d.ts.map +1 -1
  312. package/dist/react-native/agents/inputValidations.js +3 -2
  313. package/dist/react-native/agents/inputValidations.js.map +1 -1
  314. package/dist/react-native/agents/messages.js +2 -2
  315. package/dist/react-native/agents/messages.js.map +1 -1
  316. package/dist/react-native/agents/poller.d.ts +8 -33
  317. package/dist/react-native/agents/poller.d.ts.map +1 -1
  318. package/dist/react-native/agents/poller.js +130 -53
  319. package/dist/react-native/agents/poller.js.map +1 -1
  320. package/dist/react-native/agents/streamingModels.d.ts +17 -15
  321. package/dist/react-native/agents/streamingModels.d.ts.map +1 -1
  322. package/dist/react-native/agents/streamingModels.js.map +1 -1
  323. package/dist/react-native/agents/traceUtility.d.ts +3 -3
  324. package/dist/react-native/agents/traceUtility.d.ts.map +1 -1
  325. package/dist/react-native/agents/traceUtility.js.map +1 -1
  326. package/dist/react-native/agents/utils.d.ts +72 -4
  327. package/dist/react-native/agents/utils.d.ts.map +1 -1
  328. package/dist/react-native/agents/utils.js +100 -3
  329. package/dist/react-native/agents/utils.js.map +1 -1
  330. package/dist/react-native/agents/vectorStores.d.ts +3 -4
  331. package/dist/react-native/agents/vectorStores.d.ts.map +1 -1
  332. package/dist/react-native/agents/vectorStores.js +44 -26
  333. package/dist/react-native/agents/vectorStores.js.map +1 -1
  334. package/dist/react-native/agents/vectorStoresFileBatches.d.ts +5 -4
  335. package/dist/react-native/agents/vectorStoresFileBatches.d.ts.map +1 -1
  336. package/dist/react-native/agents/vectorStoresFileBatches.js +46 -32
  337. package/dist/react-native/agents/vectorStoresFileBatches.js.map +1 -1
  338. package/dist/react-native/agents/vectorStoresFiles.d.ts +4 -4
  339. package/dist/react-native/agents/vectorStoresFiles.d.ts.map +1 -1
  340. package/dist/react-native/agents/vectorStoresFiles.js +57 -28
  341. package/dist/react-native/agents/vectorStoresFiles.js.map +1 -1
  342. package/dist/react-native/constants.d.ts +1 -1
  343. package/dist/react-native/constants.js +1 -1
  344. package/dist/react-native/constants.js.map +1 -1
  345. package/dist/react-native/customization/convertModelsToWrite.d.ts.map +1 -1
  346. package/dist/react-native/customization/convertModelsToWrite.js +43 -94
  347. package/dist/react-native/customization/convertModelsToWrite.js.map +1 -1
  348. package/dist/react-native/customization/convertOutputModelsFromWire.d.ts.map +1 -1
  349. package/dist/react-native/customization/convertOutputModelsFromWire.js +53 -11
  350. package/dist/react-native/customization/convertOutputModelsFromWire.js.map +1 -1
  351. package/dist/react-native/customization/convertParametersToWire.d.ts +1 -1
  352. package/dist/react-native/customization/convertParametersToWire.d.ts.map +1 -1
  353. package/dist/react-native/customization/convertParametersToWire.js.map +1 -1
  354. package/dist/react-native/customization/models.d.ts +146 -151
  355. package/dist/react-native/customization/models.d.ts.map +1 -1
  356. package/dist/react-native/customization/models.js.map +1 -1
  357. package/dist/react-native/customization/outputModels.d.ts +188 -37
  358. package/dist/react-native/customization/outputModels.d.ts.map +1 -1
  359. package/dist/react-native/customization/outputModels.js.map +1 -1
  360. package/dist/react-native/customization/streamingModels.d.ts +2 -1
  361. package/dist/react-native/customization/streamingModels.d.ts.map +1 -1
  362. package/dist/react-native/customization/streamingModels.js.map +1 -1
  363. package/dist/react-native/customization/streamingWireModels.d.ts +2 -1
  364. package/dist/react-native/customization/streamingWireModels.d.ts.map +1 -1
  365. package/dist/react-native/customization/streamingWireModels.js.map +1 -1
  366. package/dist/react-native/generated/src/clientDefinitions.d.ts +3 -3
  367. package/dist/react-native/generated/src/clientDefinitions.d.ts.map +1 -1
  368. package/dist/react-native/generated/src/clientDefinitions.js.map +1 -1
  369. package/dist/react-native/generated/src/isUnexpected.d.ts +1 -1
  370. package/dist/react-native/generated/src/isUnexpected.d.ts.map +1 -1
  371. package/dist/react-native/generated/src/isUnexpected.js.map +1 -1
  372. package/dist/react-native/generated/src/models.d.ts +191 -157
  373. package/dist/react-native/generated/src/models.d.ts.map +1 -1
  374. package/dist/react-native/generated/src/models.js.map +1 -1
  375. package/dist/react-native/generated/src/outputModels.d.ts +277 -47
  376. package/dist/react-native/generated/src/outputModels.d.ts.map +1 -1
  377. package/dist/react-native/generated/src/outputModels.js.map +1 -1
  378. package/dist/react-native/generated/src/paginateHelper.d.ts +28 -3
  379. package/dist/react-native/generated/src/paginateHelper.d.ts.map +1 -1
  380. package/dist/react-native/generated/src/paginateHelper.js +99 -2
  381. package/dist/react-native/generated/src/paginateHelper.js.map +1 -1
  382. package/dist/react-native/generated/src/parameters.d.ts +67 -10
  383. package/dist/react-native/generated/src/parameters.d.ts.map +1 -1
  384. package/dist/react-native/generated/src/parameters.js.map +1 -1
  385. package/dist/react-native/generated/src/projectsClient.d.ts +5 -5
  386. package/dist/react-native/generated/src/projectsClient.d.ts.map +1 -1
  387. package/dist/react-native/generated/src/projectsClient.js +3 -3
  388. package/dist/react-native/generated/src/projectsClient.js.map +1 -1
  389. package/dist/react-native/generated/src/responses.d.ts +5 -4
  390. package/dist/react-native/generated/src/responses.d.ts.map +1 -1
  391. package/dist/react-native/generated/src/responses.js.map +1 -1
  392. package/package.json +33 -34
package/README.md CHANGED
@@ -9,9 +9,9 @@ Use the AI Projects client library (in preview) to:
9
9
 
10
10
  [Product documentation](https://aka.ms/azsdk/azure-ai-projects/product-doc)
11
11
 
12
- <!-- | [Samples][samples] -->
13
- <!-- | [Package (npm)](https://www.npmjs.com/package/@azure/ai-projects) -->
14
- <!-- | [API reference documentation](https://learn.microsoft.com/javascript/api/overview/azure/ai-projects-readme?view=azure-node-preview) -->
12
+ | [Samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/ai/ai-projects/samples)
13
+ | [Package (npm)](https://www.npmjs.com/package/@azure/ai-projects)
14
+ | [API reference documentation](https://learn.microsoft.com/javascript/api/overview/azure/ai-projects-readme?view=azure-node-preview)
15
15
 
16
16
  ## Table of contents
17
17
 
@@ -33,6 +33,7 @@ Use the AI Projects client library (in preview) to:
33
33
  - [Bing grounding](#create-agent-with-bing-grounding)
34
34
  - [Azure AI Search](#create-agent-with-azure-ai-search)
35
35
  - [Function call](#create-agent-with-function-call)
36
+ - [Fabric Data](#create-an-agent-with-fabric)
36
37
  - [Create thread](#create-thread) with
37
38
  - [Tool resource](#create-thread-with-tool-resource)
38
39
  - [Create message](#create-message) with:
@@ -49,7 +50,7 @@ Use the AI Projects client library (in preview) to:
49
50
  - [Troubleshooting](#troubleshooting)
50
51
  - [Exceptions](#exceptions)
51
52
  - [Reporting issues](#reporting-issues)
52
- <!-- - [Next steps](#next-steps) -->
53
+ - [Next steps](#next-steps)
53
54
  - [Contributing](#contributing)
54
55
 
55
56
  ## Getting started
@@ -69,7 +70,7 @@ Use the AI Projects client library (in preview) to:
69
70
  ### Install the package
70
71
 
71
72
  ```bash
72
- npm install @azure/ai-projects
73
+ npm install @azure/ai-projects @azure/identity
73
74
  ```
74
75
 
75
76
  ## Key concepts
@@ -78,14 +79,11 @@ npm install @azure/ai-projects
78
79
 
79
80
  The class factory method `fromConnectionString` is used to construct the client. To construct a client:
80
81
 
81
- ```javascript
82
+ ```ts snippet:setup
82
83
  import { AIProjectsClient } from "@azure/ai-projects";
83
84
  import { DefaultAzureCredential } from "@azure/identity";
84
85
 
85
- import "dotenv/config";
86
-
87
- const connectionString = process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || "<connectionString>";
88
-
86
+ const connectionString = process.env.AZURE_AI_PROJECTS_CONNECTION_STRING ?? "<connectionString>";
89
87
  const client = AIProjectsClient.fromConnectionString(
90
88
  connectionString,
91
89
  new DefaultAzureCredential(),
@@ -98,13 +96,13 @@ const client = AIProjectsClient.fromConnectionString(
98
96
 
99
97
  Your Azure AI Foundry project has a "Management center". When you enter it, you will see a tab named "Connected resources" under your project. The `.connections` operations on the client allow you to enumerate the connections and get connection properties. Connection properties include the resource URL and authentication credentials, among other things.
100
98
 
101
- Below are code examples of the connection operations. Full samples can be found under the "connections" folder in the [package samples][samples].
99
+ Below are code examples of the connection operations. Full samples can be found under the "connections" folder in the [package samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/ai/ai-projects/samples).
102
100
 
103
101
  #### Get properties of all connections
104
102
 
105
103
  To list the properties of all the connections in the Azure AI Foundry project:
106
104
 
107
- ```javascript
105
+ ```ts snippet:listConnections
108
106
  const connections = await client.connections.listConnections();
109
107
  for (const connection of connections) {
110
108
  console.log(connection);
@@ -115,7 +113,7 @@ for (const connection of connections) {
115
113
 
116
114
  To list the properties of connections of a certain type (here Azure OpenAI):
117
115
 
118
- ```javascript
116
+ ```ts snippet:filterConnections
119
117
  const connections = await client.connections.listConnections({ category: "AzureOpenAI" });
120
118
  for (const connection of connections) {
121
119
  console.log(connection);
@@ -126,21 +124,21 @@ for (const connection of connections) {
126
124
 
127
125
  To get the connection properties of a connection named `connectionName`:
128
126
 
129
- ```javascript
127
+ ```ts snippet:getConnection
130
128
  const connection = await client.connections.getConnection("connectionName");
131
129
  console.log(connection);
132
130
  ```
133
131
 
134
132
  To get the connection properties with its authentication credentials:
135
133
 
136
- ```javascript
134
+ ```ts snippet:getConnectionWithSecrets
137
135
  const connection = await client.connections.getConnectionWithSecrets("connectionName");
138
136
  console.log(connection);
139
137
  ```
140
138
 
141
139
  ### Agents (Preview)
142
140
 
143
- Agents in the Azure AI Projects client library are designed to facilitate various interactions and operations within your AI projects. They serve as the core components that manage and execute tasks, leveraging different tools and resources to achieve specific goals. The following steps outline the typical sequence for interacting with Agents. See the "agents" folder in the [package samples][samples] for additional Agent samples.
141
+ Agents in the Azure AI Projects client library are designed to facilitate various interactions and operations within your AI projects. They serve as the core components that manage and execute tasks, leveraging different tools and resources to achieve specific goals. The following steps outline the typical sequence for interacting with Agents. See the "agents" folder in the [package samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/ai/ai-projects/samples) for additional Agent samples.
144
142
 
145
143
  Agents are actively being developed. A sign-up form for private preview is coming soon.
146
144
 
@@ -148,7 +146,7 @@ Agents are actively being developed. A sign-up form for private preview is comin
148
146
 
149
147
  Here is an example of how to create an Agent:
150
148
 
151
- ```javascript
149
+ ```ts snippet:createAgent
152
150
  const agent = await client.agents.createAgent("gpt-4o", {
153
151
  name: "my-agent",
154
152
  instructions: "You are a helpful assistant",
@@ -159,12 +157,12 @@ To allow Agents to access your resources or custom functions, you need tools. Yo
159
157
 
160
158
  You can use `ToolSet` to do this:
161
159
 
162
- ```javascript
160
+ ```ts snippet:toolSet
161
+ import { ToolSet } from "@azure/ai-projects";
162
+
163
163
  const toolSet = new ToolSet();
164
164
  toolSet.addFileSearchTool([vectorStore.id]);
165
165
  toolSet.addCodeInterpreterTool([codeInterpreterFile.id]);
166
-
167
- // Create agent with tool set
168
166
  const agent = await client.agents.createAgent("gpt-4o", {
169
167
  name: "my-agent",
170
168
  instructions: "You are a helpful agent",
@@ -178,21 +176,20 @@ console.log(`Created agent, agent ID: ${agent.id}`);
178
176
 
179
177
  To perform file search by an Agent, we first need to upload a file, create a vector store, and associate the file to the vector store. Here is an example:
180
178
 
181
- ```javascript
182
- const localFileStream = fs.createReadStream("sample_file_for_upload.txt");
179
+ ```ts snippet:fileSearch
180
+ import { ToolUtility } from "@azure/ai-projects";
181
+
182
+ const localFileStream = fs.createReadStream(filePath);
183
183
  const file = await client.agents.uploadFile(localFileStream, "assistants", {
184
184
  fileName: "sample_file_for_upload.txt",
185
185
  });
186
186
  console.log(`Uploaded file, ID: ${file.id}`);
187
-
188
187
  const vectorStore = await client.agents.createVectorStore({
189
188
  fileIds: [file.id],
190
189
  name: "my_vector_store",
191
190
  });
192
191
  console.log(`Created vector store, ID: ${vectorStore.id}`);
193
-
194
192
  const fileSearchTool = ToolUtility.createFileSearchTool([vectorStore.id]);
195
-
196
193
  const agent = await client.agents.createAgent("gpt-4o", {
197
194
  name: "SDK Test Agent - Retrieval",
198
195
  instructions: "You are helpful agent that can help fetch data from files you know about.",
@@ -206,15 +203,15 @@ console.log(`Created agent, agent ID : ${agent.id}`);
206
203
 
207
204
  Here is an example to upload a file and use it for code interpreter by an Agent:
208
205
 
209
- ```javascript
210
- const fileStream = fs.createReadStream("nifty_500_quarterly_results.csv");
211
- const fFile = await client.agents.uploadFile(fileStream, "assistants", {
212
- fileName: "nifty_500_quarterly_results.csv",
213
- });
214
- console.log(`Uploaded local file, file ID : ${file.id}`);
215
-
216
- const codeInterpreterTool = ToolUtility.createCodeInterpreterTool([file.id]);
206
+ ```ts snippet:codeInterpreter
207
+ import { ToolUtility } from "@azure/ai-projects";
217
208
 
209
+ const localFileStream = fs.createReadStream(filePath);
210
+ const localFile = await client.agents.uploadFile(localFileStream, "assistants", {
211
+ fileName: "localFile",
212
+ });
213
+ console.log(`Uploaded local file, file ID : ${localFile.id}`);
214
+ const codeInterpreterTool = ToolUtility.createCodeInterpreterTool([localFile.id]);
218
215
  // Notice that CodeInterpreter must be enabled in the agent creation, otherwise the agent will not be able to see the file attachment
219
216
  const agent = await client.agents.createAgent("gpt-4o-mini", {
220
217
  name: "my-agent",
@@ -231,13 +228,15 @@ To enable your Agent to perform search through Bing search API, you use `ToolUti
231
228
 
232
229
  Here is an example:
233
230
 
234
- ```javascript
235
- const bingGroundingConnectionId = "<bingGroundingConnectionId>";
236
- const bingTool = ToolUtility.createConnectionTool(connectionToolType.BingGrounding, [
237
- bingGroundingConnectionId,
238
- ]);
231
+ ```ts snippet:bingGrounding
232
+ import { ToolUtility, connectionToolType } from "@azure/ai-projects";
239
233
 
240
- const agent = await client.agents.createAgent("gpt-4-0125-preview", {
234
+ const bingConnection = await client.connections.getConnection(
235
+ process.env.BING_CONNECTION_NAME ?? "<connection-name>",
236
+ );
237
+ const connectionId = bingConnection.id;
238
+ const bingTool = ToolUtility.createConnectionTool(connectionToolType.BingGrounding, [connectionId]);
239
+ const agent = await client.agents.createAgent("gpt-4o", {
241
240
  name: "my-agent",
242
241
  instructions: "You are a helpful agent",
243
242
  tools: [bingTool.definition],
@@ -251,17 +250,13 @@ Azure AI Search is an enterprise search system for high-performance applications
251
250
 
252
251
  Here is an example to integrate Azure AI Search:
253
252
 
254
- ```javascript
255
- const cognitiveServicesConnectionName = "<cognitiveServicesConnectionName>";
256
- const cognitiveServicesConnection = await client.connections.getConnection(
257
- cognitiveServicesConnectionName,
258
- );
259
- const azureAISearchTool = ToolUtility.createAzureAISearchTool(
260
- cognitiveServicesConnection.id,
261
- cognitiveServicesConnection.name,
262
- );
253
+ ```ts snippet:AISearch
254
+ import { ToolUtility } from "@azure/ai-projects";
263
255
 
264
- // Create agent with the Azure AI search tool
256
+ const connectionName =
257
+ process.env.AZURE_AI_SEARCH_CONNECTION_NAME ?? "<AzureAISearchConnectionName>";
258
+ const connection = await client.connections.getConnection(connectionName);
259
+ const azureAISearchTool = ToolUtility.createAzureAISearchTool(connection.id, connection.name);
265
260
  const agent = await client.agents.createAgent("gpt-4-0125-preview", {
266
261
  name: "my-agent",
267
262
  instructions: "You are a helpful agent",
@@ -277,48 +272,71 @@ You can enhance your Agents by defining callback functions as function tools. Th
277
272
 
278
273
  Here is an example:
279
274
 
280
- ```javascript
281
- class FunctionToolExecutor {
282
- private functionTools: { func: Function, definition: FunctionToolDefinition }[];
275
+ ```ts snippet:functionTools
276
+ import {
277
+ FunctionToolDefinition,
278
+ ToolUtility,
279
+ RequiredToolCallOutput,
280
+ FunctionToolDefinitionOutput,
281
+ ToolOutput,
282
+ } from "@azure/ai-projects";
283
283
 
284
+ class FunctionToolExecutor {
285
+ private functionTools: {
286
+ func: Function;
287
+ definition: FunctionToolDefinition;
288
+ }[];
284
289
  constructor() {
285
- this.functionTools = [{
286
- func: this.getUserFavoriteCity,
287
- ...ToolUtility.createFunctionTool({
288
- name: "getUserFavoriteCity",
289
- description: "Gets the user's favorite city.",
290
- parameters: {}
291
- })
292
- }, {
293
- func: this.getCityNickname,
294
- ...ToolUtility.createFunctionTool({
295
- name: "getCityNickname",
296
- description: "Gets the nickname of a city, e.g. 'LA' for 'Los Angeles, CA'.",
297
- parameters: { type: "object", properties: { location: { type: "string", description: "The city and state, e.g. Seattle, Wa" } } }
298
- })
299
- }, {
300
- func: this.getWeather,
301
- ...ToolUtility.createFunctionTool({
302
- name: "getWeather",
303
- description: "Gets the weather for a location.",
304
- parameters: { type: "object", properties: { location: { type: "string", description: "The city and state, e.g. Seattle, Wa" }, unit: { type: "string", enum: ['c', 'f'] } } }
305
- })
306
- }];
290
+ this.functionTools = [
291
+ {
292
+ func: this.getUserFavoriteCity,
293
+ ...ToolUtility.createFunctionTool({
294
+ name: "getUserFavoriteCity",
295
+ description: "Gets the user's favorite city.",
296
+ parameters: {},
297
+ }),
298
+ },
299
+ {
300
+ func: this.getCityNickname,
301
+ ...ToolUtility.createFunctionTool({
302
+ name: "getCityNickname",
303
+ description: "Gets the nickname of a city, e.g. 'LA' for 'Los Angeles, CA'.",
304
+ parameters: {
305
+ type: "object",
306
+ properties: {
307
+ location: { type: "string", description: "The city and state, e.g. Seattle, Wa" },
308
+ },
309
+ },
310
+ }),
311
+ },
312
+ {
313
+ func: this.getWeather,
314
+ ...ToolUtility.createFunctionTool({
315
+ name: "getWeather",
316
+ description: "Gets the weather for a location.",
317
+ parameters: {
318
+ type: "object",
319
+ properties: {
320
+ location: { type: "string", description: "The city and state, e.g. Seattle, Wa" },
321
+ unit: { type: "string", enum: ["c", "f"] },
322
+ },
323
+ },
324
+ }),
325
+ },
326
+ ];
307
327
  }
308
-
309
328
  private getUserFavoriteCity(): {} {
310
- return { "location": "Seattle, WA" };
329
+ return { location: "Seattle, WA" };
311
330
  }
312
-
313
331
  private getCityNickname(location: string): {} {
314
- return { "nickname": "The Emerald City" };
332
+ return { nickname: "The Emerald City" };
315
333
  }
316
-
317
334
  private getWeather(location: string, unit: string): {} {
318
- return { "weather": unit === "f" ? "72f" : "22c" };
335
+ return { weather: unit === "f" ? "72f" : "22c" };
319
336
  }
320
-
321
- public invokeTool(toolCall: RequiredToolCallOutput & FunctionToolDefinitionOutput): ToolOutput | undefined {
337
+ public invokeTool(
338
+ toolCall: RequiredToolCallOutput & FunctionToolDefinitionOutput,
339
+ ): ToolOutput | undefined {
322
340
  console.log(`Function tool call - ${toolCall.function.name}`);
323
341
  const args = [];
324
342
  if (toolCall.function.parameters) {
@@ -334,34 +352,62 @@ class FunctionToolExecutor {
334
352
  return undefined;
335
353
  }
336
354
  }
337
- const result = this.functionTools.find((tool) => tool.definition.function.name === toolCall.function.name)?.func(...args);
338
- return result ? {
339
- toolCallId: toolCall.id,
340
- output: JSON.stringify(result)
341
- } : undefined;
355
+ const result = this.functionTools
356
+ .find((tool) => tool.definition.function.name === toolCall.function.name)
357
+ ?.func(...args);
358
+ return result
359
+ ? {
360
+ toolCallId: toolCall.id,
361
+ output: JSON.stringify(result),
362
+ }
363
+ : undefined;
342
364
  }
343
-
344
365
  public getFunctionDefinitions(): FunctionToolDefinition[] {
345
- return this.functionTools.map(tool => {return tool.definition});
366
+ return this.functionTools.map((tool) => {
367
+ return tool.definition;
368
+ });
346
369
  }
347
370
  }
348
-
349
371
  const functionToolExecutor = new FunctionToolExecutor();
350
372
  const functionTools = functionToolExecutor.getFunctionDefinitions();
351
- const agent = await client.agents.createAgent("gpt-4o",
352
- {
353
- name: "my-agent",
354
- instructions: "You are a weather bot. Use the provided functions to help answer questions. Customize your responses to the user's preferences as much as possible and use friendly nicknames for cities whenever possible.",
355
- tools: functionTools
356
- });
373
+ const agent = await client.agents.createAgent("gpt-4o", {
374
+ name: "my-agent",
375
+ instructions:
376
+ "You are a weather bot. Use the provided functions to help answer questions. Customize your responses to the user's preferences as much as possible and use friendly nicknames for cities whenever possible.",
377
+ tools: functionTools,
378
+ });
357
379
  console.log(`Created agent, agent ID: ${agent.id}`);
358
380
  ```
359
381
 
382
+ #### Create an Agent with Fabric
383
+
384
+ To enable your Agent to answer queries using Fabric data, use `FabricTool` along with a connection to the Fabric resource.
385
+
386
+ Here is an example:
387
+
388
+ ```ts snippet:createAgentWithFabric
389
+ import { ToolUtility } from "@azure/ai-projects";
390
+
391
+ const fabricConnection = await client.connections.getConnection(
392
+ process.env["FABRIC_CONNECTION_NAME"] || "<connection-name>",
393
+ );
394
+ const connectionId = fabricConnection.id;
395
+ // Initialize agent Microsoft Fabric tool with the connection id
396
+ const fabricTool = ToolUtility.createFabricTool(connectionId);
397
+ // Create agent with the Microsoft Fabric tool and process assistant run
398
+ const agent = await client.agents.createAgent("gpt-4o", {
399
+ name: "my-agent",
400
+ instructions: "You are a helpful agent",
401
+ tools: [fabricTool.definition],
402
+ });
403
+ console.log(`Created agent, agent ID : ${agent.id}`);
404
+ ```
405
+
360
406
  #### Create Thread
361
407
 
362
408
  For each session or conversation, a thread is required. Here is an example:
363
409
 
364
- ```javascript
410
+ ```ts snippet:createThread
365
411
  const thread = await client.agents.createThread();
366
412
  ```
367
413
 
@@ -369,28 +415,25 @@ const thread = await client.agents.createThread();
369
415
 
370
416
  In some scenarios, you might need to assign specific resources to individual threads. To achieve this, you provide the `toolResources` argument to `createThread`. In the following example, you create a vector store and upload a file, enable an Agent for file search using the `tools` argument, and then associate the file with the thread using the `toolResources` argument.
371
417
 
372
- ```javascript
373
- const localFileStream = fs.createReadStream("sample_file_for_upload.txt");
418
+ ```ts snippet:threadWithTool
419
+ import { ToolUtility } from "@azure/ai-projects";
420
+
421
+ const localFileStream = fs.createReadStream(filePath);
374
422
  const file = await client.agents.uploadFile(localFileStream, "assistants", {
375
- fileName: "sample_file_for_upload.txt",
423
+ fileName: "sample_file_for_upload.csv",
376
424
  });
377
425
  console.log(`Uploaded file, ID: ${file.id}`);
378
-
379
426
  const vectorStore = await client.agents.createVectorStore({
380
427
  fileIds: [file.id],
381
- name: "my_vector_store",
382
428
  });
383
429
  console.log(`Created vector store, ID: ${vectorStore.id}`);
384
-
385
430
  const fileSearchTool = ToolUtility.createFileSearchTool([vectorStore.id]);
386
-
387
431
  const agent = await client.agents.createAgent("gpt-4o", {
388
- name: "SDK Test Agent - Retrieval",
432
+ name: "myAgent",
389
433
  instructions: "You are helpful agent that can help fetch data from files you know about.",
390
434
  tools: [fileSearchTool.definition],
391
435
  });
392
436
  console.log(`Created agent, agent ID : ${agent.id}`);
393
-
394
437
  // Create thread with file resources.
395
438
  // If the agent has multiple threads, only this thread can search this file.
396
439
  const thread = await client.agents.createThread({ toolResources: fileSearchTool.resources });
@@ -400,18 +443,21 @@ const thread = await client.agents.createThread({ toolResources: fileSearchTool.
400
443
 
401
444
  To create a message for assistant to process, you pass `user` as `role` and a question as `content`:
402
445
 
403
- ```javascript
446
+ ```ts snippet:createMessage
404
447
  const message = await client.agents.createMessage(thread.id, {
405
448
  role: "user",
406
449
  content: "hello, world!",
407
450
  });
451
+ console.log(`Created message, message ID: ${message.id}`);
408
452
  ```
409
453
 
410
454
  #### Create Message with File Search Attachment
411
455
 
412
456
  To attach a file to a message for content searching, you use `ToolUtility.createFileSearchTool()` and the `attachments` argument:
413
457
 
414
- ```javascript
458
+ ```ts snippet:messageWithFileSearch
459
+ import { ToolUtility } from "@azure/ai-projects";
460
+
415
461
  const fileSearchTool = ToolUtility.createFileSearchTool();
416
462
  const message = await client.agents.createMessage(thread.id, {
417
463
  role: "user",
@@ -429,7 +475,9 @@ To attach a file to a message for data analysis, you use `ToolUtility.createCode
429
475
 
430
476
  Here is an example:
431
477
 
432
- ```javascript
478
+ ```ts snippet:messageWithCodeInterpreter
479
+ import { ToolUtility } from "@azure/ai-projects";
480
+
433
481
  // notice that CodeInterpreter must be enabled in the agent creation,
434
482
  // otherwise the agent will not be able to see the file attachment for code interpretation
435
483
  const codeInterpreterTool = ToolUtility.createCodeInterpreterTool();
@@ -439,10 +487,8 @@ const agent = await client.agents.createAgent("gpt-4-1106-preview", {
439
487
  tools: [codeInterpreterTool.definition],
440
488
  });
441
489
  console.log(`Created agent, agent ID: ${agent.id}`);
442
-
443
- const thread = client.agents.createThread();
490
+ const thread = await client.agents.createThread();
444
491
  console.log(`Created thread, thread ID: ${thread.id}`);
445
-
446
492
  const message = await client.agents.createMessage(thread.id, {
447
493
  role: "user",
448
494
  content:
@@ -459,9 +505,8 @@ console.log(`Created message, message ID: ${message.id}`);
459
505
 
460
506
  Here is an example of `createRun` and poll until the run is completed:
461
507
 
462
- ```javascript
508
+ ```ts snippet:createRun
463
509
  let run = await client.agents.createRun(thread.id, agent.id);
464
-
465
510
  // Poll the run as long as run status is queued or in progress
466
511
  while (
467
512
  run.status === "queued" ||
@@ -478,48 +523,66 @@ To have the SDK poll on your behalf, use the `createThreadAndRun` method.
478
523
 
479
524
  Here is an example:
480
525
 
481
- ```javascript
482
- const run = await client.agents.createThreadAndRun(thread.id, agent.id);
526
+ ```ts snippet:createThreadAndRun
527
+ const run = await client.agents.createThreadAndRun(agent.id, {
528
+ thread: {
529
+ messages: [
530
+ {
531
+ role: "user",
532
+ content: "hello, world!",
533
+ },
534
+ ],
535
+ },
536
+ });
483
537
  ```
484
538
 
485
539
  With streaming, polling also need not be considered.
486
540
 
487
541
  Here is an example:
488
542
 
489
- ```javascript
543
+ ```ts snippet:createRunStream
490
544
  const streamEventMessages = await client.agents.createRun(thread.id, agent.id).stream();
491
545
  ```
492
546
 
493
547
  Event handling can be done as follows:
494
548
 
495
- ```javascript
549
+ ```ts snippet:eventHandling
550
+ import {
551
+ RunStreamEvent,
552
+ ThreadRunOutput,
553
+ MessageStreamEvent,
554
+ MessageDeltaChunk,
555
+ MessageDeltaTextContent,
556
+ DoneEvent,
557
+ } from "@azure/ai-projects";
558
+
559
+ const streamEventMessages = await client.agents.createRun(thread.id, agent.id).stream();
496
560
  for await (const eventMessage of streamEventMessages) {
497
- switch (eventMessage.event) {
498
- case RunStreamEvent.ThreadRunCreated:
499
- console.log(`ThreadRun status: ${(eventMessage.data as ThreadRunOutput).status}`)
500
- break;
501
- case MessageStreamEvent.ThreadMessageDelta:
502
- {
503
- const messageDelta = eventMessage.data as MessageDeltaChunk;
504
- messageDelta.delta.content.forEach((contentPart) => {
505
- if (contentPart.type === "text") {
506
- const textContent = contentPart as MessageDeltaTextContent
507
- const textValue = textContent.text?.value || "No text"
508
- console.log(`Text delta received:: ${textValue}`)
509
- }
510
- });
511
- }
512
- break;
513
-
514
- case RunStreamEvent.ThreadRunCompleted:
515
- console.log("Thread Run Completed");
516
- break;
517
- case ErrorEvent.Error:
518
- console.log(`An error occurred. Data ${eventMessage.data}`);
519
- break;
520
- case DoneEvent.Done:
521
- console.log("Stream completed.");
522
- break;
561
+ switch (eventMessage.event) {
562
+ case RunStreamEvent.ThreadRunCreated:
563
+ console.log(`ThreadRun status: ${(eventMessage.data as ThreadRunOutput).status}`);
564
+ break;
565
+ case MessageStreamEvent.ThreadMessageDelta:
566
+ {
567
+ const messageDelta = eventMessage.data as MessageDeltaChunk;
568
+ messageDelta.delta.content.forEach((contentPart) => {
569
+ if (contentPart.type === "text") {
570
+ const textContent = contentPart as MessageDeltaTextContent;
571
+ const textValue = textContent.text?.value || "No text";
572
+ console.log(`Text delta received:: ${textValue}`);
573
+ }
574
+ });
575
+ }
576
+ break;
577
+ case RunStreamEvent.ThreadRunCompleted:
578
+ console.log("Thread Run Completed");
579
+ break;
580
+ case ErrorEvent.Error:
581
+ console.log(`An error occurred. Data ${eventMessage.data}`);
582
+ break;
583
+ case DoneEvent.Done:
584
+ console.log("Stream completed.");
585
+ break;
523
586
  }
524
587
  }
525
588
  ```
@@ -528,18 +591,29 @@ switch (eventMessage.event) {
528
591
 
529
592
  To retrieve messages from agents, use the following example:
530
593
 
531
- ```javascript
532
- const messages = await client.agents.listMessages(thread.id);
594
+ ```ts snippet:listMessages
595
+ import { MessageContentOutput, isOutputOfType, MessageTextContentOutput } from "../src/index.js";
533
596
 
597
+ const messages = await client.agents.listMessages(thread.id);
598
+ while (messages.hasMore) {
599
+ const nextMessages = await client.agents.listMessages(currentRun.threadId, {
600
+ after: messages.lastId,
601
+ });
602
+ messages.data = messages.data.concat(nextMessages.data);
603
+ messages.hasMore = nextMessages.hasMore;
604
+ messages.lastId = nextMessages.lastId;
605
+ }
534
606
  // The messages are following in the reverse order,
535
607
  // we will iterate them and output only text contents.
536
608
  for (const dataPoint of messages.data.reverse()) {
537
- const lastMessageContent: MessageContentOutput = dataPoint.content[dataPoint.content.length - 1];
538
- console.log( lastMessageContent);
539
- if (isOutputOfType<MessageTextContentOutput>(lastMessageContent, "text")) {
540
- console.log(`${dataPoint.role}: ${(lastMessageContent as MessageTextContentOutput).text.value}`);
541
- }
609
+ const lastMessageContent: MessageContentOutput = dataPoint.content[dataPoint.content.length - 1];
610
+ console.log(lastMessageContent);
611
+ if (isOutputOfType<MessageTextContentOutput>(lastMessageContent, "text")) {
612
+ console.log(
613
+ `${dataPoint.role}: ${(lastMessageContent as MessageTextContentOutput).text.value}`,
614
+ );
542
615
  }
616
+ }
543
617
  ```
544
618
 
545
619
  ### Retrieve File
@@ -548,12 +622,29 @@ Files uploaded by Agents cannot be retrieved back. If your use case needs to acc
548
622
 
549
623
  Here is an example retrieving file ids from messages:
550
624
 
551
- ```javascript
625
+ ```ts snippet:retrieveFile
626
+ import {
627
+ isOutputOfType,
628
+ MessageTextContentOutput,
629
+ MessageImageFileContentOutput,
630
+ } from "../src/index.js";
631
+
552
632
  const messages = await client.agents.listMessages(thread.id);
633
+ // Get most recent message from the assistant
634
+ const assistantMessage = messages.data.find((msg) => msg.role === "assistant");
635
+ if (assistantMessage) {
636
+ const textContent = assistantMessage.content.find((content) =>
637
+ isOutputOfType<MessageTextContentOutput>(content, "text"),
638
+ ) as MessageTextContentOutput;
639
+ if (textContent) {
640
+ console.log(`Last message: ${textContent.text.value}`);
641
+ }
642
+ }
553
643
  const imageFile = (messages.data[0].content[0] as MessageImageFileContentOutput).imageFile;
554
644
  const imageFileName = (await client.agents.getFile(imageFile.fileId)).filename;
555
-
556
- const fileContent = await (await client.agents.getFileContent(imageFile.fileId).asNodeStream()).body;
645
+ const fileContent = await (
646
+ await client.agents.getFileContent(imageFile.fileId).asNodeStream()
647
+ ).body;
557
648
  if (fileContent) {
558
649
  const chunks: Buffer[] = [];
559
650
  for await (const chunk of fileContent) {
@@ -571,13 +662,11 @@ console.log(`Saved image file to: ${imageFileName}`);
571
662
 
572
663
  To remove resources after completing tasks, use the following functions:
573
664
 
574
- ```javascript
665
+ ```ts snippet:teardown
575
666
  await client.agents.deleteVectorStore(vectorStore.id);
576
667
  console.log(`Deleted vector store, vector store ID: ${vectorStore.id}`);
577
-
578
668
  await client.agents.deleteFile(file.id);
579
669
  console.log(`Deleted file, file ID: ${file.id}`);
580
-
581
670
  client.agents.deleteAgent(agent.id);
582
671
  console.log(`Deleted agent, agent ID: ${agent.id}`);
583
672
  ```
@@ -611,39 +700,34 @@ npm install @opentelemetry/exporter-trace-otlp-proto \
611
700
 
612
701
  Here is a code sample to be included above `createAgent`:
613
702
 
614
- ```javascript
615
- import { trace } from "@opentelemetry/api";
616
- import { AzureMonitorTraceExporter } from "@azure/monitor-opentelemetry-exporter"
703
+ ```ts snippet:tracing
617
704
  import {
618
- ConsoleSpanExporter,
619
- NodeTracerProvider,
620
- SimpleSpanProcessor,
705
+ NodeTracerProvider,
706
+ SimpleSpanProcessor,
707
+ ConsoleSpanExporter,
621
708
  } from "@opentelemetry/sdk-trace-node";
709
+ import { trace } from "@opentelemetry/api";
710
+ import { AzureMonitorTraceExporter } from "@azure/monitor-opentelemetry-exporter";
622
711
 
623
712
  const provider = new NodeTracerProvider();
624
713
  provider.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter()));
625
714
  provider.register();
626
-
627
715
  const tracer = trace.getTracer("Agents Sample", "1.0.0");
628
-
629
- const client = AIProjectsClient.fromConnectionString(
630
- connectionString || "", new DefaultAzureCredential()
631
- );
632
-
633
- if (!appInsightsConnectionString) {
716
+ let appInsightsConnectionString =
717
+ process.env.APP_INSIGHTS_CONNECTION_STRING ?? "<appInsightsConnectionString>";
718
+ if (appInsightsConnectionString == "<appInsightsConnectionString>") {
634
719
  appInsightsConnectionString = await client.telemetry.getConnectionString();
635
720
  }
636
-
637
721
  if (appInsightsConnectionString) {
638
722
  const exporter = new AzureMonitorTraceExporter({
639
- connectionString: appInsightsConnectionString
723
+ connectionString: appInsightsConnectionString,
640
724
  });
641
725
  provider.addSpanProcessor(new SimpleSpanProcessor(exporter));
642
726
  }
643
-
644
727
  await tracer.startActiveSpan("main", async (span) => {
645
- client.telemetry.updateSettings({enableContentRecording: true})
646
- // ...
728
+ client.telemetry.updateSettings({ enableContentRecording: true });
729
+ // ...
730
+ });
647
731
  ```
648
732
 
649
733
  ## Troubleshooting
@@ -652,16 +736,18 @@ await tracer.startActiveSpan("main", async (span) => {
652
736
 
653
737
  Client methods that make service calls raise an [RestError](https://learn.microsoft.com/javascript/api/%40azure/core-rest-pipeline/resterror) for a non-success HTTP status code response from the service. The exception's `code` will hold the HTTP response status code. The exception's `error.message` contains a detailed message that may be helpful in diagnosing the issue:
654
738
 
655
- ```javascript
656
- import { RestError } from "@azure/core-rest-pipeline"
657
-
658
- // ...
739
+ ```ts snippet:exceptions
740
+ import { RestError } from "@azure/core-rest-pipeline";
659
741
 
660
742
  try {
661
743
  const result = await client.connections.listConnections();
662
- } catch (e as RestError) {
663
- console.log(`Status code: ${e.code}`);
664
- console.log(e.message);
744
+ } catch (e) {
745
+ if (e instanceof RestError) {
746
+ console.log(`Status code: ${e.code}`);
747
+ console.log(e.message);
748
+ } else {
749
+ console.error(e);
750
+ }
665
751
  }
666
752
  ```
667
753
 
@@ -676,9 +762,9 @@ Operation returned an invalid status 'Unauthorized'
676
762
 
677
763
  To report issues with the client library, or request additional features, please open a GitHub issue [here](https://github.com/Azure/azure-sdk-for-js/issues)
678
764
 
679
- <!-- ## Next steps
765
+ ## Next steps
680
766
 
681
- Have a look at the [Samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/ai/ai-projects/samples) folder, containing fully runnable code. -->
767
+ Have a look at the [package samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/ai/ai-projects/samples) folder, containing fully runnable code.
682
768
 
683
769
  ## Contributing
684
770
 
@@ -699,8 +785,6 @@ additional questions or comments.
699
785
 
700
786
  <!-- LINKS -->
701
787
 
702
- <!-- [samples]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/ai/ai-projects/samples -->
703
-
704
788
  [code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
705
789
  [entra_id]: https://learn.microsoft.com/azure/ai-services/authentication?tabs=powershell#authenticate-with-microsoft-entra-id
706
790
  [azure_identity_npm]: https://www.npmjs.com/package/@azure/identity