Learn how to create and query rich fictional worlds using retrieval-augmented generation (RAG), guidance, and ChromaDB.
Lore is an educational project, based on the Loremaster 6000 project, which demonstrates how to build a RAG-powered system for creating and managing fictional worlds. Through Jupyter notebooks, it shows how to:
- Generate coherent, interconnected lore using constrained language models
- Store and retrieve world elements using semantic search
- Maintain consistency across a growing body of fictional content
- Query and analyze relationships between different aspects of your world
- Guided World Generation: Create foundational aspects of your world with structured prompts
- Semantic Lore Storage: Store and retrieve lore using ChromaDB's vector capabilities
- Consistency Checking: Ensure new lore aligns with existing world elements
- Relationship Analysis: Explore connections between different parts of your world
- Interactive Tutorials: Learn through hands-on Jupyter notebooks
+-------------------+ +-------------------+ +-------------------+
| LoreManager | | ChromaDB | | Language Model |
| - Proposal Gen |<--->| - Vector Storage |<--->| - Transformers |
| - Refinement | | - Semantic Search | | - Guidance |
| - Query/Analysis | | | | |
+-------------------+ +-------------------+ +-------------------+
^ ^ ^
| | |
v v v
+----------------------------------------------------------+
| World & Lore Models |
| - SettingType (Enum) |
| - World (Base Model) |
| - LoreEntry (Base Model) |
| - LoreProposal/Refinement |
+----------------------------------------------------------+
- Python 3.8+
- Jupyter Notebook/Lab
- Required packages (install via requirements.txt)
git clone https://github.com/Austin-Routt/lore.git
cd lore
pip install -r requirements.txt- Open
lore.ipynbfor a simple introduction - Explore
lore.ipynbfurther for more complex features
# Initialize manager
lore_manager = LoreManager(
model_path="path/to/model",
embeddings_path="path/to/embeddings"
)
# Create world
world = World(
setting=SettingType.horror,
world_description="A massive dark fantasy work with themes of cosmic horror"
)
# Generate lore proposal
proposal = lore_manager.propose_lore(world, "basic principles")
# Refine proposal
final_lore = lore_manager.refine_proposal(proposal, world)analysis = lore_manager.query_lore(
"How do basic principles affect key powers?"
)Contributions welcome! Please read CONTRIBUTING.md for details.
This project is licensed under the MIT License - see LICENSE.md
- Based on the Loremaster 6000 project
- Inspired by traditional world-building techniques
- Built with amazing open-source tools
Made with ❤️ for world-builders everywhere