Loading repository dataβ¦
Loading repository dataβ¦
hari9618 / repository
π§ MediaMind is a multi-agent AI-powered media intelligence platform that transforms podcasts, videos, and transcripts into summaries, highlights, and social media content using LangGraph, Hybrid RAG, and Groq Llama 3.3 70B. Features include autonomous agent routing, YouTube transcript ingestion, MCP-inspired tool architecture, ChromaDB + BM25 retr
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
π Try the App Here
π https://mediamind-ai.onrender.com/
MediaMind is a production-grade Autonomous Media Intelligence Platform powered by a multi-agent AI pipeline.
Instead of a single LLM call, it routes every user request through a Supervisor β Specialist agent system β intelligently deciding whether to summarize, extract highlights, generate social content, or answer a direct question.
It combines Groq's ultra-fast inference with Hybrid RAG (ChromaDB + BM25), MCP-style tool calling, Langfuse v4 observability, RAGAS auto-evaluation, and real-time YouTube transcript ingestion β all behind a clean, session-aware Streamlit chat UI.
| Feature | Description |
|---|---|
| β‘ Ultra-Fast Inference | Groq LPU running Llama 3.3 70B β sub-2s responses |
| π§ Multi-Agent Pipeline | Supervisor routes to Summarize / Highlight / Social / Q&A agent |
| πΊ YouTube Ingestion | Paste any YouTube URL β transcript fetched, indexed, answered |
| π Hybrid RAG | ChromaDB vector search (60%) + BM25 keyword search (40%) merged |
| π§ MCP Tool Registry | Wikipedia, DuckDuckGo, YouTube Transcript, File Reader β per-agent access control |
| π¬ Multi-Session Chat | Full session history, auto-titles, session switching, export to markdown |
| π¬ Direct Q&A Mode | Ask any question β Q&A Agent answers in 2β5 sentences, grounded in context |
| π‘οΈ Production Guardrails | Input validation, content moderation, output sanitization (Pydantic v2) |
| π RAGAS Auto-Evaluation | Faithfulness, Answer Relevancy, Context Precision + Hallucination detection |
| π Langfuse Observability | Every trace, span, LLM call and RAGAS score logged to Langfuse dashboard |
| π Deployed on Render | Persistent ChromaDB storage β data survives server restarts |
| Technology | Purpose |
|---|---|
| π Python 3.11+ | Core programming |
| β‘ Groq API | Fast LLM inference (Llama 3.3 70B) |
| π§ LangGraph | Agent orchestration (StateGraph) |
| π LangChain | LLM integration + tool binding |
| π¨ Streamlit | Frontend UI + multi-session chat |
| π¦ ChromaDB | Persistent vector store |
| π BM25 (rank_bm25) | Keyword search for hybrid RAG |
| π€ all-MiniLM-L6-v2 | Local embeddings β zero API cost |
| π DuckDuckGo DDGS | Live web search tool |
| π Wikipedia API | Factual enrichment tool |
| π RAGAS 0.4.x | Production RAG evaluation (reference-free) |
| π Langfuse v4 | LLM observability + score tracking |
| π Render | Cloud deployment |
| π³ Docker | Containerised production build |
MediaMind
β
βββ app.py # Streamlit UI β multi-session chat, source management
βββ agent.py # LangGraph multi-agent pipeline + evaluation trigger
βββ rag.py # Hybrid RAG (ChromaDB + BM25) β retrieve_context_with_chunks()
βββ evaluation.py # RAGAS evaluation service (fire-and-forget, non-blocking)
βββ mcp_tools.py # MCP tool registry (4 tools, per-agent access control)
βββ llm.py # Groq LLM client (3 temperature modes)
βββ prompts.py # All LLM prompts β ChatPromptTemplate + Few-Shot + CoT
βββ guardrails.py # Input validation, content moderation, output sanitization
βββ tracer.py # Langfuse v4 observability wrapper
βββ schemas.py # Pydantic v2 schemas for I/O validation
βββ config.py # Central config β models, RAG params, eval thresholds
βββ tracer.py # Langfuse v4 SDK wrapper (create_score, spans, traces)
βββ Dockerfile # Multi-stage production build
βββ docker-compose.yml # Local dev + persistent volumes
βββ requirements.txt
βββ .env # API keys (NOT pushed to GitHub)
βββ README.md
User Query
β
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Supervisor Node β
β Reads query, decides routing (temp=0.0) β
ββββββ¬βββββββββββ¬βββββββββββββββ¬βββββββββββββββββββββββββ
β β β β
βΌ βΌ βΌ βΌ
βββββββββββ βββββββββββ βββββββββββ ββββββββββββββ
βSummarizeβ βHighlightβ β Social β β Q&A Agent β
β Agent β β Agent β β Agent β β β
ββββββ¬βββββ ββββββ¬βββββ ββββββ¬βββββ βββββββ¬βββββββ
β β β β
βΌ βΌ βΌ βΌ
Wikipedia Wikipedia Web Search Wikipedia
Web Search Web Search (only) Web Search
β β β β
βΌ βΌ βΌ βΌ
Groq 0.3 Groq 0.0 Groq 0.75 Groq 0.3
(balanced) (precise) (creative) (balanced)
β β β β
βββββββββββββ΄ββββββββββββ΄ββββββββββββββ
β
βΌ
Output Guardrails
(validation + sanitization)
β
βΌ
Final Response β UI
β
βΌ (background daemon thread)
RAGAS Evaluation (non-blocking)
β
βΌ
Langfuse Scores Dashboard
| Query type | Example | Routes to |
|---|---|---|
| Wants a summary / overview | "summarize this video" | summarize_agent |
| Wants highlights / key moments | "what are the key points?" | highlight_agent |
| Wants social media content | "write a LinkedIn post" | social_agent |
| Asks a direct question | "what does X mean?" / "who is Y?" | qa_agent |
Routing rule: If the query contains question words β what, why, how, who, when, explain, define, tell me β the supervisor always routes to
qa_agent. The Q&A Agent answers in 2β5 sentences grounded in transcript content, no structured reports.
User Query
β
ββββββββββββββββββββββββββββββββ
βΌ βΌ
ChromaDB Vector Search BM25 Keyword Search
(semantic similarity) (exact term matching)
all-MiniLM-L6-v2 embeddings rank_bm25 BM25Okapi
Top-4 chunks (60% weight) Top-4 chunks (40% weight)
β β
ββββββββββββ¬ββββββββββββββββββββ
βΌ
Merge + Deduplicate
(vector results get priority)
β
βΌ
retrieve_context_with_chunks()
returns: (joined_str, List[str])
β β
βΌ βΌ
LLM Prompt RAGAS Evaluation
retrieve_context_with_chunks()returns both the joined context string (for the LLM prompt) and the raw chunk list (for RAGAS evaluation) in a single retrieval call β zero double-fetching.
MediaMind automatically evaluates every production query using RAGAS 0.4.x β no ground truth or human labels required.
run_agent() completes
β
βΌ (fire-and-forget daemon thread β user never waits)
EvaluationService.evaluate_fire_and_forget()
β
βΌ
_run_ragas_sync()
βββ Faithfulness (is answer grounded in context?)
βββ Answer Relevancy (does answer address the question?)
βββ LLMContextPrecisionWithoutReference (is retrieval pulling clean chunks?)
β
βΌ
_check_thresholds() β WARNING logs + UI alerts if below threshold
β
βΌ
tracer.score_response() β client.create_score() β Langfuse dashboard
| Metric | What it measures | Threshold |
|---|---|---|
| Faithfulness | Is the answer grounded in retrieved context? Low = hallucination risk | >= 0.70 |
| Answer Relevancy | Does the answer actually address the query? | >= 0.65 |
| Context Precision | Are retrieved chunks mostly relevant? Low = noisy retrieval | >= 0.60 |
| Hallucination Score | Derived: 1 - faithfulness. High = fabrication risk | <= 0.30 |
All metrics are reference-free β no ground truth needed. Scores appear in Langfuse within ~10β20s of each response.
Every pipeline run is fully traced in Langfuse v4:
| What is traced | Langfuse object |
|---|---|
| Full pipeline run | Root span (mediamind_pipeline) |
| Supervisor routing decision | Child span |
| RAG retrieval | Child span (chunk count + latency) |
| Every LLM call (LangGraph) | Auto-traced via CallbackHandler |
| Guardrail checks | Child span (pass/fail + reason) |
| RAGAS scores | create_score() per metric |
| User thumbs up / down | create_score("user_feedback") |
Langfuse v4 note: Uses
get_client()+start_as_current_observation()+create_score(). The old.score()method silently did nothing β fixed tocreate_score()withdata_type="NUMERIC".
Three-layer protection on every request:
Input Query
β
βΌ
1. Pydantic QueryInput validation
(min/max length, whitespace, injection patterns)
β
βΌ
2. Content moderation
(off-topic, harmful, ambiguous β rule-based, no API cost)
β
βΌ
3. Output guardrails
(HighlightOutput schema validation, prompt-leak sanitization)
| Tool | Description | Agent Access |
|---|---|---|
youtube_transcript | Fetches full transcript from YouTube URL | Research agent |
web_search | Live DuckDuckGo search for news & trends | All agents |
wikipedia_search | Factual background on people & topics | Summarize, Highlight, Q&A |
read_file | Reads local .txt / .srt / .md transcript | Research agent |
Each agent gets only the tools it needs β deliberate access control, not default behaviour.
git clone https://github.com/hari9618/mediamind
cd mediamind
python -m venv venv
source venv/bin/activate # Mac/Linux
venv\Scripts\activate # Windows
pip install -r requirements.txt
Create a .env file (see .env.example):
# Required
GROQ_API_KEY=your_groq_api_key_here
# Langfuse observability (v4 SDK)
LANGFUSE_PUBLIC_KEY=pk-lf-...
LANGFUSE_SECRET_KEY=sk-lf-...
LANGFUSE_BASE_URL=https://us.cloud.langfuse.com # or https://cloud.langfuse.com for EU
# RAGAS evaluation
EVAL_ENABLED=true
EVAL_LOG_TO_LANGFUSE=true
EVAL_THRESH_FAITHFULNESS=0.70
EVAL_THRESH_PRECISION=0.60
EVAL_THRESH_RELEVANCY=0.65
EVAL_THRESH_HALLUCINATION=0.30
Get your free Groq API key at console.groq.com
Get your Langfuse keys at [cloud.langfuse.com