anthropics / anthropics/claude-quickstarts
Error using anthropic.Anthropic(base_url)
- Ngôn ngữ chính
- TypeScript
- Star
- 17.6k
- Fork
- 3k
- Merge trung bình
- 5 giờ 13 phút
- Pull request đã merge (30 ngày)
- 3
Mô tả
**After installing docker with the command below:**
`docker run -e ANTHROPIC_BASE_URL=http://localhost:8080 -e ANTHROPIC_API_KEY=MY_KEY -v %userprofile%/.anthropic:/home/computeruse/.anthropic -p 5900:5900 -p 8501:8501 -p 6080:6080 -p 8080:8080 -it ghcr.io/anthropics/anthropic-quickstarts:computer-use-demo-latest`
**And try to run the python script below:**
```
import anthropic
from anthropic import APIConnectionError, APIStatusError
import requests
client = anthropic.Anthropic(api_key="MY_KEY_API",
base_url="http://localhost:8080"
)
try:
response = client.beta.messages.create(
model="claude-3-5-sonnet-20241022",
max_tokens=1024,
tools=[
{
"type": "computer_20241022",
"name": "computer",
"display_width_px": 1024,
"display_height_px": 768,
"display_number": 1,
}
],
messages=[
{"role": "user", "content": "Tire um print da tela."},
{"role": "user", "content": "Salve o print em /home/computeruse/screenshot.png"}
],
betas=["computer-use-2024-10-22"],
)
print("Resposta do servidor:", response)
except requests.exceptions.ConnectionError:
print("Erro: Não foi possível conectar ao servidor local. Verifique se o Docker está rodando.")
except APIConnectionError as e:
print("O servidor não pôde ser alcançado")
print(e.__cause__)
except APIStatusError as e:
print("Erro de status recebido")
print(e.status_code)
print(e.response)
```
**I get the following error when running the python script:**
```
Erro:
Error response
Error response
Error code: 501
Message: Unsupported method ('POST').
Error code explanation: 501 - Server does not support this operation.
```
**Note:
I can access it successfully in the browser**

### Anyone successfully using calling the docker framework via "base_url" successfully?
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Đánh giá
Issue này chưa được đánh giá.