Skip to content

Vector Database Guide

The vector database is a powerful feature in Dreamio that provides the AI narrator with long-term memory. This guide explains how it works and how you can use it to create a more immersive and consistent story.

What is the Vector Database?

The vector database stores key information about your story's world, characters, and events. When you enable this feature, the AI can recall this information in later parts of the story, leading to a more coherent and engaging narrative. This helps the narrator remember important details that might otherwise be forgotten as the story progresses.

How it Works

The vector database works by converting text-based information into numerical representations called "vector embeddings." Here's a simplified overview of the process:

  1. Information Extraction: As you play, the game automatically identifies and extracts important lore and worldbuilding information from the story.
  2. Embedding Generation: Each piece of information, specifically the "key" of an entry, is converted into a vector embedding using an AI model. This embedding captures the semantic meaning of the text.
  3. Storage: These embeddings are saved as part of your game file.
  4. Retrieval: When generating new parts of the story, the game searches the database for entries that are most relevant to the current context. It does this by scanning vector embeddings of chunks of the current context and comparing them with the embeddings of the database entries to find the best matches.

How to Use the Vector Database

You have full control over the vector database through the in-game options menu.

Enabling the Vector Database

Vector database is enabled by default. You can toggle it in the Options menu:

  1. Click the Options button at the top of the game screen.
  2. Toggle the Use Vector DB option to enable/disable it.

When enabled, the game will automatically manage the database for you. However, you can also manually edit its contents.

Editing the Database

You can view and edit the contents of the vector database by clicking the Edit database contents button in the Options menu. This will open the Database Editor, where you can:

  • Add new entries: Click the Add new entry button to create a new entry. Entries should be in a key: value format (e.g., John's Sword: A magical blade that glows in the dark). The AI uses the key to find relevant information and will then use the value as part of the context.
  • Edit existing entries: You can modify the content of any entry directly in the editor.
  • Delete entries: Each entry has a delete button to remove it from the database.

After making your changes, click the Save button to apply them.

Frequently Asked Questions

How much information can the database handle?

Think of database entries like a more flexible version of Story Cards in AI Dungeon. The AI only sees a certain number of database entries at a time, and this number depends on your context window size setting. These entries are sorted by how semantically relevant the names of the entries are to the contents of the most recent story entries.

If you want information to persist permanently in the context window, it's better to put it in the instructions for the narrator. The larger your context window setting is, the more information you can put in the instructions for the narrator.

What triggers the database's use? Do I need to use exact keywords?

You don't need to worry about using exact keywords. The system uses vector embeddings to find entries that are semantically similar to what's happening in the story. This means that related concepts will be picked up even if the names of the database entries don't match the text exactly.

A certain number of the most relevant database entries are always included in the context. This number is determined by the size of your context window. As the story progresses, the game continuously sorts entries based on their relevance to the last few turns. If you scroll up in the story window, you can see which database entries are active at any given time.

How should I handle information that changes during the story?

The database was not designed for information that is expected to change, such as a character's appearance or alliances. This type of dynamic information is better suited for the Status window.

While the database does automatically update when the story gets too long to fit within the context window, you should not rely on it for tracking details that change frequently. If an NPC's description in the database becomes outdated due to in-game events (e.g., an elf becomes a vampire), there may be a conflict. In such cases, it's best to manually update the database or move the information to the status window.