How I Built a RAG Chatbot Into My Portfolio with LangGraph, PGVector & MCP
Summary
A developer built an interactive AI assistant for their personal portfolio website, replacing the traditional "About Me" section. This RAG chatbot provides instant answers about their experience, projects, and skills, and can fetch real-time GitHub activity. To ensure accuracy, the system uses Retrieval-Augmented Generation (RAG), storing personal information as vector embeddings in a PostgreSQL database with pgvector, powered by OpenAI's embedding model. A crucial design decision involves a similarity score threshold, preventing the assistant from inventing answers when information isn't sufficiently relevant. LangGraph orchestrates the agentic workflow, enabling conditional tool usage, while the Model Context Protocol (MCP) facilitates seamless integration with GitHub for live data access. Conversation memory is maintained using LangGraph's Redis checkpointer, and the frontend is built with Next.js 16 and TypeScript, with a FastAPI backend streaming responses.
Key takeaway
For AI Engineers developing interactive, knowledge-intensive chatbots, consider implementing a RAG architecture with agentic capabilities. You should prioritize retrieval quality and use similarity score thresholds to prevent factual inaccuracies, especially for personal or critical information. Employ frameworks like LangGraph for conditional tool execution and MCP for streamlined external API integrations, ensuring your assistant provides dynamic, current, and context-aware responses without constant manual updates.
Key insights
The article demonstrates building an accurate, interactive RAG chatbot using LangGraph, pgvector, and MCP for dynamic, context-aware responses.
Principles
- Retrieval quality impacts RAG accuracy.
- Similarity thresholds prevent RAG hallucination.
- MCP simplifies external service integration.
Method
The method involves chunking a reference document, embedding it with OpenAI, storing in pgvector, and retrieving relevant chunks based on user queries. LangGraph orchestrates conditional tool calls and manages conversation state via Redis checkpointer.
In practice
- Implement RAG for personal portfolio.
- Use similarity thresholds to prevent hallucination.
- Integrate external APIs with MCP.
Topics
- RAG Chatbot
- LangGraph
- pgvector
- Model Context Protocol
- OpenAI Embeddings
- Similarity Thresholds
Best for: AI Engineer, Machine Learning Engineer, Software Engineer
Related on AIssential
See Counsel's argued verdicts on the open AI decisions leaders are weighing →
Editorial summary, takeaway, and curation by AIssential. Original article published by AI on Medium.