Coder Social home page Coder Social logo

oldwarma / gpt-prompt-kit Goto Github PK

View Code? Open in Web Editor NEW

This project forked from clean99/gpt-prompt-kit

0.0 1.0 0.0 2.21 MB

Support a set of prompt engineering techniques in nodejs. E.g., enable gpt to use nodejs, text normalization(get json from gpt).

License: MIT License

JavaScript 3.81% TypeScript 96.19%

gpt-prompt-kit's Introduction

GPTPromptKit ๐Ÿ“š

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

Features ๐ŸŽ

  1. Translate ๐ŸŒ : Ask questions in a clear and concise manner to improve translation accuracy.
  2. Format (Text Normalization) ๐Ÿ“: Use a specific format to prompt the user with two available options:
    • JSON: Provide a JSON schema and input, and receive output in this format.
    • Free: Specify any desired format and receive output accordingly.
  3. ChainOfThought ๐Ÿค”: Prompt GPT to think through the problem step by step.(Coming soon)

Installation ๐Ÿ“ฆ

Install GPTPromptKit using npm:

npm install gpt-prompt-kit

Usage ๐Ÿš€

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);

Demo ๐Ÿฅธ

In demo directory there are some use demo for you to test the abilities of this library.

To use those demo:

  1. Install dependencies:
npm install
  1. Compile & Run the demo:
tsc demo/translate.ts
node demo/translate.js

Translate

translator translator

Format JSON

You can get a JSON string with any fields you want:

formatJson formatJson

Format Free

formatFree formatFree

Changelog ๐Ÿ“

1.1.1

  • delete interpreter so that browser also can use this library.
  • add customize option for gptPromptKitFactory. Now we can use different GPT model. customizedOptions

Development ๐Ÿ› ๏ธ

To contribute to GPTPromptKit, follow these steps:

  1. Clone the repository and install dependencies:
git clone https://github.com/clean99/gpt-prompt-kit.git
cd gpt-prompt-kit
npm install
  1. Build the project:
npm run build
  1. Test the project:
npm test
  1. Lint the project:
npm run lint
  1. Format the project:
npm run format

Contributing ๐Ÿค

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.

License ๐Ÿ“„

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.

gpt-prompt-kit's People

Contributors

clean99 avatar clean666 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.