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

添加对Grok-2的支持 #2428

Open
1 task done
sr880828 opened this issue Dec 18, 2024 · 1 comment
Open
1 task done

添加对Grok-2的支持 #2428

sr880828 opened this issue Dec 18, 2024 · 1 comment

Comments

@sr880828
Copy link

⚠️ 搜索是否存在类似issue

  • 我已经搜索过issues和disscussions,没有发现相似issue

总结

自己定义了Grok-2-1212的配置信息和部分文件修改,但是还是无法正常使用图片创作,在bot对话中encoding的编码一直不正常导致一直在报警告,但是不影响使用

举例

[WARNING][2024-12-18 09:11:43][session_manager.py:72] - Exception when counting tokens precisely for prompt: Unknown encoding grok-2-1212

[INFO][2024-12-18 09:08:49][bridge.py:68] - create bot openAI for chat
[INFO][2024-12-18 09:08:49][open_ai_image.py:22] - [OPEN_AI] image_query=一只小鸟带着圣诞帽子在天上翱翔
[ERROR][2024-12-18 09:08:49][open_ai_image.py:43] - 'str' object has no attribute 'get'
Traceback (most recent call last):
File "/opt/chatgpt-on-wechat/bot/openai/open_ai_image.py", line 23, in create_img
response = openai.Image.create(
File "/usr/local/lib/python3.10/dist-packages/openai/api_resources/image.py", line 39, in create
response, _, api_key = requestor.request(
File "/usr/local/lib/python3.10/dist-packages/openai/api_requestor.py", line 298, in request
resp, got_stream = self._interpret_response(result, stream)
File "/usr/local/lib/python3.10/dist-packages/openai/api_requestor.py", line 700, in _interpret_response
self._interpret_response_line(
File "/usr/local/lib/python3.10/dist-packages/openai/api_requestor.py", line 763, in _interpret_response_line
raise self.handle_error_response(
File "/usr/local/lib/python3.10/dist-packages/openai/api_requestor.py", line 418, in handle_error_response
error_code=error_data.get("code"),
AttributeError: 'str' object has no attribute 'get'

config.json
"open_ai_api_base": "https://api.x.ai/v1",
"model": "grok-2-1212",
"bot_type": "openAI"
"conversation_max_tokens": 131000,

动机

Grok-2-1212的模型是业界内比较靠前的,对中文的支持也不错。
x.ai提供的模型画图也不错,最大tokey支持131072,而且费用也不高

@6vision
Copy link
Collaborator

6vision commented Dec 23, 2024

"bot_type": "chatGPT" 改一下试试

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants