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

[Bug]: Support for anthropic stopped to work #2850

Open
mattiashallberg opened this issue Jun 3, 2024 · 2 comments
Open

[Bug]: Support for anthropic stopped to work #2850

mattiashallberg opened this issue Jun 3, 2024 · 2 comments
Labels
0.2 Issues which were filed before re-arch to 0.4 needs-triage

Comments

@mattiashallberg
Copy link

Describe the bug

I have followed your instructions on your website for how to use Anthropic's API with Autogen (https://microsoft.github.io/autogen/docs/topics/non-openai-models/cloud-anthropic), but it does not work as expected, even with your notebook.

It seems you have closed a ticket for this before (2164), so I assume that it worked in the past. I understand that the Anthropic API has evolved, but even after setting the version ("anthropic==0.23.1"), I get error "AttributeError: 'Anthropic' object has no attribute 'beta'".

Steps to reproduce

Run the notebook from the page https://microsoft.github.io/autogen/docs/topics/non-openai-models/cloud-anthropic.

Model Used

"claude-3-sonnet-20240229"

Expected Behavior

No response

Screenshots and logs

No response

Additional Information

No response

@AdrianRibao
Copy link

I just found this bug too

@rysweet rysweet added 0.2 Issues which were filed before re-arch to 0.4 needs-triage labels Oct 2, 2024
@fniedtner fniedtner removed the bug label Oct 24, 2024
@Tisha-linkenite
Copy link

Tisha-linkenite commented Nov 5, 2024

Having the same Error.

I am following the documentation for Anthropic PDF support API https://docs.anthropic.com/en/docs/build-with-claude/pdf-support#how-to-use-pdfs-in-the-messages-api.

The code is as follows :
import anthropic import base64 import httpx

First fetch the file

pdf_url = "https://assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf" pdf_data = base64.standard_b64encode(httpx.get(pdf_url).content).decode("utf-8")

Finally send the API request

`client = anthropic.Anthropic()
message = client.beta.messages.create(
model="claude-3-5-sonnet-20241022",
betas=["pdfs-2024-09-25"],
max_tokens=1024,
messages=[
{
"role": "user",
"content": [
{
"type": "document",
"source": {
"type": "base64",
"media_type": "application/pdf",
"data": pdf_data
}
},
{
"type": "text",
"text": "Which model has the highest human preference win rates across each use-case?"
}
]
}
],
)

print(message.content)
`

Error : AttributeError: 'Anthropic' object has no attribute 'beta'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.2 Issues which were filed before re-arch to 0.4 needs-triage
Projects
None yet
Development

No branches or pull requests

5 participants