karthyks/text-embeddings-test
0
๐ GitLab Log Embedding Analyzer
A modern, full-stack application for processing, cleaning, and analyzing GitLab CI/CD log files using advanced text embeddings and LLM-based filtering. Built with React TypeScript frontend and FastAPI Python backend.
๐๏ธ Architecture Overview
This project follows a clean, modular architecture:
- ๐ Backend (`backend/`) - Python module with FastAPI server
- โ๏ธ Frontend (`frontend/`) - React TypeScript application
- ๐งช Tests (`backend/tests/`) - Comprehensive test suite
โจ Key Features
๐งน Intelligent Log Processing
- Two-Stage Pipeline: Basic cleaning + LLM-based error filtering
- Smart Chunking: Configurable chunk sizes with overlap
- GitLab CI/CD Support: Specialized parsing for GitLab logs
- ANSI Code Removal: Clean text extraction from terminal logs
๐ง Advanced LLM Filtering
- Local Gemma Models: Privacy-first AI processing (default)
- Multiple Providers: OpenAI, Anthropic, Ollama support
- Error Focus: Filters out noise, keeps only critical errors and sections
- Section-Aware: Only preserves GitLab sections containing actual errors
- Smart Condensation: Dramatically reduces log volume while preserving critical information
๐ Dual Embedding Models
- ๐ฅ Gemma Models: Advanced transformer-based embeddings (default)
- โก Sentence Transformers: Fast, efficient embeddings (fallback)
- ๐ Semantic Search: Natural language queries across processed logs
- ๐ Similarity Scoring: Ranked results with confidence scores
- ๐ Token Management: Secure HuggingFace authentication via UI
๐จ Modern UI/UX
- React + TypeScript: Type-safe frontend development
- Responsive Design: Works on desktop and mobile
- Real-time Updates: Live progress and status tracking
- Interactive Results: Expandable chunks with syntax highlighting
๐ Quick Start
Prerequisites
- Python 3.8+ with virtual environment
- Node.js 20.19+ and npm
- ๐ HuggingFace Account with access token
- ๐ฏ Gemma Model Access (request at google/gemma-2b)
1. Setup Backend
# Clone and setup Python environment
git clone <repository>
cd text-embeddings-test
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt2. Setup Frontend
cd frontend
npm install
cd ..3. Start Development Servers
# Option 1: Combined script (recommended)
python start_dev.py
# Option 2: Separate terminals
# Terminal 1: python -m uvicorn backend.api_server:app --reload
# Terminal 2: cd frontend && npm run dev4. Configure HuggingFace Authentication
- Get Your Token: Visit HF Settings โ Tokens
- Open the App: Navigate to http://localhost:5173
- Add Token: Click "Add Token" in the header bar
- Paste Token: Enter your
hf_your_token_here - Select Gemma: Choose Gemma models for advanced processing
5. Access Points
- ๐จ React UI: http://localhost:5173
- ๐ง API Backend: http://localhost:8000
- ๐ API Documentation: http://localhost:8000/docs
๐ Usage Workflow
- ๐ Configure Token - Add HuggingFace token in the header bar
- ๐ Upload Log File - Drag & drop GitLab CI/CD log files
- โ๏ธ Configure Processing - Set chunk size, overlap, and LLM filtering options
- ๐งน Process Logs - Two-stage pipeline: ANSI cleaning โ LLM error filtering
- ๐ง Generate Embeddings - Choose Gemma or Sentence Transformers
- ๐ Search & Analyze - Query logs with natural language
- ๐ Visualize Results - Explore patterns and insights
๐ ๏ธ Development
Backend Development
# Start API server with auto-reload
uvicorn backend.api_server:app --reload --port 8000
# Run tests
python run_tests.py
# Or: python -m pytest backend/tests/
# View API documentation
open http://localhost:8000/docsFrontend Development
cd frontend
# Start development server
npm run dev
# Build for production
npm run build
# Run linting
npm run lint๐ Project Structure
text-embeddings-test/
โโโ backend/ # ๐ Python Backend Module
โ โโโ tests/ # ๐งช Test Suite
โ โ โโโ README.md # Testing documentation
โ โ โโโ test_embeddings.py
โ โ โโโ test_llm_integration.py
โ โโโ README.md # Backend documentation
โ โโโ api_server.py # FastAPI REST API
โ โโโ log_processor.py # Basic log processing
โ โโโ llm_log_processor.py # LLM-based filtering
โ โโโ embedding_generator.py # Text embeddings
โโโ frontend/ # โ๏ธ React Frontend
โ โโโ README.md # Frontend documentation
โ โโโ src/components/ # React components
โ โโโ src/services/ # API integration
โ โโโ src/types/ # TypeScript definitions
โโโ README.md # ๐ This file (project overview)
โโโ requirements.txt # ๐ฆ Python dependencies
โโโ pytest.ini # ๐งช Test configuration
โโโ run_tests.py # ๐งช Test runner
โโโ start_dev.py # ๐ Development server๐๏ธ Technical Architecture
This project uses a modern, scalable architecture:
Key Benefits
- โ Modern Stack: React + FastAPI for optimal performance
- โ Type Safety: Full TypeScript support throughout
- โ Scalable: Modular architecture for easy expansion
- โ Fast: Client-side rendering with efficient API calls
๐ค Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make changes in the appropriate module (
backend/orfrontend/) - Add tests for new functionality
- Update relevant README files
- Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open a Pull Request
๐ License
This project is licensed under the MIT License.
๐ Acknowledgments
- Hugging Face for Transformers, Gemma models, and Sentence Transformers
- Google for the powerful Gemma language models
- FastAPI for the excellent Python web framework
- React and Vite for modern frontend tooling
- OpenAI and Anthropic for additional LLM capabilities
Happy Log Analysis! ๐
For detailed documentation:
- Backend: See `backend/README.md`
- Frontend: See `frontend/README.md`
- Testing: See `backend/tests/README.md`
