modelmix 2.2.4 → 2.3.2

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 (1131) hide show
  1. package/README.md +21 -8
  2. package/demo/default.env +1 -0
  3. package/demo/demo.mjs +14 -15
  4. package/demo/groq.mjs +24 -0
  5. package/demo/lmstudio.mjs +1 -1
  6. package/demo/package-lock.json +1 -50
  7. package/demo/package.json +1 -3
  8. package/demo/stream.mjs +3 -3
  9. package/demo/watson.jpg +0 -0
  10. package/index.js +54 -2
  11. package/package.json +4 -2
  12. package/demo/node_modules/.package-lock.json +0 -301
  13. package/demo/node_modules/@anthropic-ai/sdk/CHANGELOG.md +0 -859
  14. package/demo/node_modules/@anthropic-ai/sdk/LICENSE +0 -8
  15. package/demo/node_modules/@anthropic-ai/sdk/README.md +0 -424
  16. package/demo/node_modules/@anthropic-ai/sdk/_shims/MultipartBody.d.ts +0 -9
  17. package/demo/node_modules/@anthropic-ai/sdk/_shims/MultipartBody.d.ts.map +0 -1
  18. package/demo/node_modules/@anthropic-ai/sdk/_shims/MultipartBody.js +0 -16
  19. package/demo/node_modules/@anthropic-ai/sdk/_shims/MultipartBody.js.map +0 -1
  20. package/demo/node_modules/@anthropic-ai/sdk/_shims/MultipartBody.mjs +0 -12
  21. package/demo/node_modules/@anthropic-ai/sdk/_shims/MultipartBody.mjs.map +0 -1
  22. package/demo/node_modules/@anthropic-ai/sdk/_shims/README.md +0 -46
  23. package/demo/node_modules/@anthropic-ai/sdk/_shims/auto/runtime-bun.d.ts +0 -5
  24. package/demo/node_modules/@anthropic-ai/sdk/_shims/auto/runtime-bun.d.ts.map +0 -1
  25. package/demo/node_modules/@anthropic-ai/sdk/_shims/auto/runtime-bun.js +0 -21
  26. package/demo/node_modules/@anthropic-ai/sdk/_shims/auto/runtime-bun.js.map +0 -1
  27. package/demo/node_modules/@anthropic-ai/sdk/_shims/auto/runtime-bun.mjs +0 -2
  28. package/demo/node_modules/@anthropic-ai/sdk/_shims/auto/runtime-bun.mjs.map +0 -1
  29. package/demo/node_modules/@anthropic-ai/sdk/_shims/auto/runtime-node.d.ts +0 -5
  30. package/demo/node_modules/@anthropic-ai/sdk/_shims/auto/runtime-node.d.ts.map +0 -1
  31. package/demo/node_modules/@anthropic-ai/sdk/_shims/auto/runtime-node.js +0 -21
  32. package/demo/node_modules/@anthropic-ai/sdk/_shims/auto/runtime-node.js.map +0 -1
  33. package/demo/node_modules/@anthropic-ai/sdk/_shims/auto/runtime-node.mjs +0 -2
  34. package/demo/node_modules/@anthropic-ai/sdk/_shims/auto/runtime-node.mjs.map +0 -1
  35. package/demo/node_modules/@anthropic-ai/sdk/_shims/auto/runtime.d.ts +0 -5
  36. package/demo/node_modules/@anthropic-ai/sdk/_shims/auto/runtime.d.ts.map +0 -1
  37. package/demo/node_modules/@anthropic-ai/sdk/_shims/auto/runtime.js +0 -21
  38. package/demo/node_modules/@anthropic-ai/sdk/_shims/auto/runtime.js.map +0 -1
  39. package/demo/node_modules/@anthropic-ai/sdk/_shims/auto/runtime.mjs +0 -2
  40. package/demo/node_modules/@anthropic-ai/sdk/_shims/auto/runtime.mjs.map +0 -1
  41. package/demo/node_modules/@anthropic-ai/sdk/_shims/auto/types-node.d.ts +0 -5
  42. package/demo/node_modules/@anthropic-ai/sdk/_shims/auto/types-node.d.ts.map +0 -1
  43. package/demo/node_modules/@anthropic-ai/sdk/_shims/auto/types-node.js +0 -21
  44. package/demo/node_modules/@anthropic-ai/sdk/_shims/auto/types-node.js.map +0 -1
  45. package/demo/node_modules/@anthropic-ai/sdk/_shims/auto/types-node.mjs +0 -2
  46. package/demo/node_modules/@anthropic-ai/sdk/_shims/auto/types-node.mjs.map +0 -1
  47. package/demo/node_modules/@anthropic-ai/sdk/_shims/auto/types.d.ts +0 -101
  48. package/demo/node_modules/@anthropic-ai/sdk/_shims/auto/types.js +0 -3
  49. package/demo/node_modules/@anthropic-ai/sdk/_shims/auto/types.mjs +0 -3
  50. package/demo/node_modules/@anthropic-ai/sdk/_shims/bun-runtime.d.ts +0 -6
  51. package/demo/node_modules/@anthropic-ai/sdk/_shims/bun-runtime.d.ts.map +0 -1
  52. package/demo/node_modules/@anthropic-ai/sdk/_shims/bun-runtime.js +0 -14
  53. package/demo/node_modules/@anthropic-ai/sdk/_shims/bun-runtime.js.map +0 -1
  54. package/demo/node_modules/@anthropic-ai/sdk/_shims/bun-runtime.mjs +0 -10
  55. package/demo/node_modules/@anthropic-ai/sdk/_shims/bun-runtime.mjs.map +0 -1
  56. package/demo/node_modules/@anthropic-ai/sdk/_shims/index.d.ts +0 -81
  57. package/demo/node_modules/@anthropic-ai/sdk/_shims/index.js +0 -13
  58. package/demo/node_modules/@anthropic-ai/sdk/_shims/index.mjs +0 -7
  59. package/demo/node_modules/@anthropic-ai/sdk/_shims/manual-types.d.ts +0 -12
  60. package/demo/node_modules/@anthropic-ai/sdk/_shims/manual-types.js +0 -3
  61. package/demo/node_modules/@anthropic-ai/sdk/_shims/manual-types.mjs +0 -3
  62. package/demo/node_modules/@anthropic-ai/sdk/_shims/node-runtime.d.ts +0 -3
  63. package/demo/node_modules/@anthropic-ai/sdk/_shims/node-runtime.d.ts.map +0 -1
  64. package/demo/node_modules/@anthropic-ai/sdk/_shims/node-runtime.js +0 -90
  65. package/demo/node_modules/@anthropic-ai/sdk/_shims/node-runtime.js.map +0 -1
  66. package/demo/node_modules/@anthropic-ai/sdk/_shims/node-runtime.mjs +0 -56
  67. package/demo/node_modules/@anthropic-ai/sdk/_shims/node-runtime.mjs.map +0 -1
  68. package/demo/node_modules/@anthropic-ai/sdk/_shims/node-types.d.ts +0 -42
  69. package/demo/node_modules/@anthropic-ai/sdk/_shims/node-types.js +0 -3
  70. package/demo/node_modules/@anthropic-ai/sdk/_shims/node-types.mjs +0 -3
  71. package/demo/node_modules/@anthropic-ai/sdk/_shims/registry.d.ts +0 -37
  72. package/demo/node_modules/@anthropic-ai/sdk/_shims/registry.d.ts.map +0 -1
  73. package/demo/node_modules/@anthropic-ai/sdk/_shims/registry.js +0 -41
  74. package/demo/node_modules/@anthropic-ai/sdk/_shims/registry.js.map +0 -1
  75. package/demo/node_modules/@anthropic-ai/sdk/_shims/registry.mjs +0 -37
  76. package/demo/node_modules/@anthropic-ai/sdk/_shims/registry.mjs.map +0 -1
  77. package/demo/node_modules/@anthropic-ai/sdk/_shims/web-runtime.d.ts +0 -5
  78. package/demo/node_modules/@anthropic-ai/sdk/_shims/web-runtime.d.ts.map +0 -1
  79. package/demo/node_modules/@anthropic-ai/sdk/_shims/web-runtime.js +0 -78
  80. package/demo/node_modules/@anthropic-ai/sdk/_shims/web-runtime.js.map +0 -1
  81. package/demo/node_modules/@anthropic-ai/sdk/_shims/web-runtime.mjs +0 -71
  82. package/demo/node_modules/@anthropic-ai/sdk/_shims/web-runtime.mjs.map +0 -1
  83. package/demo/node_modules/@anthropic-ai/sdk/_shims/web-types.d.ts +0 -83
  84. package/demo/node_modules/@anthropic-ai/sdk/_shims/web-types.js +0 -3
  85. package/demo/node_modules/@anthropic-ai/sdk/_shims/web-types.mjs +0 -3
  86. package/demo/node_modules/@anthropic-ai/sdk/core.d.ts +0 -239
  87. package/demo/node_modules/@anthropic-ai/sdk/core.d.ts.map +0 -1
  88. package/demo/node_modules/@anthropic-ai/sdk/core.js +0 -879
  89. package/demo/node_modules/@anthropic-ai/sdk/core.js.map +0 -1
  90. package/demo/node_modules/@anthropic-ai/sdk/core.mjs +0 -848
  91. package/demo/node_modules/@anthropic-ai/sdk/core.mjs.map +0 -1
  92. package/demo/node_modules/@anthropic-ai/sdk/error.d.ts +0 -53
  93. package/demo/node_modules/@anthropic-ai/sdk/error.d.ts.map +0 -1
  94. package/demo/node_modules/@anthropic-ai/sdk/error.js +0 -143
  95. package/demo/node_modules/@anthropic-ai/sdk/error.js.map +0 -1
  96. package/demo/node_modules/@anthropic-ai/sdk/error.mjs +0 -127
  97. package/demo/node_modules/@anthropic-ai/sdk/error.mjs.map +0 -1
  98. package/demo/node_modules/@anthropic-ai/sdk/index.d.mts +0 -147
  99. package/demo/node_modules/@anthropic-ai/sdk/index.d.ts +0 -147
  100. package/demo/node_modules/@anthropic-ai/sdk/index.d.ts.map +0 -1
  101. package/demo/node_modules/@anthropic-ai/sdk/index.js +0 -149
  102. package/demo/node_modules/@anthropic-ai/sdk/index.js.map +0 -1
  103. package/demo/node_modules/@anthropic-ai/sdk/index.mjs +0 -121
  104. package/demo/node_modules/@anthropic-ai/sdk/index.mjs.map +0 -1
  105. package/demo/node_modules/@anthropic-ai/sdk/lib/MessageStream.d.ts +0 -94
  106. package/demo/node_modules/@anthropic-ai/sdk/lib/MessageStream.d.ts.map +0 -1
  107. package/demo/node_modules/@anthropic-ai/sdk/lib/MessageStream.js +0 -436
  108. package/demo/node_modules/@anthropic-ai/sdk/lib/MessageStream.js.map +0 -1
  109. package/demo/node_modules/@anthropic-ai/sdk/lib/MessageStream.mjs +0 -432
  110. package/demo/node_modules/@anthropic-ai/sdk/lib/MessageStream.mjs.map +0 -1
  111. package/demo/node_modules/@anthropic-ai/sdk/package.json +0 -104
  112. package/demo/node_modules/@anthropic-ai/sdk/resource.d.ts +0 -6
  113. package/demo/node_modules/@anthropic-ai/sdk/resource.d.ts.map +0 -1
  114. package/demo/node_modules/@anthropic-ai/sdk/resource.js +0 -11
  115. package/demo/node_modules/@anthropic-ai/sdk/resource.js.map +0 -1
  116. package/demo/node_modules/@anthropic-ai/sdk/resource.mjs +0 -7
  117. package/demo/node_modules/@anthropic-ai/sdk/resource.mjs.map +0 -1
  118. package/demo/node_modules/@anthropic-ai/sdk/resources/beta/beta.d.ts +0 -9
  119. package/demo/node_modules/@anthropic-ai/sdk/resources/beta/beta.d.ts.map +0 -1
  120. package/demo/node_modules/@anthropic-ai/sdk/resources/beta/beta.js +0 -40
  121. package/demo/node_modules/@anthropic-ai/sdk/resources/beta/beta.js.map +0 -1
  122. package/demo/node_modules/@anthropic-ai/sdk/resources/beta/beta.mjs +0 -13
  123. package/demo/node_modules/@anthropic-ai/sdk/resources/beta/beta.mjs.map +0 -1
  124. package/demo/node_modules/@anthropic-ai/sdk/resources/beta/index.d.ts +0 -3
  125. package/demo/node_modules/@anthropic-ai/sdk/resources/beta/index.d.ts.map +0 -1
  126. package/demo/node_modules/@anthropic-ai/sdk/resources/beta/index.js +0 -9
  127. package/demo/node_modules/@anthropic-ai/sdk/resources/beta/index.js.map +0 -1
  128. package/demo/node_modules/@anthropic-ai/sdk/resources/beta/index.mjs +0 -4
  129. package/demo/node_modules/@anthropic-ai/sdk/resources/beta/index.mjs.map +0 -1
  130. package/demo/node_modules/@anthropic-ai/sdk/resources/beta/tools/index.d.ts +0 -3
  131. package/demo/node_modules/@anthropic-ai/sdk/resources/beta/tools/index.d.ts.map +0 -1
  132. package/demo/node_modules/@anthropic-ai/sdk/resources/beta/tools/index.js +0 -9
  133. package/demo/node_modules/@anthropic-ai/sdk/resources/beta/tools/index.js.map +0 -1
  134. package/demo/node_modules/@anthropic-ai/sdk/resources/beta/tools/index.mjs +0 -4
  135. package/demo/node_modules/@anthropic-ai/sdk/resources/beta/tools/index.mjs.map +0 -1
  136. package/demo/node_modules/@anthropic-ai/sdk/resources/beta/tools/messages.d.ts +0 -462
  137. package/demo/node_modules/@anthropic-ai/sdk/resources/beta/tools/messages.d.ts.map +0 -1
  138. package/demo/node_modules/@anthropic-ai/sdk/resources/beta/tools/messages.js +0 -20
  139. package/demo/node_modules/@anthropic-ai/sdk/resources/beta/tools/messages.js.map +0 -1
  140. package/demo/node_modules/@anthropic-ai/sdk/resources/beta/tools/messages.mjs +0 -16
  141. package/demo/node_modules/@anthropic-ai/sdk/resources/beta/tools/messages.mjs.map +0 -1
  142. package/demo/node_modules/@anthropic-ai/sdk/resources/beta/tools/tools.d.ts +0 -19
  143. package/demo/node_modules/@anthropic-ai/sdk/resources/beta/tools/tools.d.ts.map +0 -1
  144. package/demo/node_modules/@anthropic-ai/sdk/resources/beta/tools/tools.js +0 -40
  145. package/demo/node_modules/@anthropic-ai/sdk/resources/beta/tools/tools.js.map +0 -1
  146. package/demo/node_modules/@anthropic-ai/sdk/resources/beta/tools/tools.mjs +0 -13
  147. package/demo/node_modules/@anthropic-ai/sdk/resources/beta/tools/tools.mjs.map +0 -1
  148. package/demo/node_modules/@anthropic-ai/sdk/resources/completions.d.ts +0 -184
  149. package/demo/node_modules/@anthropic-ai/sdk/resources/completions.d.ts.map +0 -1
  150. package/demo/node_modules/@anthropic-ai/sdk/resources/completions.js +0 -19
  151. package/demo/node_modules/@anthropic-ai/sdk/resources/completions.js.map +0 -1
  152. package/demo/node_modules/@anthropic-ai/sdk/resources/completions.mjs +0 -15
  153. package/demo/node_modules/@anthropic-ai/sdk/resources/completions.mjs.map +0 -1
  154. package/demo/node_modules/@anthropic-ai/sdk/resources/index.d.ts +0 -4
  155. package/demo/node_modules/@anthropic-ai/sdk/resources/index.d.ts.map +0 -1
  156. package/demo/node_modules/@anthropic-ai/sdk/resources/index.js +0 -11
  157. package/demo/node_modules/@anthropic-ai/sdk/resources/index.js.map +0 -1
  158. package/demo/node_modules/@anthropic-ai/sdk/resources/index.mjs +0 -5
  159. package/demo/node_modules/@anthropic-ai/sdk/resources/index.mjs.map +0 -1
  160. package/demo/node_modules/@anthropic-ai/sdk/resources/messages.d.ts +0 -619
  161. package/demo/node_modules/@anthropic-ai/sdk/resources/messages.d.ts.map +0 -1
  162. package/demo/node_modules/@anthropic-ai/sdk/resources/messages.js +0 -28
  163. package/demo/node_modules/@anthropic-ai/sdk/resources/messages.js.map +0 -1
  164. package/demo/node_modules/@anthropic-ai/sdk/resources/messages.mjs +0 -23
  165. package/demo/node_modules/@anthropic-ai/sdk/resources/messages.mjs.map +0 -1
  166. package/demo/node_modules/@anthropic-ai/sdk/resources/top-level.d.ts +0 -2
  167. package/demo/node_modules/@anthropic-ai/sdk/resources/top-level.d.ts.map +0 -1
  168. package/demo/node_modules/@anthropic-ai/sdk/resources/top-level.js +0 -4
  169. package/demo/node_modules/@anthropic-ai/sdk/resources/top-level.js.map +0 -1
  170. package/demo/node_modules/@anthropic-ai/sdk/resources/top-level.mjs +0 -3
  171. package/demo/node_modules/@anthropic-ai/sdk/resources/top-level.mjs.map +0 -1
  172. package/demo/node_modules/@anthropic-ai/sdk/shims/node.d.ts +0 -29
  173. package/demo/node_modules/@anthropic-ai/sdk/shims/node.d.ts.map +0 -1
  174. package/demo/node_modules/@anthropic-ai/sdk/shims/node.js +0 -31
  175. package/demo/node_modules/@anthropic-ai/sdk/shims/node.js.map +0 -1
  176. package/demo/node_modules/@anthropic-ai/sdk/shims/node.mjs +0 -5
  177. package/demo/node_modules/@anthropic-ai/sdk/shims/node.mjs.map +0 -1
  178. package/demo/node_modules/@anthropic-ai/sdk/shims/web.d.ts +0 -26
  179. package/demo/node_modules/@anthropic-ai/sdk/shims/web.d.ts.map +0 -1
  180. package/demo/node_modules/@anthropic-ai/sdk/shims/web.js +0 -31
  181. package/demo/node_modules/@anthropic-ai/sdk/shims/web.js.map +0 -1
  182. package/demo/node_modules/@anthropic-ai/sdk/shims/web.mjs +0 -5
  183. package/demo/node_modules/@anthropic-ai/sdk/shims/web.mjs.map +0 -1
  184. package/demo/node_modules/@anthropic-ai/sdk/src/_shims/MultipartBody.ts +0 -9
  185. package/demo/node_modules/@anthropic-ai/sdk/src/_shims/README.md +0 -46
  186. package/demo/node_modules/@anthropic-ai/sdk/src/_shims/auto/runtime-bun.ts +0 -4
  187. package/demo/node_modules/@anthropic-ai/sdk/src/_shims/auto/runtime-node.ts +0 -4
  188. package/demo/node_modules/@anthropic-ai/sdk/src/_shims/auto/runtime.ts +0 -4
  189. package/demo/node_modules/@anthropic-ai/sdk/src/_shims/auto/types-node.ts +0 -4
  190. package/demo/node_modules/@anthropic-ai/sdk/src/_shims/auto/types.d.ts +0 -101
  191. package/demo/node_modules/@anthropic-ai/sdk/src/_shims/auto/types.js +0 -3
  192. package/demo/node_modules/@anthropic-ai/sdk/src/_shims/auto/types.mjs +0 -3
  193. package/demo/node_modules/@anthropic-ai/sdk/src/_shims/bun-runtime.ts +0 -14
  194. package/demo/node_modules/@anthropic-ai/sdk/src/_shims/index.d.ts +0 -81
  195. package/demo/node_modules/@anthropic-ai/sdk/src/_shims/index.js +0 -13
  196. package/demo/node_modules/@anthropic-ai/sdk/src/_shims/index.mjs +0 -7
  197. package/demo/node_modules/@anthropic-ai/sdk/src/_shims/manual-types.d.ts +0 -12
  198. package/demo/node_modules/@anthropic-ai/sdk/src/_shims/manual-types.js +0 -3
  199. package/demo/node_modules/@anthropic-ai/sdk/src/_shims/manual-types.mjs +0 -3
  200. package/demo/node_modules/@anthropic-ai/sdk/src/_shims/node-runtime.ts +0 -83
  201. package/demo/node_modules/@anthropic-ai/sdk/src/_shims/node-types.d.ts +0 -42
  202. package/demo/node_modules/@anthropic-ai/sdk/src/_shims/node-types.js +0 -3
  203. package/demo/node_modules/@anthropic-ai/sdk/src/_shims/node-types.mjs +0 -3
  204. package/demo/node_modules/@anthropic-ai/sdk/src/_shims/registry.ts +0 -67
  205. package/demo/node_modules/@anthropic-ai/sdk/src/_shims/web-runtime.ts +0 -103
  206. package/demo/node_modules/@anthropic-ai/sdk/src/_shims/web-types.d.ts +0 -83
  207. package/demo/node_modules/@anthropic-ai/sdk/src/_shims/web-types.js +0 -3
  208. package/demo/node_modules/@anthropic-ai/sdk/src/_shims/web-types.mjs +0 -3
  209. package/demo/node_modules/@anthropic-ai/sdk/src/core.ts +0 -1162
  210. package/demo/node_modules/@anthropic-ai/sdk/src/error.ts +0 -146
  211. package/demo/node_modules/@anthropic-ai/sdk/src/index.ts +0 -264
  212. package/demo/node_modules/@anthropic-ai/sdk/src/lib/.keep +0 -4
  213. package/demo/node_modules/@anthropic-ai/sdk/src/lib/MessageStream.ts +0 -535
  214. package/demo/node_modules/@anthropic-ai/sdk/src/resource.ts +0 -11
  215. package/demo/node_modules/@anthropic-ai/sdk/src/resources/beta/beta.ts +0 -12
  216. package/demo/node_modules/@anthropic-ai/sdk/src/resources/beta/index.ts +0 -4
  217. package/demo/node_modules/@anthropic-ai/sdk/src/resources/beta/tools/index.ts +0 -16
  218. package/demo/node_modules/@anthropic-ai/sdk/src/resources/beta/tools/messages.ts +0 -531
  219. package/demo/node_modules/@anthropic-ai/sdk/src/resources/beta/tools/tools.ts +0 -22
  220. package/demo/node_modules/@anthropic-ai/sdk/src/resources/completions.ts +0 -223
  221. package/demo/node_modules/@anthropic-ai/sdk/src/resources/index.ts +0 -33
  222. package/demo/node_modules/@anthropic-ai/sdk/src/resources/messages.ts +0 -729
  223. package/demo/node_modules/@anthropic-ai/sdk/src/resources/top-level.ts +0 -3
  224. package/demo/node_modules/@anthropic-ai/sdk/src/shims/node.ts +0 -50
  225. package/demo/node_modules/@anthropic-ai/sdk/src/shims/web.ts +0 -50
  226. package/demo/node_modules/@anthropic-ai/sdk/src/streaming.ts +0 -509
  227. package/demo/node_modules/@anthropic-ai/sdk/src/tsconfig.json +0 -11
  228. package/demo/node_modules/@anthropic-ai/sdk/src/uploads.ts +0 -248
  229. package/demo/node_modules/@anthropic-ai/sdk/src/version.ts +0 -1
  230. package/demo/node_modules/@anthropic-ai/sdk/streaming.d.ts +0 -41
  231. package/demo/node_modules/@anthropic-ai/sdk/streaming.d.ts.map +0 -1
  232. package/demo/node_modules/@anthropic-ai/sdk/streaming.js +0 -431
  233. package/demo/node_modules/@anthropic-ai/sdk/streaming.js.map +0 -1
  234. package/demo/node_modules/@anthropic-ai/sdk/streaming.mjs +0 -424
  235. package/demo/node_modules/@anthropic-ai/sdk/streaming.mjs.map +0 -1
  236. package/demo/node_modules/@anthropic-ai/sdk/uploads.d.ts +0 -75
  237. package/demo/node_modules/@anthropic-ai/sdk/uploads.d.ts.map +0 -1
  238. package/demo/node_modules/@anthropic-ai/sdk/uploads.js +0 -165
  239. package/demo/node_modules/@anthropic-ai/sdk/uploads.js.map +0 -1
  240. package/demo/node_modules/@anthropic-ai/sdk/uploads.mjs +0 -152
  241. package/demo/node_modules/@anthropic-ai/sdk/uploads.mjs.map +0 -1
  242. package/demo/node_modules/@anthropic-ai/sdk/version.d.ts +0 -2
  243. package/demo/node_modules/@anthropic-ai/sdk/version.d.ts.map +0 -1
  244. package/demo/node_modules/@anthropic-ai/sdk/version.js +0 -5
  245. package/demo/node_modules/@anthropic-ai/sdk/version.js.map +0 -1
  246. package/demo/node_modules/@anthropic-ai/sdk/version.mjs +0 -2
  247. package/demo/node_modules/@anthropic-ai/sdk/version.mjs.map +0 -1
  248. package/demo/node_modules/@types/node/LICENSE +0 -21
  249. package/demo/node_modules/@types/node/README.md +0 -15
  250. package/demo/node_modules/@types/node/assert/strict.d.ts +0 -8
  251. package/demo/node_modules/@types/node/assert.d.ts +0 -985
  252. package/demo/node_modules/@types/node/async_hooks.d.ts +0 -522
  253. package/demo/node_modules/@types/node/buffer.d.ts +0 -2353
  254. package/demo/node_modules/@types/node/child_process.d.ts +0 -1544
  255. package/demo/node_modules/@types/node/cluster.d.ts +0 -578
  256. package/demo/node_modules/@types/node/console.d.ts +0 -452
  257. package/demo/node_modules/@types/node/constants.d.ts +0 -19
  258. package/demo/node_modules/@types/node/crypto.d.ts +0 -4457
  259. package/demo/node_modules/@types/node/dgram.d.ts +0 -596
  260. package/demo/node_modules/@types/node/diagnostics_channel.d.ts +0 -546
  261. package/demo/node_modules/@types/node/dns/promises.d.ts +0 -473
  262. package/demo/node_modules/@types/node/dns.d.ts +0 -853
  263. package/demo/node_modules/@types/node/dom-events.d.ts +0 -124
  264. package/demo/node_modules/@types/node/domain.d.ts +0 -170
  265. package/demo/node_modules/@types/node/events.d.ts +0 -819
  266. package/demo/node_modules/@types/node/fs/promises.d.ts +0 -1205
  267. package/demo/node_modules/@types/node/fs.d.ts +0 -4237
  268. package/demo/node_modules/@types/node/globals.d.ts +0 -377
  269. package/demo/node_modules/@types/node/globals.global.d.ts +0 -1
  270. package/demo/node_modules/@types/node/http.d.ts +0 -1803
  271. package/demo/node_modules/@types/node/http2.d.ts +0 -2392
  272. package/demo/node_modules/@types/node/https.d.ts +0 -544
  273. package/demo/node_modules/@types/node/index.d.ts +0 -88
  274. package/demo/node_modules/@types/node/inspector.d.ts +0 -2738
  275. package/demo/node_modules/@types/node/module.d.ts +0 -298
  276. package/demo/node_modules/@types/node/net.d.ts +0 -918
  277. package/demo/node_modules/@types/node/os.d.ts +0 -473
  278. package/demo/node_modules/@types/node/package.json +0 -222
  279. package/demo/node_modules/@types/node/path.d.ts +0 -191
  280. package/demo/node_modules/@types/node/perf_hooks.d.ts +0 -626
  281. package/demo/node_modules/@types/node/process.d.ts +0 -1548
  282. package/demo/node_modules/@types/node/punycode.d.ts +0 -117
  283. package/demo/node_modules/@types/node/querystring.d.ts +0 -141
  284. package/demo/node_modules/@types/node/readline/promises.d.ts +0 -143
  285. package/demo/node_modules/@types/node/readline.d.ts +0 -666
  286. package/demo/node_modules/@types/node/repl.d.ts +0 -430
  287. package/demo/node_modules/@types/node/stream/consumers.d.ts +0 -12
  288. package/demo/node_modules/@types/node/stream/promises.d.ts +0 -83
  289. package/demo/node_modules/@types/node/stream/web.d.ts +0 -352
  290. package/demo/node_modules/@types/node/stream.d.ts +0 -1731
  291. package/demo/node_modules/@types/node/string_decoder.d.ts +0 -67
  292. package/demo/node_modules/@types/node/test.d.ts +0 -1113
  293. package/demo/node_modules/@types/node/timers/promises.d.ts +0 -93
  294. package/demo/node_modules/@types/node/timers.d.ts +0 -126
  295. package/demo/node_modules/@types/node/tls.d.ts +0 -1203
  296. package/demo/node_modules/@types/node/trace_events.d.ts +0 -171
  297. package/demo/node_modules/@types/node/tty.d.ts +0 -206
  298. package/demo/node_modules/@types/node/url.d.ts +0 -954
  299. package/demo/node_modules/@types/node/util.d.ts +0 -2075
  300. package/demo/node_modules/@types/node/v8.d.ts +0 -753
  301. package/demo/node_modules/@types/node/vm.d.ts +0 -667
  302. package/demo/node_modules/@types/node/wasi.d.ts +0 -160
  303. package/demo/node_modules/@types/node/worker_threads.d.ts +0 -692
  304. package/demo/node_modules/@types/node/zlib.d.ts +0 -517
  305. package/demo/node_modules/@types/node-fetch/LICENSE +0 -21
  306. package/demo/node_modules/@types/node-fetch/README.md +0 -15
  307. package/demo/node_modules/@types/node-fetch/externals.d.ts +0 -32
  308. package/demo/node_modules/@types/node-fetch/index.d.ts +0 -238
  309. package/demo/node_modules/@types/node-fetch/package.json +0 -83
  310. package/demo/node_modules/abort-controller/LICENSE +0 -21
  311. package/demo/node_modules/abort-controller/README.md +0 -98
  312. package/demo/node_modules/abort-controller/browser.js +0 -13
  313. package/demo/node_modules/abort-controller/browser.mjs +0 -11
  314. package/demo/node_modules/abort-controller/package.json +0 -97
  315. package/demo/node_modules/abort-controller/polyfill.js +0 -21
  316. package/demo/node_modules/abort-controller/polyfill.mjs +0 -19
  317. package/demo/node_modules/agentkeepalive/History.md +0 -268
  318. package/demo/node_modules/agentkeepalive/LICENSE +0 -23
  319. package/demo/node_modules/agentkeepalive/README.md +0 -256
  320. package/demo/node_modules/agentkeepalive/browser.js +0 -5
  321. package/demo/node_modules/agentkeepalive/index.d.ts +0 -65
  322. package/demo/node_modules/agentkeepalive/index.js +0 -5
  323. package/demo/node_modules/agentkeepalive/lib/agent.js +0 -402
  324. package/demo/node_modules/agentkeepalive/lib/constants.js +0 -14
  325. package/demo/node_modules/agentkeepalive/lib/https_agent.js +0 -51
  326. package/demo/node_modules/agentkeepalive/package.json +0 -56
  327. package/demo/node_modules/asynckit/LICENSE +0 -21
  328. package/demo/node_modules/asynckit/README.md +0 -233
  329. package/demo/node_modules/asynckit/bench.js +0 -76
  330. package/demo/node_modules/asynckit/index.js +0 -6
  331. package/demo/node_modules/asynckit/lib/abort.js +0 -29
  332. package/demo/node_modules/asynckit/lib/async.js +0 -34
  333. package/demo/node_modules/asynckit/lib/defer.js +0 -26
  334. package/demo/node_modules/asynckit/lib/iterate.js +0 -75
  335. package/demo/node_modules/asynckit/lib/readable_asynckit.js +0 -91
  336. package/demo/node_modules/asynckit/lib/readable_parallel.js +0 -25
  337. package/demo/node_modules/asynckit/lib/readable_serial.js +0 -25
  338. package/demo/node_modules/asynckit/lib/readable_serial_ordered.js +0 -29
  339. package/demo/node_modules/asynckit/lib/state.js +0 -37
  340. package/demo/node_modules/asynckit/lib/streamify.js +0 -141
  341. package/demo/node_modules/asynckit/lib/terminator.js +0 -29
  342. package/demo/node_modules/asynckit/package.json +0 -63
  343. package/demo/node_modules/asynckit/parallel.js +0 -43
  344. package/demo/node_modules/asynckit/serial.js +0 -17
  345. package/demo/node_modules/asynckit/serialOrdered.js +0 -75
  346. package/demo/node_modules/asynckit/stream.js +0 -21
  347. package/demo/node_modules/combined-stream/License +0 -19
  348. package/demo/node_modules/combined-stream/Readme.md +0 -138
  349. package/demo/node_modules/combined-stream/lib/combined_stream.js +0 -208
  350. package/demo/node_modules/combined-stream/package.json +0 -25
  351. package/demo/node_modules/combined-stream/yarn.lock +0 -17
  352. package/demo/node_modules/debug/LICENSE +0 -20
  353. package/demo/node_modules/debug/README.md +0 -481
  354. package/demo/node_modules/debug/node_modules/ms/index.js +0 -162
  355. package/demo/node_modules/debug/node_modules/ms/license.md +0 -21
  356. package/demo/node_modules/debug/node_modules/ms/package.json +0 -37
  357. package/demo/node_modules/debug/node_modules/ms/readme.md +0 -60
  358. package/demo/node_modules/debug/package.json +0 -59
  359. package/demo/node_modules/debug/src/browser.js +0 -269
  360. package/demo/node_modules/debug/src/common.js +0 -274
  361. package/demo/node_modules/debug/src/index.js +0 -10
  362. package/demo/node_modules/debug/src/node.js +0 -263
  363. package/demo/node_modules/delayed-stream/License +0 -19
  364. package/demo/node_modules/delayed-stream/Makefile +0 -7
  365. package/demo/node_modules/delayed-stream/Readme.md +0 -141
  366. package/demo/node_modules/delayed-stream/lib/delayed_stream.js +0 -107
  367. package/demo/node_modules/delayed-stream/package.json +0 -27
  368. package/demo/node_modules/dotenv/CHANGELOG.md +0 -475
  369. package/demo/node_modules/dotenv/LICENSE +0 -23
  370. package/demo/node_modules/dotenv/README-es.md +0 -448
  371. package/demo/node_modules/dotenv/README.md +0 -728
  372. package/demo/node_modules/dotenv/config.d.ts +0 -1
  373. package/demo/node_modules/dotenv/config.js +0 -9
  374. package/demo/node_modules/dotenv/lib/cli-options.js +0 -11
  375. package/demo/node_modules/dotenv/lib/env-options.js +0 -24
  376. package/demo/node_modules/dotenv/lib/main.d.ts +0 -153
  377. package/demo/node_modules/dotenv/lib/main.js +0 -361
  378. package/demo/node_modules/dotenv/package.json +0 -65
  379. package/demo/node_modules/event-target-shim/LICENSE +0 -22
  380. package/demo/node_modules/event-target-shim/README.md +0 -293
  381. package/demo/node_modules/event-target-shim/index.d.ts +0 -399
  382. package/demo/node_modules/event-target-shim/package.json +0 -82
  383. package/demo/node_modules/form-data/License +0 -19
  384. package/demo/node_modules/form-data/README.md.bak +0 -358
  385. package/demo/node_modules/form-data/Readme.md +0 -358
  386. package/demo/node_modules/form-data/index.d.ts +0 -62
  387. package/demo/node_modules/form-data/lib/browser.js +0 -2
  388. package/demo/node_modules/form-data/lib/form_data.js +0 -501
  389. package/demo/node_modules/form-data/lib/populate.js +0 -10
  390. package/demo/node_modules/form-data/package.json +0 -68
  391. package/demo/node_modules/form-data-encoder/@type/FileLike.d.ts +0 -23
  392. package/demo/node_modules/form-data-encoder/@type/FormDataEncoder.d.ts +0 -160
  393. package/demo/node_modules/form-data-encoder/@type/FormDataLike.d.ts +0 -40
  394. package/demo/node_modules/form-data-encoder/@type/index.d.ts +0 -5
  395. package/demo/node_modules/form-data-encoder/@type/util/createBoundary.d.ts +0 -13
  396. package/demo/node_modules/form-data-encoder/@type/util/escapeName.d.ts +0 -11
  397. package/demo/node_modules/form-data-encoder/@type/util/isFileLike.d.ts +0 -28
  398. package/demo/node_modules/form-data-encoder/@type/util/isFormData.d.ts +0 -15
  399. package/demo/node_modules/form-data-encoder/@type/util/isFunction.d.ts +0 -7
  400. package/demo/node_modules/form-data-encoder/@type/util/isPlainObject.d.ts +0 -2
  401. package/demo/node_modules/form-data-encoder/@type/util/normalizeValue.d.ts +0 -11
  402. package/demo/node_modules/form-data-encoder/lib/cjs/FileLike.js +0 -2
  403. package/demo/node_modules/form-data-encoder/lib/cjs/FormDataEncoder.js +0 -126
  404. package/demo/node_modules/form-data-encoder/lib/cjs/FormDataLike.js +0 -2
  405. package/demo/node_modules/form-data-encoder/lib/cjs/index.js +0 -17
  406. package/demo/node_modules/form-data-encoder/lib/cjs/package.json +0 -3
  407. package/demo/node_modules/form-data-encoder/lib/cjs/util/createBoundary.js +0 -12
  408. package/demo/node_modules/form-data-encoder/lib/cjs/util/escapeName.js +0 -7
  409. package/demo/node_modules/form-data-encoder/lib/cjs/util/isFileLike.js +0 -16
  410. package/demo/node_modules/form-data-encoder/lib/cjs/util/isFormData.js +0 -16
  411. package/demo/node_modules/form-data-encoder/lib/cjs/util/isFunction.js +0 -4
  412. package/demo/node_modules/form-data-encoder/lib/cjs/util/isPlainObject.js +0 -15
  413. package/demo/node_modules/form-data-encoder/lib/cjs/util/normalizeValue.js +0 -11
  414. package/demo/node_modules/form-data-encoder/lib/esm/FileLike.js +0 -1
  415. package/demo/node_modules/form-data-encoder/lib/esm/FormDataEncoder.js +0 -119
  416. package/demo/node_modules/form-data-encoder/lib/esm/FormDataLike.js +0 -1
  417. package/demo/node_modules/form-data-encoder/lib/esm/index.js +0 -5
  418. package/demo/node_modules/form-data-encoder/lib/esm/package.json +0 -3
  419. package/demo/node_modules/form-data-encoder/lib/esm/util/createBoundary.js +0 -10
  420. package/demo/node_modules/form-data-encoder/lib/esm/util/escapeName.js +0 -5
  421. package/demo/node_modules/form-data-encoder/lib/esm/util/isFileLike.js +0 -9
  422. package/demo/node_modules/form-data-encoder/lib/esm/util/isFormData.js +0 -9
  423. package/demo/node_modules/form-data-encoder/lib/esm/util/isFunction.js +0 -2
  424. package/demo/node_modules/form-data-encoder/lib/esm/util/isPlainObject.js +0 -13
  425. package/demo/node_modules/form-data-encoder/lib/esm/util/normalizeValue.js +0 -9
  426. package/demo/node_modules/form-data-encoder/license +0 -21
  427. package/demo/node_modules/form-data-encoder/package.json +0 -63
  428. package/demo/node_modules/form-data-encoder/readme.md +0 -366
  429. package/demo/node_modules/formdata-node/@type/Blob.d.ts +0 -66
  430. package/demo/node_modules/formdata-node/@type/BlobPart.d.ts +0 -2
  431. package/demo/node_modules/formdata-node/@type/File.d.ts +0 -53
  432. package/demo/node_modules/formdata-node/@type/FormData.d.ts +0 -105
  433. package/demo/node_modules/formdata-node/@type/blobHelpers.d.ts +0 -9
  434. package/demo/node_modules/formdata-node/@type/browser.d.ts +0 -10
  435. package/demo/node_modules/formdata-node/@type/deprecateConstructorEntries.d.ts +0 -1
  436. package/demo/node_modules/formdata-node/@type/fileFromPath.d.ts +0 -55
  437. package/demo/node_modules/formdata-node/@type/index.d.ts +0 -3
  438. package/demo/node_modules/formdata-node/@type/isBlob.d.ts +0 -2
  439. package/demo/node_modules/formdata-node/@type/isFile.d.ts +0 -7
  440. package/demo/node_modules/formdata-node/@type/isFunction.d.ts +0 -1
  441. package/demo/node_modules/formdata-node/@type/isPlainObject.d.ts +0 -2
  442. package/demo/node_modules/formdata-node/lib/cjs/Blob.js +0 -122
  443. package/demo/node_modules/formdata-node/lib/cjs/BlobPart.js +0 -2
  444. package/demo/node_modules/formdata-node/lib/cjs/File.js +0 -52
  445. package/demo/node_modules/formdata-node/lib/cjs/FormData.js +0 -148
  446. package/demo/node_modules/formdata-node/lib/cjs/blobHelpers.js +0 -80
  447. package/demo/node_modules/formdata-node/lib/cjs/browser.js +0 -13
  448. package/demo/node_modules/formdata-node/lib/cjs/deprecateConstructorEntries.js +0 -6
  449. package/demo/node_modules/formdata-node/lib/cjs/fileFromPath.js +0 -97
  450. package/demo/node_modules/formdata-node/lib/cjs/index.js +0 -15
  451. package/demo/node_modules/formdata-node/lib/cjs/isBlob.js +0 -6
  452. package/demo/node_modules/formdata-node/lib/cjs/isFile.js +0 -6
  453. package/demo/node_modules/formdata-node/lib/cjs/isFunction.js +0 -5
  454. package/demo/node_modules/formdata-node/lib/cjs/isPlainObject.js +0 -15
  455. package/demo/node_modules/formdata-node/lib/cjs/package.json +0 -3
  456. package/demo/node_modules/formdata-node/lib/esm/Blob.js +0 -118
  457. package/demo/node_modules/formdata-node/lib/esm/BlobPart.js +0 -1
  458. package/demo/node_modules/formdata-node/lib/esm/File.js +0 -48
  459. package/demo/node_modules/formdata-node/lib/esm/FormData.js +0 -144
  460. package/demo/node_modules/formdata-node/lib/esm/blobHelpers.js +0 -75
  461. package/demo/node_modules/formdata-node/lib/esm/browser.js +0 -10
  462. package/demo/node_modules/formdata-node/lib/esm/deprecateConstructorEntries.js +0 -3
  463. package/demo/node_modules/formdata-node/lib/esm/fileFromPath.js +0 -79
  464. package/demo/node_modules/formdata-node/lib/esm/index.js +0 -3
  465. package/demo/node_modules/formdata-node/lib/esm/isBlob.js +0 -2
  466. package/demo/node_modules/formdata-node/lib/esm/isFile.js +0 -2
  467. package/demo/node_modules/formdata-node/lib/esm/isFunction.js +0 -1
  468. package/demo/node_modules/formdata-node/lib/esm/isPlainObject.js +0 -13
  469. package/demo/node_modules/formdata-node/lib/esm/package.json +0 -3
  470. package/demo/node_modules/formdata-node/lib/node-domexception.d.ts +0 -5
  471. package/demo/node_modules/formdata-node/license +0 -21
  472. package/demo/node_modules/formdata-node/node_modules/web-streams-polyfill/LICENSE +0 -22
  473. package/demo/node_modules/formdata-node/node_modules/web-streams-polyfill/README.md +0 -135
  474. package/demo/node_modules/formdata-node/node_modules/web-streams-polyfill/es5/package.json +0 -6
  475. package/demo/node_modules/formdata-node/node_modules/web-streams-polyfill/package.json +0 -101
  476. package/demo/node_modules/formdata-node/node_modules/web-streams-polyfill/polyfill/es5/package.json +0 -5
  477. package/demo/node_modules/formdata-node/node_modules/web-streams-polyfill/polyfill/package.json +0 -5
  478. package/demo/node_modules/formdata-node/node_modules/web-streams-polyfill/types/polyfill.d.ts +0 -62
  479. package/demo/node_modules/formdata-node/node_modules/web-streams-polyfill/types/ponyfill.d.ts +0 -775
  480. package/demo/node_modules/formdata-node/node_modules/web-streams-polyfill/types/tsdoc-metadata.json +0 -11
  481. package/demo/node_modules/formdata-node/package.json +0 -94
  482. package/demo/node_modules/formdata-node/readme.md +0 -444
  483. package/demo/node_modules/humanize-ms/History.md +0 -25
  484. package/demo/node_modules/humanize-ms/LICENSE +0 -17
  485. package/demo/node_modules/humanize-ms/README.md +0 -40
  486. package/demo/node_modules/humanize-ms/index.js +0 -24
  487. package/demo/node_modules/humanize-ms/package.json +0 -37
  488. package/demo/node_modules/lemonlog/README.md +0 -133
  489. package/demo/node_modules/lemonlog/demo/demo.js +0 -31
  490. package/demo/node_modules/lemonlog/index.js +0 -94
  491. package/demo/node_modules/lemonlog/package.json +0 -31
  492. package/demo/node_modules/mime-db/HISTORY.md +0 -507
  493. package/demo/node_modules/mime-db/LICENSE +0 -23
  494. package/demo/node_modules/mime-db/README.md +0 -100
  495. package/demo/node_modules/mime-db/db.json +0 -8519
  496. package/demo/node_modules/mime-db/index.js +0 -12
  497. package/demo/node_modules/mime-db/package.json +0 -60
  498. package/demo/node_modules/mime-types/HISTORY.md +0 -397
  499. package/demo/node_modules/mime-types/LICENSE +0 -23
  500. package/demo/node_modules/mime-types/README.md +0 -113
  501. package/demo/node_modules/mime-types/index.js +0 -188
  502. package/demo/node_modules/mime-types/package.json +0 -44
  503. package/demo/node_modules/ms/index.js +0 -162
  504. package/demo/node_modules/ms/license.md +0 -21
  505. package/demo/node_modules/ms/package.json +0 -38
  506. package/demo/node_modules/ms/readme.md +0 -59
  507. package/demo/node_modules/node-domexception/.history/README_20210527203617.md +0 -2
  508. package/demo/node_modules/node-domexception/.history/README_20210527212714.md +0 -41
  509. package/demo/node_modules/node-domexception/.history/README_20210527213345.md +0 -36
  510. package/demo/node_modules/node-domexception/.history/README_20210527213411.md +0 -36
  511. package/demo/node_modules/node-domexception/.history/README_20210527213803.md +0 -36
  512. package/demo/node_modules/node-domexception/.history/README_20210527214323.md +0 -38
  513. package/demo/node_modules/node-domexception/.history/README_20210527214408.md +0 -38
  514. package/demo/node_modules/node-domexception/.history/index_20210527203842.js +0 -0
  515. package/demo/node_modules/node-domexception/.history/index_20210527203947.js +0 -8
  516. package/demo/node_modules/node-domexception/.history/index_20210527204259.js +0 -9
  517. package/demo/node_modules/node-domexception/.history/index_20210527204418.js +0 -9
  518. package/demo/node_modules/node-domexception/.history/index_20210527204756.js +0 -11
  519. package/demo/node_modules/node-domexception/.history/index_20210527204833.js +0 -11
  520. package/demo/node_modules/node-domexception/.history/index_20210527211208.js +0 -15
  521. package/demo/node_modules/node-domexception/.history/index_20210527211248.js +0 -15
  522. package/demo/node_modules/node-domexception/.history/index_20210527212722.js +0 -23
  523. package/demo/node_modules/node-domexception/.history/index_20210527212731.js +0 -23
  524. package/demo/node_modules/node-domexception/.history/index_20210527212746.js +0 -15
  525. package/demo/node_modules/node-domexception/.history/index_20210527212900.js +0 -16
  526. package/demo/node_modules/node-domexception/.history/index_20210527213022.js +0 -16
  527. package/demo/node_modules/node-domexception/.history/index_20210527213822.js +0 -16
  528. package/demo/node_modules/node-domexception/.history/index_20210527213843.js +0 -17
  529. package/demo/node_modules/node-domexception/.history/index_20210527213852.js +0 -17
  530. package/demo/node_modules/node-domexception/.history/index_20210527213910.js +0 -16
  531. package/demo/node_modules/node-domexception/.history/index_20210527214034.js +0 -16
  532. package/demo/node_modules/node-domexception/.history/index_20210527214643.js +0 -41
  533. package/demo/node_modules/node-domexception/.history/index_20210527214654.js +0 -41
  534. package/demo/node_modules/node-domexception/.history/index_20210527214700.js +0 -16
  535. package/demo/node_modules/node-domexception/.history/package_20210527203733.json +0 -19
  536. package/demo/node_modules/node-domexception/.history/package_20210527203825.json +0 -16
  537. package/demo/node_modules/node-domexception/.history/package_20210527204621.json +0 -19
  538. package/demo/node_modules/node-domexception/.history/package_20210527204913.json +0 -25
  539. package/demo/node_modules/node-domexception/.history/package_20210527204925.json +0 -25
  540. package/demo/node_modules/node-domexception/.history/package_20210527205145.json +0 -29
  541. package/demo/node_modules/node-domexception/.history/package_20210527205156.json +0 -29
  542. package/demo/node_modules/node-domexception/.history/test_20210527205603.js +0 -0
  543. package/demo/node_modules/node-domexception/.history/test_20210527205957.js +0 -3
  544. package/demo/node_modules/node-domexception/.history/test_20210527210021.js +0 -3
  545. package/demo/node_modules/node-domexception/LICENSE +0 -21
  546. package/demo/node_modules/node-domexception/README.md +0 -46
  547. package/demo/node_modules/node-domexception/index.js +0 -16
  548. package/demo/node_modules/node-domexception/package.json +0 -29
  549. package/demo/node_modules/node-fetch/LICENSE.md +0 -22
  550. package/demo/node_modules/node-fetch/README.md +0 -634
  551. package/demo/node_modules/node-fetch/browser.js +0 -25
  552. package/demo/node_modules/node-fetch/lib/index.es.js +0 -1777
  553. package/demo/node_modules/node-fetch/lib/index.js +0 -1787
  554. package/demo/node_modules/node-fetch/lib/index.mjs +0 -1775
  555. package/demo/node_modules/node-fetch/package.json +0 -89
  556. package/demo/node_modules/openai/CHANGELOG.md +0 -1176
  557. package/demo/node_modules/openai/LICENSE +0 -201
  558. package/demo/node_modules/openai/README.md +0 -616
  559. package/demo/node_modules/openai/_shims/MultipartBody.d.ts +0 -9
  560. package/demo/node_modules/openai/_shims/MultipartBody.d.ts.map +0 -1
  561. package/demo/node_modules/openai/_shims/MultipartBody.js +0 -16
  562. package/demo/node_modules/openai/_shims/MultipartBody.js.map +0 -1
  563. package/demo/node_modules/openai/_shims/MultipartBody.mjs +0 -12
  564. package/demo/node_modules/openai/_shims/MultipartBody.mjs.map +0 -1
  565. package/demo/node_modules/openai/_shims/README.md +0 -46
  566. package/demo/node_modules/openai/_shims/auto/runtime-bun.d.ts +0 -5
  567. package/demo/node_modules/openai/_shims/auto/runtime-bun.d.ts.map +0 -1
  568. package/demo/node_modules/openai/_shims/auto/runtime-bun.js +0 -21
  569. package/demo/node_modules/openai/_shims/auto/runtime-bun.js.map +0 -1
  570. package/demo/node_modules/openai/_shims/auto/runtime-bun.mjs +0 -2
  571. package/demo/node_modules/openai/_shims/auto/runtime-bun.mjs.map +0 -1
  572. package/demo/node_modules/openai/_shims/auto/runtime-node.d.ts +0 -5
  573. package/demo/node_modules/openai/_shims/auto/runtime-node.d.ts.map +0 -1
  574. package/demo/node_modules/openai/_shims/auto/runtime-node.js +0 -21
  575. package/demo/node_modules/openai/_shims/auto/runtime-node.js.map +0 -1
  576. package/demo/node_modules/openai/_shims/auto/runtime-node.mjs +0 -2
  577. package/demo/node_modules/openai/_shims/auto/runtime-node.mjs.map +0 -1
  578. package/demo/node_modules/openai/_shims/auto/runtime.d.ts +0 -5
  579. package/demo/node_modules/openai/_shims/auto/runtime.d.ts.map +0 -1
  580. package/demo/node_modules/openai/_shims/auto/runtime.js +0 -21
  581. package/demo/node_modules/openai/_shims/auto/runtime.js.map +0 -1
  582. package/demo/node_modules/openai/_shims/auto/runtime.mjs +0 -2
  583. package/demo/node_modules/openai/_shims/auto/runtime.mjs.map +0 -1
  584. package/demo/node_modules/openai/_shims/auto/types-node.d.ts +0 -5
  585. package/demo/node_modules/openai/_shims/auto/types-node.d.ts.map +0 -1
  586. package/demo/node_modules/openai/_shims/auto/types-node.js +0 -21
  587. package/demo/node_modules/openai/_shims/auto/types-node.js.map +0 -1
  588. package/demo/node_modules/openai/_shims/auto/types-node.mjs +0 -2
  589. package/demo/node_modules/openai/_shims/auto/types-node.mjs.map +0 -1
  590. package/demo/node_modules/openai/_shims/auto/types.d.ts +0 -101
  591. package/demo/node_modules/openai/_shims/auto/types.js +0 -3
  592. package/demo/node_modules/openai/_shims/auto/types.mjs +0 -3
  593. package/demo/node_modules/openai/_shims/bun-runtime.d.ts +0 -6
  594. package/demo/node_modules/openai/_shims/bun-runtime.d.ts.map +0 -1
  595. package/demo/node_modules/openai/_shims/bun-runtime.js +0 -14
  596. package/demo/node_modules/openai/_shims/bun-runtime.js.map +0 -1
  597. package/demo/node_modules/openai/_shims/bun-runtime.mjs +0 -10
  598. package/demo/node_modules/openai/_shims/bun-runtime.mjs.map +0 -1
  599. package/demo/node_modules/openai/_shims/index.d.ts +0 -81
  600. package/demo/node_modules/openai/_shims/index.js +0 -13
  601. package/demo/node_modules/openai/_shims/index.mjs +0 -7
  602. package/demo/node_modules/openai/_shims/manual-types.d.ts +0 -12
  603. package/demo/node_modules/openai/_shims/manual-types.js +0 -3
  604. package/demo/node_modules/openai/_shims/manual-types.mjs +0 -3
  605. package/demo/node_modules/openai/_shims/node-runtime.d.ts +0 -3
  606. package/demo/node_modules/openai/_shims/node-runtime.d.ts.map +0 -1
  607. package/demo/node_modules/openai/_shims/node-runtime.js +0 -90
  608. package/demo/node_modules/openai/_shims/node-runtime.js.map +0 -1
  609. package/demo/node_modules/openai/_shims/node-runtime.mjs +0 -56
  610. package/demo/node_modules/openai/_shims/node-runtime.mjs.map +0 -1
  611. package/demo/node_modules/openai/_shims/node-types.d.ts +0 -42
  612. package/demo/node_modules/openai/_shims/node-types.js +0 -3
  613. package/demo/node_modules/openai/_shims/node-types.mjs +0 -3
  614. package/demo/node_modules/openai/_shims/registry.d.ts +0 -37
  615. package/demo/node_modules/openai/_shims/registry.d.ts.map +0 -1
  616. package/demo/node_modules/openai/_shims/registry.js +0 -41
  617. package/demo/node_modules/openai/_shims/registry.js.map +0 -1
  618. package/demo/node_modules/openai/_shims/registry.mjs +0 -37
  619. package/demo/node_modules/openai/_shims/registry.mjs.map +0 -1
  620. package/demo/node_modules/openai/_shims/web-runtime.d.ts +0 -5
  621. package/demo/node_modules/openai/_shims/web-runtime.d.ts.map +0 -1
  622. package/demo/node_modules/openai/_shims/web-runtime.js +0 -78
  623. package/demo/node_modules/openai/_shims/web-runtime.js.map +0 -1
  624. package/demo/node_modules/openai/_shims/web-runtime.mjs +0 -71
  625. package/demo/node_modules/openai/_shims/web-runtime.mjs.map +0 -1
  626. package/demo/node_modules/openai/_shims/web-types.d.ts +0 -83
  627. package/demo/node_modules/openai/_shims/web-types.js +0 -3
  628. package/demo/node_modules/openai/_shims/web-types.mjs +0 -3
  629. package/demo/node_modules/openai/bin/cli +0 -49
  630. package/demo/node_modules/openai/core.d.ts +0 -239
  631. package/demo/node_modules/openai/core.d.ts.map +0 -1
  632. package/demo/node_modules/openai/core.js +0 -879
  633. package/demo/node_modules/openai/core.js.map +0 -1
  634. package/demo/node_modules/openai/core.mjs +0 -848
  635. package/demo/node_modules/openai/core.mjs.map +0 -1
  636. package/demo/node_modules/openai/error.d.ts +0 -57
  637. package/demo/node_modules/openai/error.d.ts.map +0 -1
  638. package/demo/node_modules/openai/error.js +0 -148
  639. package/demo/node_modules/openai/error.js.map +0 -1
  640. package/demo/node_modules/openai/error.mjs +0 -132
  641. package/demo/node_modules/openai/error.mjs.map +0 -1
  642. package/demo/node_modules/openai/index.d.mts +0 -267
  643. package/demo/node_modules/openai/index.d.ts +0 -267
  644. package/demo/node_modules/openai/index.d.ts.map +0 -1
  645. package/demo/node_modules/openai/index.js +0 -262
  646. package/demo/node_modules/openai/index.js.map +0 -1
  647. package/demo/node_modules/openai/index.mjs +0 -232
  648. package/demo/node_modules/openai/index.mjs.map +0 -1
  649. package/demo/node_modules/openai/lib/AbstractAssistantStreamRunner.d.ts +0 -74
  650. package/demo/node_modules/openai/lib/AbstractAssistantStreamRunner.d.ts.map +0 -1
  651. package/demo/node_modules/openai/lib/AbstractAssistantStreamRunner.js +0 -246
  652. package/demo/node_modules/openai/lib/AbstractAssistantStreamRunner.js.map +0 -1
  653. package/demo/node_modules/openai/lib/AbstractAssistantStreamRunner.mjs +0 -242
  654. package/demo/node_modules/openai/lib/AbstractAssistantStreamRunner.mjs.map +0 -1
  655. package/demo/node_modules/openai/lib/AbstractChatCompletionRunner.d.ts +0 -114
  656. package/demo/node_modules/openai/lib/AbstractChatCompletionRunner.d.ts.map +0 -1
  657. package/demo/node_modules/openai/lib/AbstractChatCompletionRunner.js +0 -519
  658. package/demo/node_modules/openai/lib/AbstractChatCompletionRunner.js.map +0 -1
  659. package/demo/node_modules/openai/lib/AbstractChatCompletionRunner.mjs +0 -515
  660. package/demo/node_modules/openai/lib/AbstractChatCompletionRunner.mjs.map +0 -1
  661. package/demo/node_modules/openai/lib/AssistantStream.d.ts +0 -58
  662. package/demo/node_modules/openai/lib/AssistantStream.d.ts.map +0 -1
  663. package/demo/node_modules/openai/lib/AssistantStream.js +0 -548
  664. package/demo/node_modules/openai/lib/AssistantStream.js.map +0 -1
  665. package/demo/node_modules/openai/lib/AssistantStream.mjs +0 -521
  666. package/demo/node_modules/openai/lib/AssistantStream.mjs.map +0 -1
  667. package/demo/node_modules/openai/lib/ChatCompletionRunFunctions.test.d.ts +0 -2
  668. package/demo/node_modules/openai/lib/ChatCompletionRunFunctions.test.d.ts.map +0 -1
  669. package/demo/node_modules/openai/lib/ChatCompletionRunFunctions.test.js +0 -2177
  670. package/demo/node_modules/openai/lib/ChatCompletionRunFunctions.test.js.map +0 -1
  671. package/demo/node_modules/openai/lib/ChatCompletionRunFunctions.test.mjs +0 -2172
  672. package/demo/node_modules/openai/lib/ChatCompletionRunFunctions.test.mjs.map +0 -1
  673. package/demo/node_modules/openai/lib/ChatCompletionRunner.d.ts +0 -19
  674. package/demo/node_modules/openai/lib/ChatCompletionRunner.d.ts.map +0 -1
  675. package/demo/node_modules/openai/lib/ChatCompletionRunner.js +0 -34
  676. package/demo/node_modules/openai/lib/ChatCompletionRunner.js.map +0 -1
  677. package/demo/node_modules/openai/lib/ChatCompletionRunner.mjs +0 -30
  678. package/demo/node_modules/openai/lib/ChatCompletionRunner.mjs.map +0 -1
  679. package/demo/node_modules/openai/lib/ChatCompletionStream.d.ts +0 -149
  680. package/demo/node_modules/openai/lib/ChatCompletionStream.d.ts.map +0 -1
  681. package/demo/node_modules/openai/lib/ChatCompletionStream.js +0 -312
  682. package/demo/node_modules/openai/lib/ChatCompletionStream.js.map +0 -1
  683. package/demo/node_modules/openai/lib/ChatCompletionStream.mjs +0 -308
  684. package/demo/node_modules/openai/lib/ChatCompletionStream.mjs.map +0 -1
  685. package/demo/node_modules/openai/lib/ChatCompletionStreamingRunner.d.ts +0 -22
  686. package/demo/node_modules/openai/lib/ChatCompletionStreamingRunner.d.ts.map +0 -1
  687. package/demo/node_modules/openai/lib/ChatCompletionStreamingRunner.js +0 -32
  688. package/demo/node_modules/openai/lib/ChatCompletionStreamingRunner.js.map +0 -1
  689. package/demo/node_modules/openai/lib/ChatCompletionStreamingRunner.mjs +0 -28
  690. package/demo/node_modules/openai/lib/ChatCompletionStreamingRunner.mjs.map +0 -1
  691. package/demo/node_modules/openai/lib/RunnableFunction.d.ts +0 -95
  692. package/demo/node_modules/openai/lib/RunnableFunction.d.ts.map +0 -1
  693. package/demo/node_modules/openai/lib/RunnableFunction.js +0 -35
  694. package/demo/node_modules/openai/lib/RunnableFunction.js.map +0 -1
  695. package/demo/node_modules/openai/lib/RunnableFunction.mjs +0 -29
  696. package/demo/node_modules/openai/lib/RunnableFunction.mjs.map +0 -1
  697. package/demo/node_modules/openai/lib/Util.d.ts +0 -5
  698. package/demo/node_modules/openai/lib/Util.d.ts.map +0 -1
  699. package/demo/node_modules/openai/lib/Util.js +0 -26
  700. package/demo/node_modules/openai/lib/Util.js.map +0 -1
  701. package/demo/node_modules/openai/lib/Util.mjs +0 -22
  702. package/demo/node_modules/openai/lib/Util.mjs.map +0 -1
  703. package/demo/node_modules/openai/lib/chatCompletionUtils.d.ts +0 -6
  704. package/demo/node_modules/openai/lib/chatCompletionUtils.d.ts.map +0 -1
  705. package/demo/node_modules/openai/lib/chatCompletionUtils.js +0 -20
  706. package/demo/node_modules/openai/lib/chatCompletionUtils.js.map +0 -1
  707. package/demo/node_modules/openai/lib/chatCompletionUtils.mjs +0 -13
  708. package/demo/node_modules/openai/lib/chatCompletionUtils.mjs.map +0 -1
  709. package/demo/node_modules/openai/lib/jsonschema.d.ts +0 -106
  710. package/demo/node_modules/openai/lib/jsonschema.d.ts.map +0 -1
  711. package/demo/node_modules/openai/lib/jsonschema.js +0 -11
  712. package/demo/node_modules/openai/lib/jsonschema.js.map +0 -1
  713. package/demo/node_modules/openai/lib/jsonschema.mjs +0 -10
  714. package/demo/node_modules/openai/lib/jsonschema.mjs.map +0 -1
  715. package/demo/node_modules/openai/package.json +0 -105
  716. package/demo/node_modules/openai/pagination.d.ts +0 -37
  717. package/demo/node_modules/openai/pagination.d.ts.map +0 -1
  718. package/demo/node_modules/openai/pagination.js +0 -64
  719. package/demo/node_modules/openai/pagination.js.map +0 -1
  720. package/demo/node_modules/openai/pagination.mjs +0 -59
  721. package/demo/node_modules/openai/pagination.mjs.map +0 -1
  722. package/demo/node_modules/openai/resource.d.ts +0 -6
  723. package/demo/node_modules/openai/resource.d.ts.map +0 -1
  724. package/demo/node_modules/openai/resource.js +0 -11
  725. package/demo/node_modules/openai/resource.js.map +0 -1
  726. package/demo/node_modules/openai/resource.mjs +0 -7
  727. package/demo/node_modules/openai/resource.mjs.map +0 -1
  728. package/demo/node_modules/openai/resources/audio/audio.d.ts +0 -20
  729. package/demo/node_modules/openai/resources/audio/audio.d.ts.map +0 -1
  730. package/demo/node_modules/openai/resources/audio/audio.js +0 -46
  731. package/demo/node_modules/openai/resources/audio/audio.js.map +0 -1
  732. package/demo/node_modules/openai/resources/audio/audio.mjs +0 -19
  733. package/demo/node_modules/openai/resources/audio/audio.mjs.map +0 -1
  734. package/demo/node_modules/openai/resources/audio/index.d.ts +0 -5
  735. package/demo/node_modules/openai/resources/audio/index.d.ts.map +0 -1
  736. package/demo/node_modules/openai/resources/audio/index.js +0 -13
  737. package/demo/node_modules/openai/resources/audio/index.js.map +0 -1
  738. package/demo/node_modules/openai/resources/audio/index.mjs +0 -6
  739. package/demo/node_modules/openai/resources/audio/index.mjs.map +0 -1
  740. package/demo/node_modules/openai/resources/audio/speech.d.ts +0 -42
  741. package/demo/node_modules/openai/resources/audio/speech.d.ts.map +0 -1
  742. package/demo/node_modules/openai/resources/audio/speech.js +0 -17
  743. package/demo/node_modules/openai/resources/audio/speech.js.map +0 -1
  744. package/demo/node_modules/openai/resources/audio/speech.mjs +0 -13
  745. package/demo/node_modules/openai/resources/audio/speech.mjs.map +0 -1
  746. package/demo/node_modules/openai/resources/audio/transcriptions.d.ts +0 -71
  747. package/demo/node_modules/openai/resources/audio/transcriptions.d.ts.map +0 -1
  748. package/demo/node_modules/openai/resources/audio/transcriptions.js +0 -18
  749. package/demo/node_modules/openai/resources/audio/transcriptions.js.map +0 -1
  750. package/demo/node_modules/openai/resources/audio/transcriptions.mjs +0 -14
  751. package/demo/node_modules/openai/resources/audio/transcriptions.mjs.map +0 -1
  752. package/demo/node_modules/openai/resources/audio/translations.d.ts +0 -50
  753. package/demo/node_modules/openai/resources/audio/translations.d.ts.map +0 -1
  754. package/demo/node_modules/openai/resources/audio/translations.js +0 -18
  755. package/demo/node_modules/openai/resources/audio/translations.js.map +0 -1
  756. package/demo/node_modules/openai/resources/audio/translations.mjs +0 -14
  757. package/demo/node_modules/openai/resources/audio/translations.mjs.map +0 -1
  758. package/demo/node_modules/openai/resources/batches.d.ts +0 -189
  759. package/demo/node_modules/openai/resources/batches.d.ts.map +0 -1
  760. package/demo/node_modules/openai/resources/batches.js +0 -65
  761. package/demo/node_modules/openai/resources/batches.js.map +0 -1
  762. package/demo/node_modules/openai/resources/batches.mjs +0 -37
  763. package/demo/node_modules/openai/resources/batches.mjs.map +0 -1
  764. package/demo/node_modules/openai/resources/beta/assistants.d.ts +0 -1048
  765. package/demo/node_modules/openai/resources/beta/assistants.d.ts.map +0 -1
  766. package/demo/node_modules/openai/resources/beta/assistants.js +0 -89
  767. package/demo/node_modules/openai/resources/beta/assistants.js.map +0 -1
  768. package/demo/node_modules/openai/resources/beta/assistants.mjs +0 -61
  769. package/demo/node_modules/openai/resources/beta/assistants.mjs.map +0 -1
  770. package/demo/node_modules/openai/resources/beta/beta.d.ts +0 -53
  771. package/demo/node_modules/openai/resources/beta/beta.d.ts.map +0 -1
  772. package/demo/node_modules/openai/resources/beta/beta.js +0 -51
  773. package/demo/node_modules/openai/resources/beta/beta.js.map +0 -1
  774. package/demo/node_modules/openai/resources/beta/beta.mjs +0 -24
  775. package/demo/node_modules/openai/resources/beta/beta.mjs.map +0 -1
  776. package/demo/node_modules/openai/resources/beta/chat/chat.d.ts +0 -9
  777. package/demo/node_modules/openai/resources/beta/chat/chat.d.ts.map +0 -1
  778. package/demo/node_modules/openai/resources/beta/chat/chat.js +0 -40
  779. package/demo/node_modules/openai/resources/beta/chat/chat.js.map +0 -1
  780. package/demo/node_modules/openai/resources/beta/chat/chat.mjs +0 -13
  781. package/demo/node_modules/openai/resources/beta/chat/chat.mjs.map +0 -1
  782. package/demo/node_modules/openai/resources/beta/chat/completions.d.ts +0 -37
  783. package/demo/node_modules/openai/resources/beta/chat/completions.d.ts.map +0 -1
  784. package/demo/node_modules/openai/resources/beta/chat/completions.js +0 -39
  785. package/demo/node_modules/openai/resources/beta/chat/completions.js.map +0 -1
  786. package/demo/node_modules/openai/resources/beta/chat/completions.mjs +0 -30
  787. package/demo/node_modules/openai/resources/beta/chat/completions.mjs.map +0 -1
  788. package/demo/node_modules/openai/resources/beta/chat/index.d.ts +0 -3
  789. package/demo/node_modules/openai/resources/beta/chat/index.d.ts.map +0 -1
  790. package/demo/node_modules/openai/resources/beta/chat/index.js +0 -9
  791. package/demo/node_modules/openai/resources/beta/chat/index.js.map +0 -1
  792. package/demo/node_modules/openai/resources/beta/chat/index.mjs +0 -4
  793. package/demo/node_modules/openai/resources/beta/chat/index.mjs.map +0 -1
  794. package/demo/node_modules/openai/resources/beta/index.d.ts +0 -6
  795. package/demo/node_modules/openai/resources/beta/index.d.ts.map +0 -1
  796. package/demo/node_modules/openai/resources/beta/index.js +0 -17
  797. package/demo/node_modules/openai/resources/beta/index.js.map +0 -1
  798. package/demo/node_modules/openai/resources/beta/index.mjs +0 -7
  799. package/demo/node_modules/openai/resources/beta/index.mjs.map +0 -1
  800. package/demo/node_modules/openai/resources/beta/threads/index.d.ts +0 -4
  801. package/demo/node_modules/openai/resources/beta/threads/index.d.ts.map +0 -1
  802. package/demo/node_modules/openai/resources/beta/threads/index.js +0 -13
  803. package/demo/node_modules/openai/resources/beta/threads/index.js.map +0 -1
  804. package/demo/node_modules/openai/resources/beta/threads/index.mjs +0 -5
  805. package/demo/node_modules/openai/resources/beta/threads/index.mjs.map +0 -1
  806. package/demo/node_modules/openai/resources/beta/threads/messages.d.ts +0 -552
  807. package/demo/node_modules/openai/resources/beta/threads/messages.d.ts.map +0 -1
  808. package/demo/node_modules/openai/resources/beta/threads/messages.js +0 -89
  809. package/demo/node_modules/openai/resources/beta/threads/messages.js.map +0 -1
  810. package/demo/node_modules/openai/resources/beta/threads/messages.mjs +0 -61
  811. package/demo/node_modules/openai/resources/beta/threads/messages.mjs.map +0 -1
  812. package/demo/node_modules/openai/resources/beta/threads/runs/index.d.ts +0 -3
  813. package/demo/node_modules/openai/resources/beta/threads/runs/index.d.ts.map +0 -1
  814. package/demo/node_modules/openai/resources/beta/threads/runs/index.js +0 -11
  815. package/demo/node_modules/openai/resources/beta/threads/runs/index.js.map +0 -1
  816. package/demo/node_modules/openai/resources/beta/threads/runs/index.mjs +0 -4
  817. package/demo/node_modules/openai/resources/beta/threads/runs/index.mjs.map +0 -1
  818. package/demo/node_modules/openai/resources/beta/threads/runs/runs.d.ts +0 -1194
  819. package/demo/node_modules/openai/resources/beta/threads/runs/runs.d.ts.map +0 -1
  820. package/demo/node_modules/openai/resources/beta/threads/runs/runs.js +0 -190
  821. package/demo/node_modules/openai/resources/beta/threads/runs/runs.js.map +0 -1
  822. package/demo/node_modules/openai/resources/beta/threads/runs/runs.mjs +0 -162
  823. package/demo/node_modules/openai/resources/beta/threads/runs/runs.mjs.map +0 -1
  824. package/demo/node_modules/openai/resources/beta/threads/runs/steps.d.ts +0 -520
  825. package/demo/node_modules/openai/resources/beta/threads/runs/steps.d.ts.map +0 -1
  826. package/demo/node_modules/openai/resources/beta/threads/runs/steps.js +0 -60
  827. package/demo/node_modules/openai/resources/beta/threads/runs/steps.js.map +0 -1
  828. package/demo/node_modules/openai/resources/beta/threads/runs/steps.mjs +0 -32
  829. package/demo/node_modules/openai/resources/beta/threads/runs/steps.mjs.map +0 -1
  830. package/demo/node_modules/openai/resources/beta/threads/threads.d.ts +0 -1240
  831. package/demo/node_modules/openai/resources/beta/threads/threads.d.ts.map +0 -1
  832. package/demo/node_modules/openai/resources/beta/threads/threads.js +0 -108
  833. package/demo/node_modules/openai/resources/beta/threads/threads.js.map +0 -1
  834. package/demo/node_modules/openai/resources/beta/threads/threads.mjs +0 -81
  835. package/demo/node_modules/openai/resources/beta/threads/threads.mjs.map +0 -1
  836. package/demo/node_modules/openai/resources/beta/vector-stores/file-batches.d.ts +0 -142
  837. package/demo/node_modules/openai/resources/beta/vector-stores/file-batches.d.ts.map +0 -1
  838. package/demo/node_modules/openai/resources/beta/vector-stores/file-batches.js +0 -129
  839. package/demo/node_modules/openai/resources/beta/vector-stores/file-batches.js.map +0 -1
  840. package/demo/node_modules/openai/resources/beta/vector-stores/file-batches.mjs +0 -125
  841. package/demo/node_modules/openai/resources/beta/vector-stores/file-batches.mjs.map +0 -1
  842. package/demo/node_modules/openai/resources/beta/vector-stores/files.d.ts +0 -154
  843. package/demo/node_modules/openai/resources/beta/vector-stores/files.d.ts.map +0 -1
  844. package/demo/node_modules/openai/resources/beta/vector-stores/files.js +0 -149
  845. package/demo/node_modules/openai/resources/beta/vector-stores/files.js.map +0 -1
  846. package/demo/node_modules/openai/resources/beta/vector-stores/files.mjs +0 -121
  847. package/demo/node_modules/openai/resources/beta/vector-stores/files.mjs.map +0 -1
  848. package/demo/node_modules/openai/resources/beta/vector-stores/index.d.ts +0 -4
  849. package/demo/node_modules/openai/resources/beta/vector-stores/index.d.ts.map +0 -1
  850. package/demo/node_modules/openai/resources/beta/vector-stores/index.js +0 -13
  851. package/demo/node_modules/openai/resources/beta/vector-stores/index.js.map +0 -1
  852. package/demo/node_modules/openai/resources/beta/vector-stores/index.mjs +0 -5
  853. package/demo/node_modules/openai/resources/beta/vector-stores/index.mjs.map +0 -1
  854. package/demo/node_modules/openai/resources/beta/vector-stores/vector-stores.d.ts +0 -233
  855. package/demo/node_modules/openai/resources/beta/vector-stores/vector-stores.d.ts.map +0 -1
  856. package/demo/node_modules/openai/resources/beta/vector-stores/vector-stores.js +0 -99
  857. package/demo/node_modules/openai/resources/beta/vector-stores/vector-stores.js.map +0 -1
  858. package/demo/node_modules/openai/resources/beta/vector-stores/vector-stores.mjs +0 -71
  859. package/demo/node_modules/openai/resources/beta/vector-stores/vector-stores.mjs.map +0 -1
  860. package/demo/node_modules/openai/resources/chat/chat.d.ts +0 -42
  861. package/demo/node_modules/openai/resources/chat/chat.d.ts.map +0 -1
  862. package/demo/node_modules/openai/resources/chat/chat.js +0 -40
  863. package/demo/node_modules/openai/resources/chat/chat.js.map +0 -1
  864. package/demo/node_modules/openai/resources/chat/chat.mjs +0 -13
  865. package/demo/node_modules/openai/resources/chat/chat.mjs.map +0 -1
  866. package/demo/node_modules/openai/resources/chat/completions.d.ts +0 -845
  867. package/demo/node_modules/openai/resources/chat/completions.d.ts.map +0 -1
  868. package/demo/node_modules/openai/resources/chat/completions.js +0 -14
  869. package/demo/node_modules/openai/resources/chat/completions.js.map +0 -1
  870. package/demo/node_modules/openai/resources/chat/completions.mjs +0 -10
  871. package/demo/node_modules/openai/resources/chat/completions.mjs.map +0 -1
  872. package/demo/node_modules/openai/resources/chat/index.d.ts +0 -3
  873. package/demo/node_modules/openai/resources/chat/index.d.ts.map +0 -1
  874. package/demo/node_modules/openai/resources/chat/index.js +0 -9
  875. package/demo/node_modules/openai/resources/chat/index.js.map +0 -1
  876. package/demo/node_modules/openai/resources/chat/index.mjs +0 -4
  877. package/demo/node_modules/openai/resources/chat/index.mjs.map +0 -1
  878. package/demo/node_modules/openai/resources/completions.d.ts +0 -272
  879. package/demo/node_modules/openai/resources/completions.d.ts.map +0 -1
  880. package/demo/node_modules/openai/resources/completions.js +0 -14
  881. package/demo/node_modules/openai/resources/completions.js.map +0 -1
  882. package/demo/node_modules/openai/resources/completions.mjs +0 -10
  883. package/demo/node_modules/openai/resources/completions.mjs.map +0 -1
  884. package/demo/node_modules/openai/resources/embeddings.d.ts +0 -103
  885. package/demo/node_modules/openai/resources/embeddings.d.ts.map +0 -1
  886. package/demo/node_modules/openai/resources/embeddings.js +0 -17
  887. package/demo/node_modules/openai/resources/embeddings.js.map +0 -1
  888. package/demo/node_modules/openai/resources/embeddings.mjs +0 -13
  889. package/demo/node_modules/openai/resources/embeddings.mjs.map +0 -1
  890. package/demo/node_modules/openai/resources/files.d.ts +0 -140
  891. package/demo/node_modules/openai/resources/files.d.ts.map +0 -1
  892. package/demo/node_modules/openai/resources/files.js +0 -120
  893. package/demo/node_modules/openai/resources/files.js.map +0 -1
  894. package/demo/node_modules/openai/resources/files.mjs +0 -92
  895. package/demo/node_modules/openai/resources/files.mjs.map +0 -1
  896. package/demo/node_modules/openai/resources/fine-tuning/fine-tuning.d.ts +0 -19
  897. package/demo/node_modules/openai/resources/fine-tuning/fine-tuning.d.ts.map +0 -1
  898. package/demo/node_modules/openai/resources/fine-tuning/fine-tuning.js +0 -42
  899. package/demo/node_modules/openai/resources/fine-tuning/fine-tuning.js.map +0 -1
  900. package/demo/node_modules/openai/resources/fine-tuning/fine-tuning.mjs +0 -15
  901. package/demo/node_modules/openai/resources/fine-tuning/fine-tuning.mjs.map +0 -1
  902. package/demo/node_modules/openai/resources/fine-tuning/index.d.ts +0 -3
  903. package/demo/node_modules/openai/resources/fine-tuning/index.d.ts.map +0 -1
  904. package/demo/node_modules/openai/resources/fine-tuning/index.js +0 -11
  905. package/demo/node_modules/openai/resources/fine-tuning/index.js.map +0 -1
  906. package/demo/node_modules/openai/resources/fine-tuning/index.mjs +0 -4
  907. package/demo/node_modules/openai/resources/fine-tuning/index.mjs.map +0 -1
  908. package/demo/node_modules/openai/resources/fine-tuning/jobs/checkpoints.d.ts +0 -69
  909. package/demo/node_modules/openai/resources/fine-tuning/jobs/checkpoints.d.ts.map +0 -1
  910. package/demo/node_modules/openai/resources/fine-tuning/jobs/checkpoints.js +0 -47
  911. package/demo/node_modules/openai/resources/fine-tuning/jobs/checkpoints.js.map +0 -1
  912. package/demo/node_modules/openai/resources/fine-tuning/jobs/checkpoints.mjs +0 -19
  913. package/demo/node_modules/openai/resources/fine-tuning/jobs/checkpoints.mjs.map +0 -1
  914. package/demo/node_modules/openai/resources/fine-tuning/jobs/index.d.ts +0 -3
  915. package/demo/node_modules/openai/resources/fine-tuning/jobs/index.d.ts.map +0 -1
  916. package/demo/node_modules/openai/resources/fine-tuning/jobs/index.js +0 -12
  917. package/demo/node_modules/openai/resources/fine-tuning/jobs/index.js.map +0 -1
  918. package/demo/node_modules/openai/resources/fine-tuning/jobs/index.mjs +0 -4
  919. package/demo/node_modules/openai/resources/fine-tuning/jobs/index.mjs.map +0 -1
  920. package/demo/node_modules/openai/resources/fine-tuning/jobs/jobs.d.ts +0 -362
  921. package/demo/node_modules/openai/resources/fine-tuning/jobs/jobs.d.ts.map +0 -1
  922. package/demo/node_modules/openai/resources/fine-tuning/jobs/jobs.js +0 -93
  923. package/demo/node_modules/openai/resources/fine-tuning/jobs/jobs.js.map +0 -1
  924. package/demo/node_modules/openai/resources/fine-tuning/jobs/jobs.mjs +0 -64
  925. package/demo/node_modules/openai/resources/fine-tuning/jobs/jobs.mjs.map +0 -1
  926. package/demo/node_modules/openai/resources/images.d.ts +0 -174
  927. package/demo/node_modules/openai/resources/images.d.ts.map +0 -1
  928. package/demo/node_modules/openai/resources/images.js +0 -30
  929. package/demo/node_modules/openai/resources/images.js.map +0 -1
  930. package/demo/node_modules/openai/resources/images.mjs +0 -26
  931. package/demo/node_modules/openai/resources/images.mjs.map +0 -1
  932. package/demo/node_modules/openai/resources/index.d.ts +0 -13
  933. package/demo/node_modules/openai/resources/index.d.ts.map +0 -1
  934. package/demo/node_modules/openai/resources/index.js +0 -44
  935. package/demo/node_modules/openai/resources/index.js.map +0 -1
  936. package/demo/node_modules/openai/resources/index.mjs +0 -14
  937. package/demo/node_modules/openai/resources/index.mjs.map +0 -1
  938. package/demo/node_modules/openai/resources/models.d.ts +0 -58
  939. package/demo/node_modules/openai/resources/models.d.ts.map +0 -1
  940. package/demo/node_modules/openai/resources/models.js +0 -64
  941. package/demo/node_modules/openai/resources/models.js.map +0 -1
  942. package/demo/node_modules/openai/resources/models.mjs +0 -36
  943. package/demo/node_modules/openai/resources/models.mjs.map +0 -1
  944. package/demo/node_modules/openai/resources/moderations.d.ts +0 -176
  945. package/demo/node_modules/openai/resources/moderations.d.ts.map +0 -1
  946. package/demo/node_modules/openai/resources/moderations.js +0 -17
  947. package/demo/node_modules/openai/resources/moderations.js.map +0 -1
  948. package/demo/node_modules/openai/resources/moderations.mjs +0 -13
  949. package/demo/node_modules/openai/resources/moderations.mjs.map +0 -1
  950. package/demo/node_modules/openai/resources/shared.d.ts +0 -39
  951. package/demo/node_modules/openai/resources/shared.d.ts.map +0 -1
  952. package/demo/node_modules/openai/resources/shared.js +0 -4
  953. package/demo/node_modules/openai/resources/shared.js.map +0 -1
  954. package/demo/node_modules/openai/resources/shared.mjs +0 -3
  955. package/demo/node_modules/openai/resources/shared.mjs.map +0 -1
  956. package/demo/node_modules/openai/shims/node.d.ts +0 -29
  957. package/demo/node_modules/openai/shims/node.d.ts.map +0 -1
  958. package/demo/node_modules/openai/shims/node.js +0 -31
  959. package/demo/node_modules/openai/shims/node.js.map +0 -1
  960. package/demo/node_modules/openai/shims/node.mjs +0 -5
  961. package/demo/node_modules/openai/shims/node.mjs.map +0 -1
  962. package/demo/node_modules/openai/shims/web.d.ts +0 -26
  963. package/demo/node_modules/openai/shims/web.d.ts.map +0 -1
  964. package/demo/node_modules/openai/shims/web.js +0 -31
  965. package/demo/node_modules/openai/shims/web.js.map +0 -1
  966. package/demo/node_modules/openai/shims/web.mjs +0 -5
  967. package/demo/node_modules/openai/shims/web.mjs.map +0 -1
  968. package/demo/node_modules/openai/src/_shims/MultipartBody.ts +0 -9
  969. package/demo/node_modules/openai/src/_shims/README.md +0 -46
  970. package/demo/node_modules/openai/src/_shims/auto/runtime-bun.ts +0 -4
  971. package/demo/node_modules/openai/src/_shims/auto/runtime-node.ts +0 -4
  972. package/demo/node_modules/openai/src/_shims/auto/runtime.ts +0 -4
  973. package/demo/node_modules/openai/src/_shims/auto/types-node.ts +0 -4
  974. package/demo/node_modules/openai/src/_shims/auto/types.d.ts +0 -101
  975. package/demo/node_modules/openai/src/_shims/auto/types.js +0 -3
  976. package/demo/node_modules/openai/src/_shims/auto/types.mjs +0 -3
  977. package/demo/node_modules/openai/src/_shims/bun-runtime.ts +0 -14
  978. package/demo/node_modules/openai/src/_shims/index.d.ts +0 -81
  979. package/demo/node_modules/openai/src/_shims/index.js +0 -13
  980. package/demo/node_modules/openai/src/_shims/index.mjs +0 -7
  981. package/demo/node_modules/openai/src/_shims/manual-types.d.ts +0 -12
  982. package/demo/node_modules/openai/src/_shims/manual-types.js +0 -3
  983. package/demo/node_modules/openai/src/_shims/manual-types.mjs +0 -3
  984. package/demo/node_modules/openai/src/_shims/node-runtime.ts +0 -83
  985. package/demo/node_modules/openai/src/_shims/node-types.d.ts +0 -42
  986. package/demo/node_modules/openai/src/_shims/node-types.js +0 -3
  987. package/demo/node_modules/openai/src/_shims/node-types.mjs +0 -3
  988. package/demo/node_modules/openai/src/_shims/registry.ts +0 -65
  989. package/demo/node_modules/openai/src/_shims/web-runtime.ts +0 -103
  990. package/demo/node_modules/openai/src/_shims/web-types.d.ts +0 -83
  991. package/demo/node_modules/openai/src/_shims/web-types.js +0 -3
  992. package/demo/node_modules/openai/src/_shims/web-types.mjs +0 -3
  993. package/demo/node_modules/openai/src/core.ts +0 -1162
  994. package/demo/node_modules/openai/src/error.ts +0 -158
  995. package/demo/node_modules/openai/src/index.ts +0 -502
  996. package/demo/node_modules/openai/src/lib/.keep +0 -4
  997. package/demo/node_modules/openai/src/lib/AbstractAssistantStreamRunner.ts +0 -340
  998. package/demo/node_modules/openai/src/lib/AbstractChatCompletionRunner.ts +0 -682
  999. package/demo/node_modules/openai/src/lib/AssistantStream.ts +0 -723
  1000. package/demo/node_modules/openai/src/lib/ChatCompletionRunFunctions.test.ts +0 -2328
  1001. package/demo/node_modules/openai/src/lib/ChatCompletionRunner.ts +0 -68
  1002. package/demo/node_modules/openai/src/lib/ChatCompletionStream.ts +0 -494
  1003. package/demo/node_modules/openai/src/lib/ChatCompletionStreamingRunner.ts +0 -68
  1004. package/demo/node_modules/openai/src/lib/RunnableFunction.ts +0 -134
  1005. package/demo/node_modules/openai/src/lib/Util.ts +0 -23
  1006. package/demo/node_modules/openai/src/lib/chatCompletionUtils.ts +0 -28
  1007. package/demo/node_modules/openai/src/lib/jsonschema.ts +0 -148
  1008. package/demo/node_modules/openai/src/pagination.ts +0 -98
  1009. package/demo/node_modules/openai/src/resource.ts +0 -11
  1010. package/demo/node_modules/openai/src/resources/audio/audio.ts +0 -23
  1011. package/demo/node_modules/openai/src/resources/audio/index.ts +0 -6
  1012. package/demo/node_modules/openai/src/resources/audio/speech.ts +0 -52
  1013. package/demo/node_modules/openai/src/resources/audio/transcriptions.ts +0 -84
  1014. package/demo/node_modules/openai/src/resources/audio/translations.ts +0 -61
  1015. package/demo/node_modules/openai/src/resources/batches.ts +0 -252
  1016. package/demo/node_modules/openai/src/resources/beta/assistants.ts +0 -1315
  1017. package/demo/node_modules/openai/src/resources/beta/beta.ts +0 -56
  1018. package/demo/node_modules/openai/src/resources/beta/chat/chat.ts +0 -12
  1019. package/demo/node_modules/openai/src/resources/beta/chat/completions.ts +0 -106
  1020. package/demo/node_modules/openai/src/resources/beta/chat/index.ts +0 -4
  1021. package/demo/node_modules/openai/src/resources/beta/index.ts +0 -48
  1022. package/demo/node_modules/openai/src/resources/beta/threads/index.ts +0 -72
  1023. package/demo/node_modules/openai/src/resources/beta/threads/messages.ts +0 -706
  1024. package/demo/node_modules/openai/src/resources/beta/threads/runs/index.ts +0 -44
  1025. package/demo/node_modules/openai/src/resources/beta/threads/runs/runs.ts +0 -1627
  1026. package/demo/node_modules/openai/src/resources/beta/threads/runs/steps.ts +0 -641
  1027. package/demo/node_modules/openai/src/resources/beta/threads/threads.ts +0 -1536
  1028. package/demo/node_modules/openai/src/resources/beta/vector-stores/file-batches.ts +0 -293
  1029. package/demo/node_modules/openai/src/resources/beta/vector-stores/files.ts +0 -284
  1030. package/demo/node_modules/openai/src/resources/beta/vector-stores/index.ts +0 -25
  1031. package/demo/node_modules/openai/src/resources/beta/vector-stores/vector-stores.ts +0 -318
  1032. package/demo/node_modules/openai/src/resources/chat/chat.ts +0 -67
  1033. package/demo/node_modules/openai/src/resources/chat/completions.ts +0 -996
  1034. package/demo/node_modules/openai/src/resources/chat/index.ts +0 -33
  1035. package/demo/node_modules/openai/src/resources/completions.ts +0 -329
  1036. package/demo/node_modules/openai/src/resources/embeddings.ts +0 -125
  1037. package/demo/node_modules/openai/src/resources/files.ts +0 -214
  1038. package/demo/node_modules/openai/src/resources/fine-tuning/fine-tuning.ts +0 -22
  1039. package/demo/node_modules/openai/src/resources/fine-tuning/index.ts +0 -16
  1040. package/demo/node_modules/openai/src/resources/fine-tuning/jobs/checkpoints.ts +0 -108
  1041. package/demo/node_modules/openai/src/resources/fine-tuning/jobs/index.ts +0 -21
  1042. package/demo/node_modules/openai/src/resources/fine-tuning/jobs/jobs.ts +0 -458
  1043. package/demo/node_modules/openai/src/resources/images.ts +0 -215
  1044. package/demo/node_modules/openai/src/resources/index.ts +0 -45
  1045. package/demo/node_modules/openai/src/resources/models.ts +0 -76
  1046. package/demo/node_modules/openai/src/resources/moderations.ts +0 -214
  1047. package/demo/node_modules/openai/src/resources/shared.ts +0 -47
  1048. package/demo/node_modules/openai/src/shims/node.ts +0 -50
  1049. package/demo/node_modules/openai/src/shims/web.ts +0 -50
  1050. package/demo/node_modules/openai/src/streaming.ts +0 -508
  1051. package/demo/node_modules/openai/src/tsconfig.json +0 -11
  1052. package/demo/node_modules/openai/src/uploads.ts +0 -248
  1053. package/demo/node_modules/openai/src/version.ts +0 -1
  1054. package/demo/node_modules/openai/streaming.d.ts +0 -41
  1055. package/demo/node_modules/openai/streaming.d.ts.map +0 -1
  1056. package/demo/node_modules/openai/streaming.js +0 -433
  1057. package/demo/node_modules/openai/streaming.js.map +0 -1
  1058. package/demo/node_modules/openai/streaming.mjs +0 -426
  1059. package/demo/node_modules/openai/streaming.mjs.map +0 -1
  1060. package/demo/node_modules/openai/uploads.d.ts +0 -75
  1061. package/demo/node_modules/openai/uploads.d.ts.map +0 -1
  1062. package/demo/node_modules/openai/uploads.js +0 -165
  1063. package/demo/node_modules/openai/uploads.js.map +0 -1
  1064. package/demo/node_modules/openai/uploads.mjs +0 -152
  1065. package/demo/node_modules/openai/uploads.mjs.map +0 -1
  1066. package/demo/node_modules/openai/version.d.ts +0 -2
  1067. package/demo/node_modules/openai/version.d.ts.map +0 -1
  1068. package/demo/node_modules/openai/version.js +0 -5
  1069. package/demo/node_modules/openai/version.js.map +0 -1
  1070. package/demo/node_modules/openai/version.mjs +0 -2
  1071. package/demo/node_modules/openai/version.mjs.map +0 -1
  1072. package/demo/node_modules/tr46/index.js +0 -193
  1073. package/demo/node_modules/tr46/lib/.gitkeep +0 -0
  1074. package/demo/node_modules/tr46/lib/mappingTable.json +0 -1
  1075. package/demo/node_modules/tr46/package.json +0 -31
  1076. package/demo/node_modules/undici-types/README.md +0 -6
  1077. package/demo/node_modules/undici-types/agent.d.ts +0 -31
  1078. package/demo/node_modules/undici-types/api.d.ts +0 -43
  1079. package/demo/node_modules/undici-types/balanced-pool.d.ts +0 -18
  1080. package/demo/node_modules/undici-types/cache.d.ts +0 -36
  1081. package/demo/node_modules/undici-types/client.d.ts +0 -97
  1082. package/demo/node_modules/undici-types/connector.d.ts +0 -34
  1083. package/demo/node_modules/undici-types/content-type.d.ts +0 -21
  1084. package/demo/node_modules/undici-types/cookies.d.ts +0 -28
  1085. package/demo/node_modules/undici-types/diagnostics-channel.d.ts +0 -67
  1086. package/demo/node_modules/undici-types/dispatcher.d.ts +0 -241
  1087. package/demo/node_modules/undici-types/errors.d.ts +0 -128
  1088. package/demo/node_modules/undici-types/fetch.d.ts +0 -209
  1089. package/demo/node_modules/undici-types/file.d.ts +0 -39
  1090. package/demo/node_modules/undici-types/filereader.d.ts +0 -54
  1091. package/demo/node_modules/undici-types/formdata.d.ts +0 -108
  1092. package/demo/node_modules/undici-types/global-dispatcher.d.ts +0 -9
  1093. package/demo/node_modules/undici-types/global-origin.d.ts +0 -7
  1094. package/demo/node_modules/undici-types/handlers.d.ts +0 -9
  1095. package/demo/node_modules/undici-types/header.d.ts +0 -4
  1096. package/demo/node_modules/undici-types/index.d.ts +0 -63
  1097. package/demo/node_modules/undici-types/interceptors.d.ts +0 -5
  1098. package/demo/node_modules/undici-types/mock-agent.d.ts +0 -50
  1099. package/demo/node_modules/undici-types/mock-client.d.ts +0 -25
  1100. package/demo/node_modules/undici-types/mock-errors.d.ts +0 -12
  1101. package/demo/node_modules/undici-types/mock-interceptor.d.ts +0 -93
  1102. package/demo/node_modules/undici-types/mock-pool.d.ts +0 -25
  1103. package/demo/node_modules/undici-types/package.json +0 -55
  1104. package/demo/node_modules/undici-types/patch.d.ts +0 -71
  1105. package/demo/node_modules/undici-types/pool-stats.d.ts +0 -19
  1106. package/demo/node_modules/undici-types/pool.d.ts +0 -28
  1107. package/demo/node_modules/undici-types/proxy-agent.d.ts +0 -30
  1108. package/demo/node_modules/undici-types/readable.d.ts +0 -61
  1109. package/demo/node_modules/undici-types/webidl.d.ts +0 -220
  1110. package/demo/node_modules/undici-types/websocket.d.ts +0 -131
  1111. package/demo/node_modules/web-streams-polyfill/LICENSE +0 -22
  1112. package/demo/node_modules/web-streams-polyfill/README.md +0 -110
  1113. package/demo/node_modules/web-streams-polyfill/es2018/package.json +0 -14
  1114. package/demo/node_modules/web-streams-polyfill/es6/package.json +0 -14
  1115. package/demo/node_modules/web-streams-polyfill/package.json +0 -83
  1116. package/demo/node_modules/web-streams-polyfill/ponyfill/es2018/package.json +0 -13
  1117. package/demo/node_modules/web-streams-polyfill/ponyfill/es6/package.json +0 -13
  1118. package/demo/node_modules/web-streams-polyfill/ponyfill/package.json +0 -13
  1119. package/demo/node_modules/webidl-conversions/LICENSE.md +0 -12
  1120. package/demo/node_modules/webidl-conversions/README.md +0 -53
  1121. package/demo/node_modules/webidl-conversions/lib/index.js +0 -189
  1122. package/demo/node_modules/webidl-conversions/package.json +0 -23
  1123. package/demo/node_modules/whatwg-url/LICENSE.txt +0 -21
  1124. package/demo/node_modules/whatwg-url/README.md +0 -67
  1125. package/demo/node_modules/whatwg-url/lib/URL-impl.js +0 -200
  1126. package/demo/node_modules/whatwg-url/lib/URL.js +0 -196
  1127. package/demo/node_modules/whatwg-url/lib/public-api.js +0 -11
  1128. package/demo/node_modules/whatwg-url/lib/url-state-machine.js +0 -1297
  1129. package/demo/node_modules/whatwg-url/lib/utils.js +0 -20
  1130. package/demo/node_modules/whatwg-url/package.json +0 -32
  1131. package/demo/watson.png +0 -0
