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]: 使用第三方汇聚API时,出现不兼容Claude的情况。 #1176

Open
2 tasks done
crosswk opened this issue Dec 5, 2024 · 1 comment
Open
2 tasks done
Labels
bug Something isn't working

Comments

@crosswk
Copy link

crosswk commented Dec 5, 2024

这个bug是否已存在现有issue了?

  • 我确认没有已有issue,且已阅读常见问题

错误表现

使用GPT模型没有问题,使用Claude相关模型会有报错。
已经使用12.04号更新的版本依然会有报错。

复现操作

实现了两个厂商的汇聚API,对于Claude模型都有报错。
测试Chat-Next和Lobe没有报错。
麻烦有空可以看下。

我设置的两个厂商是:"openai_api_base": "https://api.xiaoai.plus/v1",和"openai_api_base": "https://s.lconai.com/v1",

错误日志

2024-12-05 01:28:46,180 [INFO] [base_model.py:615] 用户的输入为:output"test"
Traceback (most recent call last):
  File "/chu/Dev-ChuanhuChatGPT/ChuanhuChatGPT/modules/models/OpenAIVision.py", line 244, in _decode_chat_response
    if chunk_length > 6 and "delta" in chunk["choices"][0]:
IndexError: list index out of range
ERROR: {'id': '', 'object': 'chat.completion.chunk', 'created': 1733362128, 'model': 'claude-3-5-sonnet-20240620', 'system_fingerprint': '', 'choices': [], 'usage': {'prompt_tokens': 21, 'completion_tokens': 0, 'total_tokens': 21, 'prompt_tokens_details': {'cached_tokens': 0, 'text_tokens': 0, 'audio_tokens': 0, 'image_tokens': 0}, 'completion_tokens_details': {'text_tokens': 0, 'audio_tokens': 0}}}
Traceback (most recent call last):
  File "/chu/Dev-ChuanhuChatGPT/ChuanhuChatGPT/modules/models/OpenAIVision.py", line 244, in _decode_chat_response
    if chunk_length > 6 and "delta" in chunk["choices"][0]:
IndexError: list index out of range
ERROR: {'id': '', 'object': 'chat.completion.chunk', 'created': 1733362128, 'model': 'claude-3-5-sonnet-20240620', 'system_fingerprint': '', 'choices': [], 'usage': {'prompt_tokens': 21, 'completion_tokens': 0, 'total_tokens': 21, 'prompt_tokens_details': {'cached_tokens': 0, 'text_tokens': 0, 'audio_tokens': 0, 'image_tokens': 0}, 'completion_tokens_details': {'text_tokens': 0, 'audio_tokens': 0}}}
JSON解析错误,收到的内容: data: [DONE]
2024-12-05 01:28:50,696 [INFO] [base_model.py:703] 回答为:
2024-12-05 01:28:50,696 [INFO] [base_model.py:709] Tokens per second:4.882235892234999

运行环境

  • OS:
  • Browser:
  • Gradio version:
  • Python version:

帮助解决

  • 我愿意协助解决!

补充说明

image

@crosswk crosswk added the bug Something isn't working label Dec 5, 2024
@crosswk
Copy link
Author

crosswk commented Dec 5, 2024

还有另外一个报错,和Bug1169好像是一样的。

