empathy-framework 2.4.0__py3-none-any.whl → 3.8.2__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.
- coach_wizards/__init__.py +13 -12
- coach_wizards/accessibility_wizard.py +12 -12
- coach_wizards/api_wizard.py +12 -12
- coach_wizards/base_wizard.py +26 -20
- coach_wizards/cicd_wizard.py +15 -13
- coach_wizards/code_reviewer_README.md +60 -0
- coach_wizards/code_reviewer_wizard.py +180 -0
- coach_wizards/compliance_wizard.py +12 -12
- coach_wizards/database_wizard.py +12 -12
- coach_wizards/debugging_wizard.py +12 -12
- coach_wizards/documentation_wizard.py +12 -12
- coach_wizards/generate_wizards.py +1 -2
- coach_wizards/localization_wizard.py +101 -19
- coach_wizards/migration_wizard.py +12 -12
- coach_wizards/monitoring_wizard.py +12 -12
- coach_wizards/observability_wizard.py +12 -12
- coach_wizards/performance_wizard.py +12 -12
- coach_wizards/prompt_engineering_wizard.py +661 -0
- coach_wizards/refactoring_wizard.py +12 -12
- coach_wizards/scaling_wizard.py +12 -12
- coach_wizards/security_wizard.py +12 -12
- coach_wizards/testing_wizard.py +12 -12
- empathy_framework-3.8.2.dist-info/METADATA +1176 -0
- empathy_framework-3.8.2.dist-info/RECORD +333 -0
- empathy_framework-3.8.2.dist-info/entry_points.txt +22 -0
- {empathy_framework-2.4.0.dist-info → empathy_framework-3.8.2.dist-info}/top_level.txt +5 -1
- empathy_healthcare_plugin/__init__.py +1 -2
- empathy_healthcare_plugin/monitors/__init__.py +9 -0
- empathy_healthcare_plugin/monitors/clinical_protocol_monitor.py +315 -0
- empathy_healthcare_plugin/monitors/monitoring/__init__.py +44 -0
- empathy_healthcare_plugin/monitors/monitoring/protocol_checker.py +300 -0
- empathy_healthcare_plugin/monitors/monitoring/protocol_loader.py +214 -0
- empathy_healthcare_plugin/monitors/monitoring/sensor_parsers.py +306 -0
- empathy_healthcare_plugin/monitors/monitoring/trajectory_analyzer.py +389 -0
- empathy_llm_toolkit/__init__.py +7 -7
- empathy_llm_toolkit/agent_factory/__init__.py +53 -0
- empathy_llm_toolkit/agent_factory/adapters/__init__.py +85 -0
- empathy_llm_toolkit/agent_factory/adapters/autogen_adapter.py +312 -0
- empathy_llm_toolkit/agent_factory/adapters/crewai_adapter.py +454 -0
- empathy_llm_toolkit/agent_factory/adapters/haystack_adapter.py +298 -0
- empathy_llm_toolkit/agent_factory/adapters/langchain_adapter.py +362 -0
- empathy_llm_toolkit/agent_factory/adapters/langgraph_adapter.py +333 -0
- empathy_llm_toolkit/agent_factory/adapters/native.py +228 -0
- empathy_llm_toolkit/agent_factory/adapters/wizard_adapter.py +426 -0
- empathy_llm_toolkit/agent_factory/base.py +305 -0
- empathy_llm_toolkit/agent_factory/crews/__init__.py +67 -0
- empathy_llm_toolkit/agent_factory/crews/code_review.py +1113 -0
- empathy_llm_toolkit/agent_factory/crews/health_check.py +1246 -0
- empathy_llm_toolkit/agent_factory/crews/refactoring.py +1128 -0
- empathy_llm_toolkit/agent_factory/crews/security_audit.py +1018 -0
- empathy_llm_toolkit/agent_factory/decorators.py +286 -0
- empathy_llm_toolkit/agent_factory/factory.py +558 -0
- empathy_llm_toolkit/agent_factory/framework.py +192 -0
- empathy_llm_toolkit/agent_factory/memory_integration.py +324 -0
- empathy_llm_toolkit/agent_factory/resilient.py +320 -0
- empathy_llm_toolkit/claude_memory.py +14 -15
- empathy_llm_toolkit/cli/__init__.py +8 -0
- empathy_llm_toolkit/cli/sync_claude.py +487 -0
- empathy_llm_toolkit/code_health.py +186 -28
- empathy_llm_toolkit/config/__init__.py +29 -0
- empathy_llm_toolkit/config/unified.py +295 -0
- empathy_llm_toolkit/contextual_patterns.py +11 -12
- empathy_llm_toolkit/core.py +168 -53
- empathy_llm_toolkit/git_pattern_extractor.py +17 -13
- empathy_llm_toolkit/levels.py +6 -13
- empathy_llm_toolkit/pattern_confidence.py +14 -18
- empathy_llm_toolkit/pattern_resolver.py +10 -12
- empathy_llm_toolkit/pattern_summary.py +16 -14
- empathy_llm_toolkit/providers.py +194 -28
- empathy_llm_toolkit/routing/__init__.py +32 -0
- empathy_llm_toolkit/routing/model_router.py +362 -0
- empathy_llm_toolkit/security/IMPLEMENTATION_SUMMARY.md +413 -0
- empathy_llm_toolkit/security/PHASE2_COMPLETE.md +384 -0
- empathy_llm_toolkit/security/PHASE2_SECRETS_DETECTOR_COMPLETE.md +271 -0
- empathy_llm_toolkit/security/QUICK_REFERENCE.md +316 -0
- empathy_llm_toolkit/security/README.md +262 -0
- empathy_llm_toolkit/security/__init__.py +62 -0
- empathy_llm_toolkit/security/audit_logger.py +929 -0
- empathy_llm_toolkit/security/audit_logger_example.py +152 -0
- empathy_llm_toolkit/security/pii_scrubber.py +640 -0
- empathy_llm_toolkit/security/secrets_detector.py +678 -0
- empathy_llm_toolkit/security/secrets_detector_example.py +304 -0
- empathy_llm_toolkit/security/secure_memdocs.py +1192 -0
- empathy_llm_toolkit/security/secure_memdocs_example.py +278 -0
- empathy_llm_toolkit/session_status.py +20 -22
- empathy_llm_toolkit/state.py +28 -21
- empathy_llm_toolkit/wizards/__init__.py +38 -0
- empathy_llm_toolkit/wizards/base_wizard.py +364 -0
- empathy_llm_toolkit/wizards/customer_support_wizard.py +190 -0
- empathy_llm_toolkit/wizards/healthcare_wizard.py +362 -0
- empathy_llm_toolkit/wizards/patient_assessment_README.md +64 -0
- empathy_llm_toolkit/wizards/patient_assessment_wizard.py +193 -0
- empathy_llm_toolkit/wizards/technology_wizard.py +194 -0
- empathy_os/__init__.py +125 -84
- empathy_os/adaptive/__init__.py +13 -0
- empathy_os/adaptive/task_complexity.py +127 -0
- empathy_os/{monitoring.py → agent_monitoring.py} +28 -28
- empathy_os/cache/__init__.py +117 -0
- empathy_os/cache/base.py +166 -0
- empathy_os/cache/dependency_manager.py +253 -0
- empathy_os/cache/hash_only.py +248 -0
- empathy_os/cache/hybrid.py +390 -0
- empathy_os/cache/storage.py +282 -0
- empathy_os/cli.py +1516 -70
- empathy_os/cli_unified.py +597 -0
- empathy_os/config/__init__.py +63 -0
- empathy_os/config/xml_config.py +239 -0
- empathy_os/config.py +95 -37
- empathy_os/coordination.py +72 -68
- empathy_os/core.py +94 -107
- empathy_os/cost_tracker.py +74 -55
- empathy_os/dashboard/__init__.py +15 -0
- empathy_os/dashboard/server.py +743 -0
- empathy_os/discovery.py +17 -14
- empathy_os/emergence.py +21 -22
- empathy_os/exceptions.py +18 -30
- empathy_os/feedback_loops.py +30 -33
- empathy_os/levels.py +32 -35
- empathy_os/leverage_points.py +31 -32
- empathy_os/logging_config.py +19 -16
- empathy_os/memory/__init__.py +195 -0
- empathy_os/memory/claude_memory.py +466 -0
- empathy_os/memory/config.py +224 -0
- empathy_os/memory/control_panel.py +1298 -0
- empathy_os/memory/edges.py +179 -0
- empathy_os/memory/graph.py +567 -0
- empathy_os/memory/long_term.py +1194 -0
- empathy_os/memory/nodes.py +179 -0
- empathy_os/memory/redis_bootstrap.py +540 -0
- empathy_os/memory/security/__init__.py +31 -0
- empathy_os/memory/security/audit_logger.py +930 -0
- empathy_os/memory/security/pii_scrubber.py +640 -0
- empathy_os/memory/security/secrets_detector.py +678 -0
- empathy_os/memory/short_term.py +2119 -0
- empathy_os/memory/storage/__init__.py +15 -0
- empathy_os/memory/summary_index.py +583 -0
- empathy_os/memory/unified.py +619 -0
- empathy_os/metrics/__init__.py +12 -0
- empathy_os/metrics/prompt_metrics.py +190 -0
- empathy_os/models/__init__.py +136 -0
- empathy_os/models/__main__.py +13 -0
- empathy_os/models/cli.py +655 -0
- empathy_os/models/empathy_executor.py +354 -0
- empathy_os/models/executor.py +252 -0
- empathy_os/models/fallback.py +671 -0
- empathy_os/models/provider_config.py +563 -0
- empathy_os/models/registry.py +382 -0
- empathy_os/models/tasks.py +302 -0
- empathy_os/models/telemetry.py +548 -0
- empathy_os/models/token_estimator.py +378 -0
- empathy_os/models/validation.py +274 -0
- empathy_os/monitoring/__init__.py +52 -0
- empathy_os/monitoring/alerts.py +23 -0
- empathy_os/monitoring/alerts_cli.py +268 -0
- empathy_os/monitoring/multi_backend.py +271 -0
- empathy_os/monitoring/otel_backend.py +363 -0
- empathy_os/optimization/__init__.py +19 -0
- empathy_os/optimization/context_optimizer.py +272 -0
- empathy_os/pattern_library.py +30 -29
- empathy_os/persistence.py +35 -37
- empathy_os/platform_utils.py +261 -0
- empathy_os/plugins/__init__.py +28 -0
- empathy_os/plugins/base.py +361 -0
- empathy_os/plugins/registry.py +268 -0
- empathy_os/project_index/__init__.py +30 -0
- empathy_os/project_index/cli.py +335 -0
- empathy_os/project_index/crew_integration.py +430 -0
- empathy_os/project_index/index.py +425 -0
- empathy_os/project_index/models.py +501 -0
- empathy_os/project_index/reports.py +473 -0
- empathy_os/project_index/scanner.py +538 -0
- empathy_os/prompts/__init__.py +61 -0
- empathy_os/prompts/config.py +77 -0
- empathy_os/prompts/context.py +177 -0
- empathy_os/prompts/parser.py +285 -0
- empathy_os/prompts/registry.py +313 -0
- empathy_os/prompts/templates.py +208 -0
- empathy_os/redis_config.py +144 -58
- empathy_os/redis_memory.py +79 -77
- empathy_os/resilience/__init__.py +56 -0
- empathy_os/resilience/circuit_breaker.py +256 -0
- empathy_os/resilience/fallback.py +179 -0
- empathy_os/resilience/health.py +300 -0
- empathy_os/resilience/retry.py +209 -0
- empathy_os/resilience/timeout.py +135 -0
- empathy_os/routing/__init__.py +43 -0
- empathy_os/routing/chain_executor.py +433 -0
- empathy_os/routing/classifier.py +217 -0
- empathy_os/routing/smart_router.py +234 -0
- empathy_os/routing/wizard_registry.py +307 -0
- empathy_os/templates.py +19 -14
- empathy_os/trust/__init__.py +28 -0
- empathy_os/trust/circuit_breaker.py +579 -0
- empathy_os/trust_building.py +67 -58
- empathy_os/validation/__init__.py +19 -0
- empathy_os/validation/xml_validator.py +281 -0
- empathy_os/wizard_factory_cli.py +170 -0
- empathy_os/{workflows.py → workflow_commands.py} +131 -37
- empathy_os/workflows/__init__.py +360 -0
- empathy_os/workflows/base.py +1660 -0
- empathy_os/workflows/bug_predict.py +962 -0
- empathy_os/workflows/code_review.py +960 -0
- empathy_os/workflows/code_review_adapters.py +310 -0
- empathy_os/workflows/code_review_pipeline.py +720 -0
- empathy_os/workflows/config.py +600 -0
- empathy_os/workflows/dependency_check.py +648 -0
- empathy_os/workflows/document_gen.py +1069 -0
- empathy_os/workflows/documentation_orchestrator.py +1205 -0
- empathy_os/workflows/health_check.py +679 -0
- empathy_os/workflows/keyboard_shortcuts/__init__.py +39 -0
- empathy_os/workflows/keyboard_shortcuts/generators.py +386 -0
- empathy_os/workflows/keyboard_shortcuts/parsers.py +414 -0
- empathy_os/workflows/keyboard_shortcuts/prompts.py +295 -0
- empathy_os/workflows/keyboard_shortcuts/schema.py +193 -0
- empathy_os/workflows/keyboard_shortcuts/workflow.py +505 -0
- empathy_os/workflows/manage_documentation.py +804 -0
- empathy_os/workflows/new_sample_workflow1.py +146 -0
- empathy_os/workflows/new_sample_workflow1_README.md +150 -0
- empathy_os/workflows/perf_audit.py +687 -0
- empathy_os/workflows/pr_review.py +748 -0
- empathy_os/workflows/progress.py +445 -0
- empathy_os/workflows/progress_server.py +322 -0
- empathy_os/workflows/refactor_plan.py +693 -0
- empathy_os/workflows/release_prep.py +808 -0
- empathy_os/workflows/research_synthesis.py +404 -0
- empathy_os/workflows/secure_release.py +585 -0
- empathy_os/workflows/security_adapters.py +297 -0
- empathy_os/workflows/security_audit.py +1046 -0
- empathy_os/workflows/step_config.py +234 -0
- empathy_os/workflows/test5.py +125 -0
- empathy_os/workflows/test5_README.md +158 -0
- empathy_os/workflows/test_gen.py +1855 -0
- empathy_os/workflows/test_lifecycle.py +526 -0
- empathy_os/workflows/test_maintenance.py +626 -0
- empathy_os/workflows/test_maintenance_cli.py +590 -0
- empathy_os/workflows/test_maintenance_crew.py +821 -0
- empathy_os/workflows/xml_enhanced_crew.py +285 -0
- empathy_software_plugin/__init__.py +1 -2
- empathy_software_plugin/cli/__init__.py +120 -0
- empathy_software_plugin/cli/inspect.py +362 -0
- empathy_software_plugin/cli.py +49 -27
- empathy_software_plugin/plugin.py +4 -8
- empathy_software_plugin/wizards/__init__.py +42 -0
- empathy_software_plugin/wizards/advanced_debugging_wizard.py +392 -0
- empathy_software_plugin/wizards/agent_orchestration_wizard.py +511 -0
- empathy_software_plugin/wizards/ai_collaboration_wizard.py +503 -0
- empathy_software_plugin/wizards/ai_context_wizard.py +441 -0
- empathy_software_plugin/wizards/ai_documentation_wizard.py +503 -0
- empathy_software_plugin/wizards/base_wizard.py +288 -0
- empathy_software_plugin/wizards/book_chapter_wizard.py +519 -0
- empathy_software_plugin/wizards/code_review_wizard.py +606 -0
- empathy_software_plugin/wizards/debugging/__init__.py +50 -0
- empathy_software_plugin/wizards/debugging/bug_risk_analyzer.py +414 -0
- empathy_software_plugin/wizards/debugging/config_loaders.py +442 -0
- empathy_software_plugin/wizards/debugging/fix_applier.py +469 -0
- empathy_software_plugin/wizards/debugging/language_patterns.py +383 -0
- empathy_software_plugin/wizards/debugging/linter_parsers.py +470 -0
- empathy_software_plugin/wizards/debugging/verification.py +369 -0
- empathy_software_plugin/wizards/enhanced_testing_wizard.py +537 -0
- empathy_software_plugin/wizards/memory_enhanced_debugging_wizard.py +816 -0
- empathy_software_plugin/wizards/multi_model_wizard.py +501 -0
- empathy_software_plugin/wizards/pattern_extraction_wizard.py +422 -0
- empathy_software_plugin/wizards/pattern_retriever_wizard.py +400 -0
- empathy_software_plugin/wizards/performance/__init__.py +9 -0
- empathy_software_plugin/wizards/performance/bottleneck_detector.py +221 -0
- empathy_software_plugin/wizards/performance/profiler_parsers.py +278 -0
- empathy_software_plugin/wizards/performance/trajectory_analyzer.py +429 -0
- empathy_software_plugin/wizards/performance_profiling_wizard.py +305 -0
- empathy_software_plugin/wizards/prompt_engineering_wizard.py +425 -0
- empathy_software_plugin/wizards/rag_pattern_wizard.py +461 -0
- empathy_software_plugin/wizards/security/__init__.py +32 -0
- empathy_software_plugin/wizards/security/exploit_analyzer.py +290 -0
- empathy_software_plugin/wizards/security/owasp_patterns.py +241 -0
- empathy_software_plugin/wizards/security/vulnerability_scanner.py +604 -0
- empathy_software_plugin/wizards/security_analysis_wizard.py +322 -0
- empathy_software_plugin/wizards/security_learning_wizard.py +740 -0
- empathy_software_plugin/wizards/tech_debt_wizard.py +726 -0
- empathy_software_plugin/wizards/testing/__init__.py +27 -0
- empathy_software_plugin/wizards/testing/coverage_analyzer.py +459 -0
- empathy_software_plugin/wizards/testing/quality_analyzer.py +531 -0
- empathy_software_plugin/wizards/testing/test_suggester.py +533 -0
- empathy_software_plugin/wizards/testing_wizard.py +274 -0
- hot_reload/README.md +473 -0
- hot_reload/__init__.py +62 -0
- hot_reload/config.py +84 -0
- hot_reload/integration.py +228 -0
- hot_reload/reloader.py +298 -0
- hot_reload/watcher.py +179 -0
- hot_reload/websocket.py +176 -0
- scaffolding/README.md +589 -0
- scaffolding/__init__.py +35 -0
- scaffolding/__main__.py +14 -0
- scaffolding/cli.py +240 -0
- test_generator/__init__.py +38 -0
- test_generator/__main__.py +14 -0
- test_generator/cli.py +226 -0
- test_generator/generator.py +325 -0
- test_generator/risk_analyzer.py +216 -0
- workflow_patterns/__init__.py +33 -0
- workflow_patterns/behavior.py +249 -0
- workflow_patterns/core.py +76 -0
- workflow_patterns/output.py +99 -0
- workflow_patterns/registry.py +255 -0
- workflow_patterns/structural.py +288 -0
- workflow_scaffolding/__init__.py +11 -0
- workflow_scaffolding/__main__.py +12 -0
- workflow_scaffolding/cli.py +206 -0
- workflow_scaffolding/generator.py +265 -0
- agents/code_inspection/patterns/inspection/recurring_B112.json +0 -18
- agents/code_inspection/patterns/inspection/recurring_F541.json +0 -16
- agents/code_inspection/patterns/inspection/recurring_FORMAT.json +0 -25
- agents/code_inspection/patterns/inspection/recurring_bug_20250822_def456.json +0 -16
- agents/code_inspection/patterns/inspection/recurring_bug_20250915_abc123.json +0 -16
- agents/code_inspection/patterns/inspection/recurring_bug_20251212_3c5b9951.json +0 -16
- agents/code_inspection/patterns/inspection/recurring_bug_20251212_97c0f72f.json +0 -16
- agents/code_inspection/patterns/inspection/recurring_bug_20251212_a0871d53.json +0 -16
- agents/code_inspection/patterns/inspection/recurring_bug_20251212_a9b6ec41.json +0 -16
- agents/code_inspection/patterns/inspection/recurring_bug_null_001.json +0 -16
- agents/code_inspection/patterns/inspection/recurring_builtin.json +0 -16
- agents/compliance_anticipation_agent.py +0 -1427
- agents/epic_integration_wizard.py +0 -541
- agents/trust_building_behaviors.py +0 -891
- empathy_framework-2.4.0.dist-info/METADATA +0 -485
- empathy_framework-2.4.0.dist-info/RECORD +0 -102
- empathy_framework-2.4.0.dist-info/entry_points.txt +0 -6
- empathy_llm_toolkit/htmlcov/status.json +0 -1
- empathy_llm_toolkit/security/htmlcov/status.json +0 -1
- {empathy_framework-2.4.0.dist-info → empathy_framework-3.8.2.dist-info}/WHEEL +0 -0
- {empathy_framework-2.4.0.dist-info → empathy_framework-3.8.2.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
"""Configuration system for XML-enhanced prompting features.
|
|
2
|
+
|
|
3
|
+
Provides feature flags and settings for all 6 XML enhancement options:
|
|
4
|
+
1. Workflow migration settings
|
|
5
|
+
2. XML schema validation
|
|
6
|
+
3. Prompt metrics tracking
|
|
7
|
+
4. Context window optimization
|
|
8
|
+
5. Dynamic prompt adaptation
|
|
9
|
+
6. Multi-language support
|
|
10
|
+
|
|
11
|
+
Copyright 2026 Smart-AI-Memory
|
|
12
|
+
Licensed under Fair Source License 0.9
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
import json
|
|
16
|
+
import os
|
|
17
|
+
from dataclasses import asdict, dataclass, field
|
|
18
|
+
from pathlib import Path
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
@dataclass
|
|
22
|
+
class XMLConfig:
|
|
23
|
+
"""XML prompting configuration.
|
|
24
|
+
|
|
25
|
+
Controls XML-enhanced prompt behavior and validation.
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
use_xml_structure: bool = True # Default to XML prompts
|
|
29
|
+
validate_schemas: bool = False # Feature flag for validation
|
|
30
|
+
schema_dir: str = ".empathy/schemas"
|
|
31
|
+
strict_validation: bool = False # Fail on validation errors
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
@dataclass
|
|
35
|
+
class OptimizationConfig:
|
|
36
|
+
"""Context window optimization configuration.
|
|
37
|
+
|
|
38
|
+
Controls prompt compression and token reduction strategies.
|
|
39
|
+
"""
|
|
40
|
+
|
|
41
|
+
compression_level: str = "moderate" # none, light, moderate, aggressive
|
|
42
|
+
use_short_tags: bool = True
|
|
43
|
+
strip_whitespace: bool = True
|
|
44
|
+
cache_system_prompts: bool = True
|
|
45
|
+
max_context_tokens: int = 8000
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
@dataclass
|
|
49
|
+
class AdaptiveConfig:
|
|
50
|
+
"""Adaptive prompting configuration.
|
|
51
|
+
|
|
52
|
+
Controls dynamic model tier and compression selection based on task complexity.
|
|
53
|
+
"""
|
|
54
|
+
|
|
55
|
+
enable_adaptation: bool = True
|
|
56
|
+
model_tier_mapping: dict[str, str] = field(
|
|
57
|
+
default_factory=lambda: {
|
|
58
|
+
"simple": "gpt-3.5-turbo",
|
|
59
|
+
"moderate": "gpt-4",
|
|
60
|
+
"complex": "gpt-4",
|
|
61
|
+
"very_complex": "gpt-4-turbo-preview",
|
|
62
|
+
}
|
|
63
|
+
)
|
|
64
|
+
complexity_thresholds: dict[str, int] = field(
|
|
65
|
+
default_factory=lambda: {
|
|
66
|
+
"simple_tokens": 100,
|
|
67
|
+
"moderate_tokens": 500,
|
|
68
|
+
"complex_tokens": 2000,
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
@dataclass
|
|
74
|
+
class I18nConfig:
|
|
75
|
+
"""Internationalization configuration.
|
|
76
|
+
|
|
77
|
+
Controls multi-language support for XML prompts.
|
|
78
|
+
"""
|
|
79
|
+
|
|
80
|
+
default_language: str = "en"
|
|
81
|
+
translate_tags: bool = False # Keep tags in English by default
|
|
82
|
+
translate_content: bool = True
|
|
83
|
+
fallback_to_english: bool = True
|
|
84
|
+
translation_dir: str = ".empathy/translations"
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
@dataclass
|
|
88
|
+
class MetricsConfig:
|
|
89
|
+
"""Metrics tracking configuration.
|
|
90
|
+
|
|
91
|
+
Controls prompt performance metrics collection and storage.
|
|
92
|
+
"""
|
|
93
|
+
|
|
94
|
+
enable_tracking: bool = True
|
|
95
|
+
metrics_file: str = ".empathy/prompt_metrics.json"
|
|
96
|
+
track_token_usage: bool = True
|
|
97
|
+
track_latency: bool = True
|
|
98
|
+
track_retries: bool = True
|
|
99
|
+
track_parsing_success: bool = True
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
@dataclass
|
|
103
|
+
class EmpathyXMLConfig:
|
|
104
|
+
"""Main Empathy XML enhancement configuration.
|
|
105
|
+
|
|
106
|
+
Combines all feature configurations with centralized management.
|
|
107
|
+
|
|
108
|
+
Usage:
|
|
109
|
+
config = EmpathyXMLConfig.load_from_file()
|
|
110
|
+
if config.xml.use_xml_structure:
|
|
111
|
+
use_xml_prompts()
|
|
112
|
+
|
|
113
|
+
# Or create custom config
|
|
114
|
+
config = EmpathyXMLConfig(
|
|
115
|
+
xml=XMLConfig(validate_schemas=True),
|
|
116
|
+
metrics=MetricsConfig(enable_tracking=True)
|
|
117
|
+
)
|
|
118
|
+
config.save_to_file()
|
|
119
|
+
"""
|
|
120
|
+
|
|
121
|
+
xml: XMLConfig = field(default_factory=XMLConfig)
|
|
122
|
+
optimization: OptimizationConfig = field(default_factory=OptimizationConfig)
|
|
123
|
+
adaptive: AdaptiveConfig = field(default_factory=AdaptiveConfig)
|
|
124
|
+
i18n: I18nConfig = field(default_factory=I18nConfig)
|
|
125
|
+
metrics: MetricsConfig = field(default_factory=MetricsConfig)
|
|
126
|
+
|
|
127
|
+
@classmethod
|
|
128
|
+
def load_from_file(cls, config_file: str = ".empathy/config.json") -> "EmpathyXMLConfig":
|
|
129
|
+
"""Load configuration from JSON file.
|
|
130
|
+
|
|
131
|
+
Args:
|
|
132
|
+
config_file: Path to config file (default: .empathy/config.json)
|
|
133
|
+
|
|
134
|
+
Returns:
|
|
135
|
+
EmpathyXMLConfig instance loaded from file, or default config if file doesn't exist
|
|
136
|
+
"""
|
|
137
|
+
path = Path(config_file)
|
|
138
|
+
|
|
139
|
+
if not path.exists():
|
|
140
|
+
# Return default config if file doesn't exist
|
|
141
|
+
return cls()
|
|
142
|
+
|
|
143
|
+
try:
|
|
144
|
+
with open(path) as f:
|
|
145
|
+
data = json.load(f)
|
|
146
|
+
|
|
147
|
+
# Reconstruct nested dataclasses
|
|
148
|
+
return cls(
|
|
149
|
+
xml=XMLConfig(**data.get("xml", {})),
|
|
150
|
+
optimization=OptimizationConfig(**data.get("optimization", {})),
|
|
151
|
+
adaptive=AdaptiveConfig(**data.get("adaptive", {})),
|
|
152
|
+
i18n=I18nConfig(**data.get("i18n", {})),
|
|
153
|
+
metrics=MetricsConfig(**data.get("metrics", {})),
|
|
154
|
+
)
|
|
155
|
+
except Exception as e:
|
|
156
|
+
# Return default config on error
|
|
157
|
+
print(f"Warning: Failed to load config from {config_file}: {e}")
|
|
158
|
+
return cls()
|
|
159
|
+
|
|
160
|
+
def save_to_file(self, config_file: str = ".empathy/config.json") -> None:
|
|
161
|
+
"""Save configuration to JSON file.
|
|
162
|
+
|
|
163
|
+
Args:
|
|
164
|
+
config_file: Path to save config (default: .empathy/config.json)
|
|
165
|
+
"""
|
|
166
|
+
path = Path(config_file)
|
|
167
|
+
path.parent.mkdir(parents=True, exist_ok=True)
|
|
168
|
+
|
|
169
|
+
data = {
|
|
170
|
+
"xml": asdict(self.xml),
|
|
171
|
+
"optimization": asdict(self.optimization),
|
|
172
|
+
"adaptive": asdict(self.adaptive),
|
|
173
|
+
"i18n": asdict(self.i18n),
|
|
174
|
+
"metrics": asdict(self.metrics),
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
with open(path, "w") as f:
|
|
178
|
+
json.dump(data, f, indent=2)
|
|
179
|
+
|
|
180
|
+
@classmethod
|
|
181
|
+
def from_env(cls) -> "EmpathyXMLConfig":
|
|
182
|
+
"""Load configuration from environment variables.
|
|
183
|
+
|
|
184
|
+
Environment variables:
|
|
185
|
+
EMPATHY_XML_ENABLED: Enable XML prompts (default: true)
|
|
186
|
+
EMPATHY_VALIDATION_ENABLED: Enable schema validation (default: false)
|
|
187
|
+
EMPATHY_METRICS_ENABLED: Enable metrics tracking (default: true)
|
|
188
|
+
EMPATHY_OPTIMIZATION_LEVEL: Compression level (default: moderate)
|
|
189
|
+
EMPATHY_ADAPTIVE_ENABLED: Enable adaptive prompts (default: true)
|
|
190
|
+
|
|
191
|
+
Returns:
|
|
192
|
+
EmpathyXMLConfig with settings from environment variables
|
|
193
|
+
"""
|
|
194
|
+
return cls(
|
|
195
|
+
xml=XMLConfig(
|
|
196
|
+
use_xml_structure=os.getenv("EMPATHY_XML_ENABLED", "true").lower() == "true",
|
|
197
|
+
validate_schemas=os.getenv("EMPATHY_VALIDATION_ENABLED", "false").lower() == "true",
|
|
198
|
+
),
|
|
199
|
+
optimization=OptimizationConfig(
|
|
200
|
+
compression_level=os.getenv("EMPATHY_OPTIMIZATION_LEVEL", "moderate"),
|
|
201
|
+
),
|
|
202
|
+
adaptive=AdaptiveConfig(
|
|
203
|
+
enable_adaptation=os.getenv("EMPATHY_ADAPTIVE_ENABLED", "true").lower() == "true",
|
|
204
|
+
),
|
|
205
|
+
metrics=MetricsConfig(
|
|
206
|
+
enable_tracking=os.getenv("EMPATHY_METRICS_ENABLED", "true").lower() == "true",
|
|
207
|
+
),
|
|
208
|
+
)
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
# Global default configuration instance
|
|
212
|
+
_global_config: EmpathyXMLConfig | None = None
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
def get_config() -> EmpathyXMLConfig:
|
|
216
|
+
"""Get global configuration instance.
|
|
217
|
+
|
|
218
|
+
Returns cached config or loads from file if not yet loaded.
|
|
219
|
+
|
|
220
|
+
Returns:
|
|
221
|
+
Global EmpathyXMLConfig instance
|
|
222
|
+
"""
|
|
223
|
+
global _global_config
|
|
224
|
+
|
|
225
|
+
if _global_config is None:
|
|
226
|
+
# Try to load from file, fall back to defaults
|
|
227
|
+
_global_config = EmpathyXMLConfig.load_from_file()
|
|
228
|
+
|
|
229
|
+
return _global_config
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
def set_config(config: EmpathyXMLConfig) -> None:
|
|
233
|
+
"""Set global configuration instance.
|
|
234
|
+
|
|
235
|
+
Args:
|
|
236
|
+
config: EmpathyXMLConfig to use globally
|
|
237
|
+
"""
|
|
238
|
+
global _global_config
|
|
239
|
+
_global_config = config
|
empathy_os/config.py
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Configuration Management for Empathy Framework
|
|
1
|
+
"""Configuration Management for Empathy Framework
|
|
3
2
|
|
|
4
3
|
Supports:
|
|
5
4
|
- YAML configuration files
|
|
@@ -24,11 +23,12 @@ try:
|
|
|
24
23
|
except ImportError:
|
|
25
24
|
YAML_AVAILABLE = False
|
|
26
25
|
|
|
26
|
+
from empathy_os.workflows.config import ModelConfig
|
|
27
|
+
|
|
27
28
|
|
|
28
29
|
@dataclass
|
|
29
30
|
class EmpathyConfig:
|
|
30
|
-
"""
|
|
31
|
-
Configuration for EmpathyOS instance
|
|
31
|
+
"""Configuration for EmpathyOS instance
|
|
32
32
|
|
|
33
33
|
Can be loaded from:
|
|
34
34
|
- YAML file (.empathy.yml, empathy.config.yml)
|
|
@@ -77,10 +77,21 @@ class EmpathyConfig:
|
|
|
77
77
|
# Custom metadata
|
|
78
78
|
metadata: dict[str, Any] = field(default_factory=dict)
|
|
79
79
|
|
|
80
|
+
# Model settings
|
|
81
|
+
models: list[ModelConfig] = field(default_factory=list)
|
|
82
|
+
default_model: str | None = None
|
|
83
|
+
log_path: str | None = None
|
|
84
|
+
max_threads: int = 4
|
|
85
|
+
model_router: dict[str, Any] | None = None
|
|
86
|
+
|
|
87
|
+
def __post_init__(self):
|
|
88
|
+
"""Post-initialization validation."""
|
|
89
|
+
if self.default_model and not any(m.name == self.default_model for m in self.models):
|
|
90
|
+
raise ValueError(f"Default model '{self.default_model}' not in models.")
|
|
91
|
+
|
|
80
92
|
@classmethod
|
|
81
93
|
def from_yaml(cls, filepath: str) -> "EmpathyConfig":
|
|
82
|
-
"""
|
|
83
|
-
Load configuration from YAML file
|
|
94
|
+
"""Load configuration from YAML file
|
|
84
95
|
|
|
85
96
|
Args:
|
|
86
97
|
filepath: Path to YAML configuration file
|
|
@@ -95,21 +106,46 @@ class EmpathyConfig:
|
|
|
95
106
|
Example:
|
|
96
107
|
>>> config = EmpathyConfig.from_yaml("empathy.config.yml")
|
|
97
108
|
>>> empathy = EmpathyOS(config=config)
|
|
109
|
+
|
|
110
|
+
Note:
|
|
111
|
+
Unknown fields in the YAML file are silently ignored.
|
|
112
|
+
This allows config files to contain settings for other
|
|
113
|
+
components (e.g., model_preferences, workflows) without
|
|
114
|
+
breaking EmpathyConfig loading.
|
|
115
|
+
|
|
98
116
|
"""
|
|
99
117
|
if not YAML_AVAILABLE:
|
|
100
118
|
raise ImportError(
|
|
101
|
-
"PyYAML is required for YAML configuration. Install with: pip install pyyaml"
|
|
119
|
+
"PyYAML is required for YAML configuration. Install with: pip install pyyaml",
|
|
102
120
|
)
|
|
103
121
|
|
|
104
122
|
with open(filepath) as f:
|
|
105
123
|
data = yaml.safe_load(f)
|
|
106
124
|
|
|
107
|
-
|
|
125
|
+
# Filter to only known fields (gracefully ignore unknown fields like
|
|
126
|
+
# 'provider', 'model_preferences', 'workflows', etc.)
|
|
127
|
+
from dataclasses import fields as dataclass_fields
|
|
128
|
+
|
|
129
|
+
valid_fields = {f.name for f in dataclass_fields(cls)}
|
|
130
|
+
filtered_data = {k: v for k, v in data.items() if k in valid_fields}
|
|
131
|
+
|
|
132
|
+
return cls.from_dict(filtered_data)
|
|
133
|
+
|
|
134
|
+
@classmethod
|
|
135
|
+
def from_dict(cls, data: dict[str, Any]) -> "EmpathyConfig":
|
|
136
|
+
"""Create an EmpathyConfig from a dictionary, ignoring unknown fields."""
|
|
137
|
+
known_fields = {f.name for f in cls.__dataclass_fields__.values()}
|
|
138
|
+
filtered_data = {k: v for k, v in data.items() if k in known_fields}
|
|
139
|
+
|
|
140
|
+
# Handle nested ModelConfig objects
|
|
141
|
+
if filtered_data.get("models"):
|
|
142
|
+
filtered_data["models"] = [ModelConfig(**m) for m in filtered_data["models"]]
|
|
143
|
+
|
|
144
|
+
return cls(**filtered_data)
|
|
108
145
|
|
|
109
146
|
@classmethod
|
|
110
147
|
def from_json(cls, filepath: str) -> "EmpathyConfig":
|
|
111
|
-
"""
|
|
112
|
-
Load configuration from JSON file
|
|
148
|
+
"""Load configuration from JSON file
|
|
113
149
|
|
|
114
150
|
Args:
|
|
115
151
|
filepath: Path to JSON configuration file
|
|
@@ -120,16 +156,25 @@ class EmpathyConfig:
|
|
|
120
156
|
Example:
|
|
121
157
|
>>> config = EmpathyConfig.from_json("empathy.config.json")
|
|
122
158
|
>>> empathy = EmpathyOS(config=config)
|
|
159
|
+
|
|
160
|
+
Note:
|
|
161
|
+
Unknown fields in the JSON file are silently ignored.
|
|
162
|
+
|
|
123
163
|
"""
|
|
124
164
|
with open(filepath) as f:
|
|
125
165
|
data = json.load(f)
|
|
126
166
|
|
|
127
|
-
|
|
167
|
+
# Filter to only known fields (gracefully ignore unknown fields)
|
|
168
|
+
from dataclasses import fields as dataclass_fields
|
|
169
|
+
|
|
170
|
+
valid_fields = {f.name for f in dataclass_fields(cls)}
|
|
171
|
+
filtered_data = {k: v for k, v in data.items() if k in valid_fields}
|
|
172
|
+
|
|
173
|
+
return cls(**filtered_data)
|
|
128
174
|
|
|
129
175
|
@classmethod
|
|
130
176
|
def from_env(cls, prefix: str = "EMPATHY_") -> "EmpathyConfig":
|
|
131
|
-
"""
|
|
132
|
-
Load configuration from environment variables
|
|
177
|
+
"""Load configuration from environment variables
|
|
133
178
|
|
|
134
179
|
Environment variables should be prefixed with EMPATHY_
|
|
135
180
|
and match config field names in uppercase.
|
|
@@ -149,8 +194,14 @@ class EmpathyConfig:
|
|
|
149
194
|
>>> os.environ["EMPATHY_USER_ID"] = "alice"
|
|
150
195
|
>>> config = EmpathyConfig.from_env()
|
|
151
196
|
>>> print(config.user_id) # "alice"
|
|
197
|
+
|
|
152
198
|
"""
|
|
153
|
-
|
|
199
|
+
from dataclasses import fields as dataclass_fields
|
|
200
|
+
|
|
201
|
+
# Get valid field names from the dataclass
|
|
202
|
+
valid_fields = {f.name for f in dataclass_fields(cls)}
|
|
203
|
+
|
|
204
|
+
data: dict[str, Any] = {}
|
|
154
205
|
|
|
155
206
|
# Get all environment variables with prefix
|
|
156
207
|
for key, value in os.environ.items():
|
|
@@ -158,6 +209,10 @@ class EmpathyConfig:
|
|
|
158
209
|
# Convert EMPATHY_USER_ID -> user_id
|
|
159
210
|
field_name = key[len(prefix) :].lower()
|
|
160
211
|
|
|
212
|
+
# Skip unknown fields (e.g., EMPATHY_MASTER_KEY for encryption)
|
|
213
|
+
if field_name not in valid_fields:
|
|
214
|
+
continue
|
|
215
|
+
|
|
161
216
|
# Type conversion based on field name
|
|
162
217
|
if field_name in ("target_level",):
|
|
163
218
|
data[field_name] = int(value)
|
|
@@ -187,8 +242,7 @@ class EmpathyConfig:
|
|
|
187
242
|
|
|
188
243
|
@classmethod
|
|
189
244
|
def from_file(cls, filepath: str | None = None) -> "EmpathyConfig":
|
|
190
|
-
"""
|
|
191
|
-
Automatically detect and load configuration from file
|
|
245
|
+
"""Automatically detect and load configuration from file
|
|
192
246
|
|
|
193
247
|
Looks for configuration files in this order:
|
|
194
248
|
1. Provided filepath
|
|
@@ -208,6 +262,7 @@ class EmpathyConfig:
|
|
|
208
262
|
Example:
|
|
209
263
|
>>> config = EmpathyConfig.from_file() # Auto-detect
|
|
210
264
|
>>> config = EmpathyConfig.from_file("my-config.yml")
|
|
265
|
+
|
|
211
266
|
"""
|
|
212
267
|
search_paths = [
|
|
213
268
|
filepath,
|
|
@@ -223,15 +278,14 @@ class EmpathyConfig:
|
|
|
223
278
|
if path and Path(path).exists():
|
|
224
279
|
if path.endswith((".yml", ".yaml")):
|
|
225
280
|
return cls.from_yaml(path)
|
|
226
|
-
|
|
281
|
+
if path.endswith(".json"):
|
|
227
282
|
return cls.from_json(path)
|
|
228
283
|
|
|
229
284
|
# No config file found - return default
|
|
230
285
|
return cls()
|
|
231
286
|
|
|
232
287
|
def to_yaml(self, filepath: str):
|
|
233
|
-
"""
|
|
234
|
-
Save configuration to YAML file
|
|
288
|
+
"""Save configuration to YAML file
|
|
235
289
|
|
|
236
290
|
Args:
|
|
237
291
|
filepath: Path to save YAML file
|
|
@@ -239,10 +293,11 @@ class EmpathyConfig:
|
|
|
239
293
|
Example:
|
|
240
294
|
>>> config = EmpathyConfig(user_id="alice", target_level=4)
|
|
241
295
|
>>> config.to_yaml("my-config.yml")
|
|
296
|
+
|
|
242
297
|
"""
|
|
243
298
|
if not YAML_AVAILABLE:
|
|
244
299
|
raise ImportError(
|
|
245
|
-
"PyYAML is required for YAML export. Install with: pip install pyyaml"
|
|
300
|
+
"PyYAML is required for YAML export. Install with: pip install pyyaml",
|
|
246
301
|
)
|
|
247
302
|
|
|
248
303
|
data = asdict(self)
|
|
@@ -251,8 +306,7 @@ class EmpathyConfig:
|
|
|
251
306
|
yaml.dump(data, f, default_flow_style=False, sort_keys=False)
|
|
252
307
|
|
|
253
308
|
def to_json(self, filepath: str, indent: int = 2):
|
|
254
|
-
"""
|
|
255
|
-
Save configuration to JSON file
|
|
309
|
+
"""Save configuration to JSON file
|
|
256
310
|
|
|
257
311
|
Args:
|
|
258
312
|
filepath: Path to save JSON file
|
|
@@ -261,6 +315,7 @@ class EmpathyConfig:
|
|
|
261
315
|
Example:
|
|
262
316
|
>>> config = EmpathyConfig(user_id="alice", target_level=4)
|
|
263
317
|
>>> config.to_json("my-config.json")
|
|
318
|
+
|
|
264
319
|
"""
|
|
265
320
|
data = asdict(self)
|
|
266
321
|
|
|
@@ -272,8 +327,7 @@ class EmpathyConfig:
|
|
|
272
327
|
return asdict(self)
|
|
273
328
|
|
|
274
329
|
def update(self, **kwargs):
|
|
275
|
-
"""
|
|
276
|
-
Update configuration fields
|
|
330
|
+
"""Update configuration fields
|
|
277
331
|
|
|
278
332
|
Args:
|
|
279
333
|
**kwargs: Fields to update
|
|
@@ -281,14 +335,14 @@ class EmpathyConfig:
|
|
|
281
335
|
Example:
|
|
282
336
|
>>> config = EmpathyConfig()
|
|
283
337
|
>>> config.update(user_id="bob", target_level=5)
|
|
338
|
+
|
|
284
339
|
"""
|
|
285
340
|
for key, value in kwargs.items():
|
|
286
341
|
if hasattr(self, key):
|
|
287
342
|
setattr(self, key, value)
|
|
288
343
|
|
|
289
344
|
def merge(self, other: "EmpathyConfig") -> "EmpathyConfig":
|
|
290
|
-
"""
|
|
291
|
-
Merge with another configuration (other takes precedence)
|
|
345
|
+
"""Merge with another configuration (other takes precedence)
|
|
292
346
|
|
|
293
347
|
Args:
|
|
294
348
|
other: Configuration to merge
|
|
@@ -300,6 +354,7 @@ class EmpathyConfig:
|
|
|
300
354
|
>>> base = EmpathyConfig(user_id="alice")
|
|
301
355
|
>>> override = EmpathyConfig(target_level=5)
|
|
302
356
|
>>> merged = base.merge(override)
|
|
357
|
+
|
|
303
358
|
"""
|
|
304
359
|
# Start with base values
|
|
305
360
|
base_dict = self.to_dict()
|
|
@@ -316,31 +371,31 @@ class EmpathyConfig:
|
|
|
316
371
|
return EmpathyConfig(**base_dict)
|
|
317
372
|
|
|
318
373
|
def validate(self) -> bool:
|
|
319
|
-
"""
|
|
320
|
-
Validate configuration values
|
|
374
|
+
"""Validate configuration values
|
|
321
375
|
|
|
322
376
|
Returns:
|
|
323
377
|
True if valid, raises ValueError if invalid
|
|
324
378
|
|
|
325
379
|
Raises:
|
|
326
380
|
ValueError: If configuration is invalid
|
|
381
|
+
|
|
327
382
|
"""
|
|
328
383
|
if self.target_level not in range(1, 6):
|
|
329
384
|
raise ValueError(f"target_level must be 1-5, got {self.target_level}")
|
|
330
385
|
|
|
331
386
|
if not 0.0 <= self.confidence_threshold <= 1.0:
|
|
332
387
|
raise ValueError(
|
|
333
|
-
f"confidence_threshold must be 0.0-1.0, got {self.confidence_threshold}"
|
|
388
|
+
f"confidence_threshold must be 0.0-1.0, got {self.confidence_threshold}",
|
|
334
389
|
)
|
|
335
390
|
|
|
336
391
|
if not 0.0 <= self.pattern_confidence_threshold <= 1.0:
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
)
|
|
392
|
+
threshold_val = self.pattern_confidence_threshold
|
|
393
|
+
raise ValueError(f"pattern_confidence_threshold must be 0.0-1.0, got {threshold_val}")
|
|
340
394
|
|
|
341
395
|
if self.persistence_backend not in ("sqlite", "json", "none"):
|
|
396
|
+
backend_val = self.persistence_backend
|
|
342
397
|
raise ValueError(
|
|
343
|
-
f"persistence_backend must be 'sqlite', 'json', or 'none', got {
|
|
398
|
+
f"persistence_backend must be 'sqlite', 'json', or 'none', got {backend_val}",
|
|
344
399
|
)
|
|
345
400
|
|
|
346
401
|
return True
|
|
@@ -354,10 +409,11 @@ class EmpathyConfig:
|
|
|
354
409
|
|
|
355
410
|
|
|
356
411
|
def load_config(
|
|
357
|
-
filepath: str | None = None,
|
|
412
|
+
filepath: str | None = None,
|
|
413
|
+
use_env: bool = True,
|
|
414
|
+
defaults: dict[str, Any] | None = None,
|
|
358
415
|
) -> EmpathyConfig:
|
|
359
|
-
"""
|
|
360
|
-
Load configuration with flexible precedence
|
|
416
|
+
"""Load configuration with flexible precedence
|
|
361
417
|
|
|
362
418
|
Precedence (highest to lowest):
|
|
363
419
|
1. Environment variables (if use_env=True)
|
|
@@ -379,6 +435,7 @@ def load_config(
|
|
|
379
435
|
|
|
380
436
|
>>> # Load with custom defaults
|
|
381
437
|
>>> config = load_config(defaults={"target_level": 4})
|
|
438
|
+
|
|
382
439
|
"""
|
|
383
440
|
# Start with built-in defaults
|
|
384
441
|
config = EmpathyConfig()
|
|
@@ -418,7 +475,8 @@ def load_config(
|
|
|
418
475
|
try:
|
|
419
476
|
env_config = EmpathyConfig.from_env()
|
|
420
477
|
config = config.merge(env_config)
|
|
421
|
-
except
|
|
478
|
+
except (ValueError, TypeError):
|
|
479
|
+
# Graceful fallback: invalid env var type conversion
|
|
422
480
|
pass # Use current config if environment parsing fails
|
|
423
481
|
|
|
424
482
|
# Validate final configuration
|