kailash 0.3.2__py3-none-any.whl → 0.4.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.
- kailash/__init__.py +33 -1
- kailash/access_control/__init__.py +129 -0
- kailash/access_control/managers.py +461 -0
- kailash/access_control/rule_evaluators.py +467 -0
- kailash/access_control_abac.py +825 -0
- kailash/config/__init__.py +27 -0
- kailash/config/database_config.py +359 -0
- kailash/database/__init__.py +28 -0
- kailash/database/execution_pipeline.py +499 -0
- kailash/middleware/__init__.py +306 -0
- kailash/middleware/auth/__init__.py +33 -0
- kailash/middleware/auth/access_control.py +436 -0
- kailash/middleware/auth/auth_manager.py +422 -0
- kailash/middleware/auth/jwt_auth.py +477 -0
- kailash/middleware/auth/kailash_jwt_auth.py +616 -0
- kailash/middleware/communication/__init__.py +37 -0
- kailash/middleware/communication/ai_chat.py +989 -0
- kailash/middleware/communication/api_gateway.py +802 -0
- kailash/middleware/communication/events.py +470 -0
- kailash/middleware/communication/realtime.py +710 -0
- kailash/middleware/core/__init__.py +21 -0
- kailash/middleware/core/agent_ui.py +890 -0
- kailash/middleware/core/schema.py +643 -0
- kailash/middleware/core/workflows.py +396 -0
- kailash/middleware/database/__init__.py +63 -0
- kailash/middleware/database/base.py +113 -0
- kailash/middleware/database/base_models.py +525 -0
- kailash/middleware/database/enums.py +106 -0
- kailash/middleware/database/migrations.py +12 -0
- kailash/{api/database.py → middleware/database/models.py} +183 -291
- kailash/middleware/database/repositories.py +685 -0
- kailash/middleware/database/session_manager.py +19 -0
- kailash/middleware/mcp/__init__.py +38 -0
- kailash/middleware/mcp/client_integration.py +585 -0
- kailash/middleware/mcp/enhanced_server.py +576 -0
- kailash/nodes/__init__.py +27 -3
- kailash/nodes/admin/__init__.py +42 -0
- kailash/nodes/admin/audit_log.py +794 -0
- kailash/nodes/admin/permission_check.py +864 -0
- kailash/nodes/admin/role_management.py +823 -0
- kailash/nodes/admin/security_event.py +1523 -0
- kailash/nodes/admin/user_management.py +944 -0
- kailash/nodes/ai/a2a.py +24 -7
- kailash/nodes/ai/ai_providers.py +248 -40
- kailash/nodes/ai/embedding_generator.py +11 -11
- kailash/nodes/ai/intelligent_agent_orchestrator.py +99 -11
- kailash/nodes/ai/llm_agent.py +436 -5
- kailash/nodes/ai/self_organizing.py +85 -10
- kailash/nodes/ai/vision_utils.py +148 -0
- kailash/nodes/alerts/__init__.py +26 -0
- kailash/nodes/alerts/base.py +234 -0
- kailash/nodes/alerts/discord.py +499 -0
- kailash/nodes/api/auth.py +287 -6
- kailash/nodes/api/rest.py +151 -0
- kailash/nodes/auth/__init__.py +17 -0
- kailash/nodes/auth/directory_integration.py +1228 -0
- kailash/nodes/auth/enterprise_auth_provider.py +1328 -0
- kailash/nodes/auth/mfa.py +2338 -0
- kailash/nodes/auth/risk_assessment.py +872 -0
- kailash/nodes/auth/session_management.py +1093 -0
- kailash/nodes/auth/sso.py +1040 -0
- kailash/nodes/base.py +344 -13
- kailash/nodes/base_cycle_aware.py +4 -2
- kailash/nodes/base_with_acl.py +1 -1
- kailash/nodes/code/python.py +283 -10
- kailash/nodes/compliance/__init__.py +9 -0
- kailash/nodes/compliance/data_retention.py +1888 -0
- kailash/nodes/compliance/gdpr.py +2004 -0
- kailash/nodes/data/__init__.py +22 -2
- kailash/nodes/data/async_connection.py +469 -0
- kailash/nodes/data/async_sql.py +757 -0
- kailash/nodes/data/async_vector.py +598 -0
- kailash/nodes/data/readers.py +767 -0
- kailash/nodes/data/retrieval.py +360 -1
- kailash/nodes/data/sharepoint_graph.py +397 -21
- kailash/nodes/data/sql.py +94 -5
- kailash/nodes/data/streaming.py +68 -8
- kailash/nodes/data/vector_db.py +54 -4
- kailash/nodes/enterprise/__init__.py +13 -0
- kailash/nodes/enterprise/batch_processor.py +741 -0
- kailash/nodes/enterprise/data_lineage.py +497 -0
- kailash/nodes/logic/convergence.py +31 -9
- kailash/nodes/logic/operations.py +14 -3
- kailash/nodes/mixins/__init__.py +8 -0
- kailash/nodes/mixins/event_emitter.py +201 -0
- kailash/nodes/mixins/mcp.py +9 -4
- kailash/nodes/mixins/security.py +165 -0
- kailash/nodes/monitoring/__init__.py +7 -0
- kailash/nodes/monitoring/performance_benchmark.py +2497 -0
- kailash/nodes/rag/__init__.py +284 -0
- kailash/nodes/rag/advanced.py +1615 -0
- kailash/nodes/rag/agentic.py +773 -0
- kailash/nodes/rag/conversational.py +999 -0
- kailash/nodes/rag/evaluation.py +875 -0
- kailash/nodes/rag/federated.py +1188 -0
- kailash/nodes/rag/graph.py +721 -0
- kailash/nodes/rag/multimodal.py +671 -0
- kailash/nodes/rag/optimized.py +933 -0
- kailash/nodes/rag/privacy.py +1059 -0
- kailash/nodes/rag/query_processing.py +1335 -0
- kailash/nodes/rag/realtime.py +764 -0
- kailash/nodes/rag/registry.py +547 -0
- kailash/nodes/rag/router.py +837 -0
- kailash/nodes/rag/similarity.py +1854 -0
- kailash/nodes/rag/strategies.py +566 -0
- kailash/nodes/rag/workflows.py +575 -0
- kailash/nodes/security/__init__.py +19 -0
- kailash/nodes/security/abac_evaluator.py +1411 -0
- kailash/nodes/security/audit_log.py +103 -0
- kailash/nodes/security/behavior_analysis.py +1893 -0
- kailash/nodes/security/credential_manager.py +401 -0
- kailash/nodes/security/rotating_credentials.py +760 -0
- kailash/nodes/security/security_event.py +133 -0
- kailash/nodes/security/threat_detection.py +1103 -0
- kailash/nodes/testing/__init__.py +9 -0
- kailash/nodes/testing/credential_testing.py +499 -0
- kailash/nodes/transform/__init__.py +10 -2
- kailash/nodes/transform/chunkers.py +592 -1
- kailash/nodes/transform/processors.py +484 -14
- kailash/nodes/validation.py +321 -0
- kailash/runtime/access_controlled.py +1 -1
- kailash/runtime/async_local.py +41 -7
- kailash/runtime/docker.py +1 -1
- kailash/runtime/local.py +474 -55
- kailash/runtime/parallel.py +1 -1
- kailash/runtime/parallel_cyclic.py +1 -1
- kailash/runtime/testing.py +210 -2
- kailash/security.py +1 -1
- kailash/utils/migrations/__init__.py +25 -0
- kailash/utils/migrations/generator.py +433 -0
- kailash/utils/migrations/models.py +231 -0
- kailash/utils/migrations/runner.py +489 -0
- kailash/utils/secure_logging.py +342 -0
- kailash/workflow/__init__.py +16 -0
- kailash/workflow/cyclic_runner.py +3 -4
- kailash/workflow/graph.py +70 -2
- kailash/workflow/resilience.py +249 -0
- kailash/workflow/templates.py +726 -0
- {kailash-0.3.2.dist-info → kailash-0.4.1.dist-info}/METADATA +256 -20
- kailash-0.4.1.dist-info/RECORD +227 -0
- kailash/api/__init__.py +0 -17
- kailash/api/__main__.py +0 -6
- kailash/api/studio_secure.py +0 -893
- kailash/mcp/__main__.py +0 -13
- kailash/mcp/server_new.py +0 -336
- kailash/mcp/servers/__init__.py +0 -12
- kailash-0.3.2.dist-info/RECORD +0 -136
- {kailash-0.3.2.dist-info → kailash-0.4.1.dist-info}/WHEEL +0 -0
- {kailash-0.3.2.dist-info → kailash-0.4.1.dist-info}/entry_points.txt +0 -0
- {kailash-0.3.2.dist-info → kailash-0.4.1.dist-info}/licenses/LICENSE +0 -0
- {kailash-0.3.2.dist-info → kailash-0.4.1.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
|
+
]
|