You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if name == 'main':
spark = ChatSparkLLM(
spark_api_url=SPARKAI_URL,
spark_app_id=SPARKAI_APP_ID,
spark_api_key=SPARKAI_API_KEY,
spark_api_secret=SPARKAI_API_SECRET,
spark_llm_domain=SPARKAI_DOMAIN,
streaming=False,
)
messages = [ChatMessage(
role="user",
content='你好呀'
)]
handler = ChunkPrintHandler()
a = spark.generate([messages], callbacks=[handler])
print(a)
报错信息:
TypeError: issubclass() arg 1 must be a class
ERROR conda.cli.main_run:execute(124): conda run python /mnt/e/PycharmProjects/ToolBench/toolbench/inference/LLM/spark_websocket.py failed. (See above for error)
The text was updated successfully, but these errors were encountered:
可能是websocket的版本不对?
此项目的.toml配置文件指出,可支持1.7.0向上兼容(主版本1.X都可以?)实际上1.8.0都跑不了)
必须严格要求1.7.0
我试运行的脚本是:./test/llm_test.py
环境是通过poetry管理的
依赖1.8.0的时候报错如下:
Exception in thread Thread-1 (run):
Traceback (most recent call last):
File "C:\Users\yiouyang5\AppData\Local\Programs\Python\Python310\lib\threading.py", line 1016, in _bootstrap_inner
self.run()
File "C:\Users\yiouyang5\AppData\Local\Programs\Python\Python310\lib\threading.py", line 953, in run
self._target(*self._args, **self._kwargs)
File "D:\Projct\spark-ai-python-main\sparkai\llm\llm.py", line 526, in run
self.client.enableTrace(False)
AttributeError: module 'websocket' has no attribute 'enableTrace'
官网代码
from sparkai.llm.llm import ChatSparkLLM, ChunkPrintHandler
from sparkai.core.messages import ChatMessage
#星火认知大模型Spark Max的URL值,其他版本大模型URL值请前往文档(https://www.xfyun.cn/doc/spark/Web.html)查看
SPARKAI_URL = 'wss://spark-api.xf-yun.com/v3.5/chat'
#星火认知大模型调用秘钥信息,请前往讯飞开放平台控制台(https://console.xfyun.cn/services/bm35)查看
SPARKAI_APP_ID = ''
SPARKAI_API_SECRET = ''
SPARKAI_API_KEY = ''
#星火认知大模型Spark Max的domain值,其他版本大模型domain值请前往文档(https://www.xfyun.cn/doc/spark/Web.html)查看
SPARKAI_DOMAIN = 'generalv3.5'
if name == 'main':
spark = ChatSparkLLM(
spark_api_url=SPARKAI_URL,
spark_app_id=SPARKAI_APP_ID,
spark_api_key=SPARKAI_API_KEY,
spark_api_secret=SPARKAI_API_SECRET,
spark_llm_domain=SPARKAI_DOMAIN,
streaming=False,
)
messages = [ChatMessage(
role="user",
content='你好呀'
)]
handler = ChunkPrintHandler()
a = spark.generate([messages], callbacks=[handler])
print(a)
报错信息:
TypeError: issubclass() arg 1 must be a class
ERROR conda.cli.main_run:execute(124):
conda run python /mnt/e/PycharmProjects/ToolBench/toolbench/inference/LLM/spark_websocket.py
failed. (See above for error)The text was updated successfully, but these errors were encountered: