isa-model 0.3.9__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/__init__.py +1 -1
- isa_model/client.py +732 -565
- 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.9.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.9.dist-info/RECORD +0 -138
- {isa_model-0.3.9.dist-info → isa_model-0.4.0.dist-info}/WHEEL +0 -0
- {isa_model-0.3.9.dist-info → isa_model-0.4.0.dist-info}/top_level.txt +0 -0
@@ -1,148 +0,0 @@
|
|
1
|
-
"""
|
2
|
-
Configuration system for stacked services
|
3
|
-
"""
|
4
|
-
|
5
|
-
from typing import Dict, Any, List, Optional
|
6
|
-
from dataclasses import dataclass, field
|
7
|
-
from enum import Enum
|
8
|
-
|
9
|
-
# Define stacked service specific layer types
|
10
|
-
class StackedLayerType(Enum):
|
11
|
-
"""Types of processing layers for stacked services"""
|
12
|
-
INTELLIGENCE = "intelligence" # High-level understanding
|
13
|
-
DETECTION = "detection" # Element/object detection
|
14
|
-
CLASSIFICATION = "classification" # Detailed classification
|
15
|
-
VALIDATION = "validation" # Result validation
|
16
|
-
TRANSFORMATION = "transformation" # Data transformation
|
17
|
-
GENERATION = "generation" # Content generation
|
18
|
-
ENHANCEMENT = "enhancement" # Quality enhancement
|
19
|
-
CONTROL = "control" # Precise control/refinement
|
20
|
-
UPSCALING = "upscaling" # Resolution enhancement
|
21
|
-
|
22
|
-
@dataclass
|
23
|
-
class LayerConfig:
|
24
|
-
"""Configuration for a processing layer"""
|
25
|
-
name: str
|
26
|
-
layer_type: StackedLayerType
|
27
|
-
service_type: str # e.g., 'vision', 'llm'
|
28
|
-
model_name: str
|
29
|
-
parameters: Dict[str, Any]
|
30
|
-
depends_on: List[str] # Layer dependencies
|
31
|
-
timeout: float = 30.0
|
32
|
-
retry_count: int = 1
|
33
|
-
fallback_enabled: bool = True
|
34
|
-
|
35
|
-
@dataclass
|
36
|
-
class LayerResult:
|
37
|
-
"""Result from a processing layer"""
|
38
|
-
layer_name: str
|
39
|
-
success: bool
|
40
|
-
data: Any
|
41
|
-
metadata: Dict[str, Any]
|
42
|
-
execution_time: float
|
43
|
-
error: Optional[str] = None
|
44
|
-
|
45
|
-
class WorkflowType(Enum):
|
46
|
-
"""Predefined workflow types"""
|
47
|
-
UI_ANALYSIS_FAST = "ui_analysis_fast"
|
48
|
-
UI_ANALYSIS_ACCURATE = "ui_analysis_accurate"
|
49
|
-
UI_ANALYSIS_COMPREHENSIVE = "ui_analysis_comprehensive"
|
50
|
-
SEARCH_PAGE_ANALYSIS = "search_page_analysis"
|
51
|
-
CONTENT_EXTRACTION = "content_extraction"
|
52
|
-
FORM_INTERACTION = "form_interaction"
|
53
|
-
NAVIGATION_ANALYSIS = "navigation_analysis"
|
54
|
-
CUSTOM = "custom"
|
55
|
-
|
56
|
-
@dataclass
|
57
|
-
class StackedServiceConfig:
|
58
|
-
"""Configuration for a stacked service workflow"""
|
59
|
-
name: str
|
60
|
-
workflow_type: WorkflowType
|
61
|
-
layers: List[LayerConfig] = field(default_factory=list)
|
62
|
-
global_timeout: float = 120.0
|
63
|
-
parallel_execution: bool = False
|
64
|
-
fail_fast: bool = False
|
65
|
-
metadata: Dict[str, Any] = field(default_factory=dict)
|
66
|
-
|
67
|
-
class ConfigManager:
|
68
|
-
"""Manager for stacked service configurations"""
|
69
|
-
|
70
|
-
PREDEFINED_CONFIGS = {
|
71
|
-
WorkflowType.UI_ANALYSIS_FAST: {
|
72
|
-
"name": "Fast UI Analysis",
|
73
|
-
"layers": [
|
74
|
-
LayerConfig(
|
75
|
-
name="page_intelligence",
|
76
|
-
layer_type=StackedLayerType.INTELLIGENCE,
|
77
|
-
service_type="vision",
|
78
|
-
model_name="gpt-4.1-nano",
|
79
|
-
parameters={"max_tokens": 300},
|
80
|
-
depends_on=[],
|
81
|
-
timeout=10.0,
|
82
|
-
fallback_enabled=True
|
83
|
-
),
|
84
|
-
LayerConfig(
|
85
|
-
name="element_detection",
|
86
|
-
layer_type=StackedLayerType.DETECTION,
|
87
|
-
service_type="vision",
|
88
|
-
model_name="omniparser",
|
89
|
-
parameters={
|
90
|
-
"imgsz": 480,
|
91
|
-
"box_threshold": 0.08,
|
92
|
-
"iou_threshold": 0.2
|
93
|
-
},
|
94
|
-
depends_on=["page_intelligence"],
|
95
|
-
timeout=15.0,
|
96
|
-
fallback_enabled=True
|
97
|
-
),
|
98
|
-
LayerConfig(
|
99
|
-
name="element_classification",
|
100
|
-
layer_type=StackedLayerType.CLASSIFICATION,
|
101
|
-
service_type="vision",
|
102
|
-
model_name="gpt-4.1-nano",
|
103
|
-
parameters={"max_tokens": 200},
|
104
|
-
depends_on=["page_intelligence", "element_detection"],
|
105
|
-
timeout=20.0,
|
106
|
-
fallback_enabled=False
|
107
|
-
)
|
108
|
-
],
|
109
|
-
"global_timeout": 60.0,
|
110
|
-
"parallel_execution": False,
|
111
|
-
"fail_fast": False,
|
112
|
-
"metadata": {
|
113
|
-
"description": "Fast UI analysis optimized for speed",
|
114
|
-
"expected_time": "30-45 seconds",
|
115
|
-
"accuracy": "medium"
|
116
|
-
}
|
117
|
-
}
|
118
|
-
}
|
119
|
-
|
120
|
-
@classmethod
|
121
|
-
def get_config(cls, workflow_type: WorkflowType) -> StackedServiceConfig:
|
122
|
-
"""Get predefined configuration for a workflow type"""
|
123
|
-
if workflow_type not in cls.PREDEFINED_CONFIGS:
|
124
|
-
raise ValueError(f"Unknown workflow type: {workflow_type}")
|
125
|
-
|
126
|
-
config_data = cls.PREDEFINED_CONFIGS[workflow_type]
|
127
|
-
|
128
|
-
return StackedServiceConfig(
|
129
|
-
name=config_data["name"],
|
130
|
-
workflow_type=workflow_type,
|
131
|
-
layers=config_data["layers"],
|
132
|
-
global_timeout=config_data["global_timeout"],
|
133
|
-
parallel_execution=config_data["parallel_execution"],
|
134
|
-
fail_fast=config_data["fail_fast"],
|
135
|
-
metadata=config_data["metadata"]
|
136
|
-
)
|
137
|
-
|
138
|
-
# Convenience function for quick access
|
139
|
-
def get_ui_analysis_config(speed: str = "accurate") -> StackedServiceConfig:
|
140
|
-
"""Get UI analysis configuration by speed preference"""
|
141
|
-
speed_mapping = {
|
142
|
-
"fast": WorkflowType.UI_ANALYSIS_FAST,
|
143
|
-
"accurate": WorkflowType.UI_ANALYSIS_ACCURATE,
|
144
|
-
"comprehensive": WorkflowType.UI_ANALYSIS_COMPREHENSIVE
|
145
|
-
}
|
146
|
-
|
147
|
-
workflow_type = speed_mapping.get(speed.lower(), WorkflowType.UI_ANALYSIS_ACCURATE)
|
148
|
-
return ConfigManager.get_config(workflow_type)
|