prompt-eng

1.0.49 • Public • Published

Prompts javascript/node client

JavaScript/Node client for caching and storing prompt/response data while utilizing the OpenAI API.

How to install

npm install prompt-eng

How to use:

Your code today

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: "You: How do I combine arrays?\nJavaScript chatbot: You can use the concat() method.\nYou: How do you make an alert appear after 10 seconds?\nJavaScript chatbot",
  temperature: 0,
  max_tokens: 150,
  top_p: 1.0,
  frequency_penalty: 0.5,
  presence_penalty: 0.0,
  stop: ["You:"],
});

Your code after using the proxy client

const { Configuration, OpenAIApi } = require("openai");
const { PromptProxy } = require("prompt-eng");

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

const response = await openai.createCompletion({
  model: "text-davinci-003",
  prompt: "You: How do I combine arrays?\nJavaScript chatbot: You can use the concat() method.\nYou: How do you make an alert appear after 10 seconds?\nJavaScript chatbot",
  temperature: 0,
  max_tokens: 150,
  top_p: 1.0,
  frequency_penalty: 0.5,
  presence_penalty: 0.0,
  stop: ["You:"],
});

Package Sidebar

Install

npm i prompt-eng

Weekly Downloads

31

Version

1.0.49

License

ISC

Unpacked Size

8.68 kB

Total Files

4

Last publish

Collaborators

  • r4zz28
  • abhireddy16
  • aviral.blinqio
  • ashishkumarsoni0
  • aayush2400
  • madhav-blinq
  • samuel_amouyal
  • liad1231
  • guy_arieli