微调GPT-3模型调用/v1/chat/completions端点失败的问题咨询
问题解决:微调GPT-3模型的API调用错误
错误原因
你微调的是GPT-3系列的davinci模型,而/v1/chat/completions是专为ChatGPT系列(gpt-3.5-turbo、gpt-4等)聊天模型设计的端点,GPT-3基础模型(包括微调后的版本)不支持这个端点,因此会返回"Invalid URL"错误。
修正方案
改用/v1/completions端点调用,同时调整请求体结构——用prompt字段替代messages字段,这是GPT-3模型的标准调用格式。
修正后的curl请求
curl --location 'https://api.openai.com/v1/completions' \ --header 'Authorization: Bearer TOKEN' \ --header 'Content-Type: application/json' \ --data '{ "model": "davinci:ft-xxx-inc:6302f74d2000001f00f80919-2023-04-15-00-47-48", "prompt": "How to use apple vision api to recognize text? any example?", "temperature": 0.7, "max_tokens": 200 }'
关键注意事项
- 所有GPT-3基础模型(davinci、curie、babbage、ada)及其微调版本,都必须通过
/v1/completions端点调用,不兼容/v1/chat/completions - 请求体无需
messages数组,直接用prompt传入用户查询内容 - 可根据需求添加
temperature(控制输出随机性)、max_tokens(控制输出长度)等参数
内容的提问来源于stack exchange,提问作者angelokh
相关产品推荐
相关产品推荐

