mcli-framework 7.0.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.
Potentially problematic release.
This version of mcli-framework might be problematic. Click here for more details.
- mcli/app/chat_cmd.py +42 -0
- mcli/app/commands_cmd.py +226 -0
- mcli/app/completion_cmd.py +216 -0
- mcli/app/completion_helpers.py +288 -0
- mcli/app/cron_test_cmd.py +697 -0
- mcli/app/logs_cmd.py +419 -0
- mcli/app/main.py +492 -0
- mcli/app/model/model.py +1060 -0
- mcli/app/model_cmd.py +227 -0
- mcli/app/redis_cmd.py +269 -0
- mcli/app/video/video.py +1114 -0
- mcli/app/visual_cmd.py +303 -0
- mcli/chat/chat.py +2409 -0
- mcli/chat/command_rag.py +514 -0
- mcli/chat/enhanced_chat.py +652 -0
- mcli/chat/system_controller.py +1010 -0
- mcli/chat/system_integration.py +1016 -0
- mcli/cli.py +25 -0
- mcli/config.toml +20 -0
- mcli/lib/api/api.py +586 -0
- mcli/lib/api/daemon_client.py +203 -0
- mcli/lib/api/daemon_client_local.py +44 -0
- mcli/lib/api/daemon_decorator.py +217 -0
- mcli/lib/api/mcli_decorators.py +1032 -0
- mcli/lib/auth/auth.py +85 -0
- mcli/lib/auth/aws_manager.py +85 -0
- mcli/lib/auth/azure_manager.py +91 -0
- mcli/lib/auth/credential_manager.py +192 -0
- mcli/lib/auth/gcp_manager.py +93 -0
- mcli/lib/auth/key_manager.py +117 -0
- mcli/lib/auth/mcli_manager.py +93 -0
- mcli/lib/auth/token_manager.py +75 -0
- mcli/lib/auth/token_util.py +1011 -0
- mcli/lib/config/config.py +47 -0
- mcli/lib/discovery/__init__.py +1 -0
- mcli/lib/discovery/command_discovery.py +274 -0
- mcli/lib/erd/erd.py +1345 -0
- mcli/lib/erd/generate_graph.py +453 -0
- mcli/lib/files/files.py +76 -0
- mcli/lib/fs/fs.py +109 -0
- mcli/lib/lib.py +29 -0
- mcli/lib/logger/logger.py +611 -0
- mcli/lib/performance/optimizer.py +409 -0
- mcli/lib/performance/rust_bridge.py +502 -0
- mcli/lib/performance/uvloop_config.py +154 -0
- mcli/lib/pickles/pickles.py +50 -0
- mcli/lib/search/cached_vectorizer.py +479 -0
- mcli/lib/services/data_pipeline.py +460 -0
- mcli/lib/services/lsh_client.py +441 -0
- mcli/lib/services/redis_service.py +387 -0
- mcli/lib/shell/shell.py +137 -0
- mcli/lib/toml/toml.py +33 -0
- mcli/lib/ui/styling.py +47 -0
- mcli/lib/ui/visual_effects.py +634 -0
- mcli/lib/watcher/watcher.py +185 -0
- mcli/ml/api/app.py +215 -0
- mcli/ml/api/middleware.py +224 -0
- mcli/ml/api/routers/admin_router.py +12 -0
- mcli/ml/api/routers/auth_router.py +244 -0
- mcli/ml/api/routers/backtest_router.py +12 -0
- mcli/ml/api/routers/data_router.py +12 -0
- mcli/ml/api/routers/model_router.py +302 -0
- mcli/ml/api/routers/monitoring_router.py +12 -0
- mcli/ml/api/routers/portfolio_router.py +12 -0
- mcli/ml/api/routers/prediction_router.py +267 -0
- mcli/ml/api/routers/trade_router.py +12 -0
- mcli/ml/api/routers/websocket_router.py +76 -0
- mcli/ml/api/schemas.py +64 -0
- mcli/ml/auth/auth_manager.py +425 -0
- mcli/ml/auth/models.py +154 -0
- mcli/ml/auth/permissions.py +302 -0
- mcli/ml/backtesting/backtest_engine.py +502 -0
- mcli/ml/backtesting/performance_metrics.py +393 -0
- mcli/ml/cache.py +400 -0
- mcli/ml/cli/main.py +398 -0
- mcli/ml/config/settings.py +394 -0
- mcli/ml/configs/dvc_config.py +230 -0
- mcli/ml/configs/mlflow_config.py +131 -0
- mcli/ml/configs/mlops_manager.py +293 -0
- mcli/ml/dashboard/app.py +532 -0
- mcli/ml/dashboard/app_integrated.py +738 -0
- mcli/ml/dashboard/app_supabase.py +560 -0
- mcli/ml/dashboard/app_training.py +615 -0
- mcli/ml/dashboard/cli.py +51 -0
- mcli/ml/data_ingestion/api_connectors.py +501 -0
- mcli/ml/data_ingestion/data_pipeline.py +567 -0
- mcli/ml/data_ingestion/stream_processor.py +512 -0
- mcli/ml/database/migrations/env.py +94 -0
- mcli/ml/database/models.py +667 -0
- mcli/ml/database/session.py +200 -0
- mcli/ml/experimentation/ab_testing.py +845 -0
- mcli/ml/features/ensemble_features.py +607 -0
- mcli/ml/features/political_features.py +676 -0
- mcli/ml/features/recommendation_engine.py +809 -0
- mcli/ml/features/stock_features.py +573 -0
- mcli/ml/features/test_feature_engineering.py +346 -0
- mcli/ml/logging.py +85 -0
- mcli/ml/mlops/data_versioning.py +518 -0
- mcli/ml/mlops/experiment_tracker.py +377 -0
- mcli/ml/mlops/model_serving.py +481 -0
- mcli/ml/mlops/pipeline_orchestrator.py +614 -0
- mcli/ml/models/base_models.py +324 -0
- mcli/ml/models/ensemble_models.py +675 -0
- mcli/ml/models/recommendation_models.py +474 -0
- mcli/ml/models/test_models.py +487 -0
- mcli/ml/monitoring/drift_detection.py +676 -0
- mcli/ml/monitoring/metrics.py +45 -0
- mcli/ml/optimization/portfolio_optimizer.py +834 -0
- mcli/ml/preprocessing/data_cleaners.py +451 -0
- mcli/ml/preprocessing/feature_extractors.py +491 -0
- mcli/ml/preprocessing/ml_pipeline.py +382 -0
- mcli/ml/preprocessing/politician_trading_preprocessor.py +569 -0
- mcli/ml/preprocessing/test_preprocessing.py +294 -0
- mcli/ml/scripts/populate_sample_data.py +200 -0
- mcli/ml/tasks.py +400 -0
- mcli/ml/tests/test_integration.py +429 -0
- mcli/ml/tests/test_training_dashboard.py +387 -0
- mcli/public/oi/oi.py +15 -0
- mcli/public/public.py +4 -0
- mcli/self/self_cmd.py +1246 -0
- mcli/workflow/daemon/api_daemon.py +800 -0
- mcli/workflow/daemon/async_command_database.py +681 -0
- mcli/workflow/daemon/async_process_manager.py +591 -0
- mcli/workflow/daemon/client.py +530 -0
- mcli/workflow/daemon/commands.py +1196 -0
- mcli/workflow/daemon/daemon.py +905 -0
- mcli/workflow/daemon/daemon_api.py +59 -0
- mcli/workflow/daemon/enhanced_daemon.py +571 -0
- mcli/workflow/daemon/process_cli.py +244 -0
- mcli/workflow/daemon/process_manager.py +439 -0
- mcli/workflow/daemon/test_daemon.py +275 -0
- mcli/workflow/dashboard/dashboard_cmd.py +113 -0
- mcli/workflow/docker/docker.py +0 -0
- mcli/workflow/file/file.py +100 -0
- mcli/workflow/gcloud/config.toml +21 -0
- mcli/workflow/gcloud/gcloud.py +58 -0
- mcli/workflow/git_commit/ai_service.py +328 -0
- mcli/workflow/git_commit/commands.py +430 -0
- mcli/workflow/lsh_integration.py +355 -0
- mcli/workflow/model_service/client.py +594 -0
- mcli/workflow/model_service/download_and_run_efficient_models.py +288 -0
- mcli/workflow/model_service/lightweight_embedder.py +397 -0
- mcli/workflow/model_service/lightweight_model_server.py +714 -0
- mcli/workflow/model_service/lightweight_test.py +241 -0
- mcli/workflow/model_service/model_service.py +1955 -0
- mcli/workflow/model_service/ollama_efficient_runner.py +425 -0
- mcli/workflow/model_service/pdf_processor.py +386 -0
- mcli/workflow/model_service/test_efficient_runner.py +234 -0
- mcli/workflow/model_service/test_example.py +315 -0
- mcli/workflow/model_service/test_integration.py +131 -0
- mcli/workflow/model_service/test_new_features.py +149 -0
- mcli/workflow/openai/openai.py +99 -0
- mcli/workflow/politician_trading/commands.py +1790 -0
- mcli/workflow/politician_trading/config.py +134 -0
- mcli/workflow/politician_trading/connectivity.py +490 -0
- mcli/workflow/politician_trading/data_sources.py +395 -0
- mcli/workflow/politician_trading/database.py +410 -0
- mcli/workflow/politician_trading/demo.py +248 -0
- mcli/workflow/politician_trading/models.py +165 -0
- mcli/workflow/politician_trading/monitoring.py +413 -0
- mcli/workflow/politician_trading/scrapers.py +966 -0
- mcli/workflow/politician_trading/scrapers_california.py +412 -0
- mcli/workflow/politician_trading/scrapers_eu.py +377 -0
- mcli/workflow/politician_trading/scrapers_uk.py +350 -0
- mcli/workflow/politician_trading/scrapers_us_states.py +438 -0
- mcli/workflow/politician_trading/supabase_functions.py +354 -0
- mcli/workflow/politician_trading/workflow.py +852 -0
- mcli/workflow/registry/registry.py +180 -0
- mcli/workflow/repo/repo.py +223 -0
- mcli/workflow/scheduler/commands.py +493 -0
- mcli/workflow/scheduler/cron_parser.py +238 -0
- mcli/workflow/scheduler/job.py +182 -0
- mcli/workflow/scheduler/monitor.py +139 -0
- mcli/workflow/scheduler/persistence.py +324 -0
- mcli/workflow/scheduler/scheduler.py +679 -0
- mcli/workflow/sync/sync_cmd.py +437 -0
- mcli/workflow/sync/test_cmd.py +314 -0
- mcli/workflow/videos/videos.py +242 -0
- mcli/workflow/wakatime/wakatime.py +11 -0
- mcli/workflow/workflow.py +37 -0
- mcli_framework-7.0.0.dist-info/METADATA +479 -0
- mcli_framework-7.0.0.dist-info/RECORD +186 -0
- mcli_framework-7.0.0.dist-info/WHEEL +5 -0
- mcli_framework-7.0.0.dist-info/entry_points.txt +7 -0
- mcli_framework-7.0.0.dist-info/licenses/LICENSE +21 -0
- mcli_framework-7.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Test script for the lightweight model server.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
import os
|
|
7
|
+
import sys
|
|
8
|
+
import time
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
|
|
11
|
+
import requests
|
|
12
|
+
|
|
13
|
+
# Add the parent directory to the path so we can import the modules
|
|
14
|
+
sys.path.insert(0, str(Path(__file__).parent.parent.parent.parent))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def test_lightweight_models():
|
|
18
|
+
"""Test the lightweight models configuration"""
|
|
19
|
+
print("๐งช Testing lightweight models configuration...")
|
|
20
|
+
|
|
21
|
+
try:
|
|
22
|
+
from mcli.workflow.model_service.lightweight_model_server import LIGHTWEIGHT_MODELS
|
|
23
|
+
|
|
24
|
+
print(f"โ
Found {len(LIGHTWEIGHT_MODELS)} lightweight models:")
|
|
25
|
+
|
|
26
|
+
total_size = 0
|
|
27
|
+
for key, info in LIGHTWEIGHT_MODELS.items():
|
|
28
|
+
print(f" - {key}: {info['name']} ({info['parameters']}) - {info['size_mb']} MB")
|
|
29
|
+
total_size += info["size_mb"]
|
|
30
|
+
|
|
31
|
+
print(f"\n๐ Total size if all downloaded: {total_size:.1f} MB")
|
|
32
|
+
print(
|
|
33
|
+
f"๐ฏ Smallest model: {min(LIGHTWEIGHT_MODELS.items(), key=lambda x: x[1]['size_mb'])[1]['name']}"
|
|
34
|
+
)
|
|
35
|
+
print(
|
|
36
|
+
f"โก Most efficient: {max(LIGHTWEIGHT_MODELS.items(), key=lambda x: x[1]['efficiency_score'])[1]['name']}"
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
return True
|
|
40
|
+
|
|
41
|
+
except Exception as e:
|
|
42
|
+
print(f"โ Lightweight models test failed: {e}")
|
|
43
|
+
return False
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def test_downloader():
|
|
47
|
+
"""Test the downloader functionality"""
|
|
48
|
+
print("\n๐งช Testing downloader functionality...")
|
|
49
|
+
|
|
50
|
+
try:
|
|
51
|
+
from mcli.workflow.model_service.lightweight_model_server import LightweightModelDownloader
|
|
52
|
+
|
|
53
|
+
# Create downloader
|
|
54
|
+
downloader = LightweightModelDownloader("./test_models")
|
|
55
|
+
print("โ
Downloader created")
|
|
56
|
+
|
|
57
|
+
# Test session
|
|
58
|
+
if downloader.session:
|
|
59
|
+
print("โ
HTTP session configured")
|
|
60
|
+
else:
|
|
61
|
+
print("โ HTTP session not configured")
|
|
62
|
+
return False
|
|
63
|
+
|
|
64
|
+
# Test models directory
|
|
65
|
+
if downloader.models_dir.exists():
|
|
66
|
+
print("โ
Models directory exists")
|
|
67
|
+
else:
|
|
68
|
+
print("โ Models directory not created")
|
|
69
|
+
return False
|
|
70
|
+
|
|
71
|
+
return True
|
|
72
|
+
|
|
73
|
+
except Exception as e:
|
|
74
|
+
print(f"โ Downloader test failed: {e}")
|
|
75
|
+
return False
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def test_server():
|
|
79
|
+
"""Test the server functionality"""
|
|
80
|
+
print("\n๐งช Testing server functionality...")
|
|
81
|
+
|
|
82
|
+
try:
|
|
83
|
+
from mcli.workflow.model_service.lightweight_model_server import LightweightModelServer
|
|
84
|
+
|
|
85
|
+
# Create server
|
|
86
|
+
server = LightweightModelServer(port=8081) # Use different port for testing
|
|
87
|
+
print("โ
Server created")
|
|
88
|
+
|
|
89
|
+
# Test system info
|
|
90
|
+
system_info = server.get_system_info()
|
|
91
|
+
print(f"โ
System info collected:")
|
|
92
|
+
print(f" - CPU cores: {system_info['cpu_count']}")
|
|
93
|
+
print(f" - Memory: {system_info['memory_gb']:.1f} GB")
|
|
94
|
+
print(f" - Free disk: {system_info['disk_free_gb']:.1f} GB")
|
|
95
|
+
|
|
96
|
+
# Test model recommendation
|
|
97
|
+
recommended = server.recommend_model()
|
|
98
|
+
print(f"โ
Recommended model: {recommended}")
|
|
99
|
+
|
|
100
|
+
return True
|
|
101
|
+
|
|
102
|
+
except Exception as e:
|
|
103
|
+
print(f"โ Server test failed: {e}")
|
|
104
|
+
return False
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
def test_http_server():
|
|
108
|
+
"""Test the HTTP server functionality"""
|
|
109
|
+
print("\n๐งช Testing HTTP server...")
|
|
110
|
+
|
|
111
|
+
try:
|
|
112
|
+
import threading
|
|
113
|
+
import time
|
|
114
|
+
|
|
115
|
+
from mcli.workflow.model_service.lightweight_model_server import LightweightModelServer
|
|
116
|
+
|
|
117
|
+
# Create server
|
|
118
|
+
server = LightweightModelServer(port=8082)
|
|
119
|
+
|
|
120
|
+
# Start server in background
|
|
121
|
+
server.start_server()
|
|
122
|
+
time.sleep(2) # Wait for server to start
|
|
123
|
+
|
|
124
|
+
# Test server endpoints
|
|
125
|
+
try:
|
|
126
|
+
# Health check
|
|
127
|
+
response = requests.get("http://localhost:8082/health", timeout=5)
|
|
128
|
+
if response.status_code == 200:
|
|
129
|
+
print("โ
Health endpoint working")
|
|
130
|
+
else:
|
|
131
|
+
print("โ Health endpoint failed")
|
|
132
|
+
return False
|
|
133
|
+
|
|
134
|
+
# Models endpoint
|
|
135
|
+
response = requests.get("http://localhost:8082/models", timeout=5)
|
|
136
|
+
if response.status_code == 200:
|
|
137
|
+
print("โ
Models endpoint working")
|
|
138
|
+
else:
|
|
139
|
+
print("โ Models endpoint failed")
|
|
140
|
+
return False
|
|
141
|
+
|
|
142
|
+
# Root endpoint
|
|
143
|
+
response = requests.get("http://localhost:8082/", timeout=5)
|
|
144
|
+
if response.status_code == 200:
|
|
145
|
+
print("โ
Root endpoint working")
|
|
146
|
+
else:
|
|
147
|
+
print("โ Root endpoint failed")
|
|
148
|
+
return False
|
|
149
|
+
|
|
150
|
+
return True
|
|
151
|
+
|
|
152
|
+
except requests.exceptions.ConnectionError:
|
|
153
|
+
print("โ Could not connect to test server")
|
|
154
|
+
return False
|
|
155
|
+
except Exception as e:
|
|
156
|
+
print(f"โ HTTP server test failed: {e}")
|
|
157
|
+
return False
|
|
158
|
+
|
|
159
|
+
except Exception as e:
|
|
160
|
+
print(f"โ HTTP server test failed: {e}")
|
|
161
|
+
return False
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
def test_model_download():
|
|
165
|
+
"""Test model download functionality"""
|
|
166
|
+
print("\n๐งช Testing model download...")
|
|
167
|
+
|
|
168
|
+
try:
|
|
169
|
+
from mcli.workflow.model_service.lightweight_model_server import (
|
|
170
|
+
LIGHTWEIGHT_MODELS,
|
|
171
|
+
LightweightModelDownloader,
|
|
172
|
+
)
|
|
173
|
+
|
|
174
|
+
# Create downloader
|
|
175
|
+
downloader = LightweightModelDownloader("./test_download")
|
|
176
|
+
|
|
177
|
+
# Test with smallest model
|
|
178
|
+
smallest_model = min(LIGHTWEIGHT_MODELS.items(), key=lambda x: x[1]["size_mb"])[0]
|
|
179
|
+
print(f"๐ฅ Testing download of smallest model: {smallest_model}")
|
|
180
|
+
|
|
181
|
+
# This would actually download the model, so we'll just test the method exists
|
|
182
|
+
if hasattr(downloader, "download_model"):
|
|
183
|
+
print("โ
Download method exists")
|
|
184
|
+
else:
|
|
185
|
+
print("โ Download method not found")
|
|
186
|
+
return False
|
|
187
|
+
|
|
188
|
+
if hasattr(downloader, "download_file"):
|
|
189
|
+
print("โ
File download method exists")
|
|
190
|
+
else:
|
|
191
|
+
print("โ File download method not found")
|
|
192
|
+
return False
|
|
193
|
+
|
|
194
|
+
return True
|
|
195
|
+
|
|
196
|
+
except Exception as e:
|
|
197
|
+
print(f"โ Model download test failed: {e}")
|
|
198
|
+
return False
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
def main():
|
|
202
|
+
"""Run all tests"""
|
|
203
|
+
print("๐ Testing Lightweight Model Server")
|
|
204
|
+
print("=" * 50)
|
|
205
|
+
|
|
206
|
+
tests = [
|
|
207
|
+
("Lightweight Models", test_lightweight_models),
|
|
208
|
+
("Downloader", test_downloader),
|
|
209
|
+
("Server", test_server),
|
|
210
|
+
("HTTP Server", test_http_server),
|
|
211
|
+
("Model Download", test_model_download),
|
|
212
|
+
]
|
|
213
|
+
|
|
214
|
+
passed = 0
|
|
215
|
+
total = len(tests)
|
|
216
|
+
|
|
217
|
+
for test_name, test_func in tests:
|
|
218
|
+
print(f"\n๐ Running {test_name} test...")
|
|
219
|
+
if test_func():
|
|
220
|
+
passed += 1
|
|
221
|
+
print(f"โ
{test_name} test passed")
|
|
222
|
+
else:
|
|
223
|
+
print(f"โ {test_name} test failed")
|
|
224
|
+
|
|
225
|
+
print("\n" + "=" * 50)
|
|
226
|
+
print(f"๐ Test Results: {passed}/{total} tests passed")
|
|
227
|
+
|
|
228
|
+
if passed == total:
|
|
229
|
+
print("๐ All tests passed! The lightweight model server is ready to use.")
|
|
230
|
+
print("\n๐ Next steps:")
|
|
231
|
+
print("1. Run: python lightweight_model_server.py")
|
|
232
|
+
print("2. Choose a model to download")
|
|
233
|
+
print("3. Test with: python lightweight_client.py")
|
|
234
|
+
return 0
|
|
235
|
+
else:
|
|
236
|
+
print("โ Some tests failed. Please check the errors above.")
|
|
237
|
+
return 1
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
if __name__ == "__main__":
|
|
241
|
+
sys.exit(main())
|