isa-model 0.3.7__tar.gz → 0.3.8__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.3.7 → isa_model-0.3.8}/PKG-INFO +1 -1
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/client.py +31 -4
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model.egg-info/PKG-INFO +1 -1
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model.egg-info/SOURCES.txt +0 -10
- {isa_model-0.3.7 → isa_model-0.3.8}/pyproject.toml +1 -1
- isa_model-0.3.7/isa_model/inference/providers/__init__.py +0 -19
- isa_model-0.3.7/isa_model/inference/providers/base_provider.py +0 -77
- isa_model-0.3.7/isa_model/inference/providers/ml_provider.py +0 -50
- isa_model-0.3.7/isa_model/inference/providers/modal_provider.py +0 -109
- isa_model-0.3.7/isa_model/inference/providers/model_cache_manager.py +0 -341
- isa_model-0.3.7/isa_model/inference/providers/ollama_provider.py +0 -92
- isa_model-0.3.7/isa_model/inference/providers/openai_provider.py +0 -130
- isa_model-0.3.7/isa_model/inference/providers/replicate_provider.py +0 -119
- isa_model-0.3.7/isa_model/inference/providers/triton_provider.py +0 -439
- isa_model-0.3.7/isa_model/inference/providers/yyds_provider.py +0 -108
- {isa_model-0.3.7 → isa_model-0.3.8}/MANIFEST.in +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/README.md +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/__init__.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/core/config/__init__.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/core/config/config_manager.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/core/config.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/core/models/model_billing_tracker.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/core/models/model_manager.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/core/models/model_repo.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/core/models/model_storage.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/core/pricing_manager.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/core/services/__init__.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/core/services/intelligent_model_selector.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/core/storage/hf_storage.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/core/storage/local_storage.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/core/storage/minio_storage.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/core/types.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/deployment/__init__.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/deployment/cloud/__init__.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/deployment/cloud/modal/__init__.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/deployment/cloud/modal/isa_vision_doc_service.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/deployment/cloud/modal/isa_vision_table_service.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/deployment/cloud/modal/isa_vision_ui_service.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/deployment/cloud/modal/register_models.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/deployment/core/__init__.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/deployment/core/deployment_config.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/deployment/core/deployment_manager.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/deployment/core/isa_deployment_service.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/deployment/gpu_int8_ds8/app/server.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/deployment/gpu_int8_ds8/scripts/test_client.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/deployment/gpu_int8_ds8/scripts/test_client_os.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/deployment/runtime/deployed_service.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/deployment/services/__init__.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/deployment/services/auto_deploy_vision_service.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/deployment/services/model_service.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/deployment/services/service_monitor.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/deployment/services/service_registry.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/deployment/services/simple_auto_deploy_vision_service.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/eval/__init__.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/eval/benchmarks.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/eval/config/__init__.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/eval/config/evaluation_config.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/eval/evaluators/__init__.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/eval/evaluators/base_evaluator.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/eval/evaluators/llm_evaluator.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/eval/factory.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/eval/infrastructure/__init__.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/eval/infrastructure/experiment_tracker.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/eval/metrics.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/inference/__init__.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/inference/adapter/unified_api.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/inference/ai_factory.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/inference/base.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/inference/services/__init__.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/inference/services/audio/base_stt_service.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/inference/services/audio/base_tts_service.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/inference/services/audio/openai_realtime_service.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/inference/services/audio/openai_stt_service.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/inference/services/audio/openai_tts_service.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/inference/services/audio/replicate_tts_service.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/inference/services/base_service.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/inference/services/embedding/base_embed_service.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/inference/services/embedding/helpers/text_splitter.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/inference/services/embedding/ollama_embed_service.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/inference/services/embedding/openai_embed_service.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/inference/services/helpers/stacked_config.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/inference/services/img/__init__.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/inference/services/img/base_image_gen_service.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/inference/services/img/flux_professional_service.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/inference/services/img/helpers/base_stacked_service.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/inference/services/img/replicate_image_gen_service.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/inference/services/llm/__init__.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/inference/services/llm/base_llm_service.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/inference/services/llm/helpers/llm_adapter.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/inference/services/llm/helpers/llm_prompts.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/inference/services/llm/helpers/llm_utils.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/inference/services/llm/ollama_llm_service.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/inference/services/llm/openai_llm_service.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/inference/services/llm/yyds_llm_service.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/inference/services/ml/base_ml_service.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/inference/services/ml/sklearn_ml_service.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/inference/services/others/table_transformer_service.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/inference/services/vision/__init__.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/inference/services/vision/base_vision_service.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/inference/services/vision/disabled/isA_vision_service.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/inference/services/vision/doc_analysis_service.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/inference/services/vision/helpers/base_stacked_service.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/inference/services/vision/helpers/image_utils.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/inference/services/vision/helpers/vision_prompts.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/inference/services/vision/openai_vision_service.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/inference/services/vision/replicate_vision_service.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/inference/services/vision/ui_analysis_service.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/inference/utils/conversion/bge_rerank_convert.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/inference/utils/conversion/onnx_converter.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/inference/utils/conversion/torch_converter.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/scripts/inference_tracker.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/scripts/mlflow_manager.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/scripts/model_registry.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/scripts/register_models.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/scripts/register_models_with_embeddings.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/scripts/start_mlflow.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/scripts/training_tracker.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/serving/__init__.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/serving/api/__init__.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/serving/api/fastapi_server.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/serving/api/middleware/__init__.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/serving/api/middleware/request_logger.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/serving/api/routes/__init__.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/serving/api/routes/health.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/serving/api/routes/llm.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/serving/api/routes/ui_analysis.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/serving/api/routes/unified.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/serving/api/routes/vision.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/serving/api/schemas/__init__.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/serving/api/schemas/common.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/serving/api/schemas/ui_analysis.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/training/__init__.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/training/annotation/annotation_schema.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/training/annotation/processors/annotation_processor.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/training/annotation/storage/dataset_manager.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/training/annotation/storage/dataset_schema.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/training/annotation/tests/test_annotation_flow.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/training/annotation/tests/test_minio copy.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/training/annotation/tests/test_minio_upload.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/training/annotation/views/annotation_controller.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/training/cloud/__init__.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/training/cloud/job_orchestrator.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/training/cloud/runpod_trainer.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/training/cloud/storage_manager.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/training/core/__init__.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/training/core/config.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/training/core/dataset.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/training/core/trainer.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/training/core/utils.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model/training/factory.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model.egg-info/dependency_links.txt +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model.egg-info/requires.txt +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/isa_model.egg-info/top_level.txt +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/setup.cfg +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/setup.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/tests/test_cleaned_ai_factory.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/tests/test_isa_model_client.py +0 -0
- {isa_model-0.3.7 → isa_model-0.3.8}/tests/test_isa_model_client_http.py +0 -0
@@ -138,6 +138,7 @@ class ISAModelClient:
|
|
138
138
|
model_hint: Optional[str] = None,
|
139
139
|
provider_hint: Optional[str] = None,
|
140
140
|
stream: bool = False,
|
141
|
+
tools: Optional[List[Any]] = None,
|
141
142
|
**kwargs
|
142
143
|
) -> Union[Dict[str, Any], object]:
|
143
144
|
"""
|
@@ -150,6 +151,7 @@ class ISAModelClient:
|
|
150
151
|
model_hint: Optional model preference
|
151
152
|
provider_hint: Optional provider preference
|
152
153
|
stream: Enable streaming for text services (returns AsyncGenerator)
|
154
|
+
tools: Optional list of tools for function calling (only for text services)
|
153
155
|
**kwargs: Additional task-specific parameters
|
154
156
|
|
155
157
|
Returns:
|
@@ -174,6 +176,13 @@ class ISAModelClient:
|
|
174
176
|
async for token in await client.invoke("Hello", "chat", "text", stream=True):
|
175
177
|
print(token, end="", flush=True)
|
176
178
|
|
179
|
+
# Text with tools
|
180
|
+
await client.invoke("What's 5+3?", "chat", "text", tools=[calculator_function])
|
181
|
+
|
182
|
+
# Streaming with tools
|
183
|
+
async for token in await client.invoke("What's 5+3?", "chat", "text", stream=True, tools=[calculator_function]):
|
184
|
+
print(token, end="")
|
185
|
+
|
177
186
|
# Image generation
|
178
187
|
await client.invoke("A beautiful sunset", "generate_image", "image")
|
179
188
|
|
@@ -193,6 +202,7 @@ class ISAModelClient:
|
|
193
202
|
service_type=service_type,
|
194
203
|
model_hint=model_hint,
|
195
204
|
provider_hint=provider_hint,
|
205
|
+
tools=tools,
|
196
206
|
**kwargs
|
197
207
|
)
|
198
208
|
else:
|
@@ -202,6 +212,7 @@ class ISAModelClient:
|
|
202
212
|
service_type=service_type,
|
203
213
|
model_hint=model_hint,
|
204
214
|
provider_hint=provider_hint,
|
215
|
+
tools=tools,
|
205
216
|
**kwargs
|
206
217
|
)
|
207
218
|
|
@@ -213,6 +224,7 @@ class ISAModelClient:
|
|
213
224
|
service_type=service_type,
|
214
225
|
model_hint=model_hint,
|
215
226
|
provider_hint=provider_hint,
|
227
|
+
tools=tools,
|
216
228
|
**kwargs
|
217
229
|
)
|
218
230
|
else:
|
@@ -222,6 +234,7 @@ class ISAModelClient:
|
|
222
234
|
service_type=service_type,
|
223
235
|
model_hint=model_hint,
|
224
236
|
provider_hint=provider_hint,
|
237
|
+
tools=tools,
|
225
238
|
**kwargs
|
226
239
|
)
|
227
240
|
|
@@ -349,7 +362,8 @@ class ISAModelClient:
|
|
349
362
|
service_type: str,
|
350
363
|
model_name: str,
|
351
364
|
provider: str,
|
352
|
-
task: str
|
365
|
+
task: str,
|
366
|
+
tools: Optional[List[Any]] = None
|
353
367
|
) -> Any:
|
354
368
|
"""Get appropriate service instance"""
|
355
369
|
|
@@ -357,7 +371,11 @@ class ISAModelClient:
|
|
357
371
|
|
358
372
|
# Check cache first
|
359
373
|
if cache_key in self._service_cache:
|
360
|
-
|
374
|
+
service = self._service_cache[cache_key]
|
375
|
+
# If tools are needed, bind them to the service
|
376
|
+
if tools and service_type == "text":
|
377
|
+
return service.bind_tools(tools)
|
378
|
+
return service
|
361
379
|
|
362
380
|
try:
|
363
381
|
# Route to appropriate AIFactory method
|
@@ -387,6 +405,11 @@ class ISAModelClient:
|
|
387
405
|
|
388
406
|
# Cache the service
|
389
407
|
self._service_cache[cache_key] = service
|
408
|
+
|
409
|
+
# If tools are needed, bind them to the service
|
410
|
+
if tools and service_type == "text":
|
411
|
+
return service.bind_tools(tools)
|
412
|
+
|
390
413
|
return service
|
391
414
|
|
392
415
|
except Exception as e:
|
@@ -616,6 +639,7 @@ class ISAModelClient:
|
|
616
639
|
service_type: str,
|
617
640
|
model_hint: Optional[str] = None,
|
618
641
|
provider_hint: Optional[str] = None,
|
642
|
+
tools: Optional[List[Any]] = None,
|
619
643
|
**kwargs
|
620
644
|
) -> Dict[str, Any]:
|
621
645
|
"""Local invoke using AI Factory (original logic)"""
|
@@ -634,7 +658,8 @@ class ISAModelClient:
|
|
634
658
|
service_type=service_type,
|
635
659
|
model_name=selected_model["model_id"],
|
636
660
|
provider=selected_model["provider"],
|
637
|
-
task=task
|
661
|
+
task=task,
|
662
|
+
tools=tools
|
638
663
|
)
|
639
664
|
|
640
665
|
# Step 3: Execute task with unified interface
|
@@ -823,6 +848,7 @@ class ISAModelClient:
|
|
823
848
|
service_type: str,
|
824
849
|
model_hint: Optional[str] = None,
|
825
850
|
provider_hint: Optional[str] = None,
|
851
|
+
tools: Optional[List[Any]] = None,
|
826
852
|
**kwargs
|
827
853
|
):
|
828
854
|
"""Local streaming using AI Factory"""
|
@@ -840,7 +866,8 @@ class ISAModelClient:
|
|
840
866
|
service_type=service_type,
|
841
867
|
model_name=selected_model["model_id"],
|
842
868
|
provider=selected_model["provider"],
|
843
|
-
task=task
|
869
|
+
task=task,
|
870
|
+
tools=tools
|
844
871
|
)
|
845
872
|
|
846
873
|
# Step 3: Yield tokens from the stream
|
@@ -59,16 +59,6 @@ isa_model/inference/__init__.py
|
|
59
59
|
isa_model/inference/ai_factory.py
|
60
60
|
isa_model/inference/base.py
|
61
61
|
isa_model/inference/adapter/unified_api.py
|
62
|
-
isa_model/inference/providers/__init__.py
|
63
|
-
isa_model/inference/providers/base_provider.py
|
64
|
-
isa_model/inference/providers/ml_provider.py
|
65
|
-
isa_model/inference/providers/modal_provider.py
|
66
|
-
isa_model/inference/providers/model_cache_manager.py
|
67
|
-
isa_model/inference/providers/ollama_provider.py
|
68
|
-
isa_model/inference/providers/openai_provider.py
|
69
|
-
isa_model/inference/providers/replicate_provider.py
|
70
|
-
isa_model/inference/providers/triton_provider.py
|
71
|
-
isa_model/inference/providers/yyds_provider.py
|
72
62
|
isa_model/inference/services/__init__.py
|
73
63
|
isa_model/inference/services/base_service.py
|
74
64
|
isa_model/inference/services/audio/base_stt_service.py
|
@@ -1,19 +0,0 @@
|
|
1
|
-
"""
|
2
|
-
Providers - Components for integrating with different model providers
|
3
|
-
|
4
|
-
File: isa_model/inference/providers/__init__.py
|
5
|
-
This module contains provider implementations for different AI model backends.
|
6
|
-
"""
|
7
|
-
|
8
|
-
from .base_provider import BaseProvider
|
9
|
-
|
10
|
-
__all__ = [
|
11
|
-
"BaseProvider",
|
12
|
-
]
|
13
|
-
|
14
|
-
# Provider implementations can be imported individually as needed
|
15
|
-
# from .triton_provider import TritonProvider
|
16
|
-
# from .ollama_provider import OllamaProvider
|
17
|
-
# from .yyds_provider import YYDSProvider
|
18
|
-
# from .openai_provider import OpenAIProvider
|
19
|
-
# from .replicate_provider import ReplicateProvider
|
@@ -1,77 +0,0 @@
|
|
1
|
-
from abc import ABC, abstractmethod
|
2
|
-
from typing import Dict, List, Any, Optional
|
3
|
-
import os
|
4
|
-
import logging
|
5
|
-
from pathlib import Path
|
6
|
-
import dotenv
|
7
|
-
|
8
|
-
from isa_model.inference.base import ModelType, Capability
|
9
|
-
|
10
|
-
logger = logging.getLogger(__name__)
|
11
|
-
|
12
|
-
class BaseProvider(ABC):
|
13
|
-
"""Base class for all AI providers - handles API key management"""
|
14
|
-
|
15
|
-
def __init__(self, config: Optional[Dict[str, Any]] = None):
|
16
|
-
self.config = config or {}
|
17
|
-
self._load_environment_config()
|
18
|
-
self._validate_config()
|
19
|
-
|
20
|
-
def _load_environment_config(self):
|
21
|
-
"""Load configuration from environment variables"""
|
22
|
-
# Load .env file if it exists
|
23
|
-
project_root = Path(__file__).parent.parent.parent.parent
|
24
|
-
env_path = project_root / ".env"
|
25
|
-
|
26
|
-
if env_path.exists():
|
27
|
-
dotenv.load_dotenv(env_path)
|
28
|
-
|
29
|
-
# Subclasses should override this to load provider-specific env vars
|
30
|
-
self._load_provider_env_vars()
|
31
|
-
|
32
|
-
@abstractmethod
|
33
|
-
def _load_provider_env_vars(self):
|
34
|
-
"""Load provider-specific environment variables"""
|
35
|
-
pass
|
36
|
-
|
37
|
-
def _validate_config(self):
|
38
|
-
"""Validate that required configuration is present"""
|
39
|
-
# Subclasses should override this to validate provider-specific config
|
40
|
-
pass
|
41
|
-
|
42
|
-
def get_api_key(self) -> Optional[str]:
|
43
|
-
"""Get the API key for this provider"""
|
44
|
-
return self.config.get("api_key")
|
45
|
-
|
46
|
-
def has_valid_credentials(self) -> bool:
|
47
|
-
"""Check if provider has valid credentials"""
|
48
|
-
return bool(self.get_api_key())
|
49
|
-
|
50
|
-
@abstractmethod
|
51
|
-
def get_capabilities(self) -> Dict[ModelType, List[Capability]]:
|
52
|
-
"""Get provider capabilities by model type"""
|
53
|
-
pass
|
54
|
-
|
55
|
-
@abstractmethod
|
56
|
-
def get_models(self, model_type: ModelType) -> List[str]:
|
57
|
-
"""Get available models for given type"""
|
58
|
-
pass
|
59
|
-
|
60
|
-
def get_config(self) -> Dict[str, Any]:
|
61
|
-
"""Get provider configuration (without sensitive data)"""
|
62
|
-
# Return a copy without sensitive information
|
63
|
-
config_copy = self.config.copy()
|
64
|
-
if "api_key" in config_copy:
|
65
|
-
config_copy["api_key"] = "***" if config_copy["api_key"] else ""
|
66
|
-
if "api_token" in config_copy:
|
67
|
-
config_copy["api_token"] = "***" if config_copy["api_token"] else ""
|
68
|
-
return config_copy
|
69
|
-
|
70
|
-
def get_full_config(self) -> Dict[str, Any]:
|
71
|
-
"""Get full provider configuration (including sensitive data) - for internal use only"""
|
72
|
-
return self.config.copy()
|
73
|
-
|
74
|
-
@abstractmethod
|
75
|
-
def is_reasoning_model(self, model_name: str) -> bool:
|
76
|
-
"""Check if the model is optimized for reasoning tasks"""
|
77
|
-
pass
|
@@ -1,50 +0,0 @@
|
|
1
|
-
from isa_model.inference.providers.base_provider import BaseProvider
|
2
|
-
from isa_model.inference.base import ModelType, Capability
|
3
|
-
from typing import Dict, List, Any
|
4
|
-
import logging
|
5
|
-
|
6
|
-
logger = logging.getLogger(__name__)
|
7
|
-
|
8
|
-
class MLProvider(BaseProvider):
|
9
|
-
"""Provider for traditional ML models"""
|
10
|
-
|
11
|
-
def __init__(self, config=None):
|
12
|
-
default_config = {
|
13
|
-
"model_directory": "./models/ml",
|
14
|
-
"cache_models": True,
|
15
|
-
"max_cache_size": 5
|
16
|
-
}
|
17
|
-
|
18
|
-
merged_config = {**default_config, **(config or {})}
|
19
|
-
super().__init__(config=merged_config)
|
20
|
-
self.name = "ml"
|
21
|
-
|
22
|
-
logger.info(f"Initialized MLProvider with model directory: {self.config['model_directory']}")
|
23
|
-
|
24
|
-
def get_capabilities(self) -> Dict[ModelType, List[Capability]]:
|
25
|
-
"""Get provider capabilities"""
|
26
|
-
return {
|
27
|
-
ModelType.LLM: [], # ML models are not LLMs
|
28
|
-
ModelType.EMBEDDING: [],
|
29
|
-
ModelType.VISION: [],
|
30
|
-
"ML": [ # Custom model type for traditional ML
|
31
|
-
"CLASSIFICATION",
|
32
|
-
"REGRESSION",
|
33
|
-
"CLUSTERING",
|
34
|
-
"FEATURE_EXTRACTION"
|
35
|
-
]
|
36
|
-
}
|
37
|
-
|
38
|
-
def get_models(self, model_type: str = "ML") -> List[str]:
|
39
|
-
"""Get available ML models"""
|
40
|
-
# In practice, this would scan the model directory
|
41
|
-
return [
|
42
|
-
"fraud_detection_rf",
|
43
|
-
"customer_churn_xgb",
|
44
|
-
"price_prediction_lr",
|
45
|
-
"recommendation_kmeans"
|
46
|
-
]
|
47
|
-
|
48
|
-
def get_config(self) -> Dict[str, Any]:
|
49
|
-
"""Get provider configuration"""
|
50
|
-
return self.config
|
@@ -1,109 +0,0 @@
|
|
1
|
-
"""
|
2
|
-
Modal Provider
|
3
|
-
|
4
|
-
Provider for ISA self-hosted Modal services
|
5
|
-
No API keys needed since we deploy our own services
|
6
|
-
"""
|
7
|
-
|
8
|
-
import os
|
9
|
-
import logging
|
10
|
-
from typing import Dict, Any, Optional, List
|
11
|
-
from .base_provider import BaseProvider
|
12
|
-
from isa_model.inference.base import ModelType, Capability
|
13
|
-
|
14
|
-
logger = logging.getLogger(__name__)
|
15
|
-
|
16
|
-
class ModalProvider(BaseProvider):
|
17
|
-
"""Provider for ISA Modal services"""
|
18
|
-
|
19
|
-
def __init__(self, config: Optional[Dict[str, Any]] = None):
|
20
|
-
super().__init__(config)
|
21
|
-
self.name = "modal"
|
22
|
-
self.base_url = "https://modal.com" # Not used directly
|
23
|
-
|
24
|
-
def _load_provider_env_vars(self):
|
25
|
-
"""Load Modal-specific environment variables"""
|
26
|
-
# Modal doesn't need API keys for deployed services
|
27
|
-
# But we can load Modal token if available
|
28
|
-
modal_token = os.getenv("MODAL_TOKEN_ID") or os.getenv("MODAL_TOKEN_SECRET")
|
29
|
-
if modal_token:
|
30
|
-
self.config["modal_token"] = modal_token
|
31
|
-
|
32
|
-
# Set default config
|
33
|
-
if "timeout" not in self.config:
|
34
|
-
self.config["timeout"] = 300
|
35
|
-
if "deployment_region" not in self.config:
|
36
|
-
self.config["deployment_region"] = "us-east-1"
|
37
|
-
if "gpu_type" not in self.config:
|
38
|
-
self.config["gpu_type"] = "T4"
|
39
|
-
|
40
|
-
def get_api_key(self) -> str:
|
41
|
-
"""Modal services don't need API keys for deployed apps"""
|
42
|
-
return "modal-deployed-service" # Placeholder
|
43
|
-
|
44
|
-
def get_base_url(self) -> str:
|
45
|
-
"""Get base URL for Modal services"""
|
46
|
-
return self.base_url
|
47
|
-
|
48
|
-
def validate_credentials(self) -> bool:
|
49
|
-
"""
|
50
|
-
Validate Modal credentials
|
51
|
-
For deployed services, we assume they're accessible
|
52
|
-
"""
|
53
|
-
try:
|
54
|
-
# Check if Modal is available
|
55
|
-
import modal
|
56
|
-
return True
|
57
|
-
except ImportError:
|
58
|
-
logger.warning("Modal package not available")
|
59
|
-
return False
|
60
|
-
|
61
|
-
def get_capabilities(self) -> Dict[ModelType, List[Capability]]:
|
62
|
-
"""Get Modal provider capabilities"""
|
63
|
-
return {
|
64
|
-
ModelType.VISION: [
|
65
|
-
Capability.OBJECT_DETECTION,
|
66
|
-
Capability.IMAGE_ANALYSIS,
|
67
|
-
Capability.UI_DETECTION,
|
68
|
-
Capability.OCR,
|
69
|
-
Capability.DOCUMENT_ANALYSIS
|
70
|
-
]
|
71
|
-
}
|
72
|
-
|
73
|
-
def get_models(self, model_type: ModelType) -> List[str]:
|
74
|
-
"""Get available models for given type"""
|
75
|
-
if model_type == ModelType.VISION:
|
76
|
-
return [
|
77
|
-
"omniparser-v2.0",
|
78
|
-
"table-transformer-detection",
|
79
|
-
"table-transformer-structure-v1.1",
|
80
|
-
"paddleocr-3.0",
|
81
|
-
"yolov8"
|
82
|
-
]
|
83
|
-
return []
|
84
|
-
|
85
|
-
def is_reasoning_model(self, model_name: str) -> bool:
|
86
|
-
"""Check if the model is optimized for reasoning tasks"""
|
87
|
-
# Vision models are not reasoning models
|
88
|
-
return False
|
89
|
-
|
90
|
-
def get_default_config(self) -> Dict[str, Any]:
|
91
|
-
"""Get default configuration for Modal services"""
|
92
|
-
return {
|
93
|
-
"timeout": 300, # 5 minutes
|
94
|
-
"max_retries": 3,
|
95
|
-
"deployment_region": "us-east-1",
|
96
|
-
"gpu_type": "T4"
|
97
|
-
}
|
98
|
-
|
99
|
-
def get_billing_info(self) -> Dict[str, Any]:
|
100
|
-
"""Get billing information for Modal services"""
|
101
|
-
return {
|
102
|
-
"provider": "modal",
|
103
|
-
"billing_model": "compute_usage",
|
104
|
-
"cost_per_hour": {
|
105
|
-
"T4": 0.60,
|
106
|
-
"A100": 4.00
|
107
|
-
},
|
108
|
-
"note": "Costs depend on actual usage time, scales to zero when not in use"
|
109
|
-
}
|