llama-stack-client 0.4.3-rc3 → 0.4.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 (810) hide show
  1. package/.devcontainer/devcontainer.json +15 -0
  2. package/.eslintrc.js +16 -0
  3. package/.github/workflows/ci.yml +88 -0
  4. package/.github/workflows/integration-tests.yml +133 -0
  5. package/.github/workflows/release-doctor.yml +19 -0
  6. package/.gitignore +12 -0
  7. package/.prettierignore +7 -0
  8. package/.prettierrc.json +7 -0
  9. package/.release-please-manifest.json +3 -0
  10. package/.stats.yml +4 -0
  11. package/Brewfile +1 -0
  12. package/CODE_OF_CONDUCT.md +80 -0
  13. package/CONTRIBUTING.md +98 -0
  14. package/README.md +22 -31
  15. package/SECURITY.md +27 -0
  16. package/api.md +484 -0
  17. package/bin/check-release-environment +18 -0
  18. package/bin/publish-npm +61 -0
  19. package/dist/CHANGELOG.md +352 -0
  20. package/dist/LICENSE +7 -0
  21. package/dist/README.md +355 -0
  22. package/{index.d.mts → dist/index.d.mts} +6 -12
  23. package/{index.d.ts → dist/index.d.ts} +6 -12
  24. package/{index.d.ts.map → dist/index.d.ts.map} +1 -1
  25. package/{index.js.map → dist/index.js.map} +1 -1
  26. package/dist/index.mjs.map +1 -0
  27. package/dist/package.json +108 -0
  28. package/{resources → dist/resources}/alpha/alpha.d.ts +2 -6
  29. package/dist/resources/alpha/alpha.d.ts.map +1 -0
  30. package/{resources → dist/resources}/alpha/alpha.js +0 -4
  31. package/dist/resources/alpha/alpha.js.map +1 -0
  32. package/{resources → dist/resources}/alpha/alpha.mjs +0 -4
  33. package/dist/resources/alpha/alpha.mjs.map +1 -0
  34. package/{resources → dist/resources}/alpha/benchmarks.d.ts +1 -37
  35. package/dist/resources/alpha/benchmarks.d.ts.map +1 -0
  36. package/{resources → dist/resources}/alpha/index.d.ts +1 -2
  37. package/dist/resources/alpha/index.d.ts.map +1 -0
  38. package/{resources → dist/resources}/alpha/index.js +1 -3
  39. package/dist/resources/alpha/index.js.map +1 -0
  40. package/{resources → dist/resources}/alpha/index.mjs +0 -1
  41. package/{resources → dist/resources}/alpha/index.mjs.map +1 -1
  42. package/dist/resources/alpha/post-training/index.d.ts +3 -0
  43. package/dist/resources/alpha/post-training/index.d.ts.map +1 -0
  44. package/{resources → dist/resources}/alpha/post-training/index.js.map +1 -1
  45. package/{resources → dist/resources}/alpha/post-training/index.mjs.map +1 -1
  46. package/{resources → dist/resources}/alpha/post-training/job.d.ts +4 -1
  47. package/dist/resources/alpha/post-training/job.d.ts.map +1 -0
  48. package/{resources → dist/resources}/alpha/post-training/post-training.d.ts +3 -6
  49. package/dist/resources/alpha/post-training/post-training.d.ts.map +1 -0
  50. package/{resources → dist/resources}/alpha/post-training/post-training.js.map +1 -1
  51. package/{resources → dist/resources}/alpha/post-training/post-training.mjs.map +1 -1
  52. package/{resources → dist/resources}/beta/datasets.d.ts +8 -89
  53. package/dist/resources/beta/datasets.d.ts.map +1 -0
  54. package/{resources → dist/resources}/chat/chat.d.ts +2 -2
  55. package/{resources → dist/resources}/chat/chat.d.ts.map +1 -1
  56. package/{resources → dist/resources}/chat/completions.d.ts +6 -6
  57. package/dist/resources/chat/completions.d.ts.map +1 -0
  58. package/{resources → dist/resources}/completions.d.ts +2 -2
  59. package/dist/resources/completions.d.ts.map +1 -0
  60. package/{resources → dist/resources}/conversations/conversations.d.ts +4 -32
  61. package/dist/resources/conversations/conversations.d.ts.map +1 -0
  62. package/{resources → dist/resources}/conversations/conversations.js.map +1 -1
  63. package/{resources → dist/resources}/conversations/conversations.mjs.map +1 -1
  64. package/{resources → dist/resources}/conversations/items.d.ts +12 -124
  65. package/dist/resources/conversations/items.d.ts.map +1 -0
  66. package/{resources → dist/resources}/conversations/items.js.map +1 -1
  67. package/{resources → dist/resources}/conversations/items.mjs.map +1 -1
  68. package/{resources → dist/resources}/index.d.ts +3 -3
  69. package/dist/resources/index.d.ts.map +1 -0
  70. package/{resources → dist/resources}/index.js.map +1 -1
  71. package/{resources → dist/resources}/index.mjs.map +1 -1
  72. package/dist/resources/inspect.d.ts +56 -0
  73. package/dist/resources/inspect.d.ts.map +1 -0
  74. package/{resources → dist/resources}/inspect.js +4 -0
  75. package/dist/resources/inspect.js.map +1 -0
  76. package/{resources → dist/resources}/inspect.mjs +4 -0
  77. package/dist/resources/inspect.mjs.map +1 -0
  78. package/dist/resources/providers.d.ts +28 -0
  79. package/dist/resources/providers.d.ts.map +1 -0
  80. package/{resources → dist/resources}/providers.js +4 -0
  81. package/dist/resources/providers.js.map +1 -0
  82. package/{resources → dist/resources}/providers.mjs +4 -0
  83. package/dist/resources/providers.mjs.map +1 -0
  84. package/{resources → dist/resources}/responses/input-items.d.ts +8 -64
  85. package/dist/resources/responses/input-items.d.ts.map +1 -0
  86. package/{resources → dist/resources}/responses/responses.d.ts +31 -479
  87. package/dist/resources/responses/responses.d.ts.map +1 -0
  88. package/{resources → dist/resources}/responses/responses.js.map +1 -1
  89. package/{resources → dist/resources}/responses/responses.mjs.map +1 -1
  90. package/dist/resources/routes.d.ts +26 -0
  91. package/dist/resources/routes.d.ts.map +1 -0
  92. package/{resources → dist/resources}/routes.js.map +1 -1
  93. package/{resources → dist/resources}/routes.mjs.map +1 -1
  94. package/{resources → dist/resources}/shared.d.ts +0 -86
  95. package/dist/resources/shared.d.ts.map +1 -0
  96. package/dist/src/_shims/MultipartBody.ts +15 -0
  97. package/dist/src/_shims/README.md +46 -0
  98. package/dist/src/_shims/auto/runtime-bun.ts +10 -0
  99. package/dist/src/_shims/auto/runtime-node.ts +10 -0
  100. package/dist/src/_shims/auto/runtime.ts +10 -0
  101. package/dist/src/_shims/auto/types-node.ts +10 -0
  102. package/dist/src/_shims/auto/types.d.ts +107 -0
  103. package/dist/src/_shims/auto/types.js +9 -0
  104. package/dist/src/_shims/auto/types.mjs +10 -0
  105. package/dist/src/_shims/bun-runtime.ts +20 -0
  106. package/dist/src/_shims/index.d.ts +89 -0
  107. package/dist/src/_shims/index.js +23 -0
  108. package/dist/src/_shims/index.mjs +18 -0
  109. package/dist/src/_shims/manual-types.d.ts +18 -0
  110. package/dist/src/_shims/manual-types.js +9 -0
  111. package/dist/src/_shims/manual-types.mjs +10 -0
  112. package/dist/src/_shims/node-runtime.ts +87 -0
  113. package/dist/src/_shims/node-types.d.ts +48 -0
  114. package/dist/src/_shims/node-types.js +9 -0
  115. package/dist/src/_shims/node-types.mjs +10 -0
  116. package/dist/src/_shims/registry.ts +73 -0
  117. package/dist/src/_shims/web-runtime.ts +109 -0
  118. package/dist/src/_shims/web-types.d.ts +89 -0
  119. package/dist/src/_shims/web-types.js +9 -0
  120. package/dist/src/_shims/web-types.mjs +10 -0
  121. package/dist/src/core.ts +1259 -0
  122. package/dist/src/error.ts +137 -0
  123. package/dist/src/index.ts +591 -0
  124. package/dist/src/internal/decoders/line.ts +182 -0
  125. package/dist/src/internal/qs/LICENSE.md +13 -0
  126. package/dist/src/internal/qs/README.md +3 -0
  127. package/dist/src/internal/qs/formats.ts +15 -0
  128. package/dist/src/internal/qs/index.ts +19 -0
  129. package/dist/src/internal/qs/stringify.ts +394 -0
  130. package/dist/src/internal/qs/types.ts +77 -0
  131. package/dist/src/internal/qs/utils.ts +271 -0
  132. package/dist/src/internal/stream-utils.ts +38 -0
  133. package/dist/src/lib/.keep +4 -0
  134. package/dist/src/lib/response-helpers.ts +60 -0
  135. package/dist/src/pagination.ts +134 -0
  136. package/dist/src/resource.ts +18 -0
  137. package/dist/src/resources/alpha/alpha.ts +85 -0
  138. package/dist/src/resources/alpha/benchmarks.ts +116 -0
  139. package/dist/src/resources/alpha/eval/eval.ts +234 -0
  140. package/dist/src/resources/alpha/eval/index.ts +19 -0
  141. package/dist/src/resources/alpha/eval/jobs.ts +41 -0
  142. package/dist/src/resources/alpha/eval.ts +10 -0
  143. package/dist/src/resources/alpha/index.ts +34 -0
  144. package/dist/src/resources/alpha/inference.ts +132 -0
  145. package/dist/src/resources/alpha/post-training/index.ts +25 -0
  146. package/dist/src/resources/alpha/post-training/job.ts +182 -0
  147. package/dist/src/resources/alpha/post-training/post-training.ts +369 -0
  148. package/dist/src/resources/alpha/post-training.ts +9 -0
  149. package/dist/src/resources/alpha.ts +9 -0
  150. package/dist/src/resources/batches.ts +572 -0
  151. package/dist/src/resources/beta/beta.ts +41 -0
  152. package/dist/src/resources/beta/datasets.ts +350 -0
  153. package/dist/src/resources/beta/index.ts +20 -0
  154. package/dist/src/resources/beta.ts +9 -0
  155. package/dist/src/resources/chat/chat.ts +246 -0
  156. package/dist/src/resources/chat/completions.ts +1875 -0
  157. package/dist/src/resources/chat/index.ts +19 -0
  158. package/dist/src/resources/chat.ts +9 -0
  159. package/dist/src/resources/completions.ts +235 -0
  160. package/dist/src/resources/conversations/conversations.ts +455 -0
  161. package/dist/src/resources/conversations/index.ts +25 -0
  162. package/dist/src/resources/conversations/items.ts +1221 -0
  163. package/dist/src/resources/conversations.ts +9 -0
  164. package/dist/src/resources/embeddings.ts +84 -0
  165. package/dist/src/resources/files.ts +184 -0
  166. package/dist/src/resources/index.ts +139 -0
  167. package/dist/src/resources/inspect.ts +81 -0
  168. package/dist/src/resources/models/index.ts +18 -0
  169. package/dist/src/resources/models/models.ts +179 -0
  170. package/dist/src/resources/models/openai.ts +22 -0
  171. package/dist/src/resources/models.ts +9 -0
  172. package/dist/src/resources/moderations.ts +61 -0
  173. package/dist/src/resources/prompts/index.ts +19 -0
  174. package/dist/src/resources/prompts/prompts.ts +171 -0
  175. package/dist/src/resources/prompts/versions.ts +26 -0
  176. package/dist/src/resources/prompts.ts +9 -0
  177. package/dist/src/resources/providers.ts +49 -0
  178. package/dist/src/resources/responses/index.ts +21 -0
  179. package/dist/src/resources/responses/input-items.ts +508 -0
  180. package/dist/src/resources/responses/responses.ts +3689 -0
  181. package/dist/src/resources/responses.ts +9 -0
  182. package/dist/src/resources/routes.ts +56 -0
  183. package/dist/src/resources/safety.ts +241 -0
  184. package/dist/src/resources/scoring-functions.ts +343 -0
  185. package/dist/src/resources/scoring.ts +197 -0
  186. package/dist/src/resources/shared.ts +418 -0
  187. package/dist/src/resources/shields.ts +98 -0
  188. package/dist/src/resources/tool-runtime.ts +217 -0
  189. package/dist/src/resources/toolgroups.ts +135 -0
  190. package/dist/src/resources/tools.ts +52 -0
  191. package/dist/src/resources/vector-io.ts +468 -0
  192. package/dist/src/resources/vector-stores/file-batches.ts +201 -0
  193. package/dist/src/resources/vector-stores/files.ts +358 -0
  194. package/dist/src/resources/vector-stores/index.ts +38 -0
  195. package/dist/src/resources/vector-stores/vector-stores.ts +402 -0
  196. package/dist/src/resources/vector-stores.ts +9 -0
  197. package/dist/src/resources.ts +7 -0
  198. package/dist/src/shims/node.ts +56 -0
  199. package/dist/src/shims/web.ts +56 -0
  200. package/dist/src/streaming.ts +297 -0
  201. package/dist/src/uploads.ts +261 -0
  202. package/dist/src/version.ts +7 -0
  203. package/dist/version.d.ts +2 -0
  204. package/dist/version.d.ts.map +1 -0
  205. package/{version.js → dist/version.js} +1 -1
  206. package/{version.js.map → dist/version.js.map} +1 -1
  207. package/dist/version.mjs +7 -0
  208. package/{version.mjs.map → dist/version.mjs.map} +1 -1
  209. package/examples/.keep +4 -0
  210. package/jest.config.ts +29 -0
  211. package/package.json +55 -35
  212. package/release-please-config.json +64 -0
  213. package/scripts/bootstrap +30 -0
  214. package/scripts/build +56 -0
  215. package/scripts/fast-format +40 -0
  216. package/scripts/format +8 -0
  217. package/scripts/lint +11 -0
  218. package/scripts/mock +41 -0
  219. package/scripts/test +56 -0
  220. package/scripts/utils/check-is-in-git-install.sh +15 -0
  221. package/scripts/utils/check-version.cjs +27 -0
  222. package/scripts/utils/fix-index-exports.cjs +21 -0
  223. package/scripts/utils/git-swap.sh +19 -0
  224. package/scripts/utils/make-dist-package-json.cjs +28 -0
  225. package/scripts/utils/postprocess-files.cjs +172 -0
  226. package/scripts/utils/upload-artifact.sh +33 -0
  227. package/src/_shims/auto/runtime-deno.ts +10 -0
  228. package/src/_shims/auto/types-deno.ts +10 -0
  229. package/src/_shims/auto/types.d.ts +18 -18
  230. package/src/_shims/index-deno.ts +118 -0
  231. package/src/_shims/index.d.ts +1 -1
  232. package/src/_shims/index.mjs +1 -1
  233. package/src/index.ts +16 -11
  234. package/src/resources/alpha/alpha.ts +0 -8
  235. package/src/resources/alpha/benchmarks.ts +1 -37
  236. package/src/resources/alpha/index.ts +0 -2
  237. package/src/resources/alpha/post-training/index.ts +1 -1
  238. package/src/resources/alpha/post-training/job.ts +5 -0
  239. package/src/resources/alpha/post-training/post-training.ts +2 -5
  240. package/src/resources/beta/datasets.ts +8 -89
  241. package/src/resources/chat/chat.ts +4 -4
  242. package/src/resources/chat/completions.ts +12 -12
  243. package/src/resources/completions.ts +4 -4
  244. package/src/resources/conversations/conversations.ts +7 -43
  245. package/src/resources/conversations/items.ts +21 -165
  246. package/src/resources/index.ts +3 -3
  247. package/src/resources/inspect.ts +57 -3
  248. package/src/resources/providers.ts +16 -5
  249. package/src/resources/responses/input-items.ts +14 -86
  250. package/src/resources/responses/responses.ts +45 -654
  251. package/src/resources/routes.ts +14 -10
  252. package/src/resources/shared.ts +0 -95
  253. package/src/version.ts +1 -1
  254. package/tests/api-resources/alpha/benchmarks.test.ts +94 -0
  255. package/tests/api-resources/alpha/eval/eval.test.ts +186 -0
  256. package/tests/api-resources/alpha/eval/jobs.test.ts +68 -0
  257. package/tests/api-resources/alpha/inference.test.ts +38 -0
  258. package/tests/api-resources/alpha/post-training/job.test.ts +77 -0
  259. package/tests/api-resources/alpha/post-training/post-training.test.ts +124 -0
  260. package/tests/api-resources/batches.test.ts +100 -0
  261. package/tests/api-resources/beta/datasets.test.ts +135 -0
  262. package/tests/api-resources/chat/completions.test.ts +102 -0
  263. package/tests/api-resources/completions.test.ts +48 -0
  264. package/tests/api-resources/conversations/conversations.test.ts +76 -0
  265. package/tests/api-resources/conversations/items.test.ts +98 -0
  266. package/tests/api-resources/embeddings.test.ts +35 -0
  267. package/tests/api-resources/files.test.ts +118 -0
  268. package/tests/api-resources/inspect.test.ts +50 -0
  269. package/tests/api-resources/models/models.test.ts +89 -0
  270. package/tests/api-resources/models/openai.test.ts +32 -0
  271. package/tests/api-resources/moderations.test.ts +29 -0
  272. package/tests/api-resources/prompts/prompts.test.ts +125 -0
  273. package/tests/api-resources/prompts/versions.test.ts +32 -0
  274. package/tests/api-resources/providers.test.ts +50 -0
  275. package/tests/api-resources/responses/input-items.test.ts +43 -0
  276. package/tests/api-resources/responses/responses.test.ts +118 -0
  277. package/tests/api-resources/routes.test.ts +39 -0
  278. package/tests/api-resources/safety.test.ts +37 -0
  279. package/tests/api-resources/scoring-functions.test.ts +100 -0
  280. package/tests/api-resources/scoring.test.ts +73 -0
  281. package/tests/api-resources/shields.test.ts +88 -0
  282. package/tests/api-resources/tool-runtime.test.ts +61 -0
  283. package/tests/api-resources/toolgroups.test.ts +91 -0
  284. package/tests/api-resources/tools.test.ts +57 -0
  285. package/tests/api-resources/vector-io.test.ts +75 -0
  286. package/tests/api-resources/vector-stores/file-batches.test.ts +107 -0
  287. package/tests/api-resources/vector-stores/files.test.ts +147 -0
  288. package/tests/api-resources/vector-stores/vector-stores.test.ts +122 -0
  289. package/tests/form.test.ts +71 -0
  290. package/tests/index.test.ts +438 -0
  291. package/tests/internal/decoders/line.test.ts +134 -0
  292. package/tests/qs/empty-keys-cases.ts +277 -0
  293. package/tests/qs/stringify.test.ts +2238 -0
  294. package/tests/qs/utils.test.ts +175 -0
  295. package/tests/responses.test.ts +91 -0
  296. package/tests/streaming.test.ts +250 -0
  297. package/tests/stringifyQuery.test.ts +29 -0
  298. package/tests/uploads.test.ts +71 -0
  299. package/tsc-multi.json +7 -0
  300. package/tsconfig.build.json +18 -0
  301. package/tsconfig.deno.json +15 -0
  302. package/tsconfig.dist-src.json +11 -0
  303. package/tsconfig.json +38 -0
  304. package/index.mjs.map +0 -1
  305. package/resources/alpha/admin.d.ts +0 -41
  306. package/resources/alpha/admin.d.ts.map +0 -1
  307. package/resources/alpha/admin.js +0 -46
  308. package/resources/alpha/admin.js.map +0 -1
  309. package/resources/alpha/admin.mjs +0 -42
  310. package/resources/alpha/admin.mjs.map +0 -1
  311. package/resources/alpha/alpha.d.ts.map +0 -1
  312. package/resources/alpha/alpha.js.map +0 -1
  313. package/resources/alpha/alpha.mjs.map +0 -1
  314. package/resources/alpha/benchmarks.d.ts.map +0 -1
  315. package/resources/alpha/index.d.ts.map +0 -1
  316. package/resources/alpha/index.js.map +0 -1
  317. package/resources/alpha/post-training/index.d.ts +0 -3
  318. package/resources/alpha/post-training/index.d.ts.map +0 -1
  319. package/resources/alpha/post-training/job.d.ts.map +0 -1
  320. package/resources/alpha/post-training/post-training.d.ts.map +0 -1
  321. package/resources/beta/datasets.d.ts.map +0 -1
  322. package/resources/chat/completions.d.ts.map +0 -1
  323. package/resources/completions.d.ts.map +0 -1
  324. package/resources/conversations/conversations.d.ts.map +0 -1
  325. package/resources/conversations/items.d.ts.map +0 -1
  326. package/resources/index.d.ts.map +0 -1
  327. package/resources/inspect.d.ts +0 -14
  328. package/resources/inspect.d.ts.map +0 -1
  329. package/resources/inspect.js.map +0 -1
  330. package/resources/inspect.mjs.map +0 -1
  331. package/resources/providers.d.ts +0 -21
  332. package/resources/providers.d.ts.map +0 -1
  333. package/resources/providers.js.map +0 -1
  334. package/resources/providers.mjs.map +0 -1
  335. package/resources/responses/input-items.d.ts.map +0 -1
  336. package/resources/responses/responses.d.ts.map +0 -1
  337. package/resources/routes.d.ts +0 -27
  338. package/resources/routes.d.ts.map +0 -1
  339. package/resources/shared.d.ts.map +0 -1
  340. package/src/resources/alpha/admin.ts +0 -84
  341. package/version.d.ts +0 -2
  342. package/version.d.ts.map +0 -1
  343. package/version.mjs +0 -7
  344. /package/{_shims → dist/_shims}/MultipartBody.d.ts +0 -0
  345. /package/{_shims → dist/_shims}/MultipartBody.d.ts.map +0 -0
  346. /package/{_shims → dist/_shims}/MultipartBody.js +0 -0
  347. /package/{_shims → dist/_shims}/MultipartBody.js.map +0 -0
  348. /package/{_shims → dist/_shims}/MultipartBody.mjs +0 -0
  349. /package/{_shims → dist/_shims}/MultipartBody.mjs.map +0 -0
  350. /package/{_shims → dist/_shims}/README.md +0 -0
  351. /package/{_shims → dist/_shims}/auto/runtime-bun.d.ts +0 -0
  352. /package/{_shims → dist/_shims}/auto/runtime-bun.d.ts.map +0 -0
  353. /package/{_shims → dist/_shims}/auto/runtime-bun.js +0 -0
  354. /package/{_shims → dist/_shims}/auto/runtime-bun.js.map +0 -0
  355. /package/{_shims → dist/_shims}/auto/runtime-bun.mjs +0 -0
  356. /package/{_shims → dist/_shims}/auto/runtime-bun.mjs.map +0 -0
  357. /package/{_shims → dist/_shims}/auto/runtime-node.d.ts +0 -0
  358. /package/{_shims → dist/_shims}/auto/runtime-node.d.ts.map +0 -0
  359. /package/{_shims → dist/_shims}/auto/runtime-node.js +0 -0
  360. /package/{_shims → dist/_shims}/auto/runtime-node.js.map +0 -0
  361. /package/{_shims → dist/_shims}/auto/runtime-node.mjs +0 -0
  362. /package/{_shims → dist/_shims}/auto/runtime-node.mjs.map +0 -0
  363. /package/{_shims → dist/_shims}/auto/runtime.d.ts +0 -0
  364. /package/{_shims → dist/_shims}/auto/runtime.d.ts.map +0 -0
  365. /package/{_shims → dist/_shims}/auto/runtime.js +0 -0
  366. /package/{_shims → dist/_shims}/auto/runtime.js.map +0 -0
  367. /package/{_shims → dist/_shims}/auto/runtime.mjs +0 -0
  368. /package/{_shims → dist/_shims}/auto/runtime.mjs.map +0 -0
  369. /package/{_shims → dist/_shims}/auto/types-node.d.ts +0 -0
  370. /package/{_shims → dist/_shims}/auto/types-node.d.ts.map +0 -0
  371. /package/{_shims → dist/_shims}/auto/types-node.js +0 -0
  372. /package/{_shims → dist/_shims}/auto/types-node.js.map +0 -0
  373. /package/{_shims → dist/_shims}/auto/types-node.mjs +0 -0
  374. /package/{_shims → dist/_shims}/auto/types-node.mjs.map +0 -0
  375. /package/{_shims → dist/_shims}/auto/types.d.ts +0 -0
  376. /package/{_shims → dist/_shims}/auto/types.js +0 -0
  377. /package/{_shims → dist/_shims}/auto/types.mjs +0 -0
  378. /package/{_shims → dist/_shims}/bun-runtime.d.ts +0 -0
  379. /package/{_shims → dist/_shims}/bun-runtime.d.ts.map +0 -0
  380. /package/{_shims → dist/_shims}/bun-runtime.js +0 -0
  381. /package/{_shims → dist/_shims}/bun-runtime.js.map +0 -0
  382. /package/{_shims → dist/_shims}/bun-runtime.mjs +0 -0
  383. /package/{_shims → dist/_shims}/bun-runtime.mjs.map +0 -0
  384. /package/{_shims → dist/_shims}/index.d.ts +0 -0
  385. /package/{_shims → dist/_shims}/index.js +0 -0
  386. /package/{_shims → dist/_shims}/index.mjs +0 -0
  387. /package/{_shims → dist/_shims}/manual-types.d.ts +0 -0
  388. /package/{_shims → dist/_shims}/manual-types.js +0 -0
  389. /package/{_shims → dist/_shims}/manual-types.mjs +0 -0
  390. /package/{_shims → dist/_shims}/node-runtime.d.ts +0 -0
  391. /package/{_shims → dist/_shims}/node-runtime.d.ts.map +0 -0
  392. /package/{_shims → dist/_shims}/node-runtime.js +0 -0
  393. /package/{_shims → dist/_shims}/node-runtime.js.map +0 -0
  394. /package/{_shims → dist/_shims}/node-runtime.mjs +0 -0
  395. /package/{_shims → dist/_shims}/node-runtime.mjs.map +0 -0
  396. /package/{_shims → dist/_shims}/node-types.d.ts +0 -0
  397. /package/{_shims → dist/_shims}/node-types.js +0 -0
  398. /package/{_shims → dist/_shims}/node-types.mjs +0 -0
  399. /package/{_shims → dist/_shims}/registry.d.ts +0 -0
  400. /package/{_shims → dist/_shims}/registry.d.ts.map +0 -0
  401. /package/{_shims → dist/_shims}/registry.js +0 -0
  402. /package/{_shims → dist/_shims}/registry.js.map +0 -0
  403. /package/{_shims → dist/_shims}/registry.mjs +0 -0
  404. /package/{_shims → dist/_shims}/registry.mjs.map +0 -0
  405. /package/{_shims → dist/_shims}/web-runtime.d.ts +0 -0
  406. /package/{_shims → dist/_shims}/web-runtime.d.ts.map +0 -0
  407. /package/{_shims → dist/_shims}/web-runtime.js +0 -0
  408. /package/{_shims → dist/_shims}/web-runtime.js.map +0 -0
  409. /package/{_shims → dist/_shims}/web-runtime.mjs +0 -0
  410. /package/{_shims → dist/_shims}/web-runtime.mjs.map +0 -0
  411. /package/{_shims → dist/_shims}/web-types.d.ts +0 -0
  412. /package/{_shims → dist/_shims}/web-types.js +0 -0
  413. /package/{_shims → dist/_shims}/web-types.mjs +0 -0
  414. /package/{core.d.ts → dist/core.d.ts} +0 -0
  415. /package/{core.d.ts.map → dist/core.d.ts.map} +0 -0
  416. /package/{core.js → dist/core.js} +0 -0
  417. /package/{core.js.map → dist/core.js.map} +0 -0
  418. /package/{core.mjs → dist/core.mjs} +0 -0
  419. /package/{core.mjs.map → dist/core.mjs.map} +0 -0
  420. /package/{error.d.ts → dist/error.d.ts} +0 -0
  421. /package/{error.d.ts.map → dist/error.d.ts.map} +0 -0
  422. /package/{error.js → dist/error.js} +0 -0
  423. /package/{error.js.map → dist/error.js.map} +0 -0
  424. /package/{error.mjs → dist/error.mjs} +0 -0
  425. /package/{error.mjs.map → dist/error.mjs.map} +0 -0
  426. /package/{index.js → dist/index.js} +0 -0
  427. /package/{index.mjs → dist/index.mjs} +0 -0
  428. /package/{internal → dist/internal}/decoders/line.d.ts +0 -0
  429. /package/{internal → dist/internal}/decoders/line.d.ts.map +0 -0
  430. /package/{internal → dist/internal}/decoders/line.js +0 -0
  431. /package/{internal → dist/internal}/decoders/line.js.map +0 -0
  432. /package/{internal → dist/internal}/decoders/line.mjs +0 -0
  433. /package/{internal → dist/internal}/decoders/line.mjs.map +0 -0
  434. /package/{internal → dist/internal}/qs/formats.d.ts +0 -0
  435. /package/{internal → dist/internal}/qs/formats.d.ts.map +0 -0
  436. /package/{internal → dist/internal}/qs/formats.js +0 -0
  437. /package/{internal → dist/internal}/qs/formats.js.map +0 -0
  438. /package/{internal → dist/internal}/qs/formats.mjs +0 -0
  439. /package/{internal → dist/internal}/qs/formats.mjs.map +0 -0
  440. /package/{internal → dist/internal}/qs/index.d.ts +0 -0
  441. /package/{internal → dist/internal}/qs/index.d.ts.map +0 -0
  442. /package/{internal → dist/internal}/qs/index.js +0 -0
  443. /package/{internal → dist/internal}/qs/index.js.map +0 -0
  444. /package/{internal → dist/internal}/qs/index.mjs +0 -0
  445. /package/{internal → dist/internal}/qs/index.mjs.map +0 -0
  446. /package/{internal → dist/internal}/qs/stringify.d.ts +0 -0
  447. /package/{internal → dist/internal}/qs/stringify.d.ts.map +0 -0
  448. /package/{internal → dist/internal}/qs/stringify.js +0 -0
  449. /package/{internal → dist/internal}/qs/stringify.js.map +0 -0
  450. /package/{internal → dist/internal}/qs/stringify.mjs +0 -0
  451. /package/{internal → dist/internal}/qs/stringify.mjs.map +0 -0
  452. /package/{internal → dist/internal}/qs/types.d.ts +0 -0
  453. /package/{internal → dist/internal}/qs/types.d.ts.map +0 -0
  454. /package/{internal → dist/internal}/qs/types.js +0 -0
  455. /package/{internal → dist/internal}/qs/types.js.map +0 -0
  456. /package/{internal → dist/internal}/qs/types.mjs +0 -0
  457. /package/{internal → dist/internal}/qs/types.mjs.map +0 -0
  458. /package/{internal → dist/internal}/qs/utils.d.ts +0 -0
  459. /package/{internal → dist/internal}/qs/utils.d.ts.map +0 -0
  460. /package/{internal → dist/internal}/qs/utils.js +0 -0
  461. /package/{internal → dist/internal}/qs/utils.js.map +0 -0
  462. /package/{internal → dist/internal}/qs/utils.mjs +0 -0
  463. /package/{internal → dist/internal}/qs/utils.mjs.map +0 -0
  464. /package/{internal → dist/internal}/stream-utils.d.ts +0 -0
  465. /package/{internal → dist/internal}/stream-utils.d.ts.map +0 -0
  466. /package/{internal → dist/internal}/stream-utils.js +0 -0
  467. /package/{internal → dist/internal}/stream-utils.js.map +0 -0
  468. /package/{internal → dist/internal}/stream-utils.mjs +0 -0
  469. /package/{internal → dist/internal}/stream-utils.mjs.map +0 -0
  470. /package/{lib → dist/lib}/response-helpers.d.ts +0 -0
  471. /package/{lib → dist/lib}/response-helpers.d.ts.map +0 -0
  472. /package/{lib → dist/lib}/response-helpers.js +0 -0
  473. /package/{lib → dist/lib}/response-helpers.js.map +0 -0
  474. /package/{lib → dist/lib}/response-helpers.mjs +0 -0
  475. /package/{lib → dist/lib}/response-helpers.mjs.map +0 -0
  476. /package/{pagination.d.ts → dist/pagination.d.ts} +0 -0
  477. /package/{pagination.d.ts.map → dist/pagination.d.ts.map} +0 -0
  478. /package/{pagination.js → dist/pagination.js} +0 -0
  479. /package/{pagination.js.map → dist/pagination.js.map} +0 -0
  480. /package/{pagination.mjs → dist/pagination.mjs} +0 -0
  481. /package/{pagination.mjs.map → dist/pagination.mjs.map} +0 -0
  482. /package/{resource.d.ts → dist/resource.d.ts} +0 -0
  483. /package/{resource.d.ts.map → dist/resource.d.ts.map} +0 -0
  484. /package/{resource.js → dist/resource.js} +0 -0
  485. /package/{resource.js.map → dist/resource.js.map} +0 -0
  486. /package/{resource.mjs → dist/resource.mjs} +0 -0
  487. /package/{resource.mjs.map → dist/resource.mjs.map} +0 -0
  488. /package/{resources → dist/resources}/alpha/benchmarks.js +0 -0
  489. /package/{resources → dist/resources}/alpha/benchmarks.js.map +0 -0
  490. /package/{resources → dist/resources}/alpha/benchmarks.mjs +0 -0
  491. /package/{resources → dist/resources}/alpha/benchmarks.mjs.map +0 -0
  492. /package/{resources → dist/resources}/alpha/eval/eval.d.ts +0 -0
  493. /package/{resources → dist/resources}/alpha/eval/eval.d.ts.map +0 -0
  494. /package/{resources → dist/resources}/alpha/eval/eval.js +0 -0
  495. /package/{resources → dist/resources}/alpha/eval/eval.js.map +0 -0
  496. /package/{resources → dist/resources}/alpha/eval/eval.mjs +0 -0
  497. /package/{resources → dist/resources}/alpha/eval/eval.mjs.map +0 -0
  498. /package/{resources → dist/resources}/alpha/eval/index.d.ts +0 -0
  499. /package/{resources → dist/resources}/alpha/eval/index.d.ts.map +0 -0
  500. /package/{resources → dist/resources}/alpha/eval/index.js +0 -0
  501. /package/{resources → dist/resources}/alpha/eval/index.js.map +0 -0
  502. /package/{resources → dist/resources}/alpha/eval/index.mjs +0 -0
  503. /package/{resources → dist/resources}/alpha/eval/index.mjs.map +0 -0
  504. /package/{resources → dist/resources}/alpha/eval/jobs.d.ts +0 -0
  505. /package/{resources → dist/resources}/alpha/eval/jobs.d.ts.map +0 -0
  506. /package/{resources → dist/resources}/alpha/eval/jobs.js +0 -0
  507. /package/{resources → dist/resources}/alpha/eval/jobs.js.map +0 -0
  508. /package/{resources → dist/resources}/alpha/eval/jobs.mjs +0 -0
  509. /package/{resources → dist/resources}/alpha/eval/jobs.mjs.map +0 -0
  510. /package/{resources → dist/resources}/alpha/eval.d.ts +0 -0
  511. /package/{resources → dist/resources}/alpha/eval.d.ts.map +0 -0
  512. /package/{resources → dist/resources}/alpha/eval.js +0 -0
  513. /package/{resources → dist/resources}/alpha/eval.js.map +0 -0
  514. /package/{resources → dist/resources}/alpha/eval.mjs +0 -0
  515. /package/{resources → dist/resources}/alpha/eval.mjs.map +0 -0
  516. /package/{resources → dist/resources}/alpha/inference.d.ts +0 -0
  517. /package/{resources → dist/resources}/alpha/inference.d.ts.map +0 -0
  518. /package/{resources → dist/resources}/alpha/inference.js +0 -0
  519. /package/{resources → dist/resources}/alpha/inference.js.map +0 -0
  520. /package/{resources → dist/resources}/alpha/inference.mjs +0 -0
  521. /package/{resources → dist/resources}/alpha/inference.mjs.map +0 -0
  522. /package/{resources → dist/resources}/alpha/post-training/index.js +0 -0
  523. /package/{resources → dist/resources}/alpha/post-training/index.mjs +0 -0
  524. /package/{resources → dist/resources}/alpha/post-training/job.js +0 -0
  525. /package/{resources → dist/resources}/alpha/post-training/job.js.map +0 -0
  526. /package/{resources → dist/resources}/alpha/post-training/job.mjs +0 -0
  527. /package/{resources → dist/resources}/alpha/post-training/job.mjs.map +0 -0
  528. /package/{resources → dist/resources}/alpha/post-training/post-training.js +0 -0
  529. /package/{resources → dist/resources}/alpha/post-training/post-training.mjs +0 -0
  530. /package/{resources → dist/resources}/alpha/post-training.d.ts +0 -0
  531. /package/{resources → dist/resources}/alpha/post-training.d.ts.map +0 -0
  532. /package/{resources → dist/resources}/alpha/post-training.js +0 -0
  533. /package/{resources → dist/resources}/alpha/post-training.js.map +0 -0
  534. /package/{resources → dist/resources}/alpha/post-training.mjs +0 -0
  535. /package/{resources → dist/resources}/alpha/post-training.mjs.map +0 -0
  536. /package/{resources → dist/resources}/alpha.d.ts +0 -0
  537. /package/{resources → dist/resources}/alpha.d.ts.map +0 -0
  538. /package/{resources → dist/resources}/alpha.js +0 -0
  539. /package/{resources → dist/resources}/alpha.js.map +0 -0
  540. /package/{resources → dist/resources}/alpha.mjs +0 -0
  541. /package/{resources → dist/resources}/alpha.mjs.map +0 -0
  542. /package/{resources → dist/resources}/batches.d.ts +0 -0
  543. /package/{resources → dist/resources}/batches.d.ts.map +0 -0
  544. /package/{resources → dist/resources}/batches.js +0 -0
  545. /package/{resources → dist/resources}/batches.js.map +0 -0
  546. /package/{resources → dist/resources}/batches.mjs +0 -0
  547. /package/{resources → dist/resources}/batches.mjs.map +0 -0
  548. /package/{resources → dist/resources}/beta/beta.d.ts +0 -0
  549. /package/{resources → dist/resources}/beta/beta.d.ts.map +0 -0
  550. /package/{resources → dist/resources}/beta/beta.js +0 -0
  551. /package/{resources → dist/resources}/beta/beta.js.map +0 -0
  552. /package/{resources → dist/resources}/beta/beta.mjs +0 -0
  553. /package/{resources → dist/resources}/beta/beta.mjs.map +0 -0
  554. /package/{resources → dist/resources}/beta/datasets.js +0 -0
  555. /package/{resources → dist/resources}/beta/datasets.js.map +0 -0
  556. /package/{resources → dist/resources}/beta/datasets.mjs +0 -0
  557. /package/{resources → dist/resources}/beta/datasets.mjs.map +0 -0
  558. /package/{resources → dist/resources}/beta/index.d.ts +0 -0
  559. /package/{resources → dist/resources}/beta/index.d.ts.map +0 -0
  560. /package/{resources → dist/resources}/beta/index.js +0 -0
  561. /package/{resources → dist/resources}/beta/index.js.map +0 -0
  562. /package/{resources → dist/resources}/beta/index.mjs +0 -0
  563. /package/{resources → dist/resources}/beta/index.mjs.map +0 -0
  564. /package/{resources → dist/resources}/beta.d.ts +0 -0
  565. /package/{resources → dist/resources}/beta.d.ts.map +0 -0
  566. /package/{resources → dist/resources}/beta.js +0 -0
  567. /package/{resources → dist/resources}/beta.js.map +0 -0
  568. /package/{resources → dist/resources}/beta.mjs +0 -0
  569. /package/{resources → dist/resources}/beta.mjs.map +0 -0
  570. /package/{resources → dist/resources}/chat/chat.js +0 -0
  571. /package/{resources → dist/resources}/chat/chat.js.map +0 -0
  572. /package/{resources → dist/resources}/chat/chat.mjs +0 -0
  573. /package/{resources → dist/resources}/chat/chat.mjs.map +0 -0
  574. /package/{resources → dist/resources}/chat/completions.js +0 -0
  575. /package/{resources → dist/resources}/chat/completions.js.map +0 -0
  576. /package/{resources → dist/resources}/chat/completions.mjs +0 -0
  577. /package/{resources → dist/resources}/chat/completions.mjs.map +0 -0
  578. /package/{resources → dist/resources}/chat/index.d.ts +0 -0
  579. /package/{resources → dist/resources}/chat/index.d.ts.map +0 -0
  580. /package/{resources → dist/resources}/chat/index.js +0 -0
  581. /package/{resources → dist/resources}/chat/index.js.map +0 -0
  582. /package/{resources → dist/resources}/chat/index.mjs +0 -0
  583. /package/{resources → dist/resources}/chat/index.mjs.map +0 -0
  584. /package/{resources → dist/resources}/chat.d.ts +0 -0
  585. /package/{resources → dist/resources}/chat.d.ts.map +0 -0
  586. /package/{resources → dist/resources}/chat.js +0 -0
  587. /package/{resources → dist/resources}/chat.js.map +0 -0
  588. /package/{resources → dist/resources}/chat.mjs +0 -0
  589. /package/{resources → dist/resources}/chat.mjs.map +0 -0
  590. /package/{resources → dist/resources}/completions.js +0 -0
  591. /package/{resources → dist/resources}/completions.js.map +0 -0
  592. /package/{resources → dist/resources}/completions.mjs +0 -0
  593. /package/{resources → dist/resources}/completions.mjs.map +0 -0
  594. /package/{resources → dist/resources}/conversations/conversations.js +0 -0
  595. /package/{resources → dist/resources}/conversations/conversations.mjs +0 -0
  596. /package/{resources → dist/resources}/conversations/index.d.ts +0 -0
  597. /package/{resources → dist/resources}/conversations/index.d.ts.map +0 -0
  598. /package/{resources → dist/resources}/conversations/index.js +0 -0
  599. /package/{resources → dist/resources}/conversations/index.js.map +0 -0
  600. /package/{resources → dist/resources}/conversations/index.mjs +0 -0
  601. /package/{resources → dist/resources}/conversations/index.mjs.map +0 -0
  602. /package/{resources → dist/resources}/conversations/items.js +0 -0
  603. /package/{resources → dist/resources}/conversations/items.mjs +0 -0
  604. /package/{resources → dist/resources}/conversations.d.ts +0 -0
  605. /package/{resources → dist/resources}/conversations.d.ts.map +0 -0
  606. /package/{resources → dist/resources}/conversations.js +0 -0
  607. /package/{resources → dist/resources}/conversations.js.map +0 -0
  608. /package/{resources → dist/resources}/conversations.mjs +0 -0
  609. /package/{resources → dist/resources}/conversations.mjs.map +0 -0
  610. /package/{resources → dist/resources}/embeddings.d.ts +0 -0
  611. /package/{resources → dist/resources}/embeddings.d.ts.map +0 -0
  612. /package/{resources → dist/resources}/embeddings.js +0 -0
  613. /package/{resources → dist/resources}/embeddings.js.map +0 -0
  614. /package/{resources → dist/resources}/embeddings.mjs +0 -0
  615. /package/{resources → dist/resources}/embeddings.mjs.map +0 -0
  616. /package/{resources → dist/resources}/files.d.ts +0 -0
  617. /package/{resources → dist/resources}/files.d.ts.map +0 -0
  618. /package/{resources → dist/resources}/files.js +0 -0
  619. /package/{resources → dist/resources}/files.js.map +0 -0
  620. /package/{resources → dist/resources}/files.mjs +0 -0
  621. /package/{resources → dist/resources}/files.mjs.map +0 -0
  622. /package/{resources → dist/resources}/index.js +0 -0
  623. /package/{resources → dist/resources}/index.mjs +0 -0
  624. /package/{resources → dist/resources}/models/index.d.ts +0 -0
  625. /package/{resources → dist/resources}/models/index.d.ts.map +0 -0
  626. /package/{resources → dist/resources}/models/index.js +0 -0
  627. /package/{resources → dist/resources}/models/index.js.map +0 -0
  628. /package/{resources → dist/resources}/models/index.mjs +0 -0
  629. /package/{resources → dist/resources}/models/index.mjs.map +0 -0
  630. /package/{resources → dist/resources}/models/models.d.ts +0 -0
  631. /package/{resources → dist/resources}/models/models.d.ts.map +0 -0
  632. /package/{resources → dist/resources}/models/models.js +0 -0
  633. /package/{resources → dist/resources}/models/models.js.map +0 -0
  634. /package/{resources → dist/resources}/models/models.mjs +0 -0
  635. /package/{resources → dist/resources}/models/models.mjs.map +0 -0
  636. /package/{resources → dist/resources}/models/openai.d.ts +0 -0
  637. /package/{resources → dist/resources}/models/openai.d.ts.map +0 -0
  638. /package/{resources → dist/resources}/models/openai.js +0 -0
  639. /package/{resources → dist/resources}/models/openai.js.map +0 -0
  640. /package/{resources → dist/resources}/models/openai.mjs +0 -0
  641. /package/{resources → dist/resources}/models/openai.mjs.map +0 -0
  642. /package/{resources → dist/resources}/models.d.ts +0 -0
  643. /package/{resources → dist/resources}/models.d.ts.map +0 -0
  644. /package/{resources → dist/resources}/models.js +0 -0
  645. /package/{resources → dist/resources}/models.js.map +0 -0
  646. /package/{resources → dist/resources}/models.mjs +0 -0
  647. /package/{resources → dist/resources}/models.mjs.map +0 -0
  648. /package/{resources → dist/resources}/moderations.d.ts +0 -0
  649. /package/{resources → dist/resources}/moderations.d.ts.map +0 -0
  650. /package/{resources → dist/resources}/moderations.js +0 -0
  651. /package/{resources → dist/resources}/moderations.js.map +0 -0
  652. /package/{resources → dist/resources}/moderations.mjs +0 -0
  653. /package/{resources → dist/resources}/moderations.mjs.map +0 -0
  654. /package/{resources → dist/resources}/prompts/index.d.ts +0 -0
  655. /package/{resources → dist/resources}/prompts/index.d.ts.map +0 -0
  656. /package/{resources → dist/resources}/prompts/index.js +0 -0
  657. /package/{resources → dist/resources}/prompts/index.js.map +0 -0
  658. /package/{resources → dist/resources}/prompts/index.mjs +0 -0
  659. /package/{resources → dist/resources}/prompts/index.mjs.map +0 -0
  660. /package/{resources → dist/resources}/prompts/prompts.d.ts +0 -0
  661. /package/{resources → dist/resources}/prompts/prompts.d.ts.map +0 -0
  662. /package/{resources → dist/resources}/prompts/prompts.js +0 -0
  663. /package/{resources → dist/resources}/prompts/prompts.js.map +0 -0
  664. /package/{resources → dist/resources}/prompts/prompts.mjs +0 -0
  665. /package/{resources → dist/resources}/prompts/prompts.mjs.map +0 -0
  666. /package/{resources → dist/resources}/prompts/versions.d.ts +0 -0
  667. /package/{resources → dist/resources}/prompts/versions.d.ts.map +0 -0
  668. /package/{resources → dist/resources}/prompts/versions.js +0 -0
  669. /package/{resources → dist/resources}/prompts/versions.js.map +0 -0
  670. /package/{resources → dist/resources}/prompts/versions.mjs +0 -0
  671. /package/{resources → dist/resources}/prompts/versions.mjs.map +0 -0
  672. /package/{resources → dist/resources}/prompts.d.ts +0 -0
  673. /package/{resources → dist/resources}/prompts.d.ts.map +0 -0
  674. /package/{resources → dist/resources}/prompts.js +0 -0
  675. /package/{resources → dist/resources}/prompts.js.map +0 -0
  676. /package/{resources → dist/resources}/prompts.mjs +0 -0
  677. /package/{resources → dist/resources}/prompts.mjs.map +0 -0
  678. /package/{resources → dist/resources}/responses/index.d.ts +0 -0
  679. /package/{resources → dist/resources}/responses/index.d.ts.map +0 -0
  680. /package/{resources → dist/resources}/responses/index.js +0 -0
  681. /package/{resources → dist/resources}/responses/index.js.map +0 -0
  682. /package/{resources → dist/resources}/responses/index.mjs +0 -0
  683. /package/{resources → dist/resources}/responses/index.mjs.map +0 -0
  684. /package/{resources → dist/resources}/responses/input-items.js +0 -0
  685. /package/{resources → dist/resources}/responses/input-items.js.map +0 -0
  686. /package/{resources → dist/resources}/responses/input-items.mjs +0 -0
  687. /package/{resources → dist/resources}/responses/input-items.mjs.map +0 -0
  688. /package/{resources → dist/resources}/responses/responses.js +0 -0
  689. /package/{resources → dist/resources}/responses/responses.mjs +0 -0
  690. /package/{resources → dist/resources}/responses.d.ts +0 -0
  691. /package/{resources → dist/resources}/responses.d.ts.map +0 -0
  692. /package/{resources → dist/resources}/responses.js +0 -0
  693. /package/{resources → dist/resources}/responses.js.map +0 -0
  694. /package/{resources → dist/resources}/responses.mjs +0 -0
  695. /package/{resources → dist/resources}/responses.mjs.map +0 -0
  696. /package/{resources → dist/resources}/routes.js +0 -0
  697. /package/{resources → dist/resources}/routes.mjs +0 -0
  698. /package/{resources → dist/resources}/safety.d.ts +0 -0
  699. /package/{resources → dist/resources}/safety.d.ts.map +0 -0
  700. /package/{resources → dist/resources}/safety.js +0 -0
  701. /package/{resources → dist/resources}/safety.js.map +0 -0
  702. /package/{resources → dist/resources}/safety.mjs +0 -0
  703. /package/{resources → dist/resources}/safety.mjs.map +0 -0
  704. /package/{resources → dist/resources}/scoring-functions.d.ts +0 -0
  705. /package/{resources → dist/resources}/scoring-functions.d.ts.map +0 -0
  706. /package/{resources → dist/resources}/scoring-functions.js +0 -0
  707. /package/{resources → dist/resources}/scoring-functions.js.map +0 -0
  708. /package/{resources → dist/resources}/scoring-functions.mjs +0 -0
  709. /package/{resources → dist/resources}/scoring-functions.mjs.map +0 -0
  710. /package/{resources → dist/resources}/scoring.d.ts +0 -0
  711. /package/{resources → dist/resources}/scoring.d.ts.map +0 -0
  712. /package/{resources → dist/resources}/scoring.js +0 -0
  713. /package/{resources → dist/resources}/scoring.js.map +0 -0
  714. /package/{resources → dist/resources}/scoring.mjs +0 -0
  715. /package/{resources → dist/resources}/scoring.mjs.map +0 -0
  716. /package/{resources → dist/resources}/shared.js +0 -0
  717. /package/{resources → dist/resources}/shared.js.map +0 -0
  718. /package/{resources → dist/resources}/shared.mjs +0 -0
  719. /package/{resources → dist/resources}/shared.mjs.map +0 -0
  720. /package/{resources → dist/resources}/shields.d.ts +0 -0
  721. /package/{resources → dist/resources}/shields.d.ts.map +0 -0
  722. /package/{resources → dist/resources}/shields.js +0 -0
  723. /package/{resources → dist/resources}/shields.js.map +0 -0
  724. /package/{resources → dist/resources}/shields.mjs +0 -0
  725. /package/{resources → dist/resources}/shields.mjs.map +0 -0
  726. /package/{resources → dist/resources}/tool-runtime.d.ts +0 -0
  727. /package/{resources → dist/resources}/tool-runtime.d.ts.map +0 -0
  728. /package/{resources → dist/resources}/tool-runtime.js +0 -0
  729. /package/{resources → dist/resources}/tool-runtime.js.map +0 -0
  730. /package/{resources → dist/resources}/tool-runtime.mjs +0 -0
  731. /package/{resources → dist/resources}/tool-runtime.mjs.map +0 -0
  732. /package/{resources → dist/resources}/toolgroups.d.ts +0 -0
  733. /package/{resources → dist/resources}/toolgroups.d.ts.map +0 -0
  734. /package/{resources → dist/resources}/toolgroups.js +0 -0
  735. /package/{resources → dist/resources}/toolgroups.js.map +0 -0
  736. /package/{resources → dist/resources}/toolgroups.mjs +0 -0
  737. /package/{resources → dist/resources}/toolgroups.mjs.map +0 -0
  738. /package/{resources → dist/resources}/tools.d.ts +0 -0
  739. /package/{resources → dist/resources}/tools.d.ts.map +0 -0
  740. /package/{resources → dist/resources}/tools.js +0 -0
  741. /package/{resources → dist/resources}/tools.js.map +0 -0
  742. /package/{resources → dist/resources}/tools.mjs +0 -0
  743. /package/{resources → dist/resources}/tools.mjs.map +0 -0
  744. /package/{resources → dist/resources}/vector-io.d.ts +0 -0
  745. /package/{resources → dist/resources}/vector-io.d.ts.map +0 -0
  746. /package/{resources → dist/resources}/vector-io.js +0 -0
  747. /package/{resources → dist/resources}/vector-io.js.map +0 -0
  748. /package/{resources → dist/resources}/vector-io.mjs +0 -0
  749. /package/{resources → dist/resources}/vector-io.mjs.map +0 -0
  750. /package/{resources → dist/resources}/vector-stores/file-batches.d.ts +0 -0
  751. /package/{resources → dist/resources}/vector-stores/file-batches.d.ts.map +0 -0
  752. /package/{resources → dist/resources}/vector-stores/file-batches.js +0 -0
  753. /package/{resources → dist/resources}/vector-stores/file-batches.js.map +0 -0
  754. /package/{resources → dist/resources}/vector-stores/file-batches.mjs +0 -0
  755. /package/{resources → dist/resources}/vector-stores/file-batches.mjs.map +0 -0
  756. /package/{resources → dist/resources}/vector-stores/files.d.ts +0 -0
  757. /package/{resources → dist/resources}/vector-stores/files.d.ts.map +0 -0
  758. /package/{resources → dist/resources}/vector-stores/files.js +0 -0
  759. /package/{resources → dist/resources}/vector-stores/files.js.map +0 -0
  760. /package/{resources → dist/resources}/vector-stores/files.mjs +0 -0
  761. /package/{resources → dist/resources}/vector-stores/files.mjs.map +0 -0
  762. /package/{resources → dist/resources}/vector-stores/index.d.ts +0 -0
  763. /package/{resources → dist/resources}/vector-stores/index.d.ts.map +0 -0
  764. /package/{resources → dist/resources}/vector-stores/index.js +0 -0
  765. /package/{resources → dist/resources}/vector-stores/index.js.map +0 -0
  766. /package/{resources → dist/resources}/vector-stores/index.mjs +0 -0
  767. /package/{resources → dist/resources}/vector-stores/index.mjs.map +0 -0
  768. /package/{resources → dist/resources}/vector-stores/vector-stores.d.ts +0 -0
  769. /package/{resources → dist/resources}/vector-stores/vector-stores.d.ts.map +0 -0
  770. /package/{resources → dist/resources}/vector-stores/vector-stores.js +0 -0
  771. /package/{resources → dist/resources}/vector-stores/vector-stores.js.map +0 -0
  772. /package/{resources → dist/resources}/vector-stores/vector-stores.mjs +0 -0
  773. /package/{resources → dist/resources}/vector-stores/vector-stores.mjs.map +0 -0
  774. /package/{resources → dist/resources}/vector-stores.d.ts +0 -0
  775. /package/{resources → dist/resources}/vector-stores.d.ts.map +0 -0
  776. /package/{resources → dist/resources}/vector-stores.js +0 -0
  777. /package/{resources → dist/resources}/vector-stores.js.map +0 -0
  778. /package/{resources → dist/resources}/vector-stores.mjs +0 -0
  779. /package/{resources → dist/resources}/vector-stores.mjs.map +0 -0
  780. /package/{resources.d.ts → dist/resources.d.ts} +0 -0
  781. /package/{resources.d.ts.map → dist/resources.d.ts.map} +0 -0
  782. /package/{resources.js → dist/resources.js} +0 -0
  783. /package/{resources.js.map → dist/resources.js.map} +0 -0
  784. /package/{resources.mjs → dist/resources.mjs} +0 -0
  785. /package/{resources.mjs.map → dist/resources.mjs.map} +0 -0
  786. /package/{shims → dist/shims}/node.d.ts +0 -0
  787. /package/{shims → dist/shims}/node.d.ts.map +0 -0
  788. /package/{shims → dist/shims}/node.js +0 -0
  789. /package/{shims → dist/shims}/node.js.map +0 -0
  790. /package/{shims → dist/shims}/node.mjs +0 -0
  791. /package/{shims → dist/shims}/node.mjs.map +0 -0
  792. /package/{shims → dist/shims}/web.d.ts +0 -0
  793. /package/{shims → dist/shims}/web.d.ts.map +0 -0
  794. /package/{shims → dist/shims}/web.js +0 -0
  795. /package/{shims → dist/shims}/web.js.map +0 -0
  796. /package/{shims → dist/shims}/web.mjs +0 -0
  797. /package/{shims → dist/shims}/web.mjs.map +0 -0
  798. /package/{src → dist/src}/tsconfig.json +0 -0
  799. /package/{streaming.d.ts → dist/streaming.d.ts} +0 -0
  800. /package/{streaming.d.ts.map → dist/streaming.d.ts.map} +0 -0
  801. /package/{streaming.js → dist/streaming.js} +0 -0
  802. /package/{streaming.js.map → dist/streaming.js.map} +0 -0
  803. /package/{streaming.mjs → dist/streaming.mjs} +0 -0
  804. /package/{streaming.mjs.map → dist/streaming.mjs.map} +0 -0
  805. /package/{uploads.d.ts → dist/uploads.d.ts} +0 -0
  806. /package/{uploads.d.ts.map → dist/uploads.d.ts.map} +0 -0
  807. /package/{uploads.js → dist/uploads.js} +0 -0
  808. /package/{uploads.js.map → dist/uploads.js.map} +0 -0
  809. /package/{uploads.mjs → dist/uploads.mjs} +0 -0
  810. /package/{uploads.mjs.map → dist/uploads.mjs.map} +0 -0
