/openai-poc

OpenAI PoC implemented in Next.js

Primary LanguageTypeScriptMIT LicenseMIT

OpenAI PoC implemented in Next.js

GIF

This repository was developed using openai-node and based on openai-quickstart-node, with several additional elements added.

  • Supports styled-components and TypeScript
  • Remember conversation context instead of one-time responses
  • More intuitive and clean UI with easy customization options

Getting Started

  1. If you don’t have Node.js installed, install it from here (Node.js version >= 14.6.0 required)

  2. Clone this repository

  3. Navigate into the project directory

    $ cd openai-poc
  4. Install the requirements

    $ npm install
  5. Make a copy of the example environment variables file

    On Linux systems:

    $ cp .env.example .env

    On Windows:

    $ copy .env.example .env
  6. Add your API key to the newly created .env file

  7. Run the app

    $ npm run dev
  8. Deploy it to the cloud with Vercel (Documentation)

Customizing the Model

You can customize the following model-related variables in the setting.ts file.

Variable Description Option Type
PREFIX Prefix to include in all conversations Whatever you want (language, role, tone..) string
MODEL Models Available models string
TEMPERATURE Adjust your settings Number between 0 and 1 number
MAX_TOKENS What are tokens and how to count them? Maximum number of tokens allowed by each model number

License

MIT