CoolFace
Apppublic

karthyks/text-embeddings-test

sourceHugging Facemitupdated 1y agoView on Hugging Face
0likes
App README

๐Ÿ” 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

bash
# 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.txt

2. Setup Frontend

bash
cd frontend
npm install
cd ..

3. Start Development Servers

bash
# 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 dev

4. Configure HuggingFace Authentication

  1. 1.Get Your Token: Visit HF Settings โ†’ Tokens
  2. 2.Open the App: Navigate to http://localhost:5173
  3. 3.Add Token: Click "Add Token" in the header bar
  4. 4.Paste Token: Enter your hf_your_token_here
  5. 5.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

  1. 1.๐Ÿ” Configure Token - Add HuggingFace token in the header bar
  2. 2.๐Ÿ“ Upload Log File - Drag & drop GitLab CI/CD log files
  3. 3.โš™๏ธ Configure Processing - Set chunk size, overlap, and LLM filtering options
  4. 4.๐Ÿงน Process Logs - Two-stage pipeline: ANSI cleaning โ†’ LLM error filtering
  5. 5.๐Ÿง  Generate Embeddings - Choose Gemma or Sentence Transformers
  6. 6.๐Ÿ” Search & Analyze - Query logs with natural language
  7. 7.๐Ÿ“Š Visualize Results - Explore patterns and insights

๐Ÿ› ๏ธ Development

Backend Development

bash
# 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/docs

Frontend Development

bash
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:

**Component****Technology****Purpose**
FrontendReact + TypeScriptModern, responsive user interface
BackendFastAPI + PythonHigh-performance REST API
ProcessingSentence TransformersAdvanced text embeddings
FilteringLocal/Cloud LLMsIntelligent log condensation
DatabaseIn-memoryFast semantic search

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

  1. 1.Fork the repository
  2. 2.Create a feature branch (git checkout -b feature/amazing-feature)
  3. 3.Make changes in the appropriate module (backend/ or frontend/)
  4. 4.Add tests for new functionality
  5. 5.Update relevant README files
  6. 6.Commit changes (git commit -m 'Add amazing feature')
  7. 7.Push to branch (git push origin feature/amazing-feature)
  8. 8.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`