@@ -0,0 +1,297 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+ // All rights reserved.
3
+ //
4
+ // This source code is licensed under the terms described in the LICENSE file in
5
+ // the root directory of this source tree.
6
+
7
+ import { ReadableStream, type Response } from './_shims/index';
8
+ import { LlamaStackClientError } from './error';
9
+ import { findDoubleNewlineIndex, LineDecoder } from './internal/decoders/line';
10
+ import { ReadableStreamToAsyncIterable } from './internal/stream-utils';
11
+
12
+ type Bytes = string | ArrayBuffer | Uint8Array | Buffer | null | undefined;
13
+
14
+ export type ServerSentEvent = {
15
+ event: string | null;
16
+ data: string;
17
+ raw: string[];
18
+ };
19
+
20
+ export class Stream<Item> implements AsyncIterable<Item> {
21
+ controller: AbortController;
22
+
23
+ constructor(
24
+ private iterator: () => AsyncIterator<Item>,
25
+ controller: AbortController,
26
+ ) {
27
+ this.controller = controller;
28
+ }
29
+
30
+ static fromSSEResponse<Item>(response: Response, controller: AbortController): Stream<Item> {
31
+ let consumed = false;
32
+
33
+ async function* iterator(): AsyncIterator<Item, any, undefined> {
34
+ if (consumed) {
35
+ throw new Error('Cannot iterate over a consumed stream, use `.tee()` to split the stream.');
36
+ }
37
+ consumed = true;
38
+ let done = false;
39
+ try {
40
+ for await (const sse of _iterSSEMessages(response, controller)) {
41
+ try {
42
+ yield JSON.parse(sse.data);
43
+ } catch (e) {
44
+ console.error(`Could not parse message into JSON:`, sse.data);
45
+ console.error(`From chunk:`, sse.raw);
46
+ throw e;
47
+ }
48
+ }
49
+ done = true;
50
+ } catch (e) {
51
+ // If the user calls `stream.controller.abort()`, we should exit without throwing.
52
+ if (e instanceof Error && e.name === 'AbortError') return;
53
+ throw e;
54
+ } finally {
55
+ // If the user `break`s, abort the ongoing request.
56
+ if (!done) controller.abort();
57
+ }
58
+ }
59
+
60
+ return new Stream(iterator, controller);
61
+ }
62
+
63
+ /**
64
+ * Generates a Stream from a newline-separated ReadableStream
65
+ * where each item is a JSON value.
66
+ */
67
+ static fromReadableStream<Item>(readableStream: ReadableStream, controller: AbortController): Stream<Item> {
68
+ let consumed = false;
69
+
70
+ async function* iterLines(): AsyncGenerator<string, void, unknown> {
71
+ const lineDecoder = new LineDecoder();
72
+
73
+ const iter = ReadableStreamToAsyncIterable<Bytes>(readableStream);
74
+ for await (const chunk of iter) {
75
+ for (const line of lineDecoder.decode(chunk)) {
76
+ yield line;
77
+ }
78
+ }
79
+
80
+ for (const line of lineDecoder.flush()) {
81
+ yield line;
82
+ }
83
+ }
84
+
85
+ async function* iterator(): AsyncIterator<Item, any, undefined> {
86
+ if (consumed) {
87
+ throw new Error('Cannot iterate over a consumed stream, use `.tee()` to split the stream.');
88
+ }
89
+ consumed = true;
90
+ let done = false;
91
+ try {
92
+ for await (const line of iterLines()) {
93
+ if (done) continue;
94
+ if (line) yield JSON.parse(line);
95
+ }
96
+ done = true;
97
+ } catch (e) {
98
+ // If the user calls `stream.controller.abort()`, we should exit without throwing.
99
+ if (e instanceof Error && e.name === 'AbortError') return;
100
+ throw e;
101
+ } finally {
102
+ // If the user `break`s, abort the ongoing request.
103
+ if (!done) controller.abort();
104
+ }
105
+ }
106
+
107
+ return new Stream(iterator, controller);
108
+ }
109
+
110
+ [Symbol.asyncIterator](): AsyncIterator<Item> {
111
+ return this.iterator();
112
+ }
113
+
114
+ /**
115
+ * Splits the stream into two streams which can be
116
+ * independently read from at different speeds.
117
+ */
118
+ tee(): [Stream<Item>, Stream<Item>] {
119
+ const left: Array<Promise<IteratorResult<Item>>> = [];
120
+ const right: Array<Promise<IteratorResult<Item>>> = [];
121
+ const iterator = this.iterator();
122
+
123
+ const teeIterator = (queue: Array<Promise<IteratorResult<Item>>>): AsyncIterator<Item> => {
124
+ return {
125
+ next: () => {
126
+ if (queue.length === 0) {
127
+ const result = iterator.next();
128
+ left.push(result);
129
+ right.push(result);
130
+ }
131
+ return queue.shift()!;
132
+ },
133
+ };
134
+ };
135
+
136
+ return [
137
+ new Stream(() => teeIterator(left), this.controller),
138
+ new Stream(() => teeIterator(right), this.controller),
139
+ ];
140
+ }
141
+
142
+ /**
143
+ * Converts this stream to a newline-separated ReadableStream of
144
+ * JSON stringified values in the stream
145
+ * which can be turned back into a Stream with `Stream.fromReadableStream()`.
146
+ */
147
+ toReadableStream(): ReadableStream {
148
+ const self = this;
149
+ let iter: AsyncIterator<Item>;
150
+ const encoder = new TextEncoder();
151
+
152
+ return new ReadableStream({
153
+ async start() {
154
+ iter = self[Symbol.asyncIterator]();
155
+ },
156
+ async pull(ctrl: any) {
157
+ try {
158
+ const { value, done } = await iter.next();
159
+ if (done) return ctrl.close();
160
+
161
+ const bytes = encoder.encode(JSON.stringify(value) + '\n');
162
+
163
+ ctrl.enqueue(bytes);
164
+ } catch (err) {
165
+ ctrl.error(err);
166
+ }
167
+ },
168
+ async cancel() {
169
+ await iter.return?.();
170
+ },
171
+ });
172
+ }
173
+ }
174
+
175
+ export async function* _iterSSEMessages(
176
+ response: Response,
177
+ controller: AbortController,
178
+ ): AsyncGenerator<ServerSentEvent, void, unknown> {
179
+ if (!response.body) {
180
+ controller.abort();
181
+ throw new LlamaStackClientError(`Attempted to iterate over a response with no body`);
182
+ }
183
+
184
+ const sseDecoder = new SSEDecoder();
185
+ const lineDecoder = new LineDecoder();
186
+
187
+ const iter = ReadableStreamToAsyncIterable<Bytes>(response.body);
188
+ for await (const sseChunk of iterSSEChunks(iter)) {
189
+ for (const line of lineDecoder.decode(sseChunk)) {
190
+ const sse = sseDecoder.decode(line);
191
+ if (sse) yield sse;
192
+ }
193
+ }
194
+
195
+ for (const line of lineDecoder.flush()) {
196
+ const sse = sseDecoder.decode(line);
197
+ if (sse) yield sse;
198
+ }
199
+ }
200
+
201
+ /**
202
+ * Given an async iterable iterator, iterates over it and yields full
203
+ * SSE chunks, i.e. yields when a double new-line is encountered.
204
+ */
205
+ async function* iterSSEChunks(iterator: AsyncIterableIterator<Bytes>): AsyncGenerator<Uint8Array> {
206
+ let data = new Uint8Array();
207
+
208
+ for await (const chunk of iterator) {
209
+ if (chunk == null) {
210
+ continue;
211
+ }
212
+
213
+ const binaryChunk =
214
+ chunk instanceof ArrayBuffer ? new Uint8Array(chunk)
215
+ : typeof chunk === 'string' ? new TextEncoder().encode(chunk)
216
+ : chunk;
217
+
218
+ let newData = new Uint8Array(data.length + binaryChunk.length);
219
+ newData.set(data);
220
+ newData.set(binaryChunk, data.length);
221
+ data = newData;
222
+
223
+ let patternIndex;
224
+ while ((patternIndex = findDoubleNewlineIndex(data)) !== -1) {
225
+ yield data.slice(0, patternIndex);
226
+ data = data.slice(patternIndex);
227
+ }
228
+ }
229
+
230
+ if (data.length > 0) {
231
+ yield data;
232
+ }
233
+ }
234
+
235
+ class SSEDecoder {
236
+ private data: string[];
237
+ private event: string | null;
238
+ private chunks: string[];
239
+
240
+ constructor() {
241
+ this.event = null;
242
+ this.data = [];
243
+ this.chunks = [];
244
+ }
245
+
246
+ decode(line: string) {
247
+ if (line.endsWith('\r')) {
248
+ line = line.substring(0, line.length - 1);
249
+ }
250
+
251
+ if (!line) {
252
+ // empty line and we didn't previously encounter any messages
253
+ if (!this.event && !this.data.length) return null;
254
+
255
+ const sse: ServerSentEvent = {
256
+ event: this.event,
257
+ data: this.data.join('\n'),
258
+ raw: this.chunks,
259
+ };
260
+
261
+ this.event = null;
262
+ this.data = [];
263
+ this.chunks = [];
264
+
265
+ return sse;
266
+ }
267
+
268
+ this.chunks.push(line);
269
+
270
+ if (line.startsWith(':')) {
271
+ return null;
272
+ }
273
+
274
+ let [fieldname, _, value] = partition(line, ':');
275
+
276
+ if (value.startsWith(' ')) {
277
+ value = value.substring(1);
278
+ }
279
+
280
+ if (fieldname === 'event') {
281
+ this.event = value;
282
+ } else if (fieldname === 'data') {
283
+ this.data.push(value);
284
+ }
285
+
286
+ return null;
287
+ }
288
+ }
289
+
290
+ function partition(str: string, delimiter: string): [string, string, string] {
291
+ const index = str.indexOf(delimiter);
292
+ if (index !== -1) {
293
+ return [str.substring(0, index), delimiter, str.substring(index + delimiter.length)];
294
+ }
295
+
296
+ return [str, '', ''];
297
+ }
@@ -0,0 +1,261 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+ // All rights reserved.
3
+ //
4
+ // This source code is licensed under the terms described in the LICENSE file in
5
+ // the root directory of this source tree.
6
+
7
+ import { type RequestOptions } from './core';
8
+ import {
9
+ FormData,
10
+ File,
11
+ type Blob,
12
+ type FilePropertyBag,
13
+ getMultipartRequestOptions,
14
+ type FsReadStream,
15
+ isFsReadStream,
16
+ } from './_shims/index';
17
+ import { MultipartBody } from './_shims/MultipartBody';
18
+ export { fileFromPath } from './_shims/index';
19
+
20
+ type BlobLikePart = string | ArrayBuffer | ArrayBufferView | BlobLike | Uint8Array | DataView;
21
+ export type BlobPart = string | ArrayBuffer | ArrayBufferView | Blob | Uint8Array | DataView;
22
+
23
+ /**
24
+ * Typically, this is a native "File" class.
25
+ *
26
+ * We provide the {@link toFile} utility to convert a variety of objects
27
+ * into the File class.
28
+ *
29
+ * For convenience, you can also pass a fetch Response, or in Node,
30
+ * the result of fs.createReadStream().
31
+ */
32
+ export type Uploadable = FileLike | ResponseLike | FsReadStream;
33
+
34
+ /**
35
+ * Intended to match web.Blob, node.Blob, node-fetch.Blob, etc.
36
+ */
37
+ export interface BlobLike {
38
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/size) */
39
+ readonly size: number;
40
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/type) */
41
+ readonly type: string;
42
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text) */
43
+ text(): Promise<string>;
44
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice) */
45
+ slice(start?: number, end?: number): BlobLike;
46
+ // unfortunately @types/node-fetch@^2.6.4 doesn't type the arrayBuffer method
47
+ }
48
+
49
+ /**
50
+ * Intended to match web.File, node.File, node-fetch.File, etc.
51
+ */
52
+ export interface FileLike extends BlobLike {
53
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified) */
54
+ readonly lastModified: number;
55
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name) */
56
+ readonly name: string;
57
+ }
58
+
59
+ /**
60
+ * Intended to match web.Response, node.Response, node-fetch.Response, etc.
61
+ */
62
+ export interface ResponseLike {
63
+ url: string;
64
+ blob(): Promise<BlobLike>;
65
+ }
66
+
67
+ export const isResponseLike = (value: any): value is ResponseLike =>
68
+ value != null &&
69
+ typeof value === 'object' &&
70
+ typeof value.url === 'string' &&
71
+ typeof value.blob === 'function';
72
+
73
+ export const isFileLike = (value: any): value is FileLike =>
74
+ value != null &&
75
+ typeof value === 'object' &&
76
+ typeof value.name === 'string' &&
77
+ typeof value.lastModified === 'number' &&
78
+ isBlobLike(value);
79
+
80
+ /**
81
+ * The BlobLike type omits arrayBuffer() because @types/node-fetch@^2.6.4 lacks it; but this check
82
+ * adds the arrayBuffer() method type because it is available and used at runtime
83
+ */
84
+ export const isBlobLike = (value: any): value is BlobLike & { arrayBuffer(): Promise<ArrayBuffer> } =>
85
+ value != null &&
86
+ typeof value === 'object' &&
87
+ typeof value.size === 'number' &&
88
+ typeof value.type === 'string' &&
89
+ typeof value.text === 'function' &&
90
+ typeof value.slice === 'function' &&
91
+ typeof value.arrayBuffer === 'function';
92
+
93
+ export const isUploadable = (value: any): value is Uploadable => {
94
+ return isFileLike(value) || isResponseLike(value) || isFsReadStream(value);
95
+ };
96
+
97
+ export type ToFileInput = Uploadable | Exclude<BlobLikePart, string> | AsyncIterable<BlobLikePart>;
98
+
99
+ /**
100
+ * Helper for creating a {@link File} to pass to an SDK upload method from a variety of different data formats
101
+ * @param value the raw content of the file. Can be an {@link Uploadable}, {@link BlobLikePart}, or {@link AsyncIterable} of {@link BlobLikePart}s
102
+ * @param {string=} name the name of the file. If omitted, toFile will try to determine a file name from bits if possible
103
+ * @param {Object=} options additional properties
104
+ * @param {string=} options.type the MIME type of the content
105
+ * @param {number=} options.lastModified the last modified timestamp
106
+ * @returns a {@link File} with the given properties
107
+ */
108
+ export async function toFile(
109
+ value: ToFileInput | PromiseLike<ToFileInput>,
110
+ name?: string | null | undefined,
111
+ options?: FilePropertyBag | undefined,
112
+ ): Promise<FileLike> {
113
+ // If it's a promise, resolve it.
114
+ value = await value;
115
+
116
+ // If we've been given a `File` we don't need to do anything
117
+ if (isFileLike(value)) {
118
+ return value;
119
+ }
120
+
121
+ if (isResponseLike(value)) {
122
+ const blob = await value.blob();
123
+ name ||= new URL(value.url).pathname.split(/[\\/]/).pop() ?? 'unknown_file';
124
+
125
+ // we need to convert the `Blob` into an array buffer because the `Blob` class
126
+ // that `node-fetch` defines is incompatible with the web standard which results
127
+ // in `new File` interpreting it as a string instead of binary data.
128
+ const data = isBlobLike(blob) ? [(await blob.arrayBuffer()) as any] : [blob];
129
+
130
+ return new File(data, name, options);
131
+ }
132
+
133
+ const bits = await getBytes(value);
134
+
135
+ name ||= getName(value) ?? 'unknown_file';
136
+
137
+ if (!options?.type) {
138
+ const type = (bits[0] as any)?.type;
139
+ if (typeof type === 'string') {
140
+ options = { ...options, type };
141
+ }
142
+ }
143
+
144
+ return new File(bits, name, options);
145
+ }
146
+
147
+ async function getBytes(value: ToFileInput): Promise<Array<BlobPart>> {
148
+ let parts: Array<BlobPart> = [];
149
+ if (
150
+ typeof value === 'string' ||
151
+ ArrayBuffer.isView(value) || // includes Uint8Array, Buffer, etc.
152
+ value instanceof ArrayBuffer
153
+ ) {
154
+ parts.push(value);
155
+ } else if (isBlobLike(value)) {
156
+ parts.push(await value.arrayBuffer());
157
+ } else if (
158
+ isAsyncIterableIterator(value) // includes Readable, ReadableStream, etc.
159
+ ) {
160
+ for await (const chunk of value) {
161
+ parts.push(chunk as BlobPart); // TODO, consider validating?
162
+ }
163
+ } else {
164
+ throw new Error(
165
+ `Unexpected data type: ${typeof value}; constructor: ${value?.constructor
166
+ ?.name}; props: ${propsForError(value)}`,
167
+ );
168
+ }
169
+
170
+ return parts;
171
+ }
172
+
173
+ function propsForError(value: any): string {
174
+ const props = Object.getOwnPropertyNames(value);
175
+ return `[${props.map((p) => `"${p}"`).join(', ')}]`;
176
+ }
177
+
178
+ function getName(value: any): string | undefined {
179
+ return (
180
+ getStringFromMaybeBuffer(value.name) ||
181
+ getStringFromMaybeBuffer(value.filename) ||
182
+ // For fs.ReadStream
183
+ getStringFromMaybeBuffer(value.path)?.split(/[\\/]/).pop()
184
+ );
185
+ }
186
+
187
+ const getStringFromMaybeBuffer = (x: string | Buffer | unknown): string | undefined => {
188
+ if (typeof x === 'string') return x;
189
+ if (typeof Buffer !== 'undefined' && x instanceof Buffer) return String(x);
190
+ return undefined;
191
+ };
192
+
193
+ const isAsyncIterableIterator = (value: any): value is AsyncIterableIterator<unknown> =>
194
+ value != null && typeof value === 'object' && typeof value[Symbol.asyncIterator] === 'function';
195
+
196
+ export const isMultipartBody = (body: any): body is MultipartBody =>
197
+ body && typeof body === 'object' && body.body && body[Symbol.toStringTag] === 'MultipartBody';
198
+
199
+ /**
200
+ * Returns a multipart/form-data request if any part of the given request body contains a File / Blob value.
201
+ * Otherwise returns the request as is.
202
+ */
203
+ export const maybeMultipartFormRequestOptions = async <T = Record<string, unknown>>(
204
+ opts: RequestOptions<T>,
205
+ ): Promise<RequestOptions<T | MultipartBody>> => {
206
+ if (!hasUploadableValue(opts.body)) return opts;
207
+
208
+ const form = await createForm(opts.body);
209
+ return getMultipartRequestOptions(form, opts);
210
+ };
211
+
212
+ export const multipartFormRequestOptions = async <T = Record<string, unknown>>(
213
+ opts: RequestOptions<T>,
214
+ ): Promise<RequestOptions<T | MultipartBody>> => {
215
+ const form = await createForm(opts.body);
216
+ return getMultipartRequestOptions(form, opts);
217
+ };
218
+
219
+ export const createForm = async <T = Record<string, unknown>>(body: T | undefined): Promise<FormData> => {
220
+ const form = new FormData();
221
+ await Promise.all(Object.entries(body || {}).map(([key, value]) => addFormValue(form, key, value)));
222
+ return form;
223
+ };
224
+
225
+ const hasUploadableValue = (value: unknown): boolean => {
226
+ if (isUploadable(value)) return true;
227
+ if (Array.isArray(value)) return value.some(hasUploadableValue);
228
+ if (value && typeof value === 'object') {
229
+ for (const k in value) {
230
+ if (hasUploadableValue((value as any)[k])) return true;
231
+ }
232
+ }
233
+ return false;
234
+ };
235
+
236
+ const addFormValue = async (form: FormData, key: string, value: unknown): Promise<void> => {
237
+ if (value === undefined) return;
238
+ if (value == null) {
239
+ throw new TypeError(
240
+ `Received null for "${key}"; to pass null in FormData, you must use the string 'null'`,
241
+ );
242
+ }
243
+
244
+ // TODO: make nested formats configurable
245
+ if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
246
+ form.append(key, String(value));
247
+ } else if (isUploadable(value)) {
248
+ const file = await toFile(value);
249
+ form.append(key, file as File);
250
+ } else if (Array.isArray(value)) {
251
+ await Promise.all(value.map((entry) => addFormValue(form, key + '[]', entry)));
252
+ } else if (typeof value === 'object') {
253
+ await Promise.all(
254
+ Object.entries(value).map(([name, prop]) => addFormValue(form, `${key}[${name}]`, prop)),
255
+ );
256
+ } else {
257
+ throw new TypeError(
258
+ `Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${value} instead`,
259
+ );
260
+ }
261
+ };
@@ -0,0 +1,7 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+ // All rights reserved.
3
+ //
4
+ // This source code is licensed under the terms described in the LICENSE file in
5
+ // the root directory of this source tree.
6
+
7
+ export const VERSION = '0.4.4'; // x-release-please-version
@@ -0,0 +1,2 @@
1
+ export declare const VERSION = "0.4.4";
2
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,OAAO,UAAU,CAAC"}
@@ -6,5 +6,5 @@
6
6
  // the root directory of this source tree.
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.VERSION = void 0;
9
- exports.VERSION = '0.4.3rc3'; // x-release-please-version
9
+ exports.VERSION = '0.4.4'; // x-release-please-version
10
10
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":";AAAA,qDAAqD;AACrD,uBAAuB;AACvB,EAAE;AACF,gFAAgF;AAChF,0CAA0C;;;AAE7B,QAAA,OAAO,GAAG,UAAU,CAAC,CAAC,2BAA2B"}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":";AAAA,qDAAqD;AACrD,uBAAuB;AACvB,EAAE;AACF,gFAAgF;AAChF,0CAA0C;;;AAE7B,QAAA,OAAO,GAAG,OAAO,CAAC,CAAC,2BAA2B"}
@@ -0,0 +1,7 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+ // All rights reserved.
3
+ //
4
+ // This source code is licensed under the terms described in the LICENSE file in
5
+ // the root directory of this source tree.
6
+ export const VERSION = '0.4.4'; // x-release-please-version
7
+ //# sourceMappingURL=version.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.mjs","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,uBAAuB;AACvB,EAAE;AACF,gFAAgF;AAChF,0CAA0C;AAE1C,MAAM,CAAC,MAAM,OAAO,GAAG,UAAU,CAAC,CAAC,2BAA2B"}
1
+ {"version":3,"file":"version.mjs","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,uBAAuB;AACvB,EAAE;AACF,gFAAgF;AAChF,0CAA0C;AAE1C,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC,CAAC,2BAA2B"}
package/examples/.keep ADDED
@@ -0,0 +1,4 @@
1
+ File generated from our OpenAPI spec by Stainless.
2
+
3
+ This directory can be used to store example files demonstrating usage of this SDK.
4
+ It is ignored by Stainless code generation and its content (other than this keep file) won't be touched.
package/jest.config.ts ADDED
@@ -0,0 +1,29 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+ // All rights reserved.
3
+ //
4
+ // This source code is licensed under the terms described in the LICENSE file in
5
+ // the root directory of this source tree.
6
+
7
+ import type { JestConfigWithTsJest } from 'ts-jest';
8
+
9
+ const config: JestConfigWithTsJest = {
10
+ preset: 'ts-jest/presets/default-esm',
11
+ testEnvironment: 'node',
12
+ transform: {
13
+ '^.+\\.(t|j)sx?$': ['@swc/jest', { sourceMaps: 'inline' }],
14
+ },
15
+ moduleNameMapper: {
16
+ '^llama-stack-client$': '<rootDir>/src/index.ts',
17
+ '^llama-stack-client/_shims/auto/(.*)$': '<rootDir>/src/_shims/auto/$1-node',
18
+ '^llama-stack-client/(.*)$': '<rootDir>/src/$1',
19
+ },
20
+ modulePathIgnorePatterns: [
21
+ '<rootDir>/ecosystem-tests/',
22
+ '<rootDir>/dist/',
23
+ '<rootDir>/deno/',
24
+ '<rootDir>/deno_tests/',
25
+ ],
26
+ testPathIgnorePatterns: ['scripts'],
27
+ };
28
+
29
+ export default config;