Skip to content

An OpenAI RAG app using Reboot: return natural language answers based on help center documents

Notifications You must be signed in to change notification settings

reboot-dev/reboot-docubot

Repository files navigation

Reboot Docubot

For the impatient:

  1. Prepare an environment by either:
  2. Run the application

Overview

This repository contains code for Docubot, an OpenAI RAG app that ingests help center documents and creates a chatbot that can answer natural language questions about the docs.

The Reboot '.proto' definitions can be found in the api/ directory, grouped into subdirectories by proto package, while backend specific code can be found in backend/ and front end specific code in web/.

For more information on all of the Reboot examples, please see the docs.

Prepare an environment by...

Using VSCode connected to a GitHub Codespace

This method requires running VSCode on your machine: if that isn't your bag, see the other environment option below.

This repository includes a Dev Container config (more about Dev Containers) that declares all of the dependencies that you need to build and run the example. Dev Containers can be started locally with VSCode, but we recommend using GitHub's Codespaces to quickly launch the Dev Container:

  1. Right-click to create a Codespace in a new tab or window:
    • Open in GitHub Codespaces
    • Important: In order to view the example's front end, you must connect your local VSCode to the codespace: you cannot use VSCode in a browser window.
  2. Go to https://github.com/codespaces and click the three dots next to the codespace you just created and then click Open in Visual Studio Code.

Now you're ready to run the application!

Installing prerequisites directly

Running directly on a host requires:

  • A platform of either:
    • Linux: x86_64 or arm64, with glibc>=2.35 (Ubuntu Jammy and other equivalent-generation distributions)
    • Mac: arm64 (Apple M1 and newer) with MacOS>=14.0 and Xcode>=15.2
    • ... or talk to us if your desired platform isn't currently supported!
  • Node.js
    • Including npm.
  • Docker
    • Note: the example does not run "inside of" Docker, but Docker is used to host a native support service for local development.

If you are unable to meet any of these requirements, we suggest using the VSCode and Dev Container environment discussed above.

Now you're ready to run the application!

Run the application

Backend

Our backend is implemented in TypeScript and we must install its dependencies before running it.

npm install

Set the OpenAI API Key

Replace MY_OPENAI_API_KEY with your own OpenAI API key, which you can get from your OpenAI Dashboard.

export OPENAI_API_KEY=sk-proj-your_api-key

Run the backend

Then, to run the application, you can use the Reboot CLI rbt:

npx rbt dev run

Running rbt dev run will watch for file modifications and restart the application if necessary. See the .rbtrc file for flags and arguments that get expanded when running rbt dev run.

Front end

To run the front end, open a separate terminal/shell and do:

npm run dev:web

If using VSCode, the page will load automatically. If not using VSCode, visit http://127.0.0.1:3000.

Tests

The application comes with backend tests.

Before you run the tests, you'll need to ensure you've run rbt generate. If you've already run rbt dev run without modifying .rbtrc, rbt generate will have been run for you as part of that command. Otherwise, you can do it manually.

rbt generate

rbt generate will automatically make required Reboot '.proto' dependencies like rbt/v1alpha1/options.proto available on the import path without you having to check them into your own repository.

Now you can run the tests using pytest:

pytest backend/

About

An OpenAI RAG app using Reboot: return natural language answers based on help center documents

Resources

Stars

Watchers

Forks

Contributors 2

  •  
  •