truefoundry 0.4.9rc1__py3-none-any.whl → 0.5.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.

Potentially problematic release.


This version of truefoundry might be problematic. Click here for more details.

Files changed (78) hide show
  1. truefoundry/deploy/__init__.py +5 -0
  2. truefoundry/deploy/builder/builders/tfy_python_buildpack/dockerfile_template.py +2 -2
  3. truefoundry/deploy/lib/dao/application.py +2 -1
  4. truefoundry/deploy/v2/lib/patched_models.py +8 -0
  5. truefoundry/ml/__init__.py +41 -1
  6. truefoundry/ml/autogen/client/__init__.py +44 -14
  7. truefoundry/ml/autogen/client/api/__init__.py +3 -3
  8. truefoundry/ml/autogen/client/api/deprecated_api.py +333 -0
  9. truefoundry/ml/autogen/client/api/generate_code_snippet_api.py +526 -0
  10. truefoundry/ml/autogen/client/api/mlfoundry_artifacts_api.py +0 -322
  11. truefoundry/ml/autogen/client/api_client.py +8 -1
  12. truefoundry/ml/autogen/client/models/__init__.py +41 -11
  13. truefoundry/ml/autogen/client/models/add_features_to_model_version_request_dto.py +3 -17
  14. truefoundry/ml/autogen/client/models/agent.py +1 -1
  15. truefoundry/ml/autogen/client/models/agent_app.py +1 -1
  16. truefoundry/ml/autogen/client/models/agent_open_api_tool.py +1 -1
  17. truefoundry/ml/autogen/client/models/agent_open_api_tool_with_fqn.py +1 -1
  18. truefoundry/ml/autogen/client/models/agent_with_fqn.py +1 -1
  19. truefoundry/ml/autogen/client/models/artifact_version_dto.py +3 -5
  20. truefoundry/ml/autogen/client/models/artifact_version_manifest.py +111 -0
  21. truefoundry/ml/autogen/client/models/assistant_message.py +1 -1
  22. truefoundry/ml/autogen/client/models/blob_storage_reference.py +1 -1
  23. truefoundry/ml/autogen/client/models/chat_prompt.py +1 -1
  24. truefoundry/ml/autogen/client/models/command.py +152 -0
  25. truefoundry/ml/autogen/client/models/{feature_dto.py → create_workflow_task_config_request_dto.py} +18 -14
  26. truefoundry/ml/autogen/client/models/{external_model_source.py → external_artifact_source.py} +12 -11
  27. truefoundry/ml/autogen/client/models/fast_ai_framework.py +75 -0
  28. truefoundry/ml/autogen/client/models/finalize_artifact_version_request_dto.py +3 -5
  29. truefoundry/ml/autogen/client/models/framework.py +250 -14
  30. truefoundry/ml/autogen/client/models/gluon_framework.py +74 -0
  31. truefoundry/ml/autogen/client/models/{upload_model_source.py → h2_o_framework.py} +11 -11
  32. truefoundry/ml/autogen/client/models/image_content_part.py +1 -1
  33. truefoundry/ml/autogen/client/models/keras_framework.py +74 -0
  34. truefoundry/ml/autogen/client/models/light_gbm_framework.py +75 -0
  35. truefoundry/ml/autogen/client/models/manifest.py +154 -0
  36. truefoundry/ml/autogen/client/models/model_version_dto.py +7 -8
  37. truefoundry/ml/autogen/client/models/model_version_environment.py +97 -0
  38. truefoundry/ml/autogen/client/models/model_version_manifest.py +30 -6
  39. truefoundry/ml/autogen/client/models/onnx_framework.py +74 -0
  40. truefoundry/ml/autogen/client/models/paddle_framework.py +75 -0
  41. truefoundry/ml/autogen/client/models/py_torch_framework.py +75 -0
  42. truefoundry/ml/autogen/client/models/{feature_value_type.py → serialization_format.py} +8 -8
  43. truefoundry/ml/autogen/client/models/sklearn_framework.py +92 -0
  44. truefoundry/ml/autogen/client/models/source.py +23 -46
  45. truefoundry/ml/autogen/client/models/source1.py +154 -0
  46. truefoundry/ml/autogen/client/models/spa_cy_framework.py +74 -0
  47. truefoundry/ml/autogen/client/models/stats_models_framework.py +75 -0
  48. truefoundry/ml/autogen/client/models/system_message.py +1 -1
  49. truefoundry/ml/autogen/client/models/{tensorflow_framework.py → tensor_flow_framework.py} +11 -10
  50. truefoundry/ml/autogen/client/models/text_content_part.py +1 -1
  51. truefoundry/ml/autogen/client/models/transformers_framework.py +10 -4
  52. truefoundry/ml/autogen/client/models/trigger_job_run_config_request_dto.py +90 -0
  53. truefoundry/ml/autogen/client/models/trigger_job_run_config_response_dto.py +71 -0
  54. truefoundry/ml/autogen/client/models/{truefoundry_model_source.py → true_foundry_artifact_source.py} +13 -11
  55. truefoundry/ml/autogen/client/models/update_artifact_version_request_dto.py +11 -1
  56. truefoundry/ml/autogen/client/models/update_model_version_request_dto.py +1 -13
  57. truefoundry/ml/autogen/client/models/user_message.py +1 -1
  58. truefoundry/ml/autogen/client/models/xg_boost_framework.py +92 -0
  59. truefoundry/ml/autogen/client_README.md +30 -12
  60. truefoundry/ml/autogen/entities/artifacts.py +87 -9
  61. truefoundry/ml/autogen/models/__init__.py +4 -0
  62. truefoundry/ml/autogen/models/exceptions.py +30 -0
  63. truefoundry/ml/autogen/models/schema.py +1547 -0
  64. truefoundry/ml/autogen/models/signature.py +139 -0
  65. truefoundry/ml/autogen/models/utils.py +699 -0
  66. truefoundry/ml/log_types/artifacts/artifact.py +131 -63
  67. truefoundry/ml/log_types/artifacts/general_artifact.py +7 -26
  68. truefoundry/ml/log_types/artifacts/model.py +195 -197
  69. truefoundry/ml/mlfoundry_api.py +47 -52
  70. truefoundry/ml/mlfoundry_run.py +35 -43
  71. truefoundry/ml/model_framework.py +169 -0
  72. {truefoundry-0.4.9rc1.dist-info → truefoundry-0.5.0.dist-info}/METADATA +1 -1
  73. {truefoundry-0.4.9rc1.dist-info → truefoundry-0.5.0.dist-info}/RECORD +75 -53
  74. truefoundry/ml/autogen/client/api/python_deployment_config_api.py +0 -201
  75. truefoundry/ml/autogen/client/models/model_schema_dto.py +0 -85
  76. truefoundry/ml/autogen/client/models/prediction_type.py +0 -34
  77. {truefoundry-0.4.9rc1.dist-info → truefoundry-0.5.0.dist-info}/WHEEL +0 -0
  78. {truefoundry-0.4.9rc1.dist-info → truefoundry-0.5.0.dist-info}/entry_points.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  # generated by datamodel-codegen:
