iris-vector-rag 0.2.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. adapters/rag_templates_bridge.py +578 -0
  2. common/__init__.py +1 -0
  3. common/batch_utils.py +294 -0
  4. common/config.py +58 -0
  5. common/connection_manager.py +242 -0
  6. common/connection_pool.py +445 -0
  7. common/database.py +141 -0
  8. common/database_schema_manager.py +289 -0
  9. common/db_init_with_indexes.py +181 -0
  10. common/db_vector_utils.py +181 -0
  11. common/environment_manager.py +220 -0
  12. common/huggingface_utils.py +206 -0
  13. common/iris_client.py +92 -0
  14. common/iris_connection_manager.py +411 -0
  15. common/iris_connection_pool.py +360 -0
  16. common/iris_connector.py +71 -0
  17. common/iris_dbapi_connector.py +323 -0
  18. common/iris_index_utils.py +195 -0
  19. common/iris_sql_utils.py +704 -0
  20. common/iris_stream_reader.py +166 -0
  21. common/llm_cache_config.py +308 -0
  22. common/llm_cache_iris.py +671 -0
  23. common/llm_cache_manager.py +911 -0
  24. common/utils.py +559 -0
  25. common/vector_sql_utils.py +584 -0
  26. evaluation_framework/__init__.py +66 -0
  27. evaluation_framework/biomedical_question_generator.py +826 -0
  28. evaluation_framework/comparative_analysis_system.py +1173 -0
  29. evaluation_framework/empirical_reporting.py +1298 -0
  30. evaluation_framework/evaluation_orchestrator.py +1123 -0
  31. evaluation_framework/execute_production_evaluation.py +382 -0
  32. evaluation_framework/pmc_data_pipeline.py +1332 -0
  33. evaluation_framework/production_evaluation_config.py +353 -0
  34. evaluation_framework/ragas_metrics_framework.py +1013 -0
  35. evaluation_framework/real_production_evaluation.py +544 -0
  36. evaluation_framework/run_10k_evaluation.py +175 -0
  37. evaluation_framework/simple_test.py +364 -0
  38. evaluation_framework/statistical_evaluation_methodology.py +1016 -0
  39. evaluation_framework/test_framework.py +281 -0
  40. evaluation_framework/test_iris_connectivity.py +244 -0
  41. evaluation_framework/test_small_scale_evaluation.py +432 -0
  42. evaluation_framework/true_e2e_evaluation.py +639 -0
  43. evaluation_framework/visualization_engine.py +585 -0
  44. iris_rag/__init__.py +284 -0
  45. iris_rag/config/default_config.yaml +295 -0
  46. iris_vector_rag-0.2.1.dist-info/METADATA +499 -0
  47. iris_vector_rag-0.2.1.dist-info/RECORD +50 -0
  48. iris_vector_rag-0.2.1.dist-info/WHEEL +5 -0
  49. iris_vector_rag-0.2.1.dist-info/entry_points.txt +2 -0
  50. iris_vector_rag-0.2.1.dist-info/top_level.txt +4 -0
