isa-model 0.0.3__tar.gz → 0.0.4__tar.gz

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.
Files changed (100) hide show
  1. {isa_model-0.0.3/isa_model.egg-info → isa_model-0.0.4}/PKG-INFO +1 -1
  2. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/__init__.py +1 -1
  3. isa_model-0.0.4/isa_model/core/model_registry.py +342 -0
  4. {isa_model-0.0.3 → isa_model-0.0.4/isa_model.egg-info}/PKG-INFO +1 -1
  5. {isa_model-0.0.3 → isa_model-0.0.4}/pyproject.toml +1 -1
  6. isa_model-0.0.3/isa_model/core/model_registry.py +0 -115
  7. {isa_model-0.0.3 → isa_model-0.0.4}/LICENSE +0 -0
  8. {isa_model-0.0.3 → isa_model-0.0.4}/MANIFEST.in +0 -0
  9. {isa_model-0.0.3 → isa_model-0.0.4}/README.md +0 -0
  10. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/core/model_manager.py +0 -0
  11. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/core/model_router.py +0 -0
  12. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/core/model_storage.py +0 -0
  13. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/core/model_version.py +0 -0
  14. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/core/resource_manager.py +0 -0
  15. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/core/storage/hf_storage.py +0 -0
  16. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/core/storage/local_storage.py +0 -0
  17. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/core/storage/minio_storage.py +0 -0
  18. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/deployment/gpu_fp16_ds8/models/deepseek_r1/1/model.py +0 -0
  19. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/deployment/gpu_fp16_ds8/scripts/download_model.py +0 -0
  20. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/deployment/gpu_int8_ds8/app/server.py +0 -0
  21. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/deployment/gpu_int8_ds8/scripts/test_client.py +0 -0
  22. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/deployment/gpu_int8_ds8/scripts/test_client_os.py +0 -0
  23. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/eval/__init__.py +0 -0
  24. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/eval/benchmarks.py +0 -0
  25. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/eval/factory.py +0 -0
  26. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/eval/metrics.py +0 -0
  27. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/inference/__init__.py +0 -0
  28. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/inference/adapter/unified_api.py +0 -0
  29. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/inference/ai_factory.py +0 -0
  30. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/inference/base.py +0 -0
  31. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/inference/providers/__init__.py +0 -0
  32. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/inference/providers/base_provider.py +0 -0
  33. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/inference/providers/model_cache_manager.py +0 -0
  34. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/inference/providers/ollama_provider.py +0 -0
  35. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/inference/providers/openai_provider.py +0 -0
  36. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/inference/providers/replicate_provider.py +0 -0
  37. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/inference/providers/triton_provider.py +0 -0
  38. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/inference/services/__init__.py +0 -0
  39. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/inference/services/audio/base_stt_service.py +0 -0
  40. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/inference/services/audio/base_tts_service.py +0 -0
  41. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/inference/services/audio/openai_tts_service.py +0 -0
  42. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/inference/services/base_service.py +0 -0
  43. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/inference/services/embedding/ollama_embed_service.py +0 -0
  44. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/inference/services/embedding/openai_embed_service.py +0 -0
  45. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/inference/services/llm/__init__.py +0 -0
  46. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/inference/services/llm/base_llm_service.py +0 -0
  47. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/inference/services/llm/ollama_llm_service.py +0 -0
  48. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/inference/services/llm/openai_llm_service.py +0 -0
  49. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/inference/services/others/table_transformer_service.py +0 -0
  50. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/inference/services/vision/__init__.py +0 -0
  51. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/inference/services/vision/helpers/image_utils.py +0 -0
  52. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/inference/services/vision/helpers/text_splitter.py +0 -0
  53. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/inference/services/vision/ollama_vision_service.py +0 -0
  54. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/inference/services/vision/openai_vision_service.py +0 -0
  55. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/inference/services/vision/replicate_image_gen_service.py +0 -0
  56. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/inference/utils/conversion/bge_rerank_convert.py +0 -0
  57. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/inference/utils/conversion/onnx_converter.py +0 -0
  58. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/inference/utils/conversion/torch_converter.py +0 -0
  59. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/scripts/inference_tracker.py +0 -0
  60. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/scripts/mlflow_manager.py +0 -0
  61. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/scripts/model_registry.py +0 -0
  62. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/scripts/start_mlflow.py +0 -0
  63. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/scripts/training_tracker.py +0 -0
  64. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/training/__init__.py +0 -0
  65. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/training/engine/llama_factory/__init__.py +0 -0
  66. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/training/engine/llama_factory/config.py +0 -0
  67. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/training/engine/llama_factory/data_adapter.py +0 -0
  68. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/training/engine/llama_factory/examples/__init__.py +0 -0
  69. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/training/engine/llama_factory/examples/finetune_with_tracking.py +0 -0
  70. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/training/engine/llama_factory/examples/rlhf_with_tracking.py +0 -0
  71. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/training/engine/llama_factory/factory.py +0 -0
  72. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/training/engine/llama_factory/rl.py +0 -0
  73. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/training/engine/llama_factory/trainer.py +0 -0
  74. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/training/factory.py +0 -0
  75. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/training/image_model/configs/create_config.py +0 -0
  76. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/training/image_model/configs/create_flux_config.py +0 -0
  77. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/training/image_model/configs/create_lora_config.py +0 -0
  78. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/training/image_model/prepare_massed_compute.py +0 -0
  79. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/training/image_model/prepare_upload.py +0 -0
  80. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/training/image_model/raw_data/create_captions.py +0 -0
  81. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/training/image_model/raw_data/create_lora_captions.py +0 -0
  82. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/training/image_model/raw_data/pre_processing.py +0 -0
  83. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/training/image_model/train/train.py +0 -0
  84. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/training/image_model/train/train_flux.py +0 -0
  85. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/training/image_model/train/train_lora.py +0 -0
  86. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/training/image_model/train_main.py +0 -0
  87. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/training/llm_model/annotation/annotation_schema.py +0 -0
  88. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/training/llm_model/annotation/processors/annotation_processor.py +0 -0
  89. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/training/llm_model/annotation/storage/dataset_manager.py +0 -0
  90. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/training/llm_model/annotation/storage/dataset_schema.py +0 -0
  91. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/training/llm_model/annotation/tests/test_annotation_flow.py +0 -0
  92. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/training/llm_model/annotation/tests/test_minio copy.py +0 -0
  93. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/training/llm_model/annotation/tests/test_minio_upload.py +0 -0
  94. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model/training/llm_model/annotation/views/annotation_controller.py +0 -0
  95. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model.egg-info/SOURCES.txt +0 -0
  96. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model.egg-info/dependency_links.txt +0 -0
  97. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model.egg-info/requires.txt +0 -0
  98. {isa_model-0.0.3 → isa_model-0.0.4}/isa_model.egg-info/top_level.txt +0 -0
  99. {isa_model-0.0.3 → isa_model-0.0.4}/setup.cfg +0 -0
  100. {isa_model-0.0.3 → isa_model-0.0.4}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: isa-model
