Spaces:
Build error
Build error
Upload 7464 files
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- node_modules/.DS_Store +0 -0
- node_modules/@anthropic-ai/sdk/CHANGELOG.md +305 -0
- node_modules/@anthropic-ai/sdk/LICENSE +8 -0
- node_modules/@anthropic-ai/sdk/README.md +351 -0
- node_modules/@anthropic-ai/sdk/_shims/MultipartBody.d.ts +9 -0
- node_modules/@anthropic-ai/sdk/_shims/MultipartBody.d.ts.map +1 -0
- node_modules/@anthropic-ai/sdk/_shims/MultipartBody.js +16 -0
- node_modules/@anthropic-ai/sdk/_shims/MultipartBody.js.map +1 -0
- node_modules/@anthropic-ai/sdk/_shims/MultipartBody.mjs +12 -0
- node_modules/@anthropic-ai/sdk/_shims/MultipartBody.mjs.map +1 -0
- node_modules/@anthropic-ai/sdk/_shims/README.md +46 -0
- node_modules/@anthropic-ai/sdk/_shims/auto/runtime-bun.d.ts +5 -0
- node_modules/@anthropic-ai/sdk/_shims/auto/runtime-bun.d.ts.map +1 -0
- node_modules/@anthropic-ai/sdk/_shims/auto/runtime-bun.js +21 -0
- node_modules/@anthropic-ai/sdk/_shims/auto/runtime-bun.js.map +1 -0
- node_modules/@anthropic-ai/sdk/_shims/auto/runtime-bun.mjs +2 -0
- node_modules/@anthropic-ai/sdk/_shims/auto/runtime-bun.mjs.map +1 -0
- node_modules/@anthropic-ai/sdk/_shims/auto/runtime-node.d.ts +5 -0
- node_modules/@anthropic-ai/sdk/_shims/auto/runtime-node.d.ts.map +1 -0
- node_modules/@anthropic-ai/sdk/_shims/auto/runtime-node.js +21 -0
- node_modules/@anthropic-ai/sdk/_shims/auto/runtime-node.js.map +1 -0
- node_modules/@anthropic-ai/sdk/_shims/auto/runtime-node.mjs +2 -0
- node_modules/@anthropic-ai/sdk/_shims/auto/runtime-node.mjs.map +1 -0
- node_modules/@anthropic-ai/sdk/_shims/auto/runtime.d.ts +5 -0
- node_modules/@anthropic-ai/sdk/_shims/auto/runtime.d.ts.map +1 -0
- node_modules/@anthropic-ai/sdk/_shims/auto/runtime.js +21 -0
- node_modules/@anthropic-ai/sdk/_shims/auto/runtime.js.map +1 -0
- node_modules/@anthropic-ai/sdk/_shims/auto/runtime.mjs +2 -0
- node_modules/@anthropic-ai/sdk/_shims/auto/runtime.mjs.map +1 -0
- node_modules/@anthropic-ai/sdk/_shims/auto/types-node.d.ts +5 -0
- node_modules/@anthropic-ai/sdk/_shims/auto/types-node.d.ts.map +1 -0
- node_modules/@anthropic-ai/sdk/_shims/auto/types-node.js +21 -0
- node_modules/@anthropic-ai/sdk/_shims/auto/types-node.js.map +1 -0
- node_modules/@anthropic-ai/sdk/_shims/auto/types-node.mjs +2 -0
- node_modules/@anthropic-ai/sdk/_shims/auto/types-node.mjs.map +1 -0
- node_modules/@anthropic-ai/sdk/_shims/auto/types.d.ts +101 -0
- node_modules/@anthropic-ai/sdk/_shims/auto/types.js +3 -0
- node_modules/@anthropic-ai/sdk/_shims/auto/types.mjs +3 -0
- node_modules/@anthropic-ai/sdk/_shims/bun-runtime.d.ts +6 -0
- node_modules/@anthropic-ai/sdk/_shims/bun-runtime.d.ts.map +1 -0
- node_modules/@anthropic-ai/sdk/_shims/bun-runtime.js +14 -0
- node_modules/@anthropic-ai/sdk/_shims/bun-runtime.js.map +1 -0
- node_modules/@anthropic-ai/sdk/_shims/bun-runtime.mjs +10 -0
- node_modules/@anthropic-ai/sdk/_shims/bun-runtime.mjs.map +1 -0
- node_modules/@anthropic-ai/sdk/_shims/index.d.ts +81 -0
- node_modules/@anthropic-ai/sdk/_shims/index.js +13 -0
- node_modules/@anthropic-ai/sdk/_shims/index.mjs +7 -0
- node_modules/@anthropic-ai/sdk/_shims/manual-types.d.ts +12 -0
- node_modules/@anthropic-ai/sdk/_shims/manual-types.js +3 -0
- node_modules/@anthropic-ai/sdk/_shims/manual-types.mjs +3 -0
node_modules/.DS_Store
ADDED
Binary file (129 kB). View file
|
|
node_modules/@anthropic-ai/sdk/CHANGELOG.md
ADDED
@@ -0,0 +1,305 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Changelog
|
2 |
+
|
3 |
+
## 0.6.8 (2023-10-17)
|
4 |
+
|
5 |
+
Full Changelog: [v0.6.7...v0.6.8](https://github.com/anthropics/anthropic-sdk-typescript/compare/v0.6.7...v0.6.8)
|
6 |
+
|
7 |
+
### Bug Fixes
|
8 |
+
|
9 |
+
* import web-streams-polyfill without overriding globals ([#186](https://github.com/anthropics/anthropic-sdk-typescript/issues/186)) ([e774e17](https://github.com/anthropics/anthropic-sdk-typescript/commit/e774e1774642668e080de5233aeaa33cf5f1b3ae))
|
10 |
+
|
11 |
+
## 0.6.7 (2023-10-16)
|
12 |
+
|
13 |
+
Full Changelog: [v0.6.6...v0.6.7](https://github.com/anthropics/anthropic-sdk-typescript/compare/v0.6.6...v0.6.7)
|
14 |
+
|
15 |
+
### Bug Fixes
|
16 |
+
|
17 |
+
* improve status code in error messages ([#183](https://github.com/anthropics/anthropic-sdk-typescript/issues/183)) ([7d3bbd4](https://github.com/anthropics/anthropic-sdk-typescript/commit/7d3bbd485c9628bb7c3fb5d1660934198981fcc7))
|
18 |
+
|
19 |
+
|
20 |
+
### Chores
|
21 |
+
|
22 |
+
* add case insensitive get header function ([#178](https://github.com/anthropics/anthropic-sdk-typescript/issues/178)) ([13c398d](https://github.com/anthropics/anthropic-sdk-typescript/commit/13c398dee3ff2eaa3b6046630eda9831580348f4))
|
23 |
+
* **internal:** add debug logs for stream responses ([#182](https://github.com/anthropics/anthropic-sdk-typescript/issues/182)) ([a1fa1b7](https://github.com/anthropics/anthropic-sdk-typescript/commit/a1fa1b7766248f3178cb55ac5342409a57c1dbb8))
|
24 |
+
* update comment ([#179](https://github.com/anthropics/anthropic-sdk-typescript/issues/179)) ([27a425e](https://github.com/anthropics/anthropic-sdk-typescript/commit/27a425ee64dcdc569b92ac27b501bca0dadf2dea))
|
25 |
+
|
26 |
+
|
27 |
+
### Documentation
|
28 |
+
|
29 |
+
* organisation -> organization (UK to US English) ([#185](https://github.com/anthropics/anthropic-sdk-typescript/issues/185)) ([70257d4](https://github.com/anthropics/anthropic-sdk-typescript/commit/70257d43296f5b448b5649a34b67a3a3a26704ab))
|
30 |
+
|
31 |
+
|
32 |
+
### Refactors
|
33 |
+
|
34 |
+
* **streaming:** change Stream constructor signature ([#174](https://github.com/anthropics/anthropic-sdk-typescript/issues/174)) ([1951824](https://github.com/anthropics/anthropic-sdk-typescript/commit/195182432c41a2a8a4fc425788267e60f36f5820))
|
35 |
+
* **test:** refactor authentication tests ([#176](https://github.com/anthropics/anthropic-sdk-typescript/issues/176)) ([f59daad](https://github.com/anthropics/anthropic-sdk-typescript/commit/f59daad06cab4c5df3068ea7f71ecbb20d8af141))
|
36 |
+
|
37 |
+
## 0.6.6 (2023-10-11)
|
38 |
+
|
39 |
+
Full Changelog: [v0.6.5...v0.6.6](https://github.com/anthropics/anthropic-sdk-typescript/compare/v0.6.5...v0.6.6)
|
40 |
+
|
41 |
+
### Chores
|
42 |
+
|
43 |
+
* update README ([#173](https://github.com/anthropics/anthropic-sdk-typescript/issues/173)) ([5f50c1b](https://github.com/anthropics/anthropic-sdk-typescript/commit/5f50c1b2f160610c89f158a10d83029c356d925a))
|
44 |
+
|
45 |
+
## 0.6.5 (2023-10-11)
|
46 |
+
|
47 |
+
Full Changelog: [v0.6.4...v0.6.5](https://github.com/anthropics/anthropic-sdk-typescript/compare/v0.6.4...v0.6.5)
|
48 |
+
|
49 |
+
### Features
|
50 |
+
|
51 |
+
* **client:** handle retry-after with a date ([#162](https://github.com/anthropics/anthropic-sdk-typescript/issues/162)) ([31bd609](https://github.com/anthropics/anthropic-sdk-typescript/commit/31bd60905858a6532414665a1368ae9f5fd29370))
|
52 |
+
* **client:** retry on 408 Request Timeout ([#151](https://github.com/anthropics/anthropic-sdk-typescript/issues/151)) ([3523ffe](https://github.com/anthropics/anthropic-sdk-typescript/commit/3523ffe5647448d5a5960b1339c9a17374e85dd5))
|
53 |
+
* **client:** support importing node or web shims manually ([#157](https://github.com/anthropics/anthropic-sdk-typescript/issues/157)) ([c1237fe](https://github.com/anthropics/anthropic-sdk-typescript/commit/c1237feaea9ca2d244720f2f75e023450a78019f))
|
54 |
+
* **errors:** add status code to error message ([#155](https://github.com/anthropics/anthropic-sdk-typescript/issues/155)) ([76cf128](https://github.com/anthropics/anthropic-sdk-typescript/commit/76cf128b68f206038945ac4f54f6f50e8a6a2c1b))
|
55 |
+
* **package:** export a root error type ([#160](https://github.com/anthropics/anthropic-sdk-typescript/issues/160)) ([51d8d60](https://github.com/anthropics/anthropic-sdk-typescript/commit/51d8d60b72fbe99dcb4d5a9ec32abbcb21ba1460))
|
56 |
+
|
57 |
+
|
58 |
+
### Bug Fixes
|
59 |
+
|
60 |
+
* **client:** eliminate circular imports, which cause runtime errors in webpack dev bundles ([#170](https://github.com/anthropics/anthropic-sdk-typescript/issues/170)) ([4a86733](https://github.com/anthropics/anthropic-sdk-typescript/commit/4a86733b9d11349fca041683ac9d89685133557d))
|
61 |
+
* fix namespace exports regression ([#171](https://github.com/anthropics/anthropic-sdk-typescript/issues/171)) ([0689a91](https://github.com/anthropics/anthropic-sdk-typescript/commit/0689a9196619d968870b7fd2e1a0f037a1aee282))
|
62 |
+
* prevent ReferenceError, update compatibility to ES2020 and Node 18+ ([#169](https://github.com/anthropics/anthropic-sdk-typescript/issues/169)) ([9753314](https://github.com/anthropics/anthropic-sdk-typescript/commit/9753314b7e36a270bb4c29f2981c521ec9c17773))
|
63 |
+
|
64 |
+
|
65 |
+
### Chores
|
66 |
+
|
67 |
+
* **internal:** bump lock file ([#159](https://github.com/anthropics/anthropic-sdk-typescript/issues/159)) ([e6030fa](https://github.com/anthropics/anthropic-sdk-typescript/commit/e6030fa915f26569f9c48c478a5e6c01910a6557))
|
68 |
+
* **internal:** minor formatting improvement ([#168](https://github.com/anthropics/anthropic-sdk-typescript/issues/168)) ([6447608](https://github.com/anthropics/anthropic-sdk-typescript/commit/644760883802bc2769a916fa477f2c6491f018fd))
|
69 |
+
* **internal:** update lock file ([#161](https://github.com/anthropics/anthropic-sdk-typescript/issues/161)) ([370ce3c](https://github.com/anthropics/anthropic-sdk-typescript/commit/370ce3c34b87591071fefc8b53977078603b6ca4))
|
70 |
+
* **internal:** update lock file ([#163](https://github.com/anthropics/anthropic-sdk-typescript/issues/163)) ([4a37181](https://github.com/anthropics/anthropic-sdk-typescript/commit/4a37181e0ceada13e3ed61d6df7aa34492dc57a7))
|
71 |
+
* **internal:** update lock file ([#164](https://github.com/anthropics/anthropic-sdk-typescript/issues/164)) ([939c155](https://github.com/anthropics/anthropic-sdk-typescript/commit/939c155277e67c19f7b2ff956f7cf0d40d4671cd))
|
72 |
+
|
73 |
+
|
74 |
+
### Documentation
|
75 |
+
|
76 |
+
* **api.md:** add shared models ([#158](https://github.com/anthropics/anthropic-sdk-typescript/issues/158)) ([33e5518](https://github.com/anthropics/anthropic-sdk-typescript/commit/33e5518bdeca83bbbde0e144e444609f569f1477))
|
77 |
+
* declare Bun 1.0 officially supported ([#154](https://github.com/anthropics/anthropic-sdk-typescript/issues/154)) ([429d8f4](https://github.com/anthropics/anthropic-sdk-typescript/commit/429d8f44b113a91599f0ebb69128636da82a5050))
|
78 |
+
* **readme:** remove incorrect wording in opening ([#156](https://github.com/anthropics/anthropic-sdk-typescript/issues/156)) ([01973fe](https://github.com/anthropics/anthropic-sdk-typescript/commit/01973fe50b13ce2981656f8c13603975e7c43efd))
|
79 |
+
|
80 |
+
## 0.6.4 (2023-09-08)
|
81 |
+
|
82 |
+
Full Changelog: [v0.6.3...v0.6.4](https://github.com/anthropics/anthropic-sdk-typescript/compare/v0.6.3...v0.6.4)
|
83 |
+
|
84 |
+
### Features
|
85 |
+
|
86 |
+
* **package:** add Bun export map ([#139](https://github.com/anthropics/anthropic-sdk-typescript/issues/139)) ([ba3310d](https://github.com/anthropics/anthropic-sdk-typescript/commit/ba3310d903cd5fda91168266335f4e445e60cad4))
|
87 |
+
|
88 |
+
|
89 |
+
### Bug Fixes
|
90 |
+
|
91 |
+
* **client:** fix TS errors that appear when users Go to Source in VSCode ([#142](https://github.com/anthropics/anthropic-sdk-typescript/issues/142)) ([f7bfbea](https://github.com/anthropics/anthropic-sdk-typescript/commit/f7bfbeaa54d364201bbe5cddf3132875ae2a3ccf))
|
92 |
+
* **client:** handle case where the client is instantiated with a undefined baseURL ([#143](https://github.com/anthropics/anthropic-sdk-typescript/issues/143)) ([10e5203](https://github.com/anthropics/anthropic-sdk-typescript/commit/10e52034990d90dcdaf26672ea384545b88ddf35))
|
93 |
+
* **client:** use explicit file extensions in _shims imports ([#141](https://github.com/anthropics/anthropic-sdk-typescript/issues/141)) ([10fd687](https://github.com/anthropics/anthropic-sdk-typescript/commit/10fd68742a202c5c0a8b520db190c239dce9b676))
|
94 |
+
* fix module not found errors in Vercel edge ([#148](https://github.com/anthropics/anthropic-sdk-typescript/issues/148)) ([72e51a1](https://github.com/anthropics/anthropic-sdk-typescript/commit/72e51a170855281a8d099b00c6fb1e9ccb276212))
|
95 |
+
* **readme:** update link to api.md to use the correct branch ([#145](https://github.com/anthropics/anthropic-sdk-typescript/issues/145)) ([5db78ed](https://github.com/anthropics/anthropic-sdk-typescript/commit/5db78edec4826f86b2fc21ee3f470b49a4987029))
|
96 |
+
|
97 |
+
|
98 |
+
### Chores
|
99 |
+
|
100 |
+
* **internal:** export helper from core ([#147](https://github.com/anthropics/anthropic-sdk-typescript/issues/147)) ([7e79de1](https://github.com/anthropics/anthropic-sdk-typescript/commit/7e79de14edeab8110d740e996653e9f9cc2299a4))
|
101 |
+
|
102 |
+
|
103 |
+
### Documentation
|
104 |
+
|
105 |
+
* **readme:** add link to api.md ([#144](https://github.com/anthropics/anthropic-sdk-typescript/issues/144)) ([716c9f0](https://github.com/anthropics/anthropic-sdk-typescript/commit/716c9f0714c0e9c26cb6cdcb007457aff1284cf4))
|
106 |
+
|
107 |
+
## 0.6.3 (2023-08-28)
|
108 |
+
|
109 |
+
Full Changelog: [v0.6.2...v0.6.3](https://github.com/anthropics/anthropic-sdk-typescript/compare/v0.6.2...v0.6.3)
|
110 |
+
|
111 |
+
### Bug Fixes
|
112 |
+
|
113 |
+
* **types:** improve getNextPage() return type ([#137](https://github.com/anthropics/anthropic-sdk-typescript/issues/137)) ([713d603](https://github.com/anthropics/anthropic-sdk-typescript/commit/713d6032c2c3b3630314a9625a1672147ef19258))
|
114 |
+
|
115 |
+
|
116 |
+
### Chores
|
117 |
+
|
118 |
+
* **ci:** setup workflows to create releases and release PRs ([#135](https://github.com/anthropics/anthropic-sdk-typescript/issues/135)) ([56229d9](https://github.com/anthropics/anthropic-sdk-typescript/commit/56229d964733a8b00625dac4ff138b3ade7e4202))
|
119 |
+
|
120 |
+
## [0.6.2](https://github.com/anthropics/anthropic-sdk-typescript/compare/v0.6.1...v0.6.2) (2023-08-26)
|
121 |
+
|
122 |
+
|
123 |
+
### Bug Fixes
|
124 |
+
|
125 |
+
* **stream:** declare Stream.controller as public ([#132](https://github.com/anthropics/anthropic-sdk-typescript/issues/132)) ([ff33a89](https://github.com/anthropics/anthropic-sdk-typescript/commit/ff33a893747aa708133bab14e97fba34ec776303))
|
126 |
+
|
127 |
+
|
128 |
+
### Refactors
|
129 |
+
|
130 |
+
* remove unnecessary line in constructor ([#131](https://github.com/anthropics/anthropic-sdk-typescript/issues/131)) ([dcdf5e5](https://github.com/anthropics/anthropic-sdk-typescript/commit/dcdf5e5183e99ae91d170ca09cc6da5e5637783f))
|
131 |
+
|
132 |
+
|
133 |
+
### Chores
|
134 |
+
|
135 |
+
* **internal:** add helper method ([#133](https://github.com/anthropics/anthropic-sdk-typescript/issues/133)) ([4c6950a](https://github.com/anthropics/anthropic-sdk-typescript/commit/4c6950a489b818151127aa1a39c239e4fd58a06e))
|
136 |
+
* **internal:** export HeadersInit type shim ([#129](https://github.com/anthropics/anthropic-sdk-typescript/issues/129)) ([bcd51bd](https://github.com/anthropics/anthropic-sdk-typescript/commit/bcd51bd12ad0854baf28b59dcada871889032515))
|
137 |
+
|
138 |
+
## [0.6.1](https://github.com/anthropics/anthropic-sdk-typescript/compare/v0.6.0...v0.6.1) (2023-08-23)
|
139 |
+
|
140 |
+
|
141 |
+
### Features
|
142 |
+
|
143 |
+
* allow a default timeout to be set for clients ([#113](https://github.com/anthropics/anthropic-sdk-typescript/issues/113)) ([1c5b2e2](https://github.com/anthropics/anthropic-sdk-typescript/commit/1c5b2e29926100a6e4a6176f0943e2c98991175d))
|
144 |
+
* **client:** improve compatibility with Bun ([#119](https://github.com/anthropics/anthropic-sdk-typescript/issues/119)) ([fe4f5d5](https://github.com/anthropics/anthropic-sdk-typescript/commit/fe4f5d5e35e35cab2a62388eb595519e9c14635c))
|
145 |
+
* **docs:** add documentation to the client constructor ([#118](https://github.com/anthropics/anthropic-sdk-typescript/issues/118)) ([79303f9](https://github.com/anthropics/anthropic-sdk-typescript/commit/79303f9c46a8248abd05fedbedbbed6e735c046d))
|
146 |
+
* **types:** export RequestOptions type ([#127](https://github.com/anthropics/anthropic-sdk-typescript/issues/127)) ([9769751](https://github.com/anthropics/anthropic-sdk-typescript/commit/9769751b84853822e3e6596110ecb2c367f07438))
|
147 |
+
* **types:** remove footgun with streaming params ([#125](https://github.com/anthropics/anthropic-sdk-typescript/issues/125)) ([3ed67b6](https://github.com/anthropics/anthropic-sdk-typescript/commit/3ed67b670bae14bc586df224aa57dd4dfa6e71f5))
|
148 |
+
|
149 |
+
|
150 |
+
### Bug Fixes
|
151 |
+
|
152 |
+
* **client:** fix TypeError when a request gets retried ([#117](https://github.com/anthropics/anthropic-sdk-typescript/issues/117)) ([0ade979](https://github.com/anthropics/anthropic-sdk-typescript/commit/0ade979a322c07f9a8f5322407b38352fe99b3ce))
|
153 |
+
* **core:** fix navigator check for strange environments ([#124](https://github.com/anthropics/anthropic-sdk-typescript/issues/124)) ([c783604](https://github.com/anthropics/anthropic-sdk-typescript/commit/c7836040017d5ce35204c07be0b018e87e827fdb))
|
154 |
+
* **types:** add catch-all overload to streaming methods ([#123](https://github.com/anthropics/anthropic-sdk-typescript/issues/123)) ([7c229a2](https://github.com/anthropics/anthropic-sdk-typescript/commit/7c229a24e6751bad22acb8c544113713140120fd))
|
155 |
+
|
156 |
+
|
157 |
+
### Documentation
|
158 |
+
|
159 |
+
* **readme:** fix typo ([#121](https://github.com/anthropics/anthropic-sdk-typescript/issues/121)) ([c5dbc3f](https://github.com/anthropics/anthropic-sdk-typescript/commit/c5dbc3fe89c84a728b6a4d7a4f6eadb228ac5688))
|
160 |
+
|
161 |
+
|
162 |
+
### Chores
|
163 |
+
|
164 |
+
* assign default reviewers to release PRs ([#115](https://github.com/anthropics/anthropic-sdk-typescript/issues/115)) ([1df3965](https://github.com/anthropics/anthropic-sdk-typescript/commit/1df3965a10256d30f8ce2af8d9890a26522117a9))
|
165 |
+
* **internal:** add missing eslint-plugin-prettier ([#122](https://github.com/anthropics/anthropic-sdk-typescript/issues/122)) ([66bede0](https://github.com/anthropics/anthropic-sdk-typescript/commit/66bede0ae3ed7b5baa002bbb0c87b4156306f982))
|
166 |
+
* **internal:** fix error happening in CloudFlare pages ([#116](https://github.com/anthropics/anthropic-sdk-typescript/issues/116)) ([b0dc7b3](https://github.com/anthropics/anthropic-sdk-typescript/commit/b0dc7b3b14520ce1f66c2b9d6a0f5aae4028985b))
|
167 |
+
* **internal:** minor reformatting of code ([#120](https://github.com/anthropics/anthropic-sdk-typescript/issues/120)) ([4bcaf9e](https://github.com/anthropics/anthropic-sdk-typescript/commit/4bcaf9e30a312284cb22c2084e8242ad7d181ba8))
|
168 |
+
|
169 |
+
## [0.6.0](https://github.com/anthropics/anthropic-sdk-typescript/compare/v0.5.10...v0.6.0) (2023-08-12)
|
170 |
+
|
171 |
+
|
172 |
+
### Features
|
173 |
+
|
174 |
+
* **client:** add support for accessing the raw response object ([#105](https://github.com/anthropics/anthropic-sdk-typescript/issues/105)) ([c86b059](https://github.com/anthropics/anthropic-sdk-typescript/commit/c86b0593a630f3adafc5c329019ea7028b6a41cd))
|
175 |
+
* **client:** detect browser usage ([#101](https://github.com/anthropics/anthropic-sdk-typescript/issues/101)) ([f4cae3f](https://github.com/anthropics/anthropic-sdk-typescript/commit/f4cae3f63c2e65e087a7bf27dac1eeb8200e0a36))
|
176 |
+
* **types:** improve streaming params types ([#102](https://github.com/anthropics/anthropic-sdk-typescript/issues/102)) ([cdf808c](https://github.com/anthropics/anthropic-sdk-typescript/commit/cdf808ca2a18cd744a5d1840e5e2adb3015e8d1d))
|
177 |
+
|
178 |
+
|
179 |
+
### Documentation
|
180 |
+
|
181 |
+
* **readme:** minor updates ([#107](https://github.com/anthropics/anthropic-sdk-typescript/issues/107)) ([406fd97](https://github.com/anthropics/anthropic-sdk-typescript/commit/406fd97d4cee0dd363ad548c9a251f78091a70e3))
|
182 |
+
* **readme:** remove beta status + document versioning policy ([#100](https://github.com/anthropics/anthropic-sdk-typescript/issues/100)) ([e9ef3d2](https://github.com/anthropics/anthropic-sdk-typescript/commit/e9ef3d21a25e355d8bf94b7a941ad82ec5eafec8))
|
183 |
+
|
184 |
+
|
185 |
+
### Chores
|
186 |
+
|
187 |
+
* **docs:** remove trailing spaces ([#108](https://github.com/anthropics/anthropic-sdk-typescript/issues/108)) ([4ba2c6f](https://github.com/anthropics/anthropic-sdk-typescript/commit/4ba2c6f181521ed9a60ed45c35d2276129cd7a0b))
|
188 |
+
* **internal:** conditionally include bin during build output ([#109](https://github.com/anthropics/anthropic-sdk-typescript/issues/109)) ([58ac305](https://github.com/anthropics/anthropic-sdk-typescript/commit/58ac305d752d6b5c378f91b988ddfb97231c003c))
|
189 |
+
* **internal:** fix deno build ([#98](https://github.com/anthropics/anthropic-sdk-typescript/issues/98)) ([f011e04](https://github.com/anthropics/anthropic-sdk-typescript/commit/f011e041f2f9cabb12951013825c0f0a2a569053))
|
190 |
+
* **internal:** remove deno build ([#103](https://github.com/anthropics/anthropic-sdk-typescript/issues/103)) ([9af1527](https://github.com/anthropics/anthropic-sdk-typescript/commit/9af152707a9bcf3027afc64f027566be25da2eb9))
|
191 |
+
|
192 |
+
|
193 |
+
### Refactors
|
194 |
+
|
195 |
+
* **client:** remove Stream.toReadableStream() ([#110](https://github.com/anthropics/anthropic-sdk-typescript/issues/110)) ([c370412](https://github.com/anthropics/anthropic-sdk-typescript/commit/c37041285ed9cccf6d980a953e14ffd4006a8acc))
|
196 |
+
|
197 |
+
## [0.5.10](https://github.com/anthropics/anthropic-sdk-typescript/compare/v0.5.9...v0.5.10) (2023-08-01)
|
198 |
+
|
199 |
+
|
200 |
+
### Refactors
|
201 |
+
|
202 |
+
* create build for deno.land ([#93](https://github.com/anthropics/anthropic-sdk-typescript/issues/93)) ([2ea741a](https://github.com/anthropics/anthropic-sdk-typescript/commit/2ea741a4d4a3123b2eaafb87b73d7884c69ae23b))
|
203 |
+
|
204 |
+
|
205 |
+
### Documentation
|
206 |
+
|
207 |
+
* **readme:** add token counting reference ([#94](https://github.com/anthropics/anthropic-sdk-typescript/issues/94)) ([2c6a699](https://github.com/anthropics/anthropic-sdk-typescript/commit/2c6a699d499a3468fc4312a6b6c9493ffd1806a2))
|
208 |
+
|
209 |
+
|
210 |
+
### Chores
|
211 |
+
|
212 |
+
* **internal:** allow the build script to be run without yarn installed ([#91](https://github.com/anthropics/anthropic-sdk-typescript/issues/91)) ([9bd2b28](https://github.com/anthropics/anthropic-sdk-typescript/commit/9bd2b2871ca8a3b5f2466a904153d5c234094372))
|
213 |
+
* **internal:** fix deno build ([#96](https://github.com/anthropics/anthropic-sdk-typescript/issues/96)) ([3fdab4e](https://github.com/anthropics/anthropic-sdk-typescript/commit/3fdab4e33b4c8668d17b8cddabbb09a22adf4124))
|
214 |
+
|
215 |
+
## [0.5.9](https://github.com/anthropics/anthropic-sdk-typescript/compare/v0.5.8...v0.5.9) (2023-07-29)
|
216 |
+
|
217 |
+
|
218 |
+
### Bug Fixes
|
219 |
+
|
220 |
+
* **client:** handle undefined process in more places ([#87](https://github.com/anthropics/anthropic-sdk-typescript/issues/87)) ([d950c25](https://github.com/anthropics/anthropic-sdk-typescript/commit/d950c25469a6c6b0dd3cfecd282db078826366ba))
|
221 |
+
* **examples:** avoid swallowing errors in example scripts ([#82](https://github.com/anthropics/anthropic-sdk-typescript/issues/82)) ([b27cfe9](https://github.com/anthropics/anthropic-sdk-typescript/commit/b27cfe9323bce983bb49f57dece98f1d9e507034))
|
222 |
+
* fix undefined message in errors ([#86](https://github.com/anthropics/anthropic-sdk-typescript/issues/86)) ([5714a14](https://github.com/anthropics/anthropic-sdk-typescript/commit/5714a14d9af282a3d308b8694e6e03309d4b5642))
|
223 |
+
|
224 |
+
|
225 |
+
### Chores
|
226 |
+
|
227 |
+
* **internal:** minor refactoring of client instantiation ([#88](https://github.com/anthropics/anthropic-sdk-typescript/issues/88)) ([2c53e1c](https://github.com/anthropics/anthropic-sdk-typescript/commit/2c53e1ca28a444a48e5f1041d9eb9077608b3fc7))
|
228 |
+
|
229 |
+
|
230 |
+
### Refactors
|
231 |
+
|
232 |
+
* use destructuring arguments in client constructor and respect false values ([#89](https://github.com/anthropics/anthropic-sdk-typescript/issues/89)) ([8d4c686](https://github.com/anthropics/anthropic-sdk-typescript/commit/8d4c6860273bbd16027023700d521a5e48db76f7))
|
233 |
+
|
234 |
+
## [0.5.8](https://github.com/anthropics/anthropic-sdk-typescript/compare/v0.5.7...v0.5.8) (2023-07-22)
|
235 |
+
|
236 |
+
|
237 |
+
### Features
|
238 |
+
|
239 |
+
* **streaming:** make requests immediately throw an error if an aborted signal is passed in ([#79](https://github.com/anthropics/anthropic-sdk-typescript/issues/79)) ([5c86597](https://github.com/anthropics/anthropic-sdk-typescript/commit/5c865979a21d18db87df43a9bdb27b701815f4bb))
|
240 |
+
|
241 |
+
## [0.5.7](https://github.com/anthropics/anthropic-sdk-typescript/compare/v0.5.6...v0.5.7) (2023-07-19)
|
242 |
+
|
243 |
+
|
244 |
+
### Features
|
245 |
+
|
246 |
+
* add flexible enum to model param ([#73](https://github.com/anthropics/anthropic-sdk-typescript/issues/73)) ([a6bbcad](https://github.com/anthropics/anthropic-sdk-typescript/commit/a6bbcadb447060f3c2e60881d31d7b7fb7a50512))
|
247 |
+
* **client:** export ClientOptions interface ([#75](https://github.com/anthropics/anthropic-sdk-typescript/issues/75)) ([0315ce1](https://github.com/anthropics/anthropic-sdk-typescript/commit/0315ce170db463ad900384ab7e4f62885cb471a2))
|
248 |
+
* **deps:** remove unneeded qs dep ([#72](https://github.com/anthropics/anthropic-sdk-typescript/issues/72)) ([0aea5a6](https://github.com/anthropics/anthropic-sdk-typescript/commit/0aea5a6f4852f351ecbe9f46d6857a6fafc7e864))
|
249 |
+
|
250 |
+
|
251 |
+
### Bug Fixes
|
252 |
+
|
253 |
+
* **client:** fix errors with file uploads in the browser ([#76](https://github.com/anthropics/anthropic-sdk-typescript/issues/76)) ([ac48fa7](https://github.com/anthropics/anthropic-sdk-typescript/commit/ac48fa72bb764b2abed95f200bc658f65725e2b3))
|
254 |
+
* fix error in environments without `TextEncoder` ([#70](https://github.com/anthropics/anthropic-sdk-typescript/issues/70)) ([5b78e05](https://github.com/anthropics/anthropic-sdk-typescript/commit/5b78e0586fd351258ccc05c8ba89a2ba66681b0d))
|
255 |
+
* fix export map order ([#74](https://github.com/anthropics/anthropic-sdk-typescript/issues/74)) ([51e70cb](https://github.com/anthropics/anthropic-sdk-typescript/commit/51e70cb9b55128d4de1b0597fad475d0f4bc836c))
|
256 |
+
|
257 |
+
## [0.5.6](https://github.com/anthropics/anthropic-sdk-typescript/compare/v0.5.5...v0.5.6) (2023-07-15)
|
258 |
+
|
259 |
+
|
260 |
+
### Bug Fixes
|
261 |
+
|
262 |
+
* fix errors with "named" client export in CJS ([#67](https://github.com/anthropics/anthropic-sdk-typescript/issues/67)) ([08ef69c](https://github.com/anthropics/anthropic-sdk-typescript/commit/08ef69cca87bbdf82440d163611f45e04e894234))
|
263 |
+
|
264 |
+
## [0.5.5](https://github.com/anthropics/anthropic-sdk-typescript/compare/v0.5.4...v0.5.5) (2023-07-13)
|
265 |
+
|
266 |
+
|
267 |
+
### Features
|
268 |
+
|
269 |
+
* **client:** add support for passing a `signal` request option ([#55](https://github.com/anthropics/anthropic-sdk-typescript/issues/55)) ([09604e9](https://github.com/anthropics/anthropic-sdk-typescript/commit/09604e9990e13dd703f4bcfd0a241b8ec2ebbc71))
|
270 |
+
|
271 |
+
|
272 |
+
### Bug Fixes
|
273 |
+
|
274 |
+
* **streaming:** do not abort successfully completed streams ([#53](https://github.com/anthropics/anthropic-sdk-typescript/issues/53)) ([950dd49](https://github.com/anthropics/anthropic-sdk-typescript/commit/950dd4930429010d89ae31eef9ebb193be9517ad))
|
275 |
+
|
276 |
+
|
277 |
+
### Documentation
|
278 |
+
|
279 |
+
* **examples:** bump model to claude-2 in example scripts ([#57](https://github.com/anthropics/anthropic-sdk-typescript/issues/57)) ([f85c05d](https://github.com/anthropics/anthropic-sdk-typescript/commit/f85c05d49a7a9db1deb8eed9124934da763b721b))
|
280 |
+
* **readme:** improvements to formatting code snippets ([#58](https://github.com/anthropics/anthropic-sdk-typescript/issues/58)) ([67bae64](https://github.com/anthropics/anthropic-sdk-typescript/commit/67bae64d5388e7e71ea3a891b3579c072b743f38))
|
281 |
+
|
282 |
+
|
283 |
+
### Chores
|
284 |
+
|
285 |
+
* **internal:** add helper function for b64 ([#62](https://github.com/anthropics/anthropic-sdk-typescript/issues/62)) ([04e303c](https://github.com/anthropics/anthropic-sdk-typescript/commit/04e303c5cc7b14a862b81379d547b3dc6e908720))
|
286 |
+
* **internal:** let `toFile` helper accept promises to objects with name/type properties ([#63](https://github.com/anthropics/anthropic-sdk-typescript/issues/63)) ([93f9af2](https://github.com/anthropics/anthropic-sdk-typescript/commit/93f9af29a91cfced533d309d1816c58bc2efa355))
|
287 |
+
* **internal:** remove unneeded type var usage ([#59](https://github.com/anthropics/anthropic-sdk-typescript/issues/59)) ([42fc4a9](https://github.com/anthropics/anthropic-sdk-typescript/commit/42fc4a90cc267f077b26d2bafebe487a74cae067))
|
288 |
+
|
289 |
+
## [0.5.4](https://github.com/anthropics/anthropic-sdk-typescript/compare/v0.5.3...v0.5.4) (2023-07-11)
|
290 |
+
|
291 |
+
|
292 |
+
### Features
|
293 |
+
|
294 |
+
* **api:** reference claude-2 in examples ([#50](https://github.com/anthropics/anthropic-sdk-typescript/issues/50)) ([7c53ded](https://github.com/anthropics/anthropic-sdk-typescript/commit/7c53ded6b7f5f3efec0df295181f18469c37e09d))
|
295 |
+
* **client:** support passing a custom `fetch` function ([#46](https://github.com/anthropics/anthropic-sdk-typescript/issues/46)) ([7d54366](https://github.com/anthropics/anthropic-sdk-typescript/commit/7d54366fcefa0267e831a0cca4d10c9a146d9f6c))
|
296 |
+
|
297 |
+
|
298 |
+
### Bug Fixes
|
299 |
+
|
300 |
+
* **client:** properly handle multi-byte characters in Content-Length ([#47](https://github.com/anthropics/anthropic-sdk-typescript/issues/47)) ([8dfff26](https://github.com/anthropics/anthropic-sdk-typescript/commit/8dfff2691a3ebd5721462c055d8da638ac77e571))
|
301 |
+
|
302 |
+
|
303 |
+
### Refactors
|
304 |
+
|
305 |
+
* **streaming:** make response body streaming polyfill more spec-compliant ([#44](https://github.com/anthropics/anthropic-sdk-typescript/issues/44)) ([047d328](https://github.com/anthropics/anthropic-sdk-typescript/commit/047d328cb0968fb1926e41326d35b595ba3fb3bc))
|
node_modules/@anthropic-ai/sdk/LICENSE
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Copyright 2023 Anthropic, PBC.
|
2 |
+
|
3 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
4 |
+
|
5 |
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
6 |
+
|
7 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
8 |
+
|
node_modules/@anthropic-ai/sdk/README.md
ADDED
@@ -0,0 +1,351 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Anthropic TypeScript API Library
|
2 |
+
|
3 |
+
[![NPM version](https://img.shields.io/npm/v/@anthropic-ai/sdk.svg)](https://npmjs.org/package/@anthropic-ai/sdk)
|
4 |
+
|
5 |
+
This library provides convenient access to the Anthropic REST API from server-side TypeScript or JavaScript.
|
6 |
+
|
7 |
+
For the AWS Bedrock API, see [`@anthropic-ai/bedrock-sdk`](github.com/anthropics/anthropic-bedrock-typescript).
|
8 |
+
|
9 |
+
## Migration from v0.4.x and below
|
10 |
+
|
11 |
+
In `v0.5.0`, we introduced a fully rewritten SDK. The new version offers better error handling, a more robust and intuitive streaming implementation, and more.
|
12 |
+
|
13 |
+
Key interface changes:
|
14 |
+
|
15 |
+
1. `new Client(apiKey)` → `new Anthropic({ apiKey })`
|
16 |
+
2. `client.complete()` → `client.completions.create()`
|
17 |
+
3. `client.completeStream()` → `client.completions.create({ stream: true })`
|
18 |
+
1. `onUpdate` callback → `for await (const x of stream)`
|
19 |
+
2. full message in stream → delta of message in stream
|
20 |
+
|
21 |
+
<details>
|
22 |
+
<summary>Example diff</summary>
|
23 |
+
|
24 |
+
```diff ts
|
25 |
+
// Import "Anthropic" instead of "Client":
|
26 |
+
- import { Client, HUMAN_PROMPT, AI_PROMPT } from '@anthropic-ai/sdk';
|
27 |
+
+ import Anthropic, { HUMAN_PROMPT, AI_PROMPT } from '@anthropic-ai/sdk';
|
28 |
+
|
29 |
+
// Instantiate with "apiKey" as an object property:
|
30 |
+
- const client = new Client(apiKey);
|
31 |
+
+ const client = new Anthropic({ apiKey });
|
32 |
+
// or, simply provide an ANTHROPIC_API_KEY environment variable:
|
33 |
+
+ const client = new Anthropic();
|
34 |
+
|
35 |
+
async function main() {
|
36 |
+
// Request & response types are the same as before, but better-typed.
|
37 |
+
const params = {
|
38 |
+
prompt: `${HUMAN_PROMPT} How many toes do dogs have?${AI_PROMPT}`,
|
39 |
+
max_tokens_to_sample: 200,
|
40 |
+
model: "claude-1",
|
41 |
+
};
|
42 |
+
|
43 |
+
// Instead of "client.complete()", you now call "client.completions.create()":
|
44 |
+
- await client.complete(params);
|
45 |
+
+ await client.completions.create(params);
|
46 |
+
|
47 |
+
// Streaming requests now use async iterators instead of callbacks:
|
48 |
+
- client.completeStream(params, {
|
49 |
+
- onUpdate: (completion) => {
|
50 |
+
- console.log(completion.completion); // full text
|
51 |
+
- },
|
52 |
+
- });
|
53 |
+
+ const stream = await client.completions.create({ ...params, stream: true });
|
54 |
+
+ for await (const completion of stream) {
|
55 |
+
+ process.stdout.write(completion.completion); // incremental text
|
56 |
+
+ }
|
57 |
+
|
58 |
+
// And, since this library uses `Anthropic-Version: 2023-06-01`,
|
59 |
+
// completion streams are now incremental diffs of text
|
60 |
+
// rather than sending the whole message every time:
|
61 |
+
let text = '';
|
62 |
+
- await client.completeStream(params, {
|
63 |
+
- onUpdate: (completion) => {
|
64 |
+
- const diff = completion.completion.replace(text, "");
|
65 |
+
- text = completion.completion;
|
66 |
+
- process.stdout.write(diff);
|
67 |
+
- },
|
68 |
+
- });
|
69 |
+
+ const stream = await client.completions.create({ ...params, stream: true });
|
70 |
+
+ for await (const completion of stream) {
|
71 |
+
+ const diff = completion.completion;
|
72 |
+
+ text += diff;
|
73 |
+
+ process.stdout.write(diff);
|
74 |
+
+ }
|
75 |
+
console.log('Done; final text is:')
|
76 |
+
console.log(text)
|
77 |
+
}
|
78 |
+
main();
|
79 |
+
```
|
80 |
+
|
81 |
+
</details>
|
82 |
+
|
83 |
+
The API documentation can be found [here](https://docs.anthropic.com/claude/reference/).
|
84 |
+
|
85 |
+
## Installation
|
86 |
+
|
87 |
+
```sh
|
88 |
+
npm install --save @anthropic-ai/sdk
|
89 |
+
# or
|
90 |
+
yarn add @anthropic-ai/sdk
|
91 |
+
```
|
92 |
+
|
93 |
+
## Usage
|
94 |
+
|
95 |
+
The full API of this library can be found in [api.md](https://www.github.com/anthropics/anthropic-sdk-typescript/blob/main/api.md).
|
96 |
+
|
97 |
+
```js
|
98 |
+
import Anthropic from '@anthropic-ai/sdk';
|
99 |
+
|
100 |
+
const anthropic = new Anthropic({
|
101 |
+
apiKey: 'my api key', // defaults to process.env["ANTHROPIC_API_KEY"]
|
102 |
+
});
|
103 |
+
|
104 |
+
async function main() {
|
105 |
+
const completion = await anthropic.completions.create({
|
106 |
+
model: 'claude-2',
|
107 |
+
max_tokens_to_sample: 300,
|
108 |
+
prompt: `${Anthropic.HUMAN_PROMPT} how does a court case get to the Supreme Court?${Anthropic.AI_PROMPT}`,
|
109 |
+
});
|
110 |
+
}
|
111 |
+
|
112 |
+
main();
|
113 |
+
```
|
114 |
+
|
115 |
+
## Streaming Responses
|
116 |
+
|
117 |
+
We provide support for streaming responses using Server Sent Events (SSE).
|
118 |
+
|
119 |
+
```ts
|
120 |
+
import Anthropic from '@anthropic-ai/sdk';
|
121 |
+
|
122 |
+
const anthropic = new Anthropic();
|
123 |
+
|
124 |
+
const stream = await anthropic.completions.create({
|
125 |
+
prompt: `${Anthropic.HUMAN_PROMPT} Your prompt here${Anthropic.AI_PROMPT}`,
|
126 |
+
model: 'claude-2',
|
127 |
+
stream: true,
|
128 |
+
max_tokens_to_sample: 300,
|
129 |
+
});
|
130 |
+
for await (const completion of stream) {
|
131 |
+
console.log(completion.completion);
|
132 |
+
}
|
133 |
+
```
|
134 |
+
|
135 |
+
If you need to cancel a stream, you can `break` from the loop
|
136 |
+
or call `stream.controller.abort()`.
|
137 |
+
|
138 |
+
### Request & Response types
|
139 |
+
|
140 |
+
This library includes TypeScript definitions for all request params and response fields. You may import and use them like so:
|
141 |
+
|
142 |
+
```ts
|
143 |
+
import Anthropic from '@anthropic-ai/sdk';
|
144 |
+
|
145 |
+
const anthropic = new Anthropic({
|
146 |
+
apiKey: 'my api key', // defaults to process.env["ANTHROPIC_API_KEY"]
|
147 |
+
});
|
148 |
+
|
149 |
+
async function main() {
|
150 |
+
const params: Anthropic.CompletionCreateParams = {
|
151 |
+
prompt: `${Anthropic.HUMAN_PROMPT} how does a court case get to the Supreme Court?${Anthropic.AI_PROMPT}`,
|
152 |
+
max_tokens_to_sample: 300,
|
153 |
+
model: 'claude-2',
|
154 |
+
};
|
155 |
+
const completion: Anthropic.Completion = await anthropic.completions.create(params);
|
156 |
+
}
|
157 |
+
|
158 |
+
main();
|
159 |
+
```
|
160 |
+
|
161 |
+
Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.
|
162 |
+
|
163 |
+
## Counting Tokens
|
164 |
+
|
165 |
+
We provide a [separate package](https://github.com/anthropics/anthropic-tokenizer-typescript) for counting how many tokens a given piece of text contains.
|
166 |
+
|
167 |
+
See the [repository documentation](https://github.com/anthropics/anthropic-tokenizer-typescript) for more details.
|
168 |
+
|
169 |
+
## Handling errors
|
170 |
+
|
171 |
+
When the library is unable to connect to the API,
|
172 |
+
or if the API returns a non-success status code (i.e., 4xx or 5xx response),
|
173 |
+
a subclass of `APIError` will be thrown:
|
174 |
+
|
175 |
+
```ts
|
176 |
+
async function main() {
|
177 |
+
const completion = await anthropic.completions
|
178 |
+
.create({
|
179 |
+
prompt: `${Anthropic.HUMAN_PROMPT} Your prompt here${Anthropic.AI_PROMPT}`,
|
180 |
+
max_tokens_to_sample: 300,
|
181 |
+
model: 'claude-2',
|
182 |
+
})
|
183 |
+
.catch((err) => {
|
184 |
+
if (err instanceof Anthropic.APIError) {
|
185 |
+
console.log(err.status); // 400
|
186 |
+
console.log(err.name); // BadRequestError
|
187 |
+
console.log(err.headers); // {server: 'nginx', ...}
|
188 |
+
} else {
|
189 |
+
throw err;
|
190 |
+
}
|
191 |
+
});
|
192 |
+
}
|
193 |
+
|
194 |
+
main();
|
195 |
+
```
|
196 |
+
|
197 |
+
Error codes are as followed:
|
198 |
+
|
199 |
+
| Status Code | Error Type |
|
200 |
+
| ----------- | -------------------------- |
|
201 |
+
| 400 | `BadRequestError` |
|
202 |
+
| 401 | `AuthenticationError` |
|
203 |
+
| 403 | `PermissionDeniedError` |
|
204 |
+
| 404 | `NotFoundError` |
|
205 |
+
| 422 | `UnprocessableEntityError` |
|
206 |
+
| 429 | `RateLimitError` |
|
207 |
+
| >=500 | `InternalServerError` |
|
208 |
+
| N/A | `APIConnectionError` |
|
209 |
+
|
210 |
+
### Retries
|
211 |
+
|
212 |
+
Certain errors will be automatically retried 2 times by default, with a short exponential backoff.
|
213 |
+
Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,
|
214 |
+
429 Rate Limit, and >=500 Internal errors will all be retried by default.
|
215 |
+
|
216 |
+
You can use the `maxRetries` option to configure or disable this:
|
217 |
+
|
218 |
+
<!-- prettier-ignore -->
|
219 |
+
```js
|
220 |
+
// Configure the default for all requests:
|
221 |
+
const anthropic = new Anthropic({
|
222 |
+
maxRetries: 0, // default is 2
|
223 |
+
});
|
224 |
+
|
225 |
+
// Or, configure per-request:
|
226 |
+
await anthropic.completions.create(
|
227 |
+
{
|
228 |
+
prompt: `${Anthropic.HUMAN_PROMPT} Can you help me effectively ask for a raise at work?${Anthropic.AI_PROMPT}`,
|
229 |
+
max_tokens_to_sample: 300,
|
230 |
+
model: 'claude-2',
|
231 |
+
},
|
232 |
+
{
|
233 |
+
maxRetries: 5,
|
234 |
+
},
|
235 |
+
);
|
236 |
+
```
|
237 |
+
|
238 |
+
### Timeouts
|
239 |
+
|
240 |
+
Requests time out after 10 minutes by default. You can configure this with a `timeout` option:
|
241 |
+
|
242 |
+
<!-- prettier-ignore -->
|
243 |
+
```ts
|
244 |
+
// Configure the default for all requests:
|
245 |
+
const anthropic = new Anthropic({
|
246 |
+
timeout: 20 * 1000, // 20 seconds (default is 10 minutes)
|
247 |
+
});
|
248 |
+
|
249 |
+
// Override per-request:
|
250 |
+
await anthropic.completions.create(
|
251 |
+
{
|
252 |
+
prompt: `${Anthropic.HUMAN_PROMPT} Where can I get a good coffee in my neighbourhood?${Anthropic.AI_PROMPT}`,
|
253 |
+
max_tokens_to_sample: 300,
|
254 |
+
model: 'claude-2',
|
255 |
+
},
|
256 |
+
{
|
257 |
+
timeout: 5 * 1000,
|
258 |
+
},
|
259 |
+
);
|
260 |
+
```
|
261 |
+
|
262 |
+
On timeout, an `APIConnectionTimeoutError` is thrown.
|
263 |
+
|
264 |
+
Note that requests which time out will be [retried twice by default](#retries).
|
265 |
+
|
266 |
+
## Advanced Usage
|
267 |
+
|
268 |
+
### Accessing raw Response data (e.g., headers)
|
269 |
+
|
270 |
+
The "raw" `Response` returned by `fetch()` can be accessed through the `.asResponse()` method on the `APIPromise` type that all methods return.
|
271 |
+
|
272 |
+
You can also use the `.withResponse()` method to get the raw `Response` along with the parsed data.
|
273 |
+
|
274 |
+
```ts
|
275 |
+
const anthropic = new Anthropic();
|
276 |
+
|
277 |
+
const response = await anthropic.completions
|
278 |
+
.create({
|
279 |
+
prompt: `${Anthropic.HUMAN_PROMPT} Can you help me effectively ask for a raise at work?${Anthropic.AI_PROMPT}`,
|
280 |
+
max_tokens_to_sample: 300,
|
281 |
+
model: 'claude-2',
|
282 |
+
})
|
283 |
+
.asResponse();
|
284 |
+
console.log(response.headers.get('X-My-Header'));
|
285 |
+
console.log(response.raw.statusText); // access the underlying Response object
|
286 |
+
|
287 |
+
// parses the response body, returning an object if the API responds with JSON
|
288 |
+
const completion: Completions.Completion = await response.parse();
|
289 |
+
console.log(completion.completion);
|
290 |
+
```
|
291 |
+
|
292 |
+
## Configuring an HTTP(S) Agent (e.g., for proxies)
|
293 |
+
|
294 |
+
By default, this library uses a stable agent for all http/https requests to reuse TCP connections, eliminating many TCP & TLS handshakes and shaving around 100ms off most requests.
|
295 |
+
|
296 |
+
If you would like to disable or customize this behavior, for example to use the API behind a proxy, you can pass an `httpAgent` which is used for all requests (be they http or https), for example:
|
297 |
+
|
298 |
+
<!-- prettier-ignore -->
|
299 |
+
```ts
|
300 |
+
import http from 'http';
|
301 |
+
import Anthropic from '@anthropic-ai/sdk';
|
302 |
+
import HttpsProxyAgent from 'https-proxy-agent';
|
303 |
+
|
304 |
+
// Configure the default for all requests:
|
305 |
+
const anthropic = new Anthropic({
|
306 |
+
httpAgent: new HttpsProxyAgent(process.env.PROXY_URL),
|
307 |
+
});
|
308 |
+
|
309 |
+
// Override per-request:
|
310 |
+
await anthropic.completions.create(
|
311 |
+
{
|
312 |
+
prompt: `${Anthropic.HUMAN_PROMPT} How does a court case get to the Supreme Court?${Anthropic.AI_PROMPT}`,
|
313 |
+
max_tokens_to_sample: 300,
|
314 |
+
model: 'claude-2',
|
315 |
+
},
|
316 |
+
{
|
317 |
+
baseURL: 'http://localhost:8080/test-api',
|
318 |
+
httpAgent: new http.Agent({ keepAlive: false }),
|
319 |
+
},
|
320 |
+
);
|
321 |
+
```
|
322 |
+
|
323 |
+
## Semantic Versioning
|
324 |
+
|
325 |
+
This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:
|
326 |
+
|
327 |
+
1. Changes that only affect static types, without breaking runtime behavior.
|
328 |
+
2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals)_.
|
329 |
+
3. Changes that we do not expect to impact the vast majority of users in practice.
|
330 |
+
|
331 |
+
We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
|
332 |
+
|
333 |
+
We are keen for your feedback; please open an [issue](https://www.github.com/anthropics/anthropic-sdk-typescript/issues) with questions, bugs, or suggestions.
|
334 |
+
|
335 |
+
## Requirements
|
336 |
+
|
337 |
+
TypeScript >= 4.5 is supported.
|
338 |
+
|
339 |
+
The following runtimes are supported:
|
340 |
+
|
341 |
+
- Node.js 18 LTS or later ([non-EOL](https://endoflife.date/nodejs)) versions.
|
342 |
+
- Deno v1.28.0 or higher, using `import Anthropic from "npm:@anthropic-ai/sdk"`.
|
343 |
+
- Bun 1.0 or later.
|
344 |
+
- Cloudflare Workers.
|
345 |
+
- Vercel Edge Runtime.
|
346 |
+
- Jest 28 or greater with the `"node"` environment (`"jsdom"` is not supported at this time).
|
347 |
+
- Nitro v2.6 or greater.
|
348 |
+
|
349 |
+
Note that React Native is not supported at this time.
|
350 |
+
|
351 |
+
If you are interested in other runtime environments, please open or upvote an issue on GitHub.
|
node_modules/@anthropic-ai/sdk/_shims/MultipartBody.d.ts
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Disclaimer: modules in _shims aren't intended to be imported by SDK users.
|
3 |
+
*/
|
4 |
+
export declare class MultipartBody {
|
5 |
+
body: any;
|
6 |
+
constructor(body: any);
|
7 |
+
get [Symbol.toStringTag](): string;
|
8 |
+
}
|
9 |
+
//# sourceMappingURL=MultipartBody.d.ts.map
|
node_modules/@anthropic-ai/sdk/_shims/MultipartBody.d.ts.map
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"version":3,"file":"MultipartBody.d.ts","sourceRoot":"","sources":["../src/_shims/MultipartBody.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,aAAa;IACL,IAAI,EAAE,GAAG;gBAAT,IAAI,EAAE,GAAG;IAC5B,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAEjC;CACF"}
|
node_modules/@anthropic-ai/sdk/_shims/MultipartBody.js
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"use strict";
|
2 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3 |
+
exports.MultipartBody = void 0;
|
4 |
+
/**
|
5 |
+
* Disclaimer: modules in _shims aren't intended to be imported by SDK users.
|
6 |
+
*/
|
7 |
+
class MultipartBody {
|
8 |
+
constructor(body) {
|
9 |
+
this.body = body;
|
10 |
+
}
|
11 |
+
get [Symbol.toStringTag]() {
|
12 |
+
return 'MultipartBody';
|
13 |
+
}
|
14 |
+
}
|
15 |
+
exports.MultipartBody = MultipartBody;
|
16 |
+
//# sourceMappingURL=MultipartBody.js.map
|
node_modules/@anthropic-ai/sdk/_shims/MultipartBody.js.map
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"version":3,"file":"MultipartBody.js","sourceRoot":"","sources":["../src/_shims/MultipartBody.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,MAAa,aAAa;IACxB,YAAmB,IAAS;QAAT,SAAI,GAAJ,IAAI,CAAK;IAAG,CAAC;IAChC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC;QACtB,OAAO,eAAe,CAAC;IACzB,CAAC;CACF;AALD,sCAKC"}
|
node_modules/@anthropic-ai/sdk/_shims/MultipartBody.mjs
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Disclaimer: modules in _shims aren't intended to be imported by SDK users.
|
3 |
+
*/
|
4 |
+
export class MultipartBody {
|
5 |
+
constructor(body) {
|
6 |
+
this.body = body;
|
7 |
+
}
|
8 |
+
get [Symbol.toStringTag]() {
|
9 |
+
return 'MultipartBody';
|
10 |
+
}
|
11 |
+
}
|
12 |
+
//# sourceMappingURL=MultipartBody.mjs.map
|
node_modules/@anthropic-ai/sdk/_shims/MultipartBody.mjs.map
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"version":3,"file":"MultipartBody.mjs","sourceRoot":"","sources":["../src/_shims/MultipartBody.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,OAAO,aAAa;IACxB,YAAmB,IAAS;QAAT,SAAI,GAAJ,IAAI,CAAK;IAAG,CAAC;IAChC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC;QACtB,OAAO,eAAe,CAAC;IACzB,CAAC;CACF"}
|
node_modules/@anthropic-ai/sdk/_shims/README.md
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# 👋 Wondering what everything in here does?
|
2 |
+
|
3 |
+
`@anthropic-ai/sdk` supports a wide variety of runtime environments like Node.js, Deno, Bun, browsers, and various
|
4 |
+
edge runtimes, as well as both CommonJS (CJS) and EcmaScript Modules (ESM).
|
5 |
+
|
6 |
+
To do this, `@anthropic-ai/sdk` provides shims for either using `node-fetch` when in Node (because `fetch` is still experimental there) or the global `fetch` API built into the environment when not in Node.
|
7 |
+
|
8 |
+
It uses [conditional exports](https://nodejs.org/api/packages.html#conditional-exports) to
|
9 |
+
automatically select the correct shims for each environment. However, conditional exports are a fairly new
|
10 |
+
feature and not supported everywhere. For instance, the TypeScript `"moduleResolution": "node"`
|
11 |
+
|
12 |
+
setting doesn't consult the `exports` map, compared to `"moduleResolution": "nodeNext"`, which does.
|
13 |
+
Unfortunately that's still the default setting, and it can result in errors like
|
14 |
+
getting the wrong raw `Response` type from `.asResponse()`, for example.
|
15 |
+
|
16 |
+
The user can work around these issues by manually importing one of:
|
17 |
+
|
18 |
+
- `import '@anthropic-ai/sdk/shims/node'`
|
19 |
+
- `import '@anthropic-ai/sdk/shims/web'`
|
20 |
+
|
21 |
+
All of the code here in `_shims` handles selecting the automatic default shims or manual overrides.
|
22 |
+
|
23 |
+
### How it works - Runtime
|
24 |
+
|
25 |
+
Runtime shims get installed by calling `setShims` exported by `@anthropic-ai/sdk/_shims/registry`.
|
26 |
+
|
27 |
+
Manually importing `@anthropic-ai/sdk/shims/node` or `@anthropic-ai/sdk/shims/web`, calls `setShims` with the respective runtime shims.
|
28 |
+
|
29 |
+
All client code imports shims from `@anthropic-ai/sdk/_shims/index`, which:
|
30 |
+
|
31 |
+
- checks if shims have been set manually
|
32 |
+
- if not, calls `setShims` with the shims from `@anthropic-ai/sdk/_shims/auto/runtime`
|
33 |
+
- re-exports the installed shims from `@anthropic-ai/sdk/_shims/registry`.
|
34 |
+
|
35 |
+
`@anthropic-ai/sdk/_shims/auto/runtime` exports web runtime shims.
|
36 |
+
If the `node` export condition is set, the export map replaces it with `@anthropic-ai/sdk/_shims/auto/runtime-node`.
|
37 |
+
|
38 |
+
### How it works - Type time
|
39 |
+
|
40 |
+
All client code imports shim types from `@anthropic-ai/sdk/_shims/index`, which selects the manual types from `@anthropic-ai/sdk/_shims/manual-types` if they have been declared, otherwise it exports the auto types from `@anthropic-ai/sdk/_shims/auto/types`.
|
41 |
+
|
42 |
+
`@anthropic-ai/sdk/_shims/manual-types` exports an empty namespace.
|
43 |
+
Manually importing `@anthropic-ai/sdk/shims/node` or `@anthropic-ai/sdk/shims/web` merges declarations into this empty namespace, so they get picked up by `@anthropic-ai/sdk/_shims/index`.
|
44 |
+
|
45 |
+
`@anthropic-ai/sdk/_shims/auto/types` exports web type definitions.
|
46 |
+
If the `node` export condition is set, the export map replaces it with `@anthropic-ai/sdk/_shims/auto/types-node`, though TS only picks this up if `"moduleResolution": "nodenext"` or `"moduleResolution": "bundler"`.
|
node_modules/@anthropic-ai/sdk/_shims/auto/runtime-bun.d.ts
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Disclaimer: modules in _shims aren't intended to be imported by SDK users.
|
3 |
+
*/
|
4 |
+
export * from "../bun-runtime.js";
|
5 |
+
//# sourceMappingURL=runtime-bun.d.ts.map
|
node_modules/@anthropic-ai/sdk/_shims/auto/runtime-bun.d.ts.map
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"version":3,"file":"runtime-bun.d.ts","sourceRoot":"","sources":["../../src/_shims/auto/runtime-bun.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,gBAAgB,CAAC"}
|
node_modules/@anthropic-ai/sdk/_shims/auto/runtime-bun.js
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"use strict";
|
2 |
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3 |
+
if (k2 === undefined) k2 = k;
|
4 |
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5 |
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6 |
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7 |
+
}
|
8 |
+
Object.defineProperty(o, k2, desc);
|
9 |
+
}) : (function(o, m, k, k2) {
|
10 |
+
if (k2 === undefined) k2 = k;
|
11 |
+
o[k2] = m[k];
|
12 |
+
}));
|
13 |
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14 |
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15 |
+
};
|
16 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
17 |
+
/**
|
18 |
+
* Disclaimer: modules in _shims aren't intended to be imported by SDK users.
|
19 |
+
*/
|
20 |
+
__exportStar(require("../bun-runtime.js"), exports);
|
21 |
+
//# sourceMappingURL=runtime-bun.js.map
|
node_modules/@anthropic-ai/sdk/_shims/auto/runtime-bun.js.map
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"version":3,"file":"runtime-bun.js","sourceRoot":"","sources":["../../src/_shims/auto/runtime-bun.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;GAEG;AACH,oDAA+B"}
|
node_modules/@anthropic-ai/sdk/_shims/auto/runtime-bun.mjs
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
export * from "../bun-runtime.mjs";
|
2 |
+
//# sourceMappingURL=runtime-bun.mjs.map
|
node_modules/@anthropic-ai/sdk/_shims/auto/runtime-bun.mjs.map
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"version":3,"file":"runtime-bun.mjs","sourceRoot":"","sources":["../../src/_shims/auto/runtime-bun.ts"],"names":[],"mappings":""}
|
node_modules/@anthropic-ai/sdk/_shims/auto/runtime-node.d.ts
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Disclaimer: modules in _shims aren't intended to be imported by SDK users.
|
3 |
+
*/
|
4 |
+
export * from "../node-runtime.js";
|
5 |
+
//# sourceMappingURL=runtime-node.d.ts.map
|
node_modules/@anthropic-ai/sdk/_shims/auto/runtime-node.d.ts.map
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"version":3,"file":"runtime-node.d.ts","sourceRoot":"","sources":["../../src/_shims/auto/runtime-node.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,iBAAiB,CAAC"}
|
node_modules/@anthropic-ai/sdk/_shims/auto/runtime-node.js
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"use strict";
|
2 |
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3 |
+
if (k2 === undefined) k2 = k;
|
4 |
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5 |
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6 |
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7 |
+
}
|
8 |
+
Object.defineProperty(o, k2, desc);
|
9 |
+
}) : (function(o, m, k, k2) {
|
10 |
+
if (k2 === undefined) k2 = k;
|
11 |
+
o[k2] = m[k];
|
12 |
+
}));
|
13 |
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14 |
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15 |
+
};
|
16 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
17 |
+
/**
|
18 |
+
* Disclaimer: modules in _shims aren't intended to be imported by SDK users.
|
19 |
+
*/
|
20 |
+
__exportStar(require("../node-runtime.js"), exports);
|
21 |
+
//# sourceMappingURL=runtime-node.js.map
|
node_modules/@anthropic-ai/sdk/_shims/auto/runtime-node.js.map
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"version":3,"file":"runtime-node.js","sourceRoot":"","sources":["../../src/_shims/auto/runtime-node.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;GAEG;AACH,qDAAgC"}
|
node_modules/@anthropic-ai/sdk/_shims/auto/runtime-node.mjs
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
export * from "../node-runtime.mjs";
|
2 |
+
//# sourceMappingURL=runtime-node.mjs.map
|
node_modules/@anthropic-ai/sdk/_shims/auto/runtime-node.mjs.map
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"version":3,"file":"runtime-node.mjs","sourceRoot":"","sources":["../../src/_shims/auto/runtime-node.ts"],"names":[],"mappings":""}
|
node_modules/@anthropic-ai/sdk/_shims/auto/runtime.d.ts
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Disclaimer: modules in _shims aren't intended to be imported by SDK users.
|
3 |
+
*/
|
4 |
+
export * from "../web-runtime.js";
|
5 |
+
//# sourceMappingURL=runtime.d.ts.map
|
node_modules/@anthropic-ai/sdk/_shims/auto/runtime.d.ts.map
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/_shims/auto/runtime.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,gBAAgB,CAAC"}
|
node_modules/@anthropic-ai/sdk/_shims/auto/runtime.js
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"use strict";
|
2 |
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3 |
+
if (k2 === undefined) k2 = k;
|
4 |
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5 |
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6 |
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7 |
+
}
|
8 |
+
Object.defineProperty(o, k2, desc);
|
9 |
+
}) : (function(o, m, k, k2) {
|
10 |
+
if (k2 === undefined) k2 = k;
|
11 |
+
o[k2] = m[k];
|
12 |
+
}));
|
13 |
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14 |
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15 |
+
};
|
16 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
17 |
+
/**
|
18 |
+
* Disclaimer: modules in _shims aren't intended to be imported by SDK users.
|
19 |
+
*/
|
20 |
+
__exportStar(require("../web-runtime.js"), exports);
|
21 |
+
//# sourceMappingURL=runtime.js.map
|
node_modules/@anthropic-ai/sdk/_shims/auto/runtime.js.map
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../src/_shims/auto/runtime.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;GAEG;AACH,oDAA+B"}
|
node_modules/@anthropic-ai/sdk/_shims/auto/runtime.mjs
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
export * from "../web-runtime.mjs";
|
2 |
+
//# sourceMappingURL=runtime.mjs.map
|
node_modules/@anthropic-ai/sdk/_shims/auto/runtime.mjs.map
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"version":3,"file":"runtime.mjs","sourceRoot":"","sources":["../../src/_shims/auto/runtime.ts"],"names":[],"mappings":""}
|
node_modules/@anthropic-ai/sdk/_shims/auto/types-node.d.ts
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Disclaimer: modules in _shims aren't intended to be imported by SDK users.
|
3 |
+
*/
|
4 |
+
export * from "../node-types.js";
|
5 |
+
//# sourceMappingURL=types-node.d.ts.map
|
node_modules/@anthropic-ai/sdk/_shims/auto/types-node.d.ts.map
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"version":3,"file":"types-node.d.ts","sourceRoot":"","sources":["../../src/_shims/auto/types-node.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,eAAe,CAAC"}
|
node_modules/@anthropic-ai/sdk/_shims/auto/types-node.js
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"use strict";
|
2 |
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3 |
+
if (k2 === undefined) k2 = k;
|
4 |
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5 |
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6 |
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7 |
+
}
|
8 |
+
Object.defineProperty(o, k2, desc);
|
9 |
+
}) : (function(o, m, k, k2) {
|
10 |
+
if (k2 === undefined) k2 = k;
|
11 |
+
o[k2] = m[k];
|
12 |
+
}));
|
13 |
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14 |
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15 |
+
};
|
16 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
17 |
+
/**
|
18 |
+
* Disclaimer: modules in _shims aren't intended to be imported by SDK users.
|
19 |
+
*/
|
20 |
+
__exportStar(require("../node-types.js"), exports);
|
21 |
+
//# sourceMappingURL=types-node.js.map
|
node_modules/@anthropic-ai/sdk/_shims/auto/types-node.js.map
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"version":3,"file":"types-node.js","sourceRoot":"","sources":["../../src/_shims/auto/types-node.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;GAEG;AACH,mDAA8B"}
|
node_modules/@anthropic-ai/sdk/_shims/auto/types-node.mjs
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
export * from "../node-types.mjs";
|
2 |
+
//# sourceMappingURL=types-node.mjs.map
|
node_modules/@anthropic-ai/sdk/_shims/auto/types-node.mjs.map
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"version":3,"file":"types-node.mjs","sourceRoot":"","sources":["../../src/_shims/auto/types-node.ts"],"names":[],"mappings":""}
|
node_modules/@anthropic-ai/sdk/_shims/auto/types.d.ts
ADDED
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Disclaimer: modules in _shims aren't intended to be imported by SDK users.
|
3 |
+
*/
|
4 |
+
export type Agent = any;
|
5 |
+
|
6 |
+
// @ts-ignore
|
7 |
+
declare const _fetch: unknown extends typeof fetch ? never : typeof fetch;
|
8 |
+
export { _fetch as fetch };
|
9 |
+
|
10 |
+
// @ts-ignore
|
11 |
+
type _Request = unknown extends Request ? never : Request;
|
12 |
+
export { _Request as Request };
|
13 |
+
|
14 |
+
// @ts-ignore
|
15 |
+
type _RequestInfo = unknown extends RequestInfo ? never : RequestInfo;
|
16 |
+
export { type _RequestInfo as RequestInfo };
|
17 |
+
|
18 |
+
// @ts-ignore
|
19 |
+
type _RequestInit = unknown extends RequestInit ? never : RequestInit;
|
20 |
+
export { type _RequestInit as RequestInit };
|
21 |
+
|
22 |
+
// @ts-ignore
|
23 |
+
type _Response = unknown extends Response ? never : Response;
|
24 |
+
export { _Response as Response };
|
25 |
+
|
26 |
+
// @ts-ignore
|
27 |
+
type _ResponseInit = unknown extends ResponseInit ? never : ResponseInit;
|
28 |
+
export { type _ResponseInit as ResponseInit };
|
29 |
+
|
30 |
+
// @ts-ignore
|
31 |
+
type _ResponseType = unknown extends ResponseType ? never : ResponseType;
|
32 |
+
export { type _ResponseType as ResponseType };
|
33 |
+
|
34 |
+
// @ts-ignore
|
35 |
+
type _BodyInit = unknown extends BodyInit ? never : BodyInit;
|
36 |
+
export { type _BodyInit as BodyInit };
|
37 |
+
|
38 |
+
// @ts-ignore
|
39 |
+
type _Headers = unknown extends Headers ? never : Headers;
|
40 |
+
export { _Headers as Headers };
|
41 |
+
|
42 |
+
// @ts-ignore
|
43 |
+
type _HeadersInit = unknown extends HeadersInit ? never : HeadersInit;
|
44 |
+
export { type _HeadersInit as HeadersInit };
|
45 |
+
|
46 |
+
type EndingType = 'native' | 'transparent';
|
47 |
+
|
48 |
+
export interface BlobPropertyBag {
|
49 |
+
endings?: EndingType;
|
50 |
+
type?: string;
|
51 |
+
}
|
52 |
+
|
53 |
+
export interface FilePropertyBag extends BlobPropertyBag {
|
54 |
+
lastModified?: number;
|
55 |
+
}
|
56 |
+
|
57 |
+
export type FileFromPathOptions = Omit<FilePropertyBag, 'lastModified'>;
|
58 |
+
|
59 |
+
// @ts-ignore
|
60 |
+
type _FormData = unknown extends FormData ? never : FormData;
|
61 |
+
// @ts-ignore
|
62 |
+
declare const _FormData: unknown extends typeof FormData ? never : typeof FormData;
|
63 |
+
export { _FormData as FormData };
|
64 |
+
|
65 |
+
// @ts-ignore
|
66 |
+
type _File = unknown extends File ? never : File;
|
67 |
+
// @ts-ignore
|
68 |
+
declare const _File: unknown extends typeof File ? never : typeof File;
|
69 |
+
export { _File as File };
|
70 |
+
|
71 |
+
// @ts-ignore
|
72 |
+
type _Blob = unknown extends Blob ? never : Blob;
|
73 |
+
// @ts-ignore
|
74 |
+
declare const _Blob: unknown extends typeof Blob ? never : typeof Blob;
|
75 |
+
export { _Blob as Blob };
|
76 |
+
|
77 |
+
export declare class Readable {
|
78 |
+
readable: boolean;
|
79 |
+
readonly readableEnded: boolean;
|
80 |
+
readonly readableFlowing: boolean | null;
|
81 |
+
readonly readableHighWaterMark: number;
|
82 |
+
readonly readableLength: number;
|
83 |
+
readonly readableObjectMode: boolean;
|
84 |
+
destroyed: boolean;
|
85 |
+
read(size?: number): any;
|
86 |
+
pause(): this;
|
87 |
+
resume(): this;
|
88 |
+
isPaused(): boolean;
|
89 |
+
destroy(error?: Error): this;
|
90 |
+
[Symbol.asyncIterator](): AsyncIterableIterator<any>;
|
91 |
+
}
|
92 |
+
|
93 |
+
export declare class FsReadStream extends Readable {
|
94 |
+
path: {}; // node type is string | Buffer
|
95 |
+
}
|
96 |
+
|
97 |
+
// @ts-ignore
|
98 |
+
type _ReadableStream<R = any> = unknown extends ReadableStream<R> ? never : ReadableStream<R>;
|
99 |
+
// @ts-ignore
|
100 |
+
declare const _ReadableStream: unknown extends typeof ReadableStream ? never : typeof ReadableStream;
|
101 |
+
export { _ReadableStream as ReadableStream };
|
node_modules/@anthropic-ai/sdk/_shims/auto/types.js
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Disclaimer: modules in _shims aren't intended to be imported by SDK users.
|
3 |
+
*/
|
node_modules/@anthropic-ai/sdk/_shims/auto/types.mjs
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Disclaimer: modules in _shims aren't intended to be imported by SDK users.
|
3 |
+
*/
|
node_modules/@anthropic-ai/sdk/_shims/bun-runtime.d.ts
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Disclaimer: modules in _shims aren't intended to be imported by SDK users.
|
3 |
+
*/
|
4 |
+
import { type Shims } from "./registry.js";
|
5 |
+
export declare function getRuntime(): Shims;
|
6 |
+
//# sourceMappingURL=bun-runtime.d.ts.map
|
node_modules/@anthropic-ai/sdk/_shims/bun-runtime.d.ts.map
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"version":3,"file":"bun-runtime.d.ts","sourceRoot":"","sources":["../src/_shims/bun-runtime.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAIxC,wBAAgB,UAAU,IAAI,KAAK,CAMlC"}
|
node_modules/@anthropic-ai/sdk/_shims/bun-runtime.js
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"use strict";
|
2 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3 |
+
exports.getRuntime = void 0;
|
4 |
+
const web_runtime_1 = require("./web-runtime.js");
|
5 |
+
const node_fs_1 = require("node:fs");
|
6 |
+
function getRuntime() {
|
7 |
+
const runtime = (0, web_runtime_1.getRuntime)();
|
8 |
+
function isFsReadStream(value) {
|
9 |
+
return value instanceof node_fs_1.ReadStream;
|
10 |
+
}
|
11 |
+
return { ...runtime, isFsReadStream };
|
12 |
+
}
|
13 |
+
exports.getRuntime = getRuntime;
|
14 |
+
//# sourceMappingURL=bun-runtime.js.map
|
node_modules/@anthropic-ai/sdk/_shims/bun-runtime.js.map
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"version":3,"file":"bun-runtime.js","sourceRoot":"","sources":["../src/_shims/bun-runtime.ts"],"names":[],"mappings":";;;AAIA,kDAA4D;AAC5D,qCAAqD;AAErD,SAAgB,UAAU;IACxB,MAAM,OAAO,GAAG,IAAA,wBAAa,GAAE,CAAC;IAChC,SAAS,cAAc,CAAC,KAAU;QAChC,OAAO,KAAK,YAAY,oBAAY,CAAC;IACvC,CAAC;IACD,OAAO,EAAE,GAAG,OAAO,EAAE,cAAc,EAAE,CAAC;AACxC,CAAC;AAND,gCAMC"}
|
node_modules/@anthropic-ai/sdk/_shims/bun-runtime.mjs
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { getRuntime as getWebRuntime } from "./web-runtime.mjs";
|
2 |
+
import { ReadStream as FsReadStream } from 'node:fs';
|
3 |
+
export function getRuntime() {
|
4 |
+
const runtime = getWebRuntime();
|
5 |
+
function isFsReadStream(value) {
|
6 |
+
return value instanceof FsReadStream;
|
7 |
+
}
|
8 |
+
return { ...runtime, isFsReadStream };
|
9 |
+
}
|
10 |
+
//# sourceMappingURL=bun-runtime.mjs.map
|
node_modules/@anthropic-ai/sdk/_shims/bun-runtime.mjs.map
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"version":3,"file":"bun-runtime.mjs","sourceRoot":"","sources":["../src/_shims/bun-runtime.ts"],"names":[],"mappings":"OAIO,EAAE,UAAU,IAAI,aAAa,EAAE;OAC/B,EAAE,UAAU,IAAI,YAAY,EAAE,MAAM,SAAS;AAEpD,MAAM,UAAU,UAAU;IACxB,MAAM,OAAO,GAAG,aAAa,EAAE,CAAC;IAChC,SAAS,cAAc,CAAC,KAAU;QAChC,OAAO,KAAK,YAAY,YAAY,CAAC;IACvC,CAAC;IACD,OAAO,EAAE,GAAG,OAAO,EAAE,cAAc,EAAE,CAAC;AACxC,CAAC"}
|
node_modules/@anthropic-ai/sdk/_shims/index.d.ts
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Disclaimer: modules in _shims aren't intended to be imported by SDK users.
|
3 |
+
*/
|
4 |
+
import { manual } from "./manual-types.js";
|
5 |
+
import * as auto from '@anthropic-ai/sdk/_shims/auto/types';
|
6 |
+
import { type RequestOptions } from "../core.js";
|
7 |
+
|
8 |
+
type SelectType<Manual, Auto> = unknown extends Manual ? Auto : Manual;
|
9 |
+
|
10 |
+
export const kind: string;
|
11 |
+
|
12 |
+
// @ts-ignore
|
13 |
+
export type Agent = SelectType<manual.Agent, auto.Agent>;
|
14 |
+
|
15 |
+
// @ts-ignore
|
16 |
+
export const fetch: SelectType<typeof manual.fetch, typeof auto.fetch>;
|
17 |
+
|
18 |
+
// @ts-ignore
|
19 |
+
export type Request = SelectType<manual.Request, auto.Request>;
|
20 |
+
// @ts-ignore
|
21 |
+
export type RequestInfo = SelectType<manual.RequestInfo, auto.RequestInfo>;
|
22 |
+
// @ts-ignore
|
23 |
+
export type RequestInit = SelectType<manual.RequestInit, auto.RequestInit>;
|
24 |
+
|
25 |
+
// @ts-ignore
|
26 |
+
export type Response = SelectType<manual.Response, auto.Response>;
|
27 |
+
// @ts-ignore
|
28 |
+
export type ResponseInit = SelectType<manual.ResponseInit, auto.ResponseInit>;
|
29 |
+
// @ts-ignore
|
30 |
+
export type ResponseType = SelectType<manual.ResponseType, auto.ResponseType>;
|
31 |
+
// @ts-ignore
|
32 |
+
export type BodyInit = SelectType<manual.BodyInit, auto.BodyInit>;
|
33 |
+
// @ts-ignore
|
34 |
+
export type Headers = SelectType<manual.Headers, auto.Headers>;
|
35 |
+
// @ts-ignore
|
36 |
+
export const Headers: SelectType<typeof manual.Headers, typeof auto.Headers>;
|
37 |
+
// @ts-ignore
|
38 |
+
export type HeadersInit = SelectType<manual.HeadersInit, auto.HeadersInit>;
|
39 |
+
|
40 |
+
// @ts-ignore
|
41 |
+
export type BlobPropertyBag = SelectType<manual.BlobPropertyBag, auto.BlobPropertyBag>;
|
42 |
+
// @ts-ignore
|
43 |
+
export type FilePropertyBag = SelectType<manual.FilePropertyBag, auto.FilePropertyBag>;
|
44 |
+
// @ts-ignore
|
45 |
+
export type FileFromPathOptions = SelectType<manual.FileFromPathOptions, auto.FileFromPathOptions>;
|
46 |
+
// @ts-ignore
|
47 |
+
export type FormData = SelectType<manual.FormData, auto.FormData>;
|
48 |
+
// @ts-ignore
|
49 |
+
export const FormData: SelectType<typeof manual.FormData, typeof auto.FormData>;
|
50 |
+
// @ts-ignore
|
51 |
+
export type File = SelectType<manual.File, auto.File>;
|
52 |
+
// @ts-ignore
|
53 |
+
export const File: SelectType<typeof manual.File, typeof auto.File>;
|
54 |
+
// @ts-ignore
|
55 |
+
export type Blob = SelectType<manual.Blob, auto.Blob>;
|
56 |
+
// @ts-ignore
|
57 |
+
export const Blob: SelectType<typeof manual.Blob, typeof auto.Blob>;
|
58 |
+
|
59 |
+
// @ts-ignore
|
60 |
+
export type Readable = SelectType<manual.Readable, auto.Readable>;
|
61 |
+
// @ts-ignore
|
62 |
+
export type FsReadStream = SelectType<manual.FsReadStream, auto.FsReadStream>;
|
63 |
+
// @ts-ignore
|
64 |
+
export type ReadableStream = SelectType<manual.ReadableStream, auto.ReadableStream>;
|
65 |
+
// @ts-ignore
|
66 |
+
export const ReadableStream: SelectType<typeof manual.ReadableStream, typeof auto.ReadableStream>;
|
67 |
+
|
68 |
+
export function getMultipartRequestOptions<T extends {} = Record<string, unknown>>(
|
69 |
+
form: FormData,
|
70 |
+
opts: RequestOptions<T>,
|
71 |
+
): Promise<RequestOptions<T>>;
|
72 |
+
|
73 |
+
export function getDefaultAgent(url: string): any;
|
74 |
+
|
75 |
+
// @ts-ignore
|
76 |
+
export type FileFromPathOptions = SelectType<manual.FileFromPathOptions, auto.FileFromPathOptions>;
|
77 |
+
|
78 |
+
export function fileFromPath(path: string, options?: FileFromPathOptions): Promise<File>;
|
79 |
+
export function fileFromPath(path: string, filename?: string, options?: FileFromPathOptions): Promise<File>;
|
80 |
+
|
81 |
+
export function isFsReadStream(value: any): value is FsReadStream;
|
node_modules/@anthropic-ai/sdk/_shims/index.js
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Disclaimer: modules in _shims aren't intended to be imported by SDK users.
|
3 |
+
*/
|
4 |
+
const shims = require('./registry');
|
5 |
+
const auto = require('@anthropic-ai/sdk/_shims/auto/runtime');
|
6 |
+
if (!shims.kind) shims.setShims(auto.getRuntime(), { auto: true });
|
7 |
+
for (const property of Object.keys(shims)) {
|
8 |
+
Object.defineProperty(exports, property, {
|
9 |
+
get() {
|
10 |
+
return shims[property];
|
11 |
+
},
|
12 |
+
});
|
13 |
+
}
|
node_modules/@anthropic-ai/sdk/_shims/index.mjs
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Disclaimer: modules in _shims aren't intended to be imported by SDK users.
|
3 |
+
*/
|
4 |
+
import * as shims from './registry.mjs';
|
5 |
+
import * as auto from '@anthropic-ai/sdk/_shims/auto/runtime';
|
6 |
+
if (!shims.kind) shims.setShims(auto.getRuntime(), { auto: true });
|
7 |
+
export * from './registry.mjs';
|
node_modules/@anthropic-ai/sdk/_shims/manual-types.d.ts
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Disclaimer: modules in _shims aren't intended to be imported by SDK users.
|
3 |
+
*/
|
4 |
+
/**
|
5 |
+
* Types will get added to this namespace when you import one of the following:
|
6 |
+
*
|
7 |
+
* import '@anthropic-ai/sdk/shims/node'
|
8 |
+
* import '@anthropic-ai/sdk/shims/web'
|
9 |
+
*
|
10 |
+
* Importing more than one will cause type and runtime errors.
|
11 |
+
*/
|
12 |
+
export namespace manual {}
|
node_modules/@anthropic-ai/sdk/_shims/manual-types.js
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Disclaimer: modules in _shims aren't intended to be imported by SDK users.
|
3 |
+
*/
|
node_modules/@anthropic-ai/sdk/_shims/manual-types.mjs
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Disclaimer: modules in _shims aren't intended to be imported by SDK users.
|
3 |
+
*/
|