isa-model 0.3.4__py3-none-any.whl → 0.3.6__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.
Files changed (100) hide show
  1. isa_model/__init__.py +30 -1
  2. isa_model/client.py +770 -0
  3. isa_model/core/config/__init__.py +16 -0
  4. isa_model/core/config/config_manager.py +514 -0
  5. isa_model/core/config.py +426 -0
  6. isa_model/core/models/model_billing_tracker.py +476 -0
  7. isa_model/core/models/model_manager.py +399 -0
  8. isa_model/core/models/model_repo.py +343 -0
  9. isa_model/core/pricing_manager.py +426 -0
  10. isa_model/core/services/__init__.py +19 -0
  11. isa_model/core/services/intelligent_model_selector.py +547 -0
  12. isa_model/core/types.py +291 -0
  13. isa_model/deployment/__init__.py +2 -0
  14. isa_model/deployment/cloud/__init__.py +9 -0
  15. isa_model/deployment/cloud/modal/__init__.py +10 -0
  16. isa_model/deployment/cloud/modal/isa_vision_doc_service.py +766 -0
  17. isa_model/deployment/cloud/modal/isa_vision_table_service.py +532 -0
  18. isa_model/deployment/cloud/modal/isa_vision_ui_service.py +406 -0
  19. isa_model/deployment/cloud/modal/register_models.py +321 -0
  20. isa_model/deployment/runtime/deployed_service.py +338 -0
  21. isa_model/deployment/services/__init__.py +9 -0
  22. isa_model/deployment/services/auto_deploy_vision_service.py +537 -0
  23. isa_model/deployment/services/model_service.py +332 -0
  24. isa_model/deployment/services/service_monitor.py +356 -0
  25. isa_model/deployment/services/service_registry.py +527 -0
  26. isa_model/eval/__init__.py +80 -44
  27. isa_model/eval/config/__init__.py +10 -0
  28. isa_model/eval/config/evaluation_config.py +108 -0
  29. isa_model/eval/evaluators/__init__.py +18 -0
  30. isa_model/eval/evaluators/base_evaluator.py +503 -0
  31. isa_model/eval/evaluators/llm_evaluator.py +472 -0
  32. isa_model/eval/factory.py +417 -709
  33. isa_model/eval/infrastructure/__init__.py +24 -0
  34. isa_model/eval/infrastructure/experiment_tracker.py +466 -0
  35. isa_model/eval/metrics.py +191 -21
  36. isa_model/inference/ai_factory.py +187 -387
  37. isa_model/inference/providers/modal_provider.py +109 -0
  38. isa_model/inference/providers/yyds_provider.py +108 -0
  39. isa_model/inference/services/__init__.py +2 -1
  40. isa_model/inference/services/audio/base_stt_service.py +65 -1
  41. isa_model/inference/services/audio/base_tts_service.py +75 -1
  42. isa_model/inference/services/audio/openai_stt_service.py +189 -151
  43. isa_model/inference/services/audio/openai_tts_service.py +12 -10
  44. isa_model/inference/services/audio/replicate_tts_service.py +61 -56
  45. isa_model/inference/services/base_service.py +55 -55
  46. isa_model/inference/services/embedding/base_embed_service.py +65 -1
  47. isa_model/inference/services/embedding/ollama_embed_service.py +103 -43
  48. isa_model/inference/services/embedding/openai_embed_service.py +8 -10
  49. isa_model/inference/services/helpers/stacked_config.py +148 -0
  50. isa_model/inference/services/img/__init__.py +18 -0
  51. isa_model/inference/services/{vision → img}/base_image_gen_service.py +80 -35
  52. isa_model/inference/services/img/flux_professional_service.py +603 -0
  53. isa_model/inference/services/img/helpers/base_stacked_service.py +274 -0
  54. isa_model/inference/services/{vision → img}/replicate_image_gen_service.py +210 -69
  55. isa_model/inference/services/llm/__init__.py +3 -3
  56. isa_model/inference/services/llm/base_llm_service.py +519 -35
  57. isa_model/inference/services/llm/{llm_adapter.py → helpers/llm_adapter.py} +40 -0
  58. isa_model/inference/services/llm/helpers/llm_prompts.py +258 -0
  59. isa_model/inference/services/llm/helpers/llm_utils.py +280 -0
  60. isa_model/inference/services/llm/ollama_llm_service.py +150 -15
  61. isa_model/inference/services/llm/openai_llm_service.py +134 -31
  62. isa_model/inference/services/llm/yyds_llm_service.py +255 -0
  63. isa_model/inference/services/vision/__init__.py +38 -4
  64. isa_model/inference/services/vision/base_vision_service.py +241 -96
  65. isa_model/inference/services/vision/disabled/isA_vision_service.py +500 -0
  66. isa_model/inference/services/vision/doc_analysis_service.py +640 -0
  67. isa_model/inference/services/vision/helpers/base_stacked_service.py +274 -0
  68. isa_model/inference/services/vision/helpers/image_utils.py +272 -3
  69. isa_model/inference/services/vision/helpers/vision_prompts.py +297 -0
  70. isa_model/inference/services/vision/openai_vision_service.py +109 -170
  71. isa_model/inference/services/vision/replicate_vision_service.py +508 -0
  72. isa_model/inference/services/vision/ui_analysis_service.py +823 -0
  73. isa_model/scripts/register_models.py +370 -0
  74. isa_model/scripts/register_models_with_embeddings.py +510 -0
  75. isa_model/serving/__init__.py +19 -0
  76. isa_model/serving/api/__init__.py +10 -0
  77. isa_model/serving/api/fastapi_server.py +89 -0
  78. isa_model/serving/api/middleware/__init__.py +9 -0
  79. isa_model/serving/api/middleware/request_logger.py +88 -0
  80. isa_model/serving/api/routes/__init__.py +5 -0
  81. isa_model/serving/api/routes/health.py +82 -0
  82. isa_model/serving/api/routes/llm.py +19 -0
  83. isa_model/serving/api/routes/ui_analysis.py +223 -0
  84. isa_model/serving/api/routes/unified.py +202 -0
  85. isa_model/serving/api/routes/vision.py +19 -0
  86. isa_model/serving/api/schemas/__init__.py +17 -0
  87. isa_model/serving/api/schemas/common.py +33 -0
  88. isa_model/serving/api/schemas/ui_analysis.py +78 -0
  89. {isa_model-0.3.4.dist-info → isa_model-0.3.6.dist-info}/METADATA +4 -1
  90. isa_model-0.3.6.dist-info/RECORD +147 -0
  91. isa_model/core/model_manager.py +0 -208
  92. isa_model/core/model_registry.py +0 -342
  93. isa_model/inference/billing_tracker.py +0 -406
  94. isa_model/inference/services/llm/triton_llm_service.py +0 -481
  95. isa_model/inference/services/vision/ollama_vision_service.py +0 -194
  96. isa_model-0.3.4.dist-info/RECORD +0 -91
  97. /isa_model/core/{model_storage.py → models/model_storage.py} +0 -0
  98. /isa_model/inference/services/{vision → embedding}/helpers/text_splitter.py +0 -0
  99. {isa_model-0.3.4.dist-info → isa_model-0.3.6.dist-info}/WHEEL +0 -0
  100. {isa_model-0.3.4.dist-info → isa_model-0.3.6.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,78 @@
1
+ """
2
+ UI Analysis API Schemas
3
+
4
+ Pydantic models for UI analysis endpoints
5
+ """
6
+
7
+ from pydantic import BaseModel, Field
8
+ from typing import List, Dict, Any, Optional
9
+ import time
10
+
11
+ class UIElement(BaseModel):
12
+ """UI element detection result"""
13
+ id: str = Field(..., description="Unique element identifier")
14
+ type: str = Field(..., description="Element type (textbox, button, etc.)")
15
+ content: str = Field(..., description="Element text content or description")
16
+ center: List[int] = Field(..., description="Center coordinates [x, y]")
17
+ bbox: List[int] = Field(..., description="Bounding box [x1, y1, x2, y2]")
18
+ confidence: float = Field(..., description="Detection confidence score")
19
+ interactable: bool = Field(True, description="Whether element is interactable")
20
+
21
+ class ActionStep(BaseModel):
22
+ """Single action step in automation plan"""
23
+ step: int = Field(..., description="Step number")
24
+ action: str = Field(..., description="Action type (click, type, scroll)")
25
+ target_coordinates: List[int] = Field(..., description="Target coordinates [x, y]")
26
+ actual_coordinates: List[int] = Field(..., description="Actual coordinates [x, y]")
27
+ description: str = Field(..., description="Human-readable action description")
28
+ confidence: float = Field(0.9, description="Action confidence score")
29
+ text: Optional[str] = Field(None, description="Text to type (for type actions)")
30
+
31
+ class ActionPlan(BaseModel):
32
+ """Complete action plan for UI automation"""
33
+ steps: List[ActionStep] = Field(..., description="List of action steps")
34
+ success_probability: float = Field(0.9, description="Overall success probability")
35
+ estimated_duration: float = Field(5.0, description="Estimated execution time in seconds")
36
+
37
+ class AutomationReadiness(BaseModel):
38
+ """Automation readiness assessment"""
39
+ ready: bool = Field(..., description="Whether automation is ready")
40
+ confidence: float = Field(..., description="Automation confidence score")
41
+ page_type: str = Field(..., description="Detected page type")
42
+ steps_count: int = Field(..., description="Number of automation steps")
43
+ estimated_success_rate: float = Field(0.9, description="Estimated success rate")
44
+
45
+ class UIAnalysisRequest(BaseModel):
46
+ """UI analysis request"""
47
+ image_b64: str = Field(..., description="Base64 encoded image")
48
+ task_type: str = Field("search", description="Analysis task type")
49
+
50
+ model_config = {
51
+ "json_schema_extra": {
52
+ "example": {
53
+ "image_b64": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8/5+hHgAHggJ/PchI7wAAAABJRU5ErkJggg==",
54
+ "task_type": "search"
55
+ }
56
+ }
57
+ }
58
+
59
+ class UIAnalysisResponse(BaseModel):
60
+ """UI analysis response"""
61
+ success: bool = Field(..., description="Analysis success status")
62
+ service: str = Field("ui_analysis", description="Service identifier")
63
+ total_execution_time: float = Field(..., description="Total processing time in seconds")
64
+ ui_elements: List[UIElement] = Field(..., description="Detected UI elements")
65
+ action_plan: ActionPlan = Field(..., description="Generated action plan")
66
+ automation_ready: AutomationReadiness = Field(..., description="Automation readiness")
67
+ metadata: Dict[str, Any] = Field(default_factory=dict, description="Additional metadata")
68
+ timestamp: float = Field(default_factory=time.time, description="Response timestamp")
69
+
70
+ class UIDetectionResponse(BaseModel):
71
+ """UI elements detection only response"""
72
+ success: bool = Field(..., description="Detection success status")
73
+ processing_time: float = Field(..., description="Processing time in seconds")
74
+ ui_elements: List[UIElement] = Field(..., description="Detected UI elements")
75
+ element_count: int = Field(..., description="Number of detected elements")
76
+ task_type: str = Field(..., description="Analysis task type")
77
+ detection_method: str = Field("omniparser", description="Detection method used")
78
+ timestamp: float = Field(default_factory=time.time, description="Response timestamp")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: isa_model
3
- Version: 0.3.4
3
+ Version: 0.3.6
4
4
  Summary: Unified AI model serving framework
5
5
  Author: isA_Model Contributors
6
6
  Classifier: Development Status :: 3 - Alpha
@@ -34,6 +34,9 @@ Requires-Dist: accelerate>=0.20.0
34
34
  Requires-Dist: bitsandbytes>=0.39.0
35
35
  Requires-Dist: peft>=0.4.0
36
36
  Requires-Dist: trl>=0.4.0
37
+ Requires-Dist: supabase>=2.0.0
38
+ Requires-Dist: pgvector>=0.2.0
39
+ Requires-Dist: psycopg2-binary>=2.9.0
37
40
 
38
41
  # isa_model_sdk - Unified AI Model Serving Framework
39
42
 
@@ -0,0 +1,147 @@
1
+ isa_model/__init__.py,sha256=bAbHdrDVQ-mySC_GJtgfLNI8KPcs2LfReBkIOOtpaQQ,867
2
+ isa_model/client.py,sha256=5u_hqGB1hcFX8MQdVYlCLqzs4ylQFY3rq91h3iTI24c,27500
3
+ isa_model/core/config.py,sha256=h9GVTEEMlaJYSCDd0W9q1KtaWTV5V5TawMsKtGuphds,15686
4
+ isa_model/core/pricing_manager.py,sha256=b7HcZsBQ8ZSCzMepOhqN-J9kU43vhTxX5NabQS0aM70,17125
5
+ isa_model/core/types.py,sha256=XLUs442WGNc8E0gF2M-nb6dutD_s-XCfpr2BfGBCA2M,8445
6
+ isa_model/core/config/__init__.py,sha256=SLeHQtYGDHl64NDVyb3ECQXOKepGM8YNHEoM8CVEWus,350
7
+ isa_model/core/config/config_manager.py,sha256=hx0qcdvYEE_cCp-qb8tnVkXnpsTXEuRM1108DoAiUnE,19905
8
+ isa_model/core/models/model_billing_tracker.py,sha256=hxqG5DvQ8kqROC3WVb5Y0tespp73TPPWYq-AwatMZwc,18782
9
+ isa_model/core/models/model_manager.py,sha256=9_JHok4i2q79dhFD3nckrlG-k3z8UGb6bM82iUR-T84,14917
10
+ isa_model/core/models/model_repo.py,sha256=OqvtUrvWmn_k4tkAgdOQ61NneUHsJGbUjkobJf3LNSw,14036
11
+ isa_model/core/models/model_storage.py,sha256=yMLapW87EY1EPXw6S7H8UQAZh3hJ1KxsEohjgjw-HrA,4507
12
+ isa_model/core/services/__init__.py,sha256=M1ob5N-PDPUW0o03ioHORRl5ye5ZEEzT7265-u-NrP4,481
13
+ isa_model/core/services/intelligent_model_selector.py,sha256=vf8BhITetIh5VJcccsESrHyeh9p-V6AHD9NRAEt6a5w,21501
14
+ isa_model/core/storage/hf_storage.py,sha256=HTj1-YGJM3Q-9_Adw7u4NjEmSdr0njsFEL45KXzfcFw,14701
15
+ isa_model/core/storage/local_storage.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
+ isa_model/core/storage/minio_storage.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
+ isa_model/deployment/__init__.py,sha256=tzBOOvDXl6Hh8IiS2ehW6RKeUcBia_MY1uegQFFfFRg,1400
18
+ isa_model/deployment/cloud/__init__.py,sha256=ztahTvIZYNoEU_bqmVAvb3xL_ttWHAGO_UAiwQP4dHY,135
19
+ isa_model/deployment/cloud/modal/__init__.py,sha256=iD65eaqvI7L_W31p-tDO4fMIG5EWfkir1l3SKRSp72Y,265
20
+ isa_model/deployment/cloud/modal/isa_vision_doc_service.py,sha256=GnIOwMNibXFqeA4ToUOovPxuj0NQTLXgkSbR1r6nUcU,30386
21
+ isa_model/deployment/cloud/modal/isa_vision_table_service.py,sha256=ewuRLIM1sqeet_7Vb9y1xcB1vXg2OAHVZNDfeFA_KHM,19814
22
+ isa_model/deployment/cloud/modal/isa_vision_ui_service.py,sha256=75iTaucfLYvWBqAvNdSXJT80R7hInYWOeLamxCyfteQ,14027
23
+ isa_model/deployment/cloud/modal/register_models.py,sha256=gqvKDE8hdwOlSyg5nWrAYNlQ0AjHa4aP9OhFBw7UXLw,12162
24
+ isa_model/deployment/core/__init__.py,sha256=QJkJrs0FYgYcjvnHMSvAtUBiT6uq_ciqLKWLwx0mkDg,803
25
+ isa_model/deployment/core/deployment_config.py,sha256=__bHohsvbdZK_rS_86S1rSHPPP1bTkOnx_G0cj1HMcA,11305
26
+ isa_model/deployment/core/deployment_manager.py,sha256=kICHX1V8wIlmldkrfdqakz2OAjitUfGY6ZG_QjGzZbM,20068
27
+ isa_model/deployment/core/isa_deployment_service.py,sha256=sXU7REZ4xhUUGrpqxlJh-twx18rd97Da4sPEk62QaME,12600
28
+ isa_model/deployment/gpu_int8_ds8/app/server.py,sha256=lwWxdnR2DNEd0vIGQyfabKtDSUzSHVQsy3Z_AJejpVg,2102
29
+ isa_model/deployment/gpu_int8_ds8/scripts/test_client.py,sha256=aCULgRYzEQj_ELUK1bmPgN99yvFgNR5C0O3gc8S32pg,1421
30
+ isa_model/deployment/gpu_int8_ds8/scripts/test_client_os.py,sha256=XXrneTCHUeh1LNRcu-YtZQ5B4pNawlrxC-cTWmJU2A8,936
31
+ isa_model/deployment/runtime/deployed_service.py,sha256=0Z_Hg42oXasEVvuKjwBylJPazcmJYXhS-L9uPainaIg,13400
32
+ isa_model/deployment/services/__init__.py,sha256=JrLlmBlLb6RfiqGMzVVxKZfF5tAKliQqpon_rPoNoeA,216
33
+ isa_model/deployment/services/auto_deploy_vision_service.py,sha256=Luo8FaXsEBoKjGw5HQ7veOnv9Eh0e7U0claXaGa3-1o,19624
34
+ isa_model/deployment/services/model_service.py,sha256=_ncC--8hr5BUwzCWh59yRXPKIPVLapx_31TorB2DIr8,13492
35
+ isa_model/deployment/services/service_monitor.py,sha256=P1zGoeqkNEJwt9AXZF2qTjfSLRm5PKUa80GJVNDSIdA,15223
36
+ isa_model/deployment/services/service_registry.py,sha256=LQgWQOvoP0lb7mC6WTS6shEt6WuX6xc8rRmcixrKwTc,22765
37
+ isa_model/eval/__init__.py,sha256=CRbxC5SN7ow4ymdALSNTHawqw4f82DEdAb7twNT_Pw0,2447
38
+ isa_model/eval/benchmarks.py,sha256=_L4Vwj2hwf2yhqoleIASO9z5e3LRCClCVEVCQbGt0I8,16885
39
+ isa_model/eval/factory.py,sha256=bm5OVY7HIxdBgjlH1n7e5K1YO4ytv8e4KB7z_JS9HVQ,20737
40
+ isa_model/eval/metrics.py,sha256=VMQqcB13OScJsEmfuMZeBk5RLCs01zWknuMqQRVFCjo,30315
41
+ isa_model/eval/config/__init__.py,sha256=SDwprIRp1GSG7PAXJuyNldUZ6dPeuIcwdxCkHZXIeVQ,181
42
+ isa_model/eval/config/evaluation_config.py,sha256=y4tQAqafx5snoQ0QD239C9QXHmqcQvjH34uGSEJUhvI,3051
43
+ isa_model/eval/evaluators/__init__.py,sha256=bDMBhD8bTW740dQEt8Ru-nWPGiJHkyQQcfGEejgzkh4,461
44
+ isa_model/eval/evaluators/base_evaluator.py,sha256=1RivgnnuA-k9EtsZ-KMEtts_5gcfnaTGAoF-uBVSesE,19292
45
+ isa_model/eval/evaluators/llm_evaluator.py,sha256=yfFJFdxwGV2F3mzEWjZ-0fr9u8SR3A20UJ7zS7OgKsw,18054
46
+ isa_model/eval/infrastructure/__init__.py,sha256=fxTdtwAFtjCDOV9MJ3GbhY0A-DqKeTwr_u9WTBnGI_U,648
47
+ isa_model/eval/infrastructure/experiment_tracker.py,sha256=yfMWIAk6oA8Lfer3AtmKg0OEZiGhczmsCD5gmp--uew,15283
48
+ isa_model/inference/__init__.py,sha256=usfuQJ4zYY2RRtHkE-V6LuJ5aN7WJogtPUj9Qmy4Wvw,318
49
+ isa_model/inference/ai_factory.py,sha256=IN-q3jNmcraZ-PWNTHyhdABoxxhIweZYcXO2fr_uXoM,16478
50
+ isa_model/inference/base.py,sha256=qwOddnSGI0GUdD6qIdGBPQpkW7UjU3Y-zaZvu70B4WA,1278
51
+ isa_model/inference/adapter/unified_api.py,sha256=67_Ok8W20m6Otf6r9WyOEVpnxondP4UAxOASk9ozDk4,8668
52
+ isa_model/inference/providers/__init__.py,sha256=a83q-LMFv8u47wf0XtxvqOw_mlVgA_90wtuwy02qdDE,581
53
+ isa_model/inference/providers/base_provider.py,sha256=PT-YnGwBu-Jn_4T3iAphkAJw_mYmKVLjUID62vf2_Ow,2711
54
+ isa_model/inference/providers/ml_provider.py,sha256=4oGGF7lVWQ91Qh3h7olyPFoACLxCROaMxUZlDiZrRL4,1661
55
+ isa_model/inference/providers/modal_provider.py,sha256=klRYXECD5TJicodHIElsGNGMAsAWRFhvn4yfCRcqdVs,3654
56
+ isa_model/inference/providers/model_cache_manager.py,sha256=dLRpx7OJweQ5LcSAkU7D0DQRfLtIhG6nGvg4W_gau80,15315
57
+ isa_model/inference/providers/ollama_provider.py,sha256=IfM9XhdzfE1faguzS2-4GfhK30v5kDPecD3l4z2eB1w,3620
58
+ isa_model/inference/providers/openai_provider.py,sha256=tB8FMsMivlRx0cfPJ0Yrxh1DCvuXyyjNFXrO4lMkkhA,5366
59
+ isa_model/inference/providers/replicate_provider.py,sha256=0oi_BglIE6-HYgzLau9ifP8OdpAMO-QkwYk0OXRUzPk,4490
60
+ isa_model/inference/providers/triton_provider.py,sha256=GKlth7cTOx6ERbsXXJ0gDNby3kVGQNULBDt098BXBSU,15258
61
+ isa_model/inference/providers/yyds_provider.py,sha256=KbDsopShs11_G9oX3b2i2NgHIqkZV7HYWe9K9uZLccc,4284
62
+ isa_model/inference/services/__init__.py,sha256=yfLz0YGl8ixk6LfTRL6cRTvZMb9F_Pv1QRgGyNc9xYM,386
63
+ isa_model/inference/services/base_service.py,sha256=fVaSx0CogHK71UEsNJeSyM8mhqmq5_9ePbbSZVi3Al8,5085
64
+ isa_model/inference/services/audio/base_stt_service.py,sha256=sfzAfreFdvEOBHtphoTrQSjb-gCoCOW4WCj6iIe51oU,5804
65
+ isa_model/inference/services/audio/base_tts_service.py,sha256=PgctcV98Pe9I2kSjScsm8epRwdaEU-vAGCIfdd2P8us,6924
66
+ isa_model/inference/services/audio/openai_realtime_service.py,sha256=UENsx1bEb7aJoXNuBtFGIbTmETpNTZcCHlv0RydEp_U,13340
67
+ isa_model/inference/services/audio/openai_stt_service.py,sha256=chqVuSU8JtwkqY6Y7INm0AdSoDqh-bsg9POzJkxN3h0,10989
68
+ isa_model/inference/services/audio/openai_tts_service.py,sha256=C4vIRvCKoySs4-zBEteI_DZYZsATS84W_ZUwbxjJjpA,8253
69
+ isa_model/inference/services/audio/replicate_tts_service.py,sha256=kCG_bBNgW7GQwt5-ZdwPSqsMiTV54-FhSowFwNWGvg0,10292
70
+ isa_model/inference/services/embedding/base_embed_service.py,sha256=_9HLzwDfKXbhFWT_3VbLQpDF3N1Rr3JS-QXqAZM9Wyc,6045
71
+ isa_model/inference/services/embedding/ollama_embed_service.py,sha256=Pbc3jePaEsudHOn07BSf_A525weoesH3d3r5vs8ODvc,6702
72
+ isa_model/inference/services/embedding/openai_embed_service.py,sha256=Egzq0sxFWf5lndf12xijLuvJSw1wnLeU9wdNR9pnzkQ,8342
73
+ isa_model/inference/services/embedding/helpers/text_splitter.py,sha256=6AbvcQ7H6MS54B9d9T1XBGg4GhvmKfZqp00lKp9pF-U,1635
74
+ isa_model/inference/services/helpers/stacked_config.py,sha256=xPGvWBu364qSF5RXAefAdsqC9SUHC6frTtJamQRQZX8,5473
75
+ isa_model/inference/services/img/__init__.py,sha256=Mip969-_UGRAADfDlcXEBPrsYY7sZleztolcjjmKfyA,518
76
+ isa_model/inference/services/img/base_image_gen_service.py,sha256=PECzUood4E25Bh2hAbe-d62nB6CwRbg1pORdDkLlEjg,7194
77
+ isa_model/inference/services/img/flux_professional_service.py,sha256=c-3F9ANUuYiZPG4SgsOgb6jTDFIXWD52Kz-RC9g_a-Q,26407
78
+ isa_model/inference/services/img/replicate_image_gen_service.py,sha256=QLjgrXNmtdXmKQPCLkmrTjNPL7_icy6enWmeArRCicU,17240
79
+ isa_model/inference/services/img/helpers/base_stacked_service.py,sha256=Y2g2Hz3n2Uwo4RoCbsC33IXxTeQ2TeT6T-2HnXd-2B0,10546
80
+ isa_model/inference/services/llm/__init__.py,sha256=hSdfeqE0463CtQ6ZzREqPBvtzXNuzi3W5PFKS0nwhvo,336
81
+ isa_model/inference/services/llm/base_llm_service.py,sha256=fg79J5mKy27qahvtLscMcquOe4O2L-EoNjE33yPRI9E,22196
82
+ isa_model/inference/services/llm/ollama_llm_service.py,sha256=c0i9TLce6YcPlsLpj11kvwd-H2Uvw23G0ACuNShGyAM,16009
83
+ isa_model/inference/services/llm/openai_llm_service.py,sha256=yhqsExCWvVs6G7EhwZnoXMtKncpwY1VPeZqgLibMSX0,11922
84
+ isa_model/inference/services/llm/yyds_llm_service.py,sha256=WA5vwK9j7PrEEffdvP4thNwBlZ5Z13vFXX_F3Kd5V-Y,10475
85
+ isa_model/inference/services/llm/helpers/llm_adapter.py,sha256=gkKND55EoizRxsaGOCEazUmL-2yTIBI-_njpEOXt-4k,21779
86
+ isa_model/inference/services/llm/helpers/llm_prompts.py,sha256=4ZOovr_Jx5bwPiMkgO1lZF7GMyEFbITP3ZrhhI48QMs,10964
87
+ isa_model/inference/services/llm/helpers/llm_utils.py,sha256=LNfB3qzREyD2TyleOyVa20FU8HbhdxA8G6QV-N-wfZs,10016
88
+ isa_model/inference/services/ml/base_ml_service.py,sha256=mLBA6ENowa3KVzNqHyhWxf_Pr-cJJj84lDE4TniPzYI,2894
89
+ isa_model/inference/services/ml/sklearn_ml_service.py,sha256=Lf9JrwvI25lca7JBbjB_e66eAUtXFbwxZ3Hs13dVGkA,5512
90
+ isa_model/inference/services/others/table_transformer_service.py,sha256=r74h6QUSwSj6jTt-gRProz9SgwBwKWDe50NR0uqW0ZI,2367
91
+ isa_model/inference/services/vision/__init__.py,sha256=9JkNzwZa6WQPUXtq4i7x78mPxkzBNRB-6CkU2WyoCYE,1191
92
+ isa_model/inference/services/vision/base_vision_service.py,sha256=FInmrdhKaeu0vBUbxScH3_B9a_fk3pj2foLx0P81a6o,12645
93
+ isa_model/inference/services/vision/doc_analysis_service.py,sha256=_klnuI99tSkA1gcs5hPQmj6Ld8GElg0S823LXa9id2Y,24797
94
+ isa_model/inference/services/vision/openai_vision_service.py,sha256=IcDX0nBPqt9TJSwMEUD89Fojz1X8jF3ZD1voJGOzu4A,9609
95
+ isa_model/inference/services/vision/replicate_vision_service.py,sha256=smRkSCTwk5mvyKVnvyplqPNuVYjRZngVBWxTCbFmrxA,20679
96
+ isa_model/inference/services/vision/ui_analysis_service.py,sha256=LTFY5rMIQwgWh_kh9KWA44ZI01Mb3We5NsG2scSgBeA,32153
97
+ isa_model/inference/services/vision/disabled/isA_vision_service.py,sha256=VYa8VJtxDB9KdnfNW0GPEP_TPker4pHp33gLD_TnpaM,18336
98
+ isa_model/inference/services/vision/helpers/base_stacked_service.py,sha256=Y2g2Hz3n2Uwo4RoCbsC33IXxTeQ2TeT6T-2HnXd-2B0,10546
99
+ isa_model/inference/services/vision/helpers/image_utils.py,sha256=7RZ368o2UXcRCqyzldUOGhzB5vWbCCJOVR24UdiVdhs,11061
100
+ isa_model/inference/services/vision/helpers/vision_prompts.py,sha256=WbzOYu-Z2-8Xn9dcvuPRTA7VTy23_uoMRRGO4t0wZ8Q,12098
101
+ isa_model/inference/utils/conversion/bge_rerank_convert.py,sha256=1dvtxe5-PPCe2Au6SO8F2XaD-xdIoeA4zDTcid2L9FU,2691
102
+ isa_model/inference/utils/conversion/onnx_converter.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
103
+ isa_model/inference/utils/conversion/torch_converter.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
104
+ isa_model/scripts/inference_tracker.py,sha256=T6qQJMHJcAIQ8eYlgqpM9RWxfiV4z5xIolaoglKBBsg,8831
105
+ isa_model/scripts/mlflow_manager.py,sha256=7xMN0_wELr1jcALuTW9WeWirRkPZPlE2LlFfZKflXBY,12142
106
+ isa_model/scripts/model_registry.py,sha256=7rycPkVk8WHUO3LJaHfdyy5Yq8qmd_4WkGk4wKan-2w,14279
107
+ isa_model/scripts/register_models.py,sha256=ukqhUFiXkZh2IGzJTjEKpqRpf6VW4oSYm4PP_JjYcM8,14658
108
+ isa_model/scripts/register_models_with_embeddings.py,sha256=A4utiT5_uqvgMQJ9qioIZM2XMreHLgJoqZOysNbzmM8,20990
109
+ isa_model/scripts/start_mlflow.py,sha256=3AGKBzByjzbZ56I8w0IOfYnp3V6EU2Lv9NtX9maSqL8,2571
110
+ isa_model/scripts/training_tracker.py,sha256=cnXPi8ip2OK76-aWAOgC-dKx90PqZLEnP6UbHso7Fwc,8080
111
+ isa_model/serving/__init__.py,sha256=LTO0Adbvm7A-bgQqtuOQSoHvdu9OH3OrEjYgQanuHgI,429
112
+ isa_model/serving/api/__init__.py,sha256=wgWD69eqV37fFTLxhz8b0rOn_34P7SZHoWw2sufWjk4,162
113
+ isa_model/serving/api/fastapi_server.py,sha256=UP3CZim8E2tNcyUGaoU9cYM80_yzzpWQFd3ADfo6ANk,2628
114
+ isa_model/serving/api/middleware/__init__.py,sha256=iCKUYECf0bjNGXgV91K03hb8Dnp0Jc_wnUL897Rd0sg,163
115
+ isa_model/serving/api/middleware/request_logger.py,sha256=d48n6tp1pqZ7HFWFl8jg6er24ugWkWkMOc1y80aqPU8,2938
116
+ isa_model/serving/api/routes/__init__.py,sha256=RIaG9OPg0AjAIVbtMzwnqGyNU-tuQXbdvFcYOt4b_Do,84
117
+ isa_model/serving/api/routes/health.py,sha256=NwQcC_bpcaI4YZHTIKbGtg82yQ6QLdp0TwcqbEiqbWs,2208
118
+ isa_model/serving/api/routes/llm.py,sha256=5ZVxWugff0i6VBKz_Nv5CqacMZJsPZEKyoSB6XDrW34,385
119
+ isa_model/serving/api/routes/ui_analysis.py,sha256=-WxLaRKQNHnRh4okB85cWA4blTegpEPZtzHTsF3yeeU,6848
120
+ isa_model/serving/api/routes/unified.py,sha256=rSoHPtMWkGlzFwzzoZeFlCmFGWj2r3q-5QH9VeNQQxA,7074
121
+ isa_model/serving/api/routes/vision.py,sha256=U9jxssQYe6igtayUW0C2fcYwqmLRIE15__X-5Ru9J4c,396
122
+ isa_model/serving/api/schemas/__init__.py,sha256=Tu_hzxoKW1ZHpww3-5ER4A2hNuDByZ0rAfrgaJ7Bs-M,275
123
+ isa_model/serving/api/schemas/common.py,sha256=HVaAS7wlvqrwC1gMZ2Cvo0vzHB053x2uOTAwUoY2vsE,696
124
+ isa_model/serving/api/schemas/ui_analysis.py,sha256=IpOcIvmUeXN1UtZsbGozMfV1vvz7AVF2PVXjjxYl_0k,4089
125
+ isa_model/training/__init__.py,sha256=lfgaSGmOdfizXYV0NKZ6UDXdx_KIlit62eVhGK_6zXA,1533
126
+ isa_model/training/factory.py,sha256=c-77203-2jL3ppcAhhtms6eb8RwI1xz7k324V_NqCFM,13733
127
+ isa_model/training/annotation/annotation_schema.py,sha256=BDEgUlRxMoXGTn12VZ_UUU8rWUHQW_JL39d1AvWU-04,1271
128
+ isa_model/training/annotation/processors/annotation_processor.py,sha256=hz5VhaPLLPuwq2IoBMbxrZfOS_xBVCrqWk1GEKW2zd0,4839
129
+ isa_model/training/annotation/storage/dataset_manager.py,sha256=nKxhmkw-K5vO7Wd5I0Rp5j9fqwV06h_9i_1lVQiU7uU,4592
130
+ isa_model/training/annotation/storage/dataset_schema.py,sha256=JPhrT-pbT0jGd_rmDlhyTesXKv9OYxy85U-RAJFe05o,1086
131
+ isa_model/training/annotation/tests/test_annotation_flow.py,sha256=DXYHP8rLKaLII6bo5Rtltqk4sQxr8k8G-wQegfuXHiE,3605
132
+ isa_model/training/annotation/tests/test_minio copy.py,sha256=EI-PlH5xttAZF14Z_xn6LjgIJBkvP2qjLcvbX2hc0RM,3946
133
+ isa_model/training/annotation/tests/test_minio_upload.py,sha256=fL1eMubwR6L9lYc3zEwlWU9yjJuTsIYi93i0l9QUjm0,1109
134
+ isa_model/training/annotation/views/annotation_controller.py,sha256=3VzJ52yI-YIpcaAAXy2qac7sr4hTnFdtn-ZEKTt4IkM,5792
135
+ isa_model/training/cloud/__init__.py,sha256=ZVsNsnZUgueqtd-e1__xD19njf7KrLTwz28htaU174g,678
136
+ isa_model/training/cloud/job_orchestrator.py,sha256=WDv_7HwibjN7iogCKPnO0UTvvl7ADCQc6rRDHOBj_OQ,15501
137
+ isa_model/training/cloud/runpod_trainer.py,sha256=x9NMFNMnz6HEolADf9wYY5OnkklOspwcE6u_pf_7SVQ,15208
138
+ isa_model/training/cloud/storage_manager.py,sha256=qitWGuPHKNmYCSkMdOO0ccz2xPxFa9EfhcDZwQ-fZXA,18556
139
+ isa_model/training/core/__init__.py,sha256=HyIsPibT0MAy9v55BK95K30aXKkBU6tgVbeTL17HFTY,526
140
+ isa_model/training/core/config.py,sha256=oqgKpBvtzrN6jwLIQYQ2707lH6nmjrktRiSxp9iocVc,5084
141
+ isa_model/training/core/dataset.py,sha256=XCFsnf0NUMU1dJpdvo_CAMyvXB-9_RCUEiy8TU50e20,7802
142
+ isa_model/training/core/trainer.py,sha256=h5TjqjdFr0Fsv5y4-0siy1KmOlqLfliVaUXybvuoeXU,26932
143
+ isa_model/training/core/utils.py,sha256=Nik0M2ssfNbWqP6fKO0Kfyhzr_H6Q19ioxB-qCYbn5E,8387
144
+ isa_model-0.3.6.dist-info/METADATA,sha256=TMGcK76gGTCDWcXfCp17JuAoWxVN4TfVv5Nu-8mN8JE,12326
145
+ isa_model-0.3.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
146
+ isa_model-0.3.6.dist-info/top_level.txt,sha256=eHSy_Xb3kNkh2kK11mi1mZh0Wz91AQ5b8k2KFYO-rE8,10
147
+ isa_model-0.3.6.dist-info/RECORD,,
@@ -1,208 +0,0 @@
1
- from typing import Dict, Optional, List, Any
2
- import logging
3
- from pathlib import Path
4
- from huggingface_hub import hf_hub_download, snapshot_download
5
- from huggingface_hub.errors import HfHubHTTPError
6
- from .model_storage import ModelStorage, LocalModelStorage
7
- from .model_registry import ModelRegistry, ModelType, ModelCapability
8
-
9
- logger = logging.getLogger(__name__)
10
-
11
- class ModelManager:
12
- """Model management service for handling model downloads, versions, and caching"""
13
-
14
- # 统一的模型计费信息 (per 1M tokens)
15
- MODEL_PRICING = {
16
- # OpenAI Models
17
- "openai": {
18
- "gpt-4o-mini": {"input": 0.15, "output": 0.6},
19
- "gpt-4.1-mini": {"input": 0.4, "output": 1.6},
20
- "gpt-4.1-nano": {"input": 0.1, "output": 0.4},
21
- "gpt-4o": {"input": 5.0, "output": 15.0},
22
- "gpt-4-turbo": {"input": 10.0, "output": 30.0},
23
- "gpt-4": {"input": 30.0, "output": 60.0},
24
- "gpt-3.5-turbo": {"input": 0.5, "output": 1.5},
25
- "text-embedding-3-small": {"input": 0.02, "output": 0.0},
26
- "text-embedding-3-large": {"input": 0.13, "output": 0.0},
27
- "whisper-1": {"input": 6.0, "output": 0.0},
28
- "tts-1": {"input": 15.0, "output": 0.0},
29
- "tts-1-hd": {"input": 30.0, "output": 0.0},
30
- },
31
- # Ollama Models (免费本地模型)
32
- "ollama": {
33
- "llama3.2:3b-instruct-fp16": {"input": 0.0, "output": 0.0},
34
- "llama3.2-vision:latest": {"input": 0.0, "output": 0.0},
35
- "bge-m3": {"input": 0.0, "output": 0.0},
36
- },
37
- # Replicate Models
38
- "replicate": {
39
- "black-forest-labs/flux-schnell": {"input": 3.0, "output": 0.0}, # $3 per 1000 images
40
- "black-forest-labs/flux-kontext-pro": {"input": 40.0, "output": 0.0}, # $0.04 per image = $40 per 1000 images
41
- "meta/meta-llama-3-8b-instruct": {"input": 0.05, "output": 0.25},
42
- "kokoro-82m": {"input": 0.0, "output": 0.4}, # ~$0.0004 per second
43
- "jaaari/kokoro-82m:f559560eb822dc509045f3921a1921234918b91739db4bf3daab2169b71c7a13": {"input": 0.0, "output": 0.4},
44
- }
45
- }
46
-
47
- def __init__(self,
48
- storage: Optional[ModelStorage] = None,
49
- registry: Optional[ModelRegistry] = None):
50
- self.storage = storage or LocalModelStorage()
51
- self.registry = registry or ModelRegistry()
52
-
53
- def get_model_pricing(self, provider: str, model_name: str) -> Dict[str, float]:
54
- """获取模型定价信息"""
55
- return self.MODEL_PRICING.get(provider, {}).get(model_name, {"input": 0.0, "output": 0.0})
56
-
57
- def calculate_cost(self, provider: str, model_name: str, input_tokens: int, output_tokens: int) -> float:
58
- """计算请求成本"""
59
- pricing = self.get_model_pricing(provider, model_name)
60
- input_cost = (input_tokens / 1_000_000) * pricing["input"]
61
- output_cost = (output_tokens / 1_000_000) * pricing["output"]
62
- return input_cost + output_cost
63
-
64
- def get_cheapest_model(self, provider: str, model_type: str = "llm") -> Optional[str]:
65
- """获取最便宜的模型"""
66
- provider_models = self.MODEL_PRICING.get(provider, {})
67
- if not provider_models:
68
- return None
69
-
70
- # 计算每个模型的平均成本 (假设输入输出比例 1:1)
71
- cheapest_model = None
72
- lowest_cost = float('inf')
73
-
74
- for model_name, pricing in provider_models.items():
75
- avg_cost = (pricing["input"] + pricing["output"]) / 2
76
- if avg_cost < lowest_cost:
77
- lowest_cost = avg_cost
78
- cheapest_model = model_name
79
-
80
- return cheapest_model
81
-
82
- async def get_model(self,
83
- model_id: str,
84
- repo_id: str,
85
- model_type: ModelType,
86
- capabilities: List[ModelCapability],
87
- revision: Optional[str] = None,
88
- force_download: bool = False) -> Optional[Path]:
89
- """
90
- Get model files, downloading if necessary
91
-
92
- Args:
93
- model_id: Unique identifier for the model
94
- repo_id: Hugging Face repository ID
95
- model_type: Type of model (LLM, embedding, etc.)
96
- capabilities: List of model capabilities
97
- revision: Specific model version/tag
98
- force_download: Force re-download even if cached
99
-
100
- Returns:
101
- Path to the model files or None if failed
102
- """
103
- # Check if model is already downloaded
104
- if not force_download:
105
- model_path = await self.storage.load_model(model_id)
106
- if model_path:
107
- logger.info(f"Using cached model {model_id}")
108
- return model_path
109
-
110
- try:
111
- # Download model files
112
- logger.info(f"Downloading model {model_id} from {repo_id}")
113
- model_dir = Path(f"./models/temp/{model_id}")
114
- model_dir.mkdir(parents=True, exist_ok=True)
115
-
116
- snapshot_download(
117
- repo_id=repo_id,
118
- revision=revision,
119
- local_dir=model_dir,
120
- local_dir_use_symlinks=False
121
- )
122
-
123
- # Save model and metadata
124
- metadata = {
125
- "repo_id": repo_id,
126
- "revision": revision,
127
- "downloaded_at": str(Path(model_dir).stat().st_mtime)
128
- }
129
-
130
- # Register model
131
- self.registry.register_model(
132
- model_id=model_id,
133
- model_type=model_type,
134
- capabilities=capabilities,
135
- metadata=metadata
136
- )
137
-
138
- # Save model files
139
- await self.storage.save_model(model_id, str(model_dir), metadata)
140
-
141
- return await self.storage.load_model(model_id)
142
-
143
- except HfHubHTTPError as e:
144
- logger.error(f"Failed to download model {model_id}: {e}")
145
- return None
146
- except Exception as e:
147
- logger.error(f"Unexpected error downloading model {model_id}: {e}")
148
- return None
149
-
150
- async def list_models(self) -> List[Dict[str, Any]]:
151
- """List all downloaded models with their metadata"""
152
- models = await self.storage.list_models()
153
- return [
154
- {
155
- "model_id": model_id,
156
- **metadata,
157
- **(self.registry.get_model_info(model_id) or {})
158
- }
159
- for model_id, metadata in models.items()
160
- ]
161
-
162
- async def remove_model(self, model_id: str) -> bool:
163
- """Remove a model and its metadata"""
164
- try:
165
- # Remove from storage
166
- storage_success = await self.storage.delete_model(model_id)
167
-
168
- # Unregister from registry
169
- registry_success = self.registry.unregister_model(model_id)
170
-
171
- return storage_success and registry_success
172
-
173
- except Exception as e:
174
- logger.error(f"Failed to remove model {model_id}: {e}")
175
- return False
176
-
177
- async def get_model_info(self, model_id: str) -> Optional[Dict[str, Any]]:
178
- """Get information about a specific model"""
179
- storage_info = await self.storage.get_metadata(model_id)
180
- registry_info = self.registry.get_model_info(model_id)
181
-
182
- if not storage_info and not registry_info:
183
- return None
184
-
185
- return {
186
- **(storage_info or {}),
187
- **(registry_info or {})
188
- }
189
-
190
- async def update_model(self,
191
- model_id: str,
192
- repo_id: str,
193
- model_type: ModelType,
194
- capabilities: List[ModelCapability],
195
- revision: Optional[str] = None) -> bool:
196
- """Update a model to a new version"""
197
- try:
198
- return bool(await self.get_model(
199
- model_id=model_id,
200
- repo_id=repo_id,
201
- model_type=model_type,
202
- capabilities=capabilities,
203
- revision=revision,
204
- force_download=True
205
- ))
206
- except Exception as e:
207
- logger.error(f"Failed to update model {model_id}: {e}")
208
- return False