Pydantic AI with Mem0
This project demonstrates the integration of Pydantic AI with Mem0 for building a conversational AI assistant with memory capabilities. The assistant can retrieve relevant memories from previous conversations and provides responses in Portuguese (pt-BR).
Features
Conversational AI using Pydantic AI and OpenAI models
Memory storage and retrieval using Mem0
Custom asynchronous wrapper for Mem0 operations (AsyncMemory)
Context-aware responses based on user's past interactions
Tool integration for retrieving current date and relevant memories
Requirements
Python 3.10+
Postgres with pgvector extension for vector storage
Setup
Clone the repository
Set up the environment
Configure environment variables
Create a
.env file in the root directory with the following variables:Run the application
Usage
After starting the application, you can interact with the assistant through the command line. Type your message and press Enter to receive a response. The assistant will remember previous interactions and use them to provide context-aware responses.
To exit the conversation, type
quit.Project Structure
main.py: Main application file with agent configuration and runtime loopmem0_settings.py: Configuration for Mem0 memory systemasync_mem0.py: Asynchronous wrapper for Mem0 memory operationspyproject.toml: Project dependenciesLicense
See the LICENSE file for details.
0 likes · 4 views · May 21, 2025
Integrated Pydantic AI with Mem0 for a conversational AI assistant.
Timeline
Mar 25, 2025 - Apr 13, 2025