openapi 自定义模型url

功能建议 · 234 次浏览
回复内容
0xYancy 2024-06-14 09:48
#1


0xYancy 最后更新于 2024-06-14 13:51
CL 2024-06-14 09:24
#2

猜不出具体什么意思,请明确表述详细需求或问题。

0xYancy 回复 CL 2024-06-14 13:51 :

支持下面的curl

curl https://ark.cn-beijing.volces.com/api/v3/chat/completions \

  -H "Content-Type: application/json" \

  -H "Authorization: Bearer key \

  -d '{

    "model": "$model",

    "messages": [

      {

        "role": "system",

        "content": "You are a helpful assistant."

      },

      {

        "role": "user",

        "content": "Hello!"

      }

    ],

    "stream": true

  }'

CL 回复 0xYancy 2024-06-14 13:52 :

模块里支持设置API网址,只要兼容openai官方的接口就可以用的。

0xYancy 回复 CL 2024-06-14 18:19 :

问题就是用不了

0xYancy 回复 CL 2024-06-14 19:19 :
异常:Error converting value "json: cannot unmarshal string into Go struct field
ChatCompletionRequest.stop of type []string" to type
'OpenAI_API.EndpointBase+VYHdyjSLne5k6dYL47L'. Path 'error', line 1, position 105.
Could not cast or convert from System.String to OpenAI_API.EndpointBase+VYHdyjSLne5k6dYL47L.

CL 最后更新于 2024-06-14 20:53
CL 回复 0xYancy 2024-06-14 20:53 :

这说明接口不完全兼容官方。 你在步骤里是怎么写的,截图一下步骤看看。

0xYancy 回复 CL 2024-06-15 14:27 :

python sdk是正常调用的

CL 回复 0xYancy 2024-06-15 14:52 :


0xYancy 回复 CL 2024-06-18 14:06 :

能不能把URL弄成自定义的,不会在后面加入其他的字符

CL 回复 0xYancy 2024-06-18 14:07 :

不需要替换内容就直接写最终网址就可以了。

0xYancy 回复 CL 2024-06-18 14:37 :


0xYancy 回复 CL 2024-06-18 14:40 :


CL 回复 0xYancy 2024-06-18 14:58 :

哦哦,这个是有点问题,我研究下看看。

目前这个可以尝试把网址写成这样 https://ark.cn-beijing.volces.com/api/v3/chat/completions?test={1}  让它不影响请求路径。

0xYancy 回复 CL 2024-06-18 15:35 :

可以了 优化下url就行了

CL 回复 0xYancy 2024-06-18 16:15 :

这里网址可以写成 https://ark.cn-beijing.volces.com/api/v3/{1} 这样,这里{1}会被替换成对应的api端点, chat对应的就是 chat/completion

回复主贴