Giter Club home page Giter Club logo

openai-connect-nodeapp's Introduction

OpenAI Connect Node App

Overview

The OpenAI Connect Node App is an open-source project designed to serve as a simple interface for interacting with OpenAI's GPT (Generative Pre-trained Transformer) models. The app facilitates threaded conversations, allowing users to engage in dynamic and context-aware interactions.

Prerequisites

Before running the application, make sure you have the following prerequisites installed:

  • Node v20.10.0
  • npm (Node Package Manager)
  • OpenAI GPT-3.5 API Key
  • Assistant ID from OpenAI

Installation

  1. Clone the repository to your local machine:

    git clone https://github.com/uhurutek/openai-connect-nodeapp.git
  2. Navigate to the project directory:

    cd openai-connect-nodeapp
  3. Install dependencies:

    yarn install
  4. Create a .env file in the project root and add the following configuration:

    PORT=8000
    GPT_API_KEY=your_openai_GPT-3.5_api_key
    GPT_ASSISTANT_ID=your_assistant_id
    DOMAIN_ALLOW=[http://your-client-domain.com,http://your-client2-domain.com] 
    GPT_RUN_SLEEP=3

    Replace your_openai_api_key and your_assistant_id with your OpenAI API key and assistant ID. Also, set http://your-client-domain.com as the allowed domain for CORS.

Usage

  1. Start the Node.js server:

    yarn start

    The server will be running on the specified port (default is 8000).

  2. Use the provided API endpoints to interact with the OpenAI GPT-3.5 model:

    • POST /chats: Create a new chat thread.
    • POST /chats/:threadID/:question: Post a question to an existing chat thread.

Example

  1. Create a new chat thread

    curl -X POST http://localhost:8000/chats
  2. Post a question to a chat thread

    curl -X POST http://localhost:8000/chats/your_thread_id/Can you help me with this question?

Deploy with docker

docker compose -f docker/docker-compose.yml up -d --build

Deploy with pm2

For the initial start, use:

yarn start

And for subsequent restarts, use:

yarn restart

License

This project is licensed under the MIT License. Feel free to use and modify the code as needed.

Acknowledgments

This project utilizes the OpenAI GPT-3.5 beta API. Visit OpenAI for more information on accessing the API.

openai-connect-nodeapp's People

Contributors

shant00 avatar mahabubul470 avatar imtiaz-rahi avatar dependabot[bot] avatar

Stargazers

AeonFlux avatar  avatar  avatar

Watchers

 avatar

openai-connect-nodeapp's Issues

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.