Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: release main #595

Merged
merged 25 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
7572e48
chore(ci): remove unneeded workflow (#594)
stainless-app[bot] Nov 8, 2024
17b7da5
chore(bedrock,vertex): remove unsupported countTokens method (#597)
RobertCraigie Nov 8, 2024
9d6d584
feat(client): add ._request_id property to object responses (#596)
RobertCraigie Nov 8, 2024
e222a4d
fix(types): remove anthropic-instant-1.2 model (#599)
Nov 8, 2024
e4daff2
chore(internal): use reexports not destructuring (#604)
stainless-app[bot] Nov 11, 2024
ea44f9a
chore(api): update spec version (#607)
stainless-app[bot] Nov 13, 2024
e303077
fix(docs): add missing await to pagination example (#609)
stainless-app[bot] Nov 14, 2024
5d0d523
chore(client): drop unused devDependency (#610)
stainless-app[bot] Nov 14, 2024
91dc181
chore(tests): limit array example length (#611)
Nov 18, 2024
c26121e
chore: improve browser error message (#613)
stainless-app[bot] Nov 18, 2024
6369261
docs: remove suggestion to use `npm` call out (#614)
stainless-app[bot] Nov 19, 2024
ef57a10
chore: remove redundant word in comment (#615)
stainless-app[bot] Nov 19, 2024
d3dd7d5
feat(internal): make git install file structure match npm (#617)
stainless-app[bot] Nov 27, 2024
882c45f
chore(internal): remove unnecessary getRequestClient function (#623)
stainless-app[bot] Dec 9, 2024
e58ba9a
chore(internal): bump cross-spawn to v7.0.6 (#624)
stainless-app[bot] Dec 10, 2024
f70882b
docs: use latest sonnet in example snippets (#625)
stainless-app[bot] Dec 10, 2024
0287993
chore(types): nicer error class types + jsdocs (#626)
stainless-app[bot] Dec 10, 2024
2528ea0
chore(internal): update isAbsoluteURL (#627)
stainless-app[bot] Dec 11, 2024
a25295c
chore(api): update spec version (#629)
stainless-app[bot] Dec 16, 2024
82cac06
chore(internal): update spec (#630)
stainless-app[bot] Dec 16, 2024
93d1316
feat(api): general availability updates
RobertCraigie Dec 17, 2024
9e76b4d
feat(vertex): support token counting
RobertCraigie Dec 17, 2024
6458dc1
chore(bedrock): remove unsupported methods
RobertCraigie Dec 17, 2024
b5c92e5
feat(api): general availability updates (#631)
stainless-app[bot] Dec 17, 2024
39301bc
chore: release main
stainless-app[bot] Dec 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 0 additions & 26 deletions .github/workflows/handle-release-pr-title-edit.yml

This file was deleted.

6 changes: 3 additions & 3 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
".": "0.32.1",
"packages/vertex-sdk": "0.5.2",
"packages/bedrock-sdk": "0.11.2"
".": "0.33.0",
"packages/vertex-sdk": "0.6.0",
"packages/bedrock-sdk": "0.12.0"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 10
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic-25f83d91f601c1962b3701fedf829f678f306aca0758af286ee1586cc9931f75.yml
configured_endpoints: 19
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic-be055148d227480fcacc9086c37ac8009dcb487731069ada51af35044f65bee4.yml
43 changes: 43 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,48 @@
# Changelog

## 0.33.0 (2024-12-17)

Full Changelog: [sdk-v0.32.1...sdk-v0.33.0](https://github.com/anthropics/anthropic-sdk-typescript/compare/sdk-v0.32.1...sdk-v0.33.0)

### Features

* **api:** general availability updates ([93d1316](https://github.com/anthropics/anthropic-sdk-typescript/commit/93d13168f950b2cdfc3b7c6664205b06418fea79))
* **api:** general availability updates ([#631](https://github.com/anthropics/anthropic-sdk-typescript/issues/631)) ([b5c92e5](https://github.com/anthropics/anthropic-sdk-typescript/commit/b5c92e5b74c370ac3f9ba28e915bd54588a42be0))
* **client:** add ._request_id property to object responses ([#596](https://github.com/anthropics/anthropic-sdk-typescript/issues/596)) ([9d6d584](https://github.com/anthropics/anthropic-sdk-typescript/commit/9d6d58430a216df9888434158bf628ae4b067aba))
* **internal:** make git install file structure match npm ([#617](https://github.com/anthropics/anthropic-sdk-typescript/issues/617)) ([d3dd7d5](https://github.com/anthropics/anthropic-sdk-typescript/commit/d3dd7d5f8cad460dd18725d5c0f3c8db3f00115d))
* **vertex:** support token counting ([9e76b4d](https://github.com/anthropics/anthropic-sdk-typescript/commit/9e76b4dc22d62b1239b382bb771b69ad8cff9442))


### Bug Fixes

* **docs:** add missing await to pagination example ([#609](https://github.com/anthropics/anthropic-sdk-typescript/issues/609)) ([e303077](https://github.com/anthropics/anthropic-sdk-typescript/commit/e303077ebab73c41adee7d25375b767c3fc78998))
* **types:** remove anthropic-instant-1.2 model ([#599](https://github.com/anthropics/anthropic-sdk-typescript/issues/599)) ([e222a4d](https://github.com/anthropics/anthropic-sdk-typescript/commit/e222a4d0518aa80671c66ee2a25d87dc87a51316))


### Chores

* **api:** update spec version ([#607](https://github.com/anthropics/anthropic-sdk-typescript/issues/607)) ([ea44f9a](https://github.com/anthropics/anthropic-sdk-typescript/commit/ea44f9ac49dcc25a5dfa53880ebf61318ee90f6c))
* **api:** update spec version ([#629](https://github.com/anthropics/anthropic-sdk-typescript/issues/629)) ([a25295c](https://github.com/anthropics/anthropic-sdk-typescript/commit/a25295cd6db7b57162fdd9049eb8a3c37bb94f08))
* **bedrock,vertex:** remove unsupported countTokens method ([#597](https://github.com/anthropics/anthropic-sdk-typescript/issues/597)) ([17b7da5](https://github.com/anthropics/anthropic-sdk-typescript/commit/17b7da5ee6f35ea2bdd53a66a662871affae6341))
* **bedrock:** remove unsupported methods ([6458dc1](https://github.com/anthropics/anthropic-sdk-typescript/commit/6458dc14544c16240a6580a21a36fcf5bde594b2))
* **ci:** remove unneeded workflow ([#594](https://github.com/anthropics/anthropic-sdk-typescript/issues/594)) ([7572e48](https://github.com/anthropics/anthropic-sdk-typescript/commit/7572e48dbccb2090562399c7ff2d01503c86f445))
* **client:** drop unused devDependency ([#610](https://github.com/anthropics/anthropic-sdk-typescript/issues/610)) ([5d0d523](https://github.com/anthropics/anthropic-sdk-typescript/commit/5d0d523390d8c34cae836c423940b67defb9d2aa))
* improve browser error message ([#613](https://github.com/anthropics/anthropic-sdk-typescript/issues/613)) ([c26121e](https://github.com/anthropics/anthropic-sdk-typescript/commit/c26121e84039b7430995b6363876ea9795ba31ed))
* **internal:** bump cross-spawn to v7.0.6 ([#624](https://github.com/anthropics/anthropic-sdk-typescript/issues/624)) ([e58ba9a](https://github.com/anthropics/anthropic-sdk-typescript/commit/e58ba9a177ec5c8545fd3a3f4fd3d2e7c722f023))
* **internal:** remove unnecessary getRequestClient function ([#623](https://github.com/anthropics/anthropic-sdk-typescript/issues/623)) ([882c45f](https://github.com/anthropics/anthropic-sdk-typescript/commit/882c45f5a0bd1f4b996d59e6589a205c2111f46b))
* **internal:** update isAbsoluteURL ([#627](https://github.com/anthropics/anthropic-sdk-typescript/issues/627)) ([2528ea0](https://github.com/anthropics/anthropic-sdk-typescript/commit/2528ea0dcfc83f38e76b58eaadaa5e8c5c0b188d))
* **internal:** update spec ([#630](https://github.com/anthropics/anthropic-sdk-typescript/issues/630)) ([82cac06](https://github.com/anthropics/anthropic-sdk-typescript/commit/82cac065e2711467773c0ea62848cdf139ed5a11))
* **internal:** use reexports not destructuring ([#604](https://github.com/anthropics/anthropic-sdk-typescript/issues/604)) ([e4daff2](https://github.com/anthropics/anthropic-sdk-typescript/commit/e4daff2b6a3fb42876ebd06ed4947c88cff919d8))
* remove redundant word in comment ([#615](https://github.com/anthropics/anthropic-sdk-typescript/issues/615)) ([ef57a10](https://github.com/anthropics/anthropic-sdk-typescript/commit/ef57a103bcfc922a724a7c878f970dbd369b305e))
* **tests:** limit array example length ([#611](https://github.com/anthropics/anthropic-sdk-typescript/issues/611)) ([91dc181](https://github.com/anthropics/anthropic-sdk-typescript/commit/91dc1812db2cc9e1f4660a13106bad932518b7cf))
* **types:** nicer error class types + jsdocs ([#626](https://github.com/anthropics/anthropic-sdk-typescript/issues/626)) ([0287993](https://github.com/anthropics/anthropic-sdk-typescript/commit/0287993912ef81bd2c49603d120f49f4f979d75e))


### Documentation

* remove suggestion to use `npm` call out ([#614](https://github.com/anthropics/anthropic-sdk-typescript/issues/614)) ([6369261](https://github.com/anthropics/anthropic-sdk-typescript/commit/6369261e3597351f17b8f1a3945ca56b00eba177))
* use latest sonnet in example snippets ([#625](https://github.com/anthropics/anthropic-sdk-typescript/issues/625)) ([f70882b](https://github.com/anthropics/anthropic-sdk-typescript/commit/f70882b0e8119a414b01b9f0b85fbe1ccb06f122))

## 0.32.1 (2024-11-05)

Full Changelog: [sdk-v0.32.0...sdk-v0.32.1](https://github.com/anthropics/anthropic-sdk-typescript/compare/sdk-v0.32.0...sdk-v0.32.1)
Expand Down
42 changes: 27 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ async function main() {
const message = await client.messages.create({
max_tokens: 1024,
messages: [{ role: 'user', content: 'Hello, Claude' }],
model: 'claude-3-opus-20240229',
model: 'claude-3-5-sonnet-latest',
});

console.log(message.content);
Expand All @@ -49,7 +49,7 @@ const client = new Anthropic();
const stream = await client.messages.create({
max_tokens: 1024,
messages: [{ role: 'user', content: 'Hello, Claude' }],
model: 'claude-3-opus-20240229',
model: 'claude-3-5-sonnet-latest',
stream: true,
});
for await (const messageStreamEvent of stream) {
Expand All @@ -76,7 +76,7 @@ async function main() {
const params: Anthropic.MessageCreateParams = {
max_tokens: 1024,
messages: [{ role: 'user', content: 'Hello, Claude' }],
model: 'claude-3-opus-20240229',
model: 'claude-3-5-sonnet-latest',
};
const message: Anthropic.Message = await client.messages.create(params);
}
Expand Down Expand Up @@ -108,7 +108,7 @@ const anthropic = new Anthropic();
async function main() {
const stream = anthropic.messages
.stream({
model: 'claude-3-opus-20240229',
model: 'claude-3-5-sonnet-latest',
max_tokens: 1024,
messages: [
{
Expand Down Expand Up @@ -146,15 +146,15 @@ await anthropic.beta.messages.batches.create({
{
custom_id: 'my-first-request',
params: {
model: 'claude-3-5-sonnet-20240620',
model: 'claude-3-5-sonnet-latest',
max_tokens: 1024,
messages: [{ role: 'user', content: 'Hello, world' }],
},
},
{
custom_id: 'my-second-request',
params: {
model: 'claude-3-5-sonnet-20240620',
model: 'claude-3-5-sonnet-latest',
max_tokens: 1024,
messages: [{ role: 'user', content: 'Hi again, friend' }],
},
Expand Down Expand Up @@ -198,7 +198,7 @@ async function main() {
.create({
max_tokens: 1024,
messages: [{ role: 'user', content: 'Hello, Claude' }],
model: 'claude-3-opus-20240229',
model: 'claude-3-5-sonnet-latest',
})
.catch(async (err) => {
if (err instanceof Anthropic.APIError) {
Expand Down Expand Up @@ -227,6 +227,18 @@ Error codes are as followed:
| >=500 | `InternalServerError` |
| N/A | `APIConnectionError` |

## Request IDs

> For more information on debugging requests, see [these docs](https://docs.anthropic.com/en/api/errors#request-id)

All object responses in the SDK provide a `_request_id` property which is added from the `request-id` response header so that you can quickly log failing requests and report them back to Anthropic.

```ts
const message = await client.messages.create({ max_tokens: 1024, messages: [{ role: 'user', content: 'Hello, Claude' }], model: 'claude-3-5-sonnet-latest' });
console.log(completion._request_id) // req_018EeWyXxfu5pfWkrYcMdjWG
```


### Retries

Certain errors will be automatically retried 2 times by default, with a short exponential backoff.
Expand All @@ -243,7 +255,7 @@ const client = new Anthropic({
});

// Or, configure per-request:
await client.messages.create({ max_tokens: 1024, messages: [{ role: 'user', content: 'Hello, Claude' }], model: 'claude-3-opus-20240229' }, {
await client.messages.create({ max_tokens: 1024, messages: [{ role: 'user', content: 'Hello, Claude' }], model: 'claude-3-5-sonnet-latest' }, {
maxRetries: 5,
});
```
Expand All @@ -260,7 +272,7 @@ const client = new Anthropic({
});

// Override per-request:
await client.messages.create({ max_tokens: 1024, messages: [{ role: 'user', content: 'Hello, Claude' }], model: 'claude-3-opus-20240229' }, {
await client.messages.create({ max_tokens: 1024, messages: [{ role: 'user', content: 'Hello, Claude' }], model: 'claude-3-5-sonnet-latest' }, {
timeout: 5 * 1000,
});
```
Expand Down Expand Up @@ -295,7 +307,7 @@ for (const betaMessageBatch of page.data) {

// Convenience methods are provided for manually paginating:
while (page.hasNextPage()) {
page = page.getNextPage();
page = await page.getNextPage();
// ...
}
```
Expand All @@ -317,7 +329,7 @@ const message = await client.messages.create(
{
max_tokens: 1024,
messages: [{ role: 'user', content: 'Hello, Claude' }],
model: 'claude-3-opus-20240229',
model: 'claude-3-5-sonnet-latest',
},
{ headers: { 'anthropic-version': 'My-Custom-Value' } },
);
Expand All @@ -339,7 +351,7 @@ const response = await client.messages
.create({
max_tokens: 1024,
messages: [{ role: 'user', content: 'Hello, Claude' }],
model: 'claude-3-opus-20240229',
model: 'claude-3-5-sonnet-latest',
})
.asResponse();
console.log(response.headers.get('X-My-Header'));
Expand All @@ -349,7 +361,7 @@ const { data: message, response: raw } = await client.messages
.create({
max_tokens: 1024,
messages: [{ role: 'user', content: 'Hello, Claude' }],
model: 'claude-3-opus-20240229',
model: 'claude-3-5-sonnet-latest',
})
.withResponse();
console.log(raw.headers.get('X-My-Header'));
Expand Down Expand Up @@ -461,7 +473,7 @@ await client.messages.create(
{
max_tokens: 1024,
messages: [{ role: 'user', content: 'Hello, Claude' }],
model: 'claude-3-opus-20240229',
model: 'claude-3-5-sonnet-latest',
},
{
httpAgent: new http.Agent({ keepAlive: false }),
Expand All @@ -488,7 +500,7 @@ TypeScript >= 4.5 is supported.
The following runtimes are supported:

- Node.js 18 LTS or later ([non-EOL](https://endoflife.date/nodejs)) versions.
- Deno v1.28.0 or higher, using `import Anthropic from "npm:@anthropic-ai/sdk"`.
- Deno v1.28.0 or higher.
- Bun 1.0 or later.
- Cloudflare Workers.
- Vercel Edge Runtime.
Expand Down
Loading
Loading