AI chatbot that knows the rules of Magic the Gathering.
MTG full rulebook. https://media.wizards.com/images/magic/tcg/resources/rules/MagicCompRules_21031101.pdf Initially full db of mtg cards from scryfall called via API, then just single cards queries. https://scryfall.com/docs/api
- RAG logics implementation without using already developed libraries.
- NVIDIA free api testing
- CHROMADB vector db + Llamaindex. (probably not the right usecase for RAG)
- Easy discord bot.
- Account Setup and Credentials
- Create an NVIDIA account and deploy a model to get API key.
- Setup Discord for developers to deploy the bot.
- Store all API keys securely.
- Data Preparation
- Download the Magic: The Gathering rules manual (PDF or text)
- Test scryfall API
- Indexing Pipeline (local ipynb script) [deprecated]
- Splits text into chunks
- Call NVIDIA for embeddings (same model used for retrieval)
- Uploads vectors to a chroma DB
- Local Development Environment Setup
- Set up a Python virtual environment (here with UV to test it)
- Setup a way to chat with it
- Discord bot is feasable with a cloud VM (Oracle Cloud offers low tier free VMs)
- Quick and easy streamlit FE to run locally (TODO)
This project uses UV to handle dependencies https://docs.astral.sh/uv/getting-started/
At first, I considered indexing the entire card database, but that would require a recurring script to keep the index updated. I’ll still need to do something similar for the rules manual, though rule changes occur far less frequently than new card releases. For this usecase probably the RAG paradigm is not the right approach, need to do more testing on full rules context + google scrape for answers.
- Switch OpenaAI to NVIDIA models in /functions/agents.py
- Switch OpenaAI to NVIDIA models in /functions/chroma.py
- Switch OpenaAI to NVIDIA models in chroma-setup.ipynb
- Switch OpenaAI to NVIDIA models in chroma-test.ipynb
- Switch OpenaAI to NVIDIA models in demo.ipynb
- Add endpoint in the chatbot to index the knowledgebase from discord
- System prompt optimization and edge case handling
- Test a non RAG approach with mistral-medium-3.5-128b
- Test a non RAG approach with llama-3.1-70b-instruct
- Try to implement a google search to fact check answers