...
选择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
}' |