推荐使用在线大模型,例如阿里云、火山引擎、deepseek等。推荐使用在线大模型,例如阿里云、火山引擎、deepseek等。也可以连接本地大模型。
阿里云
到阿里云百炼平台(https://bailian.console.aliyun.com/),开通API-Key。
...
然后在Smartbi-运维设置-自然语言配置-大模型配置中添加。
Deepseek
到deepseek开放平台(https://platform.deepseek.com/)创建API Key。
然后在Smartbi-运维设置-自然语言配置-大模型配置中添加,选择OpenAI接口。
注意:由于deepseek官网的流量太大,所以性能常常不稳定,建议选取阿里云、火山引擎的deepseek。
火山引擎
到火山方舟(https://console.volcengine.com/ark/)创建API Key。
...
选择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
}' |