isa-model 0.4.3__tar.gz → 0.4.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.
- {isa_model-0.4.3 → isa_model-0.4.4}/PKG-INFO +6 -1
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/core/config.py +3 -3
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/core/models/model_manager.py +1 -69
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model.egg-info/PKG-INFO +6 -1
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model.egg-info/SOURCES.txt +0 -13
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model.egg-info/requires.txt +6 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/pyproject.toml +9 -1
- isa_model-0.4.3/isa_model/core/security/secrets.py +0 -358
- isa_model-0.4.3/isa_model/core/storage/hf_storage.py +0 -419
- isa_model-0.4.3/isa_model/deployment/local/__init__.py +0 -31
- isa_model-0.4.3/isa_model/deployment/local/config.py +0 -248
- isa_model-0.4.3/isa_model/deployment/local/gpu_gateway.py +0 -607
- isa_model-0.4.3/isa_model/deployment/local/health_checker.py +0 -428
- isa_model-0.4.3/isa_model/deployment/local/provider.py +0 -586
- isa_model-0.4.3/isa_model/deployment/local/tensorrt_service.py +0 -621
- isa_model-0.4.3/isa_model/deployment/local/transformers_service.py +0 -644
- isa_model-0.4.3/isa_model/deployment/local/vllm_service.py +0 -527
- isa_model-0.4.3/isa_model/inference/services/custom_model_manager.py +0 -277
- isa_model-0.4.3/isa_model/inference/services/llm/local_llm_service.py +0 -747
- isa_model-0.4.3/isa_model/inference/services/vision/blip_vision_service.py +0 -359
- {isa_model-0.4.3 → isa_model-0.4.4}/MANIFEST.in +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/README.md +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/__init__.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/client.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/core/cache/redis_cache.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/core/config/__init__.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/core/config/config_manager.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/core/database/__init__.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/core/database/direct_db_client.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/core/database/migration_manager.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/core/database/migrations.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/core/database/supabase_client.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/core/dependencies.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/core/discovery/__init__.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/core/discovery/consul_discovery.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/core/logging/__init__.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/core/logging/influx_logger.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/core/logging/loki_logger.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/core/models/__init__.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/core/models/config_models.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/core/models/deployment_billing_tracker.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/core/models/model_billing_tracker.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/core/models/model_metadata.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/core/models/model_repo.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/core/models/model_statistics_tracker.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/core/models/model_storage.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/core/models/model_version_manager.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/core/models/system_models.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/core/pricing_manager.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/core/repositories/__init__.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/core/repositories/config_repository.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/core/resilience/circuit_breaker.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/core/services/__init__.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/core/services/intelligent_model_selector.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/core/storage/local_storage.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/core/types.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/deployment/__init__.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/deployment/core/__init__.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/deployment/core/deployment_manager.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/deployment/modal/__init__.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/deployment/modal/config.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/deployment/modal/deployer.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/deployment/modal/services/__init__.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/deployment/modal/services/audio/__init__.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/deployment/modal/services/audio/isa_audio_chatTTS_service.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/deployment/modal/services/audio/isa_audio_fish_service.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/deployment/modal/services/audio/isa_audio_openvoice_service.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/deployment/modal/services/audio/isa_audio_service_v2.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/deployment/modal/services/embedding/__init__.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/deployment/modal/services/embedding/isa_embed_rerank_service.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/deployment/modal/services/llm/__init__.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/deployment/modal/services/llm/isa_llm_service.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/deployment/modal/services/video/__init__.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/deployment/modal/services/video/isa_video_hunyuan_service.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/deployment/modal/services/vision/__init__.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/deployment/modal/services/vision/isa_vision_ocr_service.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/deployment/modal/services/vision/isa_vision_qwen25_service.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/deployment/modal/services/vision/isa_vision_table_service.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/deployment/modal/services/vision/isa_vision_ui_service.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/deployment/modal/services/vision/isa_vision_ui_service_optimized.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/deployment/modal/services/vision/simple_auto_deploy_vision_service.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/deployment/models/org-org-acme-corp-tenant-a-service-llm-20250825-225822/tenant-a-service_modal_service.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/deployment/models/org-test-org-123-prefix-test-service-llm-20250825-225822/prefix-test-service_modal_service.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/deployment/models/test-llm-service-llm-20250825-204442/test-llm-service_modal_service.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/deployment/models/test-monitoring-gpt2-llm-20250825-212906/test-monitoring-gpt2_modal_service.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/deployment/models/test-monitoring-gpt2-llm-20250825-213009/test-monitoring-gpt2_modal_service.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/deployment/storage/__init__.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/deployment/storage/deployment_repository.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/deployment/triton/__init__.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/deployment/triton/config.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/deployment/triton/configs/__init__.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/deployment/triton/provider.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/deployment/triton/scripts/__init__.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/deployment/triton/templates/__init__.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/__init__.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/ai_factory.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/base.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/legacy_services/__init__.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/legacy_services/model_evaluation.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/legacy_services/model_service.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/legacy_services/model_serving.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/legacy_services/model_training.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/models/__init__.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/models/inference_config.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/models/inference_record.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/models/performance_models.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/repositories/__init__.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/repositories/inference_repository.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/services/__init__.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/services/audio/__init__.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/services/audio/base_realtime_service.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/services/audio/base_stt_service.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/services/audio/base_tts_service.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/services/audio/isa_tts_service.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/services/audio/openai_realtime_service.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/services/audio/openai_stt_service.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/services/audio/openai_tts_service.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/services/audio/replicate_tts_service.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/services/base_service.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/services/embedding/__init__.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/services/embedding/base_embed_service.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/services/embedding/helpers/text_splitter.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/services/embedding/isa_embed_service.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/services/embedding/ollama_embed_service.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/services/embedding/openai_embed_service.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/services/embedding/resilient_embed_service.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/services/embedding/tests/test_embedding.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/services/img/__init__.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/services/img/base_image_gen_service.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/services/img/replicate_image_gen_service.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/services/img/services/replicate_face_swap.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/services/img/services/replicate_flux.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/services/img/services/replicate_flux_kontext.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/services/img/services/replicate_sticker_maker.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/services/img/tests/test_img_client.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/services/llm/__init__.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/services/llm/base_llm_service.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/services/llm/cerebras_llm_service.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/services/llm/helpers/llm_adapter.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/services/llm/helpers/llm_prompts.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/services/llm/helpers/llm_utils.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/services/llm/huggingface_llm_service.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/services/llm/ollama_llm_service.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/services/llm/openai_llm_service.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/services/llm/yyds_llm_service.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/services/ml/base_ml_service.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/services/ml/sklearn_ml_service.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/services/vision/__init__.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/services/vision/base_vision_service.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/services/vision/disabled/isA_vision_service.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/services/vision/helpers/image_utils.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/services/vision/helpers/vision_prompts.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/services/vision/isa_vision_service.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/services/vision/openai_vision_service.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/services/vision/replicate_vision_service.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/services/vision/tests/test_ocr_client.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/services/vision/vgg16_vision_service.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/utils/conversion/bge_rerank_convert.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/utils/conversion/onnx_converter.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/inference/utils/conversion/torch_converter.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/serving/__init__.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/serving/api/__init__.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/serving/api/cache_manager.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/serving/api/dependencies/__init__.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/serving/api/dependencies/auth.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/serving/api/dependencies/database.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/serving/api/error_handlers.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/serving/api/fastapi_server.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/serving/api/middleware/__init__.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/serving/api/middleware/auth.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/serving/api/middleware/request_logger.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/serving/api/middleware/security.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/serving/api/middleware/tenant_context.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/serving/api/routes/__init__.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/serving/api/routes/analytics.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/serving/api/routes/config.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/serving/api/routes/deployment_billing.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/serving/api/routes/deployments.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/serving/api/routes/gpu_gateway.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/serving/api/routes/health.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/serving/api/routes/inference_monitoring.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/serving/api/routes/llm.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/serving/api/routes/local_deployments.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/serving/api/routes/logs.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/serving/api/routes/settings.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/serving/api/routes/tenants.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/serving/api/routes/ui_analysis.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/serving/api/routes/unified.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/serving/api/routes/vision.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/serving/api/routes/webhooks.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/serving/api/schemas/__init__.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/serving/api/schemas/common.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/serving/api/schemas/ui_analysis.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/serving/api/startup.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/serving/modal_proxy_server.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model/utils/gpu_utils.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model.egg-info/dependency_links.txt +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/isa_model.egg-info/top_level.txt +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/setup.cfg +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/setup.py +0 -0
- {isa_model-0.4.3 → isa_model-0.4.4}/tests/test_inference_service.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: isa_model
|
3
|
-
Version: 0.4.
|
3
|
+
Version: 0.4.4
|
4
4
|
Summary: Unified AI model serving framework
|
5
5
|
Author: isA_Model Contributors
|
6
6
|
Classifier: Development Status :: 3 - Alpha
|
@@ -89,6 +89,11 @@ Requires-Dist: isa-model[cloud,k8s,monitoring,storage]; extra == "production"
|
|
89
89
|
Provides-Extra: staging
|
90
90
|
Requires-Dist: isa-model[cloud,langchain,monitoring,storage]; extra == "staging"
|
91
91
|
Requires-Dist: python-consul>=1.1.0; extra == "staging"
|
92
|
+
Provides-Extra: staging-minimal
|
93
|
+
Requires-Dist: isa-model[cloud,langchain,storage]; extra == "staging-minimal"
|
94
|
+
Requires-Dist: influxdb-client>=1.36.0; extra == "staging-minimal"
|
95
|
+
Requires-Dist: python-logging-loki>=0.3.1; extra == "staging-minimal"
|
96
|
+
Requires-Dist: python-consul>=1.1.0; extra == "staging-minimal"
|
92
97
|
Provides-Extra: all
|
93
98
|
Requires-Dist: isa-model[audio,cloud,gpu-cloud,k8s,langchain,local,monitoring,storage,training,vision]; extra == "all"
|
94
99
|
|
@@ -54,7 +54,7 @@ class LocalGPUGlobalConfig:
|
|
54
54
|
enable_local_gpu: bool = True
|
55
55
|
auto_detect_gpu: bool = True
|
56
56
|
workspace_dir: str = "./local_deployments"
|
57
|
-
preferred_backend: str = "
|
57
|
+
preferred_backend: str = "api" # cloud api only
|
58
58
|
|
59
59
|
# Default resource settings
|
60
60
|
default_gpu_memory_fraction: float = 0.9
|
@@ -114,7 +114,7 @@ class GlobalConfig:
|
|
114
114
|
local_gpu_memory_fraction: float = 0.9
|
115
115
|
local_workspace_dir: str = "./local_deployments"
|
116
116
|
auto_detect_gpu: bool = True
|
117
|
-
preferred_local_backend: str = "
|
117
|
+
preferred_local_backend: str = "api" # cloud api only
|
118
118
|
|
119
119
|
# Local service defaults
|
120
120
|
local_health_check_interval: int = 30 # seconds
|
@@ -263,7 +263,7 @@ class ConfigManager:
|
|
263
263
|
"enable_local_gpu": os.getenv("ISA_ENABLE_LOCAL_GPU", "true").lower() == "true",
|
264
264
|
"auto_detect_gpu": os.getenv("ISA_AUTO_DETECT_GPU", "true").lower() == "true",
|
265
265
|
"workspace_dir": os.getenv("ISA_LOCAL_WORKSPACE_DIR", "./local_deployments"),
|
266
|
-
"preferred_backend": os.getenv("ISA_PREFERRED_LOCAL_BACKEND", "
|
266
|
+
"preferred_backend": os.getenv("ISA_PREFERRED_LOCAL_BACKEND", "api"),
|
267
267
|
"default_gpu_memory_fraction": float(os.getenv("ISA_GPU_MEMORY_FRACTION", "0.9")),
|
268
268
|
"health_check_interval": int(os.getenv("ISA_LOCAL_HEALTH_CHECK_INTERVAL", "30")),
|
269
269
|
"max_concurrent_services": int(os.getenv("ISA_MAX_CONCURRENT_SERVICES", "3")),
|
@@ -2,8 +2,6 @@ from typing import Dict, Optional, List, Any
|
|
2
2
|
import logging
|
3
3
|
from pathlib import Path
|
4
4
|
from datetime import datetime
|
5
|
-
from huggingface_hub import hf_hub_download, snapshot_download
|
6
|
-
from huggingface_hub.errors import HfHubHTTPError
|
7
5
|
from .model_storage import ModelStorage, LocalModelStorage
|
8
6
|
from .model_repo import ModelRegistry, ModelType, ModelCapability
|
9
7
|
from .model_billing_tracker import ModelBillingTracker, ModelOperationType
|
@@ -102,73 +100,7 @@ class ModelManager:
|
|
102
100
|
logger.warning(f"Failed to find cheapest model for {provider}: {e}")
|
103
101
|
return None
|
104
102
|
|
105
|
-
|
106
|
-
model_id: str,
|
107
|
-
repo_id: str,
|
108
|
-
model_type: ModelType,
|
109
|
-
capabilities: List[ModelCapability],
|
110
|
-
revision: Optional[str] = None,
|
111
|
-
force_download: bool = False) -> Optional[Path]:
|
112
|
-
"""
|
113
|
-
Get model files, downloading if necessary
|
114
|
-
|
115
|
-
Args:
|
116
|
-
model_id: Unique identifier for the model
|
117
|
-
repo_id: Hugging Face repository ID
|
118
|
-
model_type: Type of model (LLM, embedding, etc.)
|
119
|
-
capabilities: List of model capabilities
|
120
|
-
revision: Specific model version/tag
|
121
|
-
force_download: Force re-download even if cached
|
122
|
-
|
123
|
-
Returns:
|
124
|
-
Path to the model files or None if failed
|
125
|
-
"""
|
126
|
-
# Check if model is already downloaded
|
127
|
-
if not force_download:
|
128
|
-
model_path = await self.storage.load_model(model_id)
|
129
|
-
if model_path:
|
130
|
-
logger.info(f"Using cached model {model_id}")
|
131
|
-
return model_path
|
132
|
-
|
133
|
-
try:
|
134
|
-
# Download model files
|
135
|
-
logger.info(f"Downloading model {model_id} from {repo_id}")
|
136
|
-
model_dir = Path(f"./models/temp/{model_id}")
|
137
|
-
model_dir.mkdir(parents=True, exist_ok=True)
|
138
|
-
|
139
|
-
snapshot_download(
|
140
|
-
repo_id=repo_id,
|
141
|
-
revision=revision,
|
142
|
-
local_dir=model_dir,
|
143
|
-
local_dir_use_symlinks=False
|
144
|
-
)
|
145
|
-
|
146
|
-
# Save model and metadata
|
147
|
-
metadata = {
|
148
|
-
"repo_id": repo_id,
|
149
|
-
"revision": revision,
|
150
|
-
"downloaded_at": str(Path(model_dir).stat().st_mtime)
|
151
|
-
}
|
152
|
-
|
153
|
-
# Register model
|
154
|
-
self.registry.register_model(
|
155
|
-
model_id=model_id,
|
156
|
-
model_type=model_type,
|
157
|
-
capabilities=capabilities,
|
158
|
-
metadata=metadata
|
159
|
-
)
|
160
|
-
|
161
|
-
# Save model files
|
162
|
-
await self.storage.save_model(model_id, str(model_dir), metadata)
|
163
|
-
|
164
|
-
return await self.storage.load_model(model_id)
|
165
|
-
|
166
|
-
except HfHubHTTPError as e:
|
167
|
-
logger.error(f"Failed to download model {model_id}: {e}")
|
168
|
-
return None
|
169
|
-
except Exception as e:
|
170
|
-
logger.error(f"Unexpected error downloading model {model_id}: {e}")
|
171
|
-
return None
|
103
|
+
# Local model download functionality removed - use cloud API services only
|
172
104
|
|
173
105
|
async def list_models(self) -> List[Dict[str, Any]]:
|
174
106
|
"""List all downloaded models with their metadata"""
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: isa_model
|
3
|
-
Version: 0.4.
|
3
|
+
Version: 0.4.4
|
4
4
|
Summary: Unified AI model serving framework
|
5
5
|
Author: isA_Model Contributors
|
6
6
|
Classifier: Development Status :: 3 - Alpha
|
@@ -89,6 +89,11 @@ Requires-Dist: isa-model[cloud,k8s,monitoring,storage]; extra == "production"
|
|
89
89
|
Provides-Extra: staging
|
90
90
|
Requires-Dist: isa-model[cloud,langchain,monitoring,storage]; extra == "staging"
|
91
91
|
Requires-Dist: python-consul>=1.1.0; extra == "staging"
|
92
|
+
Provides-Extra: staging-minimal
|
93
|
+
Requires-Dist: isa-model[cloud,langchain,storage]; extra == "staging-minimal"
|
94
|
+
Requires-Dist: influxdb-client>=1.36.0; extra == "staging-minimal"
|
95
|
+
Requires-Dist: python-logging-loki>=0.3.1; extra == "staging-minimal"
|
96
|
+
Requires-Dist: python-consul>=1.1.0; extra == "staging-minimal"
|
92
97
|
Provides-Extra: all
|
93
98
|
Requires-Dist: isa-model[audio,cloud,gpu-cloud,k8s,langchain,local,monitoring,storage,training,vision]; extra == "all"
|
94
99
|
|
@@ -40,22 +40,12 @@ isa_model/core/models/system_models.py
|
|
40
40
|
isa_model/core/repositories/__init__.py
|
41
41
|
isa_model/core/repositories/config_repository.py
|
42
42
|
isa_model/core/resilience/circuit_breaker.py
|
43
|
-
isa_model/core/security/secrets.py
|
44
43
|
isa_model/core/services/__init__.py
|
45
44
|
isa_model/core/services/intelligent_model_selector.py
|
46
|
-
isa_model/core/storage/hf_storage.py
|
47
45
|
isa_model/core/storage/local_storage.py
|
48
46
|
isa_model/deployment/__init__.py
|
49
47
|
isa_model/deployment/core/__init__.py
|
50
48
|
isa_model/deployment/core/deployment_manager.py
|
51
|
-
isa_model/deployment/local/__init__.py
|
52
|
-
isa_model/deployment/local/config.py
|
53
|
-
isa_model/deployment/local/gpu_gateway.py
|
54
|
-
isa_model/deployment/local/health_checker.py
|
55
|
-
isa_model/deployment/local/provider.py
|
56
|
-
isa_model/deployment/local/tensorrt_service.py
|
57
|
-
isa_model/deployment/local/transformers_service.py
|
58
|
-
isa_model/deployment/local/vllm_service.py
|
59
49
|
isa_model/deployment/modal/__init__.py
|
60
50
|
isa_model/deployment/modal/config.py
|
61
51
|
isa_model/deployment/modal/deployer.py
|
@@ -107,7 +97,6 @@ isa_model/inference/repositories/__init__.py
|
|
107
97
|
isa_model/inference/repositories/inference_repository.py
|
108
98
|
isa_model/inference/services/__init__.py
|
109
99
|
isa_model/inference/services/base_service.py
|
110
|
-
isa_model/inference/services/custom_model_manager.py
|
111
100
|
isa_model/inference/services/audio/__init__.py
|
112
101
|
isa_model/inference/services/audio/base_realtime_service.py
|
113
102
|
isa_model/inference/services/audio/base_stt_service.py
|
@@ -137,7 +126,6 @@ isa_model/inference/services/llm/__init__.py
|
|
137
126
|
isa_model/inference/services/llm/base_llm_service.py
|
138
127
|
isa_model/inference/services/llm/cerebras_llm_service.py
|
139
128
|
isa_model/inference/services/llm/huggingface_llm_service.py
|
140
|
-
isa_model/inference/services/llm/local_llm_service.py
|
141
129
|
isa_model/inference/services/llm/ollama_llm_service.py
|
142
130
|
isa_model/inference/services/llm/openai_llm_service.py
|
143
131
|
isa_model/inference/services/llm/yyds_llm_service.py
|
@@ -148,7 +136,6 @@ isa_model/inference/services/ml/base_ml_service.py
|
|
148
136
|
isa_model/inference/services/ml/sklearn_ml_service.py
|
149
137
|
isa_model/inference/services/vision/__init__.py
|
150
138
|
isa_model/inference/services/vision/base_vision_service.py
|
151
|
-
isa_model/inference/services/vision/blip_vision_service.py
|
152
139
|
isa_model/inference/services/vision/isa_vision_service.py
|
153
140
|
isa_model/inference/services/vision/openai_vision_service.py
|
154
141
|
isa_model/inference/services/vision/replicate_vision_service.py
|
@@ -83,6 +83,12 @@ isa-model[cloud,k8s,monitoring,storage]
|
|
83
83
|
isa-model[cloud,langchain,monitoring,storage]
|
84
84
|
python-consul>=1.1.0
|
85
85
|
|
86
|
+
[staging-minimal]
|
87
|
+
isa-model[cloud,langchain,storage]
|
88
|
+
influxdb-client>=1.36.0
|
89
|
+
python-logging-loki>=0.3.1
|
90
|
+
python-consul>=1.1.0
|
91
|
+
|
86
92
|
[storage]
|
87
93
|
boto3>=1.26.0
|
88
94
|
google-cloud-storage>=2.7.0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
4
4
|
|
5
5
|
[project]
|
6
6
|
name = "isa_model"
|
7
|
-
version = "0.4.
|
7
|
+
version = "0.4.4"
|
8
8
|
description = "Unified AI model serving framework"
|
9
9
|
authors = [{name = "isA_Model Contributors"}]
|
10
10
|
readme = "README.md"
|
@@ -152,6 +152,14 @@ staging = [
|
|
152
152
|
"python-consul>=1.1.0", # Service discovery
|
153
153
|
]
|
154
154
|
|
155
|
+
# Ultra-lightweight staging (no MLflow monitoring)
|
156
|
+
staging-minimal = [
|
157
|
+
"isa-model[cloud,storage,langchain]",
|
158
|
+
"influxdb-client>=1.36.0", # Basic logging only
|
159
|
+
"python-logging-loki>=0.3.1", # Centralized logging
|
160
|
+
"python-consul>=1.1.0", # Service discovery
|
161
|
+
]
|
162
|
+
|
155
163
|
all = [
|
156
164
|
"isa-model[cloud,local,training,audio,vision,langchain,storage,monitoring,k8s,gpu-cloud]",
|
157
165
|
]
|
@@ -1,358 +0,0 @@
|
|
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
|
-
}
|