Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Maester's Ledger

A Retrieval-Augmented Generation (RAG) application that allows you to query a knowledge base of Game of Thrones lore using a "Maester" persona. The application uses Google's Gemini API for embeddings and text generation.

Features

  • Vector Database: Indexes text files related to Game of Thrones history.
  • Maester Persona: Answers questions in the style of a Citadel Archmaester.
  • Terminal UI: A text-based user interface powered by textual for an immersive experience.

Installation

  1. Clone the repository (if applicable).
  2. Create a virtual environment:
    python3 -m venv venv
    source venv/bin/activate
  3. Install dependencies:
    pip install -r requirements.txt
    (Note: You may need to create a requirements.txt based on the imports in the scripts if one is not provided. Key packages include langchain, langchain-chroma, langchain-google-genai, textual, python-dotenv).
  4. Set up environment variables: Create a .env file in the root directory and add your Gemini API key:
    GEMINI_API_KEY=your_api_key_here

Usage

1. Build the Knowledge Base

Before asking questions, you need to index the data. The data/ folder contains the text files to be indexed.

Open maester_brain.py and uncomment the line oracle.build_library() in the __main__ block, or run the build command if you've set up a CLI argument.

Run the script:

python maester_brain.py

This creates the citadel_db directory containing the vector store.

2. Run the Interface

Launch the terminal UI to interact with the Maester:

python archmaester_ui.py

Limitations & Known Issues

API Rate Limits (429 Resource Exhausted) This application uses the embedding-001 model from Google. On the free tier, you may encounter RESOURCE_EXHAUSTED errors when indexing a large number of files or making frequent requests.

Solutions:

  • Wait and Retry: The application includes basic pauses, but you may need to wait for quotas to reset.
  • Upgrade Plan: Using a paid tier for the Gemini API significantly increases the rate limits, allowing for faster indexing and more frequent queries.
  • Reduce Data: Try indexing fewer files at a time.

About

A Retrieval-Augmented Generation (RAG) application that transforms your local text archives into a searchable knowledge base. Interact with a persona-driven Archmaester through a custom Terminal UI, powered by LangChain and Google Gemini.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages