✅ All import errors have been resolved ✅ Dependencies installed correctly ✅ Code adapted for LangChain 0.1.6 compatibility
- Problem: Code was using
create_tool_calling_agentfrom newer LangChain (1.0+), but virtualenv had incompatible version - Solution:
- Downgraded to
langchain==0.1.6which hasAgentExecutorandinitialize_agent - Updated
services/agent_core.pyto useinitialize_agent()withAgentType.CHAT_ZERO_SHOT_REACT_DESCRIPTION
- Downgraded to
- Problem: Missing
sentence-transformers,pinecone-client,torch, and other ML libraries - Solution:
- Created
requirements.txtwith all dependencies pinned - Installed complete dependency tree (~3GB+ with PyTorch)
- Created
- Problem:
get_document_service()was not defined inservices/document.py - Solution: Added singleton pattern getter function at end of file
- Problem: No
.envfile with API keys - Solution: Created
.env.exampletemplate
Create a .env file in the Agent_Bot directory:
cd /home/randitha/Desktop/IT/UoM/TechTorque-2025/Agent_Bot
cp .env.example .envThen edit .env and add your actual API keys:
# Required keys:
GOOGLE_API_KEY=your_actual_google_gemini_api_key
PINECONE_API_KEY=your_actual_pinecone_api_key# Activate virtualenv (if not already active)
source .venv/bin/activate
# Or directly run with virtualenv python:
/home/randitha/Desktop/IT/UoM/TechTorque-2025/Agent_Bot/.venv/bin/python main.pyOnce running, the service will be available at:
- Base URL: http://localhost:8091
- API Endpoint: http://localhost:8091/api/v1/ai/chat
- Health Check: http://localhost:8091/health
- API Docs: http://localhost:8091/docs
- Go to: https://makersuite.google.com/app/apikey
- Create a new API key for Gemini
- Copy the key to your
.envfile
- Sign up at: https://www.pinecone.io/
- Create a free "Starter" project
- Go to "API Keys" in dashboard
- Create/copy your API key
- Create an index named
techtorque-kbwith dimension384
services/agent_core.py- Updated agent initialization for LangChain 0.1.6services/document.py- Added missing singleton getter functionrequirements.txt- Created with all dependencies.env.example- Created configuration template
cd /home/randitha/Desktop/IT/UoM/TechTorque-2025/Agent_Bot
git add services/agent_core.py services/document.py requirements.txt .env.example
git commit -m "fix: Resolve LangChain import errors and add dependencies
- Adapt agent_core.py for LangChain 0.1.6 API (use initialize_agent)
- Add missing get_document_service() singleton function
- Create requirements.txt with pinned dependencies
- Add .env.example configuration template"If you don't have API keys yet but want to test imports, you can temporarily set dummy values:
export GOOGLE_API_KEY=dummy_key_for_testing
export PINECONE_API_KEY=dummy_key_for_testing
python main.pyThe app will start but fail when actually trying to use the APIs. This is useful for verifying all imports work.
This Agent Bot is part of a microservices architecture:
- Port: 8091 (Agent Bot service)
- Dependencies: Authentication, Vehicle, Project, Time Logging, Appointment services
- Features:
- LangChain-based AI agent with tool calling
- RAG (Retrieval Augmented Generation) with Pinecone vector store
- Integration with TechTorque backend microservices
- Google Gemini 2.5 Flash model
✅ Fixed - LangChain version now matches code expectations
✅ Fixed - All ML dependencies now installed
.env file with actual API keys
ℹ️ PyTorch and ML models are large (~3GB). This is normal for AI applications.