Giter VIP home page Giter VIP logo

gptanswers-node's Introduction

Building a GPT-3 Knowledge Base App (NodeJS)

YouTube Video

This is code for building a GPT-3 powered knowledge base application using Node.JS/JavaScript. It's and example from the book Exploring GPT-3. To deploy and run this code you'll need the following:

  • An OpenAI API key
  • An account on Replit.com (the free account will work)

Using this code

  1. Watch the 2-minute tutorial video.

  2. Click the 'Run on Replit.com' button below to copy this code to your Replit.com account.

    Run on Replit.com

  3. In Replit.com, add a new secret named OPENAI_API_KEY and make the value your OpenAI API key.

  4. Add your own content to the documents defined in the routes/answers.json file.

  5. Run and test the app in Replit

Using an answers file

By default the code uses a JavaScript array of documents in routes/answers.json for the knowledge base. Alternately, you can store documents in an answers file. There is an example answers file named answers.jsonl in the root, along with a file named upload.js that provides code you can use to upload an answers file to the OpenAI API. If you use the answers file, you'll also need to setup a secret / environment variable named ANSWERS_FILE with the OpenAI filename for the value.

An array of documents is used by default because because it's simpler. However, there are two primary advantages to using a documents file. First, you can include more than 200 documents. Second, the the API will throw a 404 error if there isn't a matching result. Meaning, the app could be setup to log questions that should be added to the documents - unanswered questions. This is not currently a feature but is planned for a future release.

For more details on using answer files, see the OpenAI Documentation.

Question and comments

If you have questions or comments, please post them on the OpenAI Community Topic for this project, or on the GitHub Discussions page for this code. Thanks so much!

gptanswers-node's People

Contributors

tingiris avatar

Stargazers

 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.