Skip to content

User Guide

v2ray edited this page May 11, 2023 · 7 revisions

Overview

This project serves as a Proof of Concept(PoC) for utilizing embeddings to attain long-term memory and Q&A functionality. This wiki page guides you through the initial setup process, including configuring initial prompts, settings, and more. Additionally, it offers a concise explanation of the underlying mechanics of this program.
If you want to know how to load large document files, please finish the current page first, then check this page.

Table of Contents

Getting Started

Follow these steps to start using this program:

  1. Download the compiled binary for your operating system(OS) from the releases.
  2. Extract the files to a folder of your choice. For the purposes of this guide, let's call the folder CCB.
  3. (OS-specific) If you are using Linux or macOS, open a terminal and run the following commands:
    cd /path/to/the/folder/CCB
    chmod 755 GPT3Bot
    
    This sets the permission to execute the file.
  4. To run the program, follow these steps based on your OS:
    • Windows: Double-click GPT3Bot.exe to run the program.
    • Linux or macOS: Open a terminal and run the following commands:
      cd /path/to/the/folder/CCB
      ./GPT3Bot
      
  5. The program will prompt you to enter your OpenAI API key. If you don't have an API key, you can generate one here. The program will automatically validate the API key. If it's invalid, enter a valid API key and try again.
  6. Next, the program will prompt you to choose to load the initial prompt or saved chat history.
    • To load the initial prompt, press Enter.
    • To load the saved chat history, press S on your keyboard, then press Enter.
  7. You will then be prompted to enter the filename for the initial prompt or saved chat history.
    • To use the default initial prompt, press Enter.
    • To use a custom initial prompt or saved chat history, type the filename(e.g. bot for a file named bot.txt for initial prompt or bot.json for saved chat history) and press Enter.
  8. You are now ready to chat! Type in your questions and press Enter. The language model will respond.
  9. You have the option to enhance your experience by adding personalized .txt files to the initial folder. By doing this, you can create custom initial prompts that you can choose to load each time you start the program, giving it your unique touch. In addition to the Default.txt file that's already present, personalized initial prompts act like header messages for each new interaction. These prompts are sent to the language model every time you enter an input, regardless of its context. This feature allows for greater customization and control over the overall tone and style of your interactions with the language model.
  10. If you want to modify the config, check this wiki page: Config.

Commands

When in the chatting area, you can use the following commands:

  • /stop: This command will prompt you to save your chat history before exiting the program. To skip saving, press Enter. To save, enter the desired filename(e.g. bot for bot.json) and press Enter. Your chat history will be saved in the saved folder. Note: Any unsaved changes will be discarded when the program is closed without saving!
  • /undo: This command will remove your last input.
  • /reset: This command will reset your entire chat history. Use with caution!
  • /tc: This command allows you to check the token information for a piece of text. Type or paste the text after executing this command, then press Enter to see the token count, structure, and IDs.
  • /dump: This command allows you to dump the current chat history to a .txt file inside the dump folder.

How It Works

This program leverages embeddings to achieve long-term memory. When you input a piece of text, the program obtains the embeddings from the OpenAI API using text-embedding-ada-002 model. Embeddings are high-dimensional vector representations of text, and cosine similarity can be used to determine if two texts are similar even if they have different forms and structures. The program searches for both input embeddings and response embeddings in the chat history, if it finds similar ones, it means that there is some context to share with the current input, the program then injects these interactions into the initial prompt for the language model to reference.

Clone this wiki locally