Skip to content

Commit 6d90b07

Browse files
committed
use document array by default
1 parent ee217c3 commit 6d90b07

File tree

5 files changed

+528
-6
lines changed

5 files changed

+528
-6
lines changed

README.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,17 @@ This is code for building a GPT-3 powered knowledge base application using Node.
1515
[![Run on Replit.com](https://repl.it/badge/github/dabblelab/gptanswers-node)](https://repl.it/github/dabblelab/gptanswers-node)
1616

1717
3. In Replit.com, add a new secret named `OPENAI_API_KEY` and make the value your OpenAI API key.
18-
4. Add your own content to the answers.json file.
18+
4. Add your own content to the documents defined in the `routes/answers.json` file.
1919
5. Run and test the app in Replit
2020

21+
## Using an answers file
22+
23+
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.
24+
25+
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.
26+
27+
For more details on using answer files, see the [OpenAI Documentation](https://beta.openai.com/docs/api-reference/answers).
28+
2129
## Question and comments
2230

2331
If you have questions or comments, please post them on the [OpenAI Community Topic](https://community.openai.com/t/getting-started-with-the-openai-api-and-node-js-javascript/223) for this project, or on the [GitHub Discussions](https://github.com/dabblelab/gptanswers-node/discussions) page for this code. Thanks so much!

0 commit comments

Comments
 (0)