试用了一下Idea generation功能,示例代码如下:
import openai
openai.api_key = "***"
response = openai.Completion.create(
engine="davinci",
prompt="Blog topics dealing with daily life living on Mars\r\n1.",
temperature=0.3,
top_p=1,
frequency_penalty=0.5,
presence_penalty=0.8,
best_of=1,
max_tokens=64)
response内容如下:
{
"choices": [
{
"finish_reason": "length",
"index": 0,
"logprobs": null,
"text": " What is the best way to eat on Mars?\n2. What are the best ways to get around on Mars?\n3. How do you make a house on Mars?\n4. How do you make clothes for Mars?\n5. How do you grow food on Mars?\n6. What kind of"
}
],
"created": 1615435342,
"id": "cmpl-2c6ogBbdrKYgVQdfEnnuASp3ZrI3y",
"model": "davinci:2020-05-03",
"object": "text_completion"
}