Skip to content

Commit

Permalink
docs: use latest sonnet in example snippets (#625)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Dec 10, 2024
1 parent e58ba9a commit 82f3c59
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 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 @@ -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 @@ -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,
});
```
Expand All @@ -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,
});
```
Expand Down Expand Up @@ -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' } },
);
Expand All @@ -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'));
Expand All @@ -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'));
Expand Down Expand Up @@ -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 }),
Expand Down

0 comments on commit 82f3c59

Please sign in to comment.