|
1 | | -#V06262026 |
| 1 | +#V06272026 |
2 | 2 | # ============================================================================= |
3 | 3 | # Chaos AI-OS Paradox Oscillation Layer (CPOL with gating and modes). |
4 | 4 | # Copyright (c) 2025 Jonathan Schack (EL_Xaber) jon@cai-os.com |
|
60 | 60 | from typing import Dict, Any, List, Optional |
61 | 61 | from datetime import datetime, timezone |
62 | 62 |
|
| 63 | +# ============================================================================= |
| 64 | +# OPTIONAL KB INTEGRATION |
| 65 | +# ============================================================================= |
| 66 | +try: |
| 67 | + import knowledge_base as kb |
| 68 | + KB_AVAILABLE = True |
| 69 | +except ImportError: |
| 70 | + KB_AVAILABLE = False |
| 71 | + print("[INFO] knowledge_base not available. Running without KB persistence.") |
| 72 | + |
63 | 73 | # ============================================================================= |
64 | 74 | # UTILITY FUNCTIONS |
65 | 75 | # ============================================================================= |
@@ -311,12 +321,21 @@ def _extract_domain(self, text: str) -> str: |
311 | 321 | if any(re.search(r'\b' + kw + r'\b', text_lower) for kw in keywords): |
312 | 322 | return domain |
313 | 323 |
|
314 | | - # Extract noun phrases as potential new domain |
315 | | - words = text_lower.split() |
316 | | - if len(words) > 2: |
317 | | - return words[0] # First word as proxy |
| 324 | + # If no domain matches, return "general" (orchestrator will override in full system) |
318 | 325 | return "general" |
319 | 326 |
|
| 327 | +# ========================================================================= |
| 328 | +# UNCOMMENT BELOW FOR ORCHESTRATOR INTEGRATION: |
| 329 | +# The full CAIOS orchestrator overrides this with LLM-based domain |
| 330 | +# classification. The first-word proxy is a placeholder for that flow. |
| 331 | +# ========================================================================= |
| 332 | +# |
| 333 | +# # Extract noun phrases as potential new domain |
| 334 | +# words = text_lower.split() |
| 335 | +# if len(words) > 2: |
| 336 | +# return words[0] # First word as proxy |
| 337 | +# return "general" |
| 338 | + |
320 | 339 | def _score_evidence(self, text: str) -> float: |
321 | 340 | """Score query for factual evidence/grounding.""" |
322 | 341 | text_lower = text.lower() |
@@ -656,7 +675,6 @@ def run_cpol_chatbot(query_text: str, |
656 | 675 | shared_mem = session_state if session_state else {'distress_density': 0.0} |
657 | 676 | result = kernel.run_cpol_decision( |
658 | 677 | contradiction_density=density, |
659 | | - kernel=kernel, |
660 | 678 | query_text=query_text, |
661 | 679 | shared_memory=shared_mem |
662 | 680 | ) |
|
0 commit comments