The following is the code
import os
import openai
openai.api_key = "..."
response = openai.Completion.create(
model="text-davinci-003",
prompt="I am happy!",
temperature=0, #creativity
max_tokens=10,
top_p=1,
frequency_penalty=0.0,
presence_penalty=0.0,
suffix='I am even more happy!'
)
print(response)
Following is the output
{
"choices": [
{
"finish_reason": "length",
"index": 0,
"logprobs": null,
"text": "\n\nI am happy because I am surrounded by"
}
],
"created": 1674640360,
"id": "cmpl-6cWkK124234ho8C2134afasdasdnwDKLUMP",
"model": "text-davinci-003",
"object": "text_completion",
"usage": {
"completion_tokens": 10,
"prompt_tokens": 10,
"total_tokens": 20
}
}
What does the index
in above following output represent?