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] Claude API 调用报错(use error) #3054

Closed
EEE1even opened this issue Jun 27, 2024 · 13 comments · Fixed by #3359
Closed

[Bug] Claude API 调用报错(use error) #3054

EEE1even opened this issue Jun 27, 2024 · 13 comments · Fixed by #3359
Labels
🐛 Bug Something isn't working | 缺陷

Comments

@EEE1even
Copy link

📦 Environment

Docker

📌 Version

latest

💻 Operating System

Ubuntu

🌐 Browser

Chrome

🐛 Bug Description

我在尝试使用Claude API时报错,并且不显示报错代码
我已经开启了使用客户端请求模式,并且可以正常访问Openai API服务,所以可以排除网络连接问题
排查发现在pycharm上可以正常调用API进行输出,但是lobe-chat上不行
下面是报错代码:

{
  "error": {
    "cause": {}
  },
  "endpoint": "https://api.anthropic.com",
  "provider": "anthropic"
}

可以看到并没有错误代码反馈,我目前无法解决这个问题


I got an error trying to use the Claude API, and it doesn't show the error code,
I've enabled the use of client request mode and I can access the Openai API service normally,so you can rule out internet connection problems
I checked and found that I can call the API on pycharm and output it normally, but not on lobe-chat.
Here is the error code:

{
  "error": {
    "cause": {}
  },
  "endpoint": "https://api.anthropic.com",
  "provider": "anthropic"
}

As you can see there is no error code feedback, I can't fix this bug at the moment

📷 Recurrence Steps

No response

🚦 Expected Behavior

No response

📝 Additional Information

No response

@EEE1even EEE1even added the 🐛 Bug Something isn't working | 缺陷 label Jun 27, 2024
@lobehubbot
Copy link
Member

👀 @EEE1even

Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible.
Please make sure you have given us as much context as possible.
非常感谢您提交 issue。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。

@EEE1even EEE1even changed the title [Bug] Claude API 调用报错(use) [Bug] Claude API 调用报错(use error) Jun 27, 2024
@arvinxx
Copy link
Contributor

arvinxx commented Jun 27, 2024

服务端请求可以吗

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Is it possible to request from the server?

@EEE1even
Copy link
Author

服务端请求可以吗

你是指通过url请求服务吗?

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Is it possible to request from the server?

Do you mean requesting service through url?

@EEE1even
Copy link
Author

服务端请求可以吗

我能通过下述形式进行请求

import anthropic
import os

os.environ["http_proxy"] = "http://localhost:7890"
os.environ["https_proxy"] = "http://localhost:7890"

client = anthropic.Anthropic(
    api_key="my key"
)

message = client.messages.create(
    model="claude-3-5-sonnet-20240620",
    max_tokens=1000,
    temperature=0,
    system="",
    messages=[
        {
            "role": "user",
            "content": [
                {
                    "type": "text",
                    "text": "你是谁"
                }
            ]
        }
    ]
)
print(message.content)
```python

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Is it possible to request from the server?

I can make a request via the following form

import anthropopic
import os

os.environ["http_proxy"] = "http://localhost:7890"
os.environ["https_proxy"] = "http://localhost:7890"

client = anthropic.Anthropic(
    api_key="my key"
)

message = client.messages.create(
    model="claude-3-5-sonnet-20240620",
    max_tokens=1000,
    temperature=0,
    system="",
    messages=[
        {
            "role": "user",
            "content": [
                {
                    "type": "text",
                    "text": "Who are you"
                }
            ]
        }
    ]
)
print(message.content)
```python  
      

@BrandonStudio
Copy link
Contributor

Claude应该不支持客户端请求,他们好像没有计划响应预检请求

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Claude should not support client requests, they don't seem to have plans to respond to preflight requests

@dalefengs
Copy link

dalefengs commented Jul 8, 2024

image

我也遇到了,使用客户端请求和服务端请求都会出现该错误,只要回复内容长,就必定发生错误

@BrandonStudio
Copy link
Contributor

@dalefengs 你这个和他也不是一个问题啊,他说的是 Anthropic Provider,你用的不是 OpenAI Provider 吗

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


@dalefengs You have no problem with him. He is talking about Anthropic Provider. Are you not using OpenAI Provider?

@lobehubbot
Copy link
Member

@EEE1even

This issue is closed, If you have any questions, you can comment and reply.
此问题已经关闭。如果您有任何问题,可以留言并回复。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Something isn't working | 缺陷
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

5 participants