Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4,328 changes: 4,306 additions & 22 deletions content/.metadata.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion content/blog/engineering/claude-code-best-practices.md
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ Learn

Terms and policies

[Privacy policy](https://www.anthropic.com/legal/privacy)[Disclosure policy](https://www.anthropic.com/responsible-disclosure-policy)[Usage policy](https://www.anthropic.com/legal/aup)[Commercial terms](https://www.anthropic.com/legal/commercial-terms)[Consumer terms](https://www.anthropic.com/legal/consumer-terms)
[Privacy choices](https://www.anthropic.com/engineering/claude-code-best-practices#)[Privacy policy](https://www.anthropic.com/legal/privacy)[Disclosure policy](https://www.anthropic.com/responsible-disclosure-policy)[Usage policy](https://www.anthropic.com/legal/aup)[Commercial terms](https://www.anthropic.com/legal/commercial-terms)[Consumer terms](https://www.anthropic.com/legal/consumer-terms)

Assistant

Expand Down
2 changes: 1 addition & 1 deletion content/blog/engineering/claude-code-sandboxing.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Our new sandboxed bash tool and Claude Code on the web offer substantial improve
To get started with these tools:

1. Run `/sandbox` in Claude and check out [our docs](https://docs.claude.com/en/docs/claude-code/sandboxing) on how to configure this sandbox.
2. Go to [claude.com/code](http://claude.ai/redirect/website.v1.34b4a3b3-f71a-408f-94a7-0b4932e595cf/code) to try out Claude Code on the web.
2. Go to [claude.com/code](http://claude.ai/redirect/website.v1.06b686e8-9fbc-4d2f-ab23-409b29b3d2b4/code) to try out Claude Code on the web.

Or, if you're building your own agents, check out our [open-sourced sandboxing code](https://github.com/anthropic-experimental/sandbox-runtime), and consider integrating it into your work. We look forward to seeing what you build.

Expand Down
42 changes: 21 additions & 21 deletions content/en/about-claude/models/migration-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ These are not required but will improve your experience:
)
```

```typescript TypeScript hidelines={1..4}
```typescript TypeScript hidelines={1..2}
import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic();
Expand Down Expand Up @@ -89,7 +89,7 @@ These are not required but will improve your experience:
}
```

```go Go hidelines={1..13,-1}
```go Go hidelines={1..11,-1}
package main

import (
Expand Down Expand Up @@ -123,7 +123,7 @@ These are not required but will improve your experience:
}
```

```java Java hidelines={1..10,-1}
```java Java hidelines={1..5,8..10,-2..}
import com.anthropic.client.AnthropicClient;
import com.anthropic.client.okhttp.AnthropicOkHttpClient;
import com.anthropic.models.messages.MessageCreateParams;
Expand Down Expand Up @@ -152,7 +152,7 @@ These are not required but will improve your experience:
}
```

```php PHP
```php PHP hidelines={1..4}
<?php

use Anthropic\Client;
Expand All @@ -168,7 +168,7 @@ These are not required but will improve your experience:
);
```

```ruby Ruby
```ruby Ruby hidelines={1..2}
require "anthropic"

client = Anthropic::Client.new
Expand Down Expand Up @@ -482,7 +482,7 @@ class Program
}
```

```go Go hidelines={1..13,-1}
```go Go hidelines={1..11,-1}
package main

import (
Expand Down Expand Up @@ -513,7 +513,7 @@ func main() {
}
```

```java Java hidelines={1..10,-1}
```java Java hidelines={1..4,6..8,-2..}
import com.anthropic.client.AnthropicClient;
import com.anthropic.client.okhttp.AnthropicOkHttpClient;
import com.anthropic.models.messages.MessageCreateParams;
Expand Down Expand Up @@ -541,7 +541,7 @@ public class Main {
}
```

```php PHP hidelines={1..6}
```php PHP hidelines={1..4}
<?php

use Anthropic\Client;
Expand All @@ -557,7 +557,7 @@ $message = $client->messages->create(
echo $message->content[0]->text;
```

```ruby Ruby
```ruby Ruby hidelines={1..2}
require "anthropic"

client = Anthropic::Client.new
Expand Down Expand Up @@ -665,7 +665,7 @@ class Program
}
```

```go Go hidelines={1..13,-1}
```go Go hidelines={1..11,-1}
package main

import (
Expand Down Expand Up @@ -698,7 +698,7 @@ func main() {
}
```

```java Java hidelines={1..10,-1}
```java Java hidelines={1..4,7..9,-2..}
import com.anthropic.client.AnthropicClient;
import com.anthropic.client.okhttp.AnthropicOkHttpClient;
import com.anthropic.models.beta.messages.MessageCreateParams;
Expand Down Expand Up @@ -729,7 +729,7 @@ public class Main {
}
```

```php PHP hidelines={1..6}
```php PHP hidelines={1..4}
<?php

use Anthropic\Client;
Expand All @@ -748,7 +748,7 @@ $message = $client->beta->messages->create(
echo $message;
```

```ruby Ruby
```ruby Ruby hidelines={1..2}
require "anthropic"

client = Anthropic::Client.new
Expand Down Expand Up @@ -857,7 +857,7 @@ class Program
}
```

```go Go hidelines={1..13,-1}
```go Go hidelines={1..11,-1}
package main

import (
Expand Down Expand Up @@ -890,7 +890,7 @@ func main() {
}
```

```java Java hidelines={1..10,-1}
```java Java hidelines={1..4,7..9,-2..}
import com.anthropic.client.AnthropicClient;
import com.anthropic.client.okhttp.AnthropicOkHttpClient;
import com.anthropic.models.beta.messages.MessageCreateParams;
Expand Down Expand Up @@ -921,7 +921,7 @@ public class Main {
}
```

```php PHP hidelines={1..6}
```php PHP hidelines={1..4}
<?php

use Anthropic\Client;
Expand All @@ -940,7 +940,7 @@ $message = $client->beta->messages->create(
echo $message;
```

```ruby Ruby
```ruby Ruby hidelines={1..2}
require "anthropic"

client = Anthropic::Client.new
Expand Down Expand Up @@ -1046,7 +1046,7 @@ class Program
}
```

```go Go nocheck hidelines={1..13,-1}
```go Go nocheck hidelines={1..11,-1}
package main

import (
Expand Down Expand Up @@ -1080,7 +1080,7 @@ func main() {
}
```

```java Java nocheck hidelines={1..10,-1}
```java Java nocheck hidelines={1..4,7..9,-2..}
import com.anthropic.client.AnthropicClient;
import com.anthropic.client.okhttp.AnthropicOkHttpClient;
import com.anthropic.models.messages.MessageCreateParams;
Expand Down Expand Up @@ -1108,7 +1108,7 @@ public class Main {
}
```

```php PHP hidelines={1..6} nocheck
```php PHP hidelines={1..4} nocheck
<?php

use Anthropic\Client;
Expand All @@ -1126,7 +1126,7 @@ $message = $client->messages->create(
echo $message->content[0]->text;
```

```ruby Ruby nocheck
```ruby Ruby nocheck hidelines={1..2}
require "anthropic"

client = Anthropic::Client.new
Expand Down
8 changes: 4 additions & 4 deletions content/en/about-claude/use-case-guides/content-moderation.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ When selecting a model, it’s important to consider the size of your data. If c

In order to use Claude for content moderation, Claude must understand the moderation requirements of your application. Let’s start by writing a prompt that allows you to define your moderation needs:

```python nocheck
```python nocheck hidelines={1}
import anthropic
import json

Expand Down Expand Up @@ -190,7 +190,7 @@ Content moderation is a classification problem. Thus, you can use the same techn

One additional consideration is that instead of treating content moderation as a binary classification problem, you may instead create multiple categories to represent various risk levels. Creating multiple risk levels allows you to adjust the aggressiveness of your moderation. For example, you might want to automatically block user queries that are deemed high risk, while users with many medium risk queries are flagged for human review.

```python nocheck hidelines={1..6}
```python nocheck hidelines={1}
import anthropic
import json

Expand Down Expand Up @@ -289,7 +289,7 @@ In complex scenarios, it may be helpful to consider additional strategies to imp

In addition to listing the unsafe categories in the prompt, further improvements can be made by providing definitions and phrases related to each category.

```python nocheck hidelines={1..6}
```python nocheck hidelines={1}
import anthropic
import json

Expand Down Expand Up @@ -387,7 +387,7 @@ Notably, the definition for the `Specialized Advice` category now specifies the

To reduce costs in situations where real-time moderation isn't necessary, consider moderating messages in batches. Include multiple messages within the prompt's context, and ask Claude to assess which messages should be moderated.

```python nocheck hidelines={1..6}
```python nocheck hidelines={1}
import anthropic
import json

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ Claude can adapt to various summarization styles. You can change the details of

Here’s an example of how to create a prompt that ensures the generated summaries follow a consistent structure when analyzing sublease agreements:

```python nocheck hidelines={1..4,-1}
```python nocheck hidelines={1..2}
import anthropic

# Initialize the Anthropic client
Expand Down Expand Up @@ -252,7 +252,7 @@ Legal summarization often involves handling long documents or many related docum

Here's an example of how to perform meta-summarization:

```python nocheck hidelines={1..4,-1}
```python nocheck hidelines={1..2}
import anthropic

# Initialize the Anthropic client
Expand Down
6 changes: 3 additions & 3 deletions content/en/about-claude/use-case-guides/ticket-routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ It’s hard to know how well your prompt works without deploying it in a test pr

Let’s build the deployment structure. Start by defining the method signature for wrapping our call to Claude. We'll take the method we’ve already begun to write, which has `ticket_contents` as input, and now return a tuple of `reasoning` and `intent` as output. If you have an existing automation using traditional ML, you'll want to follow that method signature instead.

```python nocheck
```python nocheck hidelines={1}
import anthropic
import re

Expand Down Expand Up @@ -385,7 +385,7 @@ def classify_support_request(ticket_contents):
```

This code:
* Imports the Anthropic library and creates a client instance using your API key.
* Creates a client instance using your API key.
* Defines a `classify_support_request` function that takes a `ticket_contents` string.
* Sends the `ticket_contents` to Claude for classification using the `classification_prompt`
* Returns the model's `reasoning` and `intent` extracted from the response.
Expand All @@ -410,7 +410,7 @@ You may need to assess Claude on other axes depending on what factors that are i

To assess this, we first have to modify the script we wrote and add a function to compare the predicted intent with the actual intent and calculate the percentage of correct predictions. We also have to add in cost calculation and time measurement functionality.

```python nocheck hidelines={1..8}
```python nocheck hidelines={1}
import anthropic
import re

Expand Down
6 changes: 3 additions & 3 deletions content/en/agents-and-tools/agent-skills/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ for skill in skills.data:
print(f"{skill.id}: {skill.display_title}")
```

```typescript TypeScript hidelines={1..4}
```typescript TypeScript
import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic();
Expand Down Expand Up @@ -75,7 +75,7 @@ This API returns each Skill's metadata: its name and description. Claude loads t
Now use the PowerPoint Skill to create a presentation about renewable energy. Specify Skills using the `container` parameter in the Messages API:

<CodeGroup>
```python Python hidelines={1..4,-1}
```python Python
import anthropic

client = anthropic.Anthropic()
Expand All @@ -100,7 +100,7 @@ response = client.beta.messages.create(
print(response.content)
```

```typescript TypeScript hidelines={1..4}
```typescript TypeScript
import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic();
Expand Down
12 changes: 6 additions & 6 deletions content/en/agents-and-tools/mcp-connector.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ curl https://api.anthropic.com/v1/messages \
}'
```

```python Python nocheck
```python Python nocheck hidelines={1..2}
import anthropic

client = anthropic.Anthropic()
Expand All @@ -91,7 +91,7 @@ response = client.beta.messages.create(
)
```

```typescript TypeScript nocheck hidelines={1..4}
```typescript TypeScript nocheck hidelines={1..2}
import Anthropic from "@anthropic-ai/sdk";

const anthropic = new Anthropic();
Expand Down Expand Up @@ -166,7 +166,7 @@ class Program
}
```

```go Go nocheck hidelines={1..13,-5..-1}
```go Go nocheck hidelines={1..11,-1}
package main

import (
Expand Down Expand Up @@ -209,7 +209,7 @@ func main() {
}
```

```java Java nocheck hidelines={1..9,-1}
```java Java nocheck hidelines={1..2,4,6..9,-2..}
import com.anthropic.client.AnthropicClient;
import com.anthropic.client.okhttp.AnthropicOkHttpClient;
import com.anthropic.models.beta.messages.BetaMcpToolset;
Expand Down Expand Up @@ -242,7 +242,7 @@ public class Main {
}
```

```php PHP nocheck
```php PHP nocheck hidelines={1..4}
<?php

use Anthropic\Client;
Expand Down Expand Up @@ -275,7 +275,7 @@ $message = $client->beta->messages->create(
echo $message;
```

```ruby Ruby nocheck
```ruby Ruby nocheck hidelines={1..2}
require "anthropic"

client = Anthropic::Client.new
Expand Down
Loading
Loading