2024-12-05 01:22:39,715 [INFO] [base_model.py:612] 用户的输入为:output "test"
Traceback (most recent call last):
File "/chu/Dev-ChuanhuChatGPT/Prive-ChuanhuChatGPT-Dev/modules/models/OpenAIVision.py", line 250, in _decode_chat_response
finish_reason = chunk["finish_details"]
KeyError: 'finish_details'
ERROR: {'id': 'chatcmpl-luqhKNsLen3OwAZ6pYJseOL0ekQKh', 'object': 'chat.completion.chunk', 'created': 1733361763, 'model': 'claude-3-5-sonnet-20240620', 'choices': [{'index': 0, 'delta': {'content': 'Here'}}]}
Traceback (most recent call last):
File "/chu/Dev-ChuanhuChatGPT/Prive-ChuanhuChatGPT-Dev/modules/models/OpenAIVision.py", line 250, in _decode_chat_response
finish_reason = chunk["finish_details"]
KeyError: 'finish_details'
ERROR: {'id': 'chatcmpl-luqhKNsLen3OwAZ6pYJseOL0ekQKh', 'object': 'chat.completion.chunk', 'created': 1733361763, 'model': 'claude-3-5-sonnet-20240620', 'choices': [{'index': 0, 'delta': {'content': ''s a simple way to output "test"'}}]}
Traceback (most recent call last):
File "/chu/Dev-ChuanhuChatGPT/Prive-ChuanhuChatGPT-Dev/modules/models/OpenAIVision.py", line 250, in _decode_chat_response
finish_reason = chunk["finish_details"]
KeyError: 'finish_details'
ERROR: {'id': 'chatcmpl-luqhKNsLen3OwAZ6pYJseOL0ekQKh', 'object': 'chat.completion.chunk', 'created': 1733361763, 'model': 'claude-3-5-sonnet-20240620', 'choices': [{'index': 0, 'delta': {'content': ' in a few common programming languages:\n\npython\nprint("test'}}]} Traceback (most recent call last): File "/chu/Dev-ChuanhuChatGPT/Prive-ChuanhuChatGPT-Dev/modules/models/OpenAIVision.py", line 250, in _decode_chat_response finish_reason = chunk["finish_details"] KeyError: 'finish_details' ERROR: {'id': 'chatcmpl-luqhKNsLen3OwAZ6pYJseOL0ekQKh', 'object': 'chat.completion.chunk', 'created': 1733361763, 'model': 'claude-3-5-sonnet-20240620', 'choices': [{'index': 0, 'delta': {'content': '")\n\n\njavascript\nconsole.log'}}]} Traceback (most recent call last): File "/chu/Dev-ChuanhuChatGPT/Prive-ChuanhuChatGPT-Dev/modules/models/OpenAIVision.py", line 250, in _decode_chat_response finish_reason = chunk["finish_details"] KeyError: 'finish_details' ERROR: {'id': 'chatcmpl-luqhKNsLen3OwAZ6pYJseOL0ekQKh', 'object': 'chat.completion.chunk', 'created': 1733361763, 'model': 'claude-3-5-sonnet-20240620', 'choices': [{'index': 0, 'delta': {'content': '("test");\n\n\njava\nSystem'}}]} Traceback (most recent call last): File "/chu/Dev-ChuanhuChatGPT/Prive-ChuanhuChatGPT-Dev/modules/models/OpenAIVision.py", line 250, in _decode_chat_response finish_reason = chunk["finish_details"] KeyError: 'finish_details' ERROR: {'id': 'chatcmpl-luqhKNsLen3OwAZ6pYJseOL0ekQKh', 'object': 'chat.completion.chunk', 'created': 1733361763, 'model': 'claude-3-5-sonnet-20240620', 'choices': [{'index': 0, 'delta': {'content': '.out.println("test");\n\n\nChoose'}}]}
Traceback (most recent call last):
File "/chu/Dev-ChuanhuChatGPT/Prive-ChuanhuChatGPT-Dev/modules/models/OpenAIVision.py", line 250, in _decode_chat_response
finish_reason = chunk["finish_details"]
KeyError: 'finish_details'
ERROR: {'id': 'chatcmpl-luqhKNsLen3OwAZ6pYJseOL0ekQKh', 'object': 'chat.completion.chunk', 'created': 1733361763, 'model': 'claude-3-5-sonnet-20240620', 'choices': [{'index': 0, 'delta': {'content': ' the language that best fits your needs! Let me know if you'}}]}
Traceback (most recent call last):
File "/chu/Dev-ChuanhuChatGPT/Prive-ChuanhuChatGPT-Dev/modules/models/OpenAIVision.py", line 250, in _decode_chat_response
finish_reason = chunk["finish_details"]
KeyError: 'finish_details'
ERROR: {'id': 'chatcmpl-luqhKNsLen3OwAZ6pYJseOL0ekQKh', 'object': 'chat.completion.chunk', 'created': 1733361763, 'model': 'claude-3-5-sonnet-20240620', 'choices': [{'index': 0, 'delta': {'content': "'d like to see examples in any other programming languages."}}]}
JSON解析错误,收到的内容: data: [DONE]

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
None yet
Development

No branches or pull requests

1 participant