Coverage for src / qdrant_loader / config.py: 100%

30 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-04-10 09:40 +0000

1"""Configuration management for the application.""" 

2 

3from pydantic import BaseModel, Field 

4 

5 

6class SemanticAnalysisConfig(BaseModel): 

7 """Configuration for semantic analysis.""" 

8 

9 num_topics: int = Field( 

10 default=3, description="Number of topics to extract using LDA" 

11 ) 

12 

13 lda_passes: int = Field(default=10, description="Number of passes for LDA training") 

14 

15 spacy_model: str = Field( 

16 default="en_core_web_md", 

17 description="spaCy model to use for text processing. Options: en_core_web_sm (15MB, no vectors), en_core_web_md (50MB, 20k vectors), en_core_web_lg (750MB, 514k vectors)", 

18 ) 

19 

20 

21class ChunkingConfig(BaseModel): 

22 """Configuration for document chunking.""" 

23 

24 chunk_size: int = Field( 

25 default=1500, description="Maximum size of each chunk in characters" 

26 ) 

27 

28 chunk_overlap: int = Field( 

29 default=200, description="Number of characters to overlap between chunks" 

30 ) 

31 

32 enable_semantic_analysis: bool = Field( 

33 default=True, 

34 description="Enable semantic analysis (NLP entities, topics, key phrases). " 

35 "Disable for faster ingestion when semantic enrichment is not needed.", 

36 ) 

37 

38 enable_enhanced_semantic_analysis: bool = Field( 

39 default=False, 

40 description="Enable advanced NLP fields: pos_tags, dependencies,document_similarity." 

41 "Requires enable_semantic_analysis=true. " 

42 "Increases payload size and ingestion time.", 

43 ) 

44 

45 

46class GlobalConfig(BaseModel): 

47 """Global configuration settings.""" 

48 

49 chunking: ChunkingConfig = Field( 

50 default_factory=ChunkingConfig, description="Chunking configuration" 

51 ) 

52 

53 semantic_analysis: SemanticAnalysisConfig = Field( 

54 default_factory=SemanticAnalysisConfig, 

55 description="Semantic analysis configuration", 

56 ) 

57 

58 

59class Settings(BaseModel): 

60 """Application settings.""" 

61 

62 # Qdrant configuration 

63 QDRANT_URL: str 

64 QDRANT_API_KEY: str 

65 QDRANT_COLLECTION_NAME: str 

66 

67 # OpenAI configuration 

68 OPENAI_API_KEY: str 

69 

70 # State management 

71 STATE_DB_PATH: str 

72 

73 # Git repository configuration 

74 REPO_TOKEN: str 

75 REPO_URL: str 

76 

77 # Confluence configuration 

78 CONFLUENCE_URL: str 

79 CONFLUENCE_SPACE_KEY: str 

80 CONFLUENCE_TOKEN: str 

81 CONFLUENCE_EMAIL: str 

82 

83 # Jira configuration 

84 JIRA_URL: str 

85 JIRA_PROJECT_KEY: str 

86 JIRA_TOKEN: str 

87 JIRA_EMAIL: str 

88 

89 # Global configuration 

90 global_config: GlobalConfig = Field( 

91 default_factory=GlobalConfig, description="Global configuration settings" 

92 )