Replies: 1 comment 2 replies
-
不同的模型返回的格式不同,因此并不通用。第三方OpenAI的代理会返回和OpenAI一致的格式,因此可以。 如果其他模型需要其他代理地址,会需要进一步修改代码…… |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
目前我测试OpenAI可以使用代理接口,例如修改配置文件"openai_api_base": "https://aihubmix.com/v1" 即可。
但是使用Claude似乎无法修改代理url。我看这个聚合API是依据OpenAI写的,所以我在ChuanhuChatGPT/modules/presets.py文件修改模型名称
ONLINE_MODELS = [
"claude-3",
MODEL_METADATA = {
"claude-3": {
"model_name": "claude-3-sonnet-20240229",
"token_limit": 200000,
修改ChuanhuChatGPT/modules/models,将Claude3修改为使用OpenAi模型
elif "claude-3" in model_name_lower:
model_type = ModelType.OpenAI
#elif "claude" in model_name_lower:
# model_type = ModelType.Claude
问题是,在前端聊天时,无法正常获取对话内容。后端有报错。
2024-04-24 11:56:18,050 [INFO] [base_model.py:613] 用户的输入为:print test
ERROR: {'id': 'chatcmpl-fd5a7ea4-4f72-42eb-9a4f-71b086635fcb', 'choices': [{'index': 0, 'delta': {'content': '', 'role': 'assistant'}}], 'created': 1713930980, 'model': 'claude-3-sonnet@20240229', 'object': 'chat.completion.chunk', 'usage': {'prompt_tokens': 9, 'completion_tokens': 1, 'total_tokens': 10}}
ERROR: {'id': 'chatcmpl-fd5a7ea4-4f72-42eb-9a4f-71b086635fcb', 'choices': [{'index': 0, 'delta': {'content': 'I'}}], 'created': 1713930980, 'model': 'claude-3-sonnet@20240229', 'object': 'chat.completion.chunk', 'usage': {}}
ERROR: {'id': 'chatcmpl-fd5a7ea4-4f72-42eb-9a4f-71b086635fcb', 'choices': [{'index': 0, 'delta': {'content': ' don'}}], 'created': 1713930980, 'model': 'claude-3-sonnet@20240229', 'object': 'chat.completion.chunk', 'usage': {}}
ERROR: {'id': 'chatcmpl-fd5a7ea4-4f72-42eb-9a4f-71b086635fcb', 'choices': [{'index': 0, 'delta': {'content': "'t"}}], 'created': 1713930980, 'model': 'claude-3-sonnet@20240229', 'object': 'chat.completion.chunk', 'usage': {}}
ERROR: {'id': 'chatcmpl-fd5a7ea4-4f72-42eb-9a4f-71b086635fcb', 'choices': [{'index': 0, 'delta': {'content': ' actually'}}], 'created': 1713930980, 'model': 'claude-3-sonnet@20240229', 'object': 'chat.completion.chunk', 'usage': {}}
ERROR: {'id': 'chatcmpl-fd5a7ea4-4f72-42eb-9a4f-71b086635fcb', 'choices': [{'index': 0, 'delta': {'content': ' have'}}], 'created': 1713930980, 'model': 'claude-3-sonnet@20240229', 'object': 'chat.completion.chunk', 'usage': {}}
ERROR: {'id': 'chatcmpl-fd5a7ea4-4f72-42eb-9a4f-71b086635fcb', 'choices': [{'index': 0, 'delta': {'content': ' the'}}], 'created': 1713930980, 'model': 'claude-3-sonnet@20240229', 'object': 'chat.completion.chunk', 'usage': {}}
ERROR: {'id': 'chatcmpl-fd5a7ea4-4f72-42eb-9a4f-71b086635fcb', 'choices': [{'index': 0, 'delta': {'content': ' capability'}}], 'created': 1713930980, 'model': 'claude-3-sonnet@20240229', 'object': 'chat.completion.chunk', 'usage': {}}
ERROR: {'id': 'chatcmpl-fd5a7ea4-4f72-42eb-9a4f-71b086635fcb', 'choices': [{'index': 0, 'delta': {'content': ' to'}}], 'created': 1713930980, 'model': 'claude-3-sonnet@20240229', 'object': 'chat.completion.chunk', 'usage': {}}
ERROR: {'id': 'chatcmpl-fd5a7ea4-4f72-42eb-9a4f-71b086635fcb', 'choices': [{'index': 0, 'delta': {'content': ' print'}}], 'created': 1713930980, 'model': 'claude-3-sonnet@20240229', 'object': 'chat.completion.chunk', 'usage': {}}
ERROR: {'id': 'chatcmpl-fd5a7ea4-4f72-42eb-9a4f-71b086635fcb', 'choices': [{'index': 0, 'delta': {'content': ' text'}}], 'created': 1713930980, 'model': 'claude-3-sonnet@20240229', 'object': 'chat.completion.chunk', 'usage': {}}
ERROR: {'id': 'chatcmpl-fd5a7ea4-4f72-42eb-9a4f-71b086635fcb', 'choices': [{'index': 0, 'delta': {'content': '.'}}], 'created': 1713930980, 'model': 'claude-3-sonnet@20240229', 'object': 'chat.completion.chunk', 'usage': {}}
ERROR: {'id': 'chatcmpl-fd5a7ea4-4f72-42eb-9a4f-71b086635fcb', 'choices': [{'index': 0, 'delta': {'content': ' I'}}], 'created': 1713930980, 'model': 'claude-3-sonnet@20240229', 'object': 'chat.completion.chunk', 'usage': {}}
ERROR: {'id': 'chatcmpl-fd5a7ea4-4f72-42eb-9a4f-71b086635fcb', 'choices': [{'index': 0, 'delta': {'content': "'m"}}], 'created': 1713930980, 'model': 'claude-3-sonnet@20240229', 'object': 'chat.completion.chunk', 'usage': {}}
ERROR: {'id': 'chatcmpl-fd5a7ea4-4f72-42eb-9a4f-71b086635fcb', 'choices': [{'index': 0, 'delta': {'content': ' Claude'}}], 'created': 1713930980, 'model': 'claude-3-sonnet@20240229', 'object': 'chat.completion.chunk', 'usage': {}}
ERROR: {'id': 'chatcmpl-fd5a7ea4-4f72-42eb-9a4f-71b086635fcb', 'choices': [{'index': 0, 'delta': {'content': ','}}], 'created': 1713930980, 'model': 'claude-3-sonnet@20240229', 'object': 'chat.completion.chunk', 'usage': {}}
ERROR: {'id': 'chatcmpl-fd5a7ea4-4f72-42eb-9a4f-71b086635fcb', 'choices': [{'index': 0, 'delta': {'content': ' an'}}], 'created': 1713930980, 'model': 'claude-3-sonnet@20240229', 'object': 'chat.completion.chunk', 'usage': {}}
ERROR: {'id': 'chatcmpl-fd5a7ea4-4f72-42eb-9a4f-71b086635fcb', 'choices': [{'index': 0, 'delta': {'content': ' AI'}}], 'created': 1713930980, 'model': 'claude-3-sonnet@20240229', 'object': 'chat.completion.chunk', 'usage': {}}
ERROR: {'id': 'chatcmpl-fd5a7ea4-4f72-42eb-9a4f-71b086635fcb', 'choices': [{'index': 0, 'delta': {'content': ' assistant'}}], 'created': 1713930980, 'model': 'claude-3-sonnet@20240229', 'object': 'chat.completion.chunk', 'usage': {}}
ERROR: {'id': 'chatcmpl-fd5a7ea4-4f72-42eb-9a4f-71b086635fcb', 'choices': [{'index': 0, 'delta': {'content': ' created'}}], 'created': 1713930980, 'model': 'claude-3-sonnet@20240229', 'object': 'chat.completion.chunk', 'usage': {}}
ERROR: {'id': 'chatcmpl-fd5a7ea4-4f72-42eb-9a4f-71b086635fcb', 'choices': [{'index': 0, 'delta': {'content': ' by'}}], 'created': 1713930980, 'model': 'claude-3-sonnet@20240229', 'object': 'chat.completion.chunk', 'usage': {}}
ERROR: {'id': 'chatcmpl-fd5a7ea4-4f72-42eb-9a4f-71b086635fcb', 'choices': [{'index': 0, 'delta': {'content': ' Anthrop'}}], 'created': 1713930980, 'model': 'claude-3-sonnet@20240229', 'object': 'chat.completion.chunk', 'usage': {}}
ERROR: {'id': 'chatcmpl-fd5a7ea4-4f72-42eb-9a4f-71b086635fcb', 'choices': [{'index': 0, 'delta': {'content': 'ic'}}], 'created': 1713930980, 'model': 'claude-3-sonnet@20240229', 'object': 'chat.completion.chunk', 'usage': {}}
ERROR: {'id': 'chatcmpl-fd5a7ea4-4f72-42eb-9a4f-71b086635fcb', 'choices': [{'index': 0, 'delta': {'content': ' to'}}], 'created': 1713930980, 'model': 'claude-3-sonnet@20240229', 'object': 'chat.completion.chunk', 'usage': {}}
ERROR: {'id': 'chatcmpl-fd5a7ea4-4f72-42eb-9a4f-71b086635fcb', 'choices': [{'index': 0, 'delta': {'content': ' be'}}], 'created': 1713930980, 'model': 'claude-3-sonnet@20240229', 'object': 'chat.completion.chunk', 'usage': {}}
ERROR: {'id': 'chatcmpl-fd5a7ea4-4f72-42eb-9a4f-71b086635fcb', 'choices': [{'index': 0, 'delta': {'content': ' helpful'}}], 'created': 1713930980, 'model': 'claude-3-sonnet@20240229', 'object': 'chat.completion.chunk', 'usage': {}}
ERROR: {'id': 'chatcmpl-fd5a7ea4-4f72-42eb-9a4f-71b086635fcb', 'choices': [{'index': 0, 'delta': {'content': ','}}], 'created': 1713930980, 'model': 'claude-3-sonnet@20240229', 'object': 'chat.completion.chunk', 'usage': {}}
ERROR: {'id': 'chatcmpl-fd5a7ea4-4f72-42eb-9a4f-71b086635fcb', 'choices': [{'index': 0, 'delta': {'content': ' harm'}}], 'created': 1713930980, 'model': 'claude-3-sonnet@20240229', 'object': 'chat.completion.chunk', 'usage': {}}
ERROR: {'id': 'chatcmpl-fd5a7ea4-4f72-42eb-9a4f-71b086635fcb', 'choices': [{'index': 0, 'delta': {'content': 'less'}}], 'created': 1713930981, 'model': 'claude-3-sonnet@20240229', 'object': 'chat.completion.chunk', 'usage': {}}
ERROR: {'id': 'chatcmpl-fd5a7ea4-4f72-42eb-9a4f-71b086635fcb', 'choices': [{'index': 0, 'delta': {'content': ','}}], 'created': 1713930981, 'model': 'claude-3-sonnet@20240229', 'object': 'chat.completion.chunk', 'usage': {}}
ERROR: {'id': 'chatcmpl-fd5a7ea4-4f72-42eb-9a4f-71b086635fcb', 'choices': [{'index': 0, 'delta': {'content': ' and'}}], 'created': 1713930981, 'model': 'claude-3-sonnet@20240229', 'object': 'chat.completion.chunk', 'usage': {}}
ERROR: {'id': 'chatcmpl-fd5a7ea4-4f72-42eb-9a4f-71b086635fcb', 'choices': [{'index': 0, 'delta': {'content': ' honest'}}], 'created': 1713930981, 'model': 'claude-3-sonnet@20240229', 'object': 'chat.completion.chunk', 'usage': {}}
ERROR: {'id': 'chatcmpl-fd5a7ea4-4f72-42eb-9a4f-71b086635fcb', 'choices': [{'index': 0, 'delta': {'content': '.'}}], 'created': 1713930981, 'model': 'claude-3-sonnet@20240229', 'object': 'chat.completion.chunk', 'usage': {}}
Beta Was this translation helpful? Give feedback.
All reactions