{"openapi":"3.1.0","info":{"title":"MIVAA - Material Intelligence Vision and Analysis Agent","description":"\n**Production API v2.5.0** - AI-powered material recognition and knowledge management platform serving 5,000+ users.\n\n## 🎯 Overview\n\nMIVAA is the core backend service powering the Material Kai Vision Platform, providing comprehensive PDF processing, AI analysis, and multi-vector search capabilities.\n\n## ✨ API Organization (v2.3.0)\n\n**Comprehensive API with 125+ endpoints organized into 16 categories**\n\n**Key Features:**\n- ✅ **Knowledge Base**: `/api/kb/*` - Document management with AI embeddings, semantic search, PDF extraction, categories, and product attachments (NEW)\n- ✅ **Consolidated Upload**: `/api/rag/documents/upload` with processing modes (quick/standard/deep) and categories\n- 🎯 **Enhanced Multi-Vector Search**: 6 specialized CLIP embeddings + JSONB filtering + query understanding (ENABLED BY DEFAULT)\n- ✅ **10 Search Strategies**: `/api/rag/search?strategy={strategy}` - multi_vector (⭐ default), semantic, vector, hybrid, material, keyword, color, texture, style, material_type\n- ✅ **Query Understanding**: GPT-4o-mini auto-extracts filters from natural language ($0.0001/query, enabled by default)\n- ✅ **Comprehensive Health**: `/health` for all services (database, storage, AI models)\n- ✅ **Well-Organized**: 16 endpoint categories covering RAG, documents, search, AI services, admin, knowledge base, and more\n- ✅ **Preserved**: Prompt enhancement system, category extraction, all processing modes\n\n### Key Capabilities\n- **PDF Processing**: 14-stage pipeline with PyMuPDF4LLM extraction\n- **Products + Metadata**: Inseparable extraction (Stage 0A) - all metadata stored in product.metadata JSONB\n- **Document Entities**: Certificates, logos, specifications as separate knowledge base (Stage 0B)\n- **AI Analysis**: 13 AI models across 7 pipeline stages\n- 🎯 **Enhanced Multi-Vector Search**: 7 specialized embeddings (text 15%, visual 15%, understanding 20%, color 12.5%, texture 12.5%, style 12.5%, material 12.5%) + JSONB metadata filtering + query understanding\n- **Query Understanding**: GPT-4o-mini parses natural language queries to auto-extract filters (enabled by default)\n- **Knowledge Base**: Semantic chunking, quality scoring, deduplication\n- **Image Analysis**: SLIG + Qwen3-VL vision models (cost-effective, high accuracy)\n- **Agentic Queries**: Factory/group filtering for certificates, logos, specifications\n\n### AI Models\n1. **Voyage AI**: voyage-3.5 (1024D text embeddings), GPT-4o-mini (query understanding)\n2. **Anthropic**: Claude Haiku 4.5 (fast classification), Claude Sonnet 4.5 (deep enrichment)\n3. **HuggingFace Endpoint**: Qwen3-VL-32B-Instruct (vision analysis)\n4. **SigLIP2**: 5 specialized visual embeddings (visual, color, texture, style, material) - 768D each\n5. **Voyage AI**: voyage-3.5 (text + understanding embeddings, 1024D)\n\n### API Endpoints\n- **Total**: 125+ endpoints across 16 categories (18 legacy endpoints removed)\n- **Knowledge Base**: 15+ endpoints for document management, semantic search, PDF extraction, categories, product attachments (NEW)\n- **RAG System**: 27 endpoints for document upload, search, query, chat, embeddings, metadata\n- **AI Services**: 10 endpoints for classification, validation, boundary detection\n- **Admin**: 10 endpoints for chunk quality, extraction config, prompts\n- **Search**: 8 endpoints for semantic, image, material, multimodal search\n- **Jobs**: 7 endpoints for progress tracking, statistics, status\n- **Document Entities**: 5 endpoints for certificates, logos, specifications\n\n### Performance\n- **Search Accuracy**: 85%+ (90%+ with query understanding for complex queries)\n- **Processing Success**: 95%+\n- **Response Time**: 250-350ms (multi-vector with query understanding), 200-300ms (without), 1-4s (analysis)\n- **Query Understanding Cost**: $0.0001 per query (negligible)\n- **Uptime**: 99.5%+\n\n## 🔐 Authentication\n\nAll API endpoints require JWT authentication:\n```\nAuthorization: Bearer your-jwt-token\n```\n\nGet your token from the frontend application or Supabase authentication.\n\n## 📊 Latest Enhancements (November 2025)\n\n✅ **Knowledge Base System** - Complete documentation management with AI embeddings (NEW v2.3.0)\n  - Document CRUD with automatic embedding generation (1536D)\n  - Smart content change detection (only regenerate when needed)\n  - PDF text extraction using PyMuPDF\n  - Semantic search (vector similarity)\n  - Category hierarchy with parent/child relationships\n  - Product attachment system (link docs to products)\n  - Version history tracking\n  - Comments and suggestions system\n  - Search analytics tracking\n\n🎯 **Enhanced Multi-Vector Search** - MAJOR UPGRADE (v2.3.0, Nov 2025)\n  - **6 Specialized CLIP Embeddings**: text (20%), visual (20%), color (15%), texture (15%), style (15%), material (15%)\n  - **JSONB Metadata Filtering**: Property-based filtering (finish, properties, dimensions, etc.)\n  - **Query Understanding**: ✅ ENABLED BY DEFAULT - GPT-4o-mini auto-extracts filters from natural language\n  - **Performance**: ~250-350ms (with query understanding), ~200-300ms (without)\n  - **Accuracy**: 30-40% improvement for complex queries\n  - **Cost**: $0.0001 per query (negligible)\n  - **Example**: \"waterproof ceramic tiles for outdoor patio, matte finish\" → auto-extracts all filters\n\n✅ **10 Search Strategies** - Complete multi-strategy search system (100% implemented)\n  - Multi-Vector Search: ⭐ RECOMMENDED DEFAULT - 6 embeddings + filters + query understanding (~250ms)\n  - Semantic Search: Natural language with MMR diversity (<150ms)\n  - Vector Search: Pure similarity matching (<100ms)\n  - Hybrid Search: Semantic + PostgreSQL full-text (<180ms)\n  - Material Search: JSONB property filtering (<50ms)\n  - Image Search: Visual similarity with CLIP (<150ms)\n  - Color/Texture/Style/Material Type: Specialized CLIP embeddings (<150ms each)\n\n✅ **Product Detection Pipeline** - 60-70% false positive reduction with 4-layer validation\n✅ **Chunk Quality System** - Hash-based + semantic deduplication, quality scoring\n✅ **Two-Stage Classification** - 60% faster, 40% cost reduction\n✅ **Multi-Vector Embeddings** - 6 embedding types for 85%+ accuracy improvement\n✅ **Admin Dashboard** - Chunk quality monitoring and review workflow\n✅ **Metadata Synchronization** - 100% accuracy in job status reporting\n\n## 🚀 API Categories (125+ Endpoints)\n\n### 📚 Knowledge Base (`/api/kb/*`) - NEW v2.3.0\n- Document management with AI embeddings\n- Semantic search (vector similarity)\n- PDF text extraction (PyMuPDF)\n- Category hierarchy management\n- Product attachment system\n- Version history tracking\n- Comments and suggestions\n\n### 📄 PDF Processing (`/api/pdf/*`)\n- Extract markdown, tables, images from PDFs\n- PyMuPDF4LLM integration\n- Batch processing support\n\n### 🧠 RAG System (`/api/rag/*`)\n- Document upload and processing\n- Query and chat interfaces\n- Semantic search\n- Job monitoring with real-time progress\n\n### 🤖 AI Analysis (`/api/semantic-analysis`)\n- Vision model material analysis (configurable)\n- Multi-modal text + image processing\n- Entity extraction and classification\n\n### 🔍 Search APIs (`/api/search/*`)\n- Semantic search (text embeddings)\n- Vector search (multi-vector)\n- Hybrid search (combined)\n- Recommendations\n\n### 🔗 Embedding APIs (`/api/embeddings/*`)\n- Generate text embeddings (1024D Voyage AI)\n- Generate visual embeddings (768D SLIG)\n- Batch processing\n- Multi-vector generation (7 types)\n\n### 💬 Chat APIs (`/api/chat/*`)\n- Chat completions\n- Contextual responses\n- Conversation history\n\n### 📦 Products API (`/api/products/*`)\n- Two-stage product classification\n- Product enrichment\n- Product management\n- Health monitoring\n\n### 👨‍💼 Admin APIs (`/api/admin/*`)\n- Chunk quality dashboard\n- Quality statistics\n- Flagged chunks review\n- Metadata management\n\n### 🏷️ Metadata APIs (`/api/rag/metadata/*`)\n- Scope detection (product-specific vs catalog-general)\n- Metadata application with override logic\n- Metadata listing and filtering\n- Statistics and analytics\n\n### 🏥 Health & Monitoring\n- `/health` - Service health check\n- `/metrics` - Performance metrics\n- `/performance/summary` - Comprehensive stats\n\n## 📖 Documentation\n\n- **Interactive API Docs**: [/docs](/docs) (Swagger UI)\n- **Alternative Docs**: [/redoc](/redoc) (ReDoc)\n- **OpenAPI Schema**: [/openapi.json](/openapi.json)\n- **Complete Documentation**: https://basilakis.github.io\n\n## 🔗 Related Services\n\n- **Frontend**: https://materialshub.gr\n- **Documentation Site**: https://basilakis.github.io\n- **GitHub**: https://github.com/creativeghq/material-kai-vision-platform\n\n        ","version":"2.5.0","x-api-features":{"api_consolidation":"Consolidated and organized endpoints with clear categorization","consolidated_upload":"/api/rag/documents/upload with modes (quick/standard/deep) + categories","consolidated_search":"/api/rag/search with multi_vector strategy (default and only supported)","multi_vector_enhanced":"🎯 ENHANCED: 6 specialized CLIP embeddings (text 20%, visual 20%, color 15%, texture 15%, style 15%, material 15%) + JSONB metadata filtering + query understanding","query_understanding":"✅ ENABLED BY DEFAULT: GPT-4o-mini auto-extracts filters from natural language ($0.0001/query)","consolidated_health":"/health for all services (database, storage, AI models)","pdf_processing":"14-stage AI pipeline with checkpoint recovery","product_discovery":"Products + Metadata extraction (inseparable) - Stage 0A","document_entities":"Certificates, logos, specifications as separate knowledge base - Stage 0B","metadata_management":"Dynamic metadata extraction with scope detection and override logic - Stage 4","prompt_enhancement":"Admin templates + agent prompt enhancement (PRESERVED)","category_extraction":"Products, certificates, logos, specifications (PRESERVED)","rag_system":"Retrieval-Augmented Generation with enhanced multi-vector search","vector_search":"7 specialized embedding types (text, visual, understanding, color, texture, style, material)","search_strategies":"10 strategies: multi_vector (⭐ default), semantic, vector, hybrid, material, keyword, color, texture, style, material_type","ai_models":"13 models: Claude Sonnet 4.5, Haiku 4.5, GPT-4o-mini, Qwen3-VL-32B, SLIG, Voyage AI","material_recognition":"Qwen3-VL-8B-Instruct (configurable vision model)","embedding_models":"Voyage AI voyage-3.5 (1024D text + understanding), SLIG SigLIP2 (768D) for 5 visual embeddings","performance":"95%+ product detection, 85%+ search accuracy, 250-350ms response time (with query understanding)","scalability":"5,000+ users, 99.5%+ uptime","agentic_queries":"Factory/group filtering for certificates, logos, specifications"},"x-endpoint-categories":{"rag_routes":"/api/rag/* (25 endpoints) - Document upload, search, query, chat, embeddings, jobs, relationships, AI tracking","search_routes":"/api/search/* (16 endpoints) - Semantic, similarity, multimodal, image, material, color, texture, style search","price_monitoring_routes":"/api/v1/price-monitoring/* (13 endpoints) - Competitor price tracking, alerts, history, statistics","admin_routes":"/admin/* (10 endpoints) - Chunk quality, extraction config, prompts management","ai_services_routes":"/api/v1/ai-services/* (10 endpoints) - Classification, validation, boundary detection","internal_routes":"/api/internal/* (8 endpoints) - Modular pipeline stages (classify, upload, save, chunk, relationships, metadata)","images_routes":"/api/images/* (7 endpoints) - Image analysis, batch processing, search, upload, export, reclassify","health_routes":"/health/* (7 endpoints) - System health, database health, job monitor, metrics, circuit breakers","jobs_routes":"/api/jobs/* (7 endpoints) - Job progress, statistics, status tracking","document_entities_routes":"/api/document-entities/* (5 endpoints) - Certificates, logos, specifications","embeddings_routes":"/api/embeddings/* (4 endpoints) - CLIP text/image, material embeddings","ai_analysis_routes":"/api/semantic-analysis, /api/analyze/* (4 endpoints) - Qwen vision, multimodal analysis","anthropic_routes":"/api/v1/anthropic/* (3 endpoints) - Claude image validation, product enrichment","products_routes":"/api/products/* (3 endpoints) - Product creation from chunks/layout","monitoring_routes":"/, /metrics, /performance/summary (3 endpoints)","ai_metrics_routes":"/api/v1/ai-metrics/* (2 endpoints) - Job metrics, summary","web_scraping_routes":"/api/scraping/* (2 endpoints) - Firecrawl integration, web content to products","relationship_routes":"/api/rag/product-image-relationships, /api/rag/chunk-product-relationships (2 endpoints) - Relationship queries"},"x-platform-stats":{"total_endpoints":130,"endpoint_categories":18,"ai_models":13,"processing_stages":14,"embedding_types":6,"search_strategies":1,"specialized_clip_embeddings":6,"users":"5,000+","uptime":"99.5%+","version":"2.4.0","last_updated":"2025-01-20","latest_enhancement":"System Health Monitoring - Database connection pool health, job monitor status, query performance metrics (95-98% faster with indexes), circuit breaker pattern, retry logic with exponential backoff. Fixes Sentry issues MIVAA-4Z, MIVAA-51, MIVAA-50."}},"servers":[{"url":"http://localhost:8000","description":"Development server"},{"url":"https://mivaa.materialshub.gr","description":"Production server"}],"paths":{"/health":{"get":{"summary":"🏥 Unified Health Check - All Services","description":"Comprehensive health check for all system services including database, storage, and AI models. Use ?force_refresh=true to bypass cache.","operationId":"health_check_health_get","parameters":[{"name":"force_refresh","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Force Refresh"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/metrics":{"get":{"summary":"Performance Metrics","description":"Get current performance metrics and system status","operationId":"get_metrics_metrics_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","title":"Response Get Metrics Metrics Get"}}}}}}},"/performance/summary":{"get":{"summary":"Performance Summary","description":"Get performance summary with recommendations","operationId":"get_performance_summary_performance_summary_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","title":"Response Get Performance Summary Performance Summary Get"}}}}}}},"/":{"get":{"summary":"Service Information","description":"Get basic information about the PDF2Markdown microservice","operationId":"root__get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","title":"Response Root  Get"}}}}}}},"/health/":{"get":{"tags":["Health & Monitoring"],"summary":"Basic Health Check","description":"Quick health check to verify service is running. Returns 200 if service is operational.","operationId":"health_check_health__get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BasicHealthResponse"}}}},"500":{"description":"Internal server error"},"503":{"description":"Service unavailable"}}}},"/health/detailed":{"get":{"tags":["Health & Monitoring"],"summary":"Detailed System Health","description":"Comprehensive health check including database, job monitor, query metrics, and circuit breaker status.","operationId":"detailed_health_check_health_detailed_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DetailedHealthResponse"}}}},"500":{"description":"Internal server error"},"503":{"description":"Service unavailable"}}}},"/health/database":{"get":{"tags":["Health & Monitoring"],"summary":"Database Health","description":"Database connection pool health and performance metrics","operationId":"database_health_health_database_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","title":"Response Database Health Health Database Get"}}}},"500":{"description":"Internal server error"},"503":{"description":"Service unavailable"}}}},"/health/job-monitor":{"get":{"tags":["Health & Monitoring"],"summary":"Job Monitor Health","description":"Job monitoring service status and stuck job detection","operationId":"job_monitor_health_health_job_monitor_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","title":"Response Job Monitor Health Health Job Monitor Get"}}}},"500":{"description":"Internal server error"},"503":{"description":"Service unavailable"}}}},"/health/metrics":{"get":{"tags":["Health & Monitoring"],"summary":"Query Performance Metrics","description":"Database query performance statistics and slow query tracking","operationId":"performance_metrics_health_metrics_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QueryMetricsResponse"}}}},"500":{"description":"Internal server error"},"503":{"description":"Service unavailable"}}}},"/health/circuit-breakers":{"get":{"tags":["Health & Monitoring"],"summary":"Circuit Breaker Status","description":"Circuit breaker states for all protected services","operationId":"circuit_breaker_status_health_circuit_breakers_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":{"$ref":"#/components/schemas/CircuitBreakerState"},"type":"object","title":"Response Circuit Breaker Status Health Circuit Breakers Get"}}}},"500":{"description":"Internal server error"},"503":{"description":"Service unavailable"}}}},"/health/metrics/reset":{"post":{"tags":["Health & Monitoring"],"summary":"Reset Query Metrics","description":"Reset query performance metrics (admin only)","operationId":"reset_metrics_health_metrics_reset_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":{"type":"string"},"type":"object","title":"Response Reset Metrics Health Metrics Reset Post"}}}},"500":{"description":"Internal server error"},"503":{"description":"Service unavailable"}}}},"/api/search/semantic":{"post":{"tags":["Search","Embeddings","Chat"],"summary":"Semantic search across documents","description":"Perform semantic search across multiple documents using vector similarity","operationId":"semantic_search_api_search_semantic_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SemanticSearchRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SemanticSearchResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/search/similarity":{"post":{"tags":["Search","Embeddings","Chat"],"summary":"Vector similarity search","description":"Find documents similar to a given text using vector embeddings","operationId":"similarity_search_api_search_similarity_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SimilaritySearchRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SimilaritySearchResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/search/health":{"get":{"tags":["Search","Embeddings","Chat"],"summary":"Search service health check","description":"Check the health and availability of search and RAG services","operationId":"search_health_check_api_search_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}}}}},"/api/search/multimodal":{"post":{"tags":["Search","Embeddings","Chat"],"summary":"Multi-modal search across documents","description":"Perform advanced multi-modal search across text and images with OCR support","operationId":"multimodal_search_api_search_multimodal_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__schemas__search__SearchRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__schemas__search__SearchResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/query/multimodal":{"post":{"tags":["Search","Embeddings","Chat"],"summary":"Multi-modal RAG query","description":"Query documents using multi-modal RAG with text and image context","operationId":"multimodal_query_api_query_multimodal_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__schemas__search__QueryRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__schemas__search__QueryResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/search/images":{"post":{"tags":["Search","Embeddings","Chat"],"summary":"Image-specific search","description":"Search specifically within document images using visual analysis and OCR","operationId":"image_search_api_search_images_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__schemas__search__ImageSearchRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__schemas__search__ImageSearchResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/analyze/multimodal":{"post":{"tags":["Search","Embeddings","Chat"],"summary":"Comprehensive multi-modal document analysis","description":"Perform comprehensive analysis of document content including text, images, and structure","operationId":"multimodal_analysis_api_analyze_multimodal_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MultiModalAnalysisRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MultiModalAnalysisResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/search/materials/visual":{"post":{"tags":["Search","Embeddings","Chat"],"summary":"Material-specific visual search","description":"Perform visual search with material property filtering and analysis","operationId":"material_visual_search_api_search_materials_visual_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MaterialSearchRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MaterialSearchResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/analyze/materials/image":{"post":{"tags":["Search","Embeddings","Chat"],"summary":"Analyze material image","description":"Analyze a material image using integrated visual analysis","operationId":"analyze_material_image_api_analyze_materials_image_post","requestBody":{"content":{"application/json":{"schema":{"type":"object","title":"Request"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/embeddings/materials/generate":{"post":{"tags":["Search","Embeddings","Chat"],"summary":"Generate material embeddings","description":"Generate CLIP and custom embeddings for material images","operationId":"generate_material_embeddings_api_embeddings_materials_generate_post","requestBody":{"content":{"application/json":{"schema":{"type":"object","title":"Request"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/search/materials/{material_id}/similar":{"get":{"tags":["Search","Embeddings","Chat"],"summary":"Find similar materials","description":"Find materials similar to a reference material using visual and property analysis","operationId":"find_similar_materials_api_search_materials__material_id__similar_get","parameters":[{"name":"material_id","in":"path","required":true,"schema":{"type":"string","title":"Material Id"}},{"name":"similarity_threshold","in":"query","required":false,"schema":{"type":"number","maximum":1.0,"minimum":0.0,"description":"Minimum similarity threshold","default":0.75,"title":"Similarity Threshold"},"description":"Minimum similarity threshold"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"description":"Maximum number of results","default":20,"title":"Limit"},"description":"Maximum number of results"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/search/materials/health":{"get":{"tags":["Search","Embeddings","Chat"],"summary":"Material visual search health check","description":"Check health and availability of material visual search services","operationId":"material_search_health_check_api_search_materials_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}}}}},"/api/search/by-color":{"post":{"tags":["Search","Embeddings","Chat"],"summary":"Search images by color palette","description":"Search for images with similar color palettes using specialized SLIG embeddings","operationId":"search_by_color_api_search_by_color_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__schemas__search__ImageSearchRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__schemas__search__ImageSearchResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/search/by-texture":{"post":{"tags":["Search","Embeddings","Chat"],"summary":"Search images by texture pattern","description":"Search for images with similar textures using specialized SLIG embeddings","operationId":"search_by_texture_api_search_by_texture_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__schemas__search__ImageSearchRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__schemas__search__ImageSearchResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/search/by-style":{"post":{"tags":["Search","Embeddings","Chat"],"summary":"Search images by design style","description":"Search for images with similar design styles using specialized SLIG embeddings","operationId":"search_by_style_api_search_by_style_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__schemas__search__ImageSearchRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__schemas__search__ImageSearchResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/search/by-material":{"post":{"tags":["Search","Embeddings","Chat"],"summary":"Search images by material type","description":"Search for images with similar material types using specialized SLIG embeddings","operationId":"search_by_material_api_search_by_material_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__schemas__search__ImageSearchRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__schemas__search__ImageSearchResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/images/analyze":{"post":{"tags":["Image Analysis"],"summary":"Analyze Image","description":"**🔍 Image Analysis - AI-Powered Visual Understanding**\n\nAnalyze images using Qwen3-VL 17B Vision model for comprehensive visual understanding.\n\n## 🎯 Analysis Types\n\n- **description**: Generate natural language description of the image\n- **ocr**: Extract text from the image using OCR\n- **objects**: Detect and identify objects in the image\n- **materials**: Identify materials and their properties\n- **quality**: Assess image quality and technical specifications\n- **all**: Run all analysis types\n\n## 📝 Request Example\n\n```json\n{\n  \"image_url\": \"https://example.com/product.jpg\",\n  \"analysis_types\": [\"description\", \"materials\", \"quality\"],\n  \"confidence_threshold\": 0.7\n}\n```\n\nOr use existing image ID:\n```json\n{\n  \"image_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n  \"analysis_types\": [\"all\"]\n}\n```\n\n## ✅ Response Example\n\n```json\n{\n  \"image_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n  \"analysis_results\": {\n    \"description\": \"Modern oak dining table with minimalist design\",\n    \"materials\": [\"oak wood\", \"metal legs\"],\n    \"quality_score\": 0.92,\n    \"ocr_text\": \"NOVA Collection - Premium Oak\",\n    \"objects\": [\"table\", \"chair\", \"lamp\"]\n  },\n  \"confidence_scores\": {\n    \"description\": 0.95,\n    \"materials\": 0.88,\n    \"quality\": 0.92\n  },\n  \"processing_time\": 1.23,\n  \"model_used\": \"Qwen/Qwen3-VL-8B-Instruct\"\n}\n```\n\n## ⚠️ Error Codes\n\n- **400 Bad Request**: Invalid parameters (missing image_id/image_url, invalid analysis types)\n- **404 Not Found**: Image ID not found in database\n- **413 Payload Too Large**: Image exceeds size limit (10MB)\n- **415 Unsupported Media Type**: Unsupported image format\n- **500 Internal Server Error**: AI analysis failed\n- **503 Service Unavailable**: Vision model not available\n\n## 📏 Limits\n\n- **Max image size**: 10MB\n- **Supported formats**: JPEG, PNG, WebP\n- **Max concurrent requests**: 10 per user\n- **Timeout**: 30 seconds per image","operationId":"analyze_image_api_images_analyze_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImageAnalysisRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImageAnalysisResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/images/analyze/batch":{"post":{"tags":["Image Analysis"],"summary":"Analyze Batch Images","description":"Analyze multiple images in batch using Material Kai Vision Platform.\n\nSupports parallel processing for improved performance.","operationId":"analyze_batch_images_api_images_analyze_batch_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImageBatchRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImageBatchResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/images/search":{"post":{"tags":["Image Analysis"],"summary":"Search Similar Images","description":"Search for similar images using visual similarity or description matching.\n\nSupports both image-to-image and text-to-image search.","operationId":"search_similar_images_api_images_search_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__schemas__images__ImageSearchRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__schemas__images__ImageSearchResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/images/upload-and-analyze":{"post":{"tags":["Image Analysis"],"summary":"Upload And Analyze Image","description":"Upload and analyze an image file in a single request.\n\nSupports various analysis types and returns comprehensive results.","operationId":"upload_and_analyze_image_api_images_upload_and_analyze_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_upload_and_analyze_image_api_images_upload_and_analyze_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImageAnalysisResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/images/health":{"get":{"tags":["Image Analysis"],"summary":"Health Check","description":"Check the health status of the image processing service.\n\nReturns status of Material Kai integration and database connectivity.","operationId":"health_check_api_images_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BaseResponse"}}}}}}},"/api/images/export/{document_id}":{"post":{"tags":["Image Analysis"],"summary":"Export Document Images","description":"**📦 Batch Image Export - Streaming ZIP Generation**\n\nExport all images from a document as a ZIP archive with memory-safe streaming.\n\n## 🎯 Features\n\n- **Streaming Implementation**: Constant 5-10MB memory usage regardless of image count\n- **Format Conversion**: Support for PNG, JPEG, WEBP\n- **Metadata Included**: Complete image metadata in JSON format\n- **Memory Safe**: Processes one image at a time, no OOM risk\n\n## 📝 Request Example\n\n```bash\ncurl -X POST \"/api/images/export/{document_id}?format=PNG&quality=95\" \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -o images.zip\n```\n\n## ✅ Response\n\nReturns a ZIP file containing:\n- All document images (renamed sequentially)\n- metadata.json with image details\n\n## 📊 Performance\n\n| Images | Total Size | Memory Usage | Time | Safe? |\n|--------|-----------|--------------|------|-------|\n| 10 | 5 MB | 5 MB | 2s | ✅ |\n| 50 | 25 MB | 5 MB | 10s | ✅ |\n| 100 | 50 MB | 5 MB | 20s | ✅ |\n| 500 | 250 MB | 10 MB | 100s | ✅ |\n\n## ⚠️ Error Codes\n\n- **400 Bad Request**: Invalid parameters (unsupported format, invalid quality)\n- **404 Not Found**: Document not found or no images\n- **413 Payload Too Large**: Too many images (>500) or size exceeds 500MB\n- **500 Internal Server Error**: ZIP generation failed\n- **503 Service Unavailable**: Storage service unavailable\n\n## 📏 Limits\n\n- **Max images**: 500 per export\n- **Max ZIP size**: 500 MB\n- **Supported formats**: PNG, JPEG, WEBP\n- **Rate limit**: 5 exports/hour per user","operationId":"export_document_images_api_images_export__document_id__post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"document_id","in":"path","required":true,"schema":{"type":"string","title":"Document Id"}},{"name":"format","in":"query","required":false,"schema":{"type":"string","description":"Image format: PNG, JPEG, WEBP","default":"PNG","title":"Format"},"description":"Image format: PNG, JPEG, WEBP"},{"name":"quality","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"description":"Image quality (1-100)","default":95,"title":"Quality"},"description":"Image quality (1-100)"},{"name":"include_metadata","in":"query","required":false,"schema":{"type":"boolean","description":"Include metadata.json in ZIP","default":true,"title":"Include Metadata"},"description":"Include metadata.json in ZIP"},{"name":"max_images","in":"query","required":false,"schema":{"type":"integer","maximum":500,"minimum":1,"description":"Maximum images to export","default":500,"title":"Max Images"},"description":"Maximum images to export"}],"responses":{"200":{"description":"ZIP file containing exported images","content":{"application/json":{"schema":{}},"application/zip":{}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/images/reclassify/{image_id}":{"post":{"tags":["Image Analysis"],"summary":"Reclassify Image","description":"**🔄 Re-classify Image - Trigger AI Re-classification**\n\nRe-run the material vs non-material classification on a specific image.\n\nThis endpoint:\n1. Fetches the image from document_images table\n2. Downloads the image from Supabase Storage\n3. Re-runs Qwen Vision classification\n4. Optionally validates with secondary model (Qwen-32B or Claude)\n5. Updates the database with new classification results\n\nArgs:\n    image_id: UUID of the image to re-classify\n    force_validation: If True, always validate with secondary model\n\nReturns:\n    Updated classification results","operationId":"reclassify_image_api_images_reclassify__image_id__post","parameters":[{"name":"image_id","in":"path","required":true,"schema":{"type":"string","title":"Image Id"}},{"name":"force_validation","in":"query","required":false,"schema":{"type":"boolean","description":"Force validation with secondary model regardless of confidence","default":false,"title":"Force Validation"},"description":"Force validation with secondary model regardless of confidence"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImageReclassifyResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/images/segment":{"post":{"tags":["Image Analysis"],"summary":"Segment Image","description":"**🔍 Material Zone Segmentation**\n\nDetect distinct material surfaces in a 3D rendered image using Qwen3-VL.\nReturns bounding boxes (relative 0–1) + metadata per zone.\n\nAccepts either `image_url` (fetched server-side, no CORS issues) or\n`image_base64` (raw base64 without data URI prefix).","operationId":"segment_image_api_images_segment_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SegmentRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SegmentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/jobs":{"get":{"tags":["Health & Monitoring"],"summary":"List Jobs","description":"List all jobs with optional filtering and pagination\n\n- **status**: Filter jobs by status (pending, running, completed, failed, cancelled)\n- **job_type**: Filter jobs by type (document_processing, bulk_processing, etc.)\n- **limit**: Number of jobs to return (default: 50, max: 100)\n- **offset**: Number of jobs to skip for pagination","operationId":"list_jobs_api_jobs_get","parameters":[{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by job status","title":"Status"},"description":"Filter by job status"},{"name":"job_type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by job type","title":"Job Type"},"description":"Filter by job type"},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1,"title":"Page"}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Page Size"}},{"name":"sort_by","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sort By"}},{"name":"sort_order","in":"query","required":false,"schema":{"anyOf":[{"type":"string","pattern":"^(asc|desc)$"},{"type":"null"}],"default":"desc","title":"Sort Order"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/jobs/statistics":{"get":{"tags":["Health & Monitoring"],"summary":"Get Job Statistics","description":"Get comprehensive job statistics and metrics","operationId":"get_job_statistics_api_jobs_statistics_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","title":"Response Get Job Statistics Api Jobs Statistics Get"}}}}}}},"/api/jobs/health":{"get":{"tags":["Health & Monitoring"],"summary":"Jobs Health Check","description":"Health check endpoint for the jobs subsystem.\nPrevents /jobs/{job_id} from catching health-check probes that hit /api/jobs/health.","operationId":"jobs_health_check_api_jobs_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataResponse"}}}}}}},"/api/jobs/{job_id}":{"get":{"tags":["Health & Monitoring"],"summary":"Get Job Status","description":"Get detailed status information for a specific job\n\n- **job_id**: Unique identifier for the job","operationId":"get_job_status_api_jobs__job_id__get","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobStatusResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["Health & Monitoring"],"summary":"Cancel Job","description":"Cancel a running job and optionally clean up partial data.\n\nThis endpoint will:\n1. Mark the job as cancelled in the database\n2. The heartbeat check will detect the cancellation and raise CancelledError\n3. The processing function will catch CancelledError and stop immediately\n4. If cleanup=True, delete all partial data (chunks, embeddings, images, products, files)\n\nArgs:\n    job_id: Unique identifier for the job to cancel\n    cleanup: If True, delete all partial data created by the job (default: True)\n\nReturns:\n    Success message with cleanup statistics if cleanup was performed","operationId":"cancel_job_api_jobs__job_id__delete","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}},{"name":"cleanup","in":"query","required":false,"schema":{"type":"boolean","description":"Clean up partial data created by the job","default":true,"title":"Cleanup"},"description":"Clean up partial data created by the job"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/jobs/{job_id}/status":{"get":{"tags":["Health & Monitoring"],"summary":"Get Job Status Alt","description":"Get detailed status information for a specific job (alternative endpoint)\n\n- **job_id**: Unique identifier for the job","operationId":"get_job_status_alt_api_jobs__job_id__status_get","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/system/health":{"get":{"tags":["Health & Monitoring"],"summary":"Get System Health","description":"Get comprehensive system health status","operationId":"get_system_health_api_system_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SystemHealthResponse"}}}}}}},"/api/system/metrics":{"get":{"tags":["Health & Monitoring"],"summary":"Get System Metrics","description":"Get detailed system performance metrics","operationId":"get_system_metrics_api_system_metrics_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SystemMetricsResponse"}}}}}}},"/api/data/cleanup":{"delete":{"tags":["Health & Monitoring"],"summary":"Cleanup Old Data","description":"Clean up old data from the system\n\n- **days_old**: Delete data older than this many days (default: 30)\n- **dry_run**: Preview what would be deleted without actually deleting (default: true)","operationId":"cleanup_old_data_api_data_cleanup_delete","parameters":[{"name":"days_old","in":"query","required":false,"schema":{"type":"integer","description":"Delete data older than this many days","default":30,"title":"Days Old"},"description":"Delete data older than this many days"},{"name":"dry_run","in":"query","required":false,"schema":{"type":"boolean","description":"Preview what would be deleted without actually deleting","default":true,"title":"Dry Run"},"description":"Preview what would be deleted without actually deleting"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CleanupResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/data/backup":{"post":{"tags":["Health & Monitoring"],"summary":"Create Data Backup","description":"Create a backup of system data","operationId":"create_data_backup_api_data_backup_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CleanupResponse"}}}}}}},"/api/data/export":{"get":{"tags":["Health & Monitoring"],"summary":"Export System Data","description":"Export system data in various formats\n\n- **format**: Export format (json, csv)\n- **data_type**: Type of data to export (jobs, metrics)","operationId":"export_system_data_api_data_export_get","parameters":[{"name":"format","in":"query","required":false,"schema":{"type":"string","description":"Export format (json, csv)","default":"json","title":"Format"},"description":"Export format (json, csv)"},{"name":"data_type","in":"query","required":false,"schema":{"type":"string","description":"Type of data to export (jobs, metrics)","default":"jobs","title":"Data Type"},"description":"Type of data to export (jobs, metrics)"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CleanupResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/system/cleanup-temp-files":{"post":{"tags":["Health & Monitoring"],"summary":"Cleanup Temp Files","description":"Clean up temporary files system-wide.\n\nCleans up:\n- PDF files in /tmp (*.pdf)\n- pdf_processor folders in /tmp\n- Files in /var/www/mivaa-pdf-extractor/output\n- __pycache__ folders\n- Old files in /tmp/pdf_processing, /tmp/image_extraction, etc.\n\nArgs:\n    max_age_hours: Maximum age of files to keep (default: 24 hours)\n    dry_run: If True, only report what would be deleted without actually deleting (default: True)\n\nReturns:\n    Cleanup statistics including files deleted and space freed","operationId":"cleanup_temp_files_api_system_cleanup_temp_files_post","parameters":[{"name":"max_age_hours","in":"query","required":false,"schema":{"type":"integer","description":"Maximum age of files to keep in hours","default":24,"title":"Max Age Hours"},"description":"Maximum age of files to keep in hours"},{"name":"dry_run","in":"query","required":false,"schema":{"type":"boolean","description":"Preview what would be deleted without actually deleting","default":true,"title":"Dry Run"},"description":"Preview what would be deleted without actually deleting"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CleanupResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/packages/status":{"get":{"tags":["Health & Monitoring"],"summary":"Get Package Status","description":"Get the status of all system packages and dependencies.\n\nReturns package information for both critical and optional dependencies,\nincluding version information and availability status.","operationId":"get_package_status_api_packages_status_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PackageStatusResponse"}}}}}}},"/api/jobs/{job_id}/products":{"get":{"tags":["Health & Monitoring"],"summary":"Get Job Product Progress","description":"Get product-level progress for a PDF processing job.\n\nReturns detailed progress for each product including:\n- Product name and index\n- Current status (pending, processing, completed, failed)\n- Current processing stage\n- Completed stages list\n- Metrics (chunks, images, relationships)\n- Error messages if failed\n- Processing time","operationId":"get_job_product_progress_api_jobs__job_id__products_get","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/test-product-creation":{"post":{"tags":["Health & Monitoring"],"summary":"Test Product Creation","description":"✅ NEW: Test endpoint for enhanced product creation.\nTests the improved product detection with no limits and better filtering.","operationId":"test_product_creation_api_test_product_creation_post","parameters":[{"name":"document_id","in":"query","required":true,"schema":{"type":"string","title":"Document Id"}},{"name":"workspace_id","in":"query","required":false,"schema":{"type":"string","title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductTestResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/images/{image_id}/process-ocr":{"post":{"tags":["Health & Monitoring"],"summary":"Reprocess Image Ocr","description":"Manually reprocess a single image with OCR and update all related entities.\n\nThis endpoint is used when an image was skipped during initial processing\nbut the admin determines it should have OCR applied.\n\nProcess:\n1. Run full EasyOCR on the image\n2. Update image.ocr_extracted_text and ocr_confidence_score\n3. Update related chunks with new OCR text\n4. Regenerate text embeddings for updated chunks\n5. Update product associations based on new OCR text\n6. Update metadata relationships\n\nArgs:\n    image_id: UUID of the image to reprocess\n    workspace_context: Current workspace context\n    current_user: Current admin user\n    \nReturns:\n    Comprehensive results of the reprocessing operation","operationId":"reprocess_image_ocr_api_admin_images__image_id__process_ocr_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"image_id","in":"path","required":true,"schema":{"type":"string","title":"Image Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OCRProcessResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/regenerate-image-embeddings":{"post":{"tags":["Health & Monitoring"],"summary":"Queue Regenerate Image Embeddings","description":"Queue a background job to regenerate visual embeddings for existing images.\n\nThis endpoint queues an async job that will:\n1. Fetch existing images from document_images table\n2. Download images from Supabase Storage\n3. Generate 5 CLIP embeddings per image (visual, color, texture, style, material)\n4. Save embeddings to VECS collections\n\n**Use Cases:**\n- Fix missing embeddings from old PDF processing\n- Regenerate embeddings after model upgrades\n- Bulk embedding generation for imported images\n\n**Example Request:**\n```json\n{\n  \"document_id\": \"doc-123\",  // Optional: limit to specific document\n  \"image_ids\": [\"img-1\", \"img-2\"],  // Optional: specific images\n  \"force_regenerate\": false,  // Optional: regenerate even if embeddings exist\n  \"priority\": 0  // Optional: job priority (0 = normal)\n}\n```\n\nArgs:\n    request: Request with optional document_id, image_ids, force_regenerate, priority\n    workspace_context: Current workspace context (auto-injected)\n    current_user: Current user (auto-injected)\n\nReturns:\n    RegenerateImageEmbeddingsJobResponse with job_id","operationId":"queue_regenerate_image_embeddings_api_regenerate_image_embeddings_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegenerateImageEmbeddingsJobRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegenerateImageEmbeddingsJobResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/rag/documents/upload":{"post":{"tags":["Documents"],"summary":"Upload Document","description":"**🎯 CONSOLIDATED UPLOAD ENDPOINT - Single Entry Point for All Upload Scenarios**\n\nThis endpoint replaces:\n- `/api/documents/process` (simple extraction)\n- `/api/documents/process-url` (URL processing)\n- `/api/documents/upload` (old unified upload)\n\n## 🎨 Category-Based Extraction\n\nControl what gets extracted:\n- `categories=\"products\"` - Extract only products\n- `categories=\"certificates\"` - Extract only certificates\n- `categories=\"logos\"` - Extract only logos\n- `categories=\"specifications\"` - Extract only specifications\n- `categories=\"products,certificates\"` - Extract multiple categories\n- `categories=\"all\"` - Extract everything (default - comprehensive deep analysis)\n- `categories=\"extract_only\"` - Just extract text/images, no categorization\n\n**Processing:** All uploads use deep processing mode with:\n- Complete AI analysis with all models\n- Image embeddings (CLIP)\n- Advanced product enrichment\n- Quality validation\n- Full RAG pipeline\n\n## 🌐 URL Processing\n\nUpload from URL instead of file:\n- Set `file_url=\"https://example.com/catalog.pdf\"`\n- Leave `file` parameter empty\n- System downloads and processes automatically\n\n## 🤖 AI Model Selection\n\nChoose discovery model:\n- `discovery_model=\"claude-vision\"` - Claude Sonnet 4.5 Vision (best quality, RECOMMENDED)\n- `discovery_model=\"gpt-vision\"` - GPT-4o Vision (fast, good quality)\n- `discovery_model=\"claude-haiku-vision\"` - Claude Haiku Vision (fastest, lower cost)\n\n## 💬 Agent Prompts\n\nUse natural language instructions:\n- `agent_prompt=\"extract all products\"` - Enhanced with product extraction details\n- `agent_prompt=\"search for NOVA\"` - Enhanced with search context\n- `agent_prompt=\"find certificates\"` - Enhanced with certificate extraction details\n\n## ✅ Response Example\n\n```json\n{\n  \"job_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n  \"document_id\": \"660e8400-e29b-41d4-a716-446655440001\",\n  \"status\": \"pending\",\n  \"message\": \"Document upload successful. Processing started.\",\n  \"status_url\": \"/api/rag/documents/job/550e8400-e29b-41d4-a716-446655440000\",\n  \"processing_mode\": \"standard\",\n  \"categories\": [\"products\", \"certificates\"],\n  \"estimated_time\": \"2-5 minutes\"\n}\n```\n\n## ⚠️ Error Codes\n\n- **400 Bad Request**: Invalid parameters (missing file/URL, invalid mode, unsupported file type)\n- **401 Unauthorized**: Missing or invalid authentication\n- **413 Payload Too Large**: File exceeds size limit (100MB)\n- **415 Unsupported Media Type**: Non-PDF file uploaded\n- **500 Internal Server Error**: Processing initialization failed\n- **503 Service Unavailable**: Background job queue full\n\n## 📏 Limits\n\n- **Max file size**: 100MB\n- **Max concurrent jobs**: 5 per workspace\n- **Supported formats**: PDF only\n- **URL download timeout**: 60 seconds","operationId":"upload_document_api_rag_documents_upload_post","requestBody":{"content":{"multipart/form-data":{"schema":{"allOf":[{"$ref":"#/components/schemas/Body_upload_document_api_rag_documents_upload_post"}],"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/rag/documents/job/{job_id}":{"get":{"tags":["Documents"],"summary":"Get Job Status","description":"Get the status of an async document processing job with checkpoint information.\n\nALWAYS queries the database first as the source of truth, then optionally merges\nwith in-memory data for additional real-time details.\n\nReturns:\n    - Job status and progress (from database)\n    - Latest checkpoint information\n    - Detailed metadata including AI usage, chunks, images, products\n    - In-memory state comparison (if available)","operationId":"get_job_status_api_rag_documents_job__job_id__get","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobInfoResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/rag/jobs/{job_id}/checkpoints":{"get":{"tags":["Documents"],"summary":"Get Job Checkpoints","description":"Get all checkpoints for a job.\n\nReturns:\n    - List of all checkpoints with stage, data, and metadata\n    - Checkpoint count\n    - Processing timeline","operationId":"get_job_checkpoints_api_rag_jobs__job_id__checkpoints_get","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckpointListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/rag/jobs/{job_id}/restart":{"post":{"tags":["Documents"],"summary":"Restart Job From Checkpoint","description":"Manually restart a job from its last checkpoint.\n\nThis endpoint allows manual recovery of stuck or failed jobs.\nThe job will resume from the last successful checkpoint.","operationId":"restart_job_from_checkpoint_api_rag_jobs__job_id__restart_post","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/rag/documents/job/{job_id}/resume":{"post":{"tags":["Documents"],"summary":"Resume Job","description":"Resume a job from its last checkpoint (alias for restart).\n\nThis endpoint is the same as /jobs/{job_id}/restart but with a more intuitive name.","operationId":"resume_job_api_rag_documents_job__job_id__resume_post","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/rag/documents/{document_id}/reprocess":{"post":{"tags":["RAG"],"summary":"Reprocess Document","description":"Full Stage 0→4.7 reprocess of an existing document without re-uploading\nthe PDF. Use this to validate pipeline changes against a known document.\n\nFlow:\n  1. Find the latest background_jobs row for this document_id.\n  2. Resolve the PDF on disk (from /tmp/pdf_processor_{doc_id}/).\n  3. If `clear_intermediate=True` (default): delete derived data\n     (products, chunks, images, checkpoints, catalog_layout,\n     catalog_legends) so the new run starts from a clean slate.\n     The `documents` row itself is preserved.\n  4. Create a NEW background_jobs row (status=pending, progress=0).\n  5. Launch `process_document_with_discovery()` as a background task.\n  6. Return the new job_id + handoff URL for the monitor.\n\nQuery params:\n  clear_intermediate (bool, default True): whether to wipe derived data.\n    Set False for a \"resume fresh\" that just starts a new job against\n    existing intermediate state — useful if you want to test idempotency.","operationId":"reprocess_document_api_rag_documents__document_id__reprocess_post","parameters":[{"name":"document_id","in":"path","required":true,"schema":{"type":"string","title":"Document Id"}},{"name":"clear_intermediate","in":"query","required":false,"schema":{"type":"boolean","default":true,"title":"Clear Intermediate"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/rag/documents/jobs":{"get":{"tags":["Documents"],"summary":"List Jobs","description":"List all background jobs with optional filtering and sorting.\n\nArgs:\n    limit: Maximum number of jobs to return (default: 10)\n    offset: Number of jobs to skip (default: 0)\n    status_filter: Filter by status (pending, processing, completed, failed, interrupted)\n    sort: Sort order (created_at:desc, created_at:asc, progress:desc, progress:asc)\n\nReturns:\n    List of jobs with status, progress, and metadata","operationId":"list_jobs_api_rag_documents_jobs_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":10,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Offset"}},{"name":"status_filter","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status Filter"}},{"name":"sort","in":"query","required":false,"schema":{"type":"string","default":"created_at:desc","title":"Sort"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListDataResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/rag/documents/jobs/{job_id}":{"delete":{"tags":["Documents"],"summary":"Delete Job","description":"Delete a job and ALL its associated data.\n\nThis endpoint performs complete cleanup including:\n1. Job record from background_jobs table\n2. Document record (if exists)\n3. All chunks from document_chunks\n4. All embeddings from vecs collections\n5. All images from document_images\n6. All products\n7. Files from storage buckets\n8. Checkpoints\n9. Temporary files\n10. In-memory job_storage\n\nArgs:\n    job_id: The unique identifier of the job to delete\n\nReturns:\n    Success message with deletion statistics\n\nRaises:\n    HTTPException: If job not found or deletion fails","operationId":"delete_job_api_rag_documents_jobs__job_id__delete","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/rag/chunks":{"get":{"tags":["RAG"],"summary":"Get Chunks","description":"Get chunks for a document with embeddings.\n\nArgs:\n    document_id: Document ID to filter chunks\n    limit: Maximum number of chunks to return\n    offset: Pagination offset\n    include_embeddings: Whether to include embeddings (default: True)\n\nReturns:\n    List of chunks with metadata and embeddings","operationId":"get_chunks_api_rag_chunks_get","parameters":[{"name":"document_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by document ID","title":"Document Id"},"description":"Filter by document ID"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"description":"Maximum number of chunks to return","default":100,"title":"Limit"},"description":"Maximum number of chunks to return"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Number of chunks to skip","default":0,"title":"Offset"},"description":"Number of chunks to skip"},{"name":"include_embeddings","in":"query","required":false,"schema":{"type":"boolean","description":"Include embeddings in response","default":true,"title":"Include Embeddings"},"description":"Include embeddings in response"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListDataResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/rag/images":{"get":{"tags":["RAG"],"summary":"Get Images","description":"Get images for a document.\n\nArgs:\n    document_id: Document ID to filter images\n    limit: Maximum number of images to return\n    offset: Pagination offset\n\nReturns:\n    List of images with metadata","operationId":"get_images_api_rag_images_get","parameters":[{"name":"document_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by document ID","title":"Document Id"},"description":"Filter by document ID"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"description":"Maximum number of images to return","default":100,"title":"Limit"},"description":"Maximum number of images to return"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Number of images to skip","default":0,"title":"Offset"},"description":"Number of images to skip"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListDataResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/rag/products":{"get":{"tags":["RAG"],"summary":"Get Products","description":"Get products for a document.\n\nArgs:\n    document_id: Document ID to filter products\n    limit: Maximum number of products to return\n    offset: Pagination offset\n    include_tables: Whether to include tables in the response\n\nReturns:\n    List of products with metadata, optionally including tables","operationId":"get_products_api_rag_products_get","parameters":[{"name":"document_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by document ID","title":"Document Id"},"description":"Filter by document ID"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"description":"Maximum number of products to return","default":100,"title":"Limit"},"description":"Maximum number of products to return"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Number of products to skip","default":0,"title":"Offset"},"description":"Number of products to skip"},{"name":"include_tables","in":"query","required":false,"schema":{"type":"boolean","description":"Include tables in product response","default":true,"title":"Include Tables"},"description":"Include tables in product response"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListDataResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/rag/embeddings":{"get":{"tags":["RAG"],"summary":"Get Embeddings","description":"Get embeddings for a document.\n\nReturns presence summary for image embeddings (read from document_images\nhas_*_slig boolean flags — VECS is the canonical store) and the actual\ntext embedding vectors for document_chunks.\n\nArgs:\n    document_id: Document ID to filter embeddings\n    embedding_type: Optional type filter (text, visual, color, texture, style, material, understanding)\n    limit: Maximum number of embeddings to return\n    offset: Pagination offset\n\nReturns:\n    List of embeddings (text embeddings inline, image embeddings as presence flags)","operationId":"get_embeddings_api_rag_embeddings_get","parameters":[{"name":"document_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by document ID","title":"Document Id"},"description":"Filter by document ID"},{"name":"embedding_type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by embedding type (text, visual, color, texture, style, material, understanding)","title":"Embedding Type"},"description":"Filter by embedding type (text, visual, color, texture, style, material, understanding)"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"description":"Maximum number of embeddings to return","default":100,"title":"Limit"},"description":"Maximum number of embeddings to return"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Number of embeddings to skip","default":0,"title":"Offset"},"description":"Number of embeddings to skip"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListDataResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/rag/relevancies":{"get":{"tags":["RAG"],"summary":"Get Relevancies","description":"Get chunk-image relevancy relationships for a document.\n\nArgs:\n    document_id: Document ID to filter relevancies\n    limit: Maximum number of relevancies to return\n    offset: Pagination offset\n    min_score: Minimum relevance score threshold\n\nReturns:\n    List of chunk-image relationships with relevance scores","operationId":"get_relevancies_api_rag_relevancies_get","parameters":[{"name":"document_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by document ID","title":"Document Id"},"description":"Filter by document ID"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"description":"Maximum number of relevancies to return","default":100,"title":"Limit"},"description":"Maximum number of relevancies to return"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Number of relevancies to skip","default":0,"title":"Offset"},"description":"Number of relevancies to skip"},{"name":"min_score","in":"query","required":false,"schema":{"type":"number","maximum":1.0,"minimum":0.0,"description":"Minimum relevance score","default":0.0,"title":"Min Score"},"description":"Minimum relevance score"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RelevancyListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/rag/query":{"post":{"tags":["Documents"],"summary":"Query Documents","description":"**🤖 CONSOLIDATED QUERY ENDPOINT - Text-Based RAG Query**\n\nThis endpoint replaces:\n- `/api/documents/{id}/query` → Use with `document_ids` filter\n- `/api/documents/{id}/summarize` → Use with summarization prompt\n\n## 🎯 Query Capabilities\n\n### Text Query (Implemented) ✅\n- Pure text-based RAG with advanced retrieval\n- Semantic search with reranking\n- Best for: Factual questions, information retrieval, summarization\n\n## 📝 Examples\n\n### Text Query (Default)\n```bash\ncurl -X POST \"/api/rag/documents/query\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"query\": \"What are the dimensions of the NOVA product?\",\n    \"workspace_id\": \"your-workspace-id\",\n    \"top_k\": 5\n  }'\n```\n\n### Document-Specific Query\n```bash\ncurl -X POST \"/api/rag/documents/query\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"query\": \"Summarize this document\",\n    \"workspace_id\": \"your-workspace-id\",\n    \"document_ids\": [\"doc-123\"],\n    \"top_k\": 20\n  }'\n```\n\n## 🔄 Migration from Old Endpoints\n\n**Old:** `POST /api/documents/{id}/query`\n**New:** `POST /api/rag/documents/query` with `document_ids` filter\n\n**Old:** `POST /api/documents/{id}/summarize`\n**New:** `POST /api/rag/documents/query` with summarization prompt","operationId":"query_documents_api_rag_query_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__api__documents__query_routes__QueryRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__api__documents__query_routes__QueryResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/rag/chat":{"post":{"tags":["Documents"],"summary":"Chat With Documents","description":"Conversational interface for document Q&A.\n\nThis endpoint maintains conversation context and provides\ncontextual responses based on the document collection.\n\n## 📝 Example\n\n```bash\ncurl -X POST \"/api/rag/documents/chat\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"message\": \"What products do you have for outdoor use?\",\n    \"workspace_id\": \"your-workspace-id\",\n    \"conversation_id\": \"conv-123\",\n    \"top_k\": 5\n  }'\n```","operationId":"chat_with_documents_api_rag_chat_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__api__documents__query_routes__ChatRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/rag/search":{"post":{"tags":["Documents"],"summary":"Search Documents","description":"**🔍 SEARCH ENDPOINT - Multi-Vector Search with AI Query Understanding**\n\n## 🎯 Supported Search Strategies\n\n### Multi-Vector Search (`strategy=\"multi_vector\"`) - ⭐ DEFAULT & RECOMMENDED ✅\n- 🎯 **ENHANCED**: 7-vector fusion search + JSONB metadata filtering\n- **Embeddings Combined:**\n  - Text (15%) - Voyage AI 1024D semantic understanding\n  - Visual (15%) - SLIG 768D visual similarity\n  - Understanding (20%) - Voyage AI 1024D from Qwen3-VL vision analysis\n  - Color (12.5%) - SLIG 768D color palette matching\n  - Texture (12.5%) - SLIG 768D texture pattern matching\n  - Style (12.5%) - SLIG 768D design style matching\n  - Material (12.5%) - SLIG 768D material type matching\n- **+ JSONB Metadata Filtering**: Supports `material_filters` for property-based filtering\n- **+ Query Understanding**: ✅ **ENABLED BY DEFAULT** - Auto-extracts filters from natural language\n- **Performance**: Fast (~250-350ms with query understanding, ~200-300ms without)\n- **Best For:** ALL queries - comprehensive, accurate, fast\n- **Example:** \"waterproof ceramic tiles for outdoor patio, matte finish\"\n\n### Material Property Search (`strategy=\"material\"`) ✅\n- JSONB-based filtering with AND/OR logic\n- Requires `material_filters` in request body\n- Best for: Filtering by specific material properties\n- Uses direct database queries (no LLM required)\n\n### Image Similarity Search (`strategy=\"image\"`) ✅\n- Visual similarity using CLIP embeddings\n- Requires `image_url` or `image_base64` in request body\n- Best for: Finding visually similar products\n- Uses VECS vector database with HNSW indexing\n\n\n\n## 📝 Examples\n\n### Multi-Vector Search (⭐ DEFAULT - Recommended for all queries)\n```bash\ncurl -X POST \"/api/rag/documents/search\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"query\": \"modern minimalist furniture\", \"workspace_id\": \"xxx\", \"top_k\": 10}'\n```\n\n### Multi-Vector with Natural Language Filters\n```bash\ncurl -X POST \"/api/rag/documents/search\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"query\": \"waterproof ceramic tiles for outdoor patio, matte finish\", \"workspace_id\": \"xxx\", \"top_k\": 10}'\n# AI automatically extracts: material_type=ceramic, properties=waterproof, application=outdoor, finish=matte\n```\n\n### Material Property Search\n```bash\ncurl -X POST \"/api/rag/documents/search?strategy=material\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"workspace_id\": \"xxx\", \"material_filters\": {\"material_type\": \"fabric\", \"color\": [\"red\", \"blue\"]}, \"top_k\": 10}'\n```\n\n### Image Similarity Search\n```bash\ncurl -X POST \"/api/rag/documents/search?strategy=image\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"workspace_id\": \"xxx\", \"image_url\": \"https://example.com/image.jpg\", \"top_k\": 10}'\n```\n\n## 📊 Response Example\n```json\n{\n  \"query\": \"modern oak furniture\",\n  \"enhanced_query\": \"modern oak furniture\",\n  \"results\": [\n    {\n      \"id\": \"product_uuid_1\",\n      \"name\": \"Modern Oak Dining Table\",\n      \"description\": \"Contemporary oak furniture...\",\n      \"score\": 0.92,\n      \"final_score\": 0.85,\n      \"strategy_count\": 4,\n      \"strategies\": [\"semantic\", \"vector\", \"multi_vector\", \"hybrid\"]\n    }\n  ],\n  \"total_results\": 10,\n  \"search_type\": \"all\",\n  \"processing_time\": 0.223,\n  \"search_metadata\": {\n    \"strategies_executed\": 4,\n    \"strategies_successful\": 4,\n    \"strategies_failed\": 0,\n    \"strategy_breakdown\": {\n      \"semantic\": {\"count\": 3, \"success\": true},\n      \"vector\": {\"count\": 2, \"success\": true},\n      \"multi_vector\": {\"count\": 4, \"success\": true},\n      \"hybrid\": {\"count\": 5, \"success\": true}\n    },\n    \"parallel_execution\": true,\n    \"parallel_processing_time\": 0.017\n  }\n}\n```\n\n## ⚡ Performance Characteristics\n\n| Strategy | Typical Time | Max Time | Notes |\n|----------|-------------|----------|-------|\n| semantic | 100-150ms | 300ms | Indexed, MMR diversity |\n| vector | 50-100ms | 200ms | Fastest, pure similarity |\n| multi_vector | 200-300ms | 500ms | 3 embeddings, sequential scan for 2048-dim |\n| hybrid | 120-180ms | 350ms | Semantic + full-text search |\n| material | 30-50ms | 100ms | JSONB indexed |\n| image | 100-150ms | 300ms | CLIP indexed |\n| **all (parallel)** | **200-300ms** | **500ms** | **3-4x faster than sequential** |\n\n## 🔄 Migration from Old Endpoints\n\n**Old:** `POST /api/search/semantic`\n**New:** `POST /api/rag/documents/search?strategy=semantic`\n\n**Old:** `POST /api/search/similarity`\n**New:** `POST /api/rag/documents/search?strategy=vector`\n\n**Old:** `POST /api/unified-search`\n**New:** `POST /api/rag/documents/search` (same functionality, clearer naming)\n\n## ⚠️ Error Codes\n\n- **400 Bad Request**: Invalid parameters (missing query, invalid strategy, etc.)\n- **401 Unauthorized**: Missing or invalid authentication\n- **404 Not Found**: Workspace not found\n- **500 Internal Server Error**: Search processing failed\n- **503 Service Unavailable**: RAG service not available\n\n## 🎯 Rate Limits\n\n- **60 requests/minute** per user\n- **1000 requests/hour** per workspace\n- Parallel execution (`strategy=\"all\"`) counts as 1 request","operationId":"search_documents_api_rag_search_post","parameters":[{"name":"strategy","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Search strategy: 'multi_vector' (default and only supported strategy)","default":"multi_vector","title":"Strategy"},"description":"Search strategy: 'multi_vector' (default and only supported strategy)"},{"name":"enable_query_understanding","in":"query","required":false,"schema":{"type":"boolean","description":"🧠 AI query parsing to automatically extract filters from natural language (e.g., 'waterproof ceramic tiles for outdoor patio, matte finish' → auto-extracts material_type, properties, finish, etc.). Set to false to disable.","default":true,"title":"Enable Query Understanding"},"description":"🧠 AI query parsing to automatically extract filters from natural language (e.g., 'waterproof ceramic tiles for outdoor patio, matte finish' → auto-extracts material_type, properties, finish, etc.). Set to false to disable."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__api__documents__query_routes__SearchRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__api__documents__query_routes__SearchResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/rag/documents/documents/{document_id}/content":{"get":{"tags":["Documents"],"summary":"Get Document Content","description":"Get complete document content with all AI analysis results.\n\nReturns comprehensive document data including:\n- Document metadata\n- All chunks with embeddings\n- All images with AI analysis (CLIP, Qwen, Claude)\n- All products created from the document\n- Complete AI model usage statistics","operationId":"get_document_content_api_rag_documents_documents__document_id__content_get","parameters":[{"name":"document_id","in":"path","required":true,"schema":{"type":"string","title":"Document Id"}},{"name":"include_chunks","in":"query","required":false,"schema":{"type":"boolean","description":"Include document chunks","default":true,"title":"Include Chunks"},"description":"Include document chunks"},{"name":"include_images","in":"query","required":false,"schema":{"type":"boolean","description":"Include document images","default":true,"title":"Include Images"},"description":"Include document images"},{"name":"include_products","in":"query","required":false,"schema":{"type":"boolean","description":"Include products created from document","default":false,"title":"Include Products"},"description":"Include products created from document"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentContentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/rag/health":{"get":{"tags":["RAG"],"summary":"Rag Health Check","description":"Health check for RAG services.\n\nThis endpoint checks the health of all RAG-related services\nincluding embedding service and vector store.","operationId":"rag_health_check_api_rag_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthCheckResponse"}}}}}}},"/api/rag/stats":{"get":{"tags":["RAG"],"summary":"Get Rag Statistics","description":"Get RAG system statistics.\n\nThis endpoint provides statistics about the RAG system including\ndocument counts, embedding statistics, and performance metrics.","operationId":"get_rag_statistics_api_rag_stats_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatsResponse"}}}}}}},"/api/rag/workspace-stats":{"get":{"tags":["RAG"],"summary":"Get Workspace Statistics","description":"Get comprehensive workspace statistics including VECS embedding counts.\n\nReturns counts for:\n- Products\n- Chunks\n- Images\n- Text embeddings (from embeddings table)\n- Image embeddings (from VECS)\n- Total embeddings (text + image)","operationId":"get_workspace_statistics_api_rag_workspace_stats_get","parameters":[{"name":"workspace_id","in":"query","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/rag/job/{job_id}/ai-tracking":{"get":{"tags":["Documents"],"summary":"Get Job Ai Tracking","description":"Get detailed AI model tracking information for a job.\n\nReturns comprehensive metrics on:\n- Which AI models were used (QWEN, Anthropic, CLIP, OpenAI)\n- Confidence scores and results\n- Token usage and processing time\n- Success/failure rates\n- Per-stage breakdown","operationId":"get_job_ai_tracking_api_rag_job__job_id__ai_tracking_get","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AITrackingResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/rag/job/{job_id}/ai-tracking/stage/{stage}":{"get":{"tags":["Documents"],"summary":"Get Job Ai Tracking By Stage","description":"Get AI model tracking information for a specific processing stage.\n\nArgs:\n    job_id: Job identifier\n    stage: Processing stage (classification, boundary_detection, embedding, etc.)\n\nReturns:\n    Detailed metrics for the specified stage","operationId":"get_job_ai_tracking_by_stage_api_rag_job__job_id__ai_tracking_stage__stage__get","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}},{"name":"stage","in":"path","required":true,"schema":{"type":"string","title":"Stage"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AITrackingResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/rag/job/{job_id}/ai-tracking/model/{model_name}":{"get":{"tags":["Documents"],"summary":"Get Job Ai Tracking By Model","description":"Get AI model tracking information for a specific AI model.\n\nArgs:\n    job_id: Job identifier\n    model_name: AI model name (QWEN, Anthropic, CLIP, OpenAI)\n\nReturns:\n    Statistics for the specified AI model","operationId":"get_job_ai_tracking_by_model_api_rag_job__job_id__ai_tracking_model__model_name__get","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}},{"name":"model_name","in":"path","required":true,"schema":{"type":"string","title":"Model Name"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AITrackingResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/rag/admin/stuck-jobs/analyze/{job_id}":{"get":{"tags":["RAG"],"summary":"Analyze Stuck Job","description":"Analyze a stuck job to determine root cause and get recommendations.\n\nReturns detailed analysis including:\n- Root cause identification\n- Bottleneck stage\n- Stage-by-stage timing analysis\n- Recovery options\n- Optimization recommendations","operationId":"analyze_stuck_job_api_rag_admin_stuck_jobs_analyze__job_id__get","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StuckJobsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/rag/admin/stuck-jobs/statistics":{"get":{"tags":["RAG"],"summary":"Get Stuck Job Statistics","description":"Get overall statistics about stuck jobs.\n\nReturns:\n- Total stuck jobs\n- Stage breakdown (which stages jobs get stuck at)\n- Most common stuck stage\n- Historical patterns","operationId":"get_stuck_job_statistics_api_rag_admin_stuck_jobs_statistics_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StuckJobsResponse"}}}}}}},"/api/rag/search/knowledge-base":{"post":{"tags":["Documents"],"summary":"Search Knowledge Base","description":"🔍 Search existing knowledge base without uploading a PDF.\n\nUses the same **7-vector fusion search** as the main search endpoint, combining:\n- Text (15%) - Voyage AI 1024D semantic understanding\n- Visual (15%) - SLIG 768D visual similarity\n- Understanding (20%) - Voyage AI 1024D from Qwen3-VL analysis\n- Color (12.5%) - SLIG 768D color palette matching\n- Texture (12.5%) - SLIG 768D texture pattern matching\n- Style (12.5%) - SLIG 768D design style matching\n- Material (12.5%) - SLIG 768D material type matching\n\nPerforms unified semantic search across:\n- **Products** (with all metadata, embeddings, and material properties)\n- **Document entities** (certificates, logos, specifications)\n- **Chunks** (text content from PDFs with category tags)\n- **Images** (visual content with SLIG embeddings)\n\nSupports:\n- Category filtering (product, certificate, logo, specification, general)\n- Entity type filtering (certificate, logo, specification)\n- Material property filtering via metadata\n\nExample queries:\n- \"waterproof ceramic tiles with matte finish\"\n- \"ISO 9001 certificates\"\n- \"company logos\"\n- \"installation specifications\"","operationId":"search_knowledge_base_api_rag_search_knowledge_base_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__api__documents__query_routes__KnowledgeBaseSearchRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KnowledgeBaseSearchResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/anthropic/images/validate":{"post":{"tags":["Anthropic Claude"],"summary":"Validate Image With Claude","description":"**🔍 Image Validation - Claude 3.5 Sonnet Vision**\n\nValidate image quality and match to product groups using Claude Vision.\n\n## 🎯 What It Does\n\n- **Quality Assessment**: Rates image quality (0-1 scale) based on clarity, lighting, composition\n- **Content Analysis**: Describes what's visible in the image\n- **Material Identification**: Identifies materials present\n- **Product Matching**: Matches image to relevant product groups\n- **Issue Detection**: Identifies quality issues or concerns\n- **Recommendations**: Suggests improvements\n\n## 📝 Request Example\n\n```json\n{\n  \"image_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n  \"image_url\": \"https://example.com/product.jpg\",\n  \"product_groups\": [\"Furniture\", \"Lighting\", \"Textiles\"],\n  \"workspace_id\": \"workspace_uuid\"\n}\n```\n\n## ✅ Response Example\n\n```json\n{\n  \"image_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n  \"validation_status\": \"valid\",\n  \"quality_score\": 0.92,\n  \"product_associations\": [\n    {\n      \"product_group\": \"Furniture\",\n      \"confidence\": 0.95,\n      \"reasoning\": \"Clear oak dining table visible with professional lighting\"\n    }\n  ],\n  \"issues\": [],\n  \"recommendations\": [\"Consider adding lifestyle context shots\"],\n  \"processing_time_ms\": 1234.5\n}\n```\n\n## 📊 Validation Status\n\n- **valid**: Quality score ≥ 0.7 - Image is production-ready\n- **needs_review**: Quality score 0.5-0.7 - Manual review recommended\n- **invalid**: Quality score < 0.5 - Image needs improvement\n\n## ⚠️ Error Codes\n\n- **400 Bad Request**: Invalid parameters (missing image_id/image_url)\n- **404 Not Found**: Image not found in database\n- **500 Internal Server Error**: Claude API call failed\n- **503 Service Unavailable**: Claude API unavailable\n\n## 📏 Limits\n\n- **Max image size**: 10MB\n- **Timeout**: 30 seconds\n- **Rate limit**: 60 requests/minute\n- **Model**: claude-sonnet-4-6","operationId":"validate_image_with_claude_api_v1_anthropic_images_validate_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImageValidationRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImageValidationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/anthropic/products/enrich":{"post":{"tags":["Anthropic Claude"],"summary":"Enrich Product With Claude","description":"Enrich product data using Claude 3.5 Sonnet.\n\nGenerates descriptions, extracts specifications, and identifies related products.","operationId":"enrich_product_with_claude_api_v1_anthropic_products_enrich_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductEnrichmentRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductEnrichmentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/anthropic/test/claude-integration":{"post":{"tags":["Anthropic Claude"],"summary":"Test Claude Integration","description":"Test Claude Vision API integration.","operationId":"test_claude_integration_api_v1_anthropic_test_claude_integration_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataResponse"}}}}}}},"/api/products/create-from-chunks":{"post":{"tags":["Products","Products"],"summary":"Create products from document chunks using two-stage AI classification","description":"Advanced two-stage product creation system with intelligent AI model selection.\n\n    **Two-Stage Classification System:**\n\n    **Stage 1: Fast Filtering (Claude 4.5 Haiku)**\n    - Text-only classification for initial candidate identification\n    - Batch processing for efficiency\n    - Low-cost, high-speed filtering\n    - Identifies potential product chunks\n\n    **Stage 2: Deep Enrichment (Claude 4.5 Sonnet)**\n    - Detailed product metadata extraction\n    - Image analysis and validation\n    - Comprehensive feature extraction\n    - High-accuracy enrichment\n\n    **Performance Benefits:**\n    - ⚡ 60% faster processing vs single-stage approach\n    - 💰 40% reduced API costs through intelligent model selection\n    - 🎯 Higher accuracy through specialized model usage\n    - 📦 Batch processing reduces API call overhead\n\n    **Processing Flow:**\n    1. Fetch all chunks for document\n    2. Filter by minimum length criteria\n    3. Stage 1: Haiku classifies chunks (batch)\n    4. Stage 2: Sonnet enriches confirmed products\n    5. Create products in database\n    6. Return detailed metrics\n\n    **Example Request:**\n    ```json\n    {\n      \"document_id\": \"69cba085-9c2d-405c-aff2-8a20caf0b568\",\n      \"workspace_id\": \"ffafc28b-1b8b-4b0d-b226-9f9a6154004e\",\n      \"max_products\": null,\n      \"min_chunk_length\": 100\n    }\n    ```\n\n    **Example Response:**\n    ```json\n    {\n      \"success\": true,\n      \"products_created\": 12,\n      \"products_failed\": 0,\n      \"chunks_processed\": 45,\n      \"total_chunks\": 150,\n      \"eligible_chunks\": 45,\n      \"stage1_candidates\": 15,\n      \"stage1_time\": 2.5,\n      \"stage2_time\": 8.3,\n      \"total_time\": 10.8,\n      \"message\": \"Successfully created 12 products from 45 chunks in 10.8s\"\n    }\n    ```\n\n    **Parameters:**\n    - `document_id`: UUID of processed document (required)\n    - `workspace_id`: UUID of workspace (default: ffafc28b-1b8b-4b0d-b226-9f9a6154004e)\n    - `max_products`: Maximum products to create (null = unlimited)\n    - `min_chunk_length`: Minimum chunk content length (default: 100)\n\n    **Performance:**\n    - Typical: 10-15 seconds for 50 chunks\n    - Stage 1: ~2-3 seconds (batch processing)\n    - Stage 2: ~8-12 seconds (detailed enrichment)\n\n    **Use Cases:**\n    - Automated product extraction from PDFs\n    - Bulk product creation from catalogs\n    - Material database population\n    - Product metadata enrichment\n\n    **Error Codes:**\n    - 200: Success\n    - 400: Invalid request parameters\n    - 404: Document not found\n    - 500: Processing failed (check logs)\n\n    **Rate Limits:**\n    - 5 requests/minute (processing intensive)","operationId":"create_products_from_chunks_api_products_create_from_chunks_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductCreationRequest"}}},"required":true},"responses":{"200":{"description":"Products created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductCreationResponse"}}}},"400":{"description":"Invalid request parameters"},"404":{"description":"Document not found"},"500":{"description":"Processing failed"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/products/create-from-layout":{"post":{"tags":["Products"],"summary":"Create Products From Layout","description":"Create products from layout-based candidates (legacy method).\n\nThis endpoint uses the original layout-based product detection method\nfor comparison with the new two-stage classification system.\n\nArgs:\n    request: Product creation request parameters\n    supabase_client: Supabase client dependency\n    \nReturns:\n    ProductCreationResponse: Results from layout-based creation\n    \nRaises:\n    HTTPException: If the operation fails","operationId":"create_products_from_layout_api_products_create_from_layout_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductCreationRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductCreationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/products/batch-categorize":{"post":{"tags":["Products"],"summary":"Batch Categorize Products","description":"Batch re-categorize products using Claude Haiku.\n\nFetches products for the workspace (optionally only those without a\nmaterial_category in metadata), calls _classify_product for each,\nand updates metadata.material_category + metadata.zone_intent in DB.","operationId":"batch_categorize_products_api_products_batch_categorize_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchCategorizeRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchCategorizeResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/products/health":{"get":{"tags":["Products"],"summary":"Products Health Check","description":"Health check endpoint for the products API.\n\nReturns:\n    Dict[str, Any]: Health status information","operationId":"products_health_check_api_products_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServiceHealthResponse"}}}}}}},"/api/document-entities/":{"get":{"tags":["Document Entities"],"summary":"Get Document Entities","description":"Get all document entities for a workspace.\n\nSupports filtering by:\n- entity_type: certificate, logo, specification, marketing, bank_statement\n- factory_name: Filter by specific factory\n- factory_group: Filter by factory group\n\nExample agentic query: \"Get all certifications for Castellón Factory\"\n→ GET /api/document-entities?workspace_id=xxx&entity_type=certificate&factory_name=Castellón Factory","operationId":"get_document_entities_api_document_entities__get","parameters":[{"name":"workspace_id","in":"query","required":true,"schema":{"type":"string","description":"Workspace ID","title":"Workspace Id"},"description":"Workspace ID"},{"name":"entity_type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by entity type (certificate, logo, specification, etc.)","title":"Entity Type"},"description":"Filter by entity type (certificate, logo, specification, etc.)"},{"name":"factory_name","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by factory name","title":"Factory Name"},"description":"Filter by factory name"},{"name":"factory_group","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by factory group","title":"Factory Group"},"description":"Filter by factory group"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","description":"Maximum number of entities to return","default":100,"title":"Limit"},"description":"Maximum number of entities to return"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","description":"Number of entities to skip","default":0,"title":"Offset"},"description":"Number of entities to skip"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/DocumentEntityResponse"},"title":"Response Get Document Entities Api Document Entities  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/document-entities/{entity_id}":{"get":{"tags":["Document Entities"],"summary":"Get Document Entity","description":"Get a specific document entity by ID.","operationId":"get_document_entity_api_document_entities__entity_id__get","parameters":[{"name":"entity_id","in":"path","required":true,"schema":{"type":"string","title":"Entity Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentEntityResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/document-entities/product/{product_id}":{"get":{"tags":["Document Entities"],"summary":"Get Entities For Product","description":"Get all document entities linked to a specific product.\n\nExample agentic query: \"Get certifications for product NOVA\"\n→ First get product ID for NOVA, then:\n→ GET /api/document-entities/product/{product_id}?entity_type=certificate","operationId":"get_entities_for_product_api_document_entities_product__product_id__get","parameters":[{"name":"product_id","in":"path","required":true,"schema":{"type":"string","title":"Product Id"}},{"name":"entity_type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by entity type","title":"Entity Type"},"description":"Filter by entity type"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/DocumentEntityResponse"},"title":"Response Get Entities For Product Api Document Entities Product  Product Id  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/document-entities/factory/{factory_name}":{"get":{"tags":["Document Entities"],"summary":"Get Entities By Factory","description":"Get all document entities for a specific factory.\n\nExample agentic query: \"Get all certifications for Castellón Factory\"\n→ GET /api/document-entities/factory/Castellón Factory?entity_type=certificate","operationId":"get_entities_by_factory_api_document_entities_factory__factory_name__get","parameters":[{"name":"factory_name","in":"path","required":true,"schema":{"type":"string","title":"Factory Name"}},{"name":"entity_type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by entity type","title":"Entity Type"},"description":"Filter by entity type"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/DocumentEntityResponse"},"title":"Response Get Entities By Factory Api Document Entities Factory  Factory Name  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/document-entities/relationships/product/{product_id}":{"get":{"tags":["Document Entities"],"summary":"Get Product Document Relationships","description":"Get all document entity relationships for a specific product.","operationId":"get_product_document_relationships_api_document_entities_relationships_product__product_id__get","parameters":[{"name":"product_id","in":"path","required":true,"schema":{"type":"string","title":"Product Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ProductDocumentRelationshipResponse"},"title":"Response Get Product Document Relationships Api Document Entities Relationships Product  Product Id  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/embeddings/clip-image":{"post":{"tags":["Embeddings"],"summary":"Generate Clip Image Embedding","description":"**🖼️ Visual Image Embedding - Powered by SigLIP2**\n\nGenerate 768-dimensional visual embedding using SLIG (SigLIP2) cloud endpoint\nfor superior material image similarity search.\n\n## 🎯 Use Cases\n\n- Visual product search\n- Material similarity matching\n- Multimodal search (combine with text embeddings)\n- Image clustering and categorization\n\n## 📝 Request Example\n\n```json\n{\n  \"image_data\": \"data:image/jpeg;base64,/9j/4AAQSkZJRg...\",\n  \"model\": \"siglip2-so400m-patch14-384\"\n}\n```\n\n## ✅ Response Example\n\n```json\n{\n  \"embedding\": [0.123, -0.456, 0.789, ...],\n  \"dimension\": 512,\n  \"model\": \"siglip-so400m-patch14-384\",\n  \"processing_time_ms\": 234.5\n}\n```\n\n## 📊 Technical Details\n\n- **Model**: Google SigLIP ViT-SO400M-14-384\n- **Dimension**: 512\n- **Accuracy**: +19-29% improvement over CLIP on material images\n- **Normalization**: L2 normalized (unit vector)\n- **Distance Metric**: Cosine similarity\n- **Processing Time**: 150-400ms\n\n## ⚠️ Error Codes\n\n- **400 Bad Request**: Invalid base64 image data\n- **413 Payload Too Large**: Image exceeds 10MB\n- **415 Unsupported Media Type**: Unsupported image format\n- **500 Internal Server Error**: Embedding generation failed\n- **503 Service Unavailable**: SigLIP model not available\n\n## 📏 Limits\n\n- **Max image size**: 10MB\n- **Supported formats**: JPEG, PNG, WebP\n- **Rate limit**: 100 requests/minute","operationId":"generate_clip_image_embedding_api_embeddings_clip_image_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClipImageRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmbeddingResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/embeddings/clip-text":{"post":{"tags":["Embeddings"],"summary":"Generate Clip Text Embedding","description":"**📝 Text Embedding - Powered by Voyage AI**\n\nGenerate text embedding using Voyage AI (primary) with OpenAI fallback.\nSupports input_type optimization for better retrieval quality.\n\n## 🎯 Use Cases\n\n- Document indexing (use input_type=\"document\")\n- Search queries (use input_type=\"query\")\n- Semantic search and retrieval\n- Text-to-image search\n- Multimodal search\n\n## 📝 Request Example\n\n```json\n{\n  \"text\": \"modern minimalist oak dining table\",\n  \"model\": \"voyage-3.5\",\n  \"input_type\": \"document\",\n  \"dimensions\": 1024\n}\n```\n\n## ✅ Response Example\n\n```json\n{\n  \"embedding\": [0.234, -0.567, 0.891, ...],\n  \"dimensions\": 1024,\n  \"model\": \"voyage-3.5\",\n  \"success\": true\n}\n```\n\n## 📊 Technical Details\n\n- **Primary Model**: Voyage AI voyage-3.5\n- **Fallback Model**: OpenAI text-embedding-3-small\n- **Default Dimension**: 1024 (Voyage AI)\n- **Supported Dimensions**: 256, 512, 1024, 2048 (Voyage) or 512, 1536 (OpenAI)\n- **Input Types**: \"document\" (for indexing), \"query\" (for search)\n- **Normalization**: L2 normalized (unit vector)\n- **Distance Metric**: Cosine similarity\n- **Processing Time**: 100-300ms\n\n## 💡 Usage Pattern\n\n1. For indexing documents:\n   ```json\n   {\"text\": \"...\", \"input_type\": \"document\", \"dimensions\": 1024}\n   ```\n2. For search queries:\n   ```json\n   {\"text\": \"...\", \"input_type\": \"query\", \"dimensions\": 1024}\n   ```\n3. Search using cosine similarity:\n   ```sql\n   SELECT * FROM chunks\n   ORDER BY text_embedding <=> '[your_embedding]'\n   LIMIT 10\n   ```\n\n## ⚠️ Error Codes\n\n- **400 Bad Request**: Empty or invalid text\n- **500 Internal Server Error**: Embedding generation failed\n- **503 Service Unavailable**: Both Voyage AI and OpenAI unavailable\n\n## 📏 Limits\n\n- **Max text length**: 8000 tokens (Voyage AI), 8191 tokens (OpenAI)\n- **Rate limit**: 100 requests/minute","operationId":"generate_clip_text_embedding_api_embeddings_clip_text_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClipTextRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmbeddingResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/embeddings/health":{"get":{"tags":["Embeddings"],"summary":"Health Check","description":"Health check endpoint for embeddings service.","operationId":"health_check_api_embeddings_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmbeddingHealthResponse"}}}}}}},"/api/monitoring/supabase-status":{"get":{"tags":["Monitoring","Monitoring"],"summary":"Get comprehensive Supabase resource usage and health status","description":"Monitor all Supabase resources including database, storage, and usage limits.\n\n    **Returns:**\n    - **Database Statistics**: Row counts for all monitored tables\n    - **Storage Statistics**: Size and file counts per bucket\n    - **Resource Limits**: Free tier limits and current usage percentages\n    - **Health Status**: Overall system health (healthy, notice, warning, critical)\n    - **Warnings**: Alerts when approaching resource limits\n\n    **Monitored Tables:**\n    - documents, document_chunks, document_images\n    - embeddings, products, materials_catalog\n    - background_jobs\n\n    **Monitored Buckets:**\n    - pdf-tiles, pdf-documents, material-images\n\n    **Health Status Levels:**\n    - `healthy`: <50% usage\n    - `notice`: 50-80% usage\n    - `warning`: 80-90% usage\n    - `critical`: >90% usage (upgrade needed)\n\n    **Example Response:**\n    ```json\n    {\n      \"success\": true,\n      \"timestamp\": \"2025-11-08T16:30:00Z\",\n      \"health_status\": \"warning\",\n      \"database\": {\n        \"tables\": [\n          {\"table\": \"documents\", \"rows\": 150},\n          {\"table\": \"document_chunks\", \"rows\": 5000}\n        ],\n        \"total_rows\": 5150\n      },\n      \"storage\": {\n        \"buckets\": [\n          {\n            \"bucket\": \"pdf-documents\",\n            \"files\": 150,\n            \"size_gb\": 0.45\n          }\n        ],\n        \"total_files\": 150,\n        \"total_size_gb\": 0.85\n      },\n      \"limits\": {\n        \"storage_gb\": 1.0,\n        \"database_size_gb\": 0.5\n      },\n      \"usage\": {\n        \"storage_percent\": 85.0,\n        \"storage_remaining_gb\": 0.15\n      },\n      \"warnings\": [\n        {\n          \"type\": \"warning\",\n          \"resource\": \"storage\",\n          \"message\": \"Storage usage is at 85.0% - Consider upgrading soon.\",\n          \"usage_percent\": 85.0\n        }\n      ]\n    }\n    ```\n\n    **Use Cases:**\n    - Admin dashboard monitoring\n    - Automated alerts for resource limits\n    - Capacity planning\n    - Cost optimization\n\n    **Performance:**\n    - Typical: 1-2 seconds (queries all tables and buckets)\n    - Recommended: Cache for 5-10 minutes\n\n    **Rate Limits:**\n    - 10 requests/minute\n\n    **Error Codes:**\n    - 200: Success\n    - 500: Failed to retrieve status (check logs)","operationId":"get_supabase_status_api_monitoring_supabase_status_get","responses":{"200":{"description":"Comprehensive resource status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PerformanceMetricsResponse"}}}},"500":{"description":"Failed to retrieve status"}}}},"/api/monitoring/health":{"get":{"tags":["Monitoring"],"summary":"Health Check","description":"Quick health check for monitoring systems.\n\nReturns:\n    - Overall system health\n    - Database connectivity\n    - Storage connectivity","operationId":"health_check_api_monitoring_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServiceHealthResponse"}}}}}}},"/api/monitoring/storage-estimate":{"get":{"tags":["Monitoring"],"summary":"Estimate Storage For Upload","description":"Estimate if there's enough storage for a PDF upload.\n\nArgs:\n    file_size_mb: Size of PDF file in MB\n    estimated_images: Estimated number of images to extract\n    \nReturns:\n    - Whether upload is safe\n    - Estimated storage needed\n    - Current available storage","operationId":"estimate_storage_for_upload_api_monitoring_storage_estimate_get","parameters":[{"name":"file_size_mb","in":"query","required":true,"schema":{"type":"number","title":"File Size Mb"}},{"name":"estimated_images","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Estimated Images"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StorageEstimateResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/monitoring/pdf/health":{"get":{"tags":["Monitoring","Health & Monitoring"],"summary":"Pdf Health","description":"PDF service health check endpoint.\n\nReturns:\n    Health status of the PDF processing service","operationId":"pdf_health_api_monitoring_pdf_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PDFHealthResponse"}}}}}}},"/api/v1/ai-metrics/summary":{"get":{"tags":["AI Metrics","AI Metrics"],"summary":"Get comprehensive AI usage metrics and cost tracking","description":"Monitor AI model usage, costs, performance, and quality metrics across all services.\n\n    **Metrics Provided:**\n\n    **1. Summary Statistics**\n    - Total AI calls made\n    - Total cost (USD)\n    - Total tokens consumed\n    - Average latency (ms)\n    - Average confidence score\n    - Fallback rate (%)\n\n    **2. Model Usage Breakdown**\n    - Per-model call counts\n    - Per-model costs\n    - Per-model token usage\n    - Per-model latency\n    - Per-model confidence scores\n    - Fallback counts\n\n    **3. Task Breakdown**\n    - Calls per task type (classification, extraction, validation, etc.)\n    - Cost per task type\n    - Average confidence per task\n    - Models used per task\n\n    **4. Confidence Distribution**\n    - Distribution across confidence ranges (0.0-0.2, 0.2-0.4, etc.)\n    - Percentage of calls in each range\n    - Quality assessment\n\n    **5. Recent Calls**\n    - Last 10 AI calls with full details\n    - Model used, task, cost, latency, confidence\n\n    **Time Periods:**\n    - `1h`: Last hour\n    - `24h`: Last 24 hours (default)\n    - `7d`: Last 7 days\n    - `30d`: Last 30 days\n    - `all`: All time\n\n    **Example Response:**\n    ```json\n    {\n      \"summary\": {\n        \"total_calls\": 1250,\n        \"total_cost\": 12.45,\n        \"total_tokens\": 450000,\n        \"average_latency_ms\": 850.5,\n        \"average_confidence\": 0.87,\n        \"fallback_rate\": 0.05,\n        \"time_period\": \"24h\"\n      },\n      \"model_usage\": [\n        {\n          \"model\": \"claude-sonnet-4-6\",\n          \"call_count\": 500,\n          \"total_cost\": 8.50,\n          \"total_tokens\": 300000,\n          \"average_latency_ms\": 1200.0,\n          \"average_confidence\": 0.92,\n          \"fallback_count\": 10\n        },\n        {\n          \"model\": \"claude-3-5-haiku-20241022\",\n          \"call_count\": 750,\n          \"total_cost\": 3.95,\n          \"total_tokens\": 150000,\n          \"average_latency_ms\": 500.0,\n          \"average_confidence\": 0.84,\n          \"fallback_count\": 50\n        }\n      ],\n      \"task_breakdown\": [\n        {\n          \"task\": \"product_classification\",\n          \"call_count\": 600,\n          \"total_cost\": 5.20,\n          \"average_confidence\": 0.89,\n          \"models_used\": [\"claude-3-5-haiku-20241022\"]\n        }\n      ],\n      \"confidence_distribution\": [\n        {\"range\": \"0.8-1.0\", \"count\": 1000, \"percentage\": 80.0},\n        {\"range\": \"0.6-0.8\", \"count\": 200, \"percentage\": 16.0},\n        {\"range\": \"0.4-0.6\", \"count\": 50, \"percentage\": 4.0}\n      ],\n      \"recent_calls\": [...]\n    }\n    ```\n\n    **Use Cases:**\n    - Cost monitoring and optimization\n    - Model performance comparison\n    - Quality assurance (confidence tracking)\n    - Fallback rate monitoring\n    - Budget forecasting\n    - Performance optimization\n\n    **Performance:**\n    - Typical: 200-500ms\n    - Cached: 1 minute\n\n    **Rate Limits:**\n    - 30 requests/minute\n\n    **Error Codes:**\n    - 200: Success\n    - 400: Invalid time period\n    - 500: Failed to retrieve metrics","operationId":"get_ai_metrics_summary_api_v1_ai_metrics_summary_get","parameters":[{"name":"time_period","in":"query","required":false,"schema":{"type":"string","description":"Time period: 1h, 24h, 7d, 30d, all","default":"24h","title":"Time Period"},"description":"Time period: 1h, 24h, 7d, 30d, all"}],"responses":{"200":{"description":"Comprehensive AI metrics","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AIMetricsResponse"}}}},"400":{"description":"Invalid time period"},"500":{"description":"Failed to retrieve metrics"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/ai-metrics/external-service-usage":{"get":{"tags":["AI Metrics"],"summary":"Get external service usage and credit consumption","description":"Returns usage, cost, and credit data for external services (Twilio, Apollo, Hunter, ZeroBounce, Firecrawl) from ai_usage_logs.","operationId":"get_external_service_usage_api_v1_ai_metrics_external_service_usage_get","parameters":[{"name":"time_period","in":"query","required":false,"schema":{"type":"string","description":"Time period: 1h, 24h, 7d, 30d, all","default":"24h","title":"Time Period"},"description":"Time period: 1h, 24h, 7d, 30d, all"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/ai-metrics/job/{job_id}":{"get":{"tags":["AI Metrics"],"summary":"Get Job Ai Metrics","description":"Get AI metrics for a specific job (PDF processing, etc.).","operationId":"get_job_ai_metrics_api_v1_ai_metrics_job__job_id__get","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/ai-services/classify-document":{"post":{"tags":["AI Services","AI Services"],"summary":"Classify document content into semantic categories","description":"AI-powered content classification using Claude 4.5 Haiku for fast, accurate categorization.\n\n    **Classification Categories:**\n\n    **1. Product** (`product`)\n    - Product information and specifications\n    - Features and benefits\n    - Technical specifications\n    - Product variants and options\n    - Pricing and availability\n\n    **2. Supporting Information** (`supporting`)\n    - Technical details and guides\n    - Certifications and compliance\n    - Installation instructions\n    - Maintenance guides\n    - Warranty information\n\n    **3. Administrative** (`administrative`)\n    - Company information\n    - Legal notices and disclaimers\n    - Contact information\n    - Terms and conditions\n    - Privacy policies\n\n    **4. Transitional** (`transitional`)\n    - Table of contents\n    - Headers and footers\n    - Page numbers\n    - Navigation elements\n    - Section dividers\n\n    **Example Request:**\n    ```json\n    {\n      \"content\": \"NOVA Oak Flooring - Premium engineered wood flooring with 3mm oak veneer...\",\n      \"context\": {\n        \"page_number\": 5,\n        \"has_images\": true,\n        \"section\": \"Products\"\n      },\n      \"job_id\": \"job_123\"\n    }\n    ```\n\n    **Example Response:**\n    ```json\n    {\n      \"success\": true,\n      \"classification\": {\n        \"category\": \"product\",\n        \"confidence\": 0.95,\n        \"reasoning\": \"Content contains product name, specifications, and features\",\n        \"metadata\": {\n          \"product_indicators\": [\"specifications\", \"features\", \"pricing\"],\n          \"quality_score\": 0.92\n        }\n      }\n    }\n    ```\n\n    **Use Cases:**\n    - PDF content categorization\n    - Automated document organization\n    - Product extraction pipelines\n    - Content filtering\n\n    **Performance:**\n    - Typical: 300-500ms per classification\n    - Batch processing: Use `/classify-batch` for better performance\n\n    **Accuracy:**\n    - Average confidence: 0.87\n    - Fallback rate: <5%\n\n    **Rate Limits:**\n    - 60 requests/minute\n\n    **Error Codes:**\n    - 200: Success\n    - 400: Invalid content or parameters\n    - 500: Classification failed","operationId":"classify_document_api_v1_ai_services_classify_document_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClassifyRequest"}}},"required":true},"responses":{"200":{"description":"Classification successful","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClassificationResponse"}}}},"400":{"description":"Invalid request"},"500":{"description":"Classification failed"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/ai-services/classify-batch":{"post":{"tags":["AI Services"],"summary":"Classify Batch","description":"Classify multiple document contents in parallel.\n\nEfficient for processing multiple sections at once.","operationId":"classify_batch_api_v1_ai_services_classify_batch_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClassifyBatchRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchClassificationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/ai-services/detect-boundaries":{"post":{"tags":["AI Services"],"summary":"Detect Boundaries","description":"Detect product boundaries in document chunks.\n\nUses semantic similarity, structural markers, and page breaks\nto identify where one product ends and another begins.","operationId":"detect_boundaries_api_v1_ai_services_detect_boundaries_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DetectBoundariesRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BoundaryDetectionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/ai-services/group-by-product":{"post":{"tags":["AI Services"],"summary":"Group By Product","description":"Detect boundaries and group chunks into products.\n\nReturns product groups ready for extraction.","operationId":"group_by_product_api_v1_ai_services_group_by_product_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DetectBoundariesRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductGroupingResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/ai-services/validate-product":{"post":{"tags":["AI Services"],"summary":"Validate Product","description":"Validate product extraction quality.\n\nChecks:\n- Minimum content requirements\n- Substantive content (not just headers/footers)\n- Distinguishing features\n- Associated assets (images, specs)\n- Semantic coherence","operationId":"validate_product_api_v1_ai_services_validate_product_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidateProductRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/ai-services/consensus-validate":{"post":{"tags":["AI Services"],"summary":"Consensus Validate","description":"Validate extraction using multi-model consensus.\n\nRuns 2-3 models in parallel and uses weighted voting\nto determine the most accurate result.\n\nCritical for:\n- Product name extraction\n- Material classification\n- Safety information\n- Compliance data\n- Technical specifications\n- Pricing data","operationId":"consensus_validate_api_v1_ai_services_consensus_validate_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConsensusValidateRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/ai-services/consensus/is-critical/{task_type}":{"get":{"tags":["AI Services"],"summary":"Check If Critical","description":"Check if a task type requires consensus validation.\n\nReturns True for critical tasks like product_name_extraction,\nmaterial_classification, safety_information, etc.","operationId":"check_if_critical_api_v1_ai_services_consensus_is_critical__task_type__get","parameters":[{"name":"task_type","in":"path","required":true,"schema":{"type":"string","title":"Task Type"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/ai-services/escalation/stats":{"get":{"tags":["AI Services"],"summary":"Get Escalation Stats","description":"Get escalation engine statistics.\n\nReturns metrics on:\n- Total escalations\n- Successful escalations\n- Failed escalations\n- Cost saved/spent","operationId":"get_escalation_stats_api_v1_ai_services_escalation_stats_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EscalationStatsResponse"}}}}}}},"/api/v1/ai-services/process-pdf-enhanced":{"post":{"tags":["AI Services"],"summary":"Process Pdf Enhanced","description":"Process PDF with all enhanced AI services.\n\nThis endpoint is for testing the full integration.\nIn production, use the main PDF processing endpoint.","operationId":"process_pdf_enhanced_api_v1_ai_services_process_pdf_enhanced_post","parameters":[{"name":"document_id","in":"query","required":true,"schema":{"type":"string","title":"Document Id"}},{"name":"job_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Job Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/ai-services/health":{"get":{"tags":["AI Services"],"summary":"Health Check","description":"Health check for AI services.","operationId":"health_check_api_v1_ai_services_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServiceHealthResponse"}}}}}}},"/admin/extraction-prompts":{"get":{"tags":["Admin - Prompts"],"summary":"List Prompts","description":"**📋 List Extraction Prompts - Admin Configuration**\n\nList all AI extraction prompts configured for a workspace with optional filtering.\n\n## 🎯 Use Cases\n\n- View all configured extraction prompts\n- Filter prompts by processing stage\n- Filter prompts by extraction category\n- Audit prompt configurations\n\n## 📝 Query Parameters\n\n- **workspace_id** (required): Workspace UUID\n- **stage** (optional): Filter by stage (discovery, extraction, validation)\n- **category** (optional): Filter by category (products, certificates, logos, specifications)\n\n## ✅ Response Example\n\n```json\n[\n  {\n    \"id\": \"prompt-uuid-1\",\n    \"workspace_id\": \"workspace-uuid\",\n    \"stage\": \"discovery\",\n    \"category\": \"products\",\n    \"prompt_template\": \"Identify all products in this PDF...\",\n    \"system_prompt\": \"You are an expert at identifying products...\",\n    \"is_custom\": true,\n    \"version\": 2,\n    \"created_by\": \"user-uuid\",\n    \"created_at\": \"2025-11-08T10:00:00Z\",\n    \"updated_at\": \"2025-11-08T12:00:00Z\"\n  }\n]\n```\n\n## ⚠️ Error Codes\n\n- **400 Bad Request**: Invalid workspace_id\n- **401 Unauthorized**: Authentication required\n- **403 Forbidden**: Insufficient permissions\n- **500 Internal Server Error**: Database error","operationId":"list_prompts_admin_extraction_prompts_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"query","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"stage","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Stage"}},{"name":"category","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PromptResponse"},"title":"Response List Prompts Admin Extraction Prompts Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/extraction-prompts/{stage}/{category}":{"get":{"tags":["Admin - Prompts"],"summary":"Get Prompt","description":"Get specific prompt by stage and category","operationId":"get_prompt_admin_extraction_prompts__stage___category__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"stage","in":"path","required":true,"schema":{"type":"string","title":"Stage"}},{"name":"category","in":"path","required":true,"schema":{"type":"string","title":"Category"}},{"name":"workspace_id","in":"query","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PromptResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["Admin - Prompts"],"summary":"Update Prompt","description":"Update prompt with audit trail\n\nPath Parameters:\n- stage: Extraction stage (discovery, chunking, image_analysis, entity_creation)\n- category: Content category (products, certificates, logos, specifications)\n\nQuery Parameters:\n- workspace_id: Workspace ID\n\nBody:\n- prompt_template: New prompt template\n- system_prompt: Optional system prompt\n- change_reason: Reason for the change","operationId":"update_prompt_admin_extraction_prompts__stage___category__put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"stage","in":"path","required":true,"schema":{"type":"string","title":"Stage"}},{"name":"category","in":"path","required":true,"schema":{"type":"string","title":"Category"}},{"name":"workspace_id","in":"query","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdatePromptRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PromptResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/extraction-prompts/history/{prompt_id}":{"get":{"tags":["Admin - Prompts"],"summary":"Get Prompt History","description":"Get change history for a prompt","operationId":"get_prompt_history_admin_extraction_prompts_history__prompt_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"prompt_id","in":"path","required":true,"schema":{"type":"string","title":"Prompt Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PromptHistoryResponse"},"title":"Response Get Prompt History Admin Extraction Prompts History  Prompt Id  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/extraction-prompts/test":{"post":{"tags":["Admin - Prompts"],"summary":"Test Prompt","description":"Test a prompt before saving\n\nBody:\n- stage: Extraction stage\n- category: Content category\n- prompt_template: Prompt to test\n- test_content: Sample content to test with","operationId":"test_prompt_admin_extraction_prompts_test_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestPromptRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestPromptResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/admin/extraction-config":{"get":{"tags":["Admin - Config"],"summary":"Get Extraction Config","description":"Get extraction configuration for workspace","operationId":"get_extraction_config_admin_extraction_config_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"query","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractionConfigResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["Admin - Config"],"summary":"Update Extraction Config","description":"Update extraction configuration\n\nQuery Parameters:\n- workspace_id: Workspace ID\n\nBody: Configuration fields to update","operationId":"update_extraction_config_admin_extraction_config_put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"query","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateExtractionConfigRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractionConfigResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/saved-searches/check-duplicates":{"post":{"tags":["Saved Searches"],"summary":"Check For Duplicates","description":"Check if a search query has duplicates and get merge suggestions.\n\nUses AI-powered semantic analysis to find similar searches while\nrespecting contextual differences (floor vs wall, indoor vs outdoor).\n\nReturns:\n- has_duplicate: Whether a similar search exists\n- should_auto_merge: Whether to auto-merge (95%+ similarity)\n- merge_suggestion: Details about the suggested merge (if applicable)","operationId":"check_for_duplicates_api_saved_searches_check_duplicates_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckDuplicatesRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckDuplicatesResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/saved-searches/{search_id}/merge":{"post":{"tags":["Saved Searches"],"summary":"Merge Into Existing","description":"Merge a new search into an existing saved search.\n\nStrategy:\n- Keeps most specific query\n- Merges attributes (union, no conflicts)\n- Updates filters to be more inclusive\n- Increments merge_count\n- Updates last_merged_at timestamp","operationId":"merge_into_existing_api_saved_searches__search_id__merge_post","parameters":[{"name":"search_id","in":"path","required":true,"schema":{"type":"string","title":"Search Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MergeSearchRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SavedSearchResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/saved-searches":{"post":{"tags":["Saved Searches"],"summary":"Create Saved Search","description":"Create a new saved search with optional deduplication.\n\nIf check_for_duplicates=True (default), will check for similar searches\nand return existing one if found. Otherwise creates new search.","operationId":"create_saved_search_api_saved_searches_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateSavedSearchRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SavedSearchResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["Saved Searches"],"summary":"Get User Saved Searches","description":"Get all saved searches for a user with optional filtering.\n\nSupports:\n- Filtering by integration context (chat, moodboard, 3d_generation)\n- Pagination with limit/offset\n- Sorted by last_executed_at (most recent first)","operationId":"get_user_saved_searches_api_saved_searches_get","parameters":[{"name":"user_id","in":"query","required":true,"schema":{"type":"string","description":"User ID","title":"User Id"},"description":"User ID"},{"name":"integration_context","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by integration context","title":"Integration Context"},"description":"Filter by integration context"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"description":"Maximum number of results","default":50,"title":"Limit"},"description":"Maximum number of results"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Offset for pagination","default":0,"title":"Offset"},"description":"Offset for pagination"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/SavedSearchResponse"},"title":"Response Get User Saved Searches Api Saved Searches Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/saved-searches/{search_id}":{"get":{"tags":["Saved Searches"],"summary":"Get Saved Search","description":"Get a specific saved search by ID.","operationId":"get_saved_search_api_saved_searches__search_id__get","parameters":[{"name":"search_id","in":"path","required":true,"schema":{"type":"string","title":"Search Id"}},{"name":"user_id","in":"query","required":true,"schema":{"type":"string","description":"User ID","title":"User Id"},"description":"User ID"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SavedSearchResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["Saved Searches"],"summary":"Update Saved Search","description":"Update a saved search.","operationId":"update_saved_search_api_saved_searches__search_id__put","parameters":[{"name":"search_id","in":"path","required":true,"schema":{"type":"string","title":"Search Id"}},{"name":"user_id","in":"query","required":true,"schema":{"type":"string","description":"User ID","title":"User Id"},"description":"User ID"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateSavedSearchRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SavedSearchResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["Saved Searches"],"summary":"Delete Saved Search","description":"Delete a saved search.","operationId":"delete_saved_search_api_saved_searches__search_id__delete","parameters":[{"name":"search_id","in":"path","required":true,"schema":{"type":"string","title":"Search Id"}},{"name":"user_id","in":"query","required":true,"schema":{"type":"string","description":"User ID","title":"User Id"},"description":"User ID"}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/saved-searches/{search_id}/execute":{"post":{"tags":["Saved Searches"],"summary":"Execute Saved Search","description":"Execute a saved search and track usage.\n\nUpdates:\n- use_count (incremented)\n- last_executed_at (current timestamp)\n- relevance_score (based on usage patterns)","operationId":"execute_saved_search_api_saved_searches__search_id__execute_post","parameters":[{"name":"search_id","in":"path","required":true,"schema":{"type":"string","title":"Search Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExecuteSearchRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SavedSearchResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/duplicates/detect":{"post":{"tags":["Duplicate Detection"],"summary":"Detect Duplicates For Product","description":"Detect potential duplicates for a specific product.\n\nCRITICAL: Only finds duplicates from the SAME factory/manufacturer.\nReturns empty list if product has no factory metadata.\n\nReturns:\n    List of potential duplicate products with similarity scores","operationId":"detect_duplicates_for_product_api_duplicates_detect_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DetectDuplicatesRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DuplicateDetectionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/duplicates/batch-detect":{"post":{"tags":["Duplicate Detection"],"summary":"Batch Detect Duplicates","description":"Scan entire workspace for duplicate products.\n\nCRITICAL: Only detects duplicates from the SAME factory/manufacturer.\nProducts without factory metadata are skipped.\n\nThis can be a long-running operation for large workspaces.\n\nReturns:\n    List of duplicate pairs with similarity scores","operationId":"batch_detect_duplicates_api_duplicates_batch_detect_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchDetectRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DuplicateDetectionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/duplicates/cached":{"get":{"tags":["Duplicate Detection"],"summary":"Get Cached Duplicates","description":"Get cached duplicate detections.\n\nArgs:\n    workspace_id: Workspace to query\n    status: Filter by status ('pending', 'reviewed', 'merged', 'dismissed')\n    min_similarity: Minimum similarity score (default: 0.60)\n\nReturns:\n    List of cached duplicate pairs","operationId":"get_cached_duplicates_api_duplicates_cached_get","parameters":[{"name":"workspace_id","in":"query","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"name":"min_similarity","in":"query","required":false,"schema":{"type":"number","default":0.6,"title":"Min Similarity"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DuplicateDetectionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/duplicates/update-status":{"post":{"tags":["Duplicate Detection"],"summary":"Update Duplicate Status","description":"Update the status of a cached duplicate detection.\n\nStatuses:\n- 'pending': Not yet reviewed\n- 'reviewed': Admin has reviewed\n- 'merged': Products have been merged\n- 'dismissed': Not actually duplicates","operationId":"update_duplicate_status_api_duplicates_update_status_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateDuplicateStatusRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/duplicates/merge":{"post":{"tags":["Duplicate Detection"],"summary":"Merge Products","description":"Merge duplicate products into a single product.\n\nProcess:\n1. Merges data from source products into target product\n2. Transfers all relationships (images, chunks, etc.)\n3. Deletes source products\n4. Records merge in history for undo capability\n\nReturns:\n    Merge result with history ID and updated product","operationId":"merge_products_api_duplicates_merge_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MergeProductsRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MergeResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/duplicates/undo-merge":{"post":{"tags":["Duplicate Detection"],"summary":"Undo Merge","description":"Undo a product merge operation.\n\nRestores source products and reverts target product to pre-merge state.","operationId":"undo_merge_api_duplicates_undo_merge_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UndoMergeRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MergeResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/duplicates/merge-history":{"get":{"tags":["Duplicate Detection"],"summary":"Get Merge History","description":"Get merge history for a workspace.\n\nReturns:\n    List of merge operations with details","operationId":"get_merge_history_api_duplicates_merge_history_get","parameters":[{"name":"workspace_id","in":"query","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MergeHistoryResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/search/autocomplete":{"post":{"tags":["Search Suggestions"],"summary":"Get auto-complete suggestions","description":"Get intelligent auto-complete suggestions as user types","operationId":"autocomplete_api_search_autocomplete_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutoCompleteRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutoCompleteResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/search/trending":{"get":{"tags":["Search Suggestions"],"summary":"Get trending searches","description":"Get currently trending search queries","operationId":"get_trending_searches_api_search_trending_get","parameters":[{"name":"time_window","in":"query","required":false,"schema":{"type":"string","description":"Time window: hourly, daily, weekly, monthly","default":"daily","title":"Time Window"},"description":"Time window: hourly, daily, weekly, monthly"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"description":"Maximum number of results","default":20,"title":"Limit"},"description":"Maximum number of results"},{"name":"category","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by category","title":"Category"},"description":"Filter by category"},{"name":"min_search_count","in":"query","required":false,"schema":{"type":"integer","minimum":1,"description":"Minimum search count","default":2,"title":"Min Search Count"},"description":"Minimum search count"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TrendingSearchesResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/search/typo-correction":{"post":{"tags":["Search Suggestions"],"summary":"Check for typos and suggest corrections","description":"Detect typos and suggest corrected queries","operationId":"check_typo_correction_api_search_typo_correction_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TypoCorrectionRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TypoCorrectionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/search/query-expansion":{"post":{"tags":["Search Suggestions"],"summary":"Expand query with synonyms and related terms","description":"Expand search query with synonyms and related concepts","operationId":"expand_query_api_search_query_expansion_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/QueryExpansionRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QueryExpansionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/search/track-click":{"post":{"tags":["Search Suggestions"],"summary":"Track suggestion click","description":"Track when user clicks on a search suggestion","operationId":"track_suggestion_click_api_search_track_click_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuggestionClickRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuggestionClickResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/import/process":{"post":{"tags":["Data Import"],"summary":"Process Import Job","description":"Start processing an import job.\n\nThis endpoint is called by the Edge Function after creating the import job.\nIt processes the job in the background using batch processing, image downloads,\nand product normalization.\n\nArgs:\n    request: Process import request\n    background_tasks: FastAPI background tasks\n    \nReturns:\n    Processing status","operationId":"process_import_job_api_import_process_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProcessImportRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportProcessResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/import/jobs/{job_id}":{"get":{"tags":["Data Import"],"summary":"Get Import Job Status","description":"Get import job status and progress.\n\nArgs:\n    job_id: Import job ID\n    \nReturns:\n    Job status with progress information","operationId":"get_import_job_status_api_import_jobs__job_id__get","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportJobStatus"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/import/history":{"get":{"tags":["Data Import"],"summary":"Get Import History","description":"Get import history for a workspace.\n\nArgs:\n    workspace_id: Workspace ID\n    page: Page number (1-indexed)\n    page_size: Items per page\n    status: Optional status filter\n    import_type: Optional import type filter\n    \nReturns:\n    Paginated import history","operationId":"get_import_history_api_import_history_get","parameters":[{"name":"workspace_id","in":"query","required":true,"schema":{"type":"string","description":"Workspace ID","title":"Workspace Id"},"description":"Workspace ID"},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"description":"Page number","default":1,"title":"Page"},"description":"Page number"},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"description":"Items per page","default":20,"title":"Page Size"},"description":"Items per page"},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by status","title":"Status"},"description":"Filter by status"},{"name":"import_type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by import type","title":"Import Type"},"description":"Filter by import type"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportHistoryListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/import/health":{"get":{"tags":["Data Import"],"summary":"Import Health Check","description":"Health check endpoint for the data import API.\n\nReturns:\n    Health status information","operationId":"import_health_check_api_import_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServiceHealthResponse"}}}}}}},"/api/scraping/process-session":{"post":{"tags":["Web Scraping"],"summary":"Process Scraping Session","description":"Process a Firecrawl scraping session and create products.\n\nCalled by the Edge Function (scrape-session-manager) when scraping completes.\nCreates a background job for tracking, then processes the session via\nWebScrapingService which runs the full pipeline:\n  1. Product discovery (Claude/GPT from markdown)\n  2. Product creation with text embeddings (Voyage AI, inline)\n  3. Image download → classification (Qwen/Claude) → 5 SLIG embeddings\n  4. Phase 2: Qwen3-VL analysis → understanding embeddings (1024D)","operationId":"process_scraping_session_api_scraping_process_session_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProcessSessionRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProcessSessionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/scraping/session/{session_id}/status":{"get":{"tags":["Web Scraping"],"summary":"Get Session Status","description":"Get scraping session processing status.","operationId":"get_session_status_api_scraping_session__session_id__status_get","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"string","description":"Scraping session ID","title":"Session Id"},"description":"Scraping session ID"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionStatusResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/scraping/session/{session_id}/retry":{"post":{"tags":["Web Scraping"],"summary":"Retry Session Processing","description":"Retry processing a failed scraping session.","operationId":"retry_session_processing_api_scraping_session__session_id__retry_post","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"string","description":"Scraping session ID","title":"Session Id"},"description":"Scraping session ID"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProcessSessionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/job-health/dashboard":{"get":{"tags":["Job Health"],"summary":"Get Job Health Dashboard","description":"Get comprehensive job health dashboard data.\n\nReturns:\n    - Active jobs with progress\n    - Stuck jobs with analysis\n    - Performance metrics\n    - Health alerts","operationId":"get_job_health_dashboard_api_job_health_dashboard_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobDashboardResponse"}}}}}}},"/api/job-health/stuck-jobs":{"get":{"tags":["Job Health"],"summary":"Get Stuck Jobs","description":"Get all currently stuck jobs with analysis.","operationId":"get_stuck_jobs_api_job_health_stuck_jobs_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StuckJobListResponse"}}}}}}},"/api/job-health/job/{job_id}":{"get":{"tags":["Job Health"],"summary":"Get Job Details","description":"Get detailed information about a specific job.","operationId":"get_job_details_api_job_health_job__job_id__get","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobDiagnosticsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/kb/documents":{"post":{"tags":["Knowledge Base"],"summary":"Create a new knowledge base document","description":"Create a new document with automatic embedding generation","operationId":"create_kb_document_api_kb_documents_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateKBDocRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KBDocResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/kb/documents/{doc_id}":{"get":{"tags":["Knowledge Base"],"summary":"Get a knowledge base document","description":"Retrieve a specific document by ID","operationId":"get_kb_document_api_kb_documents__doc_id__get","parameters":[{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","title":"Doc Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KBDocResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["Knowledge Base"],"summary":"Update a knowledge base document","description":"Update document with smart embedding regeneration","operationId":"update_kb_document_api_kb_documents__doc_id__patch","parameters":[{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","title":"Doc Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateKBDocRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KBDocResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["Knowledge Base"],"summary":"Delete a knowledge base document","description":"Delete a document and all related data","operationId":"delete_kb_document_api_kb_documents__doc_id__delete","parameters":[{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","title":"Doc Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/kb/documents/from-pdf":{"post":{"tags":["Knowledge Base"],"summary":"Create document from PDF","description":"Extract text from PDF and create document with embeddings","operationId":"create_kb_document_from_pdf_api_kb_documents_from_pdf_post","parameters":[{"name":"workspace_id","in":"query","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"title","in":"query","required":true,"schema":{"type":"string","title":"Title"}},{"name":"category_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category Id"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_create_kb_document_from_pdf_api_kb_documents_from_pdf_post"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KBDocResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/kb/categories":{"post":{"tags":["Knowledge Base"],"summary":"Create a category","description":"Create a new knowledge base category","operationId":"create_category_api_kb_categories_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCategoryRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CategoryResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["Knowledge Base"],"summary":"List categories","description":"Get all categories for a workspace","operationId":"list_categories_api_kb_categories_get","parameters":[{"name":"workspace_id","in":"query","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/CategoryResponse"},"title":"Response List Categories Api Kb Categories Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/kb/attachments":{"post":{"tags":["Knowledge Base"],"summary":"Attach document to product","description":"Link a knowledge base document to a product","operationId":"attach_document_to_product_api_kb_attachments_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AttachProductRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AttachmentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/kb/documents/{doc_id}/attachments":{"get":{"tags":["Knowledge Base"],"summary":"Get document attachments","description":"Get all product attachments for a document","operationId":"get_document_attachments_api_kb_documents__doc_id__attachments_get","parameters":[{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","title":"Doc Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AttachmentResponse"},"title":"Response Get Document Attachments Api Kb Documents  Doc Id  Attachments Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/kb/products/{product_id}/documents":{"get":{"tags":["Knowledge Base"],"summary":"Get product documents","description":"Get all knowledge base documents attached to a product","operationId":"get_product_documents_api_kb_products__product_id__documents_get","parameters":[{"name":"product_id","in":"path","required":true,"schema":{"type":"string","title":"Product Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/KBDocResponse"},"title":"Response Get Product Documents Api Kb Products  Product Id  Documents Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/kb/search":{"post":{"tags":["Knowledge Base"],"summary":"Search Kb Documents","description":"Search knowledge base documents using semantic, full-text, or hybrid search.\n\n**Architecture:**\n1. Frontend calls MIVAA API with search query\n2. MIVAA generates embedding for query using OpenAI (text-embedding-3-small)\n3. MIVAA calls Supabase `kb_match_docs()` RPC function with query embedding\n4. Supabase performs vector similarity search using pgvector `<=>` operator\n5. Returns ranked results with similarity scores\n\n**Why MIVAA Backend is Required:**\n- Document embeddings already stored in `kb_docs.text_embedding` (generated when doc created)\n- Search only generates ONE embedding (for the query)\n- Cannot generate embeddings in Supabase RPC (requires OpenAI API call)\n- Uses pgvector's optimized cosine similarity for fast search\n\n**Search Types:**\n- **semantic**: Vector similarity using pgvector cosine distance\n  - Generates query embedding via OpenAI\n  - Compares against stored document embeddings\n  - Returns results with similarity scores (0.0 - 1.0)\n  - Minimum threshold: 0.5\n- **full_text**: ILIKE-based keyword matching\n  - Searches title and content fields\n  - Case-insensitive\n- **hybrid**: Combination of semantic + full-text\n  - Weighted scoring for best results\n\n**Example Request:**\n```json\n{\n  \"workspace_id\": \"uuid\",\n  \"query\": \"sustainable wood materials\",\n  \"search_type\": \"semantic\",\n  \"limit\": 20\n}\n```\n\n**Example Response:**\n```json\n{\n  \"results\": [\n    {\n      \"id\": \"uuid\",\n      \"title\": \"Sustainable Wood Guide\",\n      \"similarity\": 0.87,\n      \"content\": \"...\",\n      \"category_id\": \"uuid\"\n    }\n  ],\n  \"search_time_ms\": 145.3,\n  \"total_results\": 5\n}\n```","operationId":"search_kb_documents_api_kb_search_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchKBRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchKBResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/kb/health":{"get":{"tags":["Knowledge Base"],"summary":"Kb Health Check","description":"Health check endpoint for Knowledge Base API.","operationId":"kb_health_check_api_kb_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KBHealthResponse"}}}}}}},"/api/category-prototypes/populate":{"post":{"tags":["Category Prototypes"],"summary":"Populate Category Prototypes","description":"Populate all material categories with prototype descriptions and embeddings\n\nThis endpoint:\n1. Generates CLIP text embeddings for predefined category descriptions\n2. Updates material_categories table with prototypes\n3. Returns summary of operation","operationId":"populate_category_prototypes_api_category_prototypes_populate_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrototypePopulationResponse"}}}}}}},"/api/category-prototypes/verify":{"get":{"tags":["Category Prototypes"],"summary":"Verify Prototypes","description":"Verify that prototypes were populated correctly","operationId":"verify_prototypes_api_category_prototypes_verify_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrototypeVerifyResponse"}}}}}}},"/api/internal/classify-images/{job_id}":{"post":{"tags":["Internal Pipeline"],"summary":"Classify Images","description":"Classify images as material or non-material using Qwen Vision + Claude validation.\n\nThis endpoint:\n1. Uses vision model for fast initial classification\n2. Validates uncertain cases (confidence < threshold) with Claude Sonnet\n3. Returns separated lists of material and non-material images\n\nAI Configuration (Optional):\n- classification_primary_model: Primary classification model (default: Qwen3-VL-8B)\n- classification_validation_model: Validation model (default: Claude Sonnet 4.5)\n- classification_confidence_threshold: Threshold for validation (default: 0.7)\n- classification_temperature: Temperature setting (default: 0.1)\n- classification_max_tokens: Max tokens for responses (default: 512)\n\nExample with custom AI config:\n```json\n{\n  \"job_id\": \"abc123\",\n  \"extracted_images\": [...],\n  \"ai_config\": {\n    \"classification_primary_model\": \"Qwen/Qwen3-VL-8B-Instruct\",\n    \"classification_validation_model\": \"claude-sonnet-4-6\",\n    \"classification_confidence_threshold\": 0.8\n  }\n}\n```\n\nArgs:\n    job_id: Job ID for tracking\n    request: Classification request with extracted images and optional AI config\n\nReturns:\n    ClassifyImagesResponse with material and non-material images","operationId":"classify_images_api_internal_classify_images__job_id__post","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClassifyImagesRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClassifyImagesResponse"}}}},"500":{"description":"Internal server error"},"404":{"description":"Job not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/internal/upload-images/{job_id}":{"post":{"tags":["Internal Pipeline"],"summary":"Upload Images","description":"Upload material images to Supabase Storage.\n\nThis endpoint:\n1. Uploads material images to Supabase Storage bucket\n2. Returns uploaded images with storage URLs\n\nArgs:\n    job_id: Job ID for tracking\n    request: Upload request with material images\n\nReturns:\n    UploadImagesResponse with uploaded images","operationId":"upload_images_api_internal_upload_images__job_id__post","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UploadImagesRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UploadImagesResponse"}}}},"500":{"description":"Internal server error"},"404":{"description":"Job not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/internal/save-images-db/{job_id}":{"post":{"tags":["Internal Pipeline"],"summary":"Save Images To Db","description":"Save images to database and generate visual embeddings (SigLIP/CLIP).\n\nThis endpoint:\n1. Saves images to document_images table\n2. Generates visual embeddings using SigLIP (primary) or CLIP (fallback)\n3. Creates 5 specialized embeddings per image (visual, color, texture, style, material)\n4. Saves embeddings to database table AND VECS collection\n\nAI Configuration (Optional):\n- visual_embedding_primary: Primary visual model (default: SigLIP ViT-SO400M)\n- visual_embedding_fallback: Fallback visual model (default: CLIP ViT-B/32)\n\nExample with custom AI config:\n```json\n{\n  \"job_id\": \"abc123\",\n  \"material_images\": [...],\n  \"document_id\": \"doc123\",\n  \"workspace_id\": \"ws123\",\n  \"ai_config\": {\n    \"visual_embedding_primary\": \"google/siglip-so400m-patch14-384\",\n    \"visual_embedding_fallback\": \"openai/clip-vit-base-patch32\"\n  }\n}\n```\n\nArgs:\n    job_id: Job ID for tracking\n    request: Save request with material images and optional AI config\n\nReturns:\n    SaveImagesResponse with counts and model used","operationId":"save_images_to_db_api_internal_save_images_db__job_id__post","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SaveImagesRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SaveImagesResponse"}}}},"500":{"description":"Internal server error"},"404":{"description":"Job not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/internal/create-chunks/{job_id}":{"post":{"tags":["Internal Pipeline"],"summary":"Create Chunks","description":"Create semantic chunks and generate text embeddings.\n\nThis endpoint:\n1. Creates semantic chunks from extracted text\n2. Saves chunks to database\n3. Generates text embeddings for each chunk\n4. Creates chunk-to-product relationships\n5. **Prevents duplicates** - skips if chunks already exist\n\n**Use Cases:**\n- Regenerate chunks after text extraction updates\n- Create chunks for documents that failed chunking\n- Manual chunk generation for testing\n\nArgs:\n    job_id: Job ID for tracking\n    request: Chunking request with extracted text\n    supabase_client: Supabase client for database operations\n\nReturns:\n    CreateChunksResponse with counts","operationId":"create_chunks_api_internal_create_chunks__job_id__post","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateChunksRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateChunksResponse"}}}},"500":{"description":"Internal server error"},"404":{"description":"Job not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/internal/create-relationships/{job_id}":{"post":{"tags":["Internal Pipeline"],"summary":"Create Relationships","description":"Create all relationships between chunks, images, and products.\n\nThis endpoint:\n1. Creates chunk-to-image relationships based on embedding similarity\n2. Creates product-to-image relationships based on page ranges\n\nArgs:\n    job_id: Job ID for tracking\n    request: Relationships request\n\nReturns:\n    CreateRelationshipsResponse with counts","operationId":"create_relationships_api_internal_create_relationships__job_id__post","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateRelationshipsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateRelationshipsResponse"}}}},"500":{"description":"Internal server error"},"404":{"description":"Job not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/internal/extract-metadata/{job_id}":{"post":{"tags":["Internal Pipeline"],"summary":"Extract Metadata","description":"Extract comprehensive metadata from PDF text for products.\n\nThis endpoint:\n1. Extracts product-specific text from PDF\n2. Uses AI (Claude or GPT) to extract structured metadata\n3. Enriches product records with extracted metadata\n4. Tracks which model was used and extraction method\n\nArgs:\n    job_id: Job ID for tracking\n    request: Metadata extraction request with product IDs and PDF text\n\nReturns:\n    ExtractMetadataResponse with extraction results","operationId":"extract_metadata_api_internal_extract_metadata__job_id__post","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractMetadataRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractMetadataResponse"}}}},"500":{"description":"Internal server error"},"404":{"description":"Job not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/internal/generate-product-embeddings":{"post":{"tags":["Internal Pipeline"],"summary":"Generate Product Embeddings","description":"Generate embeddings for products that don't have them yet.\n\nThis endpoint:\n1. Finds products without embeddings (no associated chunks)\n2. Creates chunks from product name + description\n3. Queues embedding generation jobs\n\n**Use Cases:**\n- Fix missing embeddings from old PDF processing\n- Regenerate embeddings after product updates\n- Bulk embedding generation for imported products\n\nArgs:\n    request: Request with workspace_id, optional document_id and product_ids\n\nReturns:\n    GenerateProductEmbeddingsResponse with counts and errors","operationId":"generate_product_embeddings_api_internal_generate_product_embeddings_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateProductEmbeddingsRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateProductEmbeddingsResponse"}}}},"500":{"description":"Internal server error"},"404":{"description":"Job not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/internal/regenerate-image-embeddings":{"post":{"tags":["Internal Pipeline"],"summary":"Regenerate Image Embeddings","description":"Regenerate visual embeddings for existing images in the database.\n\nThis endpoint:\n1. Fetches existing images from document_images table\n2. Downloads images from Supabase Storage\n3. Generates 5 CLIP embeddings per image (visual, color, texture, style, material)\n4. Generates understanding embedding (1024D) if vision_analysis exists\n5. Saves embeddings to VECS collections\n\n**Use Cases:**\n- Fix missing embeddings from old PDF processing\n- Regenerate embeddings after model upgrades\n- Bulk embedding generation for imported images\n\n**Example Request:**\n```json\n{\n  \"workspace_id\": \"ffafc28b-1b8b-4b0d-b226-9f9a6154004e\",\n  \"document_id\": \"doc-123\",  // Optional: limit to specific document\n  \"image_ids\": [\"img-1\", \"img-2\"],  // Optional: specific images\n  \"force_regenerate\": false  // Optional: regenerate even if embeddings exist\n}\n```\n\nArgs:\n    request: Request with workspace_id, optional document_id and image_ids\n\nReturns:\n    RegenerateImageEmbeddingsResponse with counts and errors","operationId":"regenerate_image_embeddings_api_internal_regenerate_image_embeddings_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegenerateImageEmbeddingsRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegenerateImageEmbeddingsResponse"}}}},"500":{"description":"Internal server error"},"404":{"description":"Job not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/internal/reset-job/{job_id}":{"post":{"tags":["Internal Pipeline"],"summary":"Reset Job","description":"Reset a stuck / failed / stale job back to `pending` so the scheduler\ncan pick it up again.\n\nHistorical note (2026-04-11): the previous revision wrote\n`status='initialized'` which violated the\n`background_jobs_status_check` CHECK constraint (the DB only accepts\npending / processing / completed / failed / cancelled / interrupted).\nEvery single reset call has been failing with a 500 ever since that\nconstraint was added. Sentry MIVAA-4ZW, MIVAA-4ZV.\n\nAlso: by default this endpoint refuses to reset a job that's already\nin a terminal success state (`completed`). Overwriting a completed\njob means discarding the successful result — almost always a\nmistake. Pass `?force=true` to override when you actually want that.\n\nArgs:\n    job_id: Job ID to reset\n    force:  When true, allow resetting jobs in terminal states\n            (`completed`, `failed`, `cancelled`). Defaults to False.\n\nReturns:\n    ResetJobResponse with previous status","operationId":"reset_job_api_internal_reset_job__job_id__post","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}},{"name":"force","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Force"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResetJobResponse"}}}},"500":{"description":"Internal server error"},"404":{"description":"Job not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/internal/extract-entities":{"post":{"tags":["Internal Pipeline"],"summary":"Extract Entities","description":"Match document entities to products for an already-processed document.\n\nRuns DocumentEntityService.match_entities_to_products() which links\nexisting document_entities records to products by page overlap,\nfactory/manufacturer match, and name similarity.\n\nArgs:\n    request: document_id + workspace_id\n\nReturns:\n    ExtractEntitiesResponse with match statistics","operationId":"extract_entities_api_internal_extract_entities_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractEntitiesRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractEntitiesResponse"}}}},"500":{"description":"Internal server error"},"404":{"description":"Job not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/internal/generate-entity-embeddings":{"post":{"tags":["Internal Pipeline"],"summary":"Generate Entity Embeddings","description":"Generate text embeddings for all document entities.\n\nRuns DocumentEntityService.generate_entity_embeddings() which creates\nVoyage AI 1024D text embeddings for each entity and stores them in the\nembeddings table with entity_type='entity'.\n\nArgs:\n    request: document_id + workspace_id\n\nReturns:\n    GenerateEntityEmbeddingsResponse with counts","operationId":"generate_entity_embeddings_api_internal_generate_entity_embeddings_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateEntityEmbeddingsRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateEntityEmbeddingsResponse"}}}},"500":{"description":"Internal server error"},"404":{"description":"Job not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/internal/queue-understanding-embeddings":{"post":{"tags":["Internal Pipeline"],"summary":"Queue Understanding Embeddings","description":"Queue Phase 2 understanding embedding generation for a document.\n\nPhase 2 runs Qwen3-VL vision analysis on document images, converts the\nvision_analysis JSON to text, then generates 1024D Voyage AI embeddings\n(understanding embeddings) for semantic spec-based search.\n\nThis is safe to re-run — it skips images that already have understanding embeddings.\n\nArgs:\n    request: document_id + workspace_id + priority\n\nReturns:\n    QueueUnderstandingEmbeddingsResponse with queued job_id","operationId":"queue_understanding_embeddings_api_internal_queue_understanding_embeddings_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/QueueUnderstandingEmbeddingsRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QueueUnderstandingEmbeddingsResponse"}}}},"500":{"description":"Internal server error"},"404":{"description":"Job not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/internal/regenerate-text-embeddings":{"post":{"tags":["Internal Pipeline"],"summary":"Regenerate Text Embeddings","description":"Generate Voyage AI text embeddings for document chunks that are missing them.\n\nFetches chunks with null text_embedding, generates 1024D Voyage AI embeddings\ninline, and saves directly to document_chunks.text_embedding.\n\nArgs:\n    request: workspace_id, optional document_id/chunk_ids, force_regenerate flag\n\nReturns:\n    RegenerateTextEmbeddingsResponse with counts","operationId":"regenerate_text_embeddings_api_internal_regenerate_text_embeddings_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegenerateTextEmbeddingsRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegenerateTextEmbeddingsResponse"}}}},"500":{"description":"Internal server error"},"404":{"description":"Job not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/internal/validate-pipeline/{job_id}":{"post":{"tags":["Internal Pipeline"],"summary":"Validate Pipeline","description":"Audit pipeline completion status for a job.\n\nChecks each pipeline stage by querying the relevant DB tables and\nreturns a summary of what's complete, what's missing, and what to fix.\n\nArgs:\n    job_id: Job ID to validate\n\nReturns:\n    ValidatePipelineResponse with per-stage completion status and recommendations","operationId":"validate_pipeline_api_internal_validate_pipeline__job_id__post","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidatePipelineResponse"}}}},"500":{"description":"Internal server error"},"404":{"description":"Job not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/internal/enrich-existing-product/{product_id}":{"post":{"tags":["Internal Pipeline"],"summary":"Enrich Existing Product","description":"Retroactively run Stage 4.7 enrichment (chunk regex + vision_analysis rollup)\non an existing product row. Only fills null/empty fields — never overwrites.\n\nUse this to backfill products created before the Stage 4.7 enrichment pass\nwas added to the pipeline. After the next full run, this endpoint becomes\nunnecessary (the enrichment runs automatically).\n\nArgs:\n    product_id: The product UUID to enrich.\n\nReturns:\n    Stats about what was filled.","operationId":"enrich_existing_product_api_internal_enrich_existing_product__product_id__post","parameters":[{"name":"product_id","in":"path","required":true,"schema":{"type":"string","title":"Product Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnrichExistingProductResponse"}}}},"500":{"description":"Internal server error"},"404":{"description":"Job not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/internal/run-catalog-knowledge/{document_id}":{"post":{"tags":["Internal Pipeline"],"summary":"Run Catalog Knowledge","description":"Standalone runner for Layer 1 (catalog layout analyzer) + Layer 2\n(catalog legend extractor) against a single document.\n\nUse this when you want to (re)process the catalog-wide data — page\nclassification, legend extraction, certification propagation — WITHOUT\nre-running the full Stage 0-4 pipeline. This is the only endpoint that\nre-runs the catalog_legends and certifications propagation for every\nproduct in the document.\n\nQuery param `force=true` bypasses the idempotency check and re-analyzes\neven if `documents.metadata.catalog_layout.analyzed_at` exists.","operationId":"run_catalog_knowledge_api_internal_run_catalog_knowledge__document_id__post","parameters":[{"name":"document_id","in":"path","required":true,"schema":{"type":"string","title":"Document Id"}},{"name":"force","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Force"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RunCatalogKnowledgeResponse"}}}},"500":{"description":"Internal server error"},"404":{"description":"Job not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/internal/document-extraction-status/{document_id}":{"get":{"tags":["Internal Pipeline"],"summary":"Document Extraction Status","description":"Observability endpoint — returns a snapshot of how well a document has\nbeen processed end-to-end. Shows:\n\n  - Whether Layer 1 (catalog layout) ran\n  - Whether Layer 2 (catalog legends + certs) ran\n  - Which legend types were found\n  - Global certifications propagated\n  - Per-product field coverage (populated / missing critical)\n  - Source breakdown (how many fields came from chunks vs vision vs legend)\n  - Issues detected (missing legend pages, failed extractions, etc.)\n\nUse this to triage a catalog after ingestion: run it, see which products\nare underfilled and which legends are missing, and decide whether to\nre-run a specific layer or accept the current state.","operationId":"document_extraction_status_api_internal_document_extraction_status__document_id__get","parameters":[{"name":"document_id","in":"path","required":true,"schema":{"type":"string","title":"Document Id"}},{"name":"sample_limit","in":"query","required":false,"schema":{"type":"integer","default":10,"title":"Sample Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentExtractionStatusResponse"}}}},"500":{"description":"Internal server error"},"404":{"description":"Job not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/prompt-templates":{"get":{"tags":["Admin - Prompt Templates"],"summary":"List Prompt Templates","description":"**📋 List Prompt Templates**\n\nList all customizable AI prompts for a workspace.\n\n## Query Parameters\n- **workspace_id** (required): Workspace UUID\n- **stage** (optional): Filter by stage (metadata_extraction, discovery, classification, chunking)\n- **category** (optional): Filter by category (products, certificates, logos, specifications)\n- **industry** (optional): Filter by industry (construction, interior_design, general)\n- **include_inactive** (optional): Include inactive templates (default: false)","operationId":"list_prompt_templates_admin_prompt_templates_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"query","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"stage","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Stage"}},{"name":"category","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category"}},{"name":"industry","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Industry"}},{"name":"include_inactive","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Include Inactive"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PromptTemplateResponse"},"title":"Response List Prompt Templates Admin Prompt Templates Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["Admin - Prompt Templates"],"summary":"Create Prompt Template","description":"**➕ Create Prompt Template**\n\nCreate a new customizable AI prompt template.\n\n## Stages\n- **metadata_extraction**: Extract product metadata from PDFs\n- **discovery**: Discover products in PDFs\n- **classification**: Classify images\n- **chunking**: Semantic text chunking\n\n## Industries\n- **general**: Default for all material types\n- **construction**: Tiles, flooring, construction materials\n- **interior_design**: Furniture, decor, design products","operationId":"create_prompt_template_admin_prompt_templates_post","security":[{"HTTPBearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePromptTemplateRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","title":"Response Create Prompt Template Admin Prompt Templates Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/prompt-templates/{template_id}":{"put":{"tags":["Admin - Prompt Templates"],"summary":"Update Prompt Template","description":"**✏️ Update Prompt Template**\n\nUpdate an existing prompt template.","operationId":"update_prompt_template_admin_prompt_templates__template_id__put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"template_id","in":"path","required":true,"schema":{"type":"string","title":"Template Id"}},{"name":"workspace_id","in":"query","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdatePromptTemplateRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","title":"Response Update Prompt Template Admin Prompt Templates  Template Id  Put"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["Admin - Prompt Templates"],"summary":"Delete Prompt Template","description":"**🗑️ Delete Prompt Template**\n\nSoft delete a prompt template (sets is_active=false).","operationId":"delete_prompt_template_admin_prompt_templates__template_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"template_id","in":"path","required":true,"schema":{"type":"string","title":"Template Id"}},{"name":"workspace_id","in":"query","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/prompt-templates/{template_id}/history":{"get":{"tags":["Admin - Prompt Templates"],"summary":"Get Prompt Template History","description":"**📜 Get Prompt Template History**\n\nGet change history for a prompt template.","operationId":"get_prompt_template_history_admin_prompt_templates__template_id__history_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"template_id","in":"path","required":true,"schema":{"type":"string","title":"Template Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PromptTemplateHistoryResponse"},"title":"Response Get Prompt Template History Admin Prompt Templates  Template Id  History Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/restart-service":{"post":{"tags":["Admin"],"summary":"Restart Service","description":"Restart the MIVAA service with job protection.\n\n**Protection Rules**:\n- If active jobs exist and force=False: BLOCK restart\n- If active jobs exist and force=True: Interrupt jobs and restart\n- If no active jobs: Restart immediately\n\n**Required**:\n- admin_token: Must match ADMIN_RESTART_TOKEN environment variable\n- reason: Explanation for restart (logged to Sentry)\n\n**Example**:\n```json\n{\n    \"force\": false,\n    \"reason\": \"Deploy critical security patch\",\n    \"admin_token\": \"your-secret-token\"\n}\n```","operationId":"restart_service_api_admin_restart_service_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RestartRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RestartResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/feedback/submit":{"post":{"tags":["User Feedback"],"summary":"Submit Feedback","description":"Submit user feedback with automatic sentiment analysis\n\nThis endpoint:\n1. Accepts user feedback text and optional rating\n2. Performs AI-powered sentiment analysis\n3. Stores feedback with sentiment results in database\n4. Returns complete feedback record with analysis","operationId":"submit_feedback_api_feedback_submit_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubmitFeedbackRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FeedbackResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/feedback/material/{material_id}":{"get":{"tags":["User Feedback"],"summary":"Get Material Feedback","description":"Get all feedback for a specific material\n\nReturns public feedback with sentiment analysis, sorted by most recent.","operationId":"get_material_feedback_api_feedback_material__material_id__get","parameters":[{"name":"material_id","in":"path","required":true,"schema":{"type":"string","title":"Material Id"}},{"name":"workspace_id","in":"query","required":true,"schema":{"type":"string","description":"Workspace ID","title":"Workspace Id"},"description":"Workspace ID"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"description":"Maximum number of results","default":50,"title":"Limit"},"description":"Maximum number of results"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Offset for pagination","default":0,"title":"Offset"},"description":"Offset for pagination"},{"name":"sentiment_filter","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by sentiment: positive, neutral, negative","title":"Sentiment Filter"},"description":"Filter by sentiment: positive, neutral, negative"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/FeedbackResponse"},"title":"Response Get Material Feedback Api Feedback Material  Material Id  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/feedback/trends":{"get":{"tags":["User Feedback"],"summary":"Get Sentiment Trends","description":"Get sentiment trends over time\n\nReturns aggregated sentiment metrics by time window.","operationId":"get_sentiment_trends_api_feedback_trends_get","parameters":[{"name":"workspace_id","in":"query","required":true,"schema":{"type":"string","description":"Workspace ID","title":"Workspace Id"},"description":"Workspace ID"},{"name":"material_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Material ID (optional, for all materials if not provided)","title":"Material Id"},"description":"Material ID (optional, for all materials if not provided)"},{"name":"time_window","in":"query","required":false,"schema":{"type":"string","description":"Time window: hourly, daily, weekly, monthly","default":"daily","title":"Time Window"},"description":"Time window: hourly, daily, weekly, monthly"},{"name":"days_back","in":"query","required":false,"schema":{"type":"integer","maximum":365,"minimum":1,"description":"Number of days to look back","default":30,"title":"Days Back"},"description":"Number of days to look back"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/SentimentTrendsResponse"},"title":"Response Get Sentiment Trends Api Feedback Trends Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/feedback/{feedback_id}/helpful":{"post":{"tags":["User Feedback"],"summary":"Mark Feedback Helpful","description":"Mark feedback as helpful (increment helpful_count)","operationId":"mark_feedback_helpful_api_feedback__feedback_id__helpful_post","parameters":[{"name":"feedback_id","in":"path","required":true,"schema":{"type":"string","title":"Feedback Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","title":"Response Mark Feedback Helpful Api Feedback  Feedback Id  Helpful Post","$ref":"#/components/schemas/StatusResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/feedback/health":{"get":{"tags":["User Feedback"],"summary":"Feedback Health Check","description":"Health check endpoint for User Feedback API","operationId":"feedback_health_check_api_feedback_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServiceHealthResponse"}}}}}}},"/api/interior":{"post":{"tags":["Interior Design"],"summary":"Create Interior Design","description":"Generate interior design images using multiple AI models.\nCreates job in database and processes in background.\nFrontend polls database for updates.","operationId":"create_interior_design_api_interior_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InteriorRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InteriorDesignResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/chunk-quality/metrics":{"get":{"tags":["Chunk Quality"],"summary":"Get Chunk Quality Metrics","description":"Get chunk quality metrics for the specified time period.\n\nArgs:\n    days: Number of days to look back (default: 30)\n    workspace_id: Optional workspace filter\n\nReturns:\n    ChunkQualityMetrics with aggregated statistics","operationId":"get_chunk_quality_metrics_admin_chunk_quality_metrics_get","parameters":[{"name":"days","in":"query","required":false,"schema":{"type":"integer","maximum":365,"minimum":1,"default":30,"title":"Days"}},{"name":"workspace_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChunkQualityMetrics"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/chunk-quality/flagged":{"get":{"tags":["Chunk Quality"],"summary":"Get Flagged Chunks","description":"Get list of flagged chunks for review.\n\nFilters:\n- workspace_id: Filter by workspace\n- document_id: Filter by document\n- reviewed: Filter by review status (None = all, True = reviewed, False = pending)\n- limit: Maximum number of results","operationId":"get_flagged_chunks_admin_chunk_quality_flagged_get","parameters":[{"name":"workspace_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workspace Id"}},{"name":"document_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Document Id"}},{"name":"reviewed","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Reviewed"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":50,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/FlaggedChunk"},"title":"Response Get Flagged Chunks Admin Chunk Quality Flagged Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/chunk-quality/flagged/{flag_id}/review":{"post":{"tags":["Chunk Quality"],"summary":"Review Flagged Chunk","description":"Review a flagged chunk.\n\nActions:\n- approve: Mark as reviewed and approved\n- reject: Mark as reviewed and rejected\n- delete_chunk: Delete the chunk entirely","operationId":"review_flagged_chunk_admin_chunk_quality_flagged__flag_id__review_post","parameters":[{"name":"flag_id","in":"path","required":true,"schema":{"type":"string","title":"Flag Id"}},{"name":"action","in":"query","required":true,"schema":{"type":"string","title":"Action"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FlagReviewResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/price-monitoring/start":{"post":{"tags":["Price Monitoring"],"summary":"Start Monitoring","description":"Start price monitoring for a product.\n\nRequires Factory or Store role.","operationId":"start_monitoring_api_v1_price_monitoring_start_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StartMonitoringRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MonitoringActionResponse"}}}},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/price-monitoring/stop":{"post":{"tags":["Price Monitoring"],"summary":"Stop Monitoring","description":"Stop price monitoring for a product.","operationId":"stop_monitoring_api_v1_price_monitoring_stop_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"product_id","in":"query","required":true,"schema":{"type":"string","description":"Product UUID","title":"Product Id"},"description":"Product UUID"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MonitoringActionResponse"}}}},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/price-monitoring/check-now":{"post":{"tags":["Price Monitoring"],"summary":"Check Prices Now","description":"Perform on-demand price check for a product.\n\nScrapes all active competitor sources and saves price history.\nDebits Firecrawl credits from user's account.","operationId":"check_prices_now_api_v1_price_monitoring_check_now_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckPricesRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MonitoringActionResponse"}}}},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/price-monitoring/status/{product_id}":{"get":{"tags":["Price Monitoring"],"summary":"Get Monitoring Status","description":"Get monitoring status for a product.","operationId":"get_monitoring_status_api_v1_price_monitoring_status__product_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"product_id","in":"path","required":true,"schema":{"type":"string","title":"Product Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataResponse"}}}},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/price-monitoring/history/{product_id}":{"get":{"tags":["Price Monitoring"],"summary":"Get Price History","description":"Get price history for a product.\n\nOptionally filter by source_name.","operationId":"get_price_history_api_v1_price_monitoring_history__product_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"product_id","in":"path","required":true,"schema":{"type":"string","title":"Product Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"minimum":1,"default":50,"title":"Limit"}},{"name":"source_name","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Name"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriceHistoryResponse"}}}},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/price-monitoring/statistics/{product_id}":{"get":{"tags":["Price Monitoring"],"summary":"Get Price Statistics","description":"Get price statistics for a product.\n\nReturns min, max, avg prices and trend analysis.","operationId":"get_price_statistics_api_v1_price_monitoring_statistics__product_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"product_id","in":"path","required":true,"schema":{"type":"string","title":"Product Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriceStatisticsResponse"}}}},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/price-monitoring/sources":{"post":{"tags":["Price Monitoring"],"summary":"Add Competitor Source","description":"Add a competitor source for price monitoring.","operationId":"add_competitor_source_api_v1_price_monitoring_sources_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddCompetitorSourceRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriceSourceResponse"}}}},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/price-monitoring/sources/{product_id}":{"get":{"tags":["Price Monitoring"],"summary":"Get Competitor Sources","description":"Get all competitor sources for a product.","operationId":"get_competitor_sources_api_v1_price_monitoring_sources__product_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"product_id","in":"path","required":true,"schema":{"type":"string","title":"Product Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriceSourceResponse"}}}},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/price-monitoring/sources/{source_id}":{"delete":{"tags":["Price Monitoring"],"summary":"Delete Competitor Source","description":"Delete a competitor source.","operationId":"delete_competitor_source_api_v1_price_monitoring_sources__source_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"source_id","in":"path","required":true,"schema":{"type":"string","title":"Source Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusResponse"}}}},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/price-monitoring/alerts":{"post":{"tags":["Price Monitoring"],"summary":"Create Price Alert","description":"Create a price alert for a product.","operationId":"create_price_alert_api_v1_price_monitoring_alerts_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePriceAlertRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriceAlertResponse"}}}},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/price-monitoring/alerts/{product_id}":{"get":{"tags":["Price Monitoring"],"summary":"Get Price Alerts","description":"Get all price alerts for a product.","operationId":"get_price_alerts_api_v1_price_monitoring_alerts__product_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"product_id","in":"path","required":true,"schema":{"type":"string","title":"Product Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriceAlertResponse"}}}},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/price-monitoring/alerts/{alert_id}":{"delete":{"tags":["Price Monitoring"],"summary":"Delete Price Alert","description":"Delete a price alert.","operationId":"delete_price_alert_api_v1_price_monitoring_alerts__alert_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"alert_id","in":"path","required":true,"schema":{"type":"string","title":"Alert Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusResponse"}}}},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/price-monitoring/jobs/{product_id}":{"get":{"tags":["Price Monitoring"],"summary":"Get Monitoring Jobs","description":"Get monitoring job history for a product.","operationId":"get_monitoring_jobs_api_v1_price_monitoring_jobs__product_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"product_id","in":"path","required":true,"schema":{"type":"string","title":"Product Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriceJobsResponse"}}}},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/ws/stats":{"get":{"tags":["WebSocket"],"summary":"Get Websocket Stats","description":"Get WebSocket connection statistics.","operationId":"get_websocket_stats_ws_stats_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/logs/frontend":{"post":{"tags":["Admin","Logs"],"summary":"Log Frontend Error","description":"Log a frontend error to the database.\n\nThis endpoint allows the frontend to send errors to the same logging\nsystem as the backend, enabling unified error tracking.\n\nThe logs are tagged with source='frontend' to distinguish them from backend logs.","operationId":"log_frontend_error_api_admin_logs_frontend_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FrontendLogRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/logs":{"get":{"tags":["Admin","Logs"],"summary":"Get Logs","description":"Get system logs from the database.\n\nSupports filtering by:\n- Log level\n- Logger name\n- Job ID\n- Search term in message\n- Time range (hours)\n\nReturns paginated results.","operationId":"get_logs_api_admin_logs_get","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"description":"Page number","default":1,"title":"Page"},"description":"Page number"},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"description":"Number of logs per page","default":100,"title":"Page Size"},"description":"Number of logs per page"},{"name":"level","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by log level (DEBUG, INFO, WARNING, ERROR, CRITICAL)","title":"Level"},"description":"Filter by log level (DEBUG, INFO, WARNING, ERROR, CRITICAL)"},{"name":"logger_name","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by logger name","title":"Logger Name"},"description":"Filter by logger name"},{"name":"job_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by job ID","title":"Job Id"},"description":"Filter by job ID"},{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Search in message","title":"Search"},"description":"Search in message"},{"name":"source","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by source (frontend or backend)","title":"Source"},"description":"Filter by source (frontend or backend)"},{"name":"hours","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Number of hours to look back (default: 24)","default":24,"title":"Hours"},"description":"Number of hours to look back (default: 24)"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LogsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["Admin","Logs"],"summary":"Clear Logs","description":"Clear system logs.\n\nIf hours is specified, only clears logs older than that many hours.\nOtherwise, clears all logs.","operationId":"clear_logs_api_admin_logs_delete","parameters":[{"name":"hours","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Clear logs older than N hours (if not specified, clears all)","title":"Hours"},"description":"Clear logs older than N hours (if not specified, clears all)"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/logs/stats":{"get":{"tags":["Admin","Logs"],"summary":"Get Log Stats","description":"Get statistics about logs.\n\nReturns:\n- Total logs\n- Breakdown by level\n- Top loggers\n- Recent errors","operationId":"get_log_stats_api_admin_logs_stats_get","parameters":[{"name":"hours","in":"query","required":false,"schema":{"type":"integer","description":"Number of hours to analyze","default":24,"title":"Hours"},"description":"Number of hours to analyze"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LogStatsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/linking/link-chunks-to-products":{"post":{"tags":["Admin - Linking"],"summary":"Link Chunks To Products","description":"Manually link chunks to products for a specific document.\n\nThis endpoint is useful for:\n- Fixing documents where chunk-product linking failed\n- Re-linking after product updates\n- Debugging relationship issues\n\nArgs:\n    request: Document ID to link\n    \nReturns:\n    LinkChunksToProductsResponse with statistics","operationId":"link_chunks_to_products_api_admin_linking_link_chunks_to_products_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LinkChunksToProductsRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LinkChunksToProductsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/segment/sam":{"post":{"tags":["Segmentation"],"summary":"Generate Sam Mask","description":"Generate a binary inpainting mask from an image + zone hint.\n\nWhite pixels = area to replace (inpaint).\nBlack pixels = area to preserve.\n\nPrimary: SAM 2 (Replicate meta/sam-2) when `image_url` is provided + REPLICATE_API_TOKEN is set.\nFallback: Pillow bbox/ellipse (instant, no external call).","operationId":"generate_sam_mask_api_segment_sam_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SAMMaskRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SAMMaskResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/segment/inpaint":{"post":{"tags":["Segmentation"],"summary":"Inpaint Region","description":"Replace a masked region in an image.\n\n- If `reference_image_url` is provided → AnyDoor (places the actual product photo).\n- Otherwise → FLUX Fill Pro (text-guided generation).\n\nMask must be a base64 PNG where white pixels = replace area, black = keep.\nResult is uploaded to Supabase Storage and a permanent URL is returned.","operationId":"inpaint_region_api_segment_inpaint_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InpaintRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InpaintResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/segment/generate-prompt":{"post":{"tags":["Segmentation"],"summary":"Generate Inpainting Prompt","description":"Ask Claude Haiku to write an optimised FLUX Fill Pro inpainting prompt\ngiven a zone label and a user description.","operationId":"generate_inpainting_prompt_api_segment_generate_prompt_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GeneratePromptRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GeneratePromptResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/agents/catalog":{"get":{"tags":["Background Agents"],"summary":"Get Catalog","operationId":"get_catalog_api_agents_catalog_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentCatalogResponse"}}}}}}},"/api/agents/runs/{run_id}":{"get":{"tags":["Background Agents"],"summary":"Get Run Status","operationId":"get_run_status_api_agents_runs__run_id__get","parameters":[{"name":"run_id","in":"path","required":true,"schema":{"type":"string","title":"Run Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/agents/run":{"post":{"tags":["Background Agents"],"summary":"Run Agent","description":"Receive a delegated agent task from the edge function and execute it\nin the background (no 30-second timeout limit).","operationId":"run_agent_api_agents_run_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentRunRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentRunResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/sentry-debug":{"get":{"tags":["Monitoring"],"summary":"Trigger Sentry Error","description":"Debug endpoint to test Sentry error tracking integration.\n\nThis endpoint intentionally triggers a division by zero error to verify\nthat Sentry is properly capturing and reporting errors from the application.\n\n**WARNING:** This endpoint should only be used for testing purposes.\n\nReturns:\n    Never returns - always raises ZeroDivisionError\n\nRaises:\n    ZeroDivisionError: Intentional error for Sentry testing","operationId":"trigger_sentry_error_sentry_debug_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}}},"components":{"schemas":{"AIMetricsResponse":{"properties":{"summary":{"$ref":"#/components/schemas/AIMetricsSummary"},"model_usage":{"items":{"$ref":"#/components/schemas/ModelUsageStats"},"type":"array","title":"Model Usage"},"task_breakdown":{"items":{"$ref":"#/components/schemas/TaskBreakdown"},"type":"array","title":"Task Breakdown"},"confidence_distribution":{"items":{"$ref":"#/components/schemas/ConfidenceDistribution"},"type":"array","title":"Confidence Distribution"},"recent_calls":{"items":{"type":"object"},"type":"array","title":"Recent Calls"}},"type":"object","required":["summary","model_usage","task_breakdown","confidence_distribution","recent_calls"],"title":"AIMetricsResponse"},"AIMetricsSummary":{"properties":{"total_calls":{"type":"integer","title":"Total Calls"},"total_cost":{"type":"number","title":"Total Cost"},"total_tokens":{"type":"integer","title":"Total Tokens"},"average_latency_ms":{"type":"number","title":"Average Latency Ms"},"average_confidence":{"type":"number","title":"Average Confidence"},"fallback_rate":{"type":"number","title":"Fallback Rate"},"time_period":{"type":"string","title":"Time Period"}},"type":"object","required":["total_calls","total_cost","total_tokens","average_latency_ms","average_confidence","fallback_rate","time_period"],"title":"AIMetricsSummary"},"AIModelConfig":{"properties":{"visual_embedding_primary":{"type":"string","title":"Visual Embedding Primary","description":"Visual embedding model via SLIG cloud endpoint (768D)","default":"basiliskan/siglip2"},"visual_embedding_fallback":{"type":"string","title":"Visual Embedding Fallback","description":"Fallback visual embedding model (not used - cloud-only)"},"text_embedding_model":{"type":"string","title":"Text Embedding Model","description":"Text embedding model (Voyage AI primary, OpenAI fallback)","default":"voyage-3.5"},"text_embedding_dimensions":{"type":"integer","title":"Text Embedding Dimensions","description":"Text embedding dimensions (1024 for Voyage AI, 1536 for OpenAI)","default":1024},"text_embedding_input_type":{"type":"string","title":"Text Embedding Input Type","description":"Input type for Voyage AI: 'document' for indexing, 'query' for search","default":"document"},"classification_primary_model":{"type":"string","title":"Classification Primary Model","description":"Primary image classification model (Qwen Vision 32B via HF Endpoint)","default":"Qwen/Qwen3-VL-32B-Instruct"},"classification_validation_model":{"type":"string","title":"Classification Validation Model","description":"Validation model for low-confidence classifications (same as primary - 32B only)","default":"Qwen/Qwen3-VL-32B-Instruct"},"classification_confidence_threshold":{"type":"number","maximum":1.0,"minimum":0.0,"title":"Classification Confidence Threshold","description":"Confidence threshold for triggering validation","default":0.7},"discovery_model":{"type":"string","enum":["claude-sonnet-4-6","gpt-5","gpt-5.2"],"title":"Discovery Model","description":"Model for product discovery (Claude Sonnet 4.6, GPT-5, or GPT-5.2)","default":"claude-sonnet-4-6"},"metadata_extraction_model":{"type":"string","enum":["claude","gpt"],"title":"Metadata Extraction Model","description":"Model for metadata extraction (claude or gpt)","default":"claude"},"chunking_model":{"type":"string","title":"Chunking Model","description":"Model for semantic chunking and text analysis","default":"gpt-5.2"},"discovery_temperature":{"type":"number","maximum":2.0,"minimum":0.0,"title":"Discovery Temperature","description":"Temperature for product discovery","default":0.1},"classification_temperature":{"type":"number","maximum":2.0,"minimum":0.0,"title":"Classification Temperature","description":"Temperature for image classification","default":0.1},"metadata_temperature":{"type":"number","maximum":2.0,"minimum":0.0,"title":"Metadata Temperature","description":"Temperature for metadata extraction","default":0.1},"discovery_max_tokens":{"type":"integer","maximum":16384.0,"minimum":512.0,"title":"Discovery Max Tokens","description":"Max tokens for product discovery","default":4096},"classification_max_tokens":{"type":"integer","maximum":2048.0,"minimum":128.0,"title":"Classification Max Tokens","description":"Max tokens for image classification","default":512},"metadata_max_tokens":{"type":"integer","maximum":16384.0,"minimum":512.0,"title":"Metadata Max Tokens","description":"Max tokens for metadata extraction","default":4096}},"type":"object","title":"AIModelConfig","description":"Configuration for AI models used in PDF processing pipeline.","example":{"chunking_model":"gpt-5.2","classification_confidence_threshold":0.7,"classification_max_tokens":512,"classification_primary_model":"Qwen/Qwen3-VL-8B-Instruct","classification_temperature":0.1,"classification_validation_model":"claude-sonnet-4-6","discovery_max_tokens":4096,"discovery_model":"claude-sonnet-4-6","discovery_temperature":0.1,"metadata_extraction_model":"claude","metadata_max_tokens":4096,"metadata_temperature":0.1,"text_embedding_dimensions":1024,"text_embedding_input_type":"document","text_embedding_model":"voyage-3.5","visual_embedding_primary":"basiliskan/siglip2"}},"AITrackingResponse":{"properties":{"job_id":{"type":"string","title":"Job Id"},"tracking":{"items":{"type":"object"},"type":"array","title":"Tracking"},"total":{"type":"integer","title":"Total","default":0},"summary":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Summary"}},"type":"object","required":["job_id"],"title":"AITrackingResponse","description":"AI usage tracking data for a job."},"AddCompetitorSourceRequest":{"properties":{"product_id":{"type":"string","title":"Product Id","description":"Product UUID"},"source_name":{"type":"string","title":"Source Name","description":"Competitor name"},"source_url":{"type":"string","title":"Source Url","description":"Competitor product URL"},"scraping_config":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Scraping Config","description":"Optional Firecrawl configuration"}},"type":"object","required":["product_id","source_name","source_url"],"title":"AddCompetitorSourceRequest","description":"Request to add a competitor source"},"AgentCatalogResponse":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"agents":{"items":{"type":"object"},"type":"array","title":"Agents"}},"type":"object","title":"AgentCatalogResponse","description":"List of available agents."},"AgentRunRequest":{"properties":{"run_id":{"type":"string","title":"Run Id","description":"agent_runs.id to update when done"},"agent_id":{"type":"string","title":"Agent Id","description":"background_agents.id"},"agent_type":{"type":"string","title":"Agent Type","description":"Registry key, e.g. 'product-enrichment'"},"input_data":{"type":"object","title":"Input Data"},"model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model","default":"claude-haiku-4-5"},"system_prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"System Prompt"},"config":{"type":"object","title":"Config"}},"type":"object","required":["run_id","agent_id","agent_type"],"title":"AgentRunRequest"},"AgentRunResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"job_id":{"type":"string","title":"Job Id"},"message":{"type":"string","title":"Message"}},"type":"object","required":["success","job_id","message"],"title":"AgentRunResponse"},"AttachProductRequest":{"properties":{"workspace_id":{"type":"string","title":"Workspace Id","description":"UUID of workspace"},"document_id":{"type":"string","title":"Document Id","description":"UUID of document"},"product_id":{"type":"string","title":"Product Id","description":"UUID of product"},"relationship_type":{"type":"string","title":"Relationship Type","description":"Relationship type","default":"related"},"relevance_score":{"type":"integer","maximum":5.0,"minimum":1.0,"title":"Relevance Score","description":"Relevance score 1-5","default":3}},"type":"object","required":["workspace_id","document_id","product_id"],"title":"AttachProductRequest","description":"Request model for attaching document to product."},"AttachmentResponse":{"properties":{"id":{"type":"string","title":"Id"},"workspace_id":{"type":"string","title":"Workspace Id"},"document_id":{"type":"string","title":"Document Id"},"product_id":{"type":"string","title":"Product Id"},"relationship_type":{"type":"string","title":"Relationship Type"},"relevance_score":{"type":"integer","title":"Relevance Score"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["id","workspace_id","document_id","product_id","relationship_type","relevance_score","created_at"],"title":"AttachmentResponse","description":"Response model for product attachment."},"AutoCompleteRequest":{"properties":{"query":{"type":"string","maxLength":200,"minLength":1,"title":"Query","description":"Partial query text"},"limit":{"type":"integer","maximum":50.0,"minimum":1.0,"title":"Limit","description":"Maximum number of suggestions","default":10},"user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id","description":"User ID for personalization"},"session_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Session Id","description":"Session ID for tracking"},"include_trending":{"type":"boolean","title":"Include Trending","description":"Include trending searches","default":true},"include_recent":{"type":"boolean","title":"Include Recent","description":"Include recent searches","default":true},"include_popular":{"type":"boolean","title":"Include Popular","description":"Include popular searches","default":true},"categories":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Categories","description":"Filter by categories"}},"type":"object","required":["query"],"title":"AutoCompleteRequest","description":"Request for auto-complete suggestions.","example":{"categories":["ceramic","tiles"],"include_popular":true,"include_recent":true,"include_trending":true,"limit":10,"query":"fire res","session_id":"session-456","user_id":"user-123"}},"AutoCompleteResponse":{"properties":{"success":{"type":"boolean","title":"Success","description":"Whether the request was successful","default":true},"query":{"type":"string","title":"Query","description":"Original query"},"suggestions":{"items":{"$ref":"#/components/schemas/SearchSuggestion"},"type":"array","title":"Suggestions","description":"List of suggestions"},"total_suggestions":{"type":"integer","title":"Total Suggestions","description":"Total number of suggestions","default":0},"processing_time_ms":{"type":"integer","title":"Processing Time Ms","description":"Processing time in milliseconds","default":0},"metadata":{"type":"object","title":"Metadata","description":"Additional metadata"}},"type":"object","required":["query"],"title":"AutoCompleteResponse","description":"Response with auto-complete suggestions."},"BaseResponse":{"properties":{"success":{"type":"boolean","title":"Success","description":"Indicates if the request was successful","default":true},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message","description":"Optional message or description"},"timestamp":{"type":"string","title":"Timestamp","description":"Response timestamp"}},"type":"object","title":"BaseResponse","description":"Base response model with common fields."},"BasicHealthResponse":{"properties":{"status":{"type":"string","enum":["healthy"],"const":"healthy","title":"Status","description":"Service status"},"service":{"type":"string","title":"Service","description":"Service name"},"version":{"type":"string","title":"Version","description":"Service version"}},"type":"object","required":["status","service","version"],"title":"BasicHealthResponse","description":"Basic health check response"},"BatchCategorizeRequest":{"properties":{"workspace_id":{"type":"string","title":"Workspace Id","description":"UUID of the workspace to process"},"only_uncategorized":{"type":"boolean","title":"Only Uncategorized","description":"If True, only process products without a material_category","default":true},"limit":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Limit","description":"Maximum number of products to process in one run","default":200}},"type":"object","required":["workspace_id"],"title":"BatchCategorizeRequest"},"BatchCategorizeResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"total_found":{"type":"integer","title":"Total Found"},"categorized":{"type":"integer","title":"Categorized"},"failed":{"type":"integer","title":"Failed"},"skipped":{"type":"integer","title":"Skipped"},"results":{"items":{"type":"object"},"type":"array","title":"Results"},"message":{"type":"string","title":"Message"}},"type":"object","required":["success","total_found","categorized","failed","skipped","results","message"],"title":"BatchCategorizeResponse"},"BatchClassificationResponse":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"results":{"items":{"type":"object"},"type":"array","title":"Results"},"total":{"type":"integer","title":"Total","default":0},"processing_time_ms":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Processing Time Ms"}},"type":"object","title":"BatchClassificationResponse","description":"Batch classification results."},"BatchDetectRequest":{"properties":{"workspace_id":{"type":"string","title":"Workspace Id","description":"Workspace ID to scan"},"similarity_threshold":{"type":"number","maximum":1.0,"minimum":0.0,"title":"Similarity Threshold","description":"Minimum similarity score","default":0.75},"limit":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Limit","description":"Optional limit on number of products to check"}},"type":"object","required":["workspace_id"],"title":"BatchDetectRequest","description":"Request to scan entire workspace for duplicates."},"BboxHint":{"properties":{"x":{"type":"number","maximum":1.0,"minimum":0.0,"title":"X"},"y":{"type":"number","maximum":1.0,"minimum":0.0,"title":"Y"},"w":{"type":"number","maximum":1.0,"minimum":0.0,"title":"W"},"h":{"type":"number","maximum":1.0,"minimum":0.0,"title":"H"}},"type":"object","required":["x","y","w","h"],"title":"BboxHint","description":"Normalized bbox (0.0–1.0)."},"Body_create_kb_document_from_pdf_api_kb_documents_from_pdf_post":{"properties":{"file":{"type":"string","format":"binary","title":"File"}},"type":"object","required":["file"],"title":"Body_create_kb_document_from_pdf_api_kb_documents_from_pdf_post"},"Body_upload_and_analyze_image_api_images_upload_and_analyze_post":{"properties":{"file":{"type":"string","format":"binary","title":"File"},"analysis_types":{"type":"string","title":"Analysis Types","default":"description,ocr"},"confidence_threshold":{"type":"number","title":"Confidence Threshold","default":0.5}},"type":"object","required":["file"],"title":"Body_upload_and_analyze_image_api_images_upload_and_analyze_post"},"Body_upload_document_api_rag_documents_upload_post":{"properties":{"file":{"anyOf":[{"type":"string","format":"binary"},{"type":"null"}],"title":"File","description":"PDF file to upload (required unless file_url is provided)"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title","description":"Document title"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"Document description"},"tags":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tags","description":"Comma-separated tags"},"test_single_product":{"type":"boolean","title":"Test Single Product","description":"TEST MODE: Process only the first product (for testing/debugging)","default":false},"categories":{"type":"string","title":"Categories","description":"Categories to extract: 'products', 'certificates', 'logos', 'specifications', 'all', 'extract_only'. Comma-separated.","default":"all"},"material_category":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Material Category","description":"Material category: 'tiles', 'wood', 'decor', 'furniture', 'general_materials', 'paint_wall_decor', 'heating', 'sanitary', 'kitchen', 'lighting', etc."},"file_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"File Url","description":"URL to download PDF from (alternative to file upload)"},"discovery_model":{"type":"string","title":"Discovery Model","description":"AI model for discovery: 'claude-vision' (Claude Sonnet 4.5 Vision - RECOMMENDED, 10x faster), 'claude-haiku-vision' (faster/cheaper), 'gpt-vision' (GPT-4o Vision), 'claude' (text-only, legacy), 'gpt' (text-only, legacy), 'haiku' (text-only, legacy)","default":"claude-vision"},"chunk_size":{"type":"integer","maximum":4000.0,"minimum":100.0,"title":"Chunk Size","description":"Chunk size for text processing","default":1000},"chunk_overlap":{"type":"integer","maximum":1000.0,"minimum":0.0,"title":"Chunk Overlap","description":"Chunk overlap","default":200},"enable_prompt_enhancement":{"type":"boolean","title":"Enable Prompt Enhancement","description":"Enable AI prompt enhancement with admin customizations","default":true},"agent_prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Agent Prompt","description":"Natural language instruction (e.g., 'extract products', 'search for NOVA')"},"workspace_id":{"type":"string","title":"Workspace Id","description":"Workspace ID","default":"ffafc28b-1b8b-4b0d-b226-9f9a6154004e"}},"type":"object","title":"Body_upload_document_api_rag_documents_upload_post"},"BoundaryDetectionResponse":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"boundaries":{"items":{"type":"object"},"type":"array","title":"Boundaries"},"count":{"type":"integer","title":"Count","default":0}},"type":"object","title":"BoundaryDetectionResponse","description":"Product boundary detection results."},"BoundingBox":{"properties":{"x":{"type":"number","title":"X","description":"X coordinate (normalized 0-1)"},"y":{"type":"number","title":"Y","description":"Y coordinate (normalized 0-1)"},"width":{"type":"number","title":"Width","description":"Width (normalized 0-1)"},"height":{"type":"number","title":"Height","description":"Height (normalized 0-1)"}},"type":"object","required":["x","y","width","height"],"title":"BoundingBox","description":"Bounding box coordinates for detected objects."},"CategoryResponse":{"properties":{"id":{"type":"string","title":"Id"},"workspace_id":{"type":"string","title":"Workspace Id"},"name":{"type":"string","title":"Name"},"slug":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Slug"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"icon":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Icon"},"color":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Color"},"parent_category_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Parent Category Id"},"sort_order":{"type":"integer","title":"Sort Order"},"created_at":{"type":"string","title":"Created At"},"access_level":{"type":"string","title":"Access Level","default":"agent"},"trigger_keyword":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Trigger Keyword"}},"type":"object","required":["id","workspace_id","name","slug","description","icon","color","parent_category_id","sort_order","created_at"],"title":"CategoryResponse","description":"Response model for category."},"ChatResponse":{"properties":{"message":{"type":"string","title":"Message","description":"Original message"},"response":{"type":"string","title":"Response","description":"AI response"},"conversation_id":{"type":"string","title":"Conversation Id","description":"Conversation ID"},"sources":{"items":{"type":"object"},"type":"array","title":"Sources","description":"Source documents used"},"processing_time":{"type":"number","title":"Processing Time","description":"Response generation time"}},"type":"object","required":["message","response","conversation_id","sources","processing_time"],"title":"ChatResponse","description":"Response model for conversational RAG."},"CheckDuplicatesRequest":{"properties":{"user_id":{"type":"string","title":"User Id","description":"User ID"},"query":{"type":"string","title":"Query","description":"Search query"},"filters":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Filters","description":"General filters"},"material_filters":{"anyOf":[{"$ref":"#/components/schemas/MaterialFilters"},{"type":"null"}],"description":"Material filters"}},"type":"object","required":["user_id","query"],"title":"CheckDuplicatesRequest","description":"Request to check for duplicate searches."},"CheckDuplicatesResponse":{"properties":{"has_duplicate":{"type":"boolean","title":"Has Duplicate"},"should_auto_merge":{"type":"boolean","title":"Should Auto Merge"},"merge_suggestion":{"anyOf":[{"$ref":"#/components/schemas/MergeSuggestion"},{"type":"null"}]}},"type":"object","required":["has_duplicate","should_auto_merge","merge_suggestion"],"title":"CheckDuplicatesResponse","description":"Response for duplicate check."},"CheckPricesRequest":{"properties":{"product_id":{"type":"string","title":"Product Id","description":"Product UUID"},"product_name":{"type":"string","title":"Product Name","description":"Product name for scraping context"}},"type":"object","required":["product_id","product_name"],"title":"CheckPricesRequest","description":"Request to perform on-demand price check"},"CheckpointListResponse":{"properties":{"job_id":{"type":"string","title":"Job Id"},"checkpoints":{"items":{"type":"object"},"type":"array","title":"Checkpoints"},"count":{"type":"integer","title":"Count","default":0},"stages_completed":{"items":{"type":"string"},"type":"array","title":"Stages Completed"}},"type":"object","required":["job_id"],"title":"CheckpointListResponse","description":"List of checkpoints for a processing job."},"ChunkQualityMetrics":{"properties":{"total_chunks":{"type":"integer","title":"Total Chunks"},"total_documents":{"type":"integer","title":"Total Documents"},"exact_duplicates_prevented":{"type":"integer","title":"Exact Duplicates Prevented"},"semantic_duplicates_prevented":{"type":"integer","title":"Semantic Duplicates Prevented"},"low_quality_rejected":{"type":"integer","title":"Low Quality Rejected"},"borderline_quality_flagged":{"type":"integer","title":"Borderline Quality Flagged"},"average_quality_score":{"type":"number","title":"Average Quality Score"},"quality_distribution":{"type":"object","title":"Quality Distribution"},"flagged_chunks_pending_review":{"type":"integer","title":"Flagged Chunks Pending Review"},"flagged_chunks_reviewed":{"type":"integer","title":"Flagged Chunks Reviewed"},"chunk_size_stats":{"type":"object","title":"Chunk Size Stats"},"chunk_overlap_stats":{"type":"object","title":"Chunk Overlap Stats"},"very_small_chunks":{"type":"integer","title":"Very Small Chunks"},"very_large_chunks":{"type":"integer","title":"Very Large Chunks"},"recommendations":{"items":{"type":"string"},"type":"array","title":"Recommendations"}},"type":"object","required":["total_chunks","total_documents","exact_duplicates_prevented","semantic_duplicates_prevented","low_quality_rejected","borderline_quality_flagged","average_quality_score","quality_distribution","flagged_chunks_pending_review","flagged_chunks_reviewed","chunk_size_stats","chunk_overlap_stats","very_small_chunks","very_large_chunks","recommendations"],"title":"ChunkQualityMetrics","description":"Chunk quality metrics response model"},"CircuitBreakerState":{"properties":{"state":{"type":"string","enum":["closed","open","half_open"],"title":"State","description":"Circuit breaker state"},"failure_count":{"type":"integer","title":"Failure Count","description":"Number of failures"}},"type":"object","required":["state","failure_count"],"title":"CircuitBreakerState","description":"Circuit breaker state"},"ClassificationResponse":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"classification":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Classification"},"confidence":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Confidence"},"processing_time_ms":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Processing Time Ms"}},"type":"object","title":"ClassificationResponse","description":"Document/image classification result."},"ClassifyBatchRequest":{"properties":{"contents":{"items":{"type":"string"},"type":"array","title":"Contents","description":"List of text contents to classify"},"contexts":{"anyOf":[{"items":{"type":"object"},"type":"array"},{"type":"null"}],"title":"Contexts","description":"Optional contexts for each content"},"job_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Job Id","description":"Optional job ID for tracking"}},"type":"object","required":["contents"],"title":"ClassifyBatchRequest","description":"Request for batch document classification."},"ClassifyImagesRequest":{"properties":{"job_id":{"type":"string","title":"Job Id"},"extracted_images":{"items":{"type":"object"},"type":"array","title":"Extracted Images"},"ai_config":{"anyOf":[{"$ref":"#/components/schemas/AIModelConfig"},{"type":"null"}]}},"type":"object","required":["job_id","extracted_images"],"title":"ClassifyImagesRequest","description":"Request model for image classification."},"ClassifyImagesResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"material_images":{"items":{"type":"object"},"type":"array","title":"Material Images"},"non_material_images":{"items":{"type":"object"},"type":"array","title":"Non Material Images"},"total_classified":{"type":"integer","title":"Total Classified"},"material_count":{"type":"integer","title":"Material Count"},"non_material_count":{"type":"integer","title":"Non Material Count"}},"type":"object","required":["success","material_images","non_material_images","total_classified","material_count","non_material_count"],"title":"ClassifyImagesResponse","description":"Response model for image classification."},"ClassifyRequest":{"properties":{"content":{"type":"string","title":"Content","description":"Text content to classify"},"context":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Context","description":"Optional context (page number, images, etc.)"},"job_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Job Id","description":"Optional job ID for tracking"}},"type":"object","required":["content"],"title":"ClassifyRequest","description":"Request for document classification."},"CleanupResponse":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"message":{"type":"string","title":"Message","default":""},"data":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Data"},"deleted":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Deleted"},"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Timestamp"}},"type":"object","title":"CleanupResponse","description":"Data cleanup/backup/export result."},"ClipImageRequest":{"properties":{"image_data":{"type":"string","title":"Image Data","description":"Base64 encoded image data"},"model":{"type":"string","title":"Model","description":"CLIP model to use","default":"clip-vit-base-patch32"},"normalize":{"type":"boolean","title":"Normalize","description":"Whether to normalize the embedding vector","default":true}},"type":"object","required":["image_data"],"title":"ClipImageRequest","description":"Request model for CLIP image embedding generation."},"ClipTextRequest":{"properties":{"text":{"type":"string","title":"Text","description":"Text to generate embedding for"},"model":{"type":"string","title":"Model","description":"Embedding model to use (voyage-3.5 or text-embedding-3-small)","default":"voyage-3.5"},"input_type":{"type":"string","title":"Input Type","description":"Type of input: 'document' for indexing, 'query' for search (Voyage AI only)","default":"document"},"dimensions":{"type":"integer","title":"Dimensions","description":"Embedding dimensions (default 1024 for Voyage AI; 256, 512, 1024, 2048 supported)","default":1024},"truncation":{"type":"boolean","title":"Truncation","description":"Whether to truncate text to fit context length (Voyage AI only)","default":true},"output_dtype":{"type":"string","title":"Output Dtype","description":"Output data type: 'float', 'int8', 'uint8', 'binary', 'ubinary' (Voyage AI only)","default":"float"},"normalize":{"type":"boolean","title":"Normalize","description":"Whether to normalize the embedding vector","default":true}},"type":"object","required":["text"],"title":"ClipTextRequest","description":"Request model for text embedding generation (Voyage AI / OpenAI)."},"ConfidenceDistribution":{"properties":{"range":{"type":"string","title":"Range"},"count":{"type":"integer","title":"Count"},"percentage":{"type":"number","title":"Percentage"}},"type":"object","required":["range","count","percentage"],"title":"ConfidenceDistribution"},"ConsensusValidateRequest":{"properties":{"content":{"type":"string","title":"Content","description":"Content to validate"},"extraction_type":{"type":"string","title":"Extraction Type","description":"Type of extraction (e.g., 'product_name', 'material_type')"},"job_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Job Id","description":"Optional job ID for tracking"}},"type":"object","required":["content","extraction_type"],"title":"ConsensusValidateRequest","description":"Request for consensus validation."},"CreateCategoryRequest":{"properties":{"workspace_id":{"type":"string","title":"Workspace Id","description":"UUID of workspace"},"name":{"type":"string","maxLength":100,"minLength":1,"title":"Name","description":"Category name"},"slug":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Slug","description":"URL-friendly slug"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"Category description"},"icon":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Icon","description":"Icon name"},"color":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Color","description":"Hex color code"},"parent_category_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Parent Category Id","description":"Parent category UUID"},"access_level":{"type":"string","title":"Access Level","description":"Access level: admin | agent | public","default":"agent"},"trigger_keyword":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Trigger Keyword","description":"Agent searches this category only when query contains this keyword (agent-level only, case-insensitive)"}},"type":"object","required":["workspace_id","name"],"title":"CreateCategoryRequest","description":"Request model for creating a category."},"CreateChunksRequest":{"properties":{"job_id":{"type":"string","title":"Job Id"},"document_id":{"type":"string","title":"Document Id"},"workspace_id":{"type":"string","title":"Workspace Id"},"extracted_text":{"type":"string","title":"Extracted Text"},"product_ids":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Product Ids"},"chunk_size":{"type":"integer","title":"Chunk Size","default":512},"chunk_overlap":{"type":"integer","title":"Chunk Overlap","default":50},"ai_config":{"anyOf":[{"$ref":"#/components/schemas/AIModelConfig"},{"type":"null"}]}},"type":"object","required":["job_id","document_id","workspace_id","extracted_text"],"title":"CreateChunksRequest","description":"Request model for creating chunks."},"CreateChunksResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"chunks_created":{"type":"integer","title":"Chunks Created"},"embeddings_generated":{"type":"integer","title":"Embeddings Generated"},"relationships_created":{"type":"integer","title":"Relationships Created"},"skipped":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Skipped","default":false},"existing_chunks":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Existing Chunks","default":0},"existing_embeddings":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Existing Embeddings","default":0}},"type":"object","required":["success","chunks_created","embeddings_generated","relationships_created"],"title":"CreateChunksResponse","description":"Response model for creating chunks."},"CreateKBDocRequest":{"properties":{"workspace_id":{"type":"string","title":"Workspace Id","description":"UUID of the workspace"},"title":{"type":"string","maxLength":255,"minLength":1,"title":"Title","description":"Document title"},"content":{"type":"string","minLength":1,"title":"Content","description":"Document content"},"content_markdown":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Content Markdown","description":"Markdown version of content"},"summary":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Summary","description":"Document summary"},"category_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category Id","description":"UUID of category"},"seo_keywords":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Seo Keywords","description":"SEO keywords"},"status":{"type":"string","title":"Status","description":"Document status","default":"draft"},"visibility":{"type":"string","title":"Visibility","description":"Document visibility","default":"workspace"},"metadata":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Metadata","description":"Custom metadata","default":{}},"price_doc_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Price Doc Type","description":"Sub-type for pricing docs: price_list | discount_rule | contract_terms | promotion"}},"type":"object","required":["workspace_id","title","content"],"title":"CreateKBDocRequest","description":"Request model for creating a knowledge base document."},"CreatePriceAlertRequest":{"properties":{"product_id":{"type":"string","title":"Product Id","description":"Product UUID"},"alert_type":{"type":"string","title":"Alert Type","description":"Alert type: price_drop, price_increase, any_change, availability"},"threshold_percentage":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Threshold Percentage","description":"Percentage threshold for alert"},"threshold_amount":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Threshold Amount","description":"Amount threshold for alert"},"notification_channels":{"items":{"type":"string"},"type":"array","title":"Notification Channels","description":"Notification channels: email, in_app, sms","default":["email"]}},"type":"object","required":["product_id","alert_type"],"title":"CreatePriceAlertRequest","description":"Request to create a price alert"},"CreatePromptTemplateRequest":{"properties":{"workspace_id":{"type":"string","title":"Workspace Id"},"name":{"type":"string","title":"Name"},"stage":{"type":"string","title":"Stage"},"prompt_template":{"type":"string","title":"Prompt Template"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"industry":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Industry"},"category":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category"},"system_prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"System Prompt"},"model_preference":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model Preference","description":"claude, gpt, or auto"},"temperature":{"type":"number","maximum":2.0,"minimum":0.0,"title":"Temperature","default":0.1},"max_tokens":{"type":"integer","maximum":16384.0,"minimum":256.0,"title":"Max Tokens","default":4096}},"type":"object","required":["workspace_id","name","stage","prompt_template"],"title":"CreatePromptTemplateRequest","description":"Create prompt template request"},"CreateRelationshipsRequest":{"properties":{"job_id":{"type":"string","title":"Job Id"},"document_id":{"type":"string","title":"Document Id"},"product_ids":{"items":{"type":"string"},"type":"array","title":"Product Ids"},"similarity_threshold":{"type":"number","title":"Similarity Threshold","default":0.5}},"type":"object","required":["job_id","document_id","product_ids"],"title":"CreateRelationshipsRequest","description":"Request model for creating relationships."},"CreateRelationshipsResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"chunk_image_relationships":{"type":"integer","title":"Chunk Image Relationships"},"product_image_associations":{"type":"integer","title":"Product Image Associations"}},"type":"object","required":["success","chunk_image_relationships","product_image_associations"],"title":"CreateRelationshipsResponse","description":"Response model for creating relationships."},"CreateSavedSearchRequest":{"properties":{"user_id":{"type":"string","title":"User Id","description":"User ID"},"query":{"type":"string","title":"Query","description":"Search query text"},"filters":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Filters","description":"General filters"},"material_filters":{"anyOf":[{"$ref":"#/components/schemas/MaterialFilters"},{"type":"null"}],"description":"Material-specific filters"},"integration_context":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Integration Context","description":"Integration context (chat, moodboard, 3d_generation)"},"integration_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Integration Id","description":"Related integration ID"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name","description":"Custom name for the search"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"Description of the search"},"check_for_duplicates":{"type":"boolean","title":"Check For Duplicates","description":"Enable smart deduplication","default":true}},"type":"object","required":["user_id","query"],"title":"CreateSavedSearchRequest","description":"Request to create a new saved search."},"DataResponse":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"message":{"type":"string","title":"Message","default":""},"data":{"anyOf":[{},{"type":"null"}],"title":"Data"},"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Timestamp"}},"type":"object","title":"DataResponse","description":"Standard wrapper: success + message + data payload."},"DatabaseHealthResponse":{"properties":{"healthy":{"type":"boolean","title":"Healthy","description":"Whether database is healthy"},"connection_test_ms":{"type":"number","title":"Connection Test Ms","description":"Connection test time in milliseconds"},"query_test_ms":{"type":"number","title":"Query Test Ms","description":"Query test time in milliseconds"},"error_count":{"type":"integer","title":"Error Count","description":"Total error count"},"consecutive_failures":{"type":"integer","title":"Consecutive Failures","description":"Consecutive failure count"},"uptime_seconds":{"type":"number","title":"Uptime Seconds","description":"Service uptime in seconds"},"performance":{"$ref":"#/components/schemas/DatabasePerformance"}},"type":"object","required":["healthy","connection_test_ms","query_test_ms","error_count","consecutive_failures","uptime_seconds","performance"],"title":"DatabaseHealthResponse","description":"Database health status"},"DatabasePerformance":{"properties":{"avg_query_time_ms":{"type":"number","title":"Avg Query Time Ms","description":"Average query execution time in milliseconds"},"max_query_time_ms":{"type":"number","title":"Max Query Time Ms","description":"Maximum query execution time in milliseconds"},"slow_query_count":{"type":"integer","title":"Slow Query Count","description":"Number of slow queries detected"},"slow_query_threshold_ms":{"type":"number","title":"Slow Query Threshold Ms","description":"Threshold for slow query detection in milliseconds"}},"type":"object","required":["avg_query_time_ms","max_query_time_ms","slow_query_count","slow_query_threshold_ms"],"title":"DatabasePerformance","description":"Database performance metrics"},"DetailedHealthResponse":{"properties":{"overall_status":{"type":"string","enum":["healthy","degraded","unhealthy"],"title":"Overall Status","description":"Overall system status"},"database":{"$ref":"#/components/schemas/DatabaseHealthResponse"},"job_monitor":{"$ref":"#/components/schemas/JobMonitorHealthResponse"},"query_metrics":{"$ref":"#/components/schemas/QueryMetricsResponse"},"circuit_breaker":{"$ref":"#/components/schemas/CircuitBreakerState"},"timestamp":{"type":"string","title":"Timestamp","description":"Timestamp of health check"}},"type":"object","required":["overall_status","database","job_monitor","query_metrics","circuit_breaker","timestamp"],"title":"DetailedHealthResponse","description":"Detailed system health status"},"DetectBoundariesRequest":{"properties":{"chunks":{"items":{"type":"object"},"type":"array","title":"Chunks","description":"List of document chunks"},"job_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Job Id","description":"Optional job ID for tracking"}},"type":"object","required":["chunks"],"title":"DetectBoundariesRequest","description":"Request for boundary detection."},"DetectDuplicatesRequest":{"properties":{"product_id":{"type":"string","title":"Product Id","description":"Product ID to check for duplicates"},"workspace_id":{"type":"string","title":"Workspace Id","description":"Workspace ID"},"similarity_threshold":{"type":"number","maximum":1.0,"minimum":0.0,"title":"Similarity Threshold","description":"Minimum similarity score (0.0-1.0)","default":0.6}},"type":"object","required":["product_id","workspace_id"],"title":"DetectDuplicatesRequest","description":"Request to detect duplicates for a specific product."},"DetectedObject":{"properties":{"label":{"type":"string","title":"Label","description":"Object label/class"},"confidence":{"type":"number","title":"Confidence","description":"Detection confidence (0-1)"},"bounding_box":{"allOf":[{"$ref":"#/components/schemas/BoundingBox"}],"description":"Object location"},"attributes":{"type":"object","title":"Attributes","description":"Additional object attributes"}},"type":"object","required":["label","confidence","bounding_box"],"title":"DetectedObject","description":"Detected object in image."},"DetectedText":{"properties":{"text":{"type":"string","title":"Text","description":"Extracted text"},"confidence":{"type":"number","title":"Confidence","description":"OCR confidence (0-1)"},"bounding_box":{"allOf":[{"$ref":"#/components/schemas/BoundingBox"}],"description":"Text location"},"language":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Language","description":"Detected language"},"font_info":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Font Info","description":"Font characteristics"}},"type":"object","required":["text","confidence","bounding_box"],"title":"DetectedText","description":"Detected text in image (OCR result)."},"DocumentContentResponse":{"properties":{"id":{"type":"string","title":"Id"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created At"},"metadata":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Metadata"},"chunks":{"items":{"type":"object"},"type":"array","title":"Chunks"},"images":{"items":{"type":"object"},"type":"array","title":"Images"},"products":{"items":{"type":"object"},"type":"array","title":"Products"},"statistics":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Statistics"}},"type":"object","required":["id"],"title":"DocumentContentResponse","description":"Full document content with chunks, images, products."},"DocumentEntityResponse":{"properties":{"id":{"type":"string","title":"Id"},"entity_type":{"type":"string","title":"Entity Type"},"name":{"type":"string","title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"page_range":{"items":{"type":"integer"},"type":"array","title":"Page Range"},"factory_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Factory Name"},"factory_group":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Factory Group"},"manufacturer":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Manufacturer"},"metadata":{"type":"object","title":"Metadata","default":{}},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["id","entity_type","name","page_range","created_at"],"title":"DocumentEntityResponse","description":"Response model for a document entity."},"DocumentExtractionStatusResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"document_id":{"type":"string","title":"Document Id"},"filename":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Filename"},"catalog_layout_analyzed":{"type":"boolean","title":"Catalog Layout Analyzed"},"legends_extracted":{"type":"boolean","title":"Legends Extracted"},"layout_stats":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Layout Stats"},"legend_types_found":{"items":{"type":"string"},"type":"array","title":"Legend Types Found"},"global_certifications":{"items":{"type":"string"},"type":"array","title":"Global Certifications"},"total_products":{"type":"integer","title":"Total Products"},"average_coverage_pct":{"type":"number","title":"Average Coverage Pct"},"products_by_coverage":{"additionalProperties":{"type":"integer"},"type":"object","title":"Products By Coverage"},"issues":{"items":{"type":"string"},"type":"array","title":"Issues"},"products_sample":{"items":{"$ref":"#/components/schemas/ProductCoverage"},"type":"array","title":"Products Sample"}},"type":"object","required":["success","document_id","filename","catalog_layout_analyzed","legends_extracted","layout_stats","legend_types_found","global_certifications","total_products","average_coverage_pct","products_by_coverage","issues","products_sample"],"title":"DocumentExtractionStatusResponse"},"DuplicateDetectionResponse":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"duplicates":{"items":{"type":"object"},"type":"array","title":"Duplicates"},"count":{"type":"integer","title":"Count","default":0}},"type":"object","title":"DuplicateDetectionResponse","description":"Duplicate detection results."},"EmbeddingHealthResponse":{"properties":{"status":{"type":"string","title":"Status","default":"healthy"},"service":{"type":"string","title":"Service","default":"embeddings"},"models":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Models"}},"type":"object","title":"EmbeddingHealthResponse","description":"Embedding service health."},"EmbeddingResponse":{"properties":{"success":{"type":"boolean","title":"Success","description":"Whether the operation succeeded"},"embedding":{"anyOf":[{"items":{"type":"number"},"type":"array"},{"type":"null"}],"title":"Embedding","description":"Generated embedding vector"},"dimensions":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Dimensions","description":"Embedding dimensions"},"model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model","description":"Model used"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error","description":"Error message if failed"}},"type":"object","required":["success"],"title":"EmbeddingResponse","description":"Response model for embedding generation."},"EnrichExistingProductResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"product_id":{"type":"string","title":"Product Id"},"document_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Document Id"},"products_checked":{"type":"integer","title":"Products Checked"},"products_updated":{"type":"integer","title":"Products Updated"},"fields_filled":{"items":{"type":"string"},"type":"array","title":"Fields Filled"},"message":{"type":"string","title":"Message"}},"type":"object","required":["success","product_id","document_id","products_checked","products_updated","fields_filled","message"],"title":"EnrichExistingProductResponse"},"EscalationStatsResponse":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"stats":{"type":"object","title":"Stats"}},"type":"object","title":"EscalationStatsResponse","description":"AI escalation statistics."},"ExecuteSearchRequest":{"properties":{"user_id":{"type":"string","title":"User Id","description":"User ID"}},"type":"object","required":["user_id"],"title":"ExecuteSearchRequest","description":"Request to execute a saved search."},"ExpandedQuery":{"properties":{"original_query":{"type":"string","title":"Original Query","description":"Original query"},"expanded_terms":{"items":{"type":"string"},"type":"array","title":"Expanded Terms","description":"Expanded query terms"},"synonyms":{"additionalProperties":{"items":{"type":"string"},"type":"array"},"type":"object","title":"Synonyms","description":"Synonyms for each term"},"related_concepts":{"items":{"type":"string"},"type":"array","title":"Related Concepts","description":"Related concepts"},"confidence_score":{"type":"number","title":"Confidence Score","description":"Confidence in expansion","default":0.8}},"type":"object","required":["original_query"],"title":"ExpandedQuery","description":"Expanded query with synonyms and related terms."},"ExtractEntitiesRequest":{"properties":{"document_id":{"type":"string","title":"Document Id"},"workspace_id":{"type":"string","title":"Workspace Id"}},"type":"object","required":["document_id","workspace_id"],"title":"ExtractEntitiesRequest","description":"Request model for entity extraction."},"ExtractEntitiesResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"relationships_created":{"type":"integer","title":"Relationships Created"},"entities_processed":{"type":"integer","title":"Entities Processed"},"message":{"type":"string","title":"Message"}},"type":"object","required":["success","relationships_created","entities_processed","message"],"title":"ExtractEntitiesResponse","description":"Response model for entity extraction."},"ExtractMetadataRequest":{"properties":{"job_id":{"type":"string","title":"Job Id"},"document_id":{"type":"string","title":"Document Id"},"product_ids":{"items":{"type":"string"},"type":"array","title":"Product Ids"},"pdf_text":{"type":"string","title":"Pdf Text"},"ai_config":{"anyOf":[{"$ref":"#/components/schemas/AIModelConfig"},{"type":"null"}]}},"type":"object","required":["job_id","document_id","product_ids","pdf_text"],"title":"ExtractMetadataRequest","description":"Request model for metadata extraction."},"ExtractMetadataResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"products_enriched":{"type":"integer","title":"Products Enriched"},"metadata_fields_extracted":{"type":"integer","title":"Metadata Fields Extracted"},"extraction_method":{"type":"string","title":"Extraction Method"},"model_used":{"type":"string","title":"Model Used"}},"type":"object","required":["success","products_enriched","metadata_fields_extracted","extraction_method","model_used"],"title":"ExtractMetadataResponse","description":"Response model for metadata extraction."},"ExtractionConfigResponse":{"properties":{"id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id"},"workspace_id":{"type":"string","title":"Workspace Id"},"enabled_categories":{"items":{"type":"string"},"type":"array","title":"Enabled Categories"},"default_categories":{"items":{"type":"string"},"type":"array","title":"Default Categories"},"discovery_model":{"type":"string","title":"Discovery Model"},"chunk_size":{"type":"integer","title":"Chunk Size"},"chunk_overlap":{"type":"integer","title":"Chunk Overlap"},"enable_prompt_enhancement":{"type":"boolean","title":"Enable Prompt Enhancement"},"quality_threshold":{"type":"number","title":"Quality Threshold"}},"type":"object","required":["workspace_id","enabled_categories","default_categories","discovery_model","chunk_size","chunk_overlap","enable_prompt_enhancement","quality_threshold"],"title":"ExtractionConfigResponse","description":"Extraction config response"},"FaceDetection":{"properties":{"confidence":{"type":"number","title":"Confidence","description":"Face detection confidence"},"bounding_box":{"allOf":[{"$ref":"#/components/schemas/BoundingBox"}],"description":"Face location"},"landmarks":{"anyOf":[{"items":{"additionalProperties":{"type":"number"},"type":"object"},"type":"array"},{"type":"null"}],"title":"Landmarks","description":"Facial landmarks"},"attributes":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Attributes","description":"Face attributes (age, emotion, etc.)"}},"type":"object","required":["confidence","bounding_box"],"title":"FaceDetection","description":"Detected face in image."},"FeedbackResponse":{"properties":{"id":{"type":"string","title":"Id"},"workspace_id":{"type":"string","title":"Workspace Id"},"user_id":{"type":"string","title":"User Id"},"material_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Material Id"},"feedback_text":{"type":"string","title":"Feedback Text"},"feedback_type":{"type":"string","title":"Feedback Type"},"rating":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Rating"},"sentiment_analysis":{"type":"object","title":"Sentiment Analysis"},"is_verified":{"type":"boolean","title":"Is Verified"},"is_public":{"type":"boolean","title":"Is Public"},"helpful_count":{"type":"integer","title":"Helpful Count"},"created_at":{"type":"string","title":"Created At"},"analyzed_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Analyzed At"}},"type":"object","required":["id","workspace_id","user_id","material_id","feedback_text","feedback_type","rating","sentiment_analysis","is_verified","is_public","helpful_count","created_at","analyzed_at"],"title":"FeedbackResponse"},"FlagReviewResponse":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"message":{"type":"string","title":"Message","default":""},"flag_id":{"type":"string","title":"Flag Id","default":""},"status":{"type":"string","title":"Status","default":""}},"type":"object","title":"FlagReviewResponse","description":"Flagged chunk review result."},"FlaggedChunk":{"properties":{"id":{"type":"string","title":"Id"},"chunk_id":{"type":"string","title":"Chunk Id"},"document_id":{"type":"string","title":"Document Id"},"flag_type":{"type":"string","title":"Flag Type"},"flag_reason":{"type":"string","title":"Flag Reason"},"quality_score":{"type":"number","title":"Quality Score"},"content_preview":{"type":"string","title":"Content Preview"},"flagged_at":{"type":"string","title":"Flagged At"},"reviewed":{"type":"boolean","title":"Reviewed"},"reviewed_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reviewed At"},"reviewed_by":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reviewed By"},"review_action":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Review Action"}},"type":"object","required":["id","chunk_id","document_id","flag_type","flag_reason","quality_score","content_preview","flagged_at","reviewed"],"title":"FlaggedChunk","description":"Flagged chunk model"},"FrontendLogRequest":{"properties":{"level":{"type":"string","title":"Level"},"message":{"type":"string","title":"Message"},"logger_name":{"type":"string","title":"Logger Name","default":"frontend"},"context":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Context"},"user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"},"url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Url"},"user_agent":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Agent"}},"type":"object","required":["level","message"],"title":"FrontendLogRequest","description":"Request model for frontend log submission."},"GenerateEntityEmbeddingsRequest":{"properties":{"document_id":{"type":"string","title":"Document Id"},"workspace_id":{"type":"string","title":"Workspace Id"}},"type":"object","required":["document_id","workspace_id"],"title":"GenerateEntityEmbeddingsRequest","description":"Request model for generating entity embeddings."},"GenerateEntityEmbeddingsResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"embeddings_created":{"type":"integer","title":"Embeddings Created"},"entities_processed":{"type":"integer","title":"Entities Processed"},"message":{"type":"string","title":"Message"}},"type":"object","required":["success","embeddings_created","entities_processed","message"],"title":"GenerateEntityEmbeddingsResponse","description":"Response model for entity embedding generation."},"GenerateProductEmbeddingsRequest":{"properties":{"document_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Document Id"},"workspace_id":{"type":"string","title":"Workspace Id"},"product_ids":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Product Ids"}},"type":"object","required":["workspace_id"],"title":"GenerateProductEmbeddingsRequest","description":"Request model for generating product embeddings."},"GenerateProductEmbeddingsResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"message":{"type":"string","title":"Message"},"products_processed":{"type":"integer","title":"Products Processed"},"chunks_created":{"type":"integer","title":"Chunks Created"},"embeddings_queued":{"type":"integer","title":"Embeddings Queued"},"errors":{"items":{"type":"string"},"type":"array","title":"Errors","default":[]}},"type":"object","required":["success","message","products_processed","chunks_created","embeddings_queued"],"title":"GenerateProductEmbeddingsResponse","description":"Response model for product embedding generation."},"GeneratePromptRequest":{"properties":{"zone_label":{"type":"string","title":"Zone Label","description":"Label of the zone being replaced (e.g. 'Floor', 'Wall')"},"description":{"type":"string","title":"Description","description":"User description of desired material/look"},"zone_context":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Zone Context","description":"Optional zone metadata (material_type, finish, etc.)"}},"type":"object","required":["zone_label","description"],"title":"GeneratePromptRequest"},"GeneratePromptResponse":{"properties":{"prompt":{"type":"string","title":"Prompt","description":"Claude-generated inpainting prompt"}},"type":"object","required":["prompt"],"title":"GeneratePromptResponse"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"HealthCheckResponse":{"properties":{"status":{"type":"string","title":"Status","description":"Health status"},"services":{"additionalProperties":{"type":"object"},"type":"object","title":"Services","description":"Service health details"},"timestamp":{"type":"string","title":"Timestamp","description":"Health check timestamp"}},"type":"object","required":["status","services","timestamp"],"title":"HealthCheckResponse","description":"Response model for RAG health check."},"HealthResponse":{"properties":{"status":{"type":"string","title":"Status"},"timestamp":{"type":"string","format":"date-time","title":"Timestamp"},"version":{"type":"string","title":"Version"},"service":{"type":"string","title":"Service"},"services":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Services"}},"type":"object","required":["status","timestamp","version","service"],"title":"HealthResponse","description":"Health check response model."},"ImageAnalysisRequest":{"properties":{"image_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Image Id","description":"ID of extracted image from document"},"image_url":{"anyOf":[{"type":"string","maxLength":2083,"minLength":1,"format":"uri"},{"type":"null"}],"title":"Image Url","description":"URL to external image"},"analysis_types":{"items":{"type":"string"},"type":"array","title":"Analysis Types","description":"Types of analysis to perform","default":["description","ocr","objects"]},"quality":{"type":"string","pattern":"^(fast|standard|high)$","title":"Quality","description":"Analysis quality","default":"standard"},"language":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Language","description":"Language hint for OCR","default":"auto"},"confidence_threshold":{"type":"number","maximum":1.0,"minimum":0.0,"title":"Confidence Threshold","description":"Minimum confidence for results","default":0.7},"document_context":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Document Context","description":"Document context for better analysis"},"page_context":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Context","description":"Page context around the image"}},"type":"object","title":"ImageAnalysisRequest","description":"Request model for image analysis using Material Kai Vision Platform.","example":{"analysis_types":["description","ocr","objects"],"confidence_threshold":0.8,"document_context":"Research paper about machine learning","image_id":"img_123e4567-e89b-12d3-a456-426614174000","language":"en","quality":"standard"}},"ImageAnalysisResponse":{"properties":{"success":{"type":"boolean","title":"Success","description":"Indicates if the request was successful","default":true},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message","description":"Optional message or description"},"timestamp":{"type":"string","title":"Timestamp","description":"Response timestamp"},"image_id":{"type":"string","title":"Image Id","description":"Image identifier"},"status":{"allOf":[{"$ref":"#/components/schemas/ProcessingStatus"}],"description":"Analysis status"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"AI-generated image description"},"detected_objects":{"items":{"$ref":"#/components/schemas/DetectedObject"},"type":"array","title":"Detected Objects","description":"Detected objects"},"detected_text":{"items":{"$ref":"#/components/schemas/DetectedText"},"type":"array","title":"Detected Text","description":"OCR results"},"detected_faces":{"items":{"$ref":"#/components/schemas/FaceDetection"},"type":"array","title":"Detected Faces","description":"Face detection results"},"categories":{"items":{"additionalProperties":{"type":"number"},"type":"object"},"type":"array","title":"Categories","description":"Image categories with confidence"},"tags":{"items":{"type":"string"},"type":"array","title":"Tags","description":"Automatically generated tags"},"metadata":{"allOf":[{"$ref":"#/components/schemas/ImageMetadata"}],"description":"Image metadata and properties"},"analysis_types_performed":{"items":{"type":"string"},"type":"array","title":"Analysis Types Performed","description":"Types of analysis completed"},"processing_time_ms":{"type":"number","title":"Processing Time Ms","description":"Analysis processing time"},"model_versions":{"additionalProperties":{"type":"string"},"type":"object","title":"Model Versions","description":"AI model versions used"},"error_details":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Error Details","description":"Error details if analysis failed"}},"type":"object","required":["image_id","status","metadata","analysis_types_performed","processing_time_ms"],"title":"ImageAnalysisResponse","description":"Response model for image analysis.","example":{"analysis_types_performed":["description","ocr","objects"],"categories":[{"technical_diagram":0.92},{"educational_content":0.87}],"description":"A diagram showing a neural network architecture with multiple layers","detected_objects":[{"bounding_box":{"height":0.6,"width":0.8,"x":0.1,"y":0.2},"confidence":0.95,"label":"diagram"}],"detected_text":[{"bounding_box":{"height":0.05,"width":0.4,"x":0.3,"y":0.1},"confidence":0.98,"language":"en","text":"Neural Network"}],"image_id":"img_123e4567-e89b-12d3-a456-426614174000","metadata":{"format":"PNG","height":768,"quality_score":0.89,"size_bytes":245760,"width":1024},"processing_time_ms":1250.5,"status":"completed","success":true,"tags":["neural network","diagram","ai","machine learning"],"timestamp":"2024-07-26T18:00:00Z"}},"ImageBatchRequest":{"properties":{"image_ids":{"items":{"type":"string"},"type":"array","maxItems":50,"minItems":1,"title":"Image Ids","description":"List of image IDs to analyze"},"analysis_types":{"items":{"type":"string"},"type":"array","title":"Analysis Types","description":"Types of analysis to perform on all images","default":["description","ocr"]},"parallel_processing":{"type":"boolean","title":"Parallel Processing","description":"Process images in parallel","default":true},"priority":{"type":"string","pattern":"^(low|normal|high)$","title":"Priority","description":"Processing priority","default":"normal"},"quality":{"type":"string","pattern":"^(fast|standard|high)$","title":"Quality","description":"Analysis quality","default":"standard"},"confidence_threshold":{"type":"number","maximum":1.0,"minimum":0.0,"title":"Confidence Threshold","description":"Minimum confidence threshold","default":0.7}},"type":"object","required":["image_ids"],"title":"ImageBatchRequest","description":"Request model for batch image analysis.","example":{"analysis_types":["description","ocr","objects"],"image_ids":["img_123e4567-e89b-12d3-a456-426614174000","img_456e7890-e89b-12d3-a456-426614174001"],"parallel_processing":true,"priority":"normal","quality":"standard"}},"ImageBatchResponse":{"properties":{"success":{"type":"boolean","title":"Success","description":"Indicates if the request was successful","default":true},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message","description":"Optional message or description"},"timestamp":{"type":"string","title":"Timestamp","description":"Response timestamp"},"batch_id":{"type":"string","title":"Batch Id","description":"Batch processing identifier"},"total_images":{"type":"integer","title":"Total Images","description":"Total number of images in batch"},"completed_count":{"type":"integer","title":"Completed Count","description":"Number of successfully processed images"},"failed_count":{"type":"integer","title":"Failed Count","description":"Number of failed images"},"results":{"items":{"$ref":"#/components/schemas/ImageBatchResult"},"type":"array","title":"Results","description":"Individual image results"},"total_processing_time_ms":{"type":"number","title":"Total Processing Time Ms","description":"Total batch processing time"},"average_time_per_image_ms":{"type":"number","title":"Average Time Per Image Ms","description":"Average processing time per image"}},"type":"object","required":["batch_id","total_images","completed_count","failed_count","results","total_processing_time_ms","average_time_per_image_ms"],"title":"ImageBatchResponse","description":"Response model for batch image analysis.","example":{"average_time_per_image_ms":1115.35,"batch_id":"batch_789e0123-e89b-12d3-a456-426614174000","completed_count":2,"failed_count":0,"results":[{"image_id":"img_123","processing_time_ms":1250.5,"status":"completed"},{"image_id":"img_456","processing_time_ms":980.2,"status":"completed"}],"success":true,"timestamp":"2024-07-26T18:00:00Z","total_images":2,"total_processing_time_ms":2230.7}},"ImageBatchResult":{"properties":{"image_id":{"type":"string","title":"Image Id","description":"Image identifier"},"status":{"allOf":[{"$ref":"#/components/schemas/ProcessingStatus"}],"description":"Processing status for this image"},"result":{"anyOf":[{"$ref":"#/components/schemas/ImageAnalysisResponse"},{"type":"null"}],"description":"Analysis result if successful"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error","description":"Error message if failed"},"processing_time_ms":{"type":"number","title":"Processing Time Ms","description":"Processing time for this image"}},"type":"object","required":["image_id","status","processing_time_ms"],"title":"ImageBatchResult","description":"Individual result in batch processing."},"ImageMetadata":{"properties":{"width":{"type":"integer","title":"Width","description":"Image width in pixels"},"height":{"type":"integer","title":"Height","description":"Image height in pixels"},"format":{"type":"string","title":"Format","description":"Image format (JPEG, PNG, etc.)"},"size_bytes":{"type":"integer","title":"Size Bytes","description":"File size in bytes"},"color_mode":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Color Mode","description":"Color mode (RGB, CMYK, etc.)"},"resolution_dpi":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Resolution Dpi","description":"Image resolution in DPI"},"quality_score":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Quality Score","description":"Overall image quality (0-1)"},"sharpness_score":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Sharpness Score","description":"Image sharpness (0-1)"},"dominant_colors":{"items":{"type":"string"},"type":"array","title":"Dominant Colors","description":"Dominant color palette"},"brightness":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Brightness","description":"Average brightness (0-1)"},"contrast":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Contrast","description":"Image contrast (0-1)"},"exif_data":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Exif Data","description":"EXIF metadata"},"creation_date":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Creation Date","description":"Image creation date"}},"type":"object","required":["width","height","format","size_bytes"],"title":"ImageMetadata","description":"Comprehensive image metadata and analysis results."},"ImageReclassifyResponse":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"message":{"type":"string","title":"Message","default":""},"image_id":{"type":"string","title":"Image Id","default":""},"old_classification":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Old Classification"},"new_classification":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"New Classification"}},"type":"object","title":"ImageReclassifyResponse","description":"Image reclassification result."},"ImageSearchResult":{"properties":{"document_id":{"type":"string","title":"Document Id","description":"Source document ID"},"document_name":{"type":"string","title":"Document Name","description":"Document name"},"image_id":{"type":"string","title":"Image Id","description":"Image identifier"},"page_number":{"type":"integer","title":"Page Number","description":"Source page number"},"image_path":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Image Path","description":"Path to image file"},"image_dimensions":{"anyOf":[{"additionalProperties":{"type":"integer"},"type":"object"},{"type":"null"}],"title":"Image Dimensions","description":"Image width and height"},"image_format":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Image Format","description":"Image format (PNG, JPEG, etc.)"},"visual_description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Visual Description","description":"AI-generated visual description"},"ocr_text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ocr Text","description":"OCR-extracted text from image"},"ocr_confidence":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Ocr Confidence","description":"OCR extraction confidence"},"similarity_score":{"type":"number","title":"Similarity Score","description":"Visual similarity score (0-1)"},"ocr_relevance_score":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Ocr Relevance Score","description":"OCR text relevance score"},"combined_score":{"type":"number","title":"Combined Score","description":"Final combined relevance score"},"visual_features":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Visual Features","description":"Extracted visual features"},"detected_objects":{"items":{"type":"string"},"type":"array","title":"Detected Objects","description":"Detected objects in image"},"material_analysis":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Material Analysis","description":"Material property analysis results"},"clip_embedding":{"anyOf":[{"items":{"type":"number"},"type":"array"},{"type":"null"}],"title":"Clip Embedding","description":"CLIP embedding vector for visual similarity"},"vision_analysis":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Vision Analysis","description":"Vision model material analysis"},"understanding_score":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Understanding Score","description":"Vision-understanding embedding similarity score"},"material_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Material Type","description":"Identified material type"},"material_confidence":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Material Confidence","description":"Material identification confidence"},"spectral_properties":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Spectral Properties","description":"Spectral analysis properties"},"chemical_composition":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Chemical Composition","description":"Chemical composition analysis"},"mechanical_properties":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Mechanical Properties","description":"Mechanical property analysis"}},"type":"object","required":["document_id","document_name","image_id","page_number","similarity_score","combined_score"],"title":"ImageSearchResult","description":"Individual image search result."},"ImageValidationRequest":{"properties":{"image_id":{"type":"string","title":"Image Id"},"image_url":{"type":"string","title":"Image Url"},"product_groups":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Product Groups"},"workspace_id":{"type":"string","title":"Workspace Id"}},"type":"object","required":["image_id","image_url","workspace_id"],"title":"ImageValidationRequest"},"ImageValidationResponse":{"properties":{"image_id":{"type":"string","title":"Image Id"},"validation_status":{"type":"string","title":"Validation Status"},"quality_score":{"type":"number","title":"Quality Score"},"product_associations":{"items":{"type":"object"},"type":"array","title":"Product Associations"},"issues":{"items":{"type":"string"},"type":"array","title":"Issues"},"recommendations":{"items":{"type":"string"},"type":"array","title":"Recommendations"},"processing_time_ms":{"type":"number","title":"Processing Time Ms"}},"type":"object","required":["image_id","validation_status","quality_score","product_associations","issues","recommendations","processing_time_ms"],"title":"ImageValidationResponse"},"ImportHistoryListResponse":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"jobs":{"items":{"type":"object"},"type":"array","title":"Jobs"},"count":{"type":"integer","title":"Count","default":0}},"type":"object","title":"ImportHistoryListResponse","description":"Import job history."},"ImportJobStatus":{"properties":{"job_id":{"type":"string","title":"Job Id"},"status":{"type":"string","title":"Status"},"import_type":{"type":"string","title":"Import Type"},"source_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Name"},"total_products":{"type":"integer","title":"Total Products"},"processed_products":{"type":"integer","title":"Processed Products"},"failed_products":{"type":"integer","title":"Failed Products"},"progress_percentage":{"type":"integer","title":"Progress Percentage"},"current_stage":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Current Stage"},"started_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Started At"},"completed_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Completed At"},"error_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Message"},"estimated_time_remaining":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Estimated Time Remaining"}},"type":"object","required":["job_id","status","import_type","source_name","total_products","processed_products","failed_products","progress_percentage","current_stage","started_at","completed_at","error_message","estimated_time_remaining"],"title":"ImportJobStatus","description":"Import job status response"},"ImportProcessResponse":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"message":{"type":"string","title":"Message","default":""},"job_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Job Id"},"data":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Data"}},"type":"object","title":"ImportProcessResponse","description":"Import job creation result."},"InpaintRequest":{"properties":{"image_url":{"type":"string","title":"Image Url","description":"Source image URL (must be publicly accessible)"},"mask_base64":{"type":"string","title":"Mask Base64","description":"Base64-encoded PNG mask (white=replace, black=keep)"},"prompt":{"type":"string","title":"Prompt","description":"Inpainting prompt describing the replacement material"},"negative_prompt":{"type":"string","title":"Negative Prompt","default":"blurry, artifacts, distorted, low quality, unrealistic, cartoon, illustration, collage edges"},"model":{"type":"string","enum":["flux-fill-pro","flux-fill-dev","sd-inpainting"],"title":"Model","default":"flux-fill-pro"},"job_id":{"type":"string","title":"Job Id","description":"Parent generation job ID — used for Storage path"},"workspace_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workspace Id"},"reference_image_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reference Image Url","description":"Catalog product photo URL — triggers AnyDoor reference-image inpainting instead of FLUX"}},"type":"object","required":["image_url","mask_base64","prompt","job_id"],"title":"InpaintRequest"},"InpaintResponse":{"properties":{"storage_url":{"type":"string","title":"Storage Url","description":"Supabase Storage public URL of the inpainted image"},"replicate_url":{"type":"string","title":"Replicate Url","description":"Original Replicate output URL (may expire)"},"model_used":{"type":"string","title":"Model Used"},"processing_time_ms":{"type":"integer","title":"Processing Time Ms"}},"type":"object","required":["storage_url","replicate_url","model_used","processing_time_ms"],"title":"InpaintResponse"},"InteriorDesignResponse":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"message":{"type":"string","title":"Message","default":""},"task_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Task Id"},"data":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Data"}},"type":"object","title":"InteriorDesignResponse","description":"Interior design generation result."},"InteriorRequest":{"properties":{"prompt":{"type":"string","title":"Prompt","description":"Interior design description"},"image":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Image","description":"Reference image URL for image-to-image generation"},"room_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Room Type","description":"Type of room (living_room, bedroom, etc.)"},"style":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Style","description":"Design style (modern, minimalist, etc.)"},"models":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Models","description":"Specific model IDs to use, or None for all models"},"exclude_models":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Exclude Models","description":"Model IDs to exclude from generation"},"user_id":{"type":"string","title":"User Id","description":"User ID"},"workspace_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workspace Id","description":"Workspace ID"},"width":{"type":"integer","title":"Width","description":"Image width","default":1024},"height":{"type":"integer","title":"Height","description":"Image height","default":1024}},"type":"object","required":["prompt","user_id"],"title":"InteriorRequest"},"JobDashboardResponse":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"dashboard":{"type":"object","title":"Dashboard"}},"type":"object","title":"JobDashboardResponse","description":"Job health dashboard overview."},"JobDiagnosticsResponse":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"job_id":{"type":"string","title":"Job Id","default":""},"diagnostics":{"type":"object","title":"Diagnostics"}},"type":"object","title":"JobDiagnosticsResponse","description":"Per-job diagnostic info."},"JobInfoResponse":{"properties":{"job_id":{"type":"string","title":"Job Id"},"document_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Document Id"},"status":{"type":"string","title":"Status"},"progress":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Progress"},"metadata":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Metadata"},"source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source"}},"type":"object","required":["job_id","status"],"title":"JobInfoResponse","description":"Job status response used by /documents/job/{id}."},"JobListItem":{"properties":{"job_id":{"type":"string","title":"Job Id","description":"Job identifier"},"job_type":{"allOf":[{"$ref":"#/components/schemas/JobType"}],"description":"Job type"},"status":{"allOf":[{"$ref":"#/components/schemas/JobStatus"}],"description":"Job status"},"priority":{"allOf":[{"$ref":"#/components/schemas/JobPriority"}],"description":"Job priority"},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp"},"started_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Started At","description":"Start timestamp"},"completed_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Completed At","description":"Completion timestamp"},"progress_percentage":{"type":"number","title":"Progress Percentage","description":"Progress percentage","default":0.0},"current_step":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Current Step","description":"Current processing step"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"Job description"},"tags":{"items":{"type":"string"},"type":"array","title":"Tags","description":"Job tags"},"success":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Success","description":"Success status if completed"},"error_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Message","description":"Error message if failed"}},"type":"object","required":["job_id","job_type","status","priority","created_at"],"title":"JobListItem","description":"Simplified job information for list responses."},"JobListResponse":{"properties":{"success":{"type":"boolean","title":"Success","description":"Indicates if the request was successful","default":true},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message","description":"Optional message or description"},"timestamp":{"type":"string","title":"Timestamp","description":"Response timestamp"},"jobs":{"items":{"$ref":"#/components/schemas/JobListItem"},"type":"array","title":"Jobs","description":"List of jobs"},"total_count":{"type":"integer","title":"Total Count","description":"Total number of jobs"},"page":{"type":"integer","title":"Page","description":"Current page number"},"page_size":{"type":"integer","title":"Page Size","description":"Items per page"},"status_counts":{"additionalProperties":{"type":"integer"},"type":"object","title":"Status Counts","description":"Count by status"},"type_counts":{"additionalProperties":{"type":"integer"},"type":"object","title":"Type Counts","description":"Count by type"}},"type":"object","required":["jobs","total_count","page","page_size"],"title":"JobListResponse","description":"Response model for job listing.","example":{"jobs":[{"completed_at":"2024-07-26T18:05:00Z","created_at":"2024-07-26T18:00:00Z","description":"Process research paper","job_id":"job_123","job_type":"document_processing","priority":"normal","progress_percentage":100.0,"status":"completed","success":true}],"page":1,"page_size":20,"status_counts":{"completed":1,"failed":0,"running":0},"success":true,"timestamp":"2024-07-26T18:00:00Z","total_count":1,"type_counts":{"document_processing":1}}},"JobMonitorHealthResponse":{"properties":{"monitor_running":{"type":"boolean","title":"Monitor Running","description":"Whether job monitor is running"},"stuck_jobs_count":{"type":"integer","title":"Stuck Jobs Count","description":"Number of stuck jobs detected"},"health":{"type":"string","enum":["healthy","degraded","unhealthy"],"title":"Health","description":"Overall health status"}},"type":"object","required":["monitor_running","stuck_jobs_count","health"],"title":"JobMonitorHealthResponse","description":"Job monitor health status"},"JobPriority":{"type":"string","enum":["low","normal","high","urgent"],"title":"JobPriority","description":"Job priority levels."},"JobProgress":{"properties":{"current_step":{"type":"string","title":"Current Step","description":"Current processing step"},"total_steps":{"type":"integer","title":"Total Steps","description":"Total number of steps"},"completed_steps":{"type":"integer","title":"Completed Steps","description":"Number of completed steps"},"progress_percentage":{"type":"number","maximum":100.0,"minimum":0.0,"title":"Progress Percentage","description":"Progress percentage"},"step_details":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Step Details","description":"Step-specific details"},"estimated_remaining_seconds":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Estimated Remaining Seconds","description":"Estimated time remaining"}},"type":"object","required":["current_step","total_steps","completed_steps","progress_percentage"],"title":"JobProgress","description":"Job progress information."},"JobResponse":{"properties":{"success":{"type":"boolean","title":"Success","description":"Indicates if the request was successful","default":true},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message","description":"Optional message or description"},"timestamp":{"type":"string","title":"Timestamp","description":"Response timestamp"},"job_id":{"type":"string","title":"Job Id","description":"Unique job identifier"},"job_type":{"allOf":[{"$ref":"#/components/schemas/JobType"}],"description":"Type of job"},"status":{"allOf":[{"$ref":"#/components/schemas/JobStatus"}],"description":"Current job status"},"priority":{"allOf":[{"$ref":"#/components/schemas/JobPriority"}],"description":"Job priority"},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Job creation timestamp"},"started_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Started At","description":"Job start timestamp"},"completed_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Completed At","description":"Job completion timestamp"},"progress":{"anyOf":[{"$ref":"#/components/schemas/JobProgress"},{"type":"null"}],"description":"Job progress information"},"parameters":{"type":"object","title":"Parameters","description":"Job parameters"},"retry_count":{"type":"integer","title":"Retry Count","description":"Maximum retry attempts"},"current_retry":{"type":"integer","title":"Current Retry","description":"Current retry attempt","default":0},"result":{"anyOf":[{"$ref":"#/components/schemas/JobResult"},{"type":"null"}],"description":"Job result if completed"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"Job description"},"tags":{"items":{"type":"string"},"type":"array","title":"Tags","description":"Job tags"}},"type":"object","required":["job_id","job_type","status","priority","created_at","parameters","retry_count"],"title":"JobResponse","description":"Response model for job operations.","example":{"created_at":"2024-07-26T18:00:00Z","current_retry":0,"description":"Process research paper","job_id":"job_123e4567-e89b-12d3-a456-426614174000","job_type":"document_processing","parameters":{"document_url":"https://example.com/doc.pdf","extract_images":true},"priority":"normal","progress":{"completed_steps":2,"current_step":"Extracting text","estimated_remaining_seconds":120,"progress_percentage":40.0,"total_steps":5},"retry_count":3,"started_at":"2024-07-26T18:00:05Z","status":"running","success":true,"tags":["research"],"timestamp":"2024-07-26T18:00:00Z"}},"JobResult":{"properties":{"success":{"type":"boolean","title":"Success","description":"Whether job completed successfully"},"result_data":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Result Data","description":"Job result data"},"output_files":{"items":{"type":"string"},"type":"array","title":"Output Files","description":"Generated output files"},"artifacts":{"items":{"type":"string"},"type":"array","title":"Artifacts","description":"Generated artifacts"},"processing_time_seconds":{"type":"number","title":"Processing Time Seconds","description":"Total processing time"},"memory_usage_mb":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Memory Usage Mb","description":"Peak memory usage"},"cpu_time_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Cpu Time Seconds","description":"CPU time used"},"error_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Message","description":"Error message if failed"},"error_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Code","description":"Machine-readable error code"},"error_details":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Error Details","description":"Detailed error information"}},"type":"object","required":["success","processing_time_seconds"],"title":"JobResult","description":"Job execution result."},"JobStatus":{"type":"string","enum":["pending","queued","running","paused","retrying","completed","failed","cancelled"],"title":"JobStatus","description":"Extended job status enumeration."},"JobStatusResponse":{"properties":{"success":{"type":"boolean","title":"Success","description":"Indicates if the request was successful","default":true},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message","description":"Optional message or description"},"timestamp":{"type":"string","title":"Timestamp","description":"Response timestamp"},"data":{"allOf":[{"$ref":"#/components/schemas/JobResponse"}],"description":"Job details"}},"type":"object","required":["data"],"title":"JobStatusResponse","description":"Response model for job status queries.","example":{"data":{"job_id":"job_123","job_type":"document_processing","priority":"normal","progress":{"completed_steps":5,"current_step":"Processing page 5","progress_percentage":50.0,"total_steps":10},"status":"running"},"message":"Job status retrieved successfully","success":true,"timestamp":"2024-07-26T18:00:00Z"}},"JobType":{"type":"string","enum":["document_processing","image_analysis","batch_processing","bulk_processing","embedding_generation","image_embedding_regeneration","search_indexing","data_export","cleanup"],"title":"JobType","description":"Types of background jobs."},"KBDocResponse":{"properties":{"id":{"type":"string","title":"Id"},"workspace_id":{"type":"string","title":"Workspace Id"},"title":{"type":"string","title":"Title"},"content":{"type":"string","title":"Content"},"summary":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Summary"},"category_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category Id"},"status":{"type":"string","title":"Status"},"visibility":{"type":"string","title":"Visibility"},"embedding_status":{"type":"string","title":"Embedding Status"},"embedding_generated_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Embedding Generated At"},"created_by":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created By"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"},"view_count":{"type":"integer","title":"View Count"},"price_doc_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Price Doc Type"}},"type":"object","required":["id","workspace_id","title","content","summary","category_id","status","visibility","embedding_status","embedding_generated_at","created_by","created_at","updated_at","view_count"],"title":"KBDocResponse","description":"Response model for knowledge base document."},"KBHealthResponse":{"properties":{"status":{"type":"string","title":"Status","default":"healthy"},"service":{"type":"string","title":"Service","default":"knowledge-base-api"},"version":{"type":"string","title":"Version","default":"1.0.0"},"features":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Features"},"endpoints":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Endpoints"}},"type":"object","title":"KBHealthResponse","description":"Knowledge Base API health."},"KnowledgeBaseSearchResponse":{"properties":{"query":{"type":"string","title":"Query"},"total_results":{"type":"integer","title":"Total Results"},"products":{"items":{"type":"object"},"type":"array","title":"Products","default":[]},"entities":{"items":{"type":"object"},"type":"array","title":"Entities","default":[]},"chunks":{"items":{"type":"object"},"type":"array","title":"Chunks","default":[]},"images":{"items":{"type":"object"},"type":"array","title":"Images","default":[]},"processing_time":{"type":"number","title":"Processing Time"},"search_metadata":{"type":"object","title":"Search Metadata"}},"type":"object","required":["query","total_results","processing_time","search_metadata"],"title":"KnowledgeBaseSearchResponse","description":"Response model for knowledge base search"},"LinkChunksToProductsRequest":{"properties":{"document_id":{"type":"string","title":"Document Id"}},"type":"object","required":["document_id"],"title":"LinkChunksToProductsRequest","description":"Request model for linking chunks to products."},"LinkChunksToProductsResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"document_id":{"type":"string","title":"Document Id"},"chunk_product_links":{"type":"integer","title":"Chunk Product Links"},"chunks_found":{"type":"integer","title":"Chunks Found"},"products_found":{"type":"integer","title":"Products Found"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}},"type":"object","required":["success","document_id","chunk_product_links","chunks_found","products_found"],"title":"LinkChunksToProductsResponse","description":"Response model for linking chunks to products."},"ListDataResponse":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message"},"data":{"items":{},"type":"array","title":"Data"},"count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Count"},"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Timestamp"}},"type":"object","title":"ListDataResponse","description":"Standard wrapper for list results."},"LogEntry":{"properties":{"id":{"type":"string","title":"Id"},"timestamp":{"type":"string","format":"date-time","title":"Timestamp"},"level":{"type":"string","title":"Level"},"logger_name":{"type":"string","title":"Logger Name"},"message":{"type":"string","title":"Message"},"context":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Context"},"job_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Job Id"},"user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"},"request_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Request Id"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","timestamp","level","logger_name","message","created_at"],"title":"LogEntry","description":"Log entry model."},"LogStatsResponse":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"stats":{"type":"object","title":"Stats"}},"type":"object","title":"LogStatsResponse","description":"Log statistics."},"LogsResponse":{"properties":{"logs":{"items":{"$ref":"#/components/schemas/LogEntry"},"type":"array","title":"Logs"},"total":{"type":"integer","title":"Total"},"page":{"type":"integer","title":"Page"},"page_size":{"type":"integer","title":"Page Size"},"has_more":{"type":"boolean","title":"Has More"}},"type":"object","required":["logs","total","page","page_size","has_more"],"title":"LogsResponse","description":"Response model for logs endpoint."},"MaterialFilters":{"properties":{"materialTypes":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Materialtypes","description":"Material types filter"},"colors":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Colors","description":"Color filter"},"suppliers":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Suppliers","description":"Supplier filter"},"applications":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Applications","description":"Application filter"},"textures":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Textures","description":"Texture filter"},"priceRange":{"anyOf":[{"items":{"type":"number"},"type":"array"},{"type":"null"}],"title":"Pricerange","description":"Price range [min, max]"}},"type":"object","title":"MaterialFilters","description":"Material-specific filters for search."},"MaterialSearchRequest":{"properties":{"query_image":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Query Image","description":"Base64 encoded image or image URL"},"query_text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Query Text","description":"Text description for hybrid search"},"query_embedding":{"anyOf":[{"items":{"type":"number"},"type":"array"},{"type":"null"}],"title":"Query Embedding","description":"Pre-computed CLIP embedding"},"search_type":{"type":"string","title":"Search Type","description":"Type of search: visual_similarity, semantic_analysis, hybrid, material_properties","default":"hybrid"},"search_strategy":{"type":"string","title":"Search Strategy","description":"Search strategy: comprehensive, fast, accurate","default":"comprehensive"},"material_types":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Material Types","description":"Filter by material types"},"confidence_threshold":{"type":"number","maximum":1.0,"minimum":0.0,"title":"Confidence Threshold","description":"Minimum confidence threshold","default":0.75},"similarity_threshold":{"type":"number","maximum":1.0,"minimum":0.0,"title":"Similarity Threshold","description":"Minimum similarity threshold","default":0.7},"spectral_filters":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Spectral Filters","description":"Spectral property filters"},"chemical_filters":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Chemical Filters","description":"Chemical composition filters"},"mechanical_filters":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Mechanical Filters","description":"Mechanical property filters"},"thermal_filters":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Thermal Filters","description":"Thermal property filters"},"fusion_weights":{"anyOf":[{"additionalProperties":{"type":"number"},"type":"object"},{"type":"null"}],"title":"Fusion Weights","description":"Weights for combining analysis types"},"limit":{"type":"integer","maximum":100.0,"minimum":1.0,"title":"Limit","description":"Maximum number of results","default":20},"offset":{"type":"integer","minimum":0.0,"title":"Offset","description":"Result offset for pagination","default":0},"include_analytics":{"type":"boolean","title":"Include Analytics","description":"Include search analytics","default":false},"include_embeddings":{"type":"boolean","title":"Include Embeddings","description":"Include embedding vectors in response","default":false},"enable_clip_embeddings":{"type":"boolean","title":"Enable Clip Embeddings","description":"Generate CLIP embeddings","default":true},"enable_vision_analysis":{"type":"boolean","title":"Enable Vision Analysis","description":"Enable Qwen Vision analysis","default":false},"user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id","description":"User identifier"},"workspace_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workspace Id","description":"Workspace identifier"},"session_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Session Id","description":"Session identifier"}},"type":"object","title":"MaterialSearchRequest","description":"Request model for material-specific visual search."},"MaterialSearchResponse":{"properties":{"success":{"type":"boolean","title":"Success","description":"Request success status"},"results":{"items":{"$ref":"#/components/schemas/MaterialSearchResult"},"type":"array","title":"Results","description":"Search results"},"total_results":{"type":"integer","title":"Total Results","description":"Total number of results"},"search_metadata":{"type":"object","title":"Search Metadata","description":"Search execution metadata"},"analytics":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Analytics","description":"Search analytics if requested"}},"type":"object","required":["success","results","total_results","search_metadata"],"title":"MaterialSearchResponse","description":"Response model for material visual search."},"MaterialSearchResult":{"properties":{"material_id":{"type":"string","title":"Material Id","description":"Material identifier"},"material_name":{"type":"string","title":"Material Name","description":"Material name"},"material_type":{"type":"string","title":"Material Type","description":"Material type/category"},"visual_similarity_score":{"type":"number","title":"Visual Similarity Score","description":"Visual similarity score"},"semantic_relevance_score":{"type":"number","title":"Semantic Relevance Score","description":"Semantic relevance score"},"material_property_score":{"type":"number","title":"Material Property Score","description":"Material property matching score"},"combined_score":{"type":"number","title":"Combined Score","description":"Final combined score"},"confidence_score":{"type":"number","title":"Confidence Score","description":"Overall confidence"},"visual_analysis":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Visual Analysis","description":"Visual analysis results"},"material_properties":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Material Properties","description":"Material property analysis"},"clip_embedding":{"anyOf":[{"items":{"type":"number"},"type":"array"},{"type":"null"}],"title":"Clip Embedding","description":"CLIP embedding vector"},"vision_analysis":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Vision Analysis","description":"Vision model analysis"},"source":{"type":"string","title":"Source","description":"Data source"},"created_at":{"type":"string","title":"Created At","description":"Creation timestamp"},"processing_method":{"type":"string","title":"Processing Method","description":"Processing method used"},"search_rank":{"type":"integer","title":"Search Rank","description":"Result ranking"}},"type":"object","required":["material_id","material_name","material_type","visual_similarity_score","semantic_relevance_score","material_property_score","combined_score","confidence_score","source","created_at","processing_method","search_rank"],"title":"MaterialSearchResult","description":"Material-specific search result."},"MergeHistoryResponse":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"history":{"items":{"type":"object"},"type":"array","title":"History"},"count":{"type":"integer","title":"Count","default":0}},"type":"object","title":"MergeHistoryResponse","description":"Merge operation history."},"MergeProductsRequest":{"properties":{"target_product_id":{"type":"string","title":"Target Product Id","description":"Product to keep (merge into)"},"source_product_ids":{"items":{"type":"string"},"type":"array","title":"Source Product Ids","description":"Products to merge (will be deleted)"},"workspace_id":{"type":"string","title":"Workspace Id","description":"Workspace ID"},"user_id":{"type":"string","title":"User Id","description":"User performing the merge"},"merge_strategy":{"type":"string","title":"Merge Strategy","description":"Merge strategy: 'manual', 'auto', or 'suggested'","default":"manual"},"merge_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Merge Reason","description":"Optional reason for merge"}},"type":"object","required":["target_product_id","source_product_ids","workspace_id","user_id"],"title":"MergeProductsRequest","description":"Request to merge duplicate products."},"MergeResponse":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"message":{"type":"string","title":"Message","default":""},"merged_product_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Merged Product Id"}},"type":"object","title":"MergeResponse","description":"Product merge/undo result."},"MergeSearchRequest":{"properties":{"user_id":{"type":"string","title":"User Id","description":"User ID"},"new_query":{"type":"string","title":"New Query","description":"New query to merge"},"new_filters":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"New Filters","description":"New filters"},"new_material_filters":{"anyOf":[{"$ref":"#/components/schemas/MaterialFilters"},{"type":"null"}],"description":"New material filters"}},"type":"object","required":["user_id","new_query"],"title":"MergeSearchRequest","description":"Request to merge a search into existing one."},"MergeSuggestion":{"properties":{"existing_search":{"$ref":"#/components/schemas/SavedSearchResponse"},"similarity_score":{"type":"number","title":"Similarity Score"},"reason":{"type":"string","title":"Reason"},"new_query":{"type":"string","title":"New Query"}},"type":"object","required":["existing_search","similarity_score","reason","new_query"],"title":"MergeSuggestion","description":"Merge suggestion response."},"ModelUsageStats":{"properties":{"model":{"type":"string","title":"Model"},"call_count":{"type":"integer","title":"Call Count"},"total_cost":{"type":"number","title":"Total Cost"},"total_tokens":{"type":"integer","title":"Total Tokens"},"average_latency_ms":{"type":"number","title":"Average Latency Ms"},"average_confidence":{"type":"number","title":"Average Confidence"},"fallback_count":{"type":"integer","title":"Fallback Count"}},"type":"object","required":["model","call_count","total_cost","total_tokens","average_latency_ms","average_confidence","fallback_count"],"title":"ModelUsageStats"},"MonitoringActionResponse":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"message":{"type":"string","title":"Message","default":""},"monitoring":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Monitoring"}},"type":"object","title":"MonitoringActionResponse","description":"Start/stop/check-now monitoring result."},"MultiModalAnalysisRequest":{"properties":{"document_id":{"type":"string","title":"Document Id","description":"Document ID to analyze"},"analysis_types":{"items":{"type":"string"},"type":"array","title":"Analysis Types","description":"Types of analysis to perform"},"include_text_analysis":{"type":"boolean","title":"Include Text Analysis","description":"Include text content analysis","default":true},"include_image_analysis":{"type":"boolean","title":"Include Image Analysis","description":"Include image content analysis","default":true},"include_ocr_analysis":{"type":"boolean","title":"Include Ocr Analysis","description":"Include OCR text analysis","default":true},"include_structure_analysis":{"type":"boolean","title":"Include Structure Analysis","description":"Include document structure analysis","default":false},"ocr_language":{"type":"string","title":"Ocr Language","description":"OCR language code","default":"en"},"ocr_confidence_threshold":{"type":"number","maximum":1.0,"minimum":0.0,"title":"Ocr Confidence Threshold","description":"Minimum OCR confidence","default":0.5},"image_analysis_depth":{"type":"string","pattern":"^(basic|standard|detailed)$","title":"Image Analysis Depth","description":"Image analysis depth","default":"standard"},"detect_objects":{"type":"boolean","title":"Detect Objects","description":"Detect objects in images","default":true},"extract_visual_features":{"type":"boolean","title":"Extract Visual Features","description":"Extract visual features","default":true},"enable_material_analysis":{"type":"boolean","title":"Enable Material Analysis","description":"Enable material property analysis","default":false},"material_analysis_types":{"items":{"type":"string"},"type":"array","title":"Material Analysis Types","description":"Types of material analysis (spectral, chemical, mechanical, thermal)"},"enable_clip_embeddings":{"type":"boolean","title":"Enable Clip Embeddings","description":"Generate CLIP embeddings for visual similarity","default":false},"enable_vision_analysis":{"type":"boolean","title":"Enable Vision Analysis","description":"Use Qwen Vision for material understanding","default":false},"spectral_analysis":{"type":"boolean","title":"Spectral Analysis","description":"Perform spectral analysis on materials","default":false},"chemical_analysis":{"type":"boolean","title":"Chemical Analysis","description":"Perform chemical composition analysis","default":false},"mechanical_analysis":{"type":"boolean","title":"Mechanical Analysis","description":"Perform mechanical property analysis","default":false},"thermal_analysis":{"type":"boolean","title":"Thermal Analysis","description":"Perform thermal property analysis","default":false},"multimodal_llm_model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Multimodal Llm Model","description":"Specific multi-modal LLM model to use"},"cross_modal_analysis":{"type":"boolean","title":"Cross Modal Analysis","description":"Analyze relationships between different modalities","default":false},"analysis_depth":{"type":"string","pattern":"^(basic|standard|detailed|comprehensive)$","title":"Analysis Depth","description":"Overall analysis depth","default":"standard"},"prioritize_materials":{"type":"boolean","title":"Prioritize Materials","description":"Prioritize material-related content in analysis","default":false}},"type":"object","required":["document_id","analysis_types"],"title":"MultiModalAnalysisRequest","description":"Request model for multi-modal document analysis with material-specific capabilities."},"MultiModalAnalysisResponse":{"properties":{"success":{"type":"boolean","title":"Success","description":"Indicates if the request was successful","default":true},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message","description":"Optional message or description"},"timestamp":{"type":"string","title":"Timestamp","description":"Response timestamp"},"document_id":{"type":"string","title":"Document Id","description":"Analyzed document ID"},"document_name":{"type":"string","title":"Document Name","description":"Document name"},"text_analysis":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Text Analysis","description":"Text analysis results"},"image_analysis":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Image Analysis","description":"Image analysis results"},"ocr_analysis":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Ocr Analysis","description":"OCR analysis results"},"structure_analysis":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Structure Analysis","description":"Document structure analysis"},"material_analysis":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Material Analysis","description":"Comprehensive material analysis results"},"spectral_analysis":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Spectral Analysis","description":"Spectral analysis results"},"chemical_analysis":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Chemical Analysis","description":"Chemical composition analysis"},"mechanical_analysis":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Mechanical Analysis","description":"Mechanical property analysis"},"thermal_analysis":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Thermal Analysis","description":"Thermal property analysis"},"clip_embeddings":{"anyOf":[{"items":{"items":{"type":"number"},"type":"array"},"type":"array"},{"type":"null"}],"title":"Clip Embeddings","description":"Generated CLIP embeddings for visual similarity"},"vision_analysis":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Vision Analysis","description":"Qwen Vision material understanding results"},"multimodal_insights":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Multimodal Insights","description":"Combined multi-modal insights"},"cross_modal_insights":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Cross Modal Insights","description":"Cross-modal relationship insights"},"content_summary":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Content Summary","description":"Overall content summary"},"material_summary":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Material Summary","description":"Material-focused analysis summary"},"analysis_time_ms":{"type":"number","title":"Analysis Time Ms","description":"Total analysis time"},"models_used":{"additionalProperties":{"type":"string"},"type":"object","title":"Models Used","description":"Models used for analysis"},"material_analysis_enabled":{"type":"boolean","title":"Material Analysis Enabled","description":"Whether material analysis was performed","default":false},"total_pages":{"type":"integer","title":"Total Pages","description":"Total pages analyzed"},"total_images":{"type":"integer","title":"Total Images","description":"Total images analyzed"},"total_text_chunks":{"type":"integer","title":"Total Text Chunks","description":"Total text chunks analyzed"},"total_materials_identified":{"type":"integer","title":"Total Materials Identified","description":"Total materials identified in analysis","default":0}},"type":"object","required":["document_id","document_name","analysis_time_ms","total_pages","total_images","total_text_chunks"],"title":"MultiModalAnalysisResponse","description":"Response model for multi-modal analysis."},"OCRProcessResponse":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"message":{"type":"string","title":"Message","default":""},"image_id":{"type":"string","title":"Image Id","default":""},"ocr_text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ocr Text"},"confidence":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Confidence"}},"type":"object","title":"OCRProcessResponse","description":"OCR processing result for an image."},"PDFHealthResponse":{"properties":{"status":{"type":"string","title":"Status","default":"healthy"},"processor":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Processor"}},"type":"object","title":"PDFHealthResponse","description":"PDF processor health."},"PackageStatusResponse":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"message":{"type":"string","title":"Message","default":""},"packages":{"items":{"type":"object"},"type":"array","title":"Packages"}},"type":"object","title":"PackageStatusResponse","description":"Python package status listing."},"PerformanceMetricsResponse":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"data":{"type":"object","title":"Data"},"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Timestamp"}},"type":"object","title":"PerformanceMetricsResponse","description":"Performance metrics summary."},"PointHint":{"properties":{"x":{"type":"number","maximum":1.0,"minimum":0.0,"title":"X"},"y":{"type":"number","maximum":1.0,"minimum":0.0,"title":"Y"},"radius":{"type":"number","maximum":0.5,"minimum":0.01,"title":"Radius","description":"Radius as fraction of image size","default":0.15}},"type":"object","required":["x","y"],"title":"PointHint","description":"Normalized point (0.0–1.0). Generates a small default region around the click."},"PriceAlertResponse":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message"},"alert":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Alert"},"alerts":{"anyOf":[{"items":{"type":"object"},"type":"array"},{"type":"null"}],"title":"Alerts"}},"type":"object","title":"PriceAlertResponse","description":"Price alert CRUD result."},"PriceHistoryResponse":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"history":{"items":{"type":"object"},"type":"array","title":"History"},"count":{"type":"integer","title":"Count","default":0}},"type":"object","title":"PriceHistoryResponse","description":"Price history for a product."},"PriceJobsResponse":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"jobs":{"items":{"type":"object"},"type":"array","title":"Jobs"},"count":{"type":"integer","title":"Count","default":0}},"type":"object","title":"PriceJobsResponse","description":"Price monitoring jobs listing."},"PriceSourceResponse":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message"},"source":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Source"},"sources":{"anyOf":[{"items":{"type":"object"},"type":"array"},{"type":"null"}],"title":"Sources"}},"type":"object","title":"PriceSourceResponse","description":"Price monitoring source CRUD result."},"PriceStatisticsResponse":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"statistics":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Statistics"}},"type":"object","title":"PriceStatisticsResponse","description":"Price statistics for a product."},"ProcessImportRequest":{"properties":{"job_id":{"type":"string","title":"Job Id","description":"Import job ID"},"workspace_id":{"type":"string","title":"Workspace Id","description":"Workspace ID"}},"type":"object","required":["job_id","workspace_id"],"title":"ProcessImportRequest","description":"Request model for processing an import job"},"ProcessSessionRequest":{"properties":{"session_id":{"type":"string","title":"Session Id","description":"Scraping session ID"},"workspace_id":{"type":"string","title":"Workspace Id","description":"Workspace ID"},"categories":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Categories","description":"Categories to discover (default: ['products'])"},"model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model","description":"AI model to use (claude, gpt)","default":"claude"}},"type":"object","required":["session_id","workspace_id"],"title":"ProcessSessionRequest","description":"Request model for processing a scraping session"},"ProcessSessionResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"session_id":{"type":"string","title":"Session Id"},"message":{"type":"string","title":"Message"},"job_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Job Id"},"products_created":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Products Created"}},"type":"object","required":["success","session_id","message"],"title":"ProcessSessionResponse","description":"Process session response"},"ProcessingStatus":{"type":"string","enum":["pending","processing","completed","failed","cancelled"],"title":"ProcessingStatus","description":"Status enumeration for processing jobs."},"ProductCoverage":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"populated_fields":{"type":"integer","title":"Populated Fields"},"missing_critical":{"items":{"type":"string"},"type":"array","title":"Missing Critical"},"source_breakdown":{"additionalProperties":{"type":"integer"},"type":"object","title":"Source Breakdown"}},"type":"object","required":["id","name","populated_fields","missing_critical","source_breakdown"],"title":"ProductCoverage"},"ProductCreationRequest":{"properties":{"document_id":{"type":"string","title":"Document Id","description":"UUID of the processed document"},"workspace_id":{"type":"string","title":"Workspace Id","description":"UUID of the workspace","default":"ffafc28b-1b8b-4b0d-b226-9f9a6154004e"},"max_products":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Products","description":"Maximum number of products to create (None = unlimited)"},"min_chunk_length":{"type":"integer","title":"Min Chunk Length","description":"Minimum chunk content length to consider for products","default":100}},"type":"object","required":["document_id"],"title":"ProductCreationRequest","description":"Request model for creating products from chunks."},"ProductCreationResponse":{"properties":{"success":{"type":"boolean","title":"Success","description":"Whether the operation was successful"},"products_created":{"type":"integer","title":"Products Created","description":"Number of products created"},"products_failed":{"type":"integer","title":"Products Failed","description":"Number of products that failed to create"},"chunks_processed":{"type":"integer","title":"Chunks Processed","description":"Number of chunks processed"},"total_chunks":{"type":"integer","title":"Total Chunks","description":"Total number of chunks available"},"eligible_chunks":{"type":"integer","title":"Eligible Chunks","description":"Number of chunks that met criteria"},"stage1_candidates":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Stage1 Candidates","description":"Number of candidates from Stage 1"},"stage1_time":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Stage1 Time","description":"Time spent in Stage 1 (seconds)"},"stage2_time":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Stage2 Time","description":"Time spent in Stage 2 (seconds)"},"total_time":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Total Time","description":"Total AI processing time (seconds)"},"message":{"type":"string","title":"Message","description":"Human-readable result message"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error","description":"Error message if operation failed"}},"type":"object","required":["success","products_created","products_failed","chunks_processed","total_chunks","eligible_chunks","message"],"title":"ProductCreationResponse","description":"Response model for product creation results."},"ProductDocumentRelationshipResponse":{"properties":{"id":{"type":"string","title":"Id"},"product_id":{"type":"string","title":"Product Id"},"document_entity_id":{"type":"string","title":"Document Entity Id"},"relationship_type":{"type":"string","title":"Relationship Type"},"relevance_score":{"type":"number","title":"Relevance Score"},"metadata":{"type":"object","title":"Metadata","default":{}},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["id","product_id","document_entity_id","relationship_type","relevance_score","created_at"],"title":"ProductDocumentRelationshipResponse","description":"Response model for product-document relationship."},"ProductEnrichmentRequest":{"properties":{"chunk_id":{"type":"string","title":"Chunk Id"},"chunk_content":{"type":"string","title":"Chunk Content"},"workspace_id":{"type":"string","title":"Workspace Id"}},"type":"object","required":["chunk_id","chunk_content","workspace_id"],"title":"ProductEnrichmentRequest"},"ProductEnrichmentResponse":{"properties":{"chunk_id":{"type":"string","title":"Chunk Id"},"enrichment_status":{"type":"string","title":"Enrichment Status"},"product_name":{"type":"string","title":"Product Name"},"product_category":{"type":"string","title":"Product Category"},"product_description":{"type":"string","title":"Product Description"},"specifications":{"type":"object","title":"Specifications"},"related_products":{"items":{"type":"string"},"type":"array","title":"Related Products"},"confidence_score":{"type":"number","title":"Confidence Score"},"processing_time_ms":{"type":"number","title":"Processing Time Ms"}},"type":"object","required":["chunk_id","enrichment_status","product_name","product_category","product_description","specifications","related_products","confidence_score","processing_time_ms"],"title":"ProductEnrichmentResponse"},"ProductGroupingResponse":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"groups":{"items":{"type":"object"},"type":"array","title":"Groups"},"ungrouped":{"type":"integer","title":"Ungrouped","default":0}},"type":"object","title":"ProductGroupingResponse","description":"Product grouping results."},"ProductTestResponse":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"message":{"type":"string","title":"Message","default":""},"data":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Data"},"products_created":{"type":"integer","title":"Products Created","default":0}},"type":"object","title":"ProductTestResponse","description":"Test product creation result."},"PromptHistoryResponse":{"properties":{"id":{"type":"string","title":"Id"},"prompt_id":{"type":"string","title":"Prompt Id"},"old_prompt":{"type":"string","title":"Old Prompt"},"new_prompt":{"type":"string","title":"New Prompt"},"changed_by":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Changed By"},"change_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Change Reason"},"changed_at":{"type":"string","title":"Changed At"}},"type":"object","required":["id","prompt_id","old_prompt","new_prompt","changed_by","change_reason","changed_at"],"title":"PromptHistoryResponse","description":"Prompt history response"},"PromptResponse":{"properties":{"id":{"type":"string","title":"Id"},"workspace_id":{"type":"string","title":"Workspace Id"},"stage":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Stage"},"category":{"type":"string","title":"Category"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"prompt_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Prompt Type"},"prompt_template":{"type":"string","title":"Prompt Template"},"system_prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"System Prompt"},"is_custom":{"type":"boolean","title":"Is Custom","default":false},"version":{"type":"integer","title":"Version","default":1},"created_by":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created By"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"},"used_in":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Used In"}},"type":"object","required":["id","workspace_id","category","prompt_template","created_at","updated_at"],"title":"PromptResponse","description":"Prompt response model"},"PromptTemplateHistoryResponse":{"properties":{"id":{"type":"string","title":"Id"},"old_prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Old Prompt"},"new_prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"New Prompt"},"old_system_prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Old System Prompt"},"new_system_prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"New System Prompt"},"changed_by":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Changed By"},"change_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Change Reason"},"changed_at":{"type":"string","title":"Changed At"}},"type":"object","required":["id","old_prompt","new_prompt","old_system_prompt","new_system_prompt","changed_by","change_reason","changed_at"],"title":"PromptTemplateHistoryResponse","description":"Prompt template history response"},"PromptTemplateResponse":{"properties":{"id":{"type":"string","title":"Id"},"workspace_id":{"type":"string","title":"Workspace Id"},"name":{"type":"string","title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"industry":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Industry"},"stage":{"type":"string","title":"Stage"},"category":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category"},"prompt_template":{"type":"string","title":"Prompt Template"},"system_prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"System Prompt"},"model_preference":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model Preference"},"temperature":{"type":"number","title":"Temperature"},"max_tokens":{"type":"integer","title":"Max Tokens"},"is_default":{"type":"boolean","title":"Is Default"},"is_active":{"type":"boolean","title":"Is Active"},"version":{"type":"integer","title":"Version"},"created_by":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created By"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"}},"type":"object","required":["id","workspace_id","name","description","industry","stage","category","prompt_template","system_prompt","model_preference","temperature","max_tokens","is_default","is_active","version","created_by","created_at","updated_at"],"title":"PromptTemplateResponse","description":"Prompt template response"},"PrototypePopulationResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"message":{"type":"string","title":"Message"},"categories_processed":{"type":"integer","title":"Categories Processed"},"categories_succeeded":{"type":"integer","title":"Categories Succeeded"},"categories_failed":{"type":"integer","title":"Categories Failed"},"details":{"items":{"type":"object"},"type":"array","title":"Details"}},"type":"object","required":["success","message","categories_processed","categories_succeeded","categories_failed","details"],"title":"PrototypePopulationResponse"},"PrototypeVerifyResponse":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"valid":{"type":"boolean","title":"Valid","default":true},"errors":{"items":{"type":"string"},"type":"array","title":"Errors"}},"type":"object","title":"PrototypeVerifyResponse","description":"Category prototype schema verification result."},"QueryCorrection":{"properties":{"original_query":{"type":"string","title":"Original Query","description":"Original query with potential typo"},"corrected_query":{"type":"string","title":"Corrected Query","description":"Corrected query"},"correction_type":{"type":"string","title":"Correction Type","description":"Type: spelling, synonym, expansion, abbreviation"},"confidence_score":{"type":"number","maximum":1.0,"minimum":0.0,"title":"Confidence Score","description":"Confidence in correction","default":0.8},"auto_applied":{"type":"boolean","title":"Auto Applied","description":"Whether correction was auto-applied","default":false},"acceptance_rate":{"type":"number","title":"Acceptance Rate","description":"Historical acceptance rate","default":0.0}},"type":"object","required":["original_query","corrected_query","correction_type"],"title":"QueryCorrection","description":"Query typo correction."},"QueryExpansionRequest":{"properties":{"query":{"type":"string","maxLength":200,"minLength":1,"title":"Query","description":"Query to expand"},"max_synonyms_per_term":{"type":"integer","maximum":10.0,"minimum":1.0,"title":"Max Synonyms Per Term","description":"Max synonyms per term","default":3},"max_related_concepts":{"type":"integer","maximum":20.0,"minimum":1.0,"title":"Max Related Concepts","description":"Max related concepts","default":5},"use_ai":{"type":"boolean","title":"Use Ai","description":"Use AI for expansion","default":true}},"type":"object","required":["query"],"title":"QueryExpansionRequest","description":"Request for query expansion."},"QueryExpansionResponse":{"properties":{"success":{"type":"boolean","title":"Success","description":"Whether the request was successful","default":true},"expanded_query":{"allOf":[{"$ref":"#/components/schemas/ExpandedQuery"}],"description":"Expanded query details"},"suggested_searches":{"items":{"type":"string"},"type":"array","title":"Suggested Searches","description":"Suggested search variations"},"processing_time_ms":{"type":"integer","title":"Processing Time Ms","description":"Processing time in milliseconds","default":0},"metadata":{"type":"object","title":"Metadata","description":"Additional metadata"}},"type":"object","required":["expanded_query"],"title":"QueryExpansionResponse","description":"Response with expanded query."},"QueryMetricsResponse":{"properties":{"total_queries":{"type":"integer","title":"Total Queries","description":"Total number of queries executed"},"slow_queries":{"type":"integer","title":"Slow Queries","description":"Number of slow queries"},"slow_query_percentage":{"type":"number","title":"Slow Query Percentage","description":"Percentage of slow queries"},"avg_query_time_ms":{"type":"number","title":"Avg Query Time Ms","description":"Average query time in milliseconds"},"max_query_time_ms":{"type":"number","title":"Max Query Time Ms","description":"Maximum query time in milliseconds"}},"type":"object","required":["total_queries","slow_queries","slow_query_percentage","avg_query_time_ms","max_query_time_ms"],"title":"QueryMetricsResponse","description":"Query performance metrics"},"QueueUnderstandingEmbeddingsRequest":{"properties":{"document_id":{"type":"string","title":"Document Id"},"workspace_id":{"type":"string","title":"Workspace Id"},"priority":{"type":"string","title":"Priority","default":"normal"}},"type":"object","required":["document_id","workspace_id"],"title":"QueueUnderstandingEmbeddingsRequest","description":"Request model for queuing Phase 2 understanding embeddings."},"QueueUnderstandingEmbeddingsResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"job_id":{"type":"string","title":"Job Id"},"message":{"type":"string","title":"Message"}},"type":"object","required":["success","job_id","message"],"title":"QueueUnderstandingEmbeddingsResponse","description":"Response model for queuing understanding embeddings."},"RegenerateImageEmbeddingsJobRequest":{"properties":{"document_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Document Id"},"image_ids":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Image Ids"},"force_regenerate":{"type":"boolean","title":"Force Regenerate","default":false},"priority":{"type":"integer","title":"Priority","default":0}},"type":"object","title":"RegenerateImageEmbeddingsJobRequest","description":"Request model for queuing image embedding regeneration job."},"RegenerateImageEmbeddingsJobResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"message":{"type":"string","title":"Message"},"job_id":{"type":"string","title":"Job Id"}},"type":"object","required":["success","message","job_id"],"title":"RegenerateImageEmbeddingsJobResponse","description":"Response model for queued image embedding regeneration job."},"RegenerateImageEmbeddingsRequest":{"properties":{"document_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Document Id"},"workspace_id":{"type":"string","title":"Workspace Id"},"image_ids":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Image Ids"},"force_regenerate":{"type":"boolean","title":"Force Regenerate","default":false},"job_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Job Id"}},"type":"object","required":["workspace_id"],"title":"RegenerateImageEmbeddingsRequest","description":"Request model for regenerating image embeddings."},"RegenerateImageEmbeddingsResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"message":{"type":"string","title":"Message"},"images_processed":{"type":"integer","title":"Images Processed"},"embeddings_generated":{"type":"integer","title":"Embeddings Generated"},"skipped":{"type":"integer","title":"Skipped"},"errors":{"items":{"type":"string"},"type":"array","title":"Errors","default":[]}},"type":"object","required":["success","message","images_processed","embeddings_generated","skipped"],"title":"RegenerateImageEmbeddingsResponse","description":"Response model for image embedding regeneration."},"RegenerateTextEmbeddingsRequest":{"properties":{"document_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Document Id"},"workspace_id":{"type":"string","title":"Workspace Id"},"chunk_ids":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Chunk Ids"},"force_regenerate":{"type":"boolean","title":"Force Regenerate","default":false}},"type":"object","required":["workspace_id"],"title":"RegenerateTextEmbeddingsRequest","description":"Request model for regenerating text embeddings."},"RegenerateTextEmbeddingsResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"message":{"type":"string","title":"Message"},"chunks_processed":{"type":"integer","title":"Chunks Processed"},"embeddings_generated":{"type":"integer","title":"Embeddings Generated"},"skipped":{"type":"integer","title":"Skipped"},"errors":{"items":{"type":"string"},"type":"array","title":"Errors","default":[]}},"type":"object","required":["success","message","chunks_processed","embeddings_generated","skipped"],"title":"RegenerateTextEmbeddingsResponse","description":"Response model for text embedding regeneration."},"RelevancyListResponse":{"properties":{"document_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Document Id"},"relevancies":{"items":{"type":"object"},"type":"array","title":"Relevancies"},"total":{"type":"integer","title":"Total","default":0},"limit":{"type":"integer","title":"Limit","default":100}},"type":"object","title":"RelevancyListResponse","description":"Chunk-image relevancy listing."},"ResetJobResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"message":{"type":"string","title":"Message"},"job_id":{"type":"string","title":"Job Id"},"previous_status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Previous Status"}},"type":"object","required":["success","message","job_id","previous_status"],"title":"ResetJobResponse","description":"Response model for job reset."},"RestartRequest":{"properties":{"force":{"type":"boolean","title":"Force","default":false},"reason":{"type":"string","title":"Reason"},"admin_token":{"type":"string","title":"Admin Token"}},"type":"object","required":["reason","admin_token"],"title":"RestartRequest","description":"Request model for service restart"},"RestartResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"message":{"type":"string","title":"Message"},"active_jobs":{"type":"integer","title":"Active Jobs"},"interrupted_jobs":{"items":{"type":"string"},"type":"array","title":"Interrupted Jobs","default":[]},"timestamp":{"type":"string","title":"Timestamp"}},"type":"object","required":["success","message","active_jobs","timestamp"],"title":"RestartResponse","description":"Response model for restart request"},"RunCatalogKnowledgeResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"document_id":{"type":"string","title":"Document Id"},"layout":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Layout"},"legends_stats":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Legends Stats"},"message":{"type":"string","title":"Message"}},"type":"object","required":["success","document_id","message"],"title":"RunCatalogKnowledgeResponse"},"SAMMaskRequest":{"properties":{"image_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Image Url","description":"Publicly accessible image URL (preferred — no base64 download)"},"image_base64":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Image Base64","description":"Base64-encoded source image (PNG or JPEG) — fallback if image_url not provided"},"hint_type":{"type":"string","enum":["bbox","point"],"title":"Hint Type","default":"bbox"},"bbox":{"anyOf":[{"$ref":"#/components/schemas/BboxHint"},{"type":"null"}]},"point":{"anyOf":[{"$ref":"#/components/schemas/PointHint"},{"type":"null"}]},"image_width":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Image Width","description":"Output mask width in px; defaults to source image width"},"image_height":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Image Height","description":"Output mask height in px; defaults to source image height"},"workspace_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workspace Id"}},"type":"object","title":"SAMMaskRequest"},"SAMMaskResponse":{"properties":{"mask_base64":{"type":"string","title":"Mask Base64","description":"Base64-encoded PNG mask (white=replace, black=keep)"},"mask_width":{"type":"integer","title":"Mask Width"},"mask_height":{"type":"integer","title":"Mask Height"},"method":{"type":"string","title":"Method","description":"'sam2', 'bbox_fallback', or 'bbox' — indicates which method generated the mask"},"confidence":{"type":"number","title":"Confidence","description":"Confidence of the mask (1.0 for bbox, variable for SAM 2)"}},"type":"object","required":["mask_base64","mask_width","mask_height","method","confidence"],"title":"SAMMaskResponse"},"SaveImagesRequest":{"properties":{"job_id":{"type":"string","title":"Job Id"},"material_images":{"items":{"type":"object"},"type":"array","title":"Material Images"},"document_id":{"type":"string","title":"Document Id"},"workspace_id":{"type":"string","title":"Workspace Id"},"ai_config":{"anyOf":[{"$ref":"#/components/schemas/AIModelConfig"},{"type":"null"}]}},"type":"object","required":["job_id","material_images","document_id","workspace_id"],"title":"SaveImagesRequest","description":"Request model for saving images to DB and generating visual embeddings."},"SaveImagesResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"images_saved":{"type":"integer","title":"Images Saved"},"clip_embeddings_generated":{"type":"integer","title":"Clip Embeddings Generated"}},"type":"object","required":["success","images_saved","clip_embeddings_generated"],"title":"SaveImagesResponse","description":"Response model for saving images."},"SavedSearchResponse":{"properties":{"id":{"type":"string","title":"Id"},"user_id":{"type":"string","title":"User Id"},"query":{"type":"string","title":"Query"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"filters":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Filters"},"material_filters":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Material Filters"},"integration_context":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Integration Context"},"integration_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Integration Id"},"use_count":{"type":"integer","title":"Use Count"},"last_executed_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Executed At"},"relevance_score":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Relevance Score"},"core_material":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Core Material"},"material_attributes":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Material Attributes"},"application_context":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Application Context"},"merge_count":{"type":"integer","title":"Merge Count"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["id","user_id","query","name","description","filters","material_filters","integration_context","integration_id","use_count","last_executed_at","relevance_score","core_material","material_attributes","application_context","merge_count","created_at","updated_at"],"title":"SavedSearchResponse","description":"Response model for saved search."},"SearchKBDocResult":{"properties":{"id":{"type":"string","title":"Id"},"workspace_id":{"type":"string","title":"Workspace Id"},"title":{"type":"string","title":"Title"},"content":{"type":"string","title":"Content"},"summary":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Summary"},"category_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category Id"},"category_slug":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category Slug"},"category_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category Name"},"status":{"type":"string","title":"Status"},"visibility":{"type":"string","title":"Visibility"},"embedding_status":{"type":"string","title":"Embedding Status"},"embedding_generated_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Embedding Generated At"},"created_by":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created By"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"},"view_count":{"type":"integer","title":"View Count"},"price_doc_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Price Doc Type"},"similarity":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Similarity"}},"type":"object","required":["id","workspace_id","title","content","status","visibility","embedding_status","created_at","updated_at","view_count"],"title":"SearchKBDocResult","description":"Individual search result document."},"SearchKBRequest":{"properties":{"workspace_id":{"type":"string","title":"Workspace Id","description":"UUID of the workspace"},"query":{"type":"string","minLength":1,"title":"Query","description":"Search query"},"search_type":{"type":"string","title":"Search Type","description":"Search type: semantic, full_text, or hybrid","default":"semantic"},"limit":{"type":"integer","maximum":100.0,"minimum":1.0,"title":"Limit","description":"Maximum number of results","default":20},"category_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category Id","description":"Restrict search to a single category UUID"},"category_slug":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category Slug","description":"Restrict search to a category by slug (e.g. 'pricing')"},"price_doc_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Price Doc Type","description":"Restrict to pricing sub-type: price_list | discount_rule | contract_terms | promotion"},"allowed_access_levels":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Allowed Access Levels","description":"Overrides category access gating. Defaults to admin+agent+public."},"require_published":{"type":"boolean","title":"Require Published","description":"When true, only published docs are returned (semantic only). Default False preserves admin management search behavior — agent-facing search should pass True explicitly.","default":false},"match_threshold":{"type":"number","maximum":1.0,"minimum":0.0,"title":"Match Threshold","description":"Minimum similarity for semantic search","default":0.5}},"type":"object","required":["workspace_id","query"],"title":"SearchKBRequest","description":"Request model for searching knowledge base documents."},"SearchKBResponse":{"properties":{"results":{"items":{"$ref":"#/components/schemas/SearchKBDocResult"},"type":"array","title":"Results"},"search_time_ms":{"type":"number","title":"Search Time Ms"},"total_results":{"type":"integer","title":"Total Results"}},"type":"object","required":["results","search_time_ms","total_results"],"title":"SearchKBResponse","description":"Response model for search results."},"SearchResult":{"properties":{"document_id":{"type":"string","title":"Document Id","description":"Source document ID"},"document_name":{"type":"string","title":"Document Name","description":"Document name"},"chunk_id":{"type":"string","title":"Chunk Id","description":"Matching chunk ID"},"content":{"type":"string","title":"Content","description":"Matching content snippet"},"similarity_score":{"type":"number","title":"Similarity Score","description":"Similarity score (0-1)"},"keyword_score":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Keyword Score","description":"Keyword matching score"},"combined_score":{"type":"number","title":"Combined Score","description":"Final combined relevance score"},"multimodal_score":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Multimodal Score","description":"Multi-modal relevance score (0-1)"},"ocr_confidence":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Ocr Confidence","description":"OCR extraction confidence (0-1)"},"page_number":{"type":"integer","title":"Page Number","description":"Source page number"},"context_before":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Context Before","description":"Text before the match"},"context_after":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Context After","description":"Text after the match"},"content_type":{"type":"string","title":"Content Type","description":"Content type (text, image, mixed)","default":"text"},"ocr_text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ocr Text","description":"OCR-extracted text content"},"associated_images":{"items":{"type":"object"},"type":"array","title":"Associated Images","description":"Associated image information"},"image_analysis":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Image Analysis","description":"Image analysis results"},"highlighted_content":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Highlighted Content","description":"Content with search terms highlighted"},"document_tags":{"items":{"type":"string"},"type":"array","title":"Document Tags","description":"Document tags"},"chunk_metadata":{"type":"object","title":"Chunk Metadata","description":"Chunk metadata"},"filename":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Filename","description":"Original filename of the document"},"processing_status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Processing Status","description":"Document processing status"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created At","description":"Document creation timestamp"},"source_metadata":{"type":"object","title":"Source Metadata","description":"Complete document metadata including file info"}},"type":"object","required":["document_id","document_name","chunk_id","content","similarity_score","combined_score","page_number"],"title":"SearchResult","description":"Individual search result."},"SearchSuggestion":{"properties":{"id":{"type":"string","title":"Id","description":"Unique suggestion ID"},"suggestion_text":{"type":"string","title":"Suggestion Text","description":"Suggested query text"},"suggestion_type":{"type":"string","title":"Suggestion Type","description":"Type: product, material, category, property, trending, recent"},"category":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category","description":"Category of the suggestion"},"popularity_score":{"type":"number","title":"Popularity Score","description":"Popularity score (0-1)","default":0.0},"click_count":{"type":"integer","title":"Click Count","description":"Number of times clicked","default":0},"impression_count":{"type":"integer","title":"Impression Count","description":"Number of times shown","default":0},"ctr":{"type":"number","title":"Ctr","description":"Click-through rate","default":0.0},"metadata":{"type":"object","title":"Metadata","description":"Additional metadata"},"confidence":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Confidence","description":"Confidence score for AI-generated suggestions"}},"type":"object","required":["id","suggestion_text","suggestion_type"],"title":"SearchSuggestion","description":"Individual search suggestion.","example":{"category":"ceramic","click_count":142,"confidence":0.92,"ctr":0.1136,"id":"550e8400-e29b-41d4-a716-446655440000","impression_count":1250,"metadata":{"related_terms":["fireproof","heat resistant"]},"popularity_score":0.85,"suggestion_text":"fire resistant tiles","suggestion_type":"trending"}},"SegmentRequest":{"properties":{"image_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Image Url"},"image_base64":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Image Base64"},"workspace_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workspace Id"}},"type":"object","title":"SegmentRequest"},"SegmentResponse":{"properties":{"zones":{"items":{"type":"object"},"type":"array","title":"Zones"},"count":{"type":"integer","title":"Count","default":0},"processing_time_ms":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Processing Time Ms"}},"type":"object","title":"SegmentResponse","description":"Image segmentation result."},"SemanticSearchRequest":{"properties":{"query":{"type":"string","maxLength":1000,"minLength":1,"title":"Query","description":"Search query for semantic matching"},"document_ids":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Document Ids","description":"Specific document IDs to search (if None, searches all)"},"similarity_threshold":{"type":"number","maximum":1.0,"minimum":0.0,"title":"Similarity Threshold","description":"Minimum similarity score threshold","default":0.7},"max_results":{"type":"integer","maximum":100.0,"minimum":1.0,"title":"Max Results","description":"Maximum number of results to return","default":20},"include_metadata":{"type":"boolean","title":"Include Metadata","description":"Whether to include result metadata","default":true}},"type":"object","required":["query"],"title":"SemanticSearchRequest","description":"Request model for semantic search across documents.","example":{"document_ids":["doc_123","doc_456"],"include_metadata":true,"max_results":10,"query":"machine learning algorithms","similarity_threshold":0.75}},"SemanticSearchResponse":{"properties":{"success":{"type":"boolean","title":"Success","description":"Indicates if the request was successful","default":true},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message","description":"Optional message or description"},"timestamp":{"type":"string","title":"Timestamp","description":"Response timestamp"},"query":{"type":"string","title":"Query","description":"Original search query"},"results":{"items":{"type":"object"},"type":"array","title":"Results","description":"Search results with similarity scores"},"total_results":{"type":"integer","title":"Total Results","description":"Total number of results found"},"metadata":{"type":"object","title":"Metadata","description":"Search metadata and statistics"}},"type":"object","required":["query","total_results"],"title":"SemanticSearchResponse","description":"Response model for semantic search operations.","example":{"metadata":{"search_time":1.2,"searched_documents":10,"similarity_threshold":0.75},"query":"machine learning algorithms","results":[{"content":"Machine learning algorithms are...","document_id":"doc_123","metadata":{"page":1,"section":"Introduction"},"score":0.85}],"success":true,"timestamp":"2024-07-26T18:00:00Z","total_results":5}},"SentimentTrendsResponse":{"properties":{"material_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Material Id"},"time_window":{"type":"string","title":"Time Window"},"window_start":{"type":"string","title":"Window Start"},"window_end":{"type":"string","title":"Window End"},"total_feedback_count":{"type":"integer","title":"Total Feedback Count"},"positive_count":{"type":"integer","title":"Positive Count"},"neutral_count":{"type":"integer","title":"Neutral Count"},"negative_count":{"type":"integer","title":"Negative Count"},"average_rating":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Average Rating"},"average_confidence":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Average Confidence"},"aspect_scores":{"type":"object","title":"Aspect Scores"},"top_positive_phrases":{"items":{"type":"string"},"type":"array","title":"Top Positive Phrases"},"top_negative_phrases":{"items":{"type":"string"},"type":"array","title":"Top Negative Phrases"}},"type":"object","required":["material_id","time_window","window_start","window_end","total_feedback_count","positive_count","neutral_count","negative_count","average_rating","average_confidence","aspect_scores","top_positive_phrases","top_negative_phrases"],"title":"SentimentTrendsResponse"},"ServiceHealthResponse":{"properties":{"status":{"type":"string","title":"Status","default":"healthy"},"service":{"type":"string","title":"Service","default":""},"version":{"type":"string","title":"Version","default":""},"models":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Models"},"endpoints":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Endpoints"},"features":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Features"}},"type":"object","title":"ServiceHealthResponse","description":"AI service health check."},"SessionStatusResponse":{"properties":{"session_id":{"type":"string","title":"Session Id"},"status":{"type":"string","title":"Status"},"source_url":{"type":"string","title":"Source Url"},"progress_percentage":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Progress Percentage"},"total_pages":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Total Pages"},"completed_pages":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Completed Pages"},"failed_pages":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Failed Pages"},"materials_processed":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Materials Processed"},"products_created":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Products Created"},"error_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Message"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"}},"type":"object","required":["session_id","status","source_url","progress_percentage","total_pages","completed_pages","failed_pages","materials_processed","products_created","error_message","created_at","updated_at"],"title":"SessionStatusResponse","description":"Scraping session status response"},"SimilarDocument":{"properties":{"document_id":{"type":"string","title":"Document Id","description":"Document ID"},"document_name":{"type":"string","title":"Document Name","description":"Document name"},"similarity_score":{"type":"number","title":"Similarity Score","description":"Similarity score (0-1)"},"page_count":{"type":"integer","title":"Page Count","description":"Number of pages"},"word_count":{"type":"integer","title":"Word Count","description":"Word count"},"tags":{"items":{"type":"string"},"type":"array","title":"Tags","description":"Document tags"},"created_at":{"type":"string","title":"Created At","description":"Creation timestamp"},"matching_topics":{"items":{"type":"string"},"type":"array","title":"Matching Topics","description":"Common topics/themes"},"content_overlap":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Content Overlap","description":"Content overlap percentage"}},"type":"object","required":["document_id","document_name","similarity_score","page_count","word_count","created_at"],"title":"SimilarDocument","description":"Similar document result."},"SimilarImage":{"properties":{"image_id":{"type":"string","title":"Image Id","description":"Image identifier"},"document_id":{"type":"string","title":"Document Id","description":"Source document ID"},"document_name":{"type":"string","title":"Document Name","description":"Source document name"},"page_number":{"type":"integer","title":"Page Number","description":"Page number where image appears"},"similarity_score":{"type":"number","title":"Similarity Score","description":"Visual similarity score (0-1)"},"content_similarity":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Content Similarity","description":"Content/description similarity"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"Image description"},"tags":{"items":{"type":"string"},"type":"array","title":"Tags","description":"Image tags"},"dimensions":{"additionalProperties":{"type":"integer"},"type":"object","title":"Dimensions","description":"Image dimensions"},"image_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Image Url","description":"URL to access the image"}},"type":"object","required":["image_id","document_id","document_name","page_number","similarity_score","dimensions"],"title":"SimilarImage","description":"Similar image search result."},"SimilaritySearchRequest":{"properties":{"reference_document_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reference Document Id","description":"Find documents similar to this one"},"reference_text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reference Text","description":"Find documents similar to this text"},"limit":{"type":"integer","maximum":50.0,"minimum":1.0,"title":"Limit","description":"Maximum number of similar documents","default":10},"similarity_threshold":{"type":"number","maximum":1.0,"minimum":0.0,"title":"Similarity Threshold","description":"Minimum similarity score","default":0.5},"exclude_self":{"type":"boolean","title":"Exclude Self","description":"Exclude reference document from results","default":true},"tags":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Tags","description":"Filter by document tags"},"document_types":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Document Types","description":"Filter by document types"}},"type":"object","title":"SimilaritySearchRequest","description":"Request model for similarity-based document search."},"SimilaritySearchResponse":{"properties":{"success":{"type":"boolean","title":"Success","description":"Indicates if the request was successful","default":true},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message","description":"Optional message or description"},"timestamp":{"type":"string","title":"Timestamp","description":"Response timestamp"},"reference_info":{"type":"object","title":"Reference Info","description":"Information about the reference"},"similar_documents":{"items":{"$ref":"#/components/schemas/SimilarDocument"},"type":"array","title":"Similar Documents","description":"Similar documents found"},"total_found":{"type":"integer","title":"Total Found","description":"Total number of similar documents"},"search_time_ms":{"type":"number","title":"Search Time Ms","description":"Search execution time"}},"type":"object","required":["reference_info","similar_documents","total_found","search_time_ms"],"title":"SimilaritySearchResponse","description":"Response model for similarity search."},"SourceCitation":{"properties":{"document_id":{"type":"string","title":"Document Id","description":"Source document ID"},"document_name":{"type":"string","title":"Document Name","description":"Document name"},"chunk_id":{"type":"string","title":"Chunk Id","description":"Source chunk ID"},"page_number":{"type":"integer","title":"Page Number","description":"Page number"},"relevance_score":{"type":"number","title":"Relevance Score","description":"Relevance to the question"},"excerpt":{"type":"string","title":"Excerpt","description":"Relevant text excerpt"},"content_type":{"type":"string","title":"Content Type","description":"Content type (text, image, mixed)","default":"text"},"ocr_excerpt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ocr Excerpt","description":"OCR-extracted text excerpt"},"image_reference":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Image Reference","description":"Associated image information"},"multimodal_confidence":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Multimodal Confidence","description":"Multi-modal analysis confidence"}},"type":"object","required":["document_id","document_name","chunk_id","page_number","relevance_score","excerpt"],"title":"SourceCitation","description":"Source citation for RAG responses."},"StartMonitoringRequest":{"properties":{"product_id":{"type":"string","title":"Product Id","description":"Product UUID to monitor"},"frequency":{"type":"string","title":"Frequency","description":"Monitoring frequency: hourly, daily, weekly, on_demand","default":"daily"},"enabled":{"type":"boolean","title":"Enabled","description":"Enable monitoring","default":true}},"type":"object","required":["product_id"],"title":"StartMonitoringRequest","description":"Request to start price monitoring for a product"},"StatsResponse":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"stats":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Stats"},"data":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Data"},"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Timestamp"}},"type":"object","title":"StatsResponse","description":"Workspace or general statistics."},"StatusResponse":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"message":{"type":"string","title":"Message","default":""}},"type":"object","title":"StatusResponse","description":"Minimal success/failure acknowledgement."},"StorageEstimateResponse":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"storage":{"type":"object","title":"Storage"}},"type":"object","title":"StorageEstimateResponse","description":"Storage usage estimates."},"StuckJobListResponse":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"stuck_jobs":{"items":{"type":"object"},"type":"array","title":"Stuck Jobs"},"count":{"type":"integer","title":"Count","default":0}},"type":"object","title":"StuckJobListResponse","description":"List of stuck jobs."},"StuckJobsResponse":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"data":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Data"},"statistics":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Statistics"}},"type":"object","title":"StuckJobsResponse","description":"Stuck job analysis results."},"SubmitFeedbackRequest":{"properties":{"workspace_id":{"type":"string","title":"Workspace Id","description":"Workspace ID"},"user_id":{"type":"string","title":"User Id","description":"User ID"},"material_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Material Id","description":"Material/Product ID"},"feedback_text":{"type":"string","minLength":10,"title":"Feedback Text","description":"Feedback text (min 10 characters)"},"feedback_type":{"type":"string","title":"Feedback Type","description":"Type: review, comment, rating, suggestion","default":"review"},"rating":{"anyOf":[{"type":"integer","maximum":5.0,"minimum":1.0},{"type":"null"}],"title":"Rating","description":"Rating 1-5 stars"},"is_verified":{"type":"boolean","title":"Is Verified","description":"Verified purchase/usage","default":false},"is_public":{"type":"boolean","title":"Is Public","description":"Show in public reviews","default":true},"context":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Context","description":"Additional context"}},"type":"object","required":["workspace_id","user_id","feedback_text"],"title":"SubmitFeedbackRequest"},"SuccessResponse":{"properties":{"success":{"type":"boolean","title":"Success","description":"Always true for success responses","default":true},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message","description":"Optional message or description"},"timestamp":{"type":"string","title":"Timestamp","description":"Response timestamp"},"data":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Data","description":"Response data payload"}},"type":"object","title":"SuccessResponse","description":"Success response model with optional data payload.","example":{"data":{"count":42,"result":"example_value"},"message":"Operation completed successfully","success":true,"timestamp":"2024-07-26T18:00:00Z"}},"SuggestionClickRequest":{"properties":{"suggestion_id":{"type":"string","title":"Suggestion Id","description":"Suggestion ID that was clicked"},"user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id","description":"User ID"},"session_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Session Id","description":"Session ID"},"original_query":{"type":"string","title":"Original Query","description":"Original query before suggestion"},"suggestion_position":{"type":"integer","minimum":0.0,"title":"Suggestion Position","description":"Position in suggestion list"},"action_type":{"type":"string","title":"Action Type","description":"Action: clicked, dismissed, ignored, accepted"},"result_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Result Count","description":"Number of results after clicking"},"user_satisfied":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"User Satisfied","description":"Whether user was satisfied"}},"type":"object","required":["suggestion_id","original_query","suggestion_position","action_type"],"title":"SuggestionClickRequest","description":"Request to track suggestion click."},"SuggestionClickResponse":{"properties":{"success":{"type":"boolean","title":"Success","description":"Whether tracking was successful","default":true},"message":{"type":"string","title":"Message","description":"Response message","default":"Click tracked successfully"}},"type":"object","title":"SuggestionClickResponse","description":"Response after tracking suggestion click."},"SystemHealthResponse":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"message":{"type":"string","title":"Message","default":""},"data":{"type":"object","title":"Data"},"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Timestamp"}},"type":"object","title":"SystemHealthResponse","description":"System health overview."},"SystemMetricsResponse":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"message":{"type":"string","title":"Message","default":""},"data":{"type":"object","title":"Data"}},"type":"object","title":"SystemMetricsResponse","description":"System metrics and performance data."},"TaskBreakdown":{"properties":{"task":{"type":"string","title":"Task"},"call_count":{"type":"integer","title":"Call Count"},"total_cost":{"type":"number","title":"Total Cost"},"average_confidence":{"type":"number","title":"Average Confidence"},"models_used":{"items":{"type":"string"},"type":"array","title":"Models Used"}},"type":"object","required":["task","call_count","total_cost","average_confidence","models_used"],"title":"TaskBreakdown"},"TestPromptRequest":{"properties":{"stage":{"type":"string","title":"Stage"},"category":{"type":"string","title":"Category"},"prompt_template":{"type":"string","title":"Prompt Template"},"test_content":{"type":"string","title":"Test Content"}},"type":"object","required":["stage","category","prompt_template","test_content"],"title":"TestPromptRequest","description":"Test prompt request"},"TestPromptResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"result":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Result"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"},"execution_time_ms":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Execution Time Ms"}},"type":"object","required":["success"],"title":"TestPromptResponse","description":"Test prompt response"},"TrendingSearch":{"properties":{"query_text":{"type":"string","title":"Query Text","description":"Trending query text"},"search_count":{"type":"integer","title":"Search Count","description":"Number of searches in time window","default":0},"unique_users_count":{"type":"integer","title":"Unique Users Count","description":"Number of unique users","default":0},"trend_score":{"type":"number","title":"Trend Score","description":"Calculated trend score","default":0.0},"growth_rate":{"type":"number","title":"Growth Rate","description":"Growth rate percentage","default":0.0},"time_window":{"type":"string","title":"Time Window","description":"Time window: hourly, daily, weekly"},"category":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category","description":"Category of the search"},"metadata":{"type":"object","title":"Metadata","description":"Additional metadata"}},"type":"object","required":["query_text","time_window"],"title":"TrendingSearch","description":"Trending search query."},"TrendingSearchesResponse":{"properties":{"success":{"type":"boolean","title":"Success","description":"Whether the request was successful","default":true},"trending_searches":{"items":{"$ref":"#/components/schemas/TrendingSearch"},"type":"array","title":"Trending Searches","description":"List of trending searches"},"total_results":{"type":"integer","title":"Total Results","description":"Total number of trending searches","default":0},"time_window":{"type":"string","title":"Time Window","description":"Time window used"},"window_start":{"type":"string","format":"date-time","title":"Window Start","description":"Start of time window"},"window_end":{"type":"string","format":"date-time","title":"Window End","description":"End of time window"},"metadata":{"type":"object","title":"Metadata","description":"Additional metadata"}},"type":"object","required":["time_window","window_start","window_end"],"title":"TrendingSearchesResponse","description":"Response with trending searches."},"TypoCorrectionRequest":{"properties":{"query":{"type":"string","maxLength":200,"minLength":1,"title":"Query","description":"Query to check for typos"},"auto_apply_threshold":{"type":"number","maximum":1.0,"minimum":0.0,"title":"Auto Apply Threshold","description":"Confidence threshold for auto-apply","default":0.9},"max_suggestions":{"type":"integer","maximum":10.0,"minimum":1.0,"title":"Max Suggestions","description":"Maximum correction suggestions","default":3}},"type":"object","required":["query"],"title":"TypoCorrectionRequest","description":"Request for typo correction."},"TypoCorrectionResponse":{"properties":{"success":{"type":"boolean","title":"Success","description":"Whether the request was successful","default":true},"original_query":{"type":"string","title":"Original Query","description":"Original query"},"has_corrections":{"type":"boolean","title":"Has Corrections","description":"Whether corrections were found","default":false},"corrections":{"items":{"$ref":"#/components/schemas/QueryCorrection"},"type":"array","title":"Corrections","description":"List of corrections"},"recommended_correction":{"anyOf":[{"$ref":"#/components/schemas/QueryCorrection"},{"type":"null"}],"description":"Highest confidence correction"},"metadata":{"type":"object","title":"Metadata","description":"Additional metadata"}},"type":"object","required":["original_query"],"title":"TypoCorrectionResponse","description":"Response with typo corrections."},"UndoMergeRequest":{"properties":{"history_id":{"type":"string","title":"History Id","description":"Merge history ID to undo"},"user_id":{"type":"string","title":"User Id","description":"User performing the undo"}},"type":"object","required":["history_id","user_id"],"title":"UndoMergeRequest","description":"Request to undo a product merge."},"UpdateDuplicateStatusRequest":{"properties":{"cache_id":{"type":"string","title":"Cache Id","description":"Duplicate cache ID"},"status":{"type":"string","title":"Status","description":"New status: 'pending', 'reviewed', 'merged', 'dismissed'"},"user_id":{"type":"string","title":"User Id","description":"User updating the status"}},"type":"object","required":["cache_id","status","user_id"],"title":"UpdateDuplicateStatusRequest","description":"Request to update duplicate detection status."},"UpdateExtractionConfigRequest":{"properties":{"enabled_categories":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Enabled Categories"},"default_categories":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Default Categories"},"discovery_model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Discovery Model"},"chunk_size":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Chunk Size"},"chunk_overlap":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Chunk Overlap"},"enable_prompt_enhancement":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Enable Prompt Enhancement"},"quality_threshold":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Quality Threshold"}},"type":"object","title":"UpdateExtractionConfigRequest","description":"Update extraction config request"},"UpdateKBDocRequest":{"properties":{"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title","description":"Document title"},"content":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Content","description":"Document content"},"content_markdown":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Content Markdown","description":"Markdown version"},"summary":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Summary","description":"Document summary"},"category_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category Id","description":"Category UUID"},"seo_keywords":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Seo Keywords","description":"SEO keywords"},"status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status","description":"Document status"},"visibility":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Visibility","description":"Document visibility"},"metadata":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Metadata","description":"Custom metadata"},"price_doc_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Price Doc Type","description":"Sub-type for pricing docs: price_list | discount_rule | contract_terms | promotion"}},"type":"object","title":"UpdateKBDocRequest","description":"Request model for updating a knowledge base document."},"UpdatePromptRequest":{"properties":{"prompt_template":{"type":"string","title":"Prompt Template","description":"New prompt template"},"system_prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"System Prompt","description":"Optional system prompt"},"change_reason":{"type":"string","title":"Change Reason","description":"Reason for the change"}},"type":"object","required":["prompt_template","change_reason"],"title":"UpdatePromptRequest","description":"Update prompt request"},"UpdatePromptTemplateRequest":{"properties":{"prompt_template":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Prompt Template"},"system_prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"System Prompt"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"model_preference":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model Preference"},"temperature":{"anyOf":[{"type":"number","maximum":2.0,"minimum":0.0},{"type":"null"}],"title":"Temperature"},"max_tokens":{"anyOf":[{"type":"integer","maximum":16384.0,"minimum":256.0},{"type":"null"}],"title":"Max Tokens"},"is_active":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Active"},"change_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Change Reason"}},"type":"object","title":"UpdatePromptTemplateRequest","description":"Update prompt template request"},"UpdateSavedSearchRequest":{"properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name","description":"New name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"New description"},"query":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Query","description":"New query"},"filters":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Filters","description":"New filters"},"material_filters":{"anyOf":[{"$ref":"#/components/schemas/MaterialFilters"},{"type":"null"}],"description":"New material filters"}},"type":"object","title":"UpdateSavedSearchRequest","description":"Request to update a saved search."},"UploadImagesRequest":{"properties":{"job_id":{"type":"string","title":"Job Id"},"material_images":{"items":{"type":"object"},"type":"array","title":"Material Images"},"document_id":{"type":"string","title":"Document Id"}},"type":"object","required":["job_id","material_images","document_id"],"title":"UploadImagesRequest","description":"Request model for image upload."},"UploadImagesResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"uploaded_images":{"items":{"type":"object"},"type":"array","title":"Uploaded Images"},"uploaded_count":{"type":"integer","title":"Uploaded Count"},"failed_count":{"type":"integer","title":"Failed Count"}},"type":"object","required":["success","uploaded_images","uploaded_count","failed_count"],"title":"UploadImagesResponse","description":"Response model for image upload."},"ValidatePipelineResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"job_id":{"type":"string","title":"Job Id"},"document_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Document Id"},"status":{"type":"string","title":"Status"},"stages_complete":{"type":"object","title":"Stages Complete"},"issues":{"items":{"type":"string"},"type":"array","title":"Issues"},"recommendations":{"items":{"type":"string"},"type":"array","title":"Recommendations"}},"type":"object","required":["success","job_id","document_id","status","stages_complete","issues","recommendations"],"title":"ValidatePipelineResponse","description":"Response model for pipeline validation."},"ValidateProductRequest":{"properties":{"product_data":{"type":"object","title":"Product Data","description":"Product metadata"},"chunks":{"items":{"type":"object"},"type":"array","title":"Chunks","description":"Associated chunks"},"images":{"anyOf":[{"items":{"type":"object"},"type":"array"},{"type":"null"}],"title":"Images","description":"Associated images"}},"type":"object","required":["product_data","chunks"],"title":"ValidateProductRequest","description":"Request for product validation."},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"},"ValidationResponse":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"valid":{"type":"boolean","title":"Valid","default":true},"issues":{"items":{"type":"string"},"type":"array","title":"Issues"},"confidence":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Confidence"}},"type":"object","title":"ValidationResponse","description":"Product/consensus validation result."},"app__api__documents__query_routes__ChatRequest":{"properties":{"message":{"type":"string","maxLength":2000,"minLength":1,"title":"Message","description":"Chat message"},"workspace_id":{"type":"string","title":"Workspace Id","description":"Workspace ID"},"conversation_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Conversation Id","description":"Conversation ID for context"},"top_k":{"anyOf":[{"type":"integer","maximum":20.0,"minimum":1.0},{"type":"null"}],"title":"Top K","description":"Number of context chunks to retrieve","default":5},"include_history":{"type":"boolean","title":"Include History","description":"Include conversation history in context","default":true},"document_ids":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Document Ids","description":"Filter by specific document IDs"},"conversation_history":{"anyOf":[{"items":{"additionalProperties":{"type":"string"},"type":"object"},"type":"array"},{"type":"null"}],"title":"Conversation History","description":"Conversation history"}},"type":"object","required":["message","workspace_id"],"title":"ChatRequest","description":"Request model for conversational RAG."},"app__api__documents__query_routes__KnowledgeBaseSearchRequest":{"properties":{"query":{"type":"string","title":"Query","description":"Search query"},"workspace_id":{"type":"string","title":"Workspace Id","description":"Workspace ID to search within"},"search_types":{"items":{"type":"string"},"type":"array","title":"Search Types","description":"Types to search: products, entities, chunks, images","default":["products","entities","chunks"]},"categories":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Categories","description":"Filter by categories: product, certificate, logo, specification, general"},"entity_types":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Entity Types","description":"Filter by entity types: certificate, logo, specification"},"top_k":{"type":"integer","title":"Top K","description":"Number of results to return per type","default":10},"similarity_threshold":{"type":"number","title":"Similarity Threshold","description":"Minimum similarity score","default":0.7}},"type":"object","required":["query","workspace_id"],"title":"KnowledgeBaseSearchRequest","description":"Request model for knowledge base search"},"app__api__documents__query_routes__QueryRequest":{"properties":{"query":{"type":"string","maxLength":2000,"minLength":1,"title":"Query","description":"Query text"},"workspace_id":{"type":"string","title":"Workspace Id","description":"Workspace ID"},"top_k":{"anyOf":[{"type":"integer","maximum":20.0,"minimum":1.0},{"type":"null"}],"title":"Top K","description":"Number of top results to retrieve","default":5},"similarity_threshold":{"anyOf":[{"type":"number","maximum":1.0,"minimum":0.0},{"type":"null"}],"title":"Similarity Threshold","description":"Similarity threshold","default":0.7},"include_metadata":{"type":"boolean","title":"Include Metadata","description":"Include document metadata in response","default":true},"enable_reranking":{"type":"boolean","title":"Enable Reranking","description":"Enable result reranking","default":true},"document_ids":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Document Ids","description":"Filter by specific document IDs"}},"type":"object","required":["query","workspace_id"],"title":"QueryRequest","description":"Request model for RAG queries."},"app__api__documents__query_routes__QueryResponse":{"properties":{"query":{"type":"string","title":"Query","description":"Original query"},"answer":{"type":"string","title":"Answer","description":"Generated answer"},"sources":{"items":{"type":"object"},"type":"array","title":"Sources","description":"Source documents and chunks"},"confidence_score":{"type":"number","title":"Confidence Score","description":"Confidence score for the answer"},"processing_time":{"type":"number","title":"Processing Time","description":"Query processing time in seconds"},"retrieved_chunks":{"type":"integer","title":"Retrieved Chunks","description":"Number of chunks retrieved"}},"type":"object","required":["query","answer","sources","confidence_score","processing_time","retrieved_chunks"],"title":"QueryResponse","description":"Response model for RAG queries."},"app__api__documents__query_routes__SearchRequest":{"properties":{"query":{"type":"string","maxLength":1000,"minLength":1,"title":"Query","description":"Search query"},"search_type":{"type":"string","pattern":"^(semantic|hybrid|keyword)$","title":"Search Type","description":"Search type","default":"semantic"},"top_k":{"anyOf":[{"type":"integer","maximum":50.0,"minimum":1.0},{"type":"null"}],"title":"Top K","description":"Number of results to return","default":10},"similarity_threshold":{"anyOf":[{"type":"number","maximum":1.0,"minimum":0.0},{"type":"null"}],"title":"Similarity Threshold","description":"Similarity threshold","default":0.6},"document_ids":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Document Ids","description":"Filter by document IDs"},"include_content":{"type":"boolean","title":"Include Content","description":"Include chunk content in results","default":true},"workspace_id":{"type":"string","title":"Workspace Id","description":"Workspace ID for scoped search and related products"},"include_related_products":{"type":"boolean","title":"Include Related Products","description":"Include related products in results","default":true},"related_products_limit":{"type":"integer","maximum":10.0,"minimum":1.0,"title":"Related Products Limit","description":"Max related products per result","default":3},"use_search_prompts":{"type":"boolean","title":"Use Search Prompts","description":"Apply admin-configured search prompts","default":true},"custom_formatting_prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Custom Formatting Prompt","description":"Custom formatting prompt (overrides default)"},"material_filters":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Material Filters","description":"Material property filters for material search strategy"},"image_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Image Url","description":"Image URL for image similarity search strategy"},"image_base64":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Image Base64","description":"Base64-encoded image for image similarity search strategy"}},"type":"object","required":["query","workspace_id"],"title":"SearchRequest","description":"Request model for semantic search."},"app__api__documents__query_routes__SearchResponse":{"properties":{"query":{"type":"string","title":"Query","description":"Original search query"},"enhanced_query":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Enhanced Query","description":"Enhanced query (if prompts applied)"},"results":{"items":{"type":"object"},"type":"array","title":"Results","description":"Search results"},"total_results":{"type":"integer","title":"Total Results","description":"Total number of results"},"search_type":{"type":"string","title":"Search Type","description":"Type of search performed"},"processing_time":{"type":"number","title":"Processing Time","description":"Search processing time"},"search_metadata":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Search Metadata","description":"Search metadata (prompts applied, etc.)"}},"type":"object","required":["query","results","total_results","search_type","processing_time"],"title":"SearchResponse","description":"Response model for semantic search."},"app__api__rag_routes__ChatRequest":{"properties":{"message":{"type":"string","maxLength":2000,"minLength":1,"title":"Message","description":"Chat message"},"conversation_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Conversation Id","description":"Conversation ID for context"},"top_k":{"anyOf":[{"type":"integer","maximum":20.0,"minimum":1.0},{"type":"null"}],"title":"Top K","description":"Number of context chunks to retrieve","default":5},"include_history":{"type":"boolean","title":"Include History","description":"Include conversation history in context","default":true},"document_ids":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Document Ids","description":"Filter by specific document IDs"}},"type":"object","required":["message"],"title":"ChatRequest","description":"Request model for conversational RAG."},"app__api__rag_routes__KnowledgeBaseSearchRequest":{"properties":{"query":{"type":"string","title":"Query","description":"Search query"},"workspace_id":{"type":"string","title":"Workspace Id","description":"Workspace ID to search within"},"search_types":{"items":{"type":"string"},"type":"array","title":"Search Types","description":"Types to search: products, entities, chunks, images, kb_docs","default":["products","entities","chunks"]},"categories":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Categories","description":"Filter by categories: product, certificate, logo, specification, general"},"entity_types":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Entity Types","description":"Filter by entity types: certificate, logo, specification"},"top_k":{"type":"integer","title":"Top K","description":"Number of results to return per type","default":10},"similarity_threshold":{"type":"number","title":"Similarity Threshold","description":"Minimum similarity score","default":0.7},"caller":{"type":"string","title":"Caller","description":"Caller context: 'admin' (all levels), 'agent' (agent+public), 'public' (public only)","default":"agent"},"category_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category Id","description":"Restrict kb_docs search to a single category UUID"},"category_slug":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category Slug","description":"Restrict kb_docs search to a category by slug (e.g. 'pricing')"},"price_doc_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Price Doc Type","description":"Restrict to pricing sub-type: price_list | discount_rule | contract_terms | promotion"}},"type":"object","required":["query","workspace_id"],"title":"KnowledgeBaseSearchRequest","description":"Request model for knowledge base search"},"app__api__rag_routes__QueryRequest":{"properties":{"query":{"type":"string","maxLength":2000,"minLength":1,"title":"Query","description":"Query text"},"top_k":{"anyOf":[{"type":"integer","maximum":20.0,"minimum":1.0},{"type":"null"}],"title":"Top K","description":"Number of top results to retrieve","default":5},"similarity_threshold":{"anyOf":[{"type":"number","maximum":1.0,"minimum":0.0},{"type":"null"}],"title":"Similarity Threshold","description":"Similarity threshold","default":0.7},"include_metadata":{"type":"boolean","title":"Include Metadata","description":"Include document metadata in response","default":true},"enable_reranking":{"type":"boolean","title":"Enable Reranking","description":"Enable result reranking","default":true},"document_ids":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Document Ids","description":"Filter by specific document IDs"}},"type":"object","required":["query"],"title":"QueryRequest","description":"Request model for RAG queries."},"app__api__rag_routes__QueryResponse":{"properties":{"query":{"type":"string","title":"Query","description":"Original query"},"answer":{"type":"string","title":"Answer","description":"Generated answer"},"sources":{"items":{"type":"object"},"type":"array","title":"Sources","description":"Source documents and chunks"},"confidence_score":{"type":"number","title":"Confidence Score","description":"Confidence score for the answer"},"processing_time":{"type":"number","title":"Processing Time","description":"Query processing time in seconds"},"retrieved_chunks":{"type":"integer","title":"Retrieved Chunks","description":"Number of chunks retrieved"}},"type":"object","required":["query","answer","sources","confidence_score","processing_time","retrieved_chunks"],"title":"QueryResponse","description":"Response model for RAG queries."},"app__api__rag_routes__SearchRequest":{"properties":{"query":{"type":"string","maxLength":1000,"minLength":1,"title":"Query","description":"Search query"},"search_type":{"type":"string","pattern":"^(semantic|hybrid|keyword)$","title":"Search Type","description":"Search type","default":"semantic"},"top_k":{"anyOf":[{"type":"integer","maximum":50.0,"minimum":1.0},{"type":"null"}],"title":"Top K","description":"Number of results to return","default":10},"similarity_threshold":{"anyOf":[{"type":"number","maximum":1.0,"minimum":0.0},{"type":"null"}],"title":"Similarity Threshold","description":"Similarity threshold","default":0.6},"document_ids":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Document Ids","description":"Filter by document IDs"},"include_content":{"type":"boolean","title":"Include Content","description":"Include chunk content in results","default":true},"workspace_id":{"type":"string","title":"Workspace Id","description":"Workspace ID for scoped search and related products"},"include_related_products":{"type":"boolean","title":"Include Related Products","description":"Include related products in results","default":true},"related_products_limit":{"type":"integer","maximum":10.0,"minimum":1.0,"title":"Related Products Limit","description":"Max related products per result","default":3},"use_search_prompts":{"type":"boolean","title":"Use Search Prompts","description":"Apply admin-configured search prompts","default":true},"custom_formatting_prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Custom Formatting Prompt","description":"Custom formatting prompt (overrides default)"},"material_filters":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Material Filters","description":"Material property filters for material search strategy"},"image_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Image Url","description":"Image URL for image similarity search strategy"},"image_base64":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Image Base64","description":"Base64-encoded image for image similarity search strategy"},"enable_mmr":{"type":"boolean","title":"Enable Mmr","description":"Enable MMR diversity re-ranking on results","default":false},"mmr_lambda":{"type":"number","maximum":1.0,"minimum":0.0,"title":"Mmr Lambda","description":"MMR relevance/diversity balance (1.0=pure relevance, 0.0=pure diversity)","default":0.7}},"type":"object","required":["query","workspace_id"],"title":"SearchRequest","description":"Request model for semantic search."},"app__api__rag_routes__SearchResponse":{"properties":{"query":{"type":"string","title":"Query","description":"Original search query"},"enhanced_query":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Enhanced Query","description":"Enhanced query (if prompts applied)"},"results":{"items":{"type":"object"},"type":"array","title":"Results","description":"Search results"},"total_results":{"type":"integer","title":"Total Results","description":"Total number of results"},"search_type":{"type":"string","title":"Search Type","description":"Type of search performed"},"processing_time":{"type":"number","title":"Processing Time","description":"Search processing time"},"search_metadata":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Search Metadata","description":"Search metadata (prompts applied, etc.)"}},"type":"object","required":["query","results","total_results","search_type","processing_time"],"title":"SearchResponse","description":"Response model for semantic search."},"app__schemas__images__ImageSearchRequest":{"properties":{"query_image_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Query Image Id","description":"Find images similar to this one"},"query_description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Query Description","description":"Find images matching this description"},"limit":{"type":"integer","maximum":50.0,"minimum":1.0,"title":"Limit","description":"Maximum number of results","default":10},"similarity_threshold":{"type":"number","maximum":1.0,"minimum":0.0,"title":"Similarity Threshold","description":"Minimum similarity score","default":0.7},"document_ids":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Document Ids","description":"Limit search to specific documents"},"image_types":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Image Types","description":"Filter by image types (diagram, photo, etc.)"},"tags":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Tags","description":"Filter by image tags"}},"type":"object","title":"ImageSearchRequest","description":"Request model for image similarity search.","example":{"image_types":["diagram","chart"],"limit":15,"query_description":"neural network diagram","similarity_threshold":0.8,"tags":["ai","machine learning"]}},"app__schemas__images__ImageSearchResponse":{"properties":{"success":{"type":"boolean","title":"Success","description":"Indicates if the request was successful","default":true},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message","description":"Optional message or description"},"timestamp":{"type":"string","title":"Timestamp","description":"Response timestamp"},"query_info":{"type":"object","title":"Query Info","description":"Information about the search query"},"similar_images":{"items":{"$ref":"#/components/schemas/SimilarImage"},"type":"array","title":"Similar Images","description":"Similar images found"},"total_found":{"type":"integer","title":"Total Found","description":"Total number of similar images"},"search_time_ms":{"type":"number","title":"Search Time Ms","description":"Search execution time"}},"type":"object","required":["query_info","similar_images","total_found","search_time_ms"],"title":"ImageSearchResponse","description":"Response model for image search.","example":{"query_info":{"query":"neural network diagram","type":"description"},"search_time_ms":245.7,"similar_images":[{"description":"Convolutional neural network architecture diagram","dimensions":{"height":600,"width":800},"document_id":"doc_123","document_name":"Deep Learning Paper","image_id":"img_789","page_number":5,"similarity_score":0.92,"tags":["cnn","architecture","diagram"]}],"success":true,"timestamp":"2024-07-26T18:00:00Z","total_found":8}},"app__schemas__search__ImageSearchRequest":{"properties":{"query":{"type":"string","maxLength":1000,"minLength":1,"title":"Query","description":"Image search query"},"document_ids":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Document Ids","description":"Limit search to specific documents"},"limit":{"type":"integer","maximum":50.0,"minimum":1.0,"title":"Limit","description":"Maximum number of results","default":10},"similarity_threshold":{"type":"number","maximum":1.0,"minimum":0.0,"title":"Similarity Threshold","description":"Minimum similarity score","default":0.6},"include_ocr_text":{"type":"boolean","title":"Include Ocr Text","description":"Include OCR-extracted text in search","default":true},"ocr_confidence_threshold":{"type":"number","maximum":1.0,"minimum":0.0,"title":"Ocr Confidence Threshold","description":"Minimum OCR confidence threshold","default":0.5},"visual_similarity_threshold":{"type":"number","maximum":1.0,"minimum":0.0,"title":"Visual Similarity Threshold","description":"Minimum visual similarity threshold","default":0.75},"search_type":{"type":"string","pattern":"^(visual_similarity|semantic_analysis|hybrid|material_properties)$","title":"Search Type","description":"Type of visual search","default":"visual_similarity"},"analysis_depth":{"type":"string","pattern":"^(basic|standard|detailed)$","title":"Analysis Depth","description":"Level of image analysis","default":"standard"},"include_visual_features":{"type":"boolean","title":"Include Visual Features","description":"Include visual feature analysis","default":true},"image_analysis_model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Image Analysis Model","description":"Specific image analysis model to use"},"material_filters":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Material Filters","description":"Material property filters"},"material_types":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Material Types","description":"Filter by specific material types"},"confidence_threshold":{"anyOf":[{"type":"number","maximum":1.0,"minimum":0.0},{"type":"null"}],"title":"Confidence Threshold","description":"Minimum material analysis confidence"},"spectral_filters":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Spectral Filters","description":"Spectral analysis filters"},"chemical_filters":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Chemical Filters","description":"Chemical composition filters"},"mechanical_filters":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Mechanical Filters","description":"Mechanical property filters"},"fusion_weights":{"anyOf":[{"additionalProperties":{"type":"number"},"type":"object"},{"type":"null"}],"title":"Fusion Weights","description":"Weights for combining different analysis types"},"enable_clip_embeddings":{"type":"boolean","title":"Enable Clip Embeddings","description":"Enable CLIP embedding generation for visual similarity","default":true},"enable_vision_analysis":{"type":"boolean","title":"Enable Vision Analysis","description":"Enable vision model analysis for material properties","default":false},"include_analytics":{"type":"boolean","title":"Include Analytics","description":"Include search analytics in response","default":false}},"type":"object","required":["query"],"title":"ImageSearchRequest","description":"Request model for image-based search with material-specific filtering."},"app__schemas__search__ImageSearchResponse":{"properties":{"success":{"type":"boolean","title":"Success","description":"Indicates if the request was successful","default":true},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message","description":"Optional message or description"},"timestamp":{"type":"string","title":"Timestamp","description":"Response timestamp"},"query":{"type":"string","title":"Query","description":"Original search query"},"results":{"items":{"$ref":"#/components/schemas/ImageSearchResult"},"type":"array","title":"Results","description":"Image search results"},"total_found":{"type":"integer","title":"Total Found","description":"Total number of matching images"},"search_time_ms":{"type":"number","title":"Search Time Ms","description":"Search execution time in milliseconds"},"analysis_depth":{"type":"string","title":"Analysis Depth","description":"Level of analysis performed"},"ocr_enabled":{"type":"boolean","title":"Ocr Enabled","description":"Whether OCR was enabled"}},"type":"object","required":["query","results","total_found","search_time_ms","analysis_depth","ocr_enabled"],"title":"ImageSearchResponse","description":"Response model for image search operations."},"app__schemas__search__QueryRequest":{"properties":{"question":{"type":"string","maxLength":2000,"minLength":1,"title":"Question","description":"Question to answer"},"context_documents":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Context Documents","description":"Specific documents to use as context"},"context_tags":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Context Tags","description":"Filter context by tags"},"max_context_chunks":{"type":"integer","maximum":20.0,"minimum":1.0,"title":"Max Context Chunks","description":"Maximum context chunks to retrieve","default":5},"temperature":{"type":"number","maximum":2.0,"minimum":0.0,"title":"Temperature","description":"Response creativity (0=focused, 2=creative)","default":0.7},"max_tokens":{"type":"integer","maximum":2000.0,"minimum":50.0,"title":"Max Tokens","description":"Maximum response length","default":500},"include_image_context":{"type":"boolean","title":"Include Image Context","description":"Include image analysis in context retrieval","default":false},"include_ocr_context":{"type":"boolean","title":"Include Ocr Context","description":"Include OCR-extracted text in context","default":true},"multimodal_llm_model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Multimodal Llm Model","description":"Specific multi-modal LLM model to use"},"image_analysis_depth":{"type":"string","pattern":"^(basic|standard|detailed)$","title":"Image Analysis Depth","description":"Level of image analysis","default":"standard"},"include_sources":{"type":"boolean","title":"Include Sources","description":"Include source citations in response","default":true},"include_confidence":{"type":"boolean","title":"Include Confidence","description":"Include confidence score","default":true},"include_image_references":{"type":"boolean","title":"Include Image References","description":"Include image references in response","default":false},"response_format":{"type":"string","pattern":"^(text|markdown|json)$","title":"Response Format","description":"Response format","default":"markdown"}},"type":"object","required":["question"],"title":"QueryRequest","description":"Request model for RAG-based question answering."},"app__schemas__search__QueryResponse":{"properties":{"success":{"type":"boolean","title":"Success","description":"Indicates if the request was successful","default":true},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message","description":"Optional message or description"},"timestamp":{"type":"string","title":"Timestamp","description":"Response timestamp"},"question":{"type":"string","title":"Question","description":"Original question"},"answer":{"type":"string","title":"Answer","description":"Generated answer"},"confidence_score":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Confidence Score","description":"Answer confidence (0-1)"},"completeness_score":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Completeness Score","description":"Answer completeness (0-1)"},"multimodal_confidence":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Multimodal Confidence","description":"Multi-modal analysis confidence (0-1)"},"sources":{"items":{"$ref":"#/components/schemas/SourceCitation"},"type":"array","title":"Sources","description":"Source citations"},"context_used":{"type":"integer","title":"Context Used","description":"Number of context chunks used"},"image_context_used":{"type":"integer","title":"Image Context Used","description":"Number of image contexts used","default":0},"image_references":{"items":{"type":"object"},"type":"array","title":"Image References","description":"Referenced images in response"},"multimodal_analysis":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Multimodal Analysis","description":"Multi-modal analysis results"},"processing_time_ms":{"type":"number","title":"Processing Time Ms","description":"Query processing time"},"model_used":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model Used","description":"AI model used for generation"},"multimodal_model_used":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Multimodal Model Used","description":"Multi-modal model used for analysis"}},"type":"object","required":["question","answer","context_used","processing_time_ms"],"title":"QueryResponse","description":"Response model for RAG-based queries.","example":{"answer":"Transformer architectures offer several key benefits:\n\n1. **Parallel Processing**: Unlike RNNs...","completeness_score":0.88,"confidence_score":0.92,"context_used":5,"processing_time_ms":1250.5,"question":"What are the main benefits of transformer architectures?","sources":[{"chunk_id":"chunk_456","document_id":"doc_123","document_name":"Attention Is All You Need","excerpt":"The Transformer allows for significantly more parallelization...","page_number":3,"relevance_score":0.95}],"success":true,"timestamp":"2024-07-26T18:00:00Z"}},"app__schemas__search__SearchRequest":{"properties":{"query":{"type":"string","maxLength":1000,"minLength":1,"title":"Query","description":"Search query"},"document_ids":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Document Ids","description":"Limit search to specific documents"},"tags":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Tags","description":"Filter by document tags"},"limit":{"type":"integer","maximum":100.0,"minimum":1.0,"title":"Limit","description":"Maximum number of results","default":10},"similarity_threshold":{"type":"number","maximum":1.0,"minimum":0.0,"title":"Similarity Threshold","description":"Minimum similarity score","default":0.7},"search_type":{"type":"string","pattern":"^(semantic|keyword|hybrid|multimodal)$","title":"Search Type","description":"Type of search","default":"hybrid"},"include_images":{"type":"boolean","title":"Include Images","description":"Include image analysis in search results","default":false},"include_ocr_text":{"type":"boolean","title":"Include Ocr Text","description":"Include OCR-extracted text in search","default":true},"content_types":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Content Types","description":"Filter by content types (text, image, mixed)"},"ocr_confidence_threshold":{"type":"number","maximum":1.0,"minimum":0.0,"title":"Ocr Confidence Threshold","description":"Minimum OCR confidence threshold","default":0.5},"date_from":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Date From","description":"Filter documents from date (ISO format)"},"date_to":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Date To","description":"Filter documents to date (ISO format)"}},"type":"object","required":["query"],"title":"SearchRequest","description":"Request model for document search."},"app__schemas__search__SearchResponse":{"properties":{"success":{"type":"boolean","title":"Success","description":"Indicates if the request was successful","default":true},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message","description":"Optional message or description"},"timestamp":{"type":"string","title":"Timestamp","description":"Response timestamp"},"query":{"type":"string","title":"Query","description":"Original search query"},"results":{"items":{"$ref":"#/components/schemas/SearchResult"},"type":"array","title":"Results","description":"Search results"},"total_found":{"type":"integer","title":"Total Found","description":"Total number of matching results"},"search_time_ms":{"type":"number","title":"Search Time Ms","description":"Search execution time in milliseconds"},"search_type":{"type":"string","title":"Search Type","description":"Type of search performed"},"filters_applied":{"type":"object","title":"Filters Applied","description":"Applied filters"}},"type":"object","required":["query","results","total_found","search_time_ms","search_type"],"title":"SearchResponse","description":"Response model for search operations."}},"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"JWT Bearer token authentication. All endpoints require a valid JWT token."}}},"tags":[{"name":"RAG","description":"Retrieval-Augmented Generation - Document upload (quick/standard/deep modes), 6-strategy search, prompt enhancement, job management, chunk/image/product/embedding/relevancy listing, workspace stats, and AI tracking."},{"name":"Documents","description":"Document lifecycle management - Job status polling, checkpoint inspection, restart/resume, content retrieval, and AI tracking per stage/model."},{"name":"Search","description":"Multi-strategy search - Strategies: semantic, vector, multi_vector (recommended), hybrid, material, image. 85-95% accuracy, <200ms latency."},{"name":"Search Suggestions","description":"Search UX helpers - Auto-complete, trending searches, typo correction, query expansion, popular searches, and personalized suggestions."},{"name":"Embeddings","description":"Multi-vector embedding generation - 7 types: text (1024D Voyage AI), visual (768D SLIG), understanding (1024D), color/texture/style/material (768D each)."},{"name":"Chat","description":"AI chat interface - Contextual completions, conversation history, and intelligent material assistance."},{"name":"Products","description":"Product management - Two-stage AI classification (Claude Haiku 4.5 + Sonnet 4.5), enrichment, metadata extraction, and product creation from chunks."},{"name":"Image Analysis","description":"Image processing - Extraction, analysis, embedding generation, OCR, reclassification, and segmentation for material images."},{"name":"Knowledge Base","description":"Documentation system - CRUD documents with AI embeddings (1024D Voyage AI), semantic search, category hierarchy, product attachments, version history, and comments."},{"name":"Saved Searches","description":"Saved search management - Create, list, execute, and delete saved searches with AI-powered deduplication."},{"name":"Duplicate Detection","description":"Product duplicate detection - Single and batch detection, merge/undo operations, status tracking, and merge history (same-factory scope)."},{"name":"Anthropic Claude","description":"Claude integration - Image validation and product enrichment using Claude Haiku 4.5 (fast) and Sonnet 4.5 (deep)."},{"name":"Interior Design","description":"Interior design generation - AI-powered room renders with streaming progress feedback."},{"name":"Price Monitoring","description":"Competitor price tracking - On-demand and scheduled monitoring via Firecrawl. Price history, alerts (drop/increase/change), statistics, source management. 1 credit/scrape."},{"name":"Data Import","description":"Batch data import - XML and web-scraping sources with job tracking, processing history, and health checks."},{"name":"Web Scraping","description":"Web scraping sessions - Firecrawl-powered session management for product catalog ingestion."},{"name":"Category Prototypes","description":"Category prototype management - CRUD prototypes for material validation, population from existing data, and schema verification."},{"name":"Document Entities","description":"Entity extraction - List, search, and manage entities extracted from documents with relationship mapping."},{"name":"Background Agents","description":"Long-running AI task delegation - Agent catalog, run status, and task management for background processing."},{"name":"User Feedback","description":"User feedback system - Submit feedback with AI-powered sentiment analysis (aspect-based), trend tracking, and analytics."},{"name":"Segmentation","description":"SAM mask generation - Segment Anything Model for material region detection and inpainting masks."},{"name":"Health & Monitoring","description":"System health - Basic and detailed health checks, database pool status, job monitor, query metrics, circuit breakers, and PDF processor health."},{"name":"Monitoring","description":"Performance monitoring - Metrics dashboard, storage estimates, and PDF processing health."},{"name":"Job Health","description":"Job health monitoring - Dashboard overview, stuck job detection, per-job diagnostics with heartbeat tracking."},{"name":"AI Metrics","description":"AI usage analytics - Token consumption, cost tracking, and per-job AI metrics across all models."},{"name":"AI Services","description":"AI service endpoints - Document classification, boundary detection, product grouping/validation, consensus validation, escalation stats, and service health."},{"name":"Admin","description":"Admin operations - System management, job control, data cleanup/backup/export, package status, and restart protection."},{"name":"Admin - Prompts","description":"Prompt management - CRUD extraction prompts, version history, and prompt testing for AI pipeline stages."},{"name":"Admin - Config","description":"Extraction configuration - Manage field extraction configs per document category."},{"name":"Admin - Prompt Templates","description":"Prompt templates - Customizable AI prompt templates for different industries and use cases."},{"name":"Admin - Linking","description":"Entity linking - Manual chunk-product relationship management for debugging and quality assurance."},{"name":"Chunk Quality","description":"Chunk quality metrics - Quality dashboard, flagged content review, and content quality scoring."},{"name":"Logs","description":"System logs - Fetch, filter, clear application logs. Frontend error reporting endpoint."},{"name":"WebSocket","description":"Real-time updates - WebSocket endpoint for job progress streaming and system health notifications."},{"name":"Internal Pipeline","description":"Internal modular endpoints for the 14-stage PDF processing pipeline. Not for external consumption."}],"security":[{"BearerAuth":[]}]}