2
2
  # filename: artifacts.json
3
- # timestamp: 2024-10-25T06:52:16+00:00
3
+ # timestamp: 2024-11-29T06:43:26+00:00
4
4
 
5
5
  from __future__ import annotations
6
6
 
@@ -89,7 +89,7 @@ class BlobStorageReference(BaseModel):
89
89
  )
90
90
 
91
91
 
92
- class ExternalModelSource(BaseModel):
92
+ class ExternalArtifactSource(BaseModel):
93
93
  """
94
94
  +label=External
95
95
  """
@@ -98,7 +98,7 @@ class ExternalModelSource(BaseModel):
98
98
  ...,
99
99
  description="+label=Type\n+usage=Type of the source\n+value=external\n+type=External",
100
100
  )
101
- uri: str = Field(..., description="+label=URI\n+usage=URI of the model source")
101
+ uri: str = Field(..., description="+label=URI\n+usage=URI of the Artifact source")
102
102
 
103
103
 
104
104
  class FastAIFramework(BaseModel):
@@ -226,6 +226,34 @@ class ModelConfiguration(BaseModel):
226
226
  )
227
227
 
228
228
 
229
+ class ModelVersionEnvironment(BaseModel):
230
+ """
231
+ +label=ModelVersionEnvironment
232
+ """
233
+
234
+ python_version: Optional[constr(regex=r"^\d+(\.\d+){1,2}([\-\.a-z0-9]+)?$")] = (
235
+ Field(
236
+ None,
237
+ description="+label=Python Version\n+usage=Python version for the model version",
238
+ )
239
+ )
240
+ pip_packages: Optional[List[str]] = Field(
241
+ None,
242
+ description="+label=PIP Packages\n+usage=PIP packages for the model version",
243
+ )
244
+
245
+
246
+ class ONNXFramework(BaseModel):
247
+ """
248
+ +docs=ONNX framework for the model version
249
+ +label=ONNX
250
+ """
251
+
252
+ type: Literal["onnx"] = Field(
253
+ ..., description="+label=Type\n+usage=Type of the framework\n+value=onnx"
254
+ )
255
+
256
+
229
257
  class PaddleFramework(BaseModel):
