AI-Powered Geomatics & Surveying Assistant
A Retrieval-Augmented Generation (RAG) powered Telegram bot that answers questions related to Geomatics, Land Surveying, GIS, Remote Sensing, and more.
- Overview
- Features
- Architecture
- Project Structure
- Prerequisites
- Installation
- Configuration
- Running the Project
- Deployment
- Usage
- API Endpoints
- Tech Stack
- Contributing
- License
SVY Agent is an intelligent conversational assistant designed specifically for Surveying and Geoinformatics students and professionals. It leverages state-of-the-art NLP technology to provide accurate, context-aware responses to questions about geomatics topics.
The system uses Retrieval-Augmented Generation (RAG) to ensure responses are grounded in authoritative PDF materials, making it ideal for academic and professional use.
- AI-Powered Conversations - Natural language responses powered by GPT-4o
- PDF Document Processing - Extracts and processes content from PDF study materials
- Semantic Search - Finds relevant information using embeddings-based retrieval
- Telegram Interface - Easy access via the popular messaging platform
- Context-Aware Responses - Maintains conversation history for coherent dialogue
- Debug Mode - View source documents used for responses
βββββββββββββββ βββββββββββββββββββ ββββββββββββββββββββ
β Telegram ββββββΆβ Telegram Bot ββββββΆβ RAG Service β
β User β β (Python) β β (LangChain) β
βββββββββββββββ ββββββββββ¬βββββββββ ββββββββββ¬ββββββββββ
β β
βΌ βΌ
βββββββββββββββββββ ββββββββββββββββββββ
β OpenAI GPT-4o β β FAISS Index β
β (LLM) β β (Vector Store) β
βββββββββββββββββββ ββββββββββββββββββββ
svy-agent/
βββ src/ # Main source code
β βββ bot.py # Telegram bot entry point (integrated RAG)
β βββ handlers/ # Bot command and message handlers
β β βββ commands.py # /start, /help, /status commands
β β βββ messages.py # Message processing logic
β β βββ errors.py # Error handling
β βββ services/ # Business logic services
β β βββ rag_service.py # RAG pipeline implementation
β β βββ pdf_processor.py # PDF extraction and indexing
β βββ utils/ # Utility modules
β βββ logging_config.py # Logging configuration
βββ config/ # Configuration management
β βββ __init__.py # Config dataclass
βββ scripts/ # Utility scripts
β βββ index_documents.py # Build vector store from PDFs
βββ ALL_PDF_FILES/ # Source PDF documents (gitignored)
βββ .env.example # Environment variables template
βββ requirements.txt # Python dependencies
βββ README.md # This file
| Requirement | Version |
|---|---|
| Python | 3.12+ |
| OpenAI API Key | Required |
| Telegram Bot Token | Required |
| Minimum | Recommended | |
|---|---|---|
| RAM | 8GB | 16GB |
| CPU | 2 cores | 4+ cores |
| Storage | 2GB | 10GB+ (for PDFs) |
git clone https://github.com/opeblow/SVY_GPT.git
cd svy-agent# Windows
python -m venv venv
venv\Scripts\activate
# Linux/Mac
python -m venv venv
source venv/bin/activatepip install -r requirements.txt# Copy the example file
cp .env.example .env
# Edit .env with your credentials
nano .envCreate a .env file in the project root:
# Required
TELEGRAM_BOT_TOKEN=your_telegram_bot_token_here
OPENAI_API_KEY=your_openai_api_key_here
# Optional - RAG Configuration
EMBEDDING_MODEL=sentence-transformers/all-MiniLM-L6-v2
EMBEDDING_DEVICE=cpu
CHUNK_SIZE=1200
CHUNK_OVERLAP=100
RETRIEVAL_K=5
# Optional - LLM Configuration
LLM_MODEL=gpt-4o
LLM_TEMPERATURE=0.7
LLM_MAX_TOKENS=500
# Optional - Paths
INDEX_DIR=faiss_index
PDF_DIRECTORY=ALL_PDF_FILES
# Optional
DEBUG=false- Open Telegram and search for @BotFather
- Send
/newbotto create a new bot - Follow the instructions and get your API token
- Start your bot by sending
/start
- Go to OpenAI Platform
- Navigate to API Keys
- Create a new secret key
Place your Geomatics-related PDF files in the ALL_PDF_FILES directory:
# Windows
mkdir ALL_PDF_FILES
# Copy your PDFs there
# Or update the path in .env
PDF_DIRECTORY=path/to/your/pdfs# Activate virtual environment
# Windows: venv\Scripts\activate
# Linux/Mac: source venv/bin/activate
# Run the indexing script
python run.py indexThis will:
- Extract text from all PDFs
- Split into chunks
- Create embeddings
- Save the FAISS index
# Start the Telegram bot (RAG is initialized automatically)
python run.py bot- Open Telegram and find your bot
- Send
/startto see the welcome message - Ask a question about Geomatics!
Render offers a free tier that's perfect for this project.
git add .
git commit -m "Initial commit"
git push origin main- Go to Render.com
- Sign up with GitHub
- Click "New +" β "Web Service"
| Setting | Value |
|---|---|
| Name | svy-agent |
| Region | Oregon (or closest to you) |
| Branch | main |
| Runtime | Python |
| Build Command | pip install -r requirements.txt |
| Start Command | python run.py bot |
In the Render dashboard, add these environment variables:
OPENAI_API_KEY- Your OpenAI API keyTELEGRAM_BOT_TOKEN- Your Telegram bot tokenPYTHONUNBUFFERED-1
Click "Create Web Service" and wait for deployment.
Note: Since the FAISS index is built locally, you'll need to commit it or use an external storage solution. For production, consider:
- Building the index locally and committing the
faiss_indexfolder - Using a cloud storage service (AWS S3, Google Drive)
- Adding a Google Drive integration
# Railway
railway init
railway up
# DigitalOcean App Platform
doctl apps create| Command | Description |
|---|---|
/start |
Start the bot and see welcome message |
/help |
Show help information |
/status |
Check if backend is running |
What is GIS and its applications in urban planning?
Explain the principles of land surveying
What are the different types of remote sensing?
How does GPS work in surveying?
What is coordinate reference system?
Set DEBUG=true in your .env file to see source documents in responses.
| Component | Technology |
|---|---|
| Language | Python 3.12+ |
| Framework | python-telegram-bot |
| AI/LLM | OpenAI GPT-4o, LangChain |
| Embeddings | HuggingFace sentence-transformers |
| Vector Store | FAISS |
| Deployment | Render.com (free) |
Contributions are welcome! Please read our contributing guidelines before submitting PRs.
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
For questions or support:
- Email: opeblow2021@gmail.com
Made with love for Geomatics Students