推荐使用在线大模型,例如阿里云、火山引擎、deepseek等。
到阿里云百炼平台(https://bailian.console.aliyun.com/),开通API-Key。
到模型广场查看模型名称,开源版推荐qwen2.5-72b-instruct,商业版可以使用qwen-plus、qwen-max,也可以使用deepseek-v3。
然后在Smartbi-运维设置-自然语言配置-大模型配置中添加。
到deepseek开放平台(https://platform.deepseek.com/)创建API Key。
然后在Smartbi-运维设置-自然语言配置-大模型配置中添加,选择OpenAI接口。
注意:由于deepseek官网的流量太大,所以性能常常不稳定,建议选取阿里云、火山引擎的deepseek。
到火山方舟(https://console.volcengine.com/ark/)创建API Key。
到在线推理创建接入点。
然后在Smartbi-运维设置-自然语言配置-大模型配置中添加。
选择OpenAI接口,url用https://ark.cn-beijing.volces.com/api/v3,model_name可以用Model ID或接入点。
到ModelArts Studio(https://console.huaweicloud.com/modelarts)创建API Key。
到在线推理查看API地址和模型名称。
然后在Smartbi-运维设置-自然语言配置-大模型配置中添加。
选择OpenAI接口,url用https://maas-cn-southwest-2.modelarts-maas.com/deepseek-v3/v1/
本地大模型用openai接口。
可执行curl命令,测试大模型的联通性。
# 查看模型参数 curl http://ip:端口/v1/models \ -H "api-key: 123" |
context_length应>=32k,太小会导致大模型无法回答问题。上下文长度(Context Length)指的是模型在一次处理过程中能够理解和生成的文本的最大长度。
测试文本输出。
curl --location 'http://ip:端口/v1/chat/completions' \ --header 'api-key: 123' \ --header 'Content-Type: application/json' \ --data '{ "model": "qwen2.5-instruct", "messages": [ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "你是谁?" } ] }' |
测试流式输出。
curl --location 'http://ip:端口/v1/chat/completions' \ --header 'api-key: 123' \ --header 'Content-Type: application/json' \ --data '{ "model": "qwen2.5-instruct", "messages": [ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "你是谁?" } ], "stream":true }' |