Missing required arguments; Expected either ('messages' and 'model') or ('messages', 'model' and 'stream') arguments to be given

I am getting an error when I want to use a fine-tuned da-vinci model. I can’t make request from python and use it. I read Open AI API References but there is nothing about anything for da-vinci API requests. Can you help me about fix this problem ? Thx.

from openai import OpenAI
import os
client = OpenAI(api_key =‘API_KEY’)
model = “ft:davinci-002:xxxxxxxxxxxx”

stream = client.completions.create(
model= model,
messages={
“prompt”: “”,
“completion”: “<the answer of the prompt. \n>”}
)
for chunk in stream:
if chunk.choices[0].prompt is not None:
print(chunk.choices[0].delta.content)

If you go on the playground

https://platform.openai.com/playground?mode=complete

if you click top right, “view code,” you’ll get an answer you can start working with :slight_smile:

Thank you for info, I didn’t know that.
:slight_smile:

1 Like