iris_rag/__init__.py ADDED
@@ -0,0 +1,284 @@
1
+ # iris_rag package
2
+ # This file makes the iris_rag directory a Python package.
3
+
4
+ from typing import Any, Callable, Dict, List, Optional
5
+
6
+ from common.utils import get_llm_func # Import get_llm_func
7
+
8
+ from .config.manager import ConfigurationManager
9
+ from .core.base import RAGPipeline
10
+ from .core.connection import ConnectionManager
11
+ from .pipelines.basic import BasicRAGPipeline
12
+ from .pipelines.crag import CRAGPipeline
13
+
14
+ # Import validation components
15
+ from .validation.factory import ValidatedPipelineFactory, create_validated_pipeline
16
+ from .validation.orchestrator import SetupOrchestrator
17
+ from .validation.requirements import get_pipeline_requirements
18
+ from .validation.validator import PreConditionValidator
19
+
20
+ # Package version
21
+ __version__ = "0.2.1"
22
+ __author__ = "InterSystems IRIS RAG Templates Project"
23
+ __description__ = "A comprehensive, production-ready framework for implementing Retrieval Augmented Generation (RAG) pipelines using InterSystems IRIS as the vector database backend."
24
+
25
+
26
+ def create_pipeline(
27
+ pipeline_type: str,
28
+ config_path: Optional[str] = None,
29
+ llm_func: Optional[Callable[[str], str]] = None,
30
+ embedding_func: Optional[Callable[[List[str]], List[List[float]]]] = None,
31
+ external_connection=None,
32
+ validate_requirements: bool = True,
33
+ auto_setup: bool = False,
34
+ **kwargs,
35
+ ) -> RAGPipeline:
36
+ """
37
+ Factory function to create RAG pipeline instances with validation.
38
+
39
+ Args:
40
+ pipeline_type: The type of pipeline to create. Available types:
41
+ - "basic": Basic RAG with vector similarity search
42
+ - "basic_rerank": Basic RAG with reranking
43
+ - "crag": Corrective RAG with retrieval evaluation
44
+ - "graphrag": Graph-based RAG with entity relationships
45
+ - "pylate_colbert": ColBERT-based dense retrieval
46
+ - "multi_query_rrf": Multi-query retrieval with RRF fusion
47
+ config_path: Optional path to configuration file.
48
+ llm_func: Optional LLM function for answer generation.
49
+ embedding_func: Optional embedding function for vector generation.
50
+ external_connection: Optional existing database connection to use.
51
+ validate_requirements: Whether to validate pipeline requirements before creation.
52
+ auto_setup: Whether to automatically set up missing requirements.
53
+ **kwargs: Additional configuration parameters.
54
+
55
+ Returns:
56
+ An instance of a RAGPipeline.
57
+
58
+ Raises:
59
+ ValueError: If the pipeline_type is unknown.
60
+ PipelineValidationError: If validation fails and auto_setup is False.
61
+ """
62
+ # Initialize configuration manager
63
+ config_manager = ConfigurationManager(config_path)
64
+
65
+ # Initialize connection manager
66
+ if external_connection:
67
+ # Create a wrapper connection manager that uses the external connection
68
+ connection_manager = ExternalConnectionWrapper(
69
+ external_connection, config_manager
70
+ )
71
+ else:
72
+ connection_manager = ConnectionManager(config_manager)
73
+
74
+ # Use validated factory if validation is requested
75
+ if validate_requirements:
76
+ factory = ValidatedPipelineFactory(connection_manager, config_manager)
77
+ return factory.create_pipeline(
78
+ pipeline_type=pipeline_type,
79
+ llm_func=llm_func,
80
+ auto_setup=auto_setup,
81
+ validate_requirements=True,
82
+ **kwargs,
83
+ )
84
+
85
+ # Legacy creation without validation
86
+ # Pass embedding_func through kwargs for pipelines that need it
87
+ if embedding_func:
88
+ kwargs["embedding_func"] = embedding_func
89
+
90
+ # If no llm_func is provided, get one using the utility function
91
+ effective_llm_func = llm_func
92
+ if effective_llm_func is None:
93
+ # Use 'stub' provider for testing if not specified otherwise in config or kwargs
94
+ llm_provider = config_manager.get("llm.provider", "stub")
95
+ llm_model_name = config_manager.get("llm.model_name", "stub-model")
96
+ effective_llm_func = get_llm_func(
97
+ provider=llm_provider, model_name=llm_model_name, **kwargs
98
+ )
99
+
100
+ return _create_pipeline_legacy(
101
+ pipeline_type, connection_manager, config_manager, effective_llm_func, **kwargs
102
+ )
103
+
104
+
105
+ def _create_pipeline_legacy(
106
+ pipeline_type: str,
107
+ connection_manager: ConnectionManager,
108
+ config_manager: ConfigurationManager,
109
+ llm_func: Optional[Callable[[str], str]],
110
+ **kwargs,
111
+ ) -> RAGPipeline:
112
+ """Legacy pipeline creation without validation."""
113
+ if pipeline_type == "basic":
114
+ return BasicRAGPipeline(
115
+ connection_manager=connection_manager,
116
+ config_manager=config_manager,
117
+ llm_func=llm_func,
118
+ )
119
+ elif pipeline_type == "basic_rerank":
120
+ from .pipelines.basic_rerank import BasicRAGRerankingPipeline
121
+
122
+ return BasicRAGRerankingPipeline(
123
+ connection_manager=connection_manager,
124
+ config_manager=config_manager,
125
+ llm_func=llm_func,
126
+ )
127
+ elif pipeline_type == "crag":
128
+ # Extract embedding_func from kwargs if provided
129
+ embedding_func = kwargs.get("embedding_func")
130
+ return CRAGPipeline(
131
+ connection_manager=connection_manager,
132
+ config_manager=config_manager,
133
+ embedding_func=embedding_func,
134
+ llm_func=llm_func,
135
+ )
136
+ elif pipeline_type == "graphrag":
137
+ from .pipelines.hybrid_graphrag import HybridGraphRAGPipeline
138
+
139
+ return HybridGraphRAGPipeline(
140
+ connection_manager=connection_manager,
141
+ config_manager=config_manager,
142
+ llm_func=llm_func,
143
+ )
144
+ elif pipeline_type == "pylate_colbert":
145
+ from .pipelines.colbert_pylate.pylate_pipeline import PyLateColBERTPipeline
146
+
147
+ return PyLateColBERTPipeline(
148
+ connection_manager=connection_manager,
149
+ config_manager=config_manager,
150
+ llm_func=llm_func,
151
+ )
152
+ elif pipeline_type == "multi_query_rrf":
153
+ from .pipelines.multi_query_rrf import MultiQueryRRFPipeline
154
+
155
+ return MultiQueryRRFPipeline(
156
+ num_queries=kwargs.get("num_queries", 4),
157
+ retrieved_k=kwargs.get("retrieved_k", 20),
158
+ rrf_k=kwargs.get("rrf_k", 60),
159
+ use_llm_expansion=kwargs.get("use_llm_expansion", False),
160
+ llm_model=kwargs.get("llm_model", "gpt-4o-mini"),
161
+ )
162
+ else:
163
+ available_types = [
164
+ "basic",
165
+ "basic_rerank",
166
+ "crag",
167
+ "graphrag",
168
+ "pylate_colbert",
169
+ "multi_query_rrf",
170
+ ]
171
+ raise ValueError(
172
+ f"Unknown pipeline type: {pipeline_type}. Available: {available_types}"
173
+ )
174
+
175
+
176
+ def validate_pipeline(
177
+ pipeline_type: str, config_path: Optional[str] = None, external_connection=None
178
+ ) -> Dict[str, Any]:
179
+ """
180
+ Validate pipeline requirements without creating an instance.
181
+
182
+ Args:
183
+ pipeline_type: Type of pipeline to validate
184
+ config_path: Optional path to configuration file
185
+ external_connection: Optional existing database connection
186
+
187
+ Returns:
188
+ Validation results dictionary
189
+ """
190
+ config_manager = ConfigurationManager(config_path)
191
+
192
+ if external_connection:
193
+ connection_manager = ExternalConnectionWrapper(
194
+ external_connection, config_manager
195
+ )
196
+ else:
197
+ connection_manager = ConnectionManager(config_manager)
198
+
199
+ factory = ValidatedPipelineFactory(connection_manager, config_manager)
200
+ return factory.validate_pipeline_type(pipeline_type)
201
+
202
+
203
+ def setup_pipeline(
204
+ pipeline_type: str, config_path: Optional[str] = None, external_connection=None
205
+ ) -> Dict[str, Any]:
206
+ """
207
+ Set up all requirements for a pipeline type.
208
+
209
+ Args:
210
+ pipeline_type: Type of pipeline to set up
211
+ config_path: Optional path to configuration file
212
+ external_connection: Optional existing database connection
213
+
214
+ Returns:
215
+ Setup results dictionary
216
+ """
217
+ config_manager = ConfigurationManager(config_path)
218
+
219
+ if external_connection:
220
+ connection_manager = ExternalConnectionWrapper(
221
+ external_connection, config_manager
222
+ )
223
+ else:
224
+ connection_manager = ConnectionManager(config_manager)
225
+
226
+ factory = ValidatedPipelineFactory(connection_manager, config_manager)
227
+ return factory.setup_pipeline_requirements(pipeline_type)
228
+
229
+
230
+ def get_pipeline_status(
231
+ pipeline_type: str, config_path: Optional[str] = None, external_connection=None
232
+ ) -> Dict[str, Any]:
233
+ """
234
+ Get detailed status information for a pipeline type.
235
+
236
+ Args:
237
+ pipeline_type: Type of pipeline to check
238
+ config_path: Optional path to configuration file
239
+ external_connection: Optional existing database connection
240
+
241
+ Returns:
242
+ Detailed status information
243
+ """
244
+ config_manager = ConfigurationManager(config_path)
245
+
246
+ if external_connection:
247
+ connection_manager = ExternalConnectionWrapper(
248
+ external_connection, config_manager
249
+ )
250
+ else:
251
+ connection_manager = ConnectionManager(config_manager)
252
+
253
+ factory = ValidatedPipelineFactory(connection_manager, config_manager)
254
+ return factory.get_pipeline_status(pipeline_type)
255
+
256
+
257
+ class ExternalConnectionWrapper:
258
+ """Wrapper to make external connections work with iris_rag ConnectionManager interface."""
259
+
260
+ def __init__(self, external_connection, config_manager):
261
+ self.external_connection = external_connection
262
+ self.config_manager = config_manager
263
+
264
+ def get_connection(self, backend_name: str = "iris"):
265
+ """Return the external connection for any backend."""
266
+ return self.external_connection
267
+
268
+
269
+ __all__ = [
270
+ "create_pipeline",
271
+ "validate_pipeline",
272
+ "setup_pipeline",
273
+ "get_pipeline_status",
274
+ "create_validated_pipeline",
275
+ "RAGPipeline",
276
+ "ConnectionManager",
277
+ "ConfigurationManager",
278
+ "BasicRAGPipeline",
279
+ "CRAGPipeline",
280
+ "ValidatedPipelineFactory",
281
+ "PreConditionValidator",
282
+ "SetupOrchestrator",
283
+ "get_pipeline_requirements",
284
+ ]
@@ -0,0 +1,295 @@
1
+ # Default configuration for iris_rag package
2
+ database:
3
+ iris:
4
+ driver: "intersystems_iris.dbapi._DBAPI"
5
+ host: "localhost"
6
+ port: "1974"
7
+ namespace: "USER"
8
+ username: "_SYSTEM"
9
+ password: "SYS"
10
+
11
+ storage:
12
+ iris:
13
+ table_name: "RAG.SourceDocuments"
14
+ vector_dimension: 384
15
+
16
+ # Vector index configuration for optimal HNSW performance
17
+ vector_index:
18
+ type: "HNSW" # Index type: HNSW for high-performance vector search
19
+ M: 16 # Number of bi-directional links for each node (higher = better recall, more memory)
20
+ efConstruction: 200 # Size of dynamic candidate list (higher = better quality, slower build)
21
+ Distance: "COSINE" # Distance metric: COSINE, EUCLIDEAN, or DOT
22
+
23
+ pipelines:
24
+ basic:
25
+ chunk_size: 1000
26
+ chunk_overlap: 200
27
+ default_top_k: 5
28
+ embedding_batch_size: 32
29
+ vector_query_mode: "safe_single_param"
30
+ vector_hnsw:
31
+ ensure_on_start: true
32
+ try_acorn: true
33
+
34
+ # Pipeline validation configuration (Feature 047)
35
+ validation:
36
+ enabled: true # Enable pipeline contract validation
37
+ strict_mode: false # If true, treat warnings as errors
38
+ validate_on_register: true # Validate pipelines when registering handlers
39
+ validate_on_query: false # Validate responses after each query (performance impact)
40
+ log_violations: true # Log contract violations
41
+ raise_on_error: true # Raise exceptions for validation errors
42
+
43
+ # Contract requirements (should match PipelineValidator)
44
+ contract:
45
+ required_methods: ["query", "load_documents"]
46
+ required_response_fields:
47
+ - "answer"
48
+ - "retrieved_documents"
49
+ - "contexts"
50
+ - "sources"
51
+ - "execution_time"
52
+ - "metadata"
53
+ required_metadata_fields:
54
+ - "num_retrieved"
55
+ - "pipeline_type"
56
+ - "generated_answer"
57
+ - "processing_time"
58
+ - "retrieval_method"
59
+ - "context_count"
60
+
61
+ embeddings:
62
+ default_provider: "sentence_transformers"
63
+ sentence_transformers:
64
+ model_name: "all-MiniLM-L6-v2"
65
+ device: "cpu"
66
+
67
+ # Entity extraction configuration
68
+ entity_extraction:
69
+ enabled: true
70
+ method: "llm_basic" # ontology_hybrid, llm_basic, pattern_only, hybrid
71
+ confidence_threshold: 0.7 # Minimum confidence score for entities
72
+ entity_types: # Enabled entity types (matches pattern definitions)
73
+ - "DRUG"
74
+ - "DISEASE"
75
+ - "GENE"
76
+ - "ANATOMY"
77
+ - "PROCEDURE"
78
+ - "SYMPTOM"
79
+ - "TREATMENT"
80
+ - "PERSON"
81
+ - "ORGANIZATION"
82
+ llm:
83
+ model: "openai/gpt-oss-120b" # LLM model: GPT-OSS 120B (OpenAI-compatible)
84
+ api_base: "http://apps-llm-4.iscinternal.com:8000/v1" # GPT-OSS endpoint
85
+ api_key: "dummy" # API key (not required for internal endpoints)
86
+ api_type: "openai" # OpenAI-compatible API
87
+ temperature: 0.1 # Low temperature for consistent extraction
88
+ max_tokens: 2000 # Max tokens for LLM response
89
+ supports_response_format: false # GPT-OSS doesn't support JSON mode
90
+ use_json_mode: false # Disable JSON mode
91
+ batch_processing:
92
+ enabled: false # DISABLED: GPT-OSS doesn't support JSON mode
93
+ storage:
94
+ entities_table: "RAG.Entities" # Database table for entities
95
+ relationships_table: "RAG.EntityRelationships" # Table for relationships
96
+ embeddings_table: "RAG.EntityEmbeddings" # Table for entity embeddings
97
+
98
+ # General-purpose ontology configuration for ANY domain
99
+ ontology:
100
+ enabled: false # Enable/disable ontology support
101
+ type: "general" # Single general-purpose type (replaces domain-specific plugins)
102
+ auto_detect_domain: true # Auto-detect domain from ontology metadata
103
+
104
+ # Ontology data sources - works with ANY valid ontology
105
+ sources:
106
+ - type: "owl" # Ontology format: owl, rdf, skos, xml, ttl, n3
107
+ path: "path/to/any/ontology.owl" # Path to ontology file (ANY domain)
108
+ # Optional: override auto-detection
109
+ # domain: "custom_domain_name"
110
+
111
+ # Examples for different domains:
112
+ # - type: "owl"
113
+ # path: "ontologies/medical/umls.owl" # Medical domain
114
+ # - type: "skos"
115
+ # path: "ontologies/legal/legal_terms.skos" # Legal domain
116
+ # - type: "rdf"
117
+ # path: "ontologies/financial/fibo.rdf" # Financial domain
118
+ # - type: "owl"
119
+ # path: "ontologies/scientific/research.owl" # Scientific domain
120
+
121
+ # Custom domain definitions (optional)
122
+ custom_domains:
123
+ enabled: false # Enable custom domain definitions
124
+ definition_path: null # Path to JSON file with domain configuration
125
+ # Example JSON structure:
126
+ # {
127
+ # "domain_name": "biomedical",
128
+ # "description": "Biomedical research domain",
129
+ # "entity_types": {
130
+ # "PROTEIN": ["protein", "enzyme", "antibody"],
131
+ # "GENE": ["gene", "allele", "locus"]
132
+ # },
133
+ # "extraction_patterns": {
134
+ # "PROTEIN": ["\\b[A-Z][a-z]+\\d+\\b"]
135
+ # },
136
+ # "synonyms": {
137
+ # "protein": ["enzyme", "polypeptide"]
138
+ # }
139
+ # }
140
+
141
+ # Reasoning engine configuration
142
+ reasoning:
143
+ enable_inference: true # Enable ontology-based reasoning
144
+ max_inference_depth: 3 # Maximum depth for concept traversal
145
+ confidence_threshold: 0.6 # Minimum confidence for inferred relationships
146
+ reasoning_strategies: # Active reasoning strategies
147
+ - "subsumption" # Hierarchical concept reasoning
148
+ - "property_based" # Property-based inference
149
+ - "rule_based" # Custom rule application
150
+
151
+ # Entity mapping configuration
152
+ entity_mapping:
153
+ auto_map: true # Automatically map concepts to entity types
154
+ auto_domain_detection: true # Auto-detect relevant domains from text
155
+ expansion_strategy: "synonyms" # Query expansion: synonyms, hierarchical, semantic
156
+ # Note: custom_mappings are now auto-generated from loaded ontologies
157
+
158
+ # Performance and optimization settings
159
+ performance:
160
+ max_concepts_per_domain: 10000 # Limit concepts loaded per domain
161
+ cache_ontology_queries: true # Cache frequently used ontology queries
162
+ lazy_load_concepts: true # Load concepts on-demand
163
+ concept_similarity_threshold: 0.8 # Minimum similarity for concept matching
164
+
165
+ # GraphRAG pipeline configuration with general ontology support
166
+ graphrag:
167
+ enabled: true # Enable GraphRAG pipeline
168
+ default_top_k: 10 # Default number of results to return
169
+ max_depth: 2 # Maximum graph traversal depth
170
+ max_entities: 50 # Maximum entities per traversal
171
+ enable_vector_fallback: false # Fallback to vector search if graph fails
172
+
173
+ # IRIS Graph Core Hybrid Search Configuration
174
+ iris_graph_core:
175
+ enabled: true # Enable iris_graph_core hybrid search capabilities
176
+
177
+ # RRF (Reciprocal Rank Fusion) Configuration
178
+ rrf:
179
+ c_parameter: 60 # RRF constant (typically 60)
180
+ default_vector_k: 30 # Default number of vector candidates
181
+ default_text_k: 30 # Default number of text candidates
182
+ default_weights: [0.5, 0.3, 0.2] # Default fusion weights [vector, text, graph]
183
+
184
+ # HNSW Vector Search Optimization
185
+ hnsw:
186
+ enabled: true # Enable HNSW-optimized vector search
187
+ fallback_to_csv: true # Fall back to CSV parsing if HNSW unavailable
188
+ M: 16 # HNSW M parameter (bi-directional links)
189
+ efConstruction: 200 # HNSW efConstruction parameter
190
+ distance: "COSINE" # Distance metric: COSINE, EUCLIDEAN, DOT
191
+ try_acorn: false # Try ACORN=1 optimization (requires licensed IRIS)
192
+ community_edition_compatible: true # Ensure compatibility with IRIS Community Edition
193
+ # For licensed IRIS users: Set try_acorn: true and use intersystemsdc/iris-ml:latest
194
+ # For community users: Keep try_acorn: false and use intersystemsdc/iris-community:latest
195
+
196
+ # Text Search Configuration
197
+ text_search:
198
+ enable_ifind: true # Use IRIS iFind for enhanced text search
199
+ fallback_to_like: true # Fall back to LIKE patterns if iFind unavailable
200
+ min_confidence_threshold: 0 # Minimum confidence for text results (0-1000)
201
+ use_stemming: true # Enable stemming in iFind
202
+ use_stopwords: true # Enable stopword filtering in iFind
203
+
204
+ # Graph Traversal Configuration
205
+ graph_traversal:
206
+ max_expansion_depth: 2 # Maximum depth for neighborhood expansion
207
+ default_confidence_threshold: 500 # Default confidence threshold (0-1000)
208
+ max_entities_per_expansion: 50 # Maximum entities per expansion step
209
+ use_json_table_filtering: true # Use JSON_TABLE for confidence filtering
210
+
211
+ # Hybrid Search Method Configuration
212
+ hybrid_search:
213
+ default_method: "rrf" # Default method: hybrid, rrf, vector, text, kg
214
+ adaptive_routing: true # Enable adaptive query routing
215
+ enable_multi_modal: true # Enable multi-modal search fusion
216
+
217
+ # Schema Management for Graph Core Tables
218
+ schema:
219
+ auto_create_tables: true # Automatically create iris_graph_core tables
220
+ auto_migrate_schema: true # Automatically migrate schema changes
221
+ required_tables: # Tables required for iris_graph_core
222
+ - "rdf_labels"
223
+ - "rdf_props"
224
+ - "rdf_edges"
225
+ - "kg_NodeEmbeddings_optimized"
226
+
227
+ # Performance and Optimization
228
+ performance:
229
+ cache_vector_queries: true # Cache frequently used vector queries
230
+ cache_text_queries: true # Cache frequently used text queries
231
+ max_cache_size: 1000 # Maximum number of cached queries
232
+ query_timeout_ms: 30000 # Query timeout in milliseconds
233
+
234
+ # General ontology integration for GraphRAG
235
+ ontology_integration:
236
+ query_expansion: true # Expand queries using ontology concepts
237
+ entity_enrichment: true # Enrich extracted entities with ontology data
238
+ relationship_inference: true # Infer relationships using ontology reasoning
239
+ semantic_similarity: true # Use semantic similarity for entity matching
240
+
241
+ # Visualization settings
242
+ visualization:
243
+ enabled: true # Enable graph visualization
244
+ default_type: "plotly" # Default visualization: plotly, d3, traversal
245
+ highlight_ontology_concepts: true # Highlight ontology-derived concepts
246
+ show_inference_paths: true # Show reasoning inference paths
247
+
248
+ # Example configurations for different domains:
249
+
250
+ # Medical/Healthcare Domain Example:
251
+ # ontology:
252
+ # enabled: true
253
+ # sources:
254
+ # - type: "owl"
255
+ # path: "ontologies/umls/umls_core.owl"
256
+ # - type: "skos"
257
+ # path: "ontologies/snomed/snomed_ct.skos"
258
+
259
+ # Legal Domain Example:
260
+ # ontology:
261
+ # enabled: true
262
+ # sources:
263
+ # - type: "owl"
264
+ # path: "ontologies/legal/lkif.owl"
265
+ # - type: "rdf"
266
+ # path: "ontologies/legal/legislation.rdf"
267
+
268
+ # Financial Domain Example:
269
+ # ontology:
270
+ # enabled: true
271
+ # sources:
272
+ # - type: "owl"
273
+ # path: "ontologies/fibo/fibo_core.owl"
274
+ # - type: "skos"
275
+ # path: "ontologies/finance/financial_terms.skos"
276
+
277
+ # Scientific Research Domain Example:
278
+ # ontology:
279
+ # enabled: true
280
+ # sources:
281
+ # - type: "owl"
282
+ # path: "ontologies/science/research_methods.owl"
283
+ # - type: "rdf"
284
+ # path: "ontologies/science/publications.rdf"
285
+
286
+ # Multi-Domain Example:
287
+ # ontology:
288
+ # enabled: true
289
+ # sources:
290
+ # - type: "owl"
291
+ # path: "ontologies/medical.owl"
292
+ # - type: "owl"
293
+ # path: "ontologies/legal.owl"
294
+ # - type: "skos"
295
+ # path: "ontologies/general_terms.skos"