Code Monkey home page Code Monkey logo

open_ai_presets's Introduction

OpenAI Chat Presets

This project provides a way to prepend text to an OpenAI Chat Completion. It is built in TypeScript and can be used to create chat completion tasks with the model.

Requirements

  • Node.js and npm installed on your machine
  • An OpenAI API Key and Organization ID

Setup

First, clone the repository to your local machine:

git clone https://github.com/jesse-spevack/open_ai_presets.git
cd open_ai_presets

Next, install the project dependencies

npm install

Configuration

Create a .env file in the root directory of your project. Add your OpenAI API Key and Organization ID like so:

OPENAI_API_KEY=your_api_key
OPENAI_ORGANIZATION=your_organization_id

Replace your_api_key and your_organization_id with your actual OpenAI API Key and Organization ID.

Sample Usage

In the project root, run npx ts-node openai_chat.ts and then some text for ChatGPT to revise.

npx ts-node openai_chat.ts 'Even though the sun was setting quite rapidly, and the sky, like, turned all shades of red and pink and orange, the birds, which were flying high above us, were chirping loudly, and the soft rustling sound of the leaves of the trees was soothing my tired and frazzled mind in a rather significant way.Even though the sun was setting quite rapidly, and the sky, like, turned all shades of red and pink and orange, the birds, which were flying high above us, were chirping loudly, and the soft rustling sound of the leaves of the trees was soothing my tired and frazzled mind in a rather significant way.'

Sample Response

{
  fullRevision: 'Even though the sun was setting rapidly, the sky turned shades of red, pink, and orange. Birds flew high above us, chirping loudly, and the leaves of the trees rustled softly, soothing my tired mind.',
  spelling: [],
  revisions: [
    {
      originalSentence: 'Even though the sun was setting quite rapidly, and the sky, like, turned all shades of red and pink and orange, the birds, which were flying high above us, were chirping loudly, and the soft rustling sound of the leaves of the trees was soothing my tired and frazzled mind in a rather significant way.',
      revisedSentence: 'Even though the sun was setting rapidly, the sky turned shades of red, pink, and orange. Birds flew high above us, chirping loudly, and the leaves of the trees rustled softly, soothing my tired mind.',
      reason: 'The revisions simplify and declutter the sentence, removing unnecessary words and phrases. The revised sentence also improves clarity and flow.'
    }
  ]
}

License

This project is licensed under the terms of the MIT license.

open_ai_presets's People

Watchers

Jesse Spevack avatar Kostas Georgiou 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.