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]Perplexity AI的API Key使用报错 #1759

Closed
jbswbs opened this issue Mar 27, 2024 · 8 comments · Fixed by #2439
Closed

[Bug]Perplexity AI的API Key使用报错 #1759

jbswbs opened this issue Mar 27, 2024 · 8 comments · Fixed by #2439
Labels
🐛 Bug Something isn't working | 缺陷 released

Comments

@jbswbs
Copy link

jbswbs commented Mar 27, 2024

💻 系统环境

Windows

📦 部署环境

Docker

🌐 浏览器

Chrome

🐛 问题描述

2024-03-27_163814
2024-03-27_163919
检查通过,但使用回复乱码

🚦 期望结果

No response

📷 复现步骤

No response

📝 补充信息

No response

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

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


💻 System environment

Windows

📦 Deployment environment

Docker

🌐 Browser

Chrome

🐛 Problem description

2024-03-27_163814
2024-03-27_163919
The check passes, but the response is garbled.

🚦 Expected results

No response

📷 Steps to reproduce

No response

📝 Supplementary information

No response

@lobehubbot
Copy link
Member

👀 @jbswbs

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。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。

@limboinf
Copy link

同样的问题
#1780

@lobehubbot
Copy link
Member

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


same question
#1780

@jerome-massey
Copy link

I have the same environment (Docker and Chrome) and I'm having the same issue. Lobe Chat [v0.147.0]

Screenshot 2024-04-10 235555

@limboinf
Copy link

通过代码调用是OK的,但是lobehub 就出现问题了。sonar-small-online、sonar-medium-online 模型都试了。

from openai import OpenAI

messages = [
    {
        "role": "user",
        "content": (
            "美国降息最新消息"
        ),
    },
]

client = OpenAI(api_key=YOUR_API_KEY, base_url="https://api.perplexity.ai")

response = client.chat.completions.create(
    model="sonar-small-online",
    messages=messages,
)
print(response)

python demo.py

输出:

ChatCompletion(id='806bb765-c593-4969-9375-07dcc5aab01e', choices=[Choice(finish_reason='stop', index=0, logprobs=None, message=ChatCompletionMessage(content='美联储最新消息是在北京时间4月11日凌晨2点发布的,其中显示了美联储官员对美国经济、金融状况以及对货币政策路径的研判,释放了美联储降息、放慢量化紧缩的最新信号。大多数美联储官员认为,政策利率可能处于本轮紧缩周期的峰值,几乎所有联储官员认为,若经济总体发展符合他们的预期,将适合今年某个时候降息。美联储官员上月还讨论了结束缩减资产负债表的可能性。', role='assistant', function_call=None, tool_calls=None), delta={'role': 'assistant', 'content': ''})], created=7292468, model='sonar-small-online', object='chat.completion', system_fingerprint=None, usage=CompletionUsage(completion_tokens=194, prompt_tokens=37, total_tokens=231))

同样提示词:

image

@lobehubbot
Copy link
Member

@jbswbs

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

@lobehubbot
Copy link
Member

🎉 This issue has been resolved in version 0.156.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging a pull request may close this issue.

4 participants