230
258
  """
231
259
  +docs=PaddlePaddle framework for the model version
@@ -248,6 +276,17 @@ class PyTorchFramework(BaseModel):
248
276
  )
249
277
 
250
278
 
279
+ class SerializationFormat(str, Enum):
280
+ """
281
+ +label=Serialization format
282
+ +usage=Serialization format used for the model
283
+ """
284
+
285
+ cloudpickle = "cloudpickle"
286
+ joblib = "joblib"
287
+ pickle = "pickle"
288
+
289
+
251
290
  class SklearnFramework(BaseModel):
252
291
  """
253
292
  +docs=Scikit-learn framework for the model version
@@ -257,6 +296,13 @@ class SklearnFramework(BaseModel):
257
296
  type: Literal["sklearn"] = Field(
258
297
  ..., description="+label=Type\n+usage=Type of the framework\n+value=sklearn"
259
298
  )
299
+ serialization_format: Optional[SerializationFormat] = Field(
300
+ None,
301
+ description="+label=Serialization format\n+usage=Serialization format used for the model",
302
+ )
303
+ model_filename: Optional[str] = Field(
304
+ None, description="+label=Model file name\n+usage=Name of the model file"
305
+ )
260
306
 
261
307
 
262
308
  class SpaCyFramework(BaseModel):
@@ -348,11 +394,15 @@ class TransformersFramework(BaseModel):
348
394
  None,
349
395
  description="+label=Pipeline Tag\n+usage=Pipeline tag\n+docs=Pipeline tag for the framework",
350
396
  )
397
+ base_model: Optional[str] = Field(
398
+ None,
399
+ description="+label=Base Model\n+usage=Base model\n+docs=Base model Id. If this is a finetuned model, this points to the base model used for finetuning",
400
+ )
351
401
 
352
402
 
353
- class TruefoundryModelSource(BaseModel):
403
+ class TrueFoundryArtifactSource(BaseModel):
354
404
  """
355
- +usage=Source for the Model
405
+ +usage=Source for the Artifact or Model
356
406
  +label=Upload
357
407
  """
358
408
 
@@ -361,7 +411,8 @@ class TruefoundryModelSource(BaseModel):
361
411
  description="+usage=Type of the source\n+type=Upload\n+value=truefoundry\n+label=Upload",
362
412
  )
363
413
  uri: str = Field(
364
- ..., description='+label=URI\n+uiType=UploadInput\n+uiProps={"hideClear":true}'
414
+ ...,
415
+ description='+label=URI\n+uiType=ModelUploadInput\n+uiProps={"hideClear":true}',
365
416
  )
366
417
 
367
418
 
@@ -394,6 +445,13 @@ class XGBoostFramework(BaseModel):
394
445
  type: Literal["xgboost"] = Field(
395
446
  ..., description="+label=Type\n+usage=Type of the framework\n+value=xgboost"
396
447
  )
448
+ serialization_format: Optional[SerializationFormat] = Field(
449
+ None,
450
+ description="+label=Serialization format\n+usage=Serialization format used for the model",
451
+ )
452
+ model_filename: Optional[str] = Field(
453
+ None, description="+label=Model file name\n+usage=Name of the model file"
454
+ )
397
455
 
398
456
 
399
457
  class AgentOpenAPITool(BaseModel):
@@ -426,6 +484,18 @@ class AgentOpenAPIToolWithFQN(AgentOpenAPITool):
426
484
  fqn: str
427
485
 
428
486
 
