kailash 0.3.1__py3-none-any.whl → 0.4.0__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 (146) hide show
  1. kailash/__init__.py +33 -1
  2. kailash/access_control/__init__.py +129 -0
  3. kailash/access_control/managers.py +461 -0
  4. kailash/access_control/rule_evaluators.py +467 -0
  5. kailash/access_control_abac.py +825 -0
  6. kailash/config/__init__.py +27 -0
  7. kailash/config/database_config.py +359 -0
  8. kailash/database/__init__.py +28 -0
  9. kailash/database/execution_pipeline.py +499 -0
  10. kailash/middleware/__init__.py +306 -0
  11. kailash/middleware/auth/__init__.py +33 -0
  12. kailash/middleware/auth/access_control.py +436 -0
  13. kailash/middleware/auth/auth_manager.py +422 -0
  14. kailash/middleware/auth/jwt_auth.py +477 -0
  15. kailash/middleware/auth/kailash_jwt_auth.py +616 -0
  16. kailash/middleware/communication/__init__.py +37 -0
  17. kailash/middleware/communication/ai_chat.py +989 -0
  18. kailash/middleware/communication/api_gateway.py +802 -0
  19. kailash/middleware/communication/events.py +470 -0
  20. kailash/middleware/communication/realtime.py +710 -0
  21. kailash/middleware/core/__init__.py +21 -0
  22. kailash/middleware/core/agent_ui.py +890 -0
  23. kailash/middleware/core/schema.py +643 -0
  24. kailash/middleware/core/workflows.py +396 -0
  25. kailash/middleware/database/__init__.py +63 -0
  26. kailash/middleware/database/base.py +113 -0
  27. kailash/middleware/database/base_models.py +525 -0
  28. kailash/middleware/database/enums.py +106 -0
  29. kailash/middleware/database/migrations.py +12 -0
  30. kailash/{api/database.py → middleware/database/models.py} +183 -291
  31. kailash/middleware/database/repositories.py +685 -0
  32. kailash/middleware/database/session_manager.py +19 -0
  33. kailash/middleware/mcp/__init__.py +38 -0
  34. kailash/middleware/mcp/client_integration.py +585 -0
  35. kailash/middleware/mcp/enhanced_server.py +576 -0
  36. kailash/nodes/__init__.py +25 -3
  37. kailash/nodes/admin/__init__.py +35 -0
  38. kailash/nodes/admin/audit_log.py +794 -0
  39. kailash/nodes/admin/permission_check.py +864 -0
  40. kailash/nodes/admin/role_management.py +823 -0
  41. kailash/nodes/admin/security_event.py +1519 -0
  42. kailash/nodes/admin/user_management.py +944 -0
  43. kailash/nodes/ai/a2a.py +24 -7
  44. kailash/nodes/ai/ai_providers.py +1 -0
  45. kailash/nodes/ai/embedding_generator.py +11 -11
  46. kailash/nodes/ai/intelligent_agent_orchestrator.py +99 -11
  47. kailash/nodes/ai/llm_agent.py +407 -2
  48. kailash/nodes/ai/self_organizing.py +85 -10
  49. kailash/nodes/api/auth.py +287 -6
  50. kailash/nodes/api/rest.py +151 -0
  51. kailash/nodes/auth/__init__.py +17 -0
  52. kailash/nodes/auth/directory_integration.py +1228 -0
  53. kailash/nodes/auth/enterprise_auth_provider.py +1328 -0
  54. kailash/nodes/auth/mfa.py +2338 -0
  55. kailash/nodes/auth/risk_assessment.py +872 -0
  56. kailash/nodes/auth/session_management.py +1093 -0
  57. kailash/nodes/auth/sso.py +1040 -0
  58. kailash/nodes/base.py +344 -13
  59. kailash/nodes/base_cycle_aware.py +4 -2
  60. kailash/nodes/base_with_acl.py +1 -1
  61. kailash/nodes/code/python.py +293 -12
  62. kailash/nodes/compliance/__init__.py +9 -0
  63. kailash/nodes/compliance/data_retention.py +1888 -0
  64. kailash/nodes/compliance/gdpr.py +2004 -0
  65. kailash/nodes/data/__init__.py +22 -2
  66. kailash/nodes/data/async_connection.py +469 -0
  67. kailash/nodes/data/async_sql.py +757 -0
  68. kailash/nodes/data/async_vector.py +598 -0
  69. kailash/nodes/data/readers.py +767 -0
  70. kailash/nodes/data/retrieval.py +360 -1
  71. kailash/nodes/data/sharepoint_graph.py +397 -21
  72. kailash/nodes/data/sql.py +94 -5
  73. kailash/nodes/data/streaming.py +68 -8
  74. kailash/nodes/data/vector_db.py +54 -4
  75. kailash/nodes/enterprise/__init__.py +13 -0
  76. kailash/nodes/enterprise/batch_processor.py +741 -0
  77. kailash/nodes/enterprise/data_lineage.py +497 -0
  78. kailash/nodes/logic/convergence.py +31 -9
  79. kailash/nodes/logic/operations.py +14 -3
  80. kailash/nodes/mixins/__init__.py +8 -0
  81. kailash/nodes/mixins/event_emitter.py +201 -0
  82. kailash/nodes/mixins/mcp.py +9 -4
  83. kailash/nodes/mixins/security.py +165 -0
  84. kailash/nodes/monitoring/__init__.py +7 -0
  85. kailash/nodes/monitoring/performance_benchmark.py +2497 -0
  86. kailash/nodes/rag/__init__.py +284 -0
  87. kailash/nodes/rag/advanced.py +1615 -0
  88. kailash/nodes/rag/agentic.py +773 -0
  89. kailash/nodes/rag/conversational.py +999 -0
  90. kailash/nodes/rag/evaluation.py +875 -0
  91. kailash/nodes/rag/federated.py +1188 -0
  92. kailash/nodes/rag/graph.py +721 -0
  93. kailash/nodes/rag/multimodal.py +671 -0
  94. kailash/nodes/rag/optimized.py +933 -0
  95. kailash/nodes/rag/privacy.py +1059 -0
  96. kailash/nodes/rag/query_processing.py +1335 -0
  97. kailash/nodes/rag/realtime.py +764 -0
  98. kailash/nodes/rag/registry.py +547 -0
  99. kailash/nodes/rag/router.py +837 -0
  100. kailash/nodes/rag/similarity.py +1854 -0
  101. kailash/nodes/rag/strategies.py +566 -0
  102. kailash/nodes/rag/workflows.py +575 -0
  103. kailash/nodes/security/__init__.py +19 -0
  104. kailash/nodes/security/abac_evaluator.py +1411 -0
  105. kailash/nodes/security/audit_log.py +91 -0
  106. kailash/nodes/security/behavior_analysis.py +1893 -0
  107. kailash/nodes/security/credential_manager.py +401 -0
  108. kailash/nodes/security/rotating_credentials.py +760 -0
  109. kailash/nodes/security/security_event.py +132 -0
  110. kailash/nodes/security/threat_detection.py +1103 -0
  111. kailash/nodes/testing/__init__.py +9 -0
  112. kailash/nodes/testing/credential_testing.py +499 -0
  113. kailash/nodes/transform/__init__.py +10 -2
  114. kailash/nodes/transform/chunkers.py +592 -1
  115. kailash/nodes/transform/processors.py +484 -14
  116. kailash/nodes/validation.py +321 -0
  117. kailash/runtime/access_controlled.py +1 -1
  118. kailash/runtime/async_local.py +41 -7
  119. kailash/runtime/docker.py +1 -1
  120. kailash/runtime/local.py +474 -55
  121. kailash/runtime/parallel.py +1 -1
  122. kailash/runtime/parallel_cyclic.py +1 -1
  123. kailash/runtime/testing.py +210 -2
  124. kailash/utils/migrations/__init__.py +25 -0
  125. kailash/utils/migrations/generator.py +433 -0
  126. kailash/utils/migrations/models.py +231 -0
  127. kailash/utils/migrations/runner.py +489 -0
  128. kailash/utils/secure_logging.py +342 -0
  129. kailash/workflow/__init__.py +16 -0
  130. kailash/workflow/cyclic_runner.py +3 -4
  131. kailash/workflow/graph.py +70 -2
  132. kailash/workflow/resilience.py +249 -0
  133. kailash/workflow/templates.py +726 -0
  134. {kailash-0.3.1.dist-info → kailash-0.4.0.dist-info}/METADATA +253 -20
  135. kailash-0.4.0.dist-info/RECORD +223 -0
  136. kailash/api/__init__.py +0 -17
  137. kailash/api/__main__.py +0 -6
  138. kailash/api/studio_secure.py +0 -893
  139. kailash/mcp/__main__.py +0 -13
  140. kailash/mcp/server_new.py +0 -336
  141. kailash/mcp/servers/__init__.py +0 -12
  142. kailash-0.3.1.dist-info/RECORD +0 -136
  143. {kailash-0.3.1.dist-info → kailash-0.4.0.dist-info}/WHEEL +0 -0
  144. {kailash-0.3.1.dist-info → kailash-0.4.0.dist-info}/entry_points.txt +0 -0
  145. {kailash-0.3.1.dist-info → kailash-0.4.0.dist-info}/licenses/LICENSE +0 -0
  146. {kailash-0.3.1.dist-info → kailash-0.4.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,284 @@
1
+ """
2
+ RAG (Retrieval Augmented Generation) Toolkit
3
+
4
+ Comprehensive RAG implementation with swappable strategies, conditional routing,
5
+ and enterprise-grade features. Supports semantic, statistical, hybrid, and
6
+ hierarchical RAG approaches with advanced similarity methods.
7
+
8
+ ## Quick Start
9
+
10
+ ```python
11
+ from kailash.nodes.rag import (
12
+ RAGStrategyRouterNode,
13
+ SemanticRAGWorkflowNode,
14
+ HybridRAGWorkflowNode,
15
+ AdaptiveRAGWorkflowNode,
16
+ ColBERTRetrievalNode,
17
+ AsyncParallelRAGNode
18
+ )
19
+
20
+ # Method 1: AI-driven strategy selection
21
+ workflow.add_node("rag_router", RAGStrategyRouterNode())
22
+ workflow.add_node("rag_processor", SwitchNode(
23
+ condition_field="strategy",
24
+ routes={
25
+ "semantic": "semantic_rag",
26
+ "hybrid": "hybrid_rag",
27
+ "hierarchical": "hierarchical_rag"
28
+ }
29
+ ))
30
+
31
+ # Method 2: Direct strategy selection
32
+ workflow.add_node("rag", HybridRAGWorkflowNode(
33
+ chunking_strategy="semantic",
34
+ retrieval_method="hybrid",
35
+ vector_db="postgresql"
36
+ ))
37
+
38
+ # Method 3: Advanced similarity approaches
39
+ workflow.add_node("colbert", ColBERTRetrievalNode())
40
+ workflow.add_node("multi_vector", MultiVectorRetrievalNode())
41
+ ```
42
+
43
+ ## Available Components
44
+
45
+ ### Core Strategies
46
+ - **SemanticRAGNode**: Semantic chunking + dense retrieval
47
+ - **StatisticalRAGNode**: Statistical chunking + sparse retrieval
48
+ - **HybridRAGNode**: Combines semantic + statistical approaches
49
+ - **HierarchicalRAGNode**: Multi-level document processing
50
+
51
+ ### Advanced Techniques
52
+ - **SelfCorrectingRAGNode**: Iterative verification and refinement
53
+ - **RAGFusionNode**: Multi-query approach with result fusion
54
+ - **HyDENode**: Hypothetical Document Embeddings
55
+ - **StepBackRAGNode**: Abstract reasoning with background context
56
+
57
+ ### Similarity Approaches
58
+ - **DenseRetrievalNode**: Advanced dense embeddings with instruction-awareness
59
+ - **SparseRetrievalNode**: BM25, TF-IDF with query expansion
60
+ - **ColBERTRetrievalNode**: Token-level late interaction
61
+ - **MultiVectorRetrievalNode**: Multiple representations per document
62
+ - **CrossEncoderRerankNode**: Two-stage retrieval with reranking
63
+ - **HybridFusionNode**: RRF and advanced fusion methods
64
+ - **PropositionBasedRetrievalNode**: Atomic fact extraction
65
+
66
+ ### Query Processing
67
+ - **QueryExpansionNode**: Synonym and concept expansion
68
+ - **QueryDecompositionNode**: Complex query breakdown
69
+ - **QueryRewritingNode**: Query optimization for retrieval
70
+ - **QueryIntentClassifierNode**: Intent-based routing
71
+ - **MultiHopQueryPlannerNode**: Multi-step reasoning
72
+ - **AdaptiveQueryProcessorNode**: Intelligent query enhancement
73
+
74
+ ### Performance Optimization
75
+ - **CacheOptimizedRAGNode**: Multi-level caching with semantic similarity
76
+ - **AsyncParallelRAGNode**: Concurrent strategy execution
77
+ - **StreamingRAGNode**: Real-time progressive retrieval
78
+ - **BatchOptimizedRAGNode**: High-throughput batch processing
79
+
80
+ ### Workflow Nodes
81
+ - **SimpleRAGWorkflowNode**: Basic chunk → embed → store → retrieve
82
+ - **AdvancedRAGWorkflowNode**: Multi-stage with quality checks
83
+ - **AdaptiveRAGWorkflowNode**: AI-driven strategy selection
84
+
85
+ ### Router & Utilities
86
+ - **RAGStrategyRouterNode**: LLM-powered strategy selection
87
+ - **RAGQualityAnalyzerNode**: Quality assessment and optimization
88
+ - **RAGPerformanceMonitorNode**: Performance tracking and metrics
89
+ - **RAGWorkflowRegistry**: Component discovery and recommendations
90
+
91
+ ### Graph-Enhanced RAG
92
+ - **GraphRAGNode**: Knowledge graph construction and querying
93
+ - **GraphBuilderNode**: Build knowledge graphs from documents
94
+ - **GraphQueryNode**: Execute complex graph queries
95
+
96
+ ### Agentic RAG
97
+ - **AgenticRAGNode**: Autonomous reasoning with tool use
98
+ - **ToolAugmentedRAGNode**: RAG with specialized tool integration
99
+ - **ReasoningRAGNode**: Multi-step reasoning chains
100
+
101
+ ### Multimodal RAG
102
+ - **MultimodalRAGNode**: Text + image retrieval and generation
103
+ - **VisualQuestionAnsweringNode**: Answer questions about images
104
+ - **ImageTextMatchingNode**: Cross-modal similarity matching
105
+
106
+ ### Real-time & Streaming
107
+ - **RealtimeRAGNode**: Live data updates and monitoring
108
+ - **IncrementalIndexNode**: Efficient incremental updates
109
+
110
+ ### Evaluation & Testing
111
+ - **RAGEvaluationNode**: Comprehensive quality metrics (RAGAS)
112
+ - **RAGBenchmarkNode**: Performance benchmarking
113
+ - **TestDatasetGeneratorNode**: Synthetic test data generation
114
+
115
+ ### Privacy & Security
116
+ - **PrivacyPreservingRAGNode**: Differential privacy and PII protection
117
+ - **SecureMultiPartyRAGNode**: Federated computation without data sharing
118
+ - **ComplianceRAGNode**: GDPR/HIPAA compliant RAG
119
+
120
+ ### Conversational RAG
121
+ - **ConversationalRAGNode**: Multi-turn context management
122
+ - **ConversationMemoryNode**: Long-term memory and personalization
123
+
124
+ ### Federated & Distributed
125
+ - **FederatedRAGNode**: Distributed RAG across organizations
126
+ - **EdgeRAGNode**: Optimized for edge devices
127
+ - **CrossSiloRAGNode**: Cross-organizational data federation
128
+ """
129
+
130
+ from .advanced import HyDENode, RAGFusionNode, SelfCorrectingRAGNode, StepBackRAGNode
131
+
132
+ # Agentic RAG
133
+ from .agentic import AgenticRAGNode, ReasoningRAGNode, ToolAugmentedRAGNode
134
+
135
+ # Conversational RAG
136
+ from .conversational import ConversationalRAGNode, ConversationMemoryNode
137
+
138
+ # Evaluation Framework
139
+ from .evaluation import RAGBenchmarkNode, RAGEvaluationNode, TestDatasetGeneratorNode
140
+
141
+ # Federated RAG
142
+ from .federated import CrossSiloRAGNode, EdgeRAGNode, FederatedRAGNode
143
+
144
+ # Graph-based RAG
145
+ from .graph import GraphBuilderNode, GraphQueryNode, GraphRAGNode
146
+
147
+ # Multimodal RAG
148
+ from .multimodal import (
149
+ ImageTextMatchingNode,
150
+ MultimodalRAGNode,
151
+ VisualQuestionAnsweringNode,
152
+ )
153
+ from .optimized import (
154
+ AsyncParallelRAGNode,
155
+ BatchOptimizedRAGNode,
156
+ CacheOptimizedRAGNode,
157
+ StreamingRAGNode,
158
+ )
159
+
160
+ # Privacy-preserving RAG
161
+ from .privacy import (
162
+ ComplianceRAGNode,
163
+ PrivacyPreservingRAGNode,
164
+ SecureMultiPartyRAGNode,
165
+ )
166
+ from .query_processing import (
167
+ AdaptiveQueryProcessorNode,
168
+ MultiHopQueryPlannerNode,
169
+ QueryDecompositionNode,
170
+ QueryExpansionNode,
171
+ QueryIntentClassifierNode,
172
+ QueryRewritingNode,
173
+ )
174
+
175
+ # Real-time RAG
176
+ from .realtime import (
177
+ IncrementalIndexNode,
178
+ RealtimeRAGNode,
179
+ )
180
+ from .realtime import (
181
+ StreamingRAGNode as RealtimeStreamingRAGNode, # Avoid name conflict
182
+ )
183
+ from .registry import RAGWorkflowRegistry
184
+ from .router import (
185
+ RAGPerformanceMonitorNode,
186
+ RAGQualityAnalyzerNode,
187
+ RAGStrategyRouterNode,
188
+ )
189
+ from .similarity import (
190
+ ColBERTRetrievalNode,
191
+ CrossEncoderRerankNode,
192
+ DenseRetrievalNode,
193
+ HybridFusionNode,
194
+ MultiVectorRetrievalNode,
195
+ PropositionBasedRetrievalNode,
196
+ SparseRetrievalNode,
197
+ )
198
+ from .strategies import (
199
+ HierarchicalRAGNode,
200
+ HybridRAGNode,
201
+ RAGConfig,
202
+ SemanticRAGNode,
203
+ StatisticalRAGNode,
204
+ )
205
+ from .workflows import (
206
+ AdaptiveRAGWorkflowNode,
207
+ AdvancedRAGWorkflowNode,
208
+ SimpleRAGWorkflowNode,
209
+ )
210
+
211
+ __all__ = [
212
+ # Core Strategy Nodes
213
+ "SemanticRAGNode",
214
+ "StatisticalRAGNode",
215
+ "HybridRAGNode",
216
+ "HierarchicalRAGNode",
217
+ "RAGConfig",
218
+ # Workflow Nodes
219
+ "SimpleRAGWorkflowNode",
220
+ "AdvancedRAGWorkflowNode",
221
+ "AdaptiveRAGWorkflowNode",
222
+ # Router & Analysis
223
+ "RAGStrategyRouterNode",
224
+ "RAGQualityAnalyzerNode",
225
+ "RAGPerformanceMonitorNode",
226
+ # Advanced RAG Techniques
227
+ "SelfCorrectingRAGNode",
228
+ "RAGFusionNode",
229
+ "HyDENode",
230
+ "StepBackRAGNode",
231
+ # Similarity Approaches
232
+ "DenseRetrievalNode",
233
+ "SparseRetrievalNode",
234
+ "ColBERTRetrievalNode",
235
+ "MultiVectorRetrievalNode",
236
+ "CrossEncoderRerankNode",
237
+ "HybridFusionNode",
238
+ "PropositionBasedRetrievalNode",
239
+ # Query Processing
240
+ "QueryExpansionNode",
241
+ "QueryDecompositionNode",
242
+ "QueryRewritingNode",
243
+ "QueryIntentClassifierNode",
244
+ "MultiHopQueryPlannerNode",
245
+ "AdaptiveQueryProcessorNode",
246
+ # Performance Optimization
247
+ "CacheOptimizedRAGNode",
248
+ "AsyncParallelRAGNode",
249
+ "StreamingRAGNode",
250
+ "BatchOptimizedRAGNode",
251
+ # Registry
252
+ "RAGWorkflowRegistry",
253
+ # Graph-based RAG
254
+ "GraphRAGNode",
255
+ "GraphBuilderNode",
256
+ "GraphQueryNode",
257
+ # Agentic RAG
258
+ "AgenticRAGNode",
259
+ "ToolAugmentedRAGNode",
260
+ "ReasoningRAGNode",
261
+ # Multimodal RAG
262
+ "MultimodalRAGNode",
263
+ "VisualQuestionAnsweringNode",
264
+ "ImageTextMatchingNode",
265
+ # Real-time RAG
266
+ "RealtimeRAGNode",
267
+ "RealtimeStreamingRAGNode",
268
+ "IncrementalIndexNode",
269
+ # Evaluation Framework
270
+ "RAGEvaluationNode",
271
+ "RAGBenchmarkNode",
272
+ "TestDatasetGeneratorNode",
273
+ # Privacy-preserving RAG
274
+ "PrivacyPreservingRAGNode",
275
+ "SecureMultiPartyRAGNode",
276
+ "ComplianceRAGNode",
277
+ # Conversational RAG
278
+ "ConversationalRAGNode",
279
+ "ConversationMemoryNode",
280
+ # Federated RAG
281
+ "FederatedRAGNode",
282
+ "EdgeRAGNode",
283
+ "CrossSiloRAGNode",
284
+ ]