🌰 实例 examples

提示语 prompt

The following is a list of companies and the categories they fall into:

Apple, Facebook, Fedex

Apple Category:

回答 sample response

Technology

Facebook Category: Social Media

Fedex Category: Delivery

API request

const { Configuration, OpenAIApi } = require("openai");

const configuration = new Configuration({
  apiKey: process.env.OPENAI_API_KEY,
});
const openai = new OpenAIApi(configuration);

const response = await openai.createCompletion({
  model: "text-davinci-003",
  prompt: "The following is a list of companies and the categories they fall into:\\n\\nApple, Facebook, Fedex\\n\\nApple\\nCategory:",
  temperature: 0,
  max_tokens: 64,
  top_p: 1.0,
  frequency_penalty: 0.0,
  presence_penalty: 0.0,
});

🌈prompt变体 variants

🧠思考:注意点、启发