sdk: v0.12.4
0.12.4 (2024-01-23)
Full Changelog: sdk-v0.12.3...sdk-v0.12.4
⚠ BREAKING CHANGES
- remove anthropic-beta and x-api-key headers from param types (#243)
- client: Stream.toReadableStream() has been removed
Features
- add flexible enum to model param (#73) (a6bbcad)
- allow a default timeout to be set for clients (#113) (1c5b2e2)
- allow installing package directly from github (#215) (ba509fb)
- api: add messages endpoint with streaming helpers (#235) (038e036)
- api: reference claude-2 in examples (#50) (7c53ded)
- client: add support for
defaultQuery
option (48b1597) - client: add support for accessing the raw response object (#105) (c86b059)
- client: add support for passing a
signal
request option (#55) (09604e9) - client: adjust retry behavior to be exponential backoff (#192) (e11bd99)
- client: allow binary returns (#203) (77f5d09)
- client: detect browser usage (#101) (f4cae3f)
- client: export ClientOptions interface (#75) (0315ce1)
- client: handle retry-after with a date (#162) (5d7f23d)
- client: improve compatibility with Bun (#119) (fe4f5d5)
- client: improve timeout handling to reuse agent (a512020)
- client: retry on 408 Request Timeout (#151) (ccbc758)
- client: support importing node or web shims manually (#157) (c240c1d)
- client: support passing a custom
fetch
function (#46) (7d54366) - client: support reading the base url from an env variable (#223) (e084233)
- deps: remove unneeded qs dep (#72) (0aea5a6)
- docs: add documentation to the client constructor (#118) (79303f9)
- errors: add status code to error message (#155) (c07ace2)
- github: include a devcontainer setup (#202) (483bdb0)
- handle 204 No Content gracefully (#190) (11bd205)
- package: add Bun export map (#139) (7a9bfcf)
- package: export a root error type (#160) (19d5cda)
- streaming: make requests immediately throw an error if an aborted signal is passed in (#79) (5c86597)
- support ESM and web platform runtimes (#25) (d5552a5)
- types: export RequestOptions type (#127) (9769751)
- types: improve streaming params types (#102) (cdf808c)
- types: remove footgun with streaming params (#125) (3ed67b6)
- vertex: add support for google vertex (#265) (9a0410d)
Bug Fixes
- allow body type in RequestOptions to be null (#259) (55f19d9)
- bump default request timeout to 10 minutes (c442805)
- ci: ignore stainless-app edits to release PR title (#258) (e92bfaf)
- client: eliminate circular imports, which cause runtime errors in webpack dev bundles (#170) (4fe033e)
- client: fix errors with file uploads in the browser (#76) (ac48fa7)
- client: fix TS errors that appear when users Go to Source in VSCode (#142) (45d970b)
- client: fix TypeError when a request gets retried (#117) (0ade979)
- client: handle case where the client is instantiated with a undefined baseURL (#143) (4ef0acd)
- client: handle undefined process in more places (#87) (d950c25)
- client: properly handle multi-byte characters in Content-Length (#47) (8dfff26)
- client: use explicit file extensions in _shims imports (#141) (49b4bf7)
- core: fix navigator check for strange environments (#124) (c783604)
- examples: avoid swallowing errors in example scripts (e406dfb)
- examples: avoid swallowing errors in example scripts (#82) (b27cfe9)
- fix error in environments without
TextEncoder
(#70) (5b78e05) - fix errors in package source files when users go to definition in VSCode (7904179)
- fix errors with "named" client export in CJS (#67) (08ef69c)
- fix export map order (#74) (51e70cb)
- fix link to README file uploads in fileFromPath (c4e2c64)
- fix module not found errors in Vercel edge (#148) (2ecc0de)
- fix namespace exports regression (#171) (b3c1f99)
- fix undefined message in errors (#86) (5714a14)
- headers: always send lowercase headers and strip undefined (BREAKING in rare cases) (#245) (f65a046)
- import web-streams-polyfill without overriding globals (#186) (a8713c6)
- improve status code in error messages (#183) (cd45611)
- prevent ReferenceError, update compatibility to ES2020 and Node 18+ (#169) (cada6ef)
- readme: update link to api.md to use the correct branch (#145) (b1e8dd2)
- remove anthropic-beta and x-api-key headers from param types (#243) (8c63dd0)
- stream: declare Stream.controller as public (#132) (ff33a89)
- streaming: do not abort successfully completed streams (#53) (950dd49)
- streaming: fix response body streaming in non-Chrome environments (c4eb4d7)
- support
PromiseLike
input totoFile
(1d5f87d) - types: accept undefined for optional client options (#257) (3af0266)
- types: add catch-all overload to streaming methods (#123) (7c229a2)
- types: improve getNextPage() return type (#137) (6ae3abb)
- typo in build script (#197) (17a5b4a)
- use default base url if BASE_URL env var is blank (#250) (76b1429)
Chores
- add .keep files for examples and custom code directories (#249) (6fa9ad2)
- add case insensitive get header function (#178) (9aef5ad)
- assign default reviewers to release PRs (#115) (1df3965)
- ci: fix publish-npm (#213) (3b25712)
- ci: run release workflow once per day (#232) (07afeb7)
- ci: setup workflows to create releases and release PRs (#135) (9ad9acf)
- ci: update release-please config (#206) (c0f016b)
- deps: update dependency ts-jest to v29.1.1 (#233) (69ce35c)
- deps: update jest (#234) (ccf35d5)
- docs: fix github links (#208) (cb13887)
- docs: remove trailing spaces (#108) (4ba2c6f)
- internal: add debug logs for stream responses (#182) (004423e)
- internal: add helper function for b64 (#62) (04e303c)
- internal: add helper method (#133) (4c6950a)
- internal: add internal helpers & improve build scripts (#261) (4c1504a)
- internal: add missing eslint-plugin-prettier (#122) (66bede0)
- internal: allow the build script to be run without yarn installed (#91) (9bd2b28)
- internal: bump lock file (#159) (462bde3)
- internal: conditionally include bin during build output (#109) (58ac305)
- internal: debug logging for retries; speculative retry-after-ms support (#256) (334edb6)
- internal: don't call prepare in dist (#216) (82366fe)
- internal: export HeadersInit type shim (#129) (bcd51bd)
- internal: export helper from core (#147) (80948cb)
- internal: fix deno build (#96) (3fdab4e)
- internal: fix deno build (#98) (f011e04)
- internal: fix error happening in CloudFlare pages (#116) (b0dc7b3)
- internal: fix tsc usage (2b4bce4)
- internal: improve type signatures (#247) (266d32e)
- internal: let
toFile
helper accept promises to objects with name/type properties (#63) (93f9af2) - internal: minor formatting improvement (#168) (a986f28)
- internal: minor refactoring of client instantiation (#88) (2c53e1c)
- internal: minor reformatting of code (#120) (4bcaf9e)
- internal: minor streaming updates (#264) (d4414ff)
- internal: narrow type into stringifyQuery (#253) (2a3a126)
- internal: remove deno build (#103) (9af1527)
- internal: remove file import and conditionally run prepare (#217) (d4d8de3)
- internal: remove unneeded type var usage (#59) (42fc4a9)
- internal: update APIResource structure (#211) (38a4e5f)
- internal: update gitignore (#198) (3f42c52)
- internal: update jest config (#210) (4cf475a)
- internal: update lock file (#161) (23a5669)
- internal: update lock file (#163) (2ca15e4)
- internal: update lock file (#164) (9a2d365)
- internal: update resource client type (#263) (bc4f115)
- internal: update tsconfig (#209) (acb7a53)
- main: release 0.5.10 (1f701bf)
- main: release 0.5.4 (#51) (736e53b)
- main: release 0.5.5 (b2f28b3)
- main: release 0.5.6 (3944555)
- main: release 0.5.7 (caae87d)
- main: release 0.5.8 (e2e70eb)
- main: release 0.5.9 (01fe37c)
- main: release 0.6.0 (563550f)
- main: release 0.6.1 (d65a6cf)
- main: release 0.6.2 (d8dc0b7)
- next => main: release 0.6.3 (52d16f6)
- next => main: release 0.6.4 (cdc90c9)
- set
noEmit: true
intsconfig.json
, since it's for typechecking only (c9eb9b3) - small cleanups (#201) (bfadd47)
- speed up build script slightly (d8b08cf)
- update comment (#179) (686eff1)
- update dependencies (#231) (0dd6e14)
- update prettier (#230) (2788738)
- update README (#173) (edfae5e)
Documentation
- add migration guide (139f257)
- api.md: add shared models (#158) (1920bd0)
- api.md: fix links not referencing
src
directory (7cec80a) - api.md: minor restructuring (ccdefed)
- client: improve documentation for client options (4df2713)
- declare Bun 1.0 officially supported (#154) (b2ece38)
- document customizing fetch (#204) (47c958e)
- examples: bump model to claude-2 in example scripts (#57) (f85c05d)
- fix github links (#200) (dd5c0e1)
- fix missing async in readme code sample (#255) (6713fd7)
- fix typo (50fa631)
- organisation -> organization (UK to US English) (#185) (cadbf40)
- readme: add link to api.md (#144) (c23bb19)
- readme: add streaming helper documentation (#238) (4e5ed20)
- readme: add token counting reference (#94) (2c6a699)
- readme: fix typo (#121) (c5dbc3f)
- readme: improve api reference (#254) (618b85b)
- readme: improvements to formatting code snippets (#58) (67bae64)
- readme: mention version header (#205) (487ddf4)
- readme: minor updates (#107) (406fd97)
- readme: remove beta status + document versioning policy (#100) (e9ef3d2)
- readme: remove incorrect wording in opening (#156) (949cc1f)
- readme: remove old migration guide (#236) (af8d2c5)
- readme: update examples to use claude-2 (#52) (97bd635)
- rearrange sections in api.md (45479b1)
- reformat README.md (#241) (3d4b7e5)
- update examples to show claude-2.1 (#227) (975b4d4)
Refactors
- client: remove Stream.toReadableStream() (#110) (c370412)
- create build for deno.land (#93) (2ea741a)
- improve streaming implementation (56a17b7)
- mark
.responseHeaders
and.response
as deprecated (93a0445) - move to src directory, improve ecosystem compatibility (4facbae)
- remove unnecessary line in constructor (#131) (dcdf5e5)
- streaming: change Stream constructor signature (#174) (c529e2d)
- streaming: make response body streaming polyfill more spec-compliant (#44) (047d328)
- test: refactor authentication tests (#176) (eba7528)
- use destructuring arguments in client constructor and respect false values (#89) (8d4c686)
- write jest config in typescript (#239) (1d595d6)