An intelligent legal assistant that helps foreigners understand Polish law through natural language interactions, powered by advanced AI and RAG (Retrieval Augmented Generation) technology.
This project aims to make Polish legal information more accessible to foreigners by:
- Providing accurate legal information from verified sources
- Offering multi-modal interaction (text, voice, image) //TODO
- Creating a user-friendly interface for legal queries
- Ensuring responses are based on current Polish law
- Automated web scraping of legal resources //SEMI-AUTOMATED
- Content filtering and validation
- Structured data storage in Excel/PDF formats
- Exclusion of unofficial or outdated sources
- Question-answer retrieval system
- Embeddings-based similarity search
- Context-aware response generation
- Source attribution for transparency
- Real-time chat interface
- Mobile-responsive design
- Conversation history management
- Source reference display
- OpenAI for text generation and embeddings
- Custom RAG implementation for legal contexts
- Fallback mechanisms for reliability
- Frontend hosted on Vercel
- Backend deployed on Google Cloud Run
- Firestore for conversation storage
- Google Cloud Storage for data files
- React.js
- Vercel for hosting
- FastAPI
- Google Cloud Run
- Firestore
- Google Cloud Storage
- OpenAI API
- Custom RAG implementation
- Vector embeddings
/
├── frontend/ # React frontend application (Vercel)
│ ├── src/ # React source code
│ └── update-backend-url.js # Script to update backend URL
│
├── backend/ # FastAPI backend application (Google Cloud Run)
│ ├── app/ # FastAPI application code
│ ├── Dockerfile # Docker configuration for Cloud Run
│ └── deploy.sh # Deployment script for Google Cloud
│
└── query/ # RAG implementation
├── prepare_rag.py # RAG system implementation
└── *.xlsx # Legal Q&A data files
-
Install the Google Cloud SDK:
curl https://sdk.cloud.google.com | bash gcloud init -
Set your OpenAI API key:
export OPENAI_API_KEY=your-openai-api-key -
Run the deployment script:
cd backend chmod +x deploy.sh ./deploy.sh -
Note the Cloud Run URL from the output.
-
Update the backend URL in the frontend:
cd frontend node update-backend-url.js YOUR_CLOUD_RUN_URL -
Deploy to Vercel:
vercel --prod
For detailed deployment instructions, see the backend/README.md and DEPLOYMENT.md files.
-
Phase 1: Data Collection & Processing ✅
- Enhance web scraping reliability
- Improve content filtering
- Expand data sources
-
Phase 2: RAG System Enhancement ✅
- Fine-tune embeddings for legal context
- Implement better answer generation
-
Phase 3: Web Interface ✅
- Develop React frontend
- Create Python backend
-
Phase 4: Cloud Deployment ✅
- Frontend on Vercel
- Backend on Google Cloud Run
- Firestore for data storage
-
Phase 5: Future Enhancements
- Add voice input/output
- Enable image-based queries
- Implement multi-language support