kailash 0.6.2__py3-none-any.whl → 0.6.4__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 +3 -3
- kailash/api/custom_nodes_secure.py +3 -3
- kailash/api/gateway.py +1 -1
- kailash/api/studio.py +2 -3
- kailash/api/workflow_api.py +3 -4
- kailash/core/resilience/bulkhead.py +460 -0
- kailash/core/resilience/circuit_breaker.py +92 -10
- kailash/edge/discovery.py +86 -0
- kailash/mcp_server/__init__.py +334 -0
- kailash/mcp_server/advanced_features.py +1022 -0
- kailash/{mcp → mcp_server}/ai_registry_server.py +29 -4
- kailash/mcp_server/auth.py +789 -0
- kailash/mcp_server/client.py +712 -0
- kailash/mcp_server/discovery.py +1593 -0
- kailash/mcp_server/errors.py +673 -0
- kailash/mcp_server/oauth.py +1727 -0
- kailash/mcp_server/protocol.py +1126 -0
- kailash/mcp_server/registry_integration.py +587 -0
- kailash/mcp_server/server.py +1747 -0
- kailash/{mcp → mcp_server}/servers/ai_registry.py +2 -2
- kailash/mcp_server/transports.py +1169 -0
- kailash/mcp_server/utils/cache.py +510 -0
- kailash/middleware/auth/auth_manager.py +3 -3
- kailash/middleware/communication/api_gateway.py +2 -9
- kailash/middleware/communication/realtime.py +1 -1
- kailash/middleware/mcp/client_integration.py +1 -1
- kailash/middleware/mcp/enhanced_server.py +2 -2
- kailash/nodes/__init__.py +2 -0
- kailash/nodes/admin/audit_log.py +6 -6
- kailash/nodes/admin/permission_check.py +8 -8
- kailash/nodes/admin/role_management.py +32 -28
- kailash/nodes/admin/schema.sql +6 -1
- kailash/nodes/admin/schema_manager.py +13 -13
- kailash/nodes/admin/security_event.py +16 -20
- kailash/nodes/admin/tenant_isolation.py +3 -3
- kailash/nodes/admin/transaction_utils.py +3 -3
- kailash/nodes/admin/user_management.py +21 -22
- kailash/nodes/ai/a2a.py +11 -11
- kailash/nodes/ai/ai_providers.py +9 -12
- kailash/nodes/ai/embedding_generator.py +13 -14
- kailash/nodes/ai/intelligent_agent_orchestrator.py +19 -19
- kailash/nodes/ai/iterative_llm_agent.py +3 -3
- kailash/nodes/ai/llm_agent.py +213 -36
- kailash/nodes/ai/self_organizing.py +2 -2
- kailash/nodes/alerts/discord.py +4 -4
- kailash/nodes/api/graphql.py +6 -6
- kailash/nodes/api/http.py +12 -17
- kailash/nodes/api/rate_limiting.py +4 -4
- kailash/nodes/api/rest.py +15 -15
- kailash/nodes/auth/mfa.py +3 -4
- kailash/nodes/auth/risk_assessment.py +2 -2
- kailash/nodes/auth/session_management.py +5 -5
- kailash/nodes/auth/sso.py +143 -0
- kailash/nodes/base.py +6 -2
- kailash/nodes/base_async.py +16 -2
- kailash/nodes/base_with_acl.py +2 -2
- kailash/nodes/cache/__init__.py +9 -0
- kailash/nodes/cache/cache.py +1172 -0
- kailash/nodes/cache/cache_invalidation.py +870 -0
- kailash/nodes/cache/redis_pool_manager.py +595 -0
- kailash/nodes/code/async_python.py +2 -1
- kailash/nodes/code/python.py +196 -35
- kailash/nodes/compliance/data_retention.py +6 -6
- kailash/nodes/compliance/gdpr.py +5 -5
- kailash/nodes/data/__init__.py +10 -0
- kailash/nodes/data/optimistic_locking.py +906 -0
- kailash/nodes/data/readers.py +8 -8
- kailash/nodes/data/redis.py +349 -0
- kailash/nodes/data/sql.py +314 -3
- kailash/nodes/data/streaming.py +21 -0
- kailash/nodes/enterprise/__init__.py +8 -0
- kailash/nodes/enterprise/audit_logger.py +285 -0
- kailash/nodes/enterprise/batch_processor.py +22 -3
- kailash/nodes/enterprise/data_lineage.py +1 -1
- kailash/nodes/enterprise/mcp_executor.py +205 -0
- kailash/nodes/enterprise/service_discovery.py +150 -0
- kailash/nodes/enterprise/tenant_assignment.py +108 -0
- kailash/nodes/logic/async_operations.py +2 -2
- kailash/nodes/logic/convergence.py +1 -1
- kailash/nodes/logic/operations.py +1 -1
- kailash/nodes/monitoring/__init__.py +11 -1
- kailash/nodes/monitoring/health_check.py +456 -0
- kailash/nodes/monitoring/log_processor.py +817 -0
- kailash/nodes/monitoring/metrics_collector.py +627 -0
- kailash/nodes/monitoring/performance_benchmark.py +137 -11
- kailash/nodes/rag/advanced.py +7 -7
- kailash/nodes/rag/agentic.py +49 -2
- kailash/nodes/rag/conversational.py +3 -3
- kailash/nodes/rag/evaluation.py +3 -3
- kailash/nodes/rag/federated.py +3 -3
- kailash/nodes/rag/graph.py +3 -3
- kailash/nodes/rag/multimodal.py +3 -3
- kailash/nodes/rag/optimized.py +5 -5
- kailash/nodes/rag/privacy.py +3 -3
- kailash/nodes/rag/query_processing.py +6 -6
- kailash/nodes/rag/realtime.py +1 -1
- kailash/nodes/rag/registry.py +2 -6
- kailash/nodes/rag/router.py +1 -1
- kailash/nodes/rag/similarity.py +7 -7
- kailash/nodes/rag/strategies.py +4 -4
- kailash/nodes/security/abac_evaluator.py +6 -6
- kailash/nodes/security/behavior_analysis.py +5 -6
- kailash/nodes/security/credential_manager.py +1 -1
- kailash/nodes/security/rotating_credentials.py +11 -11
- kailash/nodes/security/threat_detection.py +8 -8
- kailash/nodes/testing/credential_testing.py +2 -2
- kailash/nodes/transform/processors.py +5 -5
- kailash/runtime/local.py +162 -14
- kailash/runtime/parameter_injection.py +425 -0
- kailash/runtime/parameter_injector.py +657 -0
- kailash/runtime/testing.py +2 -2
- kailash/testing/fixtures.py +2 -2
- kailash/workflow/builder.py +99 -18
- kailash/workflow/builder_improvements.py +207 -0
- kailash/workflow/input_handling.py +170 -0
- {kailash-0.6.2.dist-info → kailash-0.6.4.dist-info}/METADATA +21 -8
- {kailash-0.6.2.dist-info → kailash-0.6.4.dist-info}/RECORD +126 -101
- kailash/mcp/__init__.py +0 -53
- kailash/mcp/client.py +0 -445
- kailash/mcp/server.py +0 -292
- kailash/mcp/server_enhanced.py +0 -449
- kailash/mcp/utils/cache.py +0 -267
- /kailash/{mcp → mcp_server}/client_new.py +0 -0
- /kailash/{mcp → mcp_server}/utils/__init__.py +0 -0
- /kailash/{mcp → mcp_server}/utils/config.py +0 -0
- /kailash/{mcp → mcp_server}/utils/formatters.py +0 -0
- /kailash/{mcp → mcp_server}/utils/metrics.py +0 -0
- {kailash-0.6.2.dist-info → kailash-0.6.4.dist-info}/WHEEL +0 -0
- {kailash-0.6.2.dist-info → kailash-0.6.4.dist-info}/entry_points.txt +0 -0
- {kailash-0.6.2.dist-info → kailash-0.6.4.dist-info}/licenses/LICENSE +0 -0
- {kailash-0.6.2.dist-info → kailash-0.6.4.dist-info}/top_level.txt +0 -0
@@ -117,7 +117,7 @@ class PerformanceBenchmarkNode(SecurityMixin, PerformanceMixin, LoggingMixin, No
|
|
117
117
|
... time.sleep(0.1) # Simulate work
|
118
118
|
... return "completed"
|
119
119
|
>>>
|
120
|
-
>>> result = perf_node.
|
120
|
+
>>> result = perf_node.execute(
|
121
121
|
... action="benchmark",
|
122
122
|
... operation_name="test_operation",
|
123
123
|
... operation_func=my_operation
|
@@ -125,7 +125,7 @@ class PerformanceBenchmarkNode(SecurityMixin, PerformanceMixin, LoggingMixin, No
|
|
125
125
|
>>> print(f"Execution time: {result['execution_time_ms']}ms")
|
126
126
|
>>>
|
127
127
|
>>> # Monitor continuous performance
|
128
|
-
>>> monitor_result = perf_node.
|
128
|
+
>>> monitor_result = perf_node.execute(
|
129
129
|
... action="monitor",
|
130
130
|
... operations=["api_response", "db_query"],
|
131
131
|
... duration_seconds=60
|
@@ -233,8 +233,7 @@ class PerformanceBenchmarkNode(SecurityMixin, PerformanceMixin, LoggingMixin, No
|
|
233
233
|
name="operations",
|
234
234
|
type=list,
|
235
235
|
description="List of operations to monitor",
|
236
|
-
required=
|
237
|
-
default=[],
|
236
|
+
required=True,
|
238
237
|
),
|
239
238
|
"duration_seconds": NodeParameter(
|
240
239
|
name="duration_seconds",
|
@@ -268,6 +267,63 @@ class PerformanceBenchmarkNode(SecurityMixin, PerformanceMixin, LoggingMixin, No
|
|
268
267
|
description="Time range for querying metrics",
|
269
268
|
required=False,
|
270
269
|
),
|
270
|
+
"enable_monitoring": NodeParameter(
|
271
|
+
name="enable_monitoring",
|
272
|
+
type=bool,
|
273
|
+
description="Enable continuous monitoring",
|
274
|
+
required=False,
|
275
|
+
default=True,
|
276
|
+
),
|
277
|
+
"performance_targets": NodeParameter(
|
278
|
+
name="performance_targets",
|
279
|
+
type=dict,
|
280
|
+
description="Performance targets for monitoring",
|
281
|
+
required=False,
|
282
|
+
default={},
|
283
|
+
),
|
284
|
+
"alert_thresholds": NodeParameter(
|
285
|
+
name="alert_thresholds",
|
286
|
+
type=dict,
|
287
|
+
description="Alert thresholds for performance metrics",
|
288
|
+
required=False,
|
289
|
+
default={},
|
290
|
+
),
|
291
|
+
"enable_mcp_metrics": NodeParameter(
|
292
|
+
name="enable_mcp_metrics",
|
293
|
+
type=bool,
|
294
|
+
description="Enable MCP metrics collection",
|
295
|
+
required=False,
|
296
|
+
default=False,
|
297
|
+
),
|
298
|
+
}
|
299
|
+
|
300
|
+
def get_output_schema(self) -> Dict[str, NodeParameter]:
|
301
|
+
"""Get node output schema for validation and documentation.
|
302
|
+
|
303
|
+
Returns:
|
304
|
+
Dictionary mapping output field names to NodeParameter objects
|
305
|
+
"""
|
306
|
+
return {
|
307
|
+
"results": NodeParameter(
|
308
|
+
name="results",
|
309
|
+
type=list,
|
310
|
+
description="List of benchmark results",
|
311
|
+
),
|
312
|
+
"summary": NodeParameter(
|
313
|
+
name="summary",
|
314
|
+
type=dict,
|
315
|
+
description="Summary statistics of benchmark results",
|
316
|
+
),
|
317
|
+
"alerts": NodeParameter(
|
318
|
+
name="alerts",
|
319
|
+
type=list,
|
320
|
+
description="Performance alerts triggered during benchmarking",
|
321
|
+
),
|
322
|
+
"recommendations": NodeParameter(
|
323
|
+
name="recommendations",
|
324
|
+
type=list,
|
325
|
+
description="Performance optimization recommendations",
|
326
|
+
),
|
271
327
|
}
|
272
328
|
|
273
329
|
def execute(self, **kwargs) -> Dict[str, Any]:
|
@@ -279,6 +335,13 @@ class PerformanceBenchmarkNode(SecurityMixin, PerformanceMixin, LoggingMixin, No
|
|
279
335
|
Returns:
|
280
336
|
Performance benchmark results
|
281
337
|
"""
|
338
|
+
# If action is not provided, infer it from the parameters
|
339
|
+
if "action" not in kwargs:
|
340
|
+
if "operations" in kwargs:
|
341
|
+
kwargs["action"] = "benchmark"
|
342
|
+
else:
|
343
|
+
kwargs["action"] = "monitor"
|
344
|
+
|
282
345
|
return self.run(**kwargs)
|
283
346
|
|
284
347
|
def run(
|
@@ -326,15 +389,78 @@ class PerformanceBenchmarkNode(SecurityMixin, PerformanceMixin, LoggingMixin, No
|
|
326
389
|
|
327
390
|
# Route to appropriate action handler
|
328
391
|
if action == "benchmark":
|
329
|
-
|
392
|
+
# Handle single operation or list of operations
|
393
|
+
if operations and len(operations) > 0:
|
394
|
+
# Handle list of operations
|
395
|
+
all_results = []
|
396
|
+
for i, operation in enumerate(operations):
|
397
|
+
if callable(operation):
|
398
|
+
op_name = getattr(operation, "__name__", f"operation_{i}")
|
399
|
+
result = self._benchmark_operation(
|
400
|
+
op_name, operation, kwargs
|
401
|
+
)
|
402
|
+
# Extract individual results from the benchmark operation
|
403
|
+
if result.get("success", False):
|
404
|
+
detailed_results = result.get("detailed_results", [])
|
405
|
+
all_results.extend(detailed_results)
|
406
|
+
else:
|
407
|
+
# Add failed operation result
|
408
|
+
all_results.append(
|
409
|
+
{
|
410
|
+
"operation_name": op_name,
|
411
|
+
"success": False,
|
412
|
+
"error_message": result.get(
|
413
|
+
"error", "Benchmark failed"
|
414
|
+
),
|
415
|
+
"execution_time_ms": 0,
|
416
|
+
"memory_used_mb": 0,
|
417
|
+
"cpu_usage_percent": 0,
|
418
|
+
"metadata": {},
|
419
|
+
"timestamp": datetime.now(UTC),
|
420
|
+
}
|
421
|
+
)
|
422
|
+
else:
|
423
|
+
# String operation name - would need to look up the function
|
424
|
+
all_results.append(
|
425
|
+
{
|
426
|
+
"operation_name": str(operation),
|
427
|
+
"success": False,
|
428
|
+
"error_message": "Operation function not provided",
|
429
|
+
"execution_time_ms": 0,
|
430
|
+
"memory_used_mb": 0,
|
431
|
+
"cpu_usage_percent": 0,
|
432
|
+
"metadata": {},
|
433
|
+
"timestamp": datetime.now(UTC),
|
434
|
+
}
|
435
|
+
)
|
436
|
+
|
437
|
+
# Return combined results
|
438
|
+
result = {
|
439
|
+
"results": all_results,
|
440
|
+
"summary": {
|
441
|
+
"total_operations": len(all_results),
|
442
|
+
"successful_operations": sum(
|
443
|
+
1 for r in all_results if r.get("success", False)
|
444
|
+
),
|
445
|
+
"failed_operations": sum(
|
446
|
+
1 for r in all_results if not r.get("success", False)
|
447
|
+
),
|
448
|
+
},
|
449
|
+
"alerts": [],
|
450
|
+
"recommendations": [],
|
451
|
+
}
|
452
|
+
self.perf_stats["total_benchmarks"] += len(operations)
|
453
|
+
elif operation_name and operation_func:
|
454
|
+
# Handle single operation
|
455
|
+
result = self._benchmark_operation(
|
456
|
+
operation_name, operation_func, kwargs
|
457
|
+
)
|
458
|
+
self.perf_stats["total_benchmarks"] += 1
|
459
|
+
else:
|
330
460
|
return {
|
331
461
|
"success": False,
|
332
|
-
"error": "operation_name and operation_func required for benchmark",
|
462
|
+
"error": "Either operations list or operation_name and operation_func required for benchmark",
|
333
463
|
}
|
334
|
-
result = self._benchmark_operation(
|
335
|
-
operation_name, operation_func, kwargs
|
336
|
-
)
|
337
|
-
self.perf_stats["total_benchmarks"] += 1
|
338
464
|
if result.get("success", False):
|
339
465
|
self.perf_stats["successful_benchmarks"] += 1
|
340
466
|
else:
|
@@ -1514,7 +1640,7 @@ class PerformanceBenchmarkNode(SecurityMixin, PerformanceMixin, LoggingMixin, No
|
|
1514
1640
|
}
|
1515
1641
|
|
1516
1642
|
try:
|
1517
|
-
self.security_event_node.
|
1643
|
+
self.security_event_node.execute(**security_event)
|
1518
1644
|
except Exception as e:
|
1519
1645
|
self.log_with_context("WARNING", f"Failed to log performance alert: {e}")
|
1520
1646
|
|
kailash/nodes/rag/advanced.py
CHANGED
@@ -255,7 +255,7 @@ Respond with JSON only:
|
|
255
255
|
)
|
256
256
|
|
257
257
|
try:
|
258
|
-
verification_response = self.verifier_agent.
|
258
|
+
verification_response = self.verifier_agent.execute(
|
259
259
|
messages=[{"role": "user", "content": verification_input}]
|
260
260
|
)
|
261
261
|
|
@@ -447,7 +447,7 @@ class RAGFusionNode(Node):
|
|
447
447
|
# - "tuning neural network hyperparameters"
|
448
448
|
# - "neural network training optimization"
|
449
449
|
|
450
|
-
result = await rag_fusion.
|
450
|
+
result = await rag_fusion.execute(
|
451
451
|
documents=documents,
|
452
452
|
query="How to optimize neural networks"
|
453
453
|
)
|
@@ -628,7 +628,7 @@ Original Query: {original_query}
|
|
628
628
|
Generate {self.num_query_variations} high-quality variations that will improve retrieval coverage:
|
629
629
|
"""
|
630
630
|
|
631
|
-
response = self.query_generator.
|
631
|
+
response = self.query_generator.execute(
|
632
632
|
messages=[{"role": "user", "content": generation_input}]
|
633
633
|
)
|
634
634
|
|
@@ -919,7 +919,7 @@ class HyDENode(Node):
|
|
919
919
|
# 3. "Cryptographic systems must evolve to be quantum-resistant..."
|
920
920
|
# Then retrieves documents similar to these hypotheses
|
921
921
|
|
922
|
-
result = await hyde.
|
922
|
+
result = await hyde.execute(
|
923
923
|
documents=documents,
|
924
924
|
query="What are the implications of quantum computing for cryptography?"
|
925
925
|
)
|
@@ -1077,7 +1077,7 @@ Query: {query}
|
|
1077
1077
|
Generate {self.num_hypotheses if self.use_multiple_hypotheses else 1} detailed hypothetical answer(s) that could help find relevant documents:
|
1078
1078
|
"""
|
1079
1079
|
|
1080
|
-
response = self.hypothesis_generator.
|
1080
|
+
response = self.hypothesis_generator.execute(
|
1081
1081
|
messages=[{"role": "user", "content": hypothesis_input}]
|
1082
1082
|
)
|
1083
1083
|
|
@@ -1250,7 +1250,7 @@ class StepBackRAGNode(Node):
|
|
1250
1250
|
# - Abstract docs about normalization concepts
|
1251
1251
|
# Combines both for comprehensive answer
|
1252
1252
|
|
1253
|
-
result = await step_back.
|
1253
|
+
result = await step_back.execute(
|
1254
1254
|
documents=documents,
|
1255
1255
|
query="Why does batch normalization help neural networks?"
|
1256
1256
|
)
|
@@ -1394,7 +1394,7 @@ Specific Query: {specific_query}
|
|
1394
1394
|
Generate a broader, more abstract version that would help retrieve relevant background information:
|
1395
1395
|
"""
|
1396
1396
|
|
1397
|
-
response = self.abstraction_generator.
|
1397
|
+
response = self.abstraction_generator.execute(
|
1398
1398
|
messages=[{"role": "user", "content": abstraction_input}]
|
1399
1399
|
)
|
1400
1400
|
|
kailash/nodes/rag/agentic.py
CHANGED
@@ -62,7 +62,7 @@ class AgenticRAGNode(WorkflowNode):
|
|
62
62
|
# 4. Use calculator for growth calculations
|
63
63
|
# 5. Synthesize findings with citations
|
64
64
|
|
65
|
-
result = await agentic_rag.
|
65
|
+
result = await agentic_rag.execute(
|
66
66
|
documents=financial_docs,
|
67
67
|
query="Compare the revenue growth of tech companies in 2023 vs 2022"
|
68
68
|
)
|
@@ -219,7 +219,54 @@ def execute_tool(action_string, documents, context):
|
|
219
219
|
"sum": sum, "len": len, "pow": pow
|
220
220
|
})
|
221
221
|
|
222
|
-
|
222
|
+
# Enterprise security: Use ast.literal_eval for safe mathematical expressions
|
223
|
+
import ast
|
224
|
+
try:
|
225
|
+
# Try ast.literal_eval first for simple mathematical expressions
|
226
|
+
result = ast.literal_eval(params)
|
227
|
+
except (ValueError, SyntaxError):
|
228
|
+
# Fallback to safe mathematical evaluation
|
229
|
+
import operator
|
230
|
+
import math
|
231
|
+
|
232
|
+
# Define safe operators and functions
|
233
|
+
safe_ops = {
|
234
|
+
'+': operator.add,
|
235
|
+
'-': operator.sub,
|
236
|
+
'*': operator.mul,
|
237
|
+
'/': operator.truediv,
|
238
|
+
'**': operator.pow,
|
239
|
+
'abs': abs,
|
240
|
+
'max': max,
|
241
|
+
'min': min,
|
242
|
+
'round': round,
|
243
|
+
'sqrt': math.sqrt,
|
244
|
+
'sin': math.sin,
|
245
|
+
'cos': math.cos,
|
246
|
+
'tan': math.tan,
|
247
|
+
'log': math.log,
|
248
|
+
'exp': math.exp,
|
249
|
+
'pi': math.pi,
|
250
|
+
'e': math.e,
|
251
|
+
}
|
252
|
+
safe_ops.update(safe_dict)
|
253
|
+
|
254
|
+
# Parse and evaluate safely
|
255
|
+
try:
|
256
|
+
# Simple expression parser for basic math
|
257
|
+
import re
|
258
|
+
# Replace function calls and operators with safe alternatives
|
259
|
+
safe_expr = params
|
260
|
+
for func in ['sqrt', 'sin', 'cos', 'tan', 'log', 'exp']:
|
261
|
+
safe_expr = re.sub(rf'\b{func}\(([^)]+)\)', rf'safe_ops["{func}"](\1)', safe_expr)
|
262
|
+
|
263
|
+
# Only evaluate if it's a simple mathematical expression
|
264
|
+
if re.match(r'^[0-9+\-*/.() \w]+$', safe_expr.replace('safe_ops', '')):
|
265
|
+
result = eval(safe_expr, {"__builtins__": {}}, {"safe_ops": safe_ops})
|
266
|
+
else:
|
267
|
+
result = f"Cannot evaluate complex expression: {params}"
|
268
|
+
except:
|
269
|
+
result = f"Invalid mathematical expression: {params}"
|
223
270
|
results = {
|
224
271
|
"tool": "calculate",
|
225
272
|
"expression": params,
|
@@ -62,19 +62,19 @@ class ConversationalRAGNode(WorkflowNode):
|
|
62
62
|
session = await conv_rag.create_session(user_id="user123")
|
63
63
|
|
64
64
|
# First turn
|
65
|
-
response1 = await conv_rag.
|
65
|
+
response1 = await conv_rag.execute(
|
66
66
|
query="What is transformer architecture?",
|
67
67
|
session_id=session.id
|
68
68
|
)
|
69
69
|
|
70
70
|
# Follow-up with context
|
71
|
-
response2 = await conv_rag.
|
71
|
+
response2 = await conv_rag.execute(
|
72
72
|
query="How does its attention mechanism work?", # "its" refers to transformer
|
73
73
|
session_id=session.id
|
74
74
|
)
|
75
75
|
|
76
76
|
# Topic switch with smooth transition
|
77
|
-
response3 = await conv_rag.
|
77
|
+
response3 = await conv_rag.execute(
|
78
78
|
query="Now tell me about BERT",
|
79
79
|
session_id=session.id
|
80
80
|
)
|
kailash/nodes/rag/evaluation.py
CHANGED
@@ -57,7 +57,7 @@ class RAGEvaluationNode(WorkflowNode):
|
|
57
57
|
)
|
58
58
|
|
59
59
|
# Evaluate a RAG system
|
60
|
-
results = await evaluator.
|
60
|
+
results = await evaluator.execute(
|
61
61
|
test_queries=[
|
62
62
|
{"query": "What is transformer architecture?",
|
63
63
|
"reference": "Transformers use self-attention..."},
|
@@ -461,7 +461,7 @@ class RAGBenchmarkNode(Node):
|
|
461
461
|
concurrent_users=[1, 5, 10]
|
462
462
|
)
|
463
463
|
|
464
|
-
results = await benchmark.
|
464
|
+
results = await benchmark.execute(
|
465
465
|
rag_systems={"system_a": rag_a, "system_b": rag_b},
|
466
466
|
test_queries=queries
|
467
467
|
)
|
@@ -674,7 +674,7 @@ class TestDatasetGeneratorNode(Node):
|
|
674
674
|
difficulty_levels=["easy", "medium", "hard"]
|
675
675
|
)
|
676
676
|
|
677
|
-
dataset = generator.
|
677
|
+
dataset = generator.execute(
|
678
678
|
num_samples=100,
|
679
679
|
domain="machine learning"
|
680
680
|
)
|
kailash/nodes/rag/federated.py
CHANGED
@@ -60,7 +60,7 @@ class FederatedRAGNode(WorkflowNode):
|
|
60
60
|
)
|
61
61
|
|
62
62
|
# Query across all federated sources
|
63
|
-
result = await federated_rag.
|
63
|
+
result = await federated_rag.execute(
|
64
64
|
query="Latest treatment protocols for condition X",
|
65
65
|
node_endpoints={
|
66
66
|
"hospital_a": "https://hospitalA.api/rag",
|
@@ -598,7 +598,7 @@ class EdgeRAGNode(Node):
|
|
598
598
|
update_strategy="incremental"
|
599
599
|
)
|
600
600
|
|
601
|
-
result = await edge_rag.
|
601
|
+
result = await edge_rag.execute(
|
602
602
|
query="Local sensor anomaly detection",
|
603
603
|
local_data=sensor_readings,
|
604
604
|
sync_with_cloud=False
|
@@ -848,7 +848,7 @@ class CrossSiloRAGNode(Node):
|
|
848
848
|
audit_mode="comprehensive"
|
849
849
|
)
|
850
850
|
|
851
|
-
result = await cross_silo_rag.
|
851
|
+
result = await cross_silo_rag.execute(
|
852
852
|
query="Industry-wide trend analysis",
|
853
853
|
requester_org="org_a",
|
854
854
|
access_permissions=["read_aggregated", "no_raw_data"]
|
kailash/nodes/rag/graph.py
CHANGED
@@ -60,7 +60,7 @@ class GraphRAGNode(WorkflowNode):
|
|
60
60
|
# 3. Traverse graph to find influence paths
|
61
61
|
# 4. Synthesize multi-hop connections
|
62
62
|
|
63
|
-
result = await graph_rag.
|
63
|
+
result = await graph_rag.execute(
|
64
64
|
documents=research_papers,
|
65
65
|
query="How did key researchers influence the development of transformers?"
|
66
66
|
)
|
@@ -474,7 +474,7 @@ class GraphBuilderNode(Node):
|
|
474
474
|
similarity_threshold=0.85
|
475
475
|
)
|
476
476
|
|
477
|
-
graph = await builder.
|
477
|
+
graph = await builder.execute(
|
478
478
|
documents=documents,
|
479
479
|
existing_graph=previous_graph # Optional: update existing
|
480
480
|
)
|
@@ -599,7 +599,7 @@ class GraphQueryNode(Node):
|
|
599
599
|
querier = GraphQueryNode()
|
600
600
|
|
601
601
|
# Find influence paths
|
602
|
-
result = await querier.
|
602
|
+
result = await querier.execute(
|
603
603
|
graph=knowledge_graph,
|
604
604
|
query_type="path",
|
605
605
|
source_entity="BERT",
|
kailash/nodes/rag/multimodal.py
CHANGED
@@ -62,7 +62,7 @@ class MultimodalRAGNode(WorkflowNode):
|
|
62
62
|
# 3. Code implementations with visual outputs
|
63
63
|
# 4. Combine into comprehensive answer with images
|
64
64
|
|
65
|
-
result = await multimodal_rag.
|
65
|
+
result = await multimodal_rag.execute(
|
66
66
|
documents=mixed_media_docs, # Contains text and image paths
|
67
67
|
query="Show me the architecture diagram for transformers"
|
68
68
|
)
|
@@ -446,7 +446,7 @@ class VisualQuestionAnsweringNode(Node):
|
|
446
446
|
Example:
|
447
447
|
vqa = VisualQuestionAnsweringNode()
|
448
448
|
|
449
|
-
result = await vqa.
|
449
|
+
result = await vqa.execute(
|
450
450
|
image_path="architecture_diagram.png",
|
451
451
|
question="What components are shown in this diagram?"
|
452
452
|
)
|
@@ -569,7 +569,7 @@ class ImageTextMatchingNode(Node):
|
|
569
569
|
Example:
|
570
570
|
matcher = ImageTextMatchingNode()
|
571
571
|
|
572
|
-
matches = await matcher.
|
572
|
+
matches = await matcher.execute(
|
573
573
|
query="neural network architecture",
|
574
574
|
image_collection=image_database
|
575
575
|
)
|
kailash/nodes/rag/optimized.py
CHANGED
@@ -57,13 +57,13 @@ class CacheOptimizedRAGNode(WorkflowNode):
|
|
57
57
|
)
|
58
58
|
|
59
59
|
# First query: ~500ms (goes to retrieval)
|
60
|
-
result1 = await cached_rag.
|
60
|
+
result1 = await cached_rag.execute(query="What is deep learning?")
|
61
61
|
|
62
62
|
# Exact match: ~10ms (from cache)
|
63
|
-
result2 = await cached_rag.
|
63
|
+
result2 = await cached_rag.execute(query="What is deep learning?")
|
64
64
|
|
65
65
|
# Similar query: ~15ms (semantic cache)
|
66
|
-
result3 = await cached_rag.
|
66
|
+
result3 = await cached_rag.execute(query="Explain deep learning")
|
67
67
|
|
68
68
|
Parameters:
|
69
69
|
cache_ttl: Time-to-live in seconds
|
@@ -306,7 +306,7 @@ class AsyncParallelRAGNode(WorkflowNode):
|
|
306
306
|
)
|
307
307
|
|
308
308
|
# Runs all 4 strategies in parallel, takes time of slowest
|
309
|
-
result = await parallel_rag.
|
309
|
+
result = await parallel_rag.execute(
|
310
310
|
documents=documents,
|
311
311
|
query="Complex technical question requiring precision"
|
312
312
|
)
|
@@ -700,7 +700,7 @@ class BatchOptimizedRAGNode(WorkflowNode):
|
|
700
700
|
# Process 100 queries efficiently
|
701
701
|
queries = ["query1", "query2", ..., "query100"]
|
702
702
|
|
703
|
-
results = await batch_rag.
|
703
|
+
results = await batch_rag.execute(
|
704
704
|
queries=queries,
|
705
705
|
documents=documents
|
706
706
|
)
|
kailash/nodes/rag/privacy.py
CHANGED
@@ -58,7 +58,7 @@ class PrivacyPreservingRAGNode(WorkflowNode):
|
|
58
58
|
)
|
59
59
|
|
60
60
|
# Query with sensitive information
|
61
|
-
result = await private_rag.
|
61
|
+
result = await private_rag.execute(
|
62
62
|
query="What is John Smith's diagnosis based on symptoms X, Y, Z?",
|
63
63
|
documents=medical_records,
|
64
64
|
user_consent={"data_usage": True, "retention_days": 7}
|
@@ -608,7 +608,7 @@ class SecureMultiPartyRAGNode(Node):
|
|
608
608
|
)
|
609
609
|
|
610
610
|
# Each party contributes encrypted data
|
611
|
-
result = await smpc_rag.
|
611
|
+
result = await smpc_rag.execute(
|
612
612
|
query="Average treatment success rate",
|
613
613
|
party_data={
|
614
614
|
"hospital_a": encrypted_data_a,
|
@@ -800,7 +800,7 @@ class ComplianceRAGNode(Node):
|
|
800
800
|
default_retention_days=30
|
801
801
|
)
|
802
802
|
|
803
|
-
result = await compliance_rag.
|
803
|
+
result = await compliance_rag.execute(
|
804
804
|
query="Patient symptoms analysis",
|
805
805
|
user_consent={
|
806
806
|
"purpose": "medical_diagnosis",
|
@@ -56,7 +56,7 @@ class QueryExpansionNode(Node):
|
|
56
56
|
# - "deep learning optimization"
|
57
57
|
# - "AI optimization techniques"
|
58
58
|
|
59
|
-
expanded = await expander.
|
59
|
+
expanded = await expander.execute(query="ML optimization")
|
60
60
|
|
61
61
|
Parameters:
|
62
62
|
expansion_method: Algorithm (llm, wordnet, custom)
|
@@ -236,7 +236,7 @@ class QueryDecompositionNode(Node):
|
|
236
236
|
# 4. "How are CNNs used in vision?"
|
237
237
|
# 5. "What are the key differences?"
|
238
238
|
|
239
|
-
plan = await decomposer.
|
239
|
+
plan = await decomposer.execute(
|
240
240
|
query="Compare transformer and CNN architectures for NLP and vision"
|
241
241
|
)
|
242
242
|
|
@@ -426,7 +426,7 @@ class QueryRewritingNode(Node):
|
|
426
426
|
# technical: "neural network training process Keras implementation"
|
427
427
|
# simplified: "train neural network keras"
|
428
428
|
|
429
|
-
rewritten = await rewriter.
|
429
|
+
rewritten = await rewriter.execute(
|
430
430
|
query="how 2 trian nueral netwrk wit keras"
|
431
431
|
)
|
432
432
|
|
@@ -656,7 +656,7 @@ class QueryIntentClassifierNode(Node):
|
|
656
656
|
# requirements: ["needs_examples", "needs_code"]
|
657
657
|
# recommended_strategy: "statistical"
|
658
658
|
|
659
|
-
intent = await classifier.
|
659
|
+
intent = await classifier.execute(
|
660
660
|
query="Show me Python code to implement gradient descent"
|
661
661
|
)
|
662
662
|
|
@@ -924,7 +924,7 @@ class MultiHopQueryPlannerNode(Node):
|
|
924
924
|
# Hop 3: "What BERT innovations are used in modern models?"
|
925
925
|
# Hop 4: "How do modern models improve on BERT?"
|
926
926
|
|
927
|
-
plan = await planner.
|
927
|
+
plan = await planner.execute(
|
928
928
|
query="How has BERT influenced modern NLP architectures?"
|
929
929
|
)
|
930
930
|
|
@@ -1179,7 +1179,7 @@ class AdaptiveQueryProcessorNode(Node):
|
|
1179
1179
|
# - Decomposition (if complex)
|
1180
1180
|
# - Multi-hop planning (if required)
|
1181
1181
|
|
1182
|
-
optimized = await processor.
|
1182
|
+
optimized = await processor.execute(
|
1183
1183
|
query="compair transfomer vs lstm for sequnce tasks"
|
1184
1184
|
)
|
1185
1185
|
# Corrects spelling, decomposes comparison, plans retrieval
|
kailash/nodes/rag/realtime.py
CHANGED
kailash/nodes/rag/registry.py
CHANGED
@@ -8,11 +8,7 @@ Provides a unified interface for users to find the right RAG approach.
|
|
8
8
|
import logging
|
9
9
|
from typing import Any, Dict, List, Optional, Type
|
10
10
|
|
11
|
-
from .router import
|
12
|
-
RAGPerformanceMonitorNode,
|
13
|
-
RAGQualityAnalyzerNode,
|
14
|
-
RAGStrategyRouterNode,
|
15
|
-
)
|
11
|
+
from .router import RAGPerformanceMonitorNode, RAGQualityAnalyzerNode, RAGStrategyRouterNode
|
16
12
|
from .strategies import (
|
17
13
|
HierarchicalRAGNode,
|
18
14
|
HybridRAGNode,
|
@@ -448,7 +444,7 @@ performance_monitor = registry.create_utility("performance_monitor")
|
|
448
444
|
```python
|
449
445
|
# Use strategy directly
|
450
446
|
semantic_rag = registry.create_strategy("semantic")
|
451
|
-
result = semantic_rag.
|
447
|
+
result = semantic_rag.execute(documents=docs, operation="index")
|
452
448
|
```
|
453
449
|
|
454
450
|
### In Workflows:
|