The Agent_Bot service is the intelligence and interaction layer of the TechTorque platform. It combines two critical AI functionalities:
- AI Agent (Tool Use): Uses advanced reasoning to perform real-time actions against microservices (e.g., checking appointment slots, viewing user vehicle status).
- RAG (Knowledge Retrieval): Uses a Vector Database (Pinecone) and a local embedding model to answer non-real-time questions based on structured knowledge documents (e.g., "What is your warranty policy?").
Built with Python, FastAPI, and Gemini (via LangChain), this service implements the /api/v1/ai/chat endpoint.
- Python 3.10+
- External Microservices: The
Authentication,Appointment_Service,Vehicle_Service, andProject_Servicemust be running. - Cloud Services: A Gemini API Key and a Pinecone Account/API Key are required for RAG functionality.
- Navigate to the project directory:
cd Agent_Bot - Activate the virtual environment:
source venv/bin/activate # macOS/Linux .\venv\Scripts\activate # Windows
- Install dependencies:
(Ensure you run this command inside the active
(venv)to resolve all LangChain dependencies)pip install -r requirements.txt
Create a .env file in the root of the Agent_Bot directory and populate it with your specific secrets and URLs.
# --- LLM & RAG Configuration ---
GOOGLE_API_KEY="YOUR_ACTUAL_GEMINI_API_KEY_HERE"
GEMINI_MODEL="gemini-2.5-flash"
PINECONE_API_KEY="YOUR_ACTUAL_PINECONE_API_KEY_HERE"
PINECONE_ENVIRONMENT="us-east-1-aws"
PINECONE_INDEX_NAME="techtorque-kb"
# RAG Configuration Defaults
RAG_CHUNK_SIZE=500
RAG_CHUNK_OVERLAP=50
MAX_CONTEXT_LENGTH=2000
# --- Microservice URLs ---
PORT=8091
BASE_SERVICE_URL="http://localhost:8080/api/v1"
AUTHENTICATION_SERVICE_URL="${BASE_SERVICE_URL}/auth"
VEHICLE_SERVICE_URL="${BASE_SERVICE_URL}/vehicles"
PROJECT_SERVICE_URL="${BASE_SERVICE_URL}/jobs"
TIME_LOGGING_SERVICE_URL="${BASE_SERVICE_URL}/logs"
APPOINTMENT_SERVICE_URL="${BASE_SERVICE_URL}/appointments"