isa-model 0.3.91__py3-none-any.whl → 0.4.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.
- isa_model/client.py +732 -573
- isa_model/core/cache/redis_cache.py +401 -0
- isa_model/core/config/config_manager.py +53 -10
- isa_model/core/config.py +1 -1
- isa_model/core/database/__init__.py +1 -0
- isa_model/core/database/migrations.py +277 -0
- isa_model/core/database/supabase_client.py +123 -0
- isa_model/core/models/__init__.py +37 -0
- isa_model/core/models/model_billing_tracker.py +60 -88
- isa_model/core/models/model_manager.py +36 -18
- isa_model/core/models/model_repo.py +44 -38
- isa_model/core/models/model_statistics_tracker.py +234 -0
- isa_model/core/models/model_storage.py +0 -1
- isa_model/core/models/model_version_manager.py +959 -0
- isa_model/core/pricing_manager.py +2 -249
- isa_model/core/resilience/circuit_breaker.py +366 -0
- isa_model/core/security/secrets.py +358 -0
- isa_model/core/services/__init__.py +2 -4
- isa_model/core/services/intelligent_model_selector.py +101 -370
- isa_model/core/storage/hf_storage.py +1 -1
- isa_model/core/types.py +7 -0
- isa_model/deployment/cloud/modal/isa_audio_chatTTS_service.py +520 -0
- isa_model/deployment/cloud/modal/isa_audio_fish_service.py +0 -0
- isa_model/deployment/cloud/modal/isa_audio_openvoice_service.py +758 -0
- isa_model/deployment/cloud/modal/isa_audio_service_v2.py +1044 -0
- isa_model/deployment/cloud/modal/isa_embed_rerank_service.py +296 -0
- isa_model/deployment/cloud/modal/isa_video_hunyuan_service.py +423 -0
- isa_model/deployment/cloud/modal/isa_vision_ocr_service.py +519 -0
- isa_model/deployment/cloud/modal/isa_vision_qwen25_service.py +709 -0
- isa_model/deployment/cloud/modal/isa_vision_table_service.py +467 -323
- isa_model/deployment/cloud/modal/isa_vision_ui_service.py +607 -180
- isa_model/deployment/cloud/modal/isa_vision_ui_service_optimized.py +660 -0
- isa_model/deployment/core/deployment_manager.py +6 -4
- isa_model/deployment/services/auto_hf_modal_deployer.py +894 -0
- isa_model/eval/benchmarks/__init__.py +27 -0
- isa_model/eval/benchmarks/multimodal_datasets.py +460 -0
- isa_model/eval/benchmarks.py +244 -12
- isa_model/eval/evaluators/__init__.py +8 -2
- isa_model/eval/evaluators/audio_evaluator.py +727 -0
- isa_model/eval/evaluators/embedding_evaluator.py +742 -0
- isa_model/eval/evaluators/vision_evaluator.py +564 -0
- isa_model/eval/example_evaluation.py +395 -0
- isa_model/eval/factory.py +272 -5
- isa_model/eval/isa_benchmarks.py +700 -0
- isa_model/eval/isa_integration.py +582 -0
- isa_model/eval/metrics.py +159 -6
- isa_model/eval/tests/unit/test_basic.py +396 -0
- isa_model/inference/ai_factory.py +44 -8
- isa_model/inference/services/audio/__init__.py +21 -0
- isa_model/inference/services/audio/base_realtime_service.py +225 -0
- isa_model/inference/services/audio/isa_tts_service.py +0 -0
- isa_model/inference/services/audio/openai_realtime_service.py +320 -124
- isa_model/inference/services/audio/openai_stt_service.py +32 -6
- isa_model/inference/services/base_service.py +17 -1
- isa_model/inference/services/embedding/__init__.py +13 -0
- isa_model/inference/services/embedding/base_embed_service.py +111 -8
- isa_model/inference/services/embedding/isa_embed_service.py +305 -0
- isa_model/inference/services/embedding/openai_embed_service.py +2 -4
- isa_model/inference/services/embedding/tests/test_embedding.py +222 -0
- isa_model/inference/services/img/__init__.py +2 -2
- isa_model/inference/services/img/base_image_gen_service.py +24 -7
- isa_model/inference/services/img/replicate_image_gen_service.py +84 -422
- isa_model/inference/services/img/services/replicate_face_swap.py +193 -0
- isa_model/inference/services/img/services/replicate_flux.py +226 -0
- isa_model/inference/services/img/services/replicate_flux_kontext.py +219 -0
- isa_model/inference/services/img/services/replicate_sticker_maker.py +249 -0
- isa_model/inference/services/img/tests/test_img_client.py +297 -0
- isa_model/inference/services/llm/base_llm_service.py +30 -6
- isa_model/inference/services/llm/helpers/llm_adapter.py +63 -9
- isa_model/inference/services/llm/ollama_llm_service.py +2 -1
- isa_model/inference/services/llm/openai_llm_service.py +652 -55
- isa_model/inference/services/llm/yyds_llm_service.py +2 -1
- isa_model/inference/services/vision/__init__.py +5 -5
- isa_model/inference/services/vision/base_vision_service.py +118 -185
- isa_model/inference/services/vision/helpers/image_utils.py +11 -5
- isa_model/inference/services/vision/isa_vision_service.py +573 -0
- isa_model/inference/services/vision/tests/test_ocr_client.py +284 -0
- isa_model/serving/api/fastapi_server.py +88 -16
- isa_model/serving/api/middleware/auth.py +311 -0
- isa_model/serving/api/middleware/security.py +278 -0
- isa_model/serving/api/routes/analytics.py +486 -0
- isa_model/serving/api/routes/deployments.py +339 -0
- isa_model/serving/api/routes/evaluations.py +579 -0
- isa_model/serving/api/routes/logs.py +430 -0
- isa_model/serving/api/routes/settings.py +582 -0
- isa_model/serving/api/routes/unified.py +324 -165
- isa_model/serving/api/startup.py +304 -0
- isa_model/serving/modal_proxy_server.py +249 -0
- isa_model/training/__init__.py +100 -6
- isa_model/training/core/__init__.py +4 -1
- isa_model/training/examples/intelligent_training_example.py +281 -0
- isa_model/training/intelligent/__init__.py +25 -0
- isa_model/training/intelligent/decision_engine.py +643 -0
- isa_model/training/intelligent/intelligent_factory.py +888 -0
- isa_model/training/intelligent/knowledge_base.py +751 -0
- isa_model/training/intelligent/resource_optimizer.py +839 -0
- isa_model/training/intelligent/task_classifier.py +576 -0
- isa_model/training/storage/__init__.py +24 -0
- isa_model/training/storage/core_integration.py +439 -0
- isa_model/training/storage/training_repository.py +552 -0
- isa_model/training/storage/training_storage.py +628 -0
- {isa_model-0.3.91.dist-info → isa_model-0.4.0.dist-info}/METADATA +13 -1
- isa_model-0.4.0.dist-info/RECORD +182 -0
- isa_model/deployment/cloud/modal/isa_vision_doc_service.py +0 -766
- isa_model/deployment/cloud/modal/register_models.py +0 -321
- isa_model/inference/adapter/unified_api.py +0 -248
- isa_model/inference/services/helpers/stacked_config.py +0 -148
- isa_model/inference/services/img/flux_professional_service.py +0 -603
- isa_model/inference/services/img/helpers/base_stacked_service.py +0 -274
- isa_model/inference/services/others/table_transformer_service.py +0 -61
- isa_model/inference/services/vision/doc_analysis_service.py +0 -640
- isa_model/inference/services/vision/helpers/base_stacked_service.py +0 -274
- isa_model/inference/services/vision/ui_analysis_service.py +0 -823
- isa_model/scripts/inference_tracker.py +0 -283
- isa_model/scripts/mlflow_manager.py +0 -379
- isa_model/scripts/model_registry.py +0 -465
- isa_model/scripts/register_models.py +0 -370
- isa_model/scripts/register_models_with_embeddings.py +0 -510
- isa_model/scripts/start_mlflow.py +0 -95
- isa_model/scripts/training_tracker.py +0 -257
- isa_model-0.3.91.dist-info/RECORD +0 -138
- {isa_model-0.3.91.dist-info → isa_model-0.4.0.dist-info}/WHEEL +0 -0
- {isa_model-0.3.91.dist-info → isa_model-0.4.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,358 @@
|
|
1
|
+
"""
|
2
|
+
Secrets Management System
|
3
|
+
|
4
|
+
Provides secure handling of API keys, tokens, and other sensitive data.
|
5
|
+
Supports multiple backends: environment variables, HashiCorp Vault, AWS Secrets Manager.
|
6
|
+
"""
|
7
|
+
|
8
|
+
import os
|
9
|
+
import json
|
10
|
+
import logging
|
11
|
+
import hashlib
|
12
|
+
import base64
|
13
|
+
from typing import Dict, Optional, Any, List
|
14
|
+
from pathlib import Path
|
15
|
+
from cryptography.fernet import Fernet
|
16
|
+
from cryptography.hazmat.primitives import hashes
|
17
|
+
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
|
18
|
+
import structlog
|
19
|
+
|
20
|
+
logger = structlog.get_logger(__name__)
|
21
|
+
|
22
|
+
class SecretsManager:
|
23
|
+
"""Unified secrets management with multiple backend support"""
|
24
|
+
|
25
|
+
def __init__(self, backend: str = "env", **kwargs):
|
26
|
+
self.backend = backend
|
27
|
+
self.config = kwargs
|
28
|
+
self._cache = {}
|
29
|
+
self._encryption_key = None
|
30
|
+
|
31
|
+
# Initialize encryption key for local storage
|
32
|
+
self._init_encryption()
|
33
|
+
|
34
|
+
# Initialize backend
|
35
|
+
if backend == "vault":
|
36
|
+
self._init_vault()
|
37
|
+
elif backend == "aws":
|
38
|
+
self._init_aws()
|
39
|
+
elif backend == "env":
|
40
|
+
self._init_env()
|
41
|
+
else:
|
42
|
+
raise ValueError(f"Unsupported secrets backend: {backend}")
|
43
|
+
|
44
|
+
logger.info("Secrets manager initialized", backend=backend)
|
45
|
+
|
46
|
+
def _init_encryption(self):
|
47
|
+
"""Initialize encryption for local secret storage"""
|
48
|
+
# Use a combination of environment and system info for key derivation
|
49
|
+
password = os.getenv("SECRET_ENCRYPTION_KEY", "default-key-change-in-production").encode()
|
50
|
+
salt = os.getenv("SECRET_SALT", "default-salt").encode()
|
51
|
+
|
52
|
+
kdf = PBKDF2HMAC(
|
53
|
+
algorithm=hashes.SHA256(),
|
54
|
+
length=32,
|
55
|
+
salt=salt,
|
56
|
+
iterations=100000,
|
57
|
+
)
|
58
|
+
key = base64.urlsafe_b64encode(kdf.derive(password))
|
59
|
+
self._encryption_key = Fernet(key)
|
60
|
+
|
61
|
+
def _init_env(self):
|
62
|
+
"""Initialize environment variable backend"""
|
63
|
+
logger.info("Using environment variables for secrets")
|
64
|
+
|
65
|
+
def _init_vault(self):
|
66
|
+
"""Initialize HashiCorp Vault backend"""
|
67
|
+
try:
|
68
|
+
import hvac
|
69
|
+
|
70
|
+
vault_url = self.config.get("vault_url", os.getenv("VAULT_URL"))
|
71
|
+
vault_token = self.config.get("vault_token", os.getenv("VAULT_TOKEN"))
|
72
|
+
|
73
|
+
if not vault_url:
|
74
|
+
raise ValueError("VAULT_URL required for Vault backend")
|
75
|
+
|
76
|
+
self.vault_client = hvac.Client(url=vault_url, token=vault_token)
|
77
|
+
|
78
|
+
if not self.vault_client.is_authenticated():
|
79
|
+
raise ValueError("Vault authentication failed")
|
80
|
+
|
81
|
+
logger.info("Vault backend initialized", url=vault_url)
|
82
|
+
|
83
|
+
except ImportError:
|
84
|
+
raise ImportError("hvac package required for Vault backend: pip install hvac")
|
85
|
+
|
86
|
+
def _init_aws(self):
|
87
|
+
"""Initialize AWS Secrets Manager backend"""
|
88
|
+
try:
|
89
|
+
import boto3
|
90
|
+
|
91
|
+
region = self.config.get("region", os.getenv("AWS_REGION", "us-east-1"))
|
92
|
+
self.secrets_client = boto3.client("secretsmanager", region_name=region)
|
93
|
+
|
94
|
+
logger.info("AWS Secrets Manager backend initialized", region=region)
|
95
|
+
|
96
|
+
except ImportError:
|
97
|
+
raise ImportError("boto3 package required for AWS backend: pip install boto3")
|
98
|
+
|
99
|
+
def get_secret(self, key: str, default: Optional[str] = None) -> Optional[str]:
|
100
|
+
"""Get a secret value by key"""
|
101
|
+
# Check cache first
|
102
|
+
if key in self._cache:
|
103
|
+
return self._cache[key]
|
104
|
+
|
105
|
+
try:
|
106
|
+
if self.backend == "env":
|
107
|
+
value = self._get_env_secret(key, default)
|
108
|
+
elif self.backend == "vault":
|
109
|
+
value = self._get_vault_secret(key, default)
|
110
|
+
elif self.backend == "aws":
|
111
|
+
value = self._get_aws_secret(key, default)
|
112
|
+
else:
|
113
|
+
value = default
|
114
|
+
|
115
|
+
# Cache the value
|
116
|
+
if value is not None:
|
117
|
+
self._cache[key] = value
|
118
|
+
|
119
|
+
return value
|
120
|
+
|
121
|
+
except Exception as e:
|
122
|
+
logger.error("Failed to retrieve secret", key=key, error=str(e))
|
123
|
+
return default
|
124
|
+
|
125
|
+
def _get_env_secret(self, key: str, default: Optional[str] = None) -> Optional[str]:
|
126
|
+
"""Get secret from environment variables"""
|
127
|
+
return os.getenv(key, default)
|
128
|
+
|
129
|
+
def _get_vault_secret(self, key: str, default: Optional[str] = None) -> Optional[str]:
|
130
|
+
"""Get secret from HashiCorp Vault"""
|
131
|
+
try:
|
132
|
+
secret_path = self.config.get("secret_path", "secret/data/isa-model")
|
133
|
+
response = self.vault_client.secrets.kv.v2.read_secret_version(path=secret_path)
|
134
|
+
data = response["data"]["data"]
|
135
|
+
return data.get(key, default)
|
136
|
+
except Exception as e:
|
137
|
+
logger.warning("Failed to retrieve secret from Vault", key=key, error=str(e))
|
138
|
+
return default
|
139
|
+
|
140
|
+
def _get_aws_secret(self, key: str, default: Optional[str] = None) -> Optional[str]:
|
141
|
+
"""Get secret from AWS Secrets Manager"""
|
142
|
+
try:
|
143
|
+
secret_name = self.config.get("secret_name", "isa-model/secrets")
|
144
|
+
response = self.secrets_client.get_secret_value(SecretId=secret_name)
|
145
|
+
secrets = json.loads(response["SecretString"])
|
146
|
+
return secrets.get(key, default)
|
147
|
+
except Exception as e:
|
148
|
+
logger.warning("Failed to retrieve secret from AWS", key=key, error=str(e))
|
149
|
+
return default
|
150
|
+
|
151
|
+
def set_secret(self, key: str, value: str) -> bool:
|
152
|
+
"""Set a secret value (only supported for some backends)"""
|
153
|
+
try:
|
154
|
+
if self.backend == "vault":
|
155
|
+
return self._set_vault_secret(key, value)
|
156
|
+
elif self.backend == "aws":
|
157
|
+
return self._set_aws_secret(key, value)
|
158
|
+
else:
|
159
|
+
logger.warning("Set operation not supported for backend", backend=self.backend)
|
160
|
+
return False
|
161
|
+
except Exception as e:
|
162
|
+
logger.error("Failed to set secret", key=key, error=str(e))
|
163
|
+
return False
|
164
|
+
|
165
|
+
def _set_vault_secret(self, key: str, value: str) -> bool:
|
166
|
+
"""Set secret in HashiCorp Vault"""
|
167
|
+
try:
|
168
|
+
secret_path = self.config.get("secret_path", "secret/data/isa-model")
|
169
|
+
# Get existing secrets first
|
170
|
+
try:
|
171
|
+
response = self.vault_client.secrets.kv.v2.read_secret_version(path=secret_path)
|
172
|
+
existing_data = response["data"]["data"]
|
173
|
+
except:
|
174
|
+
existing_data = {}
|
175
|
+
|
176
|
+
# Update with new secret
|
177
|
+
existing_data[key] = value
|
178
|
+
|
179
|
+
# Write back to vault
|
180
|
+
self.vault_client.secrets.kv.v2.create_or_update_secret(
|
181
|
+
path=secret_path,
|
182
|
+
secret=existing_data
|
183
|
+
)
|
184
|
+
|
185
|
+
# Update cache
|
186
|
+
self._cache[key] = value
|
187
|
+
return True
|
188
|
+
|
189
|
+
except Exception as e:
|
190
|
+
logger.error("Failed to set secret in Vault", key=key, error=str(e))
|
191
|
+
return False
|
192
|
+
|
193
|
+
def _set_aws_secret(self, key: str, value: str) -> bool:
|
194
|
+
"""Set secret in AWS Secrets Manager"""
|
195
|
+
try:
|
196
|
+
secret_name = self.config.get("secret_name", "isa-model/secrets")
|
197
|
+
|
198
|
+
# Get existing secrets
|
199
|
+
try:
|
200
|
+
response = self.secrets_client.get_secret_value(SecretId=secret_name)
|
201
|
+
existing_secrets = json.loads(response["SecretString"])
|
202
|
+
except:
|
203
|
+
existing_secrets = {}
|
204
|
+
|
205
|
+
# Update with new secret
|
206
|
+
existing_secrets[key] = value
|
207
|
+
|
208
|
+
# Update secret
|
209
|
+
self.secrets_client.update_secret(
|
210
|
+
SecretId=secret_name,
|
211
|
+
SecretString=json.dumps(existing_secrets)
|
212
|
+
)
|
213
|
+
|
214
|
+
# Update cache
|
215
|
+
self._cache[key] = value
|
216
|
+
return True
|
217
|
+
|
218
|
+
except Exception as e:
|
219
|
+
logger.error("Failed to set secret in AWS", key=key, error=str(e))
|
220
|
+
return False
|
221
|
+
|
222
|
+
def list_secrets(self) -> List[str]:
|
223
|
+
"""List available secret keys"""
|
224
|
+
try:
|
225
|
+
if self.backend == "vault":
|
226
|
+
return self._list_vault_secrets()
|
227
|
+
elif self.backend == "aws":
|
228
|
+
return self._list_aws_secrets()
|
229
|
+
elif self.backend == "env":
|
230
|
+
# Return common secret environment variables
|
231
|
+
common_secrets = [
|
232
|
+
"OPENAI_API_KEY", "REPLICATE_API_TOKEN", "ANTHROPIC_API_KEY",
|
233
|
+
"DATABASE_URL", "REDIS_URL", "ISA_API_KEY"
|
234
|
+
]
|
235
|
+
return [key for key in common_secrets if os.getenv(key)]
|
236
|
+
else:
|
237
|
+
return []
|
238
|
+
except Exception as e:
|
239
|
+
logger.error("Failed to list secrets", error=str(e))
|
240
|
+
return []
|
241
|
+
|
242
|
+
def _list_vault_secrets(self) -> List[str]:
|
243
|
+
"""List secrets in HashiCorp Vault"""
|
244
|
+
try:
|
245
|
+
secret_path = self.config.get("secret_path", "secret/data/isa-model")
|
246
|
+
response = self.vault_client.secrets.kv.v2.read_secret_version(path=secret_path)
|
247
|
+
return list(response["data"]["data"].keys())
|
248
|
+
except Exception as e:
|
249
|
+
logger.warning("Failed to list Vault secrets", error=str(e))
|
250
|
+
return []
|
251
|
+
|
252
|
+
def _list_aws_secrets(self) -> List[str]:
|
253
|
+
"""List secrets in AWS Secrets Manager"""
|
254
|
+
try:
|
255
|
+
secret_name = self.config.get("secret_name", "isa-model/secrets")
|
256
|
+
response = self.secrets_client.get_secret_value(SecretId=secret_name)
|
257
|
+
secrets = json.loads(response["SecretString"])
|
258
|
+
return list(secrets.keys())
|
259
|
+
except Exception as e:
|
260
|
+
logger.warning("Failed to list AWS secrets", error=str(e))
|
261
|
+
return []
|
262
|
+
|
263
|
+
def rotate_secret(self, key: str) -> bool:
|
264
|
+
"""Rotate a secret (implementation depends on secret type)"""
|
265
|
+
# This is a placeholder for secret rotation logic
|
266
|
+
logger.info("Secret rotation requested", key=key)
|
267
|
+
# In production, this would implement proper rotation logic
|
268
|
+
return True
|
269
|
+
|
270
|
+
def clear_cache(self):
|
271
|
+
"""Clear the secrets cache"""
|
272
|
+
self._cache.clear()
|
273
|
+
logger.info("Secrets cache cleared")
|
274
|
+
|
275
|
+
# Global secrets manager instance
|
276
|
+
_secrets_manager = None
|
277
|
+
|
278
|
+
def get_secrets_manager() -> SecretsManager:
|
279
|
+
"""Get the global secrets manager instance"""
|
280
|
+
global _secrets_manager
|
281
|
+
|
282
|
+
if _secrets_manager is None:
|
283
|
+
# Determine backend from environment
|
284
|
+
backend = os.getenv("SECRETS_BACKEND", "env")
|
285
|
+
|
286
|
+
# Initialize with backend-specific configuration
|
287
|
+
if backend == "vault":
|
288
|
+
_secrets_manager = SecretsManager(
|
289
|
+
backend="vault",
|
290
|
+
vault_url=os.getenv("VAULT_URL"),
|
291
|
+
vault_token=os.getenv("VAULT_TOKEN"),
|
292
|
+
secret_path=os.getenv("VAULT_SECRET_PATH", "secret/data/isa-model")
|
293
|
+
)
|
294
|
+
elif backend == "aws":
|
295
|
+
_secrets_manager = SecretsManager(
|
296
|
+
backend="aws",
|
297
|
+
region=os.getenv("AWS_REGION", "us-east-1"),
|
298
|
+
secret_name=os.getenv("AWS_SECRET_NAME", "isa-model/secrets")
|
299
|
+
)
|
300
|
+
else:
|
301
|
+
_secrets_manager = SecretsManager(backend="env")
|
302
|
+
|
303
|
+
return _secrets_manager
|
304
|
+
|
305
|
+
def get_secret(key: str, default: Optional[str] = None) -> Optional[str]:
|
306
|
+
"""Convenience function to get a secret"""
|
307
|
+
return get_secrets_manager().get_secret(key, default)
|
308
|
+
|
309
|
+
def set_secret(key: str, value: str) -> bool:
|
310
|
+
"""Convenience function to set a secret"""
|
311
|
+
return get_secrets_manager().set_secret(key, value)
|
312
|
+
|
313
|
+
# Predefined secret getters for common secrets
|
314
|
+
def get_openai_api_key() -> Optional[str]:
|
315
|
+
"""Get OpenAI API key"""
|
316
|
+
return get_secret("OPENAI_API_KEY")
|
317
|
+
|
318
|
+
def get_replicate_api_token() -> Optional[str]:
|
319
|
+
"""Get Replicate API token"""
|
320
|
+
return get_secret("REPLICATE_API_TOKEN")
|
321
|
+
|
322
|
+
def get_anthropic_api_key() -> Optional[str]:
|
323
|
+
"""Get Anthropic API key"""
|
324
|
+
return get_secret("ANTHROPIC_API_KEY")
|
325
|
+
|
326
|
+
def get_database_url() -> Optional[str]:
|
327
|
+
"""Get database URL"""
|
328
|
+
return get_secret("DATABASE_URL")
|
329
|
+
|
330
|
+
def get_redis_url() -> Optional[str]:
|
331
|
+
"""Get Redis URL"""
|
332
|
+
return get_secret("REDIS_URL", "redis://localhost:6379")
|
333
|
+
|
334
|
+
def get_isa_api_key() -> Optional[str]:
|
335
|
+
"""Get ISA API key"""
|
336
|
+
return get_secret("ISA_API_KEY")
|
337
|
+
|
338
|
+
# Health check for secrets manager
|
339
|
+
async def check_secrets_health() -> Dict[str, Any]:
|
340
|
+
"""Check secrets manager health"""
|
341
|
+
try:
|
342
|
+
manager = get_secrets_manager()
|
343
|
+
|
344
|
+
# Test basic functionality
|
345
|
+
test_secret = manager.get_secret("HEALTH_CHECK_TEST", "test")
|
346
|
+
|
347
|
+
return {
|
348
|
+
"secrets_manager": "ok",
|
349
|
+
"backend": manager.backend,
|
350
|
+
"cached_secrets": len(manager._cache),
|
351
|
+
"status": "healthy"
|
352
|
+
}
|
353
|
+
except Exception as e:
|
354
|
+
return {
|
355
|
+
"secrets_manager": "error",
|
356
|
+
"status": "unhealthy",
|
357
|
+
"error": str(e)
|
358
|
+
}
|
@@ -8,12 +8,10 @@ This module contains platform-wide services including:
|
|
8
8
|
|
9
9
|
from .intelligent_model_selector import (
|
10
10
|
IntelligentModelSelector,
|
11
|
-
|
12
|
-
ModelRecommendation
|
11
|
+
get_model_selector
|
13
12
|
)
|
14
13
|
|
15
14
|
__all__ = [
|
16
15
|
"IntelligentModelSelector",
|
17
|
-
"
|
18
|
-
"ModelRecommendation"
|
16
|
+
"get_model_selector"
|
19
17
|
]
|