使用少量样本提示训练GPT 3.5时出现错误

我尝试使用messages参数而不是prompt参数来训练GPT 3.5模型,尽管OpenAI的文档中明确提到可以这样训练模型,但仍然抛出了错误。

import openaiconversation=[        {"role": "system", "content": "You are a helpful assistant."},        {"role": "user", "content": "Who won the world series in 2020?"},        {"role": "assistant", "content": "The Los Angeles Dodgers won the World Series in 2020."},    ]def askGPT(question):    conversation.append({"role": "user", "content": question})    openai.api_key = "openai key"    response = openai.Completion.create(        model = "gpt-3.5-turbo",        messages = conversation,        temperature = 0.6        #max_tokens = 150,    )    #conversation.append({"role": "assistant","content":response})    #print(response)    #print(response["choices"][0]["message"]["content"])        conversation.append({"role": "assistant", "content": response.choices[0].message.content})    print(response.choices[0].message.content)def main():    while True:        print('GPT: Ask me a question\n')        myQn = input()        askGPT(myQn)        print('\n')main()

错误:

openai.error.InvalidRequestError: Unrecognized request argument supplied: messages

我尝试在“responses”中给模型提供“conversations”,但似乎不起作用。


回答:

您在聊天完成完成之间犯了错误。请查看文档。

完成:https://platform.openai.com/docs/api-reference/completions/create

聊天完成:https://platform.openai.com/docs/api-reference/chat/create

Related Posts

使用LSTM在Python中预测未来值

这段代码可以预测指定股票的当前日期之前的值,但不能预测…

如何在gensim的word2vec模型中查找双词组的相似性

我有一个word2vec模型,假设我使用的是googl…

dask_xgboost.predict 可以工作但无法显示 – 数据必须是一维的

我试图使用 XGBoost 创建模型。 看起来我成功地…

ML Tuning – Cross Validation in Spark

我在https://spark.apache.org/…

如何在React JS中使用fetch从REST API获取预测

我正在开发一个应用程序,其中Flask REST AP…

如何分析ML.NET中多类分类预测得分数组?

我在ML.NET中创建了一个多类分类项目。该项目可以对…

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注