This project demonstrates how to build an AI agent with both short-term and long-term memory using Mem0, LangChain, and Groq. The agent acts as an interview preparation coach, remembering your answers and preferences across sessions.
- Conversational UI: Chat with an AI interview coach in your browser (Streamlit app)
- Personalized Memory: Remembers your answers, feedback, and preferences across sessions
- Memory Engine: Uses Mem0 for memory extraction, storage, and retrieval (vector DB: Qdrant)
- LLM Integration: Uses Groq (Llama-3) for interview questions and Gemini for embeddings
- Input & Output validation: Checking the input before passing it to the LLM and processing the output before giving harmful response to the user
- User interacts with the AI via a chat interface (Streamlit)
- Messages are sent to the memory engine (Mem0), which extracts and stores relevant memories
- Memories are retrieved and provided as context to the LLM (Groq/Llama-3) for personalized responses
- All conversations are stored in a vector database (Qdrant) for long-term recall
- Short-term memory: Session-based, remembers the current conversation
- Long-term memory: User-based, persists across sessions (using
user_id)
memory_in_agents/
├── app.py # Streamlit UI for chat
├── memory_agent.py # Core logic: memory engine, LLM chain, chat function
├── MEMORY.md # Theory and concepts of memory in AI agents
├── pyproject.toml # Python dependencies
├── notebooks/
│ └── experiment.ipynb # Example notebook for experiments
└── README.md # This documentation
Core files involved are app.py and memory_agent.py for implementation purpose and experiement.ipynb for experiment
-
Clone the repo
git clone https://github.com/Jerry-britto/AI-Interview-Coach.git cd AI-Interview-Coach -
Create a virtual environment
python3 -m venv .venv source .venv/bin/activate -
Install dependencies
pip install -r requirements.txt # or pip install -e .
-
Set up API keys
- Copy
.env.exampleto.envand add your keys forGROQ_API_KEYandGEMINI_API_KEY.
- Copy
streamlit run app.pyOpen http://localhost:8501 in your browser.
python main.py- app.py: Streamlit web interface for chatting with the AI coach. Handles user input, session state, and displays stored memories.
- memory_agent.py: Implements the memory engine using Mem0, integrates with Groq LLM and Gemini embedder, and provides the
chat()function. - notebooks/experiment.ipynb: Jupyter notebook for experimenting with memory and retrieval.
- Receives user messages and extracts memories using an LLM
- Resolves conflicts (e.g., updates preferences if changed)
- Stores memories in a vector DB (Qdrant)
- Retrieves relevant memories for each new query
- Combines graph and vector search results for best context
See MEMORY.md for a deep dive into memory concepts and parameters.