Commit Graph

17 Commits

Author SHA1 Message Date
ef8bab5962 feat(benchmarking): add evaluation, benchmark service, and report
Why:
- Need LLM-as-Judge evaluation for automated scoring
- Need benchmark orchestration to run questions × strategies
- Need HTML report generation with two views (managerial/technical)

Changes:
- evaluation.py: LLM-as-Judge scoring on 4 metrics (context, similarity, faithfulness, hallucination)
- benchmark_service.py: Orchestration with per-strategy failure isolation
- report.py: Dual-view HTML reports with dark mode, charts, and strategy cards
2026-07-27 14:14:40 +03:30
d572724115 docs(data): add 21-question evaluation dataset for benchmarking
Why:
- Need standardized questions to evaluate chunking strategies
- Questions cover easy/medium/hard difficulty levels
- Golden answers enable automated scoring

Changes:
- 21 questions about engineering insurance (بیمه‌های مهندسی)
- 7 easy, 7 medium, 7 hard questions
- Categories: factual, procedural, comparative, complex
- Each question includes golden answer and expected keywords
2026-07-26 13:48:36 +03:30
b18ecdcd0c feat(api): add logging configuration and mount routers
Why:
- Need structured logging for debugging query pipeline
- Need to mount benchmarking router

Changes:
- Added logging.basicConfig() with INFO level
- Mounted benchmarking router
- Registered QueryError exception handler
2026-07-26 12:06:25 +03:30
cbaa72b420 feat(documents): add GET /documents endpoint and improve models
Why:
- Need to list documents to get document IDs for queries
- ProcessRequest should default to all 5 strategies
- paragraph_count should be optional (not always stored)

Changes:
- Added GET /documents endpoint with pagination
- Added DocumentListResponse model
- ProcessRequest now defaults to all 5 strategies
- DocumentResponse.paragraph_count now defaults to 0
2026-07-26 12:06:14 +03:30
496a58c62a feat(benchmarking): add query pipeline with logging and tracing
Why:
- Need query pipeline to ask questions against chunked documents
- Need comprehensive logging for debugging

Changes:
- Query service: embed question → vector search → LLM answer
- Query routes: POST /queries, GET /queries/{id}
- Query models: QueryRequest, QueryResponse, RetrievedChunk
- Added QueryError exception class
- Added STEP 1-6 logging for full traceability
2026-07-26 12:06:04 +03:30
b75fde8185 fix(models): add text field to ChunkMetadata for Qdrant storage
Why:
- Qdrant was storing only metadata, not chunk text
- Queries returned empty text in retrieved chunks
- Scores were low (~0.25) because embeddings were on empty strings

Changes:
- Added 'text' field to ChunkMetadata model
- Updated chunk_to_metadata() to copy text
2026-07-26 12:05:52 +03:30
292ae17cfa docs: add phases, tasks, and chunking strategies documentation
Why:
- Need implementation plan and task tracking documentation
- Need strategy explanations for reference

Changes:
- phases.md: 5-phase implementation plan with status tracking
- tasks.md: 25 tasks mapped to phases and steps
- chunking_strategies.md: detailed explanations of all 5 strategies
2026-07-26 09:38:08 +03:30
29edbf57c4 feat(api): wire documents router and SQLite init in app factory
Why:
- App factory needs to mount document routes and initialize SQLite at startup

Changes:
- Import and mount documents_router
- Call init_db() on app creation
2026-07-26 09:38:02 +03:30
8715d9c186 feat(strategies): implement all 5 chunking strategies
Why:
- Core evaluation targets — each strategy chunks differently for comparison

Changes:
- fixed_size: token-based splitting with overlap (baseline)
- recursive: cascade splitting (headers → newlines → sentences → words)
- semantic: sentence-level embeddings with similarity-based boundaries
- contextual_retrieval: LLM-generated context prefixes per chunk (Anthropic research)
- semantic_parent_child: paragraph clustering into parent-child hierarchy
2026-07-26 09:37:56 +03:30
143351b96b feat(chunking): add base strategy interface, embedding service, and orchestration
Why:
- Need abstract base class for all chunking strategies
- Need OpenAI embedding service (text-embedding-3-small)
- Need orchestration to run chunk → embed → store pipeline

Changes:
- Base: ChunkingStrategy ABC, token counting, chunk ID generation, sentence splitting
- Embedding: batch embedding with 2048 text limit per call
- Service: strategy registry, single/multi-strategy runners with per-strategy failure isolation
2026-07-26 09:37:46 +03:30
fdc21e3316 feat(documents): add document parser, service, and API routes
Why:
- Need to parse .docx/.doc files into DocumentTree + markdown
- Need API endpoints for document upload, processing, and deletion

Changes:
- Parser: .doc→.docx conversion via LibreOffice, XML-level extraction for table-heavy docs, heuristic heading detection
- Service: upload, process (delegates to chunking), delete orchestration
- Routes: POST /documents, POST /documents/{id}/process, DELETE /documents/{id}, GET /strategies
2026-07-26 09:37:40 +03:30
4aaaccec49 feat(storage): add SQLite and Qdrant storage layers
Why:
- SQLite stores structured data (documents, queries, experiments)
- Qdrant stores vector embeddings for similarity search

Changes:
- SQLite: schema init, document/query/experiment CRUD, JSON field parsing
- Qdrant: collection management, vector upsert, similarity search, delete operations
2026-07-26 09:37:32 +03:30
4f205a7ef7 feat(core): add StrategyName enum, DocumentTree models, and pagination helper
Why:
- StrategyName enum needed proper values for all 5 strategies
- DocumentTree models needed for document parser output
- PaginatedResponse needed for list endpoints

Changes:
- Renamed StrategyName values to match implementation (fixed_size, contextual_retrieval, semantic_parent_child)
- Added NodeType, DocumentTreeNode, DocumentTree models
- Added PaginatedResponse helper model
2026-07-26 09:37:24 +03:30
4edc355ae5 feat(core): add core layer with config, clients, exceptions, models, and app factory 2026-07-21 18:51:57 +03:30
c5bf8d5e1e build: add project configuration and environment template 2026-07-21 18:51:51 +03:30
09f9bb53bf docs: add domain glossary and architectural decision records
15 ADRs covering chunk model, failure handling, evaluation, parsing, directory structure, REST design, and strategy-specific decisions. 62 domain terms across 7 sections.
2026-07-21 18:51:46 +03:30
247ea0a16e Initial commit 2026-07-21 11:27:49 +03:30