Coverage for /home/admin/Documents/AI/applications/lexigram-dev/lexigram/experimental/ai/lexigram-ai-rag/src/lexigram/ai/rag/exceptions.py: 100%

20 statements  

« prev     ^ index     » next       coverage.py v7.15.4, created at 2026-08-25 07:19 +0800

1"""Exceptions for the RAG package.""" 

2 

3from __future__ import annotations 

4 

5from lexigram.contracts.ai.exceptions import RAGError as _ContractsRAGError 

6from lexigram.contracts.ai.rag import ChunkingError, RetrievalError, SynthesisError 

7 

8 

9class RAGError(_ContractsRAGError): 

10 """Base exception for RAG errors.""" 

11 

12 _code: str = "LEX_ERR_RAG_005" 

13 

14 

15class PreprocessingError(RAGError): 

16 """Raised when document preprocessing fails.""" 

17 

18 _code: str = "LEX_ERR_RAG_006" 

19 

20 

21class MultimodalError(RAGError): 

22 """Base exception for multimodal processing errors.""" 

23 

24 _code: str = "LEX_ERR_RAG_010" 

25 

26 

27class AudioLoaderError(MultimodalError): 

28 """Raised when audio loading fails.""" 

29 

30 _code: str = "LEX_ERR_RAG_011" 

31 

32 

33class VideoLoaderError(MultimodalError): 

34 """Raised when video loading fails.""" 

35 

36 _code: str = "LEX_ERR_RAG_012" 

37 

38 

39class ImageLoaderError(MultimodalError): 

40 """Raised when image loading fails.""" 

41 

42 _code: str = "LEX_ERR_RAG_013" 

43 

44 

45class CLIPEmbeddingError(MultimodalError): 

46 """Raised when CLIP embedding computation fails.""" 

47 

48 _code: str = "LEX_ERR_RAG_014" 

49 

50 

51class MissingCitationsError(RAGError): 

52 """Raised when a pipeline with ``require_citations=True`` produces no citations.""" 

53 

54 _code: str = "LEX_ERR_RAG_015" 

55 

56 

57__all__ = [ 

58 "AudioLoaderError", 

59 "CLIPEmbeddingError", 

60 "ChunkingError", 

61 "ImageLoaderError", 

62 "MissingCitationsError", 

63 "MultimodalError", 

64 "PreprocessingError", 

65 "RAGError", 

66 "RetrievalError", 

67 "SynthesisError", 

68 "VideoLoaderError", 

69]