[Bug]Perplexity AI的API Key使用报错 #1759
jbswbs posted onGitHub
💻 系统环境
Windows
📦 部署环境
Docker
🌐 浏览器
Chrome
🐛 问题描述
检查通过,但使用回复乱码
🚦 期望结果
No response
📷 复现步骤
No response
📝 补充信息
No response
Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑🤝🧑👫🧑🏿🤝🧑🏻👩🏾🤝👨🏿👬🏿
💻 System environment
Windows
📦 Deployment environment
Docker
🌐 Browser
Chrome
🐛 Problem description
The check passes, but the response is garbled.
🚦 Expected results
No response
📷 Steps to reproduce
No response
📝 Supplementary information
No response
👀 @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。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。
Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑🤝🧑👫🧑🏿🤝🧑🏻👩🏾🤝👨🏿👬🏿
same question https://github.com/lobehub/lobe-chat/issues/1780
I have the same environment (Docker and Chrome) and I'm having the same issue. Lobe Chat [v0.147.0]
通过代码调用是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))
同样提示词:
<img width="837" alt="image" src="https://github.com/lobehub/lobe-chat/assets/4414032/702115e2-fce7-4845-8c2e-bd9ae446315e">
✅ @jbswbs
This issue is closed, If you have any questions, you can comment and reply.
此问题已经关闭。如果您有任何问题,可以留言并回复。
:tada: This issue has been resolved in version 0.156.0 :tada:
The release is available on:
Your semantic-release bot :package::rocket: