This project features an AI-powered Query-Response Agent that remembers previous user interactions and generates context-aware responses. Built using the Gemini LLM for natural language processing and FAISS for semantic search, the agent can recall related queries and provide accurate, meaningful answers over time. The agent stores conversation history in a JSON file, allowing it to maintain context and improve responses as more queries are added.
- Contextual Memory: The agent remembers past queries and responses to create more relevant and context-aware answers.
- FAISS Integration: Implements FAISS to store and retrieve related queries for better search results and context.
- Dynamic Query Handling: As new queries come in, the agent combines them with previous interactions to enhance its responses.
- Gemini LLM for Response Generation: The agent uses the Gemini LLM model to generate accurate and human-like responses based on past conversations.
- Persistent History: Conversation history is saved and loaded from a JSON file, making the agent capable of resuming conversations after a restart.
- Python
- Gemini LLM (for natural language processing)
- FAISS (for semantic search)
- PydanticAI (for building the agent framework)
- JSON (for conversation history storage)
-
Clone the repository:
git clone https://github.com/deepakmalikk/conversation-agent.git cd conversation-agent
-
Create a virtual environment and activate it:
-
For macOS/Linux:
python3 -m venv venv source venv/bin/activate
-
For Windows:
python -m venv venv venv\Scripts\activate
-
-
Install the required dependencies:
pip install -r requirements.txt
-
Create a
.env
file in the root directory and add your Gemini API key:GEMINI_API_KEY=your-gemini-api-key
-
Run the agent script:
python main.py
-
To interact with the agent, you can call the
handle_query
method. For example:agent = QueryAgent() response = agent.handle_query("What is the capital of France?") print(response)
If you'd like to contribute to this project, feel free to fork it and submit pull requests. Please ensure that your code follows the existing style and includes proper tests.
This project is licensed under the MIT License - see the LICENSE file for details.