3
- Version: 0.0.3
3
+ Version: 0.0.4
4
4
  Summary: Unified AI model serving framework
5
5
  Author-email: isA_Model Contributors <your.email@example.com>
6
6
  License-Expression: MIT
@@ -2,4 +2,4 @@
2
2
  isA_Model - A simple interface for AI model integration
3
3
  """
4
4
 
5
- __version__ = "0.1.0"
5
+ __version__ = "0.0.4"
@@ -0,0 +1,342 @@
1
+ from typing import Dict, List, Optional, Any
2
+ from enum import Enum
3
+ import logging
4
+ from pathlib import Path
5
+ import json
6
+ import sqlite3
7
+ from datetime import datetime
8
+ import threading
9
+
10
+ logger = logging.getLogger(__name__)
11
+
12
+ class ModelCapability(str, Enum):
13
+ """Model capabilities"""
14
+ TEXT_GENERATION = "text_generation"
15
+ CHAT = "chat"
16
+ EMBEDDING = "embedding"
17
+ RERANKING = "reranking"
18
+ REASONING = "reasoning"
19
+ IMAGE_GENERATION = "image_generation"
20
+ IMAGE_ANALYSIS = "image_analysis"
21
+ AUDIO_TRANSCRIPTION = "audio_transcription"
22
+ IMAGE_UNDERSTANDING = "image_understanding"
23
+
24
+ class ModelType(str, Enum):
25
+ """Model types"""
26
+ LLM = "llm"
27
+ EMBEDDING = "embedding"
28
+ RERANK = "rerank"
29
+ IMAGE = "image"
30
+ AUDIO = "audio"
31
+ VIDEO = "video"
32
+ VISION = "vision"
33
+
34
+ class ModelRegistry:
35
+ """SQLite-based registry for model metadata and capabilities"""
36
+
37
+ def __init__(self, db_path: str = "./models/model_registry.db"):
38
+ self.db_path = Path(db_path)
39
+ self.db_path.parent.mkdir(parents=True, exist_ok=True)
40
+ self._lock = threading.Lock()
41
+ self._initialize_database()
42
+
43
+ def _initialize_database(self):
44
+ """Initialize SQLite database with required tables"""
45
+ with sqlite3.connect(self.db_path) as conn:
46
+ conn.execute("""
47
+ CREATE TABLE IF NOT EXISTS models (
48
+ model_id TEXT PRIMARY KEY,
49
+ model_type TEXT NOT NULL,
50
+ metadata TEXT,
51
+ created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
52
+ updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
53
+ )
54
+ """)
55
+
56
+ conn.execute("""
57
+ CREATE TABLE IF NOT EXISTS model_capabilities (
58
+ model_id TEXT,
59
+ capability TEXT,
60
+ PRIMARY KEY (model_id, capability),
61
+ FOREIGN KEY (model_id) REFERENCES models(model_id) ON DELETE CASCADE
62
+ )
63
+ """)
64
+
65
+ conn.execute("""
66
+ CREATE INDEX IF NOT EXISTS idx_model_type ON models(model_type)
67
+ """)
68
+
69
+ conn.execute("""
70
+ CREATE INDEX IF NOT EXISTS idx_capability ON model_capabilities(capability)
71
+ """)
72
+
73
+ conn.commit()
74
+
75
+ def register_model(self,
76
+ model_id: str,
77
+ model_type: ModelType,
78
+ capabilities: List[ModelCapability],
79
+ metadata: Dict[str, Any]) -> bool:
80
+ """Register a model with its capabilities and metadata"""
81
+ try:
82
+ with self._lock:
83
+ with sqlite3.connect(self.db_path) as conn:
84
+ # Insert or update model
85
+ conn.execute("""
86
+ INSERT OR REPLACE INTO models
87
+ (model_id, model_type, metadata, updated_at)
88
+ VALUES (?, ?, ?, CURRENT_TIMESTAMP)
89
+ """, (model_id, model_type.value, json.dumps(metadata)))
90
+
91
+ # Clear existing capabilities
92
+ conn.execute("DELETE FROM model_capabilities WHERE model_id = ?", (model_id,))
93
+
94
+ # Insert new capabilities
95
+ for capability in capabilities:
96
+ conn.execute("""
97
+ INSERT INTO model_capabilities (model_id, capability)
98
+ VALUES (?, ?)
99
+ """, (model_id, capability.value))
100
+
101
+ conn.commit()
102
+
103
+ logger.info(f"Registered model {model_id}")
104
+ return True
105
+
106
+ except Exception as e:
107
+ logger.error(f"Failed to register model {model_id}: {e}")
108
+ return False
109
+
110
+ def unregister_model(self, model_id: str) -> bool:
111
+ """Unregister a model"""
112
+ try:
113
+ with self._lock:
114
+ with sqlite3.connect(self.db_path) as conn:
115
+ cursor = conn.execute("DELETE FROM models WHERE model_id = ?", (model_id,))
116
+ conn.commit()
117
+
118
+ if cursor.rowcount > 0:
119
+ logger.info(f"Unregistered model {model_id}")
120
+ return True
121
+ return False
122
+
123
+ except Exception as e:
124
+ logger.error(f"Failed to unregister model {model_id}: {e}")
125
+ return False
126
+
127
+ def get_model_info(self, model_id: str) -> Optional[Dict[str, Any]]:
128
+ """Get model information"""
129
+ try:
130
+ with sqlite3.connect(self.db_path) as conn:
131
+ conn.row_factory = sqlite3.Row
132
+
133
+ # Get model info
134
+ model_row = conn.execute("""
135
+ SELECT model_id, model_type, metadata, created_at, updated_at
136
+ FROM models WHERE model_id = ?
137
+ """, (model_id,)).fetchone()
138
+
139
+ if not model_row:
140
+ return None
141
+
142
+ # Get capabilities
143
+ capabilities = conn.execute("""
144
+ SELECT capability FROM model_capabilities WHERE model_id = ?
145
+ """, (model_id,)).fetchall()
146
+
147
+ model_info = {
148
+ "model_id": model_row["model_id"],
149
+ "type": model_row["model_type"],
150
+ "capabilities": [cap["capability"] for cap in capabilities],
151
+ "metadata": json.loads(model_row["metadata"]) if model_row["metadata"] else {},
152
+ "created_at": model_row["created_at"],
153
+ "updated_at": model_row["updated_at"]
154
+ }
155
+
156
+ return model_info
157
+
158
+ except Exception as e:
159
+ logger.error(f"Failed to get model info for {model_id}: {e}")
160
+ return None
161
+
162
+ def get_models_by_type(self, model_type: ModelType) -> Dict[str, Dict[str, Any]]:
163
+ """Get all models of a specific type"""
164
+ try:
165
+ with sqlite3.connect(self.db_path) as conn:
166
+ conn.row_factory = sqlite3.Row
167
+
168
+ models = conn.execute("""
169
+ SELECT model_id, model_type, metadata, created_at, updated_at
170
+ FROM models WHERE model_type = ?
171
+ """, (model_type.value,)).fetchall()
172
+
173
+ result = {}
174
+ for model in models:
175
+ model_id = model["model_id"]
176
+
177
+ # Get capabilities for this model
178
+ capabilities = conn.execute("""
179
+ SELECT capability FROM model_capabilities WHERE model_id = ?
180
+ """, (model_id,)).fetchall()
181
+
182
+ result[model_id] = {
183
+ "type": model["model_type"],
184
+ "capabilities": [cap["capability"] for cap in capabilities],
185
+ "metadata": json.loads(model["metadata"]) if model["metadata"] else {},
186
+ "created_at": model["created_at"],
187
+ "updated_at": model["updated_at"]
188
+ }
189
+
190
+ return result
191
+
192
+ except Exception as e:
193
+ logger.error(f"Failed to get models by type {model_type}: {e}")
194
+ return {}
195
+
196
+ def get_models_by_capability(self, capability: ModelCapability) -> Dict[str, Dict[str, Any]]:
197
+ """Get all models with a specific capability"""
198
+ try:
199
+ with sqlite3.connect(self.db_path) as conn:
200
+ conn.row_factory = sqlite3.Row
201
+
202
+ models = conn.execute("""
203
+ SELECT DISTINCT m.model_id, m.model_type, m.metadata, m.created_at, m.updated_at
204
+ FROM models m
205
+ JOIN model_capabilities mc ON m.model_id = mc.model_id
206
+ WHERE mc.capability = ?
207
+ """, (capability.value,)).fetchall()
208
+
209
+ result = {}
210
+ for model in models:
211
+ model_id = model["model_id"]
212
+
213
+ # Get all capabilities for this model
214
+ capabilities = conn.execute("""
215
+ SELECT capability FROM model_capabilities WHERE model_id = ?
216
+ """, (model_id,)).fetchall()
217
+
218
+ result[model_id] = {
219
+ "type": model["model_type"],
220
+ "capabilities": [cap["capability"] for cap in capabilities],
221
+ "metadata": json.loads(model["metadata"]) if model["metadata"] else {},
222
+ "created_at": model["created_at"],
223
+ "updated_at": model["updated_at"]
224
+ }
225
+
226
+ return result
227
+
228
+ except Exception as e:
229
+ logger.error(f"Failed to get models by capability {capability}: {e}")
230
+ return {}
231
+
232
+ def has_capability(self, model_id: str, capability: ModelCapability) -> bool:
233
+ """Check if a model has a specific capability"""
234
+ try:
235
+ with sqlite3.connect(self.db_path) as conn:
236
+ result = conn.execute("""
237
+ SELECT 1 FROM model_capabilities
238
+ WHERE model_id = ? AND capability = ?
239
+ """, (model_id, capability.value)).fetchone()
240
+
241
+ return result is not None
242
+
243
+ except Exception as e:
244
+ logger.error(f"Failed to check capability for {model_id}: {e}")
245
+ return False
246
+
247
+ def list_models(self) -> Dict[str, Dict[str, Any]]:
248
+ """List all registered models"""
249
+ try:
250
+ with sqlite3.connect(self.db_path) as conn:
251
+ conn.row_factory = sqlite3.Row
252
+
253
+ models = conn.execute("""
254
+ SELECT model_id, model_type, metadata, created_at, updated_at
255
+ FROM models ORDER BY created_at DESC
256
+ """).fetchall()
257
+
258
+ result = {}
259
+ for model in models:
260
+ model_id = model["model_id"]
261
+
262
+ # Get capabilities for this model
263
+ capabilities = conn.execute("""
264
+ SELECT capability FROM model_capabilities WHERE model_id = ?
265
+ """, (model_id,)).fetchall()
266
+
267
+ result[model_id] = {
268
+ "type": model["model_type"],
269
+ "capabilities": [cap["capability"] for cap in capabilities],
270
+ "metadata": json.loads(model["metadata"]) if model["metadata"] else {},
271
+ "created_at": model["created_at"],
272
+ "updated_at": model["updated_at"]
273
+ }
274
+
275
+ return result
276
+
277
+ except Exception as e:
278
+ logger.error(f"Failed to list models: {e}")
279
+ return {}
280
+
281
+ def get_stats(self) -> Dict[str, Any]:
282
+ """Get registry statistics"""
283
+ try:
284
+ with sqlite3.connect(self.db_path) as conn:
285
+ # Count total models
286
+ total_models = conn.execute("SELECT COUNT(*) FROM models").fetchone()[0]
287
+
288
+ # Count by type
289
+ type_counts = dict(conn.execute("""
290
+ SELECT model_type, COUNT(*) FROM models GROUP BY model_type
291
+ """).fetchall())
292
+
293
+ # Count by capability
294
+ capability_counts = dict(conn.execute("""
295
+ SELECT capability, COUNT(*) FROM model_capabilities GROUP BY capability
296
+ """).fetchall())
297
+
298
+ return {
299
+ "total_models": total_models,
300
+ "models_by_type": type_counts,
301
+ "models_by_capability": capability_counts
302
+ }
303
+
304
+ except Exception as e:
305
+ logger.error(f"Failed to get stats: {e}")
306
+ return {}
307
+
308
+ def search_models(self, query: str) -> Dict[str, Dict[str, Any]]:
309
+ """Search models by name or metadata"""
310
+ try:
311
+ with sqlite3.connect(self.db_path) as conn:
312
+ conn.row_factory = sqlite3.Row
313
+
314
+ models = conn.execute("""
315
+ SELECT model_id, model_type, metadata, created_at, updated_at
316
+ FROM models
317
+ WHERE model_id LIKE ? OR metadata LIKE ?
318
+ ORDER BY created_at DESC
319
+ """, (f"%{query}%", f"%{query}%")).fetchall()
320
+
321
+ result = {}
322
+ for model in models:
323
+ model_id = model["model_id"]
324
+
325
+ # Get capabilities for this model
326
+ capabilities = conn.execute("""
327
+ SELECT capability FROM model_capabilities WHERE model_id = ?
328
+ """, (model_id,)).fetchall()
329
+
330
+ result[model_id] = {
331
+ "type": model["model_type"],
332
+ "capabilities": [cap["capability"] for cap in capabilities],
333
+ "metadata": json.loads(model["metadata"]) if model["metadata"] else {},
334
+ "created_at": model["created_at"],
335
+ "updated_at": model["updated_at"]
336
+ }
337
+
338
+ return result
339
+
340
+ except Exception as e:
341
+ logger.error(f"Failed to search models with query '{query}': {e}")
342
+ return {}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: isa-model
3
- Version: 0.0.3
3
+ Version: 0.0.4
4
4
  Summary: Unified AI model serving framework
5
5
  Author-email: isA_Model Contributors <your.email@example.com>
6
6
  License-Expression: MIT
@@ -10,7 +10,7 @@ build-backend = "setuptools.build_meta"
10
10
 
11
11
  [project]
12
12
  name = "isa-model"
13
- version = "0.0.3"
13
+ version = "0.0.4"
14
14
  description = "Unified AI model serving framework"
15
15
  authors = [
16
16
  {name = "isA_Model Contributors", email = "your.email@example.com"}
@@ -1,115 +0,0 @@
1
- from typing import Dict, List, Optional, Any
2
- from enum import Enum
3
- import logging
4
- from pathlib import Path
5
- import json
6
-
7
- logger = logging.getLogger(__name__)
8
-
9
- class ModelCapability(str, Enum):
10
- """Model capabilities"""
11
- TEXT_GENERATION = "text_generation"
12
- CHAT = "chat"
13
- EMBEDDING = "embedding"
14
- RERANKING = "reranking"
15
- REASONING = "reasoning"
16
- IMAGE_GENERATION = "image_generation"
17
- IMAGE_ANALYSIS = "image_analysis"
18
- AUDIO_TRANSCRIPTION = "audio_transcription"
19
- IMAGE_UNDERSTANDING = "image_understanding"
20
-
21
- class ModelType(str, Enum):
22
- """Model types"""
23
- LLM = "llm"
24
- EMBEDDING = "embedding"
25
- RERANK = "rerank"
26
- IMAGE = "image"
27
- AUDIO = "audio"
28
- VIDEO = "video"
29
- VISION = "vision"
30
-
31
- class ModelRegistry:
32
- """Registry for model metadata and capabilities"""
33
-
34
- def __init__(self, registry_file: str = "./models/model_registry.json"):
35
- self.registry_file = Path(registry_file)
36
- self.registry: Dict[str, Dict[str, Any]] = {}
37
- self._load_registry()
38
-
39
- def _load_registry(self):
40
- """Load model registry from file"""
41
- if self.registry_file.exists():
42
- with open(self.registry_file, 'r') as f:
43
- self.registry = json.load(f)
44
- else:
45
- self.registry = {}
46
- self._save_registry()
47
-
48
- def _save_registry(self):
49
- """Save model registry to file"""
50
- self.registry_file.parent.mkdir(parents=True, exist_ok=True)
51
- with open(self.registry_file, 'w') as f:
52
- json.dump(self.registry, f, indent=2)
53
-
54
- def register_model(self,
55
- model_id: str,
56
- model_type: ModelType,
57
- capabilities: List[ModelCapability],
58
- metadata: Dict[str, Any]) -> bool:
59
- """Register a model with its capabilities and metadata"""
60
- try:
61
- self.registry[model_id] = {
62
- "type": model_type,
63
- "capabilities": [cap.value for cap in capabilities],
64
- "metadata": metadata
65
- }
66
- self._save_registry()
67
- logger.info(f"Registered model {model_id}")
68
- return True
69
- except Exception as e:
70
- logger.error(f"Failed to register model {model_id}: {e}")
71
- return False
72
-
73
- def unregister_model(self, model_id: str) -> bool:
74
- """Unregister a model"""
75
- try:
76
- if model_id in self.registry:
77
- del self.registry[model_id]
78
- self._save_registry()
79
- logger.info(f"Unregistered model {model_id}")
80
- return True
81
- return False
82
- except Exception as e:
83
- logger.error(f"Failed to unregister model {model_id}: {e}")
84
- return False
85
-
86
- def get_model_info(self, model_id: str) -> Optional[Dict[str, Any]]:
87
- """Get model information"""
88
- return self.registry.get(model_id)
89
-
90
- def get_models_by_type(self, model_type: ModelType) -> Dict[str, Dict[str, Any]]:
91
- """Get all models of a specific type"""
92
- return {
93
- model_id: info
94
- for model_id, info in self.registry.items()
95
- if info["type"] == model_type
96
- }
97
-
98
- def get_models_by_capability(self, capability: ModelCapability) -> Dict[str, Dict[str, Any]]:
99
- """Get all models with a specific capability"""
100
- return {
101
- model_id: info
102
- for model_id, info in self.registry.items()
103
- if capability.value in info["capabilities"]
104
- }
105
-
106
- def has_capability(self, model_id: str, capability: ModelCapability) -> bool:
107
- """Check if a model has a specific capability"""
108
- model_info = self.get_model_info(model_id)
109
- if not model_info:
110
- return False
111
- return capability.value in model_info["capabilities"]
112
-
113
- def list_models(self) -> Dict[str, Dict[str, Any]]:
114
- """List all registered models"""
115
- return self.registry
File without changes
File without changes
File without changes
File without changes
File without changes