487
+ class ArtifactVersion(BaseArtifactVersion):
488
+ type: Literal["artifact-version"] = Field(
489
+ ...,
490
+ description='+label=Type\n+usage=Artifact Version\n+value="artifact-version"',
491
+ )
492
+ source: Union[TrueFoundryArtifactSource, ExternalArtifactSource] = Field(
493
+ ...,
494
+ description="+label=Artifact Source\n+usage=Source for the Artifact version\n+uiType=Group",
495
+ )
496
+ step: conint(ge=0) = Field(0, description="+label=Step")
497
+
498
+
429
499
  class AssistantMessage(BaseModel):
430
500
  """
431
501
  +usage=Assistant message
@@ -481,7 +551,7 @@ class ModelVersion(BaseArtifactVersion):
481
551
  type: Literal["model-version"] = Field(
482
552
  ..., description='+label=Type\n+usage=Model Version\n+value="model-version"'
483
553
  )
484
- source: Union[TruefoundryModelSource, ExternalModelSource] = Field(
554
+ source: Union[TrueFoundryArtifactSource, ExternalArtifactSource] = Field(
485
555
  ...,
486
556
  description="+label=Model Source\n+usage=Source for the model version\n+uiType=Group",
487
557
  )
@@ -496,6 +566,7 @@ class ModelVersion(BaseArtifactVersion):
496
566
  LightGBMFramework,
497
567
  FastAIFramework,
498
568
  H2OFramework,
569
+ ONNXFramework,
499
570
  SpaCyFramework,
500
571
  StatsModelsFramework,
501
572
  GluonFramework,
@@ -504,7 +575,12 @@ class ModelVersion(BaseArtifactVersion):
504
575
  ] = Field(
505
576
  None, description="+label=Framework\n+usage=Framework for the model version"
506
577
  )
578
+ environment: Optional[ModelVersionEnvironment] = None
507
579
  step: conint(ge=0) = Field(0, description="+label=Step")
580
+ model_schema: Optional[Dict[str, Any]] = Field(
581
+ None,
582
+ description="+label=Model Schema\n+usage=Schema of the model\n+uiType=Hidden",
583
+ )
508
584
 
509
585
 
510
586
  class AgentApp(BaseModel):
@@ -514,5 +590,7 @@ class AgentApp(BaseModel):
514
590
  root_agent: constr(min_length=1)
515
591
 
516
592
 
517
- class ArtifactsVersion(BaseModel):
518
- __root__: Union[ChatPrompt, AgentOpenAPITool, Agent, AgentApp, ModelVersion]
593
+ class VersionedArtifactType(BaseModel):
594
+ __root__: Union[
595
+ ChatPrompt, AgentOpenAPITool, Agent, AgentApp, ModelVersion, ArtifactVersion
596
+ ]
@@ -0,0 +1,4 @@
1
+ from .schema import ColSpec, TensorSpec
2
+ from .signature import ModelSignature, Schema, infer_signature
3
+
4
+ __all__ = ["infer_signature", "ModelSignature", "Schema", "TensorSpec", "ColSpec"]
@@ -0,0 +1,30 @@
1
+ INTERNAL_ERROR = 1
2
+ INVALID_PARAMETER_VALUE = 1000
3
+
4
+
5
+ class MlflowException(Exception):
6
+ """
7
+ Generic exception thrown to surface failure information about external-facing operations.
8
+ The error message associated with this exception may be exposed to clients in HTTP responses
9
+ for debugging purposes. If the error text is sensitive, raise a generic `Exception` object
10
+ instead.
11
+ """
12
+
13
+ def __init__(self, message, error_code=INTERNAL_ERROR, **kwargs):
14
+ """
15
+ :param message: The message describing the error that occured. This will be included in the
16
+ exception's serialized JSON representation.
17
+ :param error_code: An appropriate error code for the error that occured; it will be included
18
+ in the exception's serialized JSON representation. This should be one of
19
+ the codes listed in the `mlflow.protos.databricks_pb2` proto.
20
+ :param kwargs: Additional key-value pairs to include in the serialized JSON representation
21
+ of the MlflowException.
22
+ """
23
+ self.error_code = error_code
24
+ self.message = str(message)
25
+ self.json_kwargs = kwargs
26
+ super().__init__(message)
27
+
28
+ @classmethod
29
+ def invalid_parameter_value(cls, message, **kwargs):
30
+ return cls(message, error_code=INVALID_PARAMETER_VALUE, **kwargs)