@@ -1,2328 +0,0 @@
1
- import OpenAI from 'openai';
2
- import { OpenAIError, APIConnectionError } from "../error";
3
- import { PassThrough } from 'stream';
4
- import {
5
- ParsingToolFunction,
6
- type ChatCompletionRunner,
7
- type ChatCompletionFunctionRunnerParams,
8
- ChatCompletionStreamingRunner,
9
- type ChatCompletionStreamingFunctionRunnerParams,
10
- } from "../resources/beta/chat/completions";
11
- import type { ChatCompletionMessageParam } from "../resources/chat/completions";
12
-
13
- import { type RequestInfo, type RequestInit } from "../_shims/index";
14
- import { Response } from 'node-fetch';
15
- import { isAssistantMessage } from './chatCompletionUtils';
16
-
17
- type Fetch = (req: string | RequestInfo, init?: RequestInit) => Promise<Response>;
18
-
19
- /**
20
- * Creates a mock `fetch` function and a `handleRequest` function for intercepting `fetch` calls.
21
- *
22
- * You call `handleRequest` with a callback function that handles the next `fetch` call.
23
- * It returns a Promise that:
24
- * - waits for the next call to `fetch`
25
- * - calls the callback with the `fetch` arguments
26
- * - resolves `fetch` with the callback output
27
- */
28
- function mockFetch(): { fetch: Fetch; handleRequest: (handle: Fetch) => Promise<void> } {
29
- const fetchQueue: ((handler: typeof fetch) => void)[] = [];
30
- const handlerQueue: Promise<typeof fetch>[] = [];
31
-
32
- const enqueueHandler = () => {
33
- handlerQueue.push(
34
- new Promise<typeof fetch>((resolve) => {
35
- fetchQueue.push((handle: typeof fetch) => {
36
- enqueueHandler();
37
- resolve(handle);
38
- });
39
- }),
40
- );
41
- };
42
- enqueueHandler();
43
-
44
- async function fetch(req: string | RequestInfo, init?: RequestInit): Promise<Response> {
45
- const handler = await handlerQueue.shift();
46
- if (!handler) throw new Error('expected handler to be defined');
47
- const signal = init?.signal;
48
- if (!signal) return await handler(req, init);
49
- return await Promise.race([
50
- handler(req, init),
51
- new Promise<Response>((resolve, reject) => {
52
- if (signal.aborted) {
53
- // @ts-ignore does exist in Node
54
- reject(new DOMException('The user aborted a request.', 'AbortError'));
55
- return;
56
- }
57
- signal.addEventListener('abort', (e) => {
58
- // @ts-ignore does exist in Node
59
- reject(new DOMException('The user aborted a request.', 'AbortError'));
60
- });
61
- }),
62
- ]);
63
- }
64
-
65
- function handleRequest(handle: typeof fetch): Promise<void> {
66
- return new Promise<void>((resolve, reject) => {
67
- fetchQueue.shift()?.(async (req, init) => {
68
- try {
69
- return await handle(req, init);
70
- } catch (err) {
71
- reject(err);
72
- return err as any;
73
- } finally {
74
- resolve();
75
- }
76
- });
77
- });
78
- }
79
-
80
- return { fetch, handleRequest };
81
- }
82
-
83
- // mockChatCompletionFetch is like mockFetch, but with better a more convenient handleRequest to mock
84
- // chat completion request/responses.
85
- function mockChatCompletionFetch() {
86
- const { fetch, handleRequest: handleRawRequest } = mockFetch();
87
-
88
- function handleRequest(
89
- handler: (body: ChatCompletionFunctionRunnerParams<any[]>) => Promise<OpenAI.Chat.ChatCompletion>,
90
- ): Promise<void> {
91
- return handleRawRequest(async (req, init) => {
92
- const rawBody = init?.body;
93
- if (typeof rawBody !== 'string') throw new Error(`expected init.body to be a string`);
94
- const body: ChatCompletionFunctionRunnerParams<any[]> = JSON.parse(rawBody);
95
- return new Response(JSON.stringify(await handler(body)), {
96
- headers: { 'Content-Type': 'application/json' },
97
- });
98
- });
99
- }
100
- return { fetch, handleRequest };
101
- }
102
-
103
- // mockStreamingChatCompletionFetch is like mockFetch, but with better a more convenient handleRequest to mock
104
- // streaming chat completion request/responses.
105
- function mockStreamingChatCompletionFetch() {
106
- const { fetch, handleRequest: handleRawRequest } = mockFetch();
107
-
108
- function handleRequest(
109
- handler: (
110
- body: ChatCompletionStreamingFunctionRunnerParams<any[]>,
111
- ) => AsyncIterable<OpenAI.Chat.ChatCompletionChunk>,
112
- ): Promise<void> {
113
- return handleRawRequest(async (req, init) => {
114
- const rawBody = init?.body;
115
- if (typeof rawBody !== 'string') throw new Error(`expected init.body to be a string`);
116
- const body: ChatCompletionStreamingFunctionRunnerParams<any[]> = JSON.parse(rawBody);
117
- const stream = new PassThrough();
118
- (async () => {
119
- for await (const chunk of handler(body)) {
120
- stream.write(`data: ${JSON.stringify(chunk)}\n\n`);
121
- }
122
- stream.end(`data: [DONE]\n\n`);
123
- })();
124
- return new Response(stream, {
125
- headers: {
126
- 'Content-Type': 'text/event-stream',
127
- 'Transfer-Encoding': 'chunked',
128
- },
129
- });
130
- });
131
- }
132
- return { fetch, handleRequest };
133
- }
134
-
135
- // contentChoiceDeltas returns an async iterator which mocks a delta stream of a by splitting the
136
- // argument into chunks separated by whitespace.
137
- function* contentChoiceDeltas(
138
- content: string,
139
- {
140
- index = 0,
141
- role = 'assistant',
142
- }: { index?: number; role?: NonNullable<OpenAI.Chat.ChatCompletionChunk.Choice.Delta['role']> } = {},
143
- ): Iterable<OpenAI.Chat.Completions.ChatCompletionChunk.Choice> {
144
- const deltas = content.split(/\s+/g);
145
- for (let i = 0; i < deltas.length; i++) {
146
- yield {
147
- index,
148
- finish_reason: i === deltas.length - 1 ? 'stop' : null,
149
- logprobs: null,
150
- delta: {
151
- role,
152
- content: deltas[i] ? `${deltas[i]}${i === deltas.length - 1 ? '' : ' '}` : null,
153
- },
154
- };
155
- }
156
- }
157
-
158
- // functionCallDeltas returns an async iterator which mocks a delta stream of a functionCall by splitting
159
- // the argument into chunks separated by whitespace.
160
- function* functionCallDeltas(
161
- args: string,
162
- {
163
- index = 0,
164
- id = '123',
165
- name,
166
- role = 'assistant',
167
- }: {
168
- name: string;
169
- id?: string;
170
- index?: number;
171
- role?: NonNullable<OpenAI.Chat.ChatCompletionChunk.Choice.Delta['role']>;
172
- },
173
- ): Iterable<OpenAI.Chat.Completions.ChatCompletionChunk.Choice> {
174
- const deltas = args.split(/\s+/g);
175
- for (let i = 0; i < deltas.length; i++) {
176
- yield {
177
- index,
178
- finish_reason: i === deltas.length - 1 ? 'function_call' : null,
179
- delta: {
180
- role,
181
- tool_calls: [
182
- {
183
- type: 'function',
184
- index: 0,
185
- id,
186
- function: {
187
- arguments: `${deltas[i] || ''}${i === deltas.length - 1 ? '' : ' '}`,
188
- ...(i === deltas.length - 1 ? { name } : null),
189
- },
190
- },
191
- ],
192
- },
193
- };
194
- }
195
- }
196
-
197
- class RunnerListener {
198
- readonly contents: string[] = [];
199
- readonly messages: ChatCompletionMessageParam[] = [];
200
- readonly chatCompletions: OpenAI.Chat.ChatCompletion[] = [];
201
- readonly functionCalls: OpenAI.Chat.ChatCompletionMessage.FunctionCall[] = [];
202
- readonly functionCallResults: string[] = [];
203
- finalContent: string | null = null;
204
- finalMessage: ChatCompletionMessageParam | undefined;
205
- finalChatCompletion: OpenAI.Chat.ChatCompletion | undefined;
206
- finalFunctionCall: OpenAI.Chat.ChatCompletionMessage.FunctionCall | undefined;
207
- finalFunctionCallResult: string | undefined;
208
- totalUsage: OpenAI.CompletionUsage | undefined;
209
- error: OpenAIError | undefined;
210
- gotConnect = false;
211
- gotAbort = false;
212
- gotEnd = false;
213
-
214
- onceMessageCallCount = 0;
215
-
216
- constructor(public runner: ChatCompletionRunner) {
217
- runner
218
- .on('connect', () => (this.gotConnect = true))
219
- .on('content', (content) => this.contents.push(content))
220
- .on('message', (message) => this.messages.push(message))
221
- .on('chatCompletion', (completion) => this.chatCompletions.push(completion))
222
- .on('functionCall', (functionCall) => this.functionCalls.push(functionCall))
223
- .on('functionCallResult', (result) => this.functionCallResults.push(result))
224
- .on('finalContent', (content) => (this.finalContent = content))
225
- .on('finalMessage', (message) => (this.finalMessage = message))
226
- .on('finalChatCompletion', (completion) => (this.finalChatCompletion = completion))
227
- .on('finalFunctionCall', (functionCall) => (this.finalFunctionCall = functionCall))
228
- .on('finalFunctionCallResult', (result) => (this.finalFunctionCallResult = result))
229
- .on('totalUsage', (usage) => (this.totalUsage = usage))
230
- .on('error', (error) => (this.error = error))
231
- .on('abort', (error) => ((this.error = error), (this.gotAbort = true)))
232
- .on('end', () => (this.gotEnd = true))
233
- .once('message', () => this.onceMessageCallCount++);
234
- }
235
-
236
- async sanityCheck({ error }: { error?: string } = {}) {
237
- expect(this.onceMessageCallCount).toBeLessThanOrEqual(1);
238
- expect(this.gotAbort).toEqual(this.runner.aborted);
239
- if (this.runner.aborted) expect(this.runner.errored).toBe(true);
240
- if (error) {
241
- expect(this.error?.message).toEqual(error);
242
- expect(this.runner.errored).toBe(true);
243
- await expect(this.runner.finalChatCompletion()).rejects.toThrow(error);
244
- await expect(this.runner.finalMessage()).rejects.toThrow(error);
245
- await expect(this.runner.finalContent()).rejects.toThrow(error);
246
- await expect(this.runner.finalFunctionCall()).rejects.toThrow(error);
247
- await expect(this.runner.finalFunctionCallResult()).rejects.toThrow(error);
248
- await expect(this.runner.totalUsage()).rejects.toThrow(error);
249
- await expect(this.runner.done()).rejects.toThrow(error);
250
- } else {
251
- expect(this.error).toBeUndefined();
252
- expect(this.runner.errored).toBe(false);
253
- }
254
-
255
- if (!this.gotConnect) {
256
- expect(this.contents).toEqual([]);
257
- expect(this.messages).toEqual([]);
258
- expect(this.chatCompletions).toEqual([]);
259
- expect(this.functionCalls).toEqual([]);
260
- expect(this.functionCallResults).toEqual([]);
261
- expect(this.finalContent).toBeUndefined();
262
- expect(this.finalMessage).toBeUndefined();
263
- expect(this.finalChatCompletion).toBeUndefined();
264
- expect(this.finalFunctionCall).toBeUndefined();
265
- expect(this.finalFunctionCallResult).toBeUndefined();
266
- expect(this.totalUsage).toBeUndefined();
267
- expect(this.gotEnd).toBe(true);
268
- return;
269
- }
270
-
271
- if (error) return;
272
-
273
- const expectedContents = this.messages
274
- .filter(isAssistantMessage)
275
- .map((m) => m.content as string)
276
- .filter(Boolean);
277
- expect(this.contents).toEqual(expectedContents);
278
- expect(this.finalMessage).toEqual([...this.messages].reverse().find((x) => x.role === 'assistant'));
279
- expect(await this.runner.finalMessage()).toEqual(this.finalMessage);
280
- expect(this.finalContent).toEqual(expectedContents[expectedContents.length - 1] ?? null);
281
- expect(await this.runner.finalContent()).toEqual(this.finalContent);
282
- expect(this.finalChatCompletion).toEqual(this.chatCompletions[this.chatCompletions.length - 1]);
283
- expect(await this.runner.finalChatCompletion()).toEqual(this.finalChatCompletion);
284
- expect(this.finalFunctionCall).toEqual(this.functionCalls[this.functionCalls.length - 1]);
285
- expect(await this.runner.finalFunctionCall()).toEqual(this.finalFunctionCall);
286
- expect(this.finalFunctionCallResult).toEqual(
287
- this.functionCallResults[this.functionCallResults.length - 1],
288
- );
289
- expect(await this.runner.finalFunctionCallResult()).toEqual(this.finalFunctionCallResult);
290
- expect(this.chatCompletions).toEqual(this.runner.allChatCompletions());
291
- expect(this.messages).toEqual(this.runner.messages.slice(-this.messages.length));
292
- if (this.chatCompletions.some((c) => c.usage)) {
293
- const totalUsage: OpenAI.CompletionUsage = {
294
- completion_tokens: 0,
295
- prompt_tokens: 0,
296
- total_tokens: 0,
297
- };
298
- for (const { usage } of this.chatCompletions) {
299
- if (usage) {
300
- totalUsage.completion_tokens += usage.completion_tokens;
301
- totalUsage.prompt_tokens += usage.prompt_tokens;
302
- totalUsage.total_tokens += usage.total_tokens;
303
- }
304
- }
305
- expect(this.totalUsage).toEqual(totalUsage);
306
- expect(await this.runner.totalUsage()).toEqual(totalUsage);
307
- }
308
-
309
- expect(this.gotEnd).toBe(true);
310
- }
311
- }
312
-
313
- class StreamingRunnerListener {
314
- readonly eventChunks: OpenAI.Chat.ChatCompletionChunk[] = [];
315
- readonly eventContents: [string, string][] = [];
316
- readonly eventMessages: ChatCompletionMessageParam[] = [];
317
- readonly eventChatCompletions: OpenAI.Chat.ChatCompletion[] = [];
318
- readonly eventFunctionCalls: OpenAI.Chat.ChatCompletionMessage.FunctionCall[] = [];
319
- readonly eventFunctionCallResults: string[] = [];
320
-
321
- finalContent: string | null = null;
322
- finalMessage: ChatCompletionMessageParam | undefined;
323
- finalChatCompletion: OpenAI.Chat.ChatCompletion | undefined;
324
- finalFunctionCall: OpenAI.Chat.ChatCompletionMessage.FunctionCall | undefined;
325
- finalFunctionCallResult: string | undefined;
326
- error: OpenAIError | undefined;
327
- gotConnect = false;
328
- gotEnd = false;
329
-
330
- constructor(public runner: ChatCompletionStreamingRunner) {
331
- runner
332
- .on('connect', () => (this.gotConnect = true))
333
- .on('chunk', (chunk) => this.eventChunks.push(chunk))
334
- .on('content', (delta, snapshot) => this.eventContents.push([delta, snapshot]))
335
- .on('message', (message) => this.eventMessages.push(message))
336
- .on('chatCompletion', (completion) => this.eventChatCompletions.push(completion))
337
- .on('functionCall', (functionCall) => this.eventFunctionCalls.push(functionCall))
338
- .on('functionCallResult', (result) => this.eventFunctionCallResults.push(result))
339
- .on('finalContent', (content) => (this.finalContent = content))
340
- .on('finalMessage', (message) => (this.finalMessage = message))
341
- .on('finalChatCompletion', (completion) => (this.finalChatCompletion = completion))
342
- .on('finalFunctionCall', (functionCall) => (this.finalFunctionCall = functionCall))
343
- .on('finalFunctionCallResult', (result) => (this.finalFunctionCallResult = result))
344
- .on('error', (error) => (this.error = error))
345
- .on('abort', (abort) => (this.error = abort))
346
- .on('end', () => (this.gotEnd = true));
347
- }
348
-
349
- async sanityCheck({ error }: { error?: string } = {}) {
350
- if (error) {
351
- expect(this.error?.message).toEqual(error);
352
- expect(this.runner.errored).toBe(true);
353
- await expect(this.runner.finalChatCompletion()).rejects.toThrow(error);
354
- await expect(this.runner.finalMessage()).rejects.toThrow(error);
355
- await expect(this.runner.finalContent()).rejects.toThrow(error);
356
- await expect(this.runner.finalFunctionCall()).rejects.toThrow(error);
357
- await expect(this.runner.finalFunctionCallResult()).rejects.toThrow(error);
358
- await expect(this.runner.done()).rejects.toThrow(error);
359
- } else {
360
- expect(this.error).toBeUndefined();
361
- expect(this.runner.errored).toBe(false);
362
- }
363
-
364
- if (!this.gotConnect) {
365
- expect(this.eventContents).toEqual([]);
366
- expect(this.eventMessages).toEqual([]);
367
- expect(this.eventChatCompletions).toEqual([]);
368
- expect(this.eventFunctionCalls).toEqual([]);
369
- expect(this.eventFunctionCallResults).toEqual([]);
370
- expect(this.finalContent).toBeUndefined();
371
- expect(this.finalMessage).toBeUndefined();
372
- expect(this.finalChatCompletion).toBeUndefined();
373
- expect(this.finalFunctionCall).toBeUndefined();
374
- expect(this.finalFunctionCallResult).toBeUndefined();
375
- expect(this.gotEnd).toBe(true);
376
- return;
377
- }
378
-
379
- if (error) return;
380
-
381
- if (this.eventContents.length) expect(this.eventChunks.length).toBeGreaterThan(0);
382
- expect(this.finalMessage).toEqual([...this.eventMessages].reverse().find((x) => x.role === 'assistant'));
383
- expect(await this.runner.finalMessage()).toEqual(this.finalMessage);
384
- expect(this.finalContent).toEqual(this.eventContents[this.eventContents.length - 1]?.[1] ?? null);
385
- expect(await this.runner.finalContent()).toEqual(this.finalContent);
386
- expect(this.finalChatCompletion).toEqual(this.eventChatCompletions[this.eventChatCompletions.length - 1]);
387
- expect(await this.runner.finalChatCompletion()).toEqual(this.finalChatCompletion);
388
- expect(this.finalFunctionCall).toEqual(this.eventFunctionCalls[this.eventFunctionCalls.length - 1]);
389
- expect(await this.runner.finalFunctionCall()).toEqual(this.finalFunctionCall);
390
- expect(this.finalFunctionCallResult).toEqual(
391
- this.eventFunctionCallResults[this.eventFunctionCallResults.length - 1],
392
- );
393
- expect(await this.runner.finalFunctionCallResult()).toEqual(this.finalFunctionCallResult);
394
- expect(this.eventChatCompletions).toEqual(this.runner.allChatCompletions());
395
- expect(this.eventMessages).toEqual(this.runner.messages.slice(-this.eventMessages.length));
396
- if (error) {
397
- expect(this.error?.message).toEqual(error);
398
- expect(this.runner.errored).toBe(true);
399
- } else {
400
- expect(this.error).toBeUndefined();
401
- expect(this.runner.errored).toBe(false);
402
- }
403
- expect(this.gotEnd).toBe(true);
404
- }
405
- }
406
-
407
- function _typeTests() {
408
- const openai = new OpenAI();
409
-
410
- openai.beta.chat.completions.runTools({
411
- messages: [
412
- { role: 'user', content: 'can you tell me how many properties are in {"a": 1, "b": 2, "c": 3}' },
413
- ],
414
- model: 'gpt-3.5-turbo',
415
- tools: [
416
- {
417
- type: 'function',
418
- function: {
419
- name: 'numProperties',
420
- function: (obj: object) => String(Object.keys(obj).length),
421
- parameters: { type: 'object' },
422
- parse: (str: string): object => {
423
- const result = JSON.parse(str);
424
- if (!(result instanceof Object) || Array.isArray(result)) {
425
- throw new Error('must be an object');
426
- }
427
- return result;
428
- },
429
- description: 'gets the number of properties on an object',
430
- },
431
- },
432
- {
433
- type: 'function',
434
- function: {
435
- function: (str: string) => String(str.length),
436
- parameters: { type: 'string' },
437
- description: 'gets the length of a string',
438
- },
439
- },
440
- {
441
- type: 'function',
442
- // @ts-expect-error function must accept string if parse is omitted
443
- function: {
444
- function: (obj: object) => String(Object.keys(obj).length),
445
- parameters: { type: 'object' },
446
- description: 'gets the number of properties on an object',
447
- },
448
- },
449
- ],
450
- });
451
- openai.beta.chat.completions.runTools({
452
- messages: [
453
- { role: 'user', content: 'can you tell me how many properties are in {"a": 1, "b": 2, "c": 3}' },
454
- ],
455
- model: 'gpt-3.5-turbo',
456
- tools: [
457
- new ParsingToolFunction({
458
- name: 'numProperties',
459
- // @ts-expect-error parse and function don't match
460
- parse: (str: string) => str,
461
- function: (obj: object) => String(Object.keys(obj).length),
462
- parameters: { type: 'object' },
463
- description: 'gets the number of properties on an object',
464
- }),
465
- ],
466
- });
467
- openai.beta.chat.completions.runTools({
468
- messages: [
469
- { role: 'user', content: 'can you tell me how many properties are in {"a": 1, "b": 2, "c": 3}' },
470
- ],
471
- model: 'gpt-3.5-turbo',
472
- tools: [
473
- new ParsingToolFunction({
474
- name: 'numProperties',
475
- parse: (str: string): object => {
476
- const result = JSON.parse(str);
477
- if (!(result instanceof Object) || Array.isArray(result)) {
478
- throw new Error('must be an object');
479
- }
480
- return result;
481
- },
482
- function: (obj: object) => String(Object.keys(obj).length),
483
- parameters: { type: 'object' },
484
- description: 'gets the number of properties on an object',
485
- }),
486
- new ParsingToolFunction({
487
- name: 'keys',
488
- parse: (str: string): object => {
489
- const result = JSON.parse(str);
490
- if (!(result instanceof Object)) {
491
- throw new Error('must be an Object');
492
- }
493
- return result;
494
- },
495
- function: (obj: object) => Object.keys(obj).join(', '),
496
- parameters: { type: 'object' },
497
- description: 'gets the number of properties on an object',
498
- }),
499
- new ParsingToolFunction({
500
- name: 'len2',
501
- // @ts-expect-error parse and function don't match
502
- parse: (str: string) => str,
503
- function: (obj: object) => String(Object.keys(obj).length),
504
- parameters: { type: 'object' },
505
- description: 'gets the number of properties on an object',
506
- }),
507
- ],
508
- });
509
- openai.beta.chat.completions.runTools({
510
- messages: [
511
- { role: 'user', content: 'can you tell me how many properties are in {"a": 1, "b": 2, "c": 3}' },
512
- ],
513
- model: 'gpt-3.5-turbo',
514
- // @ts-ignore error occurs here in TS 4
515
- tools: [
516
- {
517
- type: 'function',
518
- function: {
519
- name: 'numProperties',
520
- parse: (str: string): object => {
521
- const result = JSON.parse(str);
522
- if (!(result instanceof Object) || Array.isArray(result)) {
523
- throw new Error('must be an object');
524
- }
525
- return result;
526
- },
527
- function: (obj: object) => String(Object.keys(obj).length),
528
- parameters: { type: 'object' },
529
- description: 'gets the number of properties on an object',
530
- },
531
- },
532
- {
533
- type: 'function',
534
- function: {
535
- name: 'keys',
536
- parse: (str: string): object => {
537
- const result = JSON.parse(str);
538
- if (!(result instanceof Object)) {
539
- throw new Error('must be an Object');
540
- }
541
- return result;
542
- },
543
- function: (obj: object) => Object.keys(obj).join(', '),
544
- parameters: { type: 'object' },
545
- description: 'gets the number of properties on an object',
546
- },
547
- },
548
- {
549
- type: 'function',
550
- function: {
551
- name: 'len2',
552
- parse: (str: string) => str,
553
- // @ts-ignore error occurs here in TS 5
554
- // function input doesn't match parse output
555
- function: (obj: object) => String(Object.keys(obj).length),
556
- parameters: { type: 'object' },
557
- description: 'gets the number of properties on an object',
558
- },
559
- },
560
- ] as const,
561
- });
562
- }
563
-
564
- describe('resource completions', () => {
565
- describe('runTools with stream: false', () => {
566
- test('successful flow', async () => {
567
- const { fetch, handleRequest } = mockChatCompletionFetch();
568
-
569
- const openai = new OpenAI({ apiKey: 'something1234', baseURL: 'http://127.0.0.1:4010', fetch });
570
-
571
- const runner = openai.beta.chat.completions.runTools({
572
- messages: [{ role: 'user', content: 'tell me what the weather is like' }],
573
- model: 'gpt-3.5-turbo',
574
- tools: [
575
- {
576
- type: 'function',
577
- function: {
578
- function: function getWeather() {
579
- return `it's raining`;
580
- },
581
- parameters: {},
582
- description: 'gets the weather',
583
- },
584
- },
585
- ],
586
- });
587
- const listener = new RunnerListener(runner);
588
-
589
- await handleRequest(async (request) => {
590
- expect(request.messages).toEqual([{ role: 'user', content: 'tell me what the weather is like' }]);
591
- return {
592
- id: '1',
593
- choices: [
594
- {
595
- index: 0,
596
- finish_reason: 'function_call',
597
- logprobs: null,
598
- message: {
599
- role: 'assistant',
600
- content: null,
601
- tool_calls: [
602
- {
603
- type: 'function',
604
- id: '123',
605
- function: {
606
- arguments: '',
607
- name: 'getWeather',
608
- },
609
- },
610
- ],
611
- },
612
- },
613
- ],
614
- created: Math.floor(Date.now() / 1000),
615
- model: 'gpt-3.5-turbo',
616
- object: 'chat.completion',
617
- };
618
- });
619
-
620
- await handleRequest(async (request) => {
621
- expect(request.messages).toEqual([
622
- { role: 'user', content: 'tell me what the weather is like' },
623
- {
624
- role: 'assistant',
625
- content: null,
626
- tool_calls: [
627
- {
628
- type: 'function',
629
- id: '123',
630
- function: {
631
- arguments: '',
632
- name: 'getWeather',
633
- },
634
- },
635
- ],
636
- },
637
- {
638
- role: 'tool',
639
- content: `it's raining`,
640
- tool_call_id: '123',
641
- },
642
- ]);
643
-
644
- return {
645
- id: '2',
646
- choices: [
647
- {
648
- index: 0,
649
- finish_reason: 'stop',
650
- logprobs: null,
651
- message: {
652
- role: 'assistant',
653
- content: `it's raining`,
654
- },
655
- },
656
- ],
657
- created: Math.floor(Date.now() / 1000),
658
- model: 'gpt-3.5-turbo',
659
- object: 'chat.completion',
660
- };
661
- });
662
-
663
- await runner.done();
664
-
665
- expect(listener.messages).toEqual([
666
- { role: 'user', content: 'tell me what the weather is like' },
667
- {
668
- role: 'assistant',
669
- content: null,
670
- tool_calls: [
671
- {
672
- type: 'function',
673
- id: '123',
674
- function: {
675
- arguments: '',
676
- name: 'getWeather',
677
- },
678
- },
679
- ],
680
- },
681
- { role: 'tool', content: `it's raining`, tool_call_id: '123' },
682
- { role: 'assistant', content: "it's raining" },
683
- ]);
684
- expect(listener.functionCallResults).toEqual([`it's raining`]);
685
- await listener.sanityCheck();
686
- });
687
- test('flow with abort', async () => {
688
- const { fetch, handleRequest } = mockChatCompletionFetch();
689
-
690
- const openai = new OpenAI({ apiKey: 'something1234', baseURL: 'http://127.0.0.1:4010', fetch });
691
-
692
- const controller = new AbortController();
693
- const runner = openai.beta.chat.completions.runTools(
694
- {
695
- messages: [{ role: 'user', content: 'tell me what the weather is like' }],
696
- model: 'gpt-3.5-turbo',
697
- tools: [
698
- {
699
- type: 'function',
700
- function: {
701
- function: function getWeather() {
702
- return `it's raining`;
703
- },
704
- parameters: {},
705
- description: 'gets the weather',
706
- },
707
- },
708
- ],
709
- },
710
- { signal: controller.signal },
711
- );
712
- const listener = new RunnerListener(runner);
713
-
714
- await handleRequest(async (request) => {
715
- expect(request.messages).toEqual([{ role: 'user', content: 'tell me what the weather is like' }]);
716
- return {
717
- id: '1',
718
- choices: [
719
- {
720
- index: 0,
721
- finish_reason: 'function_call',
722
- logprobs: null,
723
- message: {
724
- role: 'assistant',
725
- content: null,
726
- tool_calls: [
727
- {
728
- type: 'function',
729
- id: '123',
730
- function: {
731
- arguments: '',
732
- name: 'getWeather',
733
- },
734
- },
735
- ],
736
- },
737
- },
738
- ],
739
- created: Math.floor(Date.now() / 1000),
740
- model: 'gpt-3.5-turbo',
741
- object: 'chat.completion',
742
- };
743
- });
744
-
745
- controller.abort();
746
-
747
- await runner.done().catch(() => {});
748
-
749
- expect(listener.messages).toEqual([
750
- { role: 'user', content: 'tell me what the weather is like' },
751
- {
752
- role: 'assistant',
753
- content: null,
754
- tool_calls: [
755
- {
756
- type: 'function',
757
- id: '123',
758
- function: {
759
- arguments: '',
760
- name: 'getWeather',
761
- },
762
- },
763
- ],
764
- },
765
- { role: 'tool', content: `it's raining`, tool_call_id: '123' },
766
- ]);
767
- expect(listener.functionCallResults).toEqual([`it's raining`]);
768
- await listener.sanityCheck({ error: 'Request was aborted.' });
769
- expect(runner.aborted).toBe(true);
770
- });
771
- test('successful flow with parse', async () => {
772
- const { fetch, handleRequest } = mockChatCompletionFetch();
773
-
774
- const openai = new OpenAI({ apiKey: 'something1234', baseURL: 'http://127.0.0.1:4010', fetch });
775
-
776
- const runner = openai.beta.chat.completions.runTools({
777
- messages: [
778
- {
779
- role: 'user',
780
- content: 'can you tell me how many properties are in {"a": 1, "b": 2, "c": 3}',
781
- },
782
- ],
783
- model: 'gpt-3.5-turbo',
784
- tools: [
785
- new ParsingToolFunction({
786
- name: 'numProperties',
787
- function: (obj: object) => String(Object.keys(obj).length),
788
- parameters: { type: 'object' },
789
- parse: (str: string): object => {
790
- const result = JSON.parse(str);
791
- if (!(result instanceof Object) || Array.isArray(result)) {
792
- throw new Error('must be an object');
793
- }
794
- return result;
795
- },
796
- description: 'gets the number of properties on an object',
797
- }),
798
- ],
799
- });
800
- const listener = new RunnerListener(runner);
801
-
802
- await handleRequest(async (request) => {
803
- expect(request.messages).toEqual([
804
- {
805
- role: 'user',
806
- content: 'can you tell me how many properties are in {"a": 1, "b": 2, "c": 3}',
807
- },
808
- ]);
809
- return {
810
- id: '1',
811
- choices: [
812
- {
813
- index: 0,
814
- finish_reason: 'function_call',
815
- logprobs: null,
816
- message: {
817
- role: 'assistant',
818
- content: null,
819
- tool_calls: [
820
- {
821
- type: 'function',
822
- id: '123',
823
- function: {
824
- arguments: '{"a": 1, "b": 2, "c": 3}',
825
- name: 'numProperties',
826
- },
827
- },
828
- ],
829
- },
830
- },
831
- ],
832
- created: Math.floor(Date.now() / 1000),
833
- model: 'gpt-3.5-turbo',
834
- object: 'chat.completion',
835
- usage: {
836
- completion_tokens: 5,
837
- prompt_tokens: 20,
838
- total_tokens: 25,
839
- },
840
- };
841
- });
842
-
843
- await handleRequest(async (request) => {
844
- expect(request.messages).toEqual([
845
- {
846
- role: 'user',
847
- content: 'can you tell me how many properties are in {"a": 1, "b": 2, "c": 3}',
848
- },
849
- {
850
- role: 'assistant',
851
- content: null,
852
- tool_calls: [
853
- {
854
- type: 'function',
855
- id: '123',
856
- function: {
857
- arguments: '{"a": 1, "b": 2, "c": 3}',
858
- name: 'numProperties',
859
- },
860
- },
861
- ],
862
- },
863
- {
864
- role: 'tool',
865
- content: '3',
866
- tool_call_id: '123',
867
- },
868
- ]);
869
- return {
870
- id: '2',
871
- choices: [
872
- {
873
- index: 0,
874
- finish_reason: 'stop',
875
- logprobs: null,
876
- message: {
877
- role: 'assistant',
878
- content: `there are 3 properties in {"a": 1, "b": 2, "c": 3}`,
879
- },
880
- },
881
- ],
882
- created: Math.floor(Date.now() / 1000),
883
- model: 'gpt-3.5-turbo',
884
- object: 'chat.completion',
885
- usage: {
886
- completion_tokens: 10,
887
- prompt_tokens: 25,
888
- total_tokens: 35,
889
- },
890
- };
891
- });
892
-
893
- await runner.done();
894
-
895
- expect(listener.messages).toEqual([
896
- {
897
- role: 'user',
898
- content: 'can you tell me how many properties are in {"a": 1, "b": 2, "c": 3}',
899
- },
900
- {
901
- role: 'assistant',
902
- content: null,
903
- tool_calls: [
904
- {
905
- type: 'function',
906
- id: '123',
907
- function: { name: 'numProperties', arguments: '{"a": 1, "b": 2, "c": 3}' },
908
- },
909
- ],
910
- },
911
- { role: 'tool', content: '3', tool_call_id: '123' },
912
- { role: 'assistant', content: 'there are 3 properties in {"a": 1, "b": 2, "c": 3}' },
913
- ]);
914
- expect(listener.functionCallResults).toEqual(['3']);
915
- await listener.sanityCheck();
916
- });
917
- test('flow with parse error', async () => {
918
- const { fetch, handleRequest } = mockChatCompletionFetch();
919
-
920
- const openai = new OpenAI({ apiKey: 'something1234', baseURL: 'http://127.0.0.1:4010', fetch });
921
-
922
- const runner = openai.beta.chat.completions.runTools({
923
- messages: [
924
- {
925
- role: 'user',
926
- content: 'can you tell me how many properties are in {"a": 1, "b": 2, "c": 3}',
927
- },
928
- ],
929
- model: 'gpt-3.5-turbo',
930
- tools: [
931
- new ParsingToolFunction({
932
- name: 'numProperties',
933
- function: (obj: object) => String(Object.keys(obj).length),
934
- parameters: { type: 'object' },
935
- parse: (str: string): object => {
936
- const result = JSON.parse(str);
937
- if (!(result instanceof Object) || Array.isArray(result)) {
938
- throw new Error('must be an object');
939
- }
940
- return result;
941
- },
942
- description: 'gets the number of properties on an object',
943
- }),
944
- ],
945
- });
946
- const listener = new RunnerListener(runner);
947
-
948
- await Promise.all([
949
- handleRequest(async (request) => {
950
- expect(request.messages).toEqual([
951
- {
952
- role: 'user',
953
- content: 'can you tell me how many properties are in {"a": 1, "b": 2, "c": 3}',
954
- },
955
- ]);
956
- return {
957
- id: '1',
958
- choices: [
959
- {
960
- index: 0,
961
- finish_reason: 'function_call',
962
- logprobs: null,
963
- message: {
964
- role: 'assistant',
965
- content: null,
966
- tool_calls: [
967
- {
968
- type: 'function',
969
- id: '123',
970
- function: {
971
- arguments: '[{"a": 1, "b": 2, "c": 3}]',
972
- name: 'numProperties',
973
- },
974
- },
975
- ],
976
- },
977
- },
978
- ],
979
- created: Math.floor(Date.now() / 1000),
980
- model: 'gpt-3.5-turbo',
981
- object: 'chat.completion',
982
- };
983
- }),
984
- handleRequest(async (request) => {
985
- expect(request.messages).toEqual([
986
- {
987
- role: 'user',
988
- content: 'can you tell me how many properties are in {"a": 1, "b": 2, "c": 3}',
989
- },
990
- {
991
- role: 'assistant',
992
- content: null,
993
- tool_calls: [
994
- {
995
- type: 'function',
996
- id: '123',
997
- function: {
998
- arguments: '[{"a": 1, "b": 2, "c": 3}]',
999
- name: 'numProperties',
1000
- },
1001
- },
1002
- ],
1003
- },
1004
- {
1005
- role: 'tool',
1006
- content: `must be an object`,
1007
- tool_call_id: '123',
1008
- },
1009
- ]);
1010
- return {
1011
- id: '2',
1012
- choices: [
1013
- {
1014
- index: 0,
1015
- finish_reason: 'function_call',
1016
- logprobs: null,
1017
- message: {
1018
- role: 'assistant',
1019
- content: null,
1020
- tool_calls: [
1021
- {
1022
- type: 'function',
1023
- id: '1234',
1024
- function: {
1025
- arguments: '{"a": 1, "b": 2, "c": 3}',
1026
- name: 'numProperties',
1027
- },
1028
- },
1029
- ],
1030
- },
1031
- },
1032
- ],
1033
- created: Math.floor(Date.now() / 1000),
1034
- model: 'gpt-3.5-turbo',
1035
- object: 'chat.completion',
1036
- };
1037
- }),
1038
- handleRequest(async (request) => {
1039
- expect(request.messages).toEqual([
1040
- {
1041
- role: 'user',
1042
- content: 'can you tell me how many properties are in {"a": 1, "b": 2, "c": 3}',
1043
- },
1044
- {
1045
- role: 'assistant',
1046
- content: null,
1047
- tool_calls: [
1048
- {
1049
- type: 'function',
1050
- id: '123',
1051
- function: {
1052
- arguments: '[{"a": 1, "b": 2, "c": 3}]',
1053
- name: 'numProperties',
1054
- },
1055
- },
1056
- ],
1057
- },
1058
- {
1059
- role: 'tool',
1060
- content: `must be an object`,
1061
- tool_call_id: '123',
1062
- },
1063
- {
1064
- role: 'assistant',
1065
- content: null,
1066
- tool_calls: [
1067
- {
1068
- type: 'function',
1069
- id: '1234',
1070
- function: {
1071
- arguments: '{"a": 1, "b": 2, "c": 3}',
1072
- name: 'numProperties',
1073
- },
1074
- },
1075
- ],
1076
- },
1077
- {
1078
- role: 'tool',
1079
- content: '3',
1080
- tool_call_id: '1234',
1081
- },
1082
- ]);
1083
- return {
1084
- id: '3',
1085
- choices: [
1086
- {
1087
- index: 0,
1088
- finish_reason: 'stop',
1089
- logprobs: null,
1090
- message: {
1091
- role: 'assistant',
1092
- content: `there are 3 properties in {"a": 1, "b": 2, "c": 3}`,
1093
- },
1094
- },
1095
- ],
1096
- created: Math.floor(Date.now() / 1000),
1097
- model: 'gpt-3.5-turbo',
1098
- object: 'chat.completion',
1099
- };
1100
- }),
1101
- runner.done(),
1102
- ]);
1103
-
1104
- expect(listener.messages).toEqual([
1105
- {
1106
- role: 'user',
1107
- content: 'can you tell me how many properties are in {"a": 1, "b": 2, "c": 3}',
1108
- },
1109
- {
1110
- role: 'assistant',
1111
- content: null,
1112
- tool_calls: [
1113
- {
1114
- type: 'function',
1115
- id: '123',
1116
- function: { name: 'numProperties', arguments: '[{"a": 1, "b": 2, "c": 3}]' },
1117
- },
1118
- ],
1119
- },
1120
- { role: 'tool', content: `must be an object`, tool_call_id: '123' },
1121
- {
1122
- role: 'assistant',
1123
- content: null,
1124
- tool_calls: [
1125
- {
1126
- type: 'function',
1127
- id: '1234',
1128
- function: { name: 'numProperties', arguments: '{"a": 1, "b": 2, "c": 3}' },
1129
- },
1130
- ],
1131
- },
1132
- { role: 'tool', content: '3', tool_call_id: '1234' },
1133
- { role: 'assistant', content: 'there are 3 properties in {"a": 1, "b": 2, "c": 3}' },
1134
- ]);
1135
- expect(listener.functionCallResults).toEqual([`must be an object`, '3']);
1136
- await listener.sanityCheck();
1137
- });
1138
- test('single function call', async () => {
1139
- const { fetch, handleRequest } = mockChatCompletionFetch();
1140
-
1141
- const openai = new OpenAI({ apiKey: 'something1234', baseURL: 'http://127.0.0.1:4010', fetch });
1142
-
1143
- const runner = openai.beta.chat.completions.runTools({
1144
- messages: [{ role: 'user', content: 'tell me what the weather is like' }],
1145
- model: 'gpt-3.5-turbo',
1146
- tool_choice: {
1147
- type: 'function',
1148
- function: {
1149
- name: 'getWeather',
1150
- },
1151
- },
1152
- tools: [
1153
- {
1154
- type: 'function',
1155
- function: {
1156
- function: function getWeather() {
1157
- return `it's raining`;
1158
- },
1159
- parameters: {},
1160
- description: 'gets the weather',
1161
- },
1162
- },
1163
- ],
1164
- });
1165
- const listener = new RunnerListener(runner);
1166
-
1167
- await Promise.all([
1168
- handleRequest(async (request) => {
1169
- expect(request.messages).toEqual([{ role: 'user', content: 'tell me what the weather is like' }]);
1170
- return {
1171
- id: '1',
1172
- choices: [
1173
- {
1174
- index: 0,
1175
- finish_reason: 'function_call',
1176
- logprobs: null,
1177
- message: {
1178
- role: 'assistant',
1179
- content: null,
1180
- tool_calls: [
1181
- {
1182
- type: 'function',
1183
- id: '123',
1184
- function: {
1185
- arguments: '',
1186
- name: 'getWeather',
1187
- },
1188
- },
1189
- ],
1190
- },
1191
- },
1192
- ],
1193
- created: Math.floor(Date.now() / 1000),
1194
- model: 'gpt-3.5-turbo',
1195
- object: 'chat.completion',
1196
- };
1197
- }),
1198
- runner.done(),
1199
- ]);
1200
-
1201
- expect(listener.messages).toEqual([
1202
- { role: 'user', content: 'tell me what the weather is like' },
1203
- {
1204
- role: 'assistant',
1205
- content: null,
1206
- tool_calls: [
1207
- {
1208
- type: 'function',
1209
- id: '123',
1210
- function: {
1211
- arguments: '',
1212
- name: 'getWeather',
1213
- },
1214
- },
1215
- ],
1216
- },
1217
- { role: 'tool', content: `it's raining`, tool_call_id: '123' },
1218
- ]);
1219
- expect(listener.functionCallResults).toEqual([`it's raining`]);
1220
- await listener.sanityCheck();
1221
- });
1222
- test('wrong function name', async () => {
1223
- const { fetch, handleRequest } = mockChatCompletionFetch();
1224
-
1225
- const openai = new OpenAI({ apiKey: 'something1234', baseURL: 'http://127.0.0.1:4010', fetch });
1226
-
1227
- const runner = openai.beta.chat.completions.runTools({
1228
- messages: [{ role: 'user', content: 'tell me what the weather is like' }],
1229
- model: 'gpt-3.5-turbo',
1230
- tools: [
1231
- {
1232
- type: 'function',
1233
- function: {
1234
- function: function getWeather() {
1235
- return `it's raining`;
1236
- },
1237
- parameters: {},
1238
- description: 'gets the weather',
1239
- },
1240
- },
1241
- ],
1242
- });
1243
- const listener = new RunnerListener(runner);
1244
-
1245
- await Promise.all([
1246
- handleRequest(async (request) => {
1247
- expect(request.messages).toEqual([{ role: 'user', content: 'tell me what the weather is like' }]);
1248
- return {
1249
- id: '1',
1250
- choices: [
1251
- {
1252
- index: 0,
1253
- finish_reason: 'function_call',
1254
- logprobs: null,
1255
- message: {
1256
- role: 'assistant',
1257
- content: null,
1258
- tool_calls: [
1259
- {
1260
- type: 'function',
1261
- id: '123',
1262
- function: {
1263
- arguments: '',
1264
- name: 'get_weather',
1265
- },
1266
- },
1267
- ],
1268
- },
1269
- },
1270
- ],
1271
- created: Math.floor(Date.now() / 1000),
1272
- model: 'gpt-3.5-turbo',
1273
- object: 'chat.completion',
1274
- };
1275
- }),
1276
- handleRequest(async (request) => {
1277
- expect(request.messages).toEqual([
1278
- { role: 'user', content: 'tell me what the weather is like' },
1279
- {
1280
- role: 'assistant',
1281
- content: null,
1282
- tool_calls: [
1283
- {
1284
- type: 'function',
1285
- id: '123',
1286
- function: {
1287
- arguments: '',
1288
- name: 'get_weather',
1289
- },
1290
- },
1291
- ],
1292
- },
1293
- {
1294
- role: 'tool',
1295
- content: `Invalid tool_call: "get_weather". Available options are: "getWeather". Please try again`,
1296
- tool_call_id: '123',
1297
- },
1298
- ]);
1299
- return {
1300
- id: '2',
1301
- choices: [
1302
- {
1303
- index: 0,
1304
- finish_reason: 'function_call',
1305
- logprobs: null,
1306
- message: {
1307
- role: 'assistant',
1308
- content: null,
1309
- tool_calls: [
1310
- {
1311
- type: 'function',
1312
- id: '1234',
1313
- function: {
1314
- arguments: '',
1315
- name: 'getWeather',
1316
- },
1317
- },
1318
- ],
1319
- },
1320
- },
1321
- ],
1322
- created: Math.floor(Date.now() / 1000),
1323
- model: 'gpt-3.5-turbo',
1324
- object: 'chat.completion',
1325
- };
1326
- }),
1327
- handleRequest(async (request) => {
1328
- expect(request.messages).toEqual([
1329
- { role: 'user', content: 'tell me what the weather is like' },
1330
- {
1331
- role: 'assistant',
1332
- content: null,
1333
- tool_calls: [
1334
- {
1335
- type: 'function',
1336
- id: '123',
1337
- function: {
1338
- arguments: '',
1339
- name: 'get_weather',
1340
- },
1341
- },
1342
- ],
1343
- },
1344
- {
1345
- role: 'tool',
1346
- content: `Invalid tool_call: "get_weather". Available options are: "getWeather". Please try again`,
1347
- tool_call_id: '123',
1348
- },
1349
- {
1350
- role: 'assistant',
1351
- content: null,
1352
- tool_calls: [
1353
- {
1354
- type: 'function',
1355
- id: '1234',
1356
- function: {
1357
- arguments: '',
1358
- name: 'getWeather',
1359
- },
1360
- },
1361
- ],
1362
- },
1363
- {
1364
- role: 'tool',
1365
- content: `it's raining`,
1366
- tool_call_id: '1234',
1367
- },
1368
- ]);
1369
- return {
1370
- id: '3',
1371
- choices: [
1372
- {
1373
- index: 0,
1374
- finish_reason: 'stop',
1375
- logprobs: null,
1376
- message: {
1377
- role: 'assistant',
1378
- content: `it's raining`,
1379
- },
1380
- },
1381
- ],
1382
- created: Math.floor(Date.now() / 1000),
1383
- model: 'gpt-3.5-turbo',
1384
- object: 'chat.completion',
1385
- };
1386
- }),
1387
- runner.done(),
1388
- ]);
1389
-
1390
- expect(listener.messages).toEqual([
1391
- { role: 'user', content: 'tell me what the weather is like' },
1392
- {
1393
- role: 'assistant',
1394
- content: null,
1395
- tool_calls: [{ type: 'function', id: '123', function: { name: 'get_weather', arguments: '' } }],
1396
- },
1397
- {
1398
- role: 'tool',
1399
- content: `Invalid tool_call: "get_weather". Available options are: "getWeather". Please try again`,
1400
- tool_call_id: '123',
1401
- },
1402
- {
1403
- role: 'assistant',
1404
- content: null,
1405
- tool_calls: [{ type: 'function', id: '1234', function: { name: 'getWeather', arguments: '' } }],
1406
- },
1407
- { role: 'tool', content: `it's raining`, tool_call_id: '1234' },
1408
- { role: 'assistant', content: "it's raining" },
1409
- ]);
1410
- expect(listener.functionCallResults).toEqual([
1411
- `Invalid tool_call: "get_weather". Available options are: "getWeather". Please try again`,
1412
- `it's raining`,
1413
- ]);
1414
- await listener.sanityCheck();
1415
- });
1416
- });
1417
-
1418
- describe('runTools with stream: true', () => {
1419
- test('successful flow', async () => {
1420
- const { fetch, handleRequest } = mockStreamingChatCompletionFetch();
1421
-
1422
- const openai = new OpenAI({ apiKey: 'something1234', baseURL: 'http://127.0.0.1:4010', fetch });
1423
-
1424
- const runner = openai.beta.chat.completions.runTools({
1425
- stream: true,
1426
- messages: [{ role: 'user', content: 'tell me what the weather is like' }],
1427
- model: 'gpt-3.5-turbo',
1428
- tools: [
1429
- {
1430
- type: 'function',
1431
- function: {
1432
- function: function getWeather() {
1433
- return `it's raining`;
1434
- },
1435
- parameters: {},
1436
- description: 'gets the weather',
1437
- },
1438
- },
1439
- ],
1440
- });
1441
- const listener = new StreamingRunnerListener(runner);
1442
-
1443
- await Promise.all([
1444
- handleRequest(async function* (request): AsyncIterable<OpenAI.Chat.ChatCompletionChunk> {
1445
- expect(request.messages).toEqual([{ role: 'user', content: 'tell me what the weather is like' }]);
1446
- yield {
1447
- id: '1',
1448
- choices: [
1449
- {
1450
- index: 0,
1451
- finish_reason: 'function_call',
1452
- logprobs: null,
1453
- delta: {
1454
- role: 'assistant',
1455
- content: null,
1456
- tool_calls: [
1457
- {
1458
- type: 'function',
1459
- index: 0,
1460
- id: '123',
1461
- function: {
1462
- arguments: '',
1463
- name: 'getWeather',
1464
- },
1465
- },
1466
- ],
1467
- },
1468
- },
1469
- ],
1470
- created: Math.floor(Date.now() / 1000),
1471
- model: 'gpt-3.5-turbo',
1472
- object: 'chat.completion.chunk',
1473
- };
1474
- }),
1475
- handleRequest(async function* (request): AsyncIterable<OpenAI.Chat.ChatCompletionChunk> {
1476
- expect(request.messages).toEqual([
1477
- { role: 'user', content: 'tell me what the weather is like' },
1478
- {
1479
- role: 'assistant',
1480
- content: null,
1481
- tool_calls: [
1482
- {
1483
- type: 'function',
1484
- id: '123',
1485
- function: {
1486
- arguments: '',
1487
- name: 'getWeather',
1488
- },
1489
- },
1490
- ],
1491
- },
1492
- {
1493
- role: 'tool',
1494
- content: `it's raining`,
1495
- tool_call_id: '123',
1496
- },
1497
- ]);
1498
- for (const choice of contentChoiceDeltas(`it's raining`)) {
1499
- yield {
1500
- id: '2',
1501
- choices: [choice],
1502
- created: Math.floor(Date.now() / 1000),
1503
- model: 'gpt-3.5-turbo',
1504
- object: 'chat.completion.chunk',
1505
- };
1506
- }
1507
- }),
1508
- runner.done(),
1509
- ]);
1510
-
1511
- expect(listener.eventMessages).toEqual([
1512
- {
1513
- role: 'assistant',
1514
- content: null,
1515
- tool_calls: [
1516
- {
1517
- type: 'function',
1518
- id: '123',
1519
- function: {
1520
- arguments: '',
1521
- name: 'getWeather',
1522
- },
1523
- },
1524
- ],
1525
- },
1526
- { role: 'tool', content: `it's raining`, tool_call_id: '123' },
1527
- { role: 'assistant', content: "it's raining" },
1528
- ]);
1529
- expect(listener.eventFunctionCallResults).toEqual([`it's raining`]);
1530
- await listener.sanityCheck();
1531
- });
1532
- test('flow with abort', async () => {
1533
- const { fetch, handleRequest } = mockStreamingChatCompletionFetch();
1534
-
1535
- const openai = new OpenAI({ apiKey: 'something1234', baseURL: 'http://127.0.0.1:4010', fetch });
1536
-
1537
- const controller = new AbortController();
1538
- const runner = openai.beta.chat.completions.runTools(
1539
- {
1540
- stream: true,
1541
- messages: [{ role: 'user', content: 'tell me what the weather is like' }],
1542
- model: 'gpt-3.5-turbo',
1543
- tools: [
1544
- {
1545
- type: 'function',
1546
- function: {
1547
- function: function getWeather() {
1548
- return `it's raining`;
1549
- },
1550
- parameters: {},
1551
- description: 'gets the weather',
1552
- },
1553
- },
1554
- ],
1555
- },
1556
- { signal: controller.signal },
1557
- );
1558
- runner.on('functionCallResult', () => controller.abort());
1559
- const listener = new StreamingRunnerListener(runner);
1560
-
1561
- await handleRequest(async function* (request): AsyncIterable<OpenAI.Chat.ChatCompletionChunk> {
1562
- expect(request.messages).toEqual([{ role: 'user', content: 'tell me what the weather is like' }]);
1563
- yield {
1564
- id: '1',
1565
- choices: [
1566
- {
1567
- index: 0,
1568
- finish_reason: 'function_call',
1569
- delta: {
1570
- role: 'assistant',
1571
- content: null,
1572
- tool_calls: [
1573
- {
1574
- type: 'function',
1575
- index: 0,
1576
- id: '123',
1577
- function: {
1578
- arguments: '',
1579
- name: 'getWeather',
1580
- },
1581
- },
1582
- ],
1583
- },
1584
- },
1585
- ],
1586
- created: Math.floor(Date.now() / 1000),
1587
- model: 'gpt-3.5-turbo',
1588
- object: 'chat.completion.chunk',
1589
- };
1590
- });
1591
-
1592
- await runner.done().catch(() => {});
1593
-
1594
- expect(listener.eventMessages).toEqual([
1595
- {
1596
- role: 'assistant',
1597
- content: null,
1598
- tool_calls: [
1599
- {
1600
- type: 'function',
1601
- id: '123',
1602
- function: {
1603
- arguments: '',
1604
- name: 'getWeather',
1605
- },
1606
- },
1607
- ],
1608
- },
1609
- { role: 'tool', content: `it's raining`, tool_call_id: '123' },
1610
- ]);
1611
- expect(listener.eventFunctionCallResults).toEqual([`it's raining`]);
1612
- await listener.sanityCheck({ error: 'Request was aborted.' });
1613
- expect(runner.aborted).toBe(true);
1614
- });
1615
- test('successful flow with parse', async () => {
1616
- const { fetch, handleRequest } = mockStreamingChatCompletionFetch();
1617
-
1618
- const openai = new OpenAI({ apiKey: 'something1234', baseURL: 'http://127.0.0.1:4010', fetch });
1619
-
1620
- const runner = openai.beta.chat.completions.runTools({
1621
- stream: true,
1622
- messages: [
1623
- {
1624
- role: 'user',
1625
- content: 'can you tell me how many properties are in {"a": 1, "b": 2, "c": 3}',
1626
- },
1627
- ],
1628
- model: 'gpt-3.5-turbo',
1629
- tools: [
1630
- new ParsingToolFunction({
1631
- name: 'numProperties',
1632
- function: (obj: object) => String(Object.keys(obj).length),
1633
- parameters: { type: 'object' },
1634
- parse: (str: string): object => {
1635
- const result = JSON.parse(str);
1636
- if (!(result instanceof Object) || Array.isArray(result)) {
1637
- throw new Error('must be an object');
1638
- }
1639
- return result;
1640
- },
1641
- description: 'gets the number of properties on an object',
1642
- }),
1643
- ],
1644
- });
1645
- const listener = new StreamingRunnerListener(runner);
1646
-
1647
- await Promise.all([
1648
- handleRequest(async function* (request): AsyncIterable<OpenAI.Chat.ChatCompletionChunk> {
1649
- expect(request.messages).toEqual([
1650
- {
1651
- role: 'user',
1652
- content: 'can you tell me how many properties are in {"a": 1, "b": 2, "c": 3}',
1653
- },
1654
- ]);
1655
- yield {
1656
- id: '1',
1657
- choices: [
1658
- {
1659
- index: 0,
1660
- finish_reason: 'function_call',
1661
- delta: {
1662
- role: 'assistant',
1663
- content: null,
1664
- tool_calls: [
1665
- {
1666
- type: 'function',
1667
- id: '123',
1668
- index: 0,
1669
- function: {
1670
- arguments: '{"a": 1, "b": 2, "c": 3}',
1671
- name: 'numProperties',
1672
- },
1673
- },
1674
- ],
1675
- },
1676
- },
1677
- ],
1678
- created: Math.floor(Date.now() / 1000),
1679
- model: 'gpt-3.5-turbo',
1680
- object: 'chat.completion.chunk',
1681
- };
1682
- }),
1683
- handleRequest(async function* (request): AsyncIterable<OpenAI.Chat.ChatCompletionChunk> {
1684
- expect(request.messages).toEqual([
1685
- {
1686
- role: 'user',
1687
- content: 'can you tell me how many properties are in {"a": 1, "b": 2, "c": 3}',
1688
- },
1689
- {
1690
- role: 'assistant',
1691
- content: null,
1692
- tool_calls: [
1693
- {
1694
- type: 'function',
1695
- id: '123',
1696
- function: {
1697
- arguments: '{"a": 1, "b": 2, "c": 3}',
1698
- name: 'numProperties',
1699
- },
1700
- },
1701
- ],
1702
- },
1703
- {
1704
- role: 'tool',
1705
- content: '3',
1706
- tool_call_id: '123',
1707
- },
1708
- ]);
1709
- for (const choice of contentChoiceDeltas(`there are 3 properties in {"a": 1, "b": 2, "c": 3}`)) {
1710
- yield {
1711
- id: '2',
1712
- choices: [choice],
1713
- created: Math.floor(Date.now() / 1000),
1714
- model: 'gpt-3.5-turbo',
1715
- object: 'chat.completion.chunk',
1716
- };
1717
- }
1718
- }),
1719
- runner.done(),
1720
- ]);
1721
-
1722
- expect(listener.eventMessages).toEqual([
1723
- {
1724
- role: 'assistant',
1725
- content: null,
1726
- tool_calls: [
1727
- {
1728
- type: 'function',
1729
- id: '123',
1730
- function: { name: 'numProperties', arguments: '{"a": 1, "b": 2, "c": 3}' },
1731
- },
1732
- ],
1733
- },
1734
- { role: 'tool', content: '3', tool_call_id: '123' },
1735
- { role: 'assistant', content: 'there are 3 properties in {"a": 1, "b": 2, "c": 3}' },
1736
- ]);
1737
- expect(listener.eventFunctionCallResults).toEqual(['3']);
1738
- await listener.sanityCheck();
1739
- });
1740
- test('flow with parse error', async () => {
1741
- const { fetch, handleRequest } = mockStreamingChatCompletionFetch();
1742
-
1743
- const openai = new OpenAI({ apiKey: 'something1234', baseURL: 'http://127.0.0.1:4010', fetch });
1744
-
1745
- const runner = openai.beta.chat.completions.runTools({
1746
- stream: true,
1747
- messages: [
1748
- {
1749
- role: 'user',
1750
- content: 'can you tell me how many properties are in {"a": 1, "b": 2, "c": 3}',
1751
- },
1752
- ],
1753
- model: 'gpt-3.5-turbo',
1754
- tools: [
1755
- new ParsingToolFunction({
1756
- name: 'numProperties',
1757
- function: (obj: object) => String(Object.keys(obj).length),
1758
- parameters: { type: 'object' },
1759
- parse: (str: string): object => {
1760
- const result = JSON.parse(str);
1761
- if (!(result instanceof Object) || Array.isArray(result)) {
1762
- throw new Error('must be an object');
1763
- }
1764
- return result;
1765
- },
1766
- description: 'gets the number of properties on an object',
1767
- }),
1768
- ],
1769
- });
1770
- const listener = new StreamingRunnerListener(runner);
1771
-
1772
- await Promise.all([
1773
- handleRequest(async function* (request): AsyncIterable<OpenAI.Chat.ChatCompletionChunk> {
1774
- expect(request.messages).toEqual([
1775
- {
1776
- role: 'user',
1777
- content: 'can you tell me how many properties are in {"a": 1, "b": 2, "c": 3}',
1778
- },
1779
- ]);
1780
- for (const choice of functionCallDeltas('[{"a": 1, "b": 2, "c": 3}]', {
1781
- name: 'numProperties',
1782
- id: '123',
1783
- })) {
1784
- yield {
1785
- id: '1',
1786
- choices: [choice],
1787
- created: Math.floor(Date.now() / 1000),
1788
- model: 'gpt-3.5-turbo',
1789
- object: 'chat.completion.chunk',
1790
- };
1791
- }
1792
- }),
1793
- handleRequest(async function* (request): AsyncIterable<OpenAI.Chat.ChatCompletionChunk> {
1794
- expect(request.messages).toEqual([
1795
- {
1796
- role: 'user',
1797
- content: 'can you tell me how many properties are in {"a": 1, "b": 2, "c": 3}',
1798
- },
1799
- {
1800
- role: 'assistant',
1801
- content: null,
1802
- tool_calls: [
1803
- {
1804
- type: 'function',
1805
- id: '123',
1806
- function: {
1807
- arguments: '[{"a": 1, "b": 2, "c": 3}]',
1808
- name: 'numProperties',
1809
- },
1810
- },
1811
- ],
1812
- },
1813
- {
1814
- role: 'tool',
1815
- content: `must be an object`,
1816
- tool_call_id: '123',
1817
- },
1818
- ]);
1819
- for (const choice of functionCallDeltas('{"a": 1, "b": 2, "c": 3}', {
1820
- name: 'numProperties',
1821
- id: '1234',
1822
- })) {
1823
- yield {
1824
- id: '2',
1825
- choices: [choice],
1826
- created: Math.floor(Date.now() / 1000),
1827
- model: 'gpt-3.5-turbo',
1828
- object: 'chat.completion.chunk',
1829
- };
1830
- }
1831
- }),
1832
- handleRequest(async function* (request): AsyncIterable<OpenAI.Chat.ChatCompletionChunk> {
1833
- expect(request.messages).toEqual([
1834
- {
1835
- role: 'user',
1836
- content: 'can you tell me how many properties are in {"a": 1, "b": 2, "c": 3}',
1837
- },
1838
- {
1839
- role: 'assistant',
1840
- content: null,
1841
- tool_calls: [
1842
- {
1843
- type: 'function',
1844
- id: '123',
1845
- function: {
1846
- arguments: '[{"a": 1, "b": 2, "c": 3}]',
1847
- name: 'numProperties',
1848
- },
1849
- },
1850
- ],
1851
- },
1852
- {
1853
- role: 'tool',
1854
- content: `must be an object`,
1855
- tool_call_id: '123',
1856
- },
1857
- {
1858
- role: 'assistant',
1859
- content: null,
1860
- tool_calls: [
1861
- {
1862
- type: 'function',
1863
- id: '1234',
1864
- function: {
1865
- arguments: '{"a": 1, "b": 2, "c": 3}',
1866
- name: 'numProperties',
1867
- },
1868
- },
1869
- ],
1870
- },
1871
- {
1872
- role: 'tool',
1873
- content: '3',
1874
- tool_call_id: '1234',
1875
- },
1876
- ]);
1877
- for (const choice of contentChoiceDeltas(`there are 3 properties in {"a": 1, "b": 2, "c": 3}`)) {
1878
- yield {
1879
- id: '3',
1880
- choices: [choice],
1881
- created: Math.floor(Date.now() / 1000),
1882
- model: 'gpt-3.5-turbo',
1883
- object: 'chat.completion.chunk',
1884
- };
1885
- }
1886
- }),
1887
- runner.done(),
1888
- ]);
1889
-
1890
- expect(listener.eventMessages).toEqual([
1891
- {
1892
- role: 'assistant',
1893
- content: null,
1894
- tool_calls: [
1895
- {
1896
- type: 'function',
1897
- id: '123',
1898
- function: { name: 'numProperties', arguments: '[{"a": 1, "b": 2, "c": 3}]' },
1899
- },
1900
- ],
1901
- },
1902
- { role: 'tool', content: `must be an object`, tool_call_id: '123' },
1903
- {
1904
- role: 'assistant',
1905
- content: null,
1906
- tool_calls: [
1907
- {
1908
- type: 'function',
1909
- id: '1234',
1910
- function: { name: 'numProperties', arguments: '{"a": 1, "b": 2, "c": 3}' },
1911
- },
1912
- ],
1913
- },
1914
- { role: 'tool', content: '3', tool_call_id: '1234' },
1915
- { role: 'assistant', content: 'there are 3 properties in {"a": 1, "b": 2, "c": 3}' },
1916
- ]);
1917
- expect(listener.eventFunctionCallResults).toEqual([`must be an object`, '3']);
1918
- await listener.sanityCheck();
1919
- });
1920
- test('single function call', async () => {
1921
- const { fetch, handleRequest } = mockStreamingChatCompletionFetch();
1922
-
1923
- const openai = new OpenAI({ apiKey: 'something1234', baseURL: 'http://127.0.0.1:4010', fetch });
1924
-
1925
- const runner = openai.beta.chat.completions.runTools({
1926
- stream: true,
1927
- messages: [{ role: 'user', content: 'tell me what the weather is like' }],
1928
- model: 'gpt-3.5-turbo',
1929
- tool_choice: {
1930
- type: 'function',
1931
- function: {
1932
- name: 'getWeather',
1933
- },
1934
- },
1935
- tools: [
1936
- {
1937
- type: 'function',
1938
- function: {
1939
- function: function getWeather() {
1940
- return `it's raining`;
1941
- },
1942
- parameters: {},
1943
- description: 'gets the weather',
1944
- },
1945
- },
1946
- ],
1947
- });
1948
- const listener = new StreamingRunnerListener(runner);
1949
-
1950
- await Promise.all([
1951
- handleRequest(async function* (request): AsyncIterable<OpenAI.Chat.ChatCompletionChunk> {
1952
- expect(request.messages).toEqual([{ role: 'user', content: 'tell me what the weather is like' }]);
1953
- yield {
1954
- id: '1',
1955
- choices: [
1956
- {
1957
- index: 0,
1958
- finish_reason: 'function_call',
1959
- delta: {
1960
- role: 'assistant',
1961
- content: null,
1962
- tool_calls: [
1963
- {
1964
- type: 'function',
1965
- index: 0,
1966
- id: '123',
1967
- function: {
1968
- arguments: '',
1969
- name: 'getWeather',
1970
- },
1971
- },
1972
- ],
1973
- },
1974
- },
1975
- ],
1976
- created: Math.floor(Date.now() / 1000),
1977
- model: 'gpt-3.5-turbo',
1978
- object: 'chat.completion.chunk',
1979
- };
1980
- }),
1981
- runner.done(),
1982
- ]);
1983
-
1984
- expect(listener.eventMessages).toEqual([
1985
- {
1986
- role: 'assistant',
1987
- content: null,
1988
- tool_calls: [
1989
- {
1990
- type: 'function',
1991
- id: '123',
1992
- function: {
1993
- arguments: '',
1994
- name: 'getWeather',
1995
- },
1996
- },
1997
- ],
1998
- },
1999
- { role: 'tool', tool_call_id: '123', content: `it's raining` },
2000
- ]);
2001
- expect(listener.eventFunctionCallResults).toEqual([`it's raining`]);
2002
- await listener.sanityCheck();
2003
- });
2004
- test('wrong function name', async () => {
2005
- const { fetch, handleRequest } = mockStreamingChatCompletionFetch();
2006
-
2007
- const openai = new OpenAI({ apiKey: 'something1234', baseURL: 'http://127.0.0.1:4010', fetch });
2008
-
2009
- const runner = openai.beta.chat.completions.runTools({
2010
- stream: true,
2011
- messages: [{ role: 'user', content: 'tell me what the weather is like' }],
2012
- model: 'gpt-3.5-turbo',
2013
- tools: [
2014
- {
2015
- type: 'function',
2016
- function: {
2017
- function: function getWeather() {
2018
- return `it's raining`;
2019
- },
2020
- parameters: {},
2021
- description: 'gets the weather',
2022
- },
2023
- },
2024
- ],
2025
- });
2026
- const listener = new StreamingRunnerListener(runner);
2027
-
2028
- await Promise.all([
2029
- handleRequest(async function* (request): AsyncIterable<OpenAI.Chat.ChatCompletionChunk> {
2030
- expect(request.messages).toEqual([{ role: 'user', content: 'tell me what the weather is like' }]);
2031
- yield {
2032
- id: '1',
2033
- choices: [
2034
- {
2035
- index: 0,
2036
- finish_reason: 'function_call',
2037
- delta: {
2038
- role: 'assistant',
2039
- content: null,
2040
- tool_calls: [
2041
- {
2042
- type: 'function',
2043
- index: 0,
2044
- id: '123',
2045
- function: {
2046
- arguments: '',
2047
- name: 'get_weather',
2048
- },
2049
- },
2050
- ],
2051
- },
2052
- },
2053
- ],
2054
- created: Math.floor(Date.now() / 1000),
2055
- model: 'gpt-3.5-turbo',
2056
- object: 'chat.completion.chunk',
2057
- };
2058
- }),
2059
- handleRequest(async function* (request): AsyncIterable<OpenAI.Chat.ChatCompletionChunk> {
2060
- expect(request.messages).toEqual([
2061
- { role: 'user', content: 'tell me what the weather is like' },
2062
- {
2063
- role: 'assistant',
2064
- content: null,
2065
- tool_calls: [
2066
- {
2067
- type: 'function',
2068
- id: '123',
2069
- function: {
2070
- arguments: '',
2071
- name: 'get_weather',
2072
- },
2073
- },
2074
- ],
2075
- },
2076
- {
2077
- role: 'tool',
2078
- content: `Invalid tool_call: "get_weather". Available options are: "getWeather". Please try again`,
2079
- tool_call_id: '123',
2080
- },
2081
- ]);
2082
- yield {
2083
- id: '2',
2084
- choices: [
2085
- {
2086
- index: 0,
2087
- finish_reason: 'function_call',
2088
- logprobs: null,
2089
- delta: {
2090
- role: 'assistant',
2091
- content: null,
2092
- tool_calls: [
2093
- {
2094
- type: 'function',
2095
- index: 0,
2096
- id: '1234',
2097
- function: {
2098
- arguments: '',
2099
- name: 'getWeather',
2100
- },
2101
- },
2102
- ],
2103
- },
2104
- },
2105
- ],
2106
- created: Math.floor(Date.now() / 1000),
2107
- model: 'gpt-3.5-turbo',
2108
- object: 'chat.completion.chunk',
2109
- };
2110
- }),
2111
- handleRequest(async function* (request): AsyncIterable<OpenAI.Chat.ChatCompletionChunk> {
2112
- expect(request.messages).toEqual([
2113
- { role: 'user', content: 'tell me what the weather is like' },
2114
- {
2115
- role: 'assistant',
2116
- content: null,
2117
- tool_calls: [
2118
- {
2119
- type: 'function',
2120
- id: '123',
2121
- function: {
2122
- arguments: '',
2123
- name: 'get_weather',
2124
- },
2125
- },
2126
- ],
2127
- },
2128
- {
2129
- role: 'tool',
2130
- content: `Invalid tool_call: "get_weather". Available options are: "getWeather". Please try again`,
2131
- tool_call_id: '123',
2132
- },
2133
- {
2134
- role: 'assistant',
2135
- content: null,
2136
- tool_calls: [
2137
- {
2138
- type: 'function',
2139
- id: '1234',
2140
- function: {
2141
- arguments: '',
2142
- name: 'getWeather',
2143
- },
2144
- },
2145
- ],
2146
- },
2147
- {
2148
- role: 'tool',
2149
- content: `it's raining`,
2150
- tool_call_id: '1234',
2151
- },
2152
- ]);
2153
- for (const choice of contentChoiceDeltas(`it's raining`)) {
2154
- yield {
2155
- id: '3',
2156
- choices: [choice],
2157
- created: Math.floor(Date.now() / 1000),
2158
- model: 'gpt-3.5-turbo',
2159
- object: 'chat.completion.chunk',
2160
- };
2161
- }
2162
- }),
2163
- runner.done(),
2164
- ]);
2165
-
2166
- expect(listener.eventMessages).toEqual([
2167
- {
2168
- role: 'assistant',
2169
- content: null,
2170
- tool_calls: [
2171
- {
2172
- type: 'function',
2173
- id: '123',
2174
- function: {
2175
- arguments: '',
2176
- name: 'get_weather',
2177
- },
2178
- },
2179
- ],
2180
- },
2181
- {
2182
- role: 'tool',
2183
- content: `Invalid tool_call: "get_weather". Available options are: "getWeather". Please try again`,
2184
- tool_call_id: '123',
2185
- },
2186
- {
2187
- role: 'assistant',
2188
- content: null,
2189
- tool_calls: [
2190
- {
2191
- type: 'function',
2192
- id: '1234',
2193
- function: {
2194
- arguments: '',
2195
- name: 'getWeather',
2196
- },
2197
- },
2198
- ],
2199
- },
2200
- { role: 'tool', content: `it's raining`, tool_call_id: '1234' },
2201
- { role: 'assistant', content: "it's raining" },
2202
- ]);
2203
- expect(listener.eventFunctionCallResults).toEqual([
2204
- `Invalid tool_call: "get_weather". Available options are: "getWeather". Please try again`,
2205
- `it's raining`,
2206
- ]);
2207
- await listener.sanityCheck();
2208
- });
2209
- });
2210
-
2211
- describe('stream', () => {
2212
- test('successful flow', async () => {
2213
- const { fetch, handleRequest } = mockStreamingChatCompletionFetch();
2214
-
2215
- const openai = new OpenAI({ apiKey: 'something1234', baseURL: 'http://127.0.0.1:4010', fetch });
2216
-
2217
- const runner = openai.beta.chat.completions.stream({
2218
- stream: true,
2219
- messages: [{ role: 'user', content: 'tell me what the weather is like' }],
2220
- model: 'gpt-3.5-turbo',
2221
- });
2222
-
2223
- const listener = new StreamingRunnerListener(runner);
2224
-
2225
- await Promise.all([
2226
- handleRequest(async function* (request): AsyncIterable<OpenAI.Chat.ChatCompletionChunk> {
2227
- expect(request.messages).toEqual([{ role: 'user', content: 'tell me what the weather is like' }]);
2228
- for (const choice of contentChoiceDeltas(`The weather is great today!`)) {
2229
- yield {
2230
- id: '1',
2231
- choices: [choice],
2232
- created: Math.floor(Date.now() / 1000),
2233
- model: 'gpt-3.5-turbo',
2234
- object: 'chat.completion.chunk',
2235
- };
2236
- }
2237
- }),
2238
- runner.done(),
2239
- ]);
2240
-
2241
- expect(listener.finalMessage).toEqual({ role: 'assistant', content: 'The weather is great today!' });
2242
- await listener.sanityCheck();
2243
- });
2244
- test('toReadableStream and fromReadableStream', async () => {
2245
- const { fetch, handleRequest } = mockStreamingChatCompletionFetch();
2246
-
2247
- const openai = new OpenAI({ apiKey: 'something1234', baseURL: 'http://127.0.0.1:4010', fetch });
2248
-
2249
- const runner = openai.beta.chat.completions.stream({
2250
- stream: true,
2251
- messages: [{ role: 'user', content: 'tell me what the weather is like' }],
2252
- model: 'gpt-3.5-turbo',
2253
- });
2254
-
2255
- const proxied = ChatCompletionStreamingRunner.fromReadableStream(runner.toReadableStream());
2256
- const listener = new StreamingRunnerListener(proxied);
2257
-
2258
- await Promise.all([
2259
- handleRequest(async function* (request): AsyncIterable<OpenAI.Chat.ChatCompletionChunk> {
2260
- expect(request.messages).toEqual([{ role: 'user', content: 'tell me what the weather is like' }]);
2261
- for (const choice of contentChoiceDeltas(`The weather is great today!`)) {
2262
- yield {
2263
- id: '1',
2264
- choices: [choice],
2265
- created: Math.floor(Date.now() / 1000),
2266
- model: 'gpt-3.5-turbo',
2267
- object: 'chat.completion.chunk',
2268
- };
2269
- }
2270
- }),
2271
- proxied.done(),
2272
- ]);
2273
-
2274
- expect(listener.finalMessage).toEqual({ role: 'assistant', content: 'The weather is great today!' });
2275
- await listener.sanityCheck();
2276
- });
2277
- test('handles network errors', async () => {
2278
- const { fetch, handleRequest } = mockFetch();
2279
-
2280
- const openai = new OpenAI({ apiKey: '...', fetch });
2281
-
2282
- const stream = openai.beta.chat.completions.stream(
2283
- {
2284
- max_tokens: 1024,
2285
- model: 'gpt-3.5-turbo',
2286
- messages: [{ role: 'user', content: 'Say hello there!' }],
2287
- },
2288
- { maxRetries: 0 },
2289
- );
2290
-
2291
- handleRequest(async () => {
2292
- throw new Error('mock request error');
2293
- }).catch(() => {});
2294
-
2295
- async function runStream() {
2296
- await stream.done();
2297
- }
2298
-
2299
- await expect(runStream).rejects.toThrow(APIConnectionError);
2300
- });
2301
- test('handles network errors on async iterator', async () => {
2302
- const { fetch, handleRequest } = mockFetch();
2303
-
2304
- const openai = new OpenAI({ apiKey: '...', fetch });
2305
-
2306
- const stream = openai.beta.chat.completions.stream(
2307
- {
2308
- max_tokens: 1024,
2309
- model: 'gpt-3.5-turbo',
2310
- messages: [{ role: 'user', content: 'Say hello there!' }],
2311
- },
2312
- { maxRetries: 0 },
2313
- );
2314
-
2315
- handleRequest(async () => {
2316
- throw new Error('mock request error');
2317
- }).catch(() => {});
2318
-
2319
- async function runStream() {
2320
- for await (const _event of stream) {
2321
- continue;
2322
- }
2323
- }
2324
-
2325
- await expect(runStream).rejects.toThrow(APIConnectionError);
2326
- });
2327
- });
2328
- });