diff --git a/README.md b/README.md index 714e8d16..da3db48e 100644 --- a/README.md +++ b/README.md @@ -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); @@ -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) { @@ -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); } @@ -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: [ { @@ -146,7 +146,7 @@ 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' }], }, @@ -154,7 +154,7 @@ await anthropic.beta.messages.batches.create({ { 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' }], }, @@ -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) { @@ -234,7 +234,7 @@ Error codes are as followed: 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-opus-20240229' }); +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 ``` @@ -255,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, }); ``` @@ -272,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, }); ``` @@ -329,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' } }, ); @@ -351,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')); @@ -361,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')); @@ -473,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 }), diff --git a/examples/cancellation.ts b/examples/cancellation.ts index 23fb7ec9..fc8bb0c7 100755 --- a/examples/cancellation.ts +++ b/examples/cancellation.ts @@ -16,7 +16,7 @@ async function main() { const question = 'Hey Claude! How can I recursively list all files in a directory in Rust?'; const stream = await client.messages.create({ - model: 'claude-3-opus-20240229', + model: 'claude-3-5-sonnet-latest', stream: true, max_tokens: 500, messages: [{ role: 'user', content: question }], diff --git a/examples/demo.ts b/examples/demo.ts index 609e63ef..33fc2d87 100755 --- a/examples/demo.ts +++ b/examples/demo.ts @@ -12,7 +12,7 @@ async function main() { content: 'Hey Claude!?', }, ], - model: 'claude-3-opus-20240229', + model: 'claude-3-5-sonnet-latest', max_tokens: 1024, }); console.dir(result); diff --git a/examples/raw-streaming.ts b/examples/raw-streaming.ts index 559a6cac..916f2a4d 100755 --- a/examples/raw-streaming.ts +++ b/examples/raw-streaming.ts @@ -6,7 +6,7 @@ const client = new Anthropic(); // gets API Key from environment variable ANTHRO async function main() { const stream = await client.messages.create({ - model: 'claude-3-opus-20240229', + model: 'claude-3-5-sonnet-latest', stream: true, max_tokens: 500, messages: [ diff --git a/examples/streaming.ts b/examples/streaming.ts index 9ac2da60..bc2c74bd 100755 --- a/examples/streaming.ts +++ b/examples/streaming.ts @@ -13,7 +13,7 @@ async function main() { content: `Hey Claude! How can I recursively list all files in a directory in Rust?`, }, ], - model: 'claude-3-opus-20240229', + model: 'claude-3-5-sonnet-latest', max_tokens: 1024, }) // Once a content block is fully streamed, this event will fire diff --git a/examples/tools-streaming.ts b/examples/tools-streaming.ts index 96d9cbdc..816201f2 100644 --- a/examples/tools-streaming.ts +++ b/examples/tools-streaming.ts @@ -33,7 +33,7 @@ async function main() { }, }, ], - model: 'claude-3-haiku-20240307', + model: 'claude-3-5-sonnet-latest', max_tokens: 1024, }) // When a JSON content block delta is encountered this diff --git a/examples/tools.ts b/examples/tools.ts index b237043b..1a696bc0 100644 --- a/examples/tools.ts +++ b/examples/tools.ts @@ -22,7 +22,7 @@ async function main() { ]; const message = await client.messages.create({ - model: 'claude-3-opus-20240229', + model: 'claude-3-5-sonnet-latest', max_tokens: 1024, messages: [userMessage], tools, @@ -38,7 +38,7 @@ async function main() { assert(tool); const result = await client.messages.create({ - model: 'claude-3-opus-20240229', + model: 'claude-3-5-sonnet-latest', max_tokens: 1024, messages: [ userMessage, diff --git a/packages/bedrock-sdk/README.md b/packages/bedrock-sdk/README.md index f6eca6f5..74765c47 100644 --- a/packages/bedrock-sdk/README.md +++ b/packages/bedrock-sdk/README.md @@ -27,7 +27,7 @@ const client = new AnthropicBedrock(); async function main() { const message = await client.messages.create({ - model: 'anthropic.claude-3-sonnet-20240229-v1:0', + model: 'anthropic.claude-3-5-sonnet-20241022-v2:0', messages: [ { role: 'user', diff --git a/packages/bedrock-sdk/examples/demo.ts b/packages/bedrock-sdk/examples/demo.ts index 810514e8..a918b9ca 100644 --- a/packages/bedrock-sdk/examples/demo.ts +++ b/packages/bedrock-sdk/examples/demo.ts @@ -11,7 +11,7 @@ const anthropic = new AnthropicBedrock(); async function main() { const message = await anthropic.messages.create({ - model: 'anthropic.claude-3-sonnet-20240229-v1:0', + model: 'anthropic.claude-3-5-sonnet-20241022-v2:0', messages: [ { role: 'user', diff --git a/packages/bedrock-sdk/examples/streaming.ts b/packages/bedrock-sdk/examples/streaming.ts index e1fac81f..5c577a2d 100644 --- a/packages/bedrock-sdk/examples/streaming.ts +++ b/packages/bedrock-sdk/examples/streaming.ts @@ -11,7 +11,7 @@ const client = new AnthropicBedrock(); async function main() { const stream = await client.messages.create({ - model: 'anthropic.claude-3-sonnet-20240229-v1:0', + model: 'anthropic.claude-3-5-sonnet-20241022-v2:0', messages: [ { role: 'user', diff --git a/packages/vertex-sdk/README.md b/packages/vertex-sdk/README.md index 6e63a8c5..6c9a9c93 100644 --- a/packages/vertex-sdk/README.md +++ b/packages/vertex-sdk/README.md @@ -30,7 +30,7 @@ async function main() { content: 'Hey Claude!', }, ], - model: 'claude-3-sonnet@20240229', + model: 'claude-3-5-sonnet-v2@20241022', max_tokens: 300, }); console.log(JSON.stringify(result, null, 2)); diff --git a/packages/vertex-sdk/examples/vertex.ts b/packages/vertex-sdk/examples/vertex.ts index 62474cc7..75aba347 100644 --- a/packages/vertex-sdk/examples/vertex.ts +++ b/packages/vertex-sdk/examples/vertex.ts @@ -14,7 +14,7 @@ async function main() { content: 'Hello!', }, ], - model: 'claude-3-sonnet@20240229', + model: 'claude-3-5-sonnet-v2@20241022', max_tokens: 300, }); console.log(JSON.stringify(result, null, 2));