Magic Key Assistant

Secure, locally fine-tuned Language Model deployed as a helpful Discord Bot within the Magic Key Leisure Center, our community Discord server.

Magic Key Assistant

AI-Powered, Secure, User-Centric Discord Knowledge Assistant

Project Summary

Magic Key Assistant is a custom-built AI knowledge assistant for Discord, designed to provide fast, context-aware answers and technical support to our community. Leveraging OpenAI APIs, secure document embedding, and robust workflow automation, it exemplifies our commitment to responsible, user-focused AI product development.

Features & Tools

  • Contextual Retrieval: Uses vector embeddings (OpenAI + ChromaDB) to surface relevant documents and project knowledge in real time.
  • Secure, Auditable Workflows: All data processing is logged, hashed, and versioned for transparency and compliance.
  • Custom Prompt Engineering: Dynamic, role-aware prompt templates ensure responses are on-brand, accurate, and contextually appropriate.
  • Discord Integration: Built with discord.py for seamless, event-driven interaction.
  • Live Web Lookup: Can fetch and summarize current web content on demand, with clear citation and error handling.
  • Responsible AI Use: User privacy, channel whitelisting, and rate limiting are enforced by design.

Implementation

  • Python & LangChain: Modular, production-grade codebase using LangChain for LLM orchestration and document management.
  • OpenAI API: Secure, key-managed access to GPT-4o for natural language understanding and generation.
  • ChromaDB: Persistent, high-performance vector database for document retrieval and context injection.
  • Automated Hashing & Versioning: All source documents are hashed and tracked for integrity and update detection.
  • Robust Logging: Full event and error logging for auditability and rapid troubleshooting.

Challenges

  • Secure API Integration: Managed sensitive API keys and user data with strict separation and environment controls.
  • Scalable Document Embedding: Batched and chunked large files to stay within API token limits and ensure fast retrieval.
  • Discord Rate Limits: Implemented retry logic and channel whitelisting to prevent spam and ensure compliance with Discord policies.
  • Contextual Accuracy: Engineered prompt templates and retrieval logic to minimize hallucination and maximize relevance.

Outcome

  • Trusted Knowledge Assistant: Actively used by our team and community for technical support, onboarding, and project documentation Q&A.
  • Showcase of Responsible AI: Demonstrates our ability to build secure, user-centric AI tools with transparent workflows and robust error handling.
  • Extensible Platform: Designed for rapid adaptation to new channels, document types, and evolving user needs.
  • Positive Feedback: Praised for its accuracy, speed, and seamless integration into our Discord ecosystem.

Note: Magic Key Assistant builds on collaborative work with Varad Patwardhan and Colin Nickels as part of the StudiosLLM project. This tool is not a commercial product or public framework, but an internal proof-of-concept demonstrating our ability to extend, adapt, and responsibly deploy advanced AI workflows for user-centric environments.