Get Format DATA(Like JSON) from GPT! GPTPromptKit is a library that helps developers interact with AI language models more effectively by using prompt engineering techniques. The library offers several techniques that can be used depending on the situation, improving the clarity and accuracy of prompts, and enabling more effective communication with users.
repo: gpt-prompt-kit
Install GPTPromptKit using npm:
npm install gpt-prompt-kit
Create a new file named index.js
and add the following code:
import { GPTPromptKit, gptPromptKitFactory } from 'gpt-prompt-kit';
// custom your prompt function to create a gPTPromptKit instance.
const prompt = (text) => {
// Your function to send the text to GPT and receive a response
};
const gptPromptKit = new GPTPromptKit(prompt);
// or you can just pass API_KEY to use the build-in GPT-3.5 model
const gptPromptKit = gptPromptKitFactory(API_KEY);
// Example usage:
// Translate
const translate = gptPromptKit.translate(Lang.English, Lang.Chinese);
translate('Hello, world!').then(console.log);
// Format JSON
const formatJson = gptPromptKit.formatJson({ key: 'explain it', key2: 'explain it' });
formatJson('Description here', { key: 'example' }).then(console.log);
// Format Free
const formatFree = gptPromptKit.formatFree('Any format template you want');
formatFree('Description here').then(console.log);
In demo directory there are some use demo for you to test the abilities of this library.
To use those demo:
npm install
tsc demo/translate.ts
node demo/translate.js
You can get a JSON string with any fields you want:
To contribute to GPTPromptKit, follow these steps:
git clone https://github.com/clean99/gpt-prompt-kit.git
cd gpt-prompt-kit
npm install
npm run build
npm test
npm run lint
npm run format
We welcome contributions to GPTPromptKit! If you'd like to contribute, please fork the repository, create a new branch, make your changes, and submit a pull request.
GPTPromptKit is licensed under the MIT License.
Feel free to modify the code snippets, installation, usage, and contributing sections as necessary to match your library's actual implementation and requirements.