Metadata-Version: 2.4
Name: georag
Version: 0.1.1
Summary: Spatial-Semantic Retrieval Augmented Generation framework
Author-email: Developer <makindeadedeji500@gmail.com>
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: django>=4.2
Requires-Dist: scikit-learn>=1.3.0
Requires-Dist: psycopg2-binary>=2.9
Requires-Dist: numpy>=1.24

<div align="center">
  <h1 style="color: #007acc;">GeoRAG</h1>
  <p><b>Spatial and Semantic RAG for real world engineering.</b></p>
</div>

## The Problem
If you have ever tried to build a RAG system that understands locations, you know standard vector databases fail completely. If you ask an AI to find "infrastructure damage within 50km of Lagos", a normal vector database just gives you articles about infrastructure damage from all over the world because it ignores the map.

I built GeoRAG to fix this. It is a python package that combines PostGIS mapping with pgvector semantic search in a single database, this means your AI only gets information that actually makes sense for the specific location you are asking about.

## What it does
* **Hybrid Search:** It filters out the wrong map locations first and then it finds the best matching text.
* **Smart Clustering:** It uses Scikit-Learn to group your data points into real geographic regions so your AI does not get confused by scattered coordinates.
* **One Database:** Everything lives in PostgreSQL, you do not need to sync a separate vector database with your main backend.

## Quickstart


```bash
pip install georag

from georag import GeoRAGPipeline

# Set up the pipeline with your Django model
pipeline = GeoRAGPipeline(chunk_model=MySpatialChunk, max_clusters=3)

# Get context ready for your LLM
context = pipeline.generate_context(
    query_embedding=my_vector,
    target_longitude=3.3792,
    target_latitude=6.5244,
    radius_km=50.0
)

## Author & Next Steps
Feel free to open an issue or reach out at [makindeadedeji500@gmail.com](mailto:makindeadedeji500@gmail.com) if you have questions. 

**Upcoming Roadmap**
- [ ] **Interactive Demo:** Hosting a live instance on Hugging Face to visualize the spatial routing algorithm.
- [ ] **Architecture Breakdown:** Publishing a Hashnode article detailing the exact PostGIS and Scikit-Learn backend integration.
