Skip to content
7 changes: 4 additions & 3 deletions integrations/llms/anthropic.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const response = await portkey.chat.completions.create({
console.log(response.choices[0].message.content)
```

```python OpenAI Py icon="openai"
```python OpenAI Py icon="python"
from openai import OpenAI
from portkey_ai import PORTKEY_GATEWAY_URL

Expand All @@ -85,7 +85,7 @@ response = client.chat.completions.create(
print(response.choices[0].message.content)
```

```js OpenAI JS icon="openai"
```js OpenAI JS icon="square-js"
import OpenAI from "openai"
import { PORTKEY_GATEWAY_URL } from "portkey-ai"

Expand Down Expand Up @@ -412,6 +412,7 @@ const portkey = new Portkey({
const pdfUrl = "https://assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf"
const pdfResponse = await axios.get(pdfUrl, { responseType: 'arraybuffer' })
const pdfBase64 = Buffer.from(pdfResponse.data).toString('base64')
const pdfData = `data:application/pdf;base64,${pdfBase64}`

const response = await portkey.chat.completions.create({
model: "@anthropic/claude-sonnet-4-5-20250929",
Expand All @@ -422,7 +423,7 @@ const response = await portkey.chat.completions.create({
role: "user",
content: [
{ type: "text", text: "What are the key findings in this document?" },
{ type: "file", file: { mime_type: "application/pdf", file_data: pdfBase64 } }
{ type: "file", file: { mime_type: "application/pdf", file_data: pdfData } }
]
}
]
Expand Down
Loading