truefoundry 0.5.5rc1__py3-none-any.whl → 0.5.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.
Potentially problematic release.
This version of truefoundry might be problematic. Click here for more details.
- truefoundry/deploy/__init__.py +9 -2
- truefoundry/deploy/auto_gen/models.py +177 -57
- truefoundry/deploy/cli/commands/__init__.py +0 -1
- truefoundry/deploy/lib/clients/servicefoundry_client.py +20 -16
- truefoundry/deploy/v2/lib/deploy.py +23 -15
- truefoundry/deploy/v2/lib/deploy_workflow.py +9 -4
- truefoundry/deploy/v2/lib/deployable_patched_models.py +10 -0
- truefoundry/deploy/v2/lib/patched_models.py +9 -1
- truefoundry/ml/autogen/client/__init__.py +4 -4
- truefoundry/ml/autogen/client/api/experiments_api.py +0 -156
- truefoundry/ml/autogen/client/api/mlfoundry_artifacts_api.py +49 -305
- truefoundry/ml/autogen/client/models/__init__.py +4 -4
- truefoundry/ml/autogen/client/models/agent.py +64 -13
- truefoundry/ml/autogen/client/models/agent_open_api_tool.py +63 -17
- truefoundry/ml/autogen/client/models/agent_open_api_tool_with_fqn.py +63 -17
- truefoundry/ml/autogen/client/models/agent_with_fqn.py +64 -12
- truefoundry/ml/autogen/client/models/artifact_version_manifest.py +39 -4
- truefoundry/ml/autogen/client/models/chat_prompt.py +60 -22
- truefoundry/ml/autogen/client/models/{external_artifact_source.py → external_blob_storage_source.py} +10 -11
- truefoundry/ml/autogen/client/models/model_version_manifest.py +39 -4
- truefoundry/ml/autogen/client/models/source.py +22 -22
- truefoundry/ml/autogen/client/models/source1.py +22 -22
- truefoundry/ml/autogen/client/models/{true_foundry_artifact_source.py → true_foundry_managed_source.py} +12 -11
- truefoundry/ml/autogen/client_README.md +2 -3
- truefoundry/ml/autogen/entities/artifacts.py +87 -69
- truefoundry/ml/log_types/artifacts/artifact.py +26 -18
- truefoundry/ml/log_types/artifacts/general_artifact.py +4 -13
- truefoundry/ml/log_types/artifacts/model.py +28 -21
- truefoundry/ml/mlfoundry_api.py +2 -6
- truefoundry/workflow/task.py +1 -1
- {truefoundry-0.5.5rc1.dist-info → truefoundry-0.5.6.dist-info}/METADATA +2 -2
- {truefoundry-0.5.5rc1.dist-info → truefoundry-0.5.6.dist-info}/RECORD +34 -35
- truefoundry/deploy/cli/commands/build_logs_command.py +0 -89
- {truefoundry-0.5.5rc1.dist-info → truefoundry-0.5.6.dist-info}/WHEEL +0 -0
- {truefoundry-0.5.5rc1.dist-info → truefoundry-0.5.6.dist-info}/entry_points.txt +0 -0
|
@@ -146,8 +146,8 @@ from truefoundry.ml.autogen.client.models.experiment_tag_dto import ExperimentTa
|
|
|
146
146
|
from truefoundry.ml.autogen.client.models.export_deployment_files_request_dto import (
|
|
147
147
|
ExportDeploymentFilesRequestDto,
|
|
148
148
|
)
|
|
149
|
-
from truefoundry.ml.autogen.client.models.
|
|
150
|
-
|
|
149
|
+
from truefoundry.ml.autogen.client.models.external_blob_storage_source import (
|
|
150
|
+
ExternalBlobStorageSource,
|
|
151
151
|
)
|
|
152
152
|
from truefoundry.ml.autogen.client.models.fast_ai_framework import FastAIFramework
|
|
153
153
|
from truefoundry.ml.autogen.client.models.file_info_dto import FileInfoDto
|
|
@@ -374,8 +374,8 @@ from truefoundry.ml.autogen.client.models.trigger_job_run_config_request_dto imp
|
|
|
374
374
|
from truefoundry.ml.autogen.client.models.trigger_job_run_config_response_dto import (
|
|
375
375
|
TriggerJobRunConfigResponseDto,
|
|
376
376
|
)
|
|
377
|
-
from truefoundry.ml.autogen.client.models.
|
|
378
|
-
|
|
377
|
+
from truefoundry.ml.autogen.client.models.true_foundry_managed_source import (
|
|
378
|
+
TrueFoundryManagedSource,
|
|
379
379
|
)
|
|
380
380
|
from truefoundry.ml.autogen.client.models.update_artifact_version_request_dto import (
|
|
381
381
|
UpdateArtifactVersionRequestDto,
|
|
@@ -16,7 +16,7 @@ from __future__ import annotations
|
|
|
16
16
|
import json
|
|
17
17
|
import pprint
|
|
18
18
|
import re # noqa: F401
|
|
19
|
-
from typing import Optional
|
|
19
|
+
from typing import Any, Dict, Optional
|
|
20
20
|
|
|
21
21
|
from truefoundry.pydantic_v1 import (
|
|
22
22
|
BaseModel,
|
|
@@ -33,10 +33,26 @@ class Agent(BaseModel):
|
|
|
33
33
|
Agent artifact. # noqa: E501
|
|
34
34
|
"""
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
description: Optional[constr(strict=True, max_length=512)] = Field(
|
|
37
|
+
default=None, description="+sort=2 +label=Description"
|
|
38
|
+
)
|
|
39
|
+
metadata: Dict[str, Any] = Field(
|
|
40
|
+
default=...,
|
|
41
|
+
description="+label=Metadata +docs=Key value pairs to store additional metadata +usage=Key value pairs to store additional metadata +uiType=JsonInput",
|
|
42
|
+
)
|
|
43
|
+
version_alias: Optional[constr(strict=True, max_length=128)] = Field(
|
|
44
|
+
default=None,
|
|
45
|
+
description="+label=Version Alias +usage=The version alias should start with 'v' followed by alphanumeric and it can include '.' and '-' in between (e.g. v1.0.0, v1-prod, v3-dev, etc) +docs=The version alias should start with 'v' followed by alphanumeric and it can include '.' and '-' in between (e.g. v1.0.0, v1-prod, v3-dev, etc) +message=The version alias should start with 'v' followed by alphanumeric and it can include '.' and '-' in between (e.g. v1.0.0, v1-prod, v3-dev, etc)",
|
|
46
|
+
)
|
|
47
|
+
name: Optional[constr(strict=True, max_length=256)] = Field(
|
|
48
|
+
default=None,
|
|
49
|
+
description="+sort=1 +label=Name +message=The name should start with lowercase alphabets and can contain alphanumeric and can include '-' in between",
|
|
39
50
|
)
|
|
51
|
+
ml_repo: Optional[constr(strict=True)] = Field(
|
|
52
|
+
default=None,
|
|
53
|
+
description="+label=ML Repo +usage=name of the ML Repo +docs=name of the ML Repo +uiType=Hidden",
|
|
54
|
+
)
|
|
55
|
+
type: Optional[StrictStr] = "agent"
|
|
40
56
|
available_tools: conlist(constr(strict=True, min_length=1)) = Field(
|
|
41
57
|
default=..., description="+sort=30 +uiType=Hidden"
|
|
42
58
|
)
|
|
@@ -52,33 +68,64 @@ class Agent(BaseModel):
|
|
|
52
68
|
description='+sort=40 +uiType=EnabledModelSelector +uiProps={"searchable":true,"modelType":"chat","providerType":"openai"}',
|
|
53
69
|
)
|
|
54
70
|
__properties = [
|
|
55
|
-
"
|
|
71
|
+
"description",
|
|
72
|
+
"metadata",
|
|
73
|
+
"version_alias",
|
|
56
74
|
"name",
|
|
75
|
+
"ml_repo",
|
|
76
|
+
"type",
|
|
57
77
|
"available_tools",
|
|
58
78
|
"goal",
|
|
59
79
|
"instruction",
|
|
60
80
|
"model_id",
|
|
61
81
|
]
|
|
62
82
|
|
|
63
|
-
@validator("
|
|
64
|
-
def
|
|
65
|
-
"""Validates the
|
|
83
|
+
@validator("version_alias")
|
|
84
|
+
def version_alias_validate_regular_expression(cls, value):
|
|
85
|
+
"""Validates the regular expression"""
|
|
66
86
|
if value is None:
|
|
67
87
|
return value
|
|
68
88
|
|
|
69
|
-
if
|
|
70
|
-
raise ValueError(
|
|
89
|
+
if not re.match(r"^v[a-zA-Z0-9.-]*([a-zA-Z0-9]+)$", value):
|
|
90
|
+
raise ValueError(
|
|
91
|
+
r"must validate the regular expression /^v[a-zA-Z0-9.-]*([a-zA-Z0-9]+)$/"
|
|
92
|
+
)
|
|
71
93
|
return value
|
|
72
94
|
|
|
73
95
|
@validator("name")
|
|
74
96
|
def name_validate_regular_expression(cls, value):
|
|
75
97
|
"""Validates the regular expression"""
|
|
76
|
-
if
|
|
98
|
+
if value is None:
|
|
99
|
+
return value
|
|
100
|
+
|
|
101
|
+
if not re.match(r"^[A-Za-z0-9_\-]+$", value):
|
|
102
|
+
raise ValueError(
|
|
103
|
+
r"must validate the regular expression /^[A-Za-z0-9_\-]+$/"
|
|
104
|
+
)
|
|
105
|
+
return value
|
|
106
|
+
|
|
107
|
+
@validator("ml_repo")
|
|
108
|
+
def ml_repo_validate_regular_expression(cls, value):
|
|
109
|
+
"""Validates the regular expression"""
|
|
110
|
+
if value is None:
|
|
111
|
+
return value
|
|
112
|
+
|
|
113
|
+
if not re.match(r"^[a-zA-Z][a-zA-Z0-9\-]{1,98}[a-zA-Z0-9]$", value):
|
|
77
114
|
raise ValueError(
|
|
78
|
-
r"must validate the regular expression /^[a-zA-Z][a-zA-Z0-9\-]{1,
|
|
115
|
+
r"must validate the regular expression /^[a-zA-Z][a-zA-Z0-9\-]{1,98}[a-zA-Z0-9]$/"
|
|
79
116
|
)
|
|
80
117
|
return value
|
|
81
118
|
|
|
119
|
+
@validator("type")
|
|
120
|
+
def type_validate_enum(cls, value):
|
|
121
|
+
"""Validates the enum"""
|
|
122
|
+
if value is None:
|
|
123
|
+
return value
|
|
124
|
+
|
|
125
|
+
if value not in ("agent",):
|
|
126
|
+
raise ValueError("must be one of enum values ('agent')")
|
|
127
|
+
return value
|
|
128
|
+
|
|
82
129
|
class Config:
|
|
83
130
|
"""Pydantic configuration"""
|
|
84
131
|
|
|
@@ -114,8 +161,12 @@ class Agent(BaseModel):
|
|
|
114
161
|
|
|
115
162
|
_obj = Agent.parse_obj(
|
|
116
163
|
{
|
|
117
|
-
"
|
|
164
|
+
"description": obj.get("description"),
|
|
165
|
+
"metadata": obj.get("metadata"),
|
|
166
|
+
"version_alias": obj.get("version_alias"),
|
|
118
167
|
"name": obj.get("name"),
|
|
168
|
+
"ml_repo": obj.get("ml_repo"),
|
|
169
|
+
"type": obj.get("type") if obj.get("type") is not None else "agent",
|
|
119
170
|
"available_tools": obj.get("available_tools"),
|
|
120
171
|
"goal": obj.get("goal"),
|
|
121
172
|
"instruction": obj.get("instruction"),
|
|
@@ -16,7 +16,7 @@ from __future__ import annotations
|
|
|
16
16
|
import json
|
|
17
17
|
import pprint
|
|
18
18
|
import re # noqa: F401
|
|
19
|
-
from typing import Dict, Optional
|
|
19
|
+
from typing import Any, Dict, Optional
|
|
20
20
|
|
|
21
21
|
from truefoundry.ml.autogen.client.models.method import Method
|
|
22
22
|
from truefoundry.ml.autogen.client.models.openapi_spec import OpenapiSpec
|
|
@@ -28,13 +28,26 @@ class AgentOpenAPITool(BaseModel):
|
|
|
28
28
|
OpenAPI Tool artifact. # noqa: E501
|
|
29
29
|
"""
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
description: Optional[constr(strict=True, max_length=512)] = Field(
|
|
32
|
+
default=None, description="+sort=2 +label=Description"
|
|
33
|
+
)
|
|
34
|
+
metadata: Dict[str, Any] = Field(
|
|
35
|
+
default=...,
|
|
36
|
+
description="+label=Metadata +docs=Key value pairs to store additional metadata +usage=Key value pairs to store additional metadata +uiType=JsonInput",
|
|
37
|
+
)
|
|
38
|
+
version_alias: Optional[constr(strict=True, max_length=128)] = Field(
|
|
39
|
+
default=None,
|
|
40
|
+
description="+label=Version Alias +usage=The version alias should start with 'v' followed by alphanumeric and it can include '.' and '-' in between (e.g. v1.0.0, v1-prod, v3-dev, etc) +docs=The version alias should start with 'v' followed by alphanumeric and it can include '.' and '-' in between (e.g. v1.0.0, v1-prod, v3-dev, etc) +message=The version alias should start with 'v' followed by alphanumeric and it can include '.' and '-' in between (e.g. v1.0.0, v1-prod, v3-dev, etc)",
|
|
41
|
+
)
|
|
42
|
+
name: Optional[constr(strict=True, max_length=256)] = Field(
|
|
43
|
+
default=None,
|
|
44
|
+
description="+sort=1 +label=Name +message=The name should start with lowercase alphabets and can contain alphanumeric and can include '-' in between",
|
|
34
45
|
)
|
|
35
|
-
|
|
36
|
-
default
|
|
46
|
+
ml_repo: Optional[constr(strict=True)] = Field(
|
|
47
|
+
default=None,
|
|
48
|
+
description="+label=ML Repo +usage=name of the ML Repo +docs=name of the ML Repo +uiType=Hidden",
|
|
37
49
|
)
|
|
50
|
+
type: Optional[StrictStr] = "openapi-tool"
|
|
38
51
|
openapi_spec: OpenapiSpec = Field(...)
|
|
39
52
|
base_url: constr(strict=True) = Field(default=..., description="+sort=30")
|
|
40
53
|
path: constr(strict=True, min_length=1) = Field(
|
|
@@ -47,9 +60,12 @@ class AgentOpenAPITool(BaseModel):
|
|
|
47
60
|
description='+sort=60 +uiType=KV +uiProps={"allowSecrets":true,"secretConfig":{"enableNew":true,"hideOptions":true}}',
|
|
48
61
|
)
|
|
49
62
|
__properties = [
|
|
50
|
-
"type",
|
|
51
|
-
"name",
|
|
52
63
|
"description",
|
|
64
|
+
"metadata",
|
|
65
|
+
"version_alias",
|
|
66
|
+
"name",
|
|
67
|
+
"ml_repo",
|
|
68
|
+
"type",
|
|
53
69
|
"openapi_spec",
|
|
54
70
|
"base_url",
|
|
55
71
|
"path",
|
|
@@ -57,25 +73,52 @@ class AgentOpenAPITool(BaseModel):
|
|
|
57
73
|
"headers",
|
|
58
74
|
]
|
|
59
75
|
|
|
60
|
-
@validator("
|
|
61
|
-
def
|
|
62
|
-
"""Validates the
|
|
76
|
+
@validator("version_alias")
|
|
77
|
+
def version_alias_validate_regular_expression(cls, value):
|
|
78
|
+
"""Validates the regular expression"""
|
|
63
79
|
if value is None:
|
|
64
80
|
return value
|
|
65
81
|
|
|
66
|
-
if
|
|
67
|
-
raise ValueError(
|
|
82
|
+
if not re.match(r"^v[a-zA-Z0-9.-]*([a-zA-Z0-9]+)$", value):
|
|
83
|
+
raise ValueError(
|
|
84
|
+
r"must validate the regular expression /^v[a-zA-Z0-9.-]*([a-zA-Z0-9]+)$/"
|
|
85
|
+
)
|
|
68
86
|
return value
|
|
69
87
|
|
|
70
88
|
@validator("name")
|
|
71
89
|
def name_validate_regular_expression(cls, value):
|
|
72
90
|
"""Validates the regular expression"""
|
|
73
|
-
if
|
|
91
|
+
if value is None:
|
|
92
|
+
return value
|
|
93
|
+
|
|
94
|
+
if not re.match(r"^[A-Za-z0-9_\-]+$", value):
|
|
95
|
+
raise ValueError(
|
|
96
|
+
r"must validate the regular expression /^[A-Za-z0-9_\-]+$/"
|
|
97
|
+
)
|
|
98
|
+
return value
|
|
99
|
+
|
|
100
|
+
@validator("ml_repo")
|
|
101
|
+
def ml_repo_validate_regular_expression(cls, value):
|
|
102
|
+
"""Validates the regular expression"""
|
|
103
|
+
if value is None:
|
|
104
|
+
return value
|
|
105
|
+
|
|
106
|
+
if not re.match(r"^[a-zA-Z][a-zA-Z0-9\-]{1,98}[a-zA-Z0-9]$", value):
|
|
74
107
|
raise ValueError(
|
|
75
|
-
r"must validate the regular expression /^[a-zA-Z][a-zA-Z0-9\-]{1,
|
|
108
|
+
r"must validate the regular expression /^[a-zA-Z][a-zA-Z0-9\-]{1,98}[a-zA-Z0-9]$/"
|
|
76
109
|
)
|
|
77
110
|
return value
|
|
78
111
|
|
|
112
|
+
@validator("type")
|
|
113
|
+
def type_validate_enum(cls, value):
|
|
114
|
+
"""Validates the enum"""
|
|
115
|
+
if value is None:
|
|
116
|
+
return value
|
|
117
|
+
|
|
118
|
+
if value not in ("openapi-tool",):
|
|
119
|
+
raise ValueError("must be one of enum values ('openapi-tool')")
|
|
120
|
+
return value
|
|
121
|
+
|
|
79
122
|
@validator("base_url")
|
|
80
123
|
def base_url_validate_regular_expression(cls, value):
|
|
81
124
|
"""Validates the regular expression"""
|
|
@@ -126,11 +169,14 @@ class AgentOpenAPITool(BaseModel):
|
|
|
126
169
|
|
|
127
170
|
_obj = AgentOpenAPITool.parse_obj(
|
|
128
171
|
{
|
|
172
|
+
"description": obj.get("description"),
|
|
173
|
+
"metadata": obj.get("metadata"),
|
|
174
|
+
"version_alias": obj.get("version_alias"),
|
|
175
|
+
"name": obj.get("name"),
|
|
176
|
+
"ml_repo": obj.get("ml_repo"),
|
|
129
177
|
"type": obj.get("type")
|
|
130
178
|
if obj.get("type") is not None
|
|
131
179
|
else "openapi-tool",
|
|
132
|
-
"name": obj.get("name"),
|
|
133
|
-
"description": obj.get("description"),
|
|
134
180
|
"openapi_spec": OpenapiSpec.from_dict(obj.get("openapi_spec"))
|
|
135
181
|
if obj.get("openapi_spec") is not None
|
|
136
182
|
else None,
|
|
@@ -16,7 +16,7 @@ from __future__ import annotations
|
|
|
16
16
|
import json
|
|
17
17
|
import pprint
|
|
18
18
|
import re # noqa: F401
|
|
19
|
-
from typing import Dict, Optional
|
|
19
|
+
from typing import Any, Dict, Optional
|
|
20
20
|
|
|
21
21
|
from truefoundry.ml.autogen.client.models.method import Method
|
|
22
22
|
from truefoundry.ml.autogen.client.models.openapi_spec import OpenapiSpec
|
|
@@ -28,13 +28,26 @@ class AgentOpenAPIToolWithFQN(BaseModel):
|
|
|
28
28
|
AgentOpenAPIToolWithFQN
|
|
29
29
|
"""
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
description: Optional[constr(strict=True, max_length=512)] = Field(
|
|
32
|
+
default=None, description="+sort=2 +label=Description"
|
|
33
|
+
)
|
|
34
|
+
metadata: Dict[str, Any] = Field(
|
|
35
|
+
default=...,
|
|
36
|
+
description="+label=Metadata +docs=Key value pairs to store additional metadata +usage=Key value pairs to store additional metadata +uiType=JsonInput",
|
|
37
|
+
)
|
|
38
|
+
version_alias: Optional[constr(strict=True, max_length=128)] = Field(
|
|
39
|
+
default=None,
|
|
40
|
+
description="+label=Version Alias +usage=The version alias should start with 'v' followed by alphanumeric and it can include '.' and '-' in between (e.g. v1.0.0, v1-prod, v3-dev, etc) +docs=The version alias should start with 'v' followed by alphanumeric and it can include '.' and '-' in between (e.g. v1.0.0, v1-prod, v3-dev, etc) +message=The version alias should start with 'v' followed by alphanumeric and it can include '.' and '-' in between (e.g. v1.0.0, v1-prod, v3-dev, etc)",
|
|
34
41
|
)
|
|
35
|
-
|
|
36
|
-
default
|
|
42
|
+
name: Optional[constr(strict=True, max_length=256)] = Field(
|
|
43
|
+
default=None,
|
|
44
|
+
description="+sort=1 +label=Name +message=The name should start with lowercase alphabets and can contain alphanumeric and can include '-' in between",
|
|
45
|
+
)
|
|
46
|
+
ml_repo: Optional[constr(strict=True)] = Field(
|
|
47
|
+
default=None,
|
|
48
|
+
description="+label=ML Repo +usage=name of the ML Repo +docs=name of the ML Repo +uiType=Hidden",
|
|
37
49
|
)
|
|
50
|
+
type: StrictStr = Field(default=..., description="+value=openapi-tool")
|
|
38
51
|
openapi_spec: OpenapiSpec = Field(...)
|
|
39
52
|
base_url: constr(strict=True) = Field(default=..., description="+sort=30")
|
|
40
53
|
path: constr(strict=True, min_length=1) = Field(
|
|
@@ -49,9 +62,12 @@ class AgentOpenAPIToolWithFQN(BaseModel):
|
|
|
49
62
|
id: StrictStr = Field(...)
|
|
50
63
|
fqn: StrictStr = Field(...)
|
|
51
64
|
__properties = [
|
|
52
|
-
"type",
|
|
53
|
-
"name",
|
|
54
65
|
"description",
|
|
66
|
+
"metadata",
|
|
67
|
+
"version_alias",
|
|
68
|
+
"name",
|
|
69
|
+
"ml_repo",
|
|
70
|
+
"type",
|
|
55
71
|
"openapi_spec",
|
|
56
72
|
"base_url",
|
|
57
73
|
"path",
|
|
@@ -61,22 +77,49 @@ class AgentOpenAPIToolWithFQN(BaseModel):
|
|
|
61
77
|
"fqn",
|
|
62
78
|
]
|
|
63
79
|
|
|
64
|
-
@validator("
|
|
65
|
-
def
|
|
66
|
-
"""Validates the
|
|
67
|
-
if value
|
|
68
|
-
|
|
80
|
+
@validator("version_alias")
|
|
81
|
+
def version_alias_validate_regular_expression(cls, value):
|
|
82
|
+
"""Validates the regular expression"""
|
|
83
|
+
if value is None:
|
|
84
|
+
return value
|
|
85
|
+
|
|
86
|
+
if not re.match(r"^v[a-zA-Z0-9.-]*([a-zA-Z0-9]+)$", value):
|
|
87
|
+
raise ValueError(
|
|
88
|
+
r"must validate the regular expression /^v[a-zA-Z0-9.-]*([a-zA-Z0-9]+)$/"
|
|
89
|
+
)
|
|
69
90
|
return value
|
|
70
91
|
|
|
71
92
|
@validator("name")
|
|
72
93
|
def name_validate_regular_expression(cls, value):
|
|
73
94
|
"""Validates the regular expression"""
|
|
74
|
-
if
|
|
95
|
+
if value is None:
|
|
96
|
+
return value
|
|
97
|
+
|
|
98
|
+
if not re.match(r"^[A-Za-z0-9_\-]+$", value):
|
|
99
|
+
raise ValueError(
|
|
100
|
+
r"must validate the regular expression /^[A-Za-z0-9_\-]+$/"
|
|
101
|
+
)
|
|
102
|
+
return value
|
|
103
|
+
|
|
104
|
+
@validator("ml_repo")
|
|
105
|
+
def ml_repo_validate_regular_expression(cls, value):
|
|
106
|
+
"""Validates the regular expression"""
|
|
107
|
+
if value is None:
|
|
108
|
+
return value
|
|
109
|
+
|
|
110
|
+
if not re.match(r"^[a-zA-Z][a-zA-Z0-9\-]{1,98}[a-zA-Z0-9]$", value):
|
|
75
111
|
raise ValueError(
|
|
76
|
-
r"must validate the regular expression /^[a-zA-Z][a-zA-Z0-9\-]{1,
|
|
112
|
+
r"must validate the regular expression /^[a-zA-Z][a-zA-Z0-9\-]{1,98}[a-zA-Z0-9]$/"
|
|
77
113
|
)
|
|
78
114
|
return value
|
|
79
115
|
|
|
116
|
+
@validator("type")
|
|
117
|
+
def type_validate_enum(cls, value):
|
|
118
|
+
"""Validates the enum"""
|
|
119
|
+
if value not in ("openapi-tool",):
|
|
120
|
+
raise ValueError("must be one of enum values ('openapi-tool')")
|
|
121
|
+
return value
|
|
122
|
+
|
|
80
123
|
@validator("base_url")
|
|
81
124
|
def base_url_validate_regular_expression(cls, value):
|
|
82
125
|
"""Validates the regular expression"""
|
|
@@ -127,9 +170,12 @@ class AgentOpenAPIToolWithFQN(BaseModel):
|
|
|
127
170
|
|
|
128
171
|
_obj = AgentOpenAPIToolWithFQN.parse_obj(
|
|
129
172
|
{
|
|
130
|
-
"type": obj.get("type"),
|
|
131
|
-
"name": obj.get("name"),
|
|
132
173
|
"description": obj.get("description"),
|
|
174
|
+
"metadata": obj.get("metadata"),
|
|
175
|
+
"version_alias": obj.get("version_alias"),
|
|
176
|
+
"name": obj.get("name"),
|
|
177
|
+
"ml_repo": obj.get("ml_repo"),
|
|
178
|
+
"type": obj.get("type"),
|
|
133
179
|
"openapi_spec": OpenapiSpec.from_dict(obj.get("openapi_spec"))
|
|
134
180
|
if obj.get("openapi_spec") is not None
|
|
135
181
|
else None,
|
|
@@ -16,6 +16,7 @@ from __future__ import annotations
|
|
|
16
16
|
import json
|
|
17
17
|
import pprint
|
|
18
18
|
import re # noqa: F401
|
|
19
|
+
from typing import Any, Dict, Optional
|
|
19
20
|
|
|
20
21
|
from truefoundry.pydantic_v1 import (
|
|
21
22
|
BaseModel,
|
|
@@ -32,10 +33,26 @@ class AgentWithFQN(BaseModel):
|
|
|
32
33
|
AgentWithFQN
|
|
33
34
|
"""
|
|
34
35
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
description: Optional[constr(strict=True, max_length=512)] = Field(
|
|
37
|
+
default=None, description="+sort=2 +label=Description"
|
|
38
|
+
)
|
|
39
|
+
metadata: Dict[str, Any] = Field(
|
|
40
|
+
default=...,
|
|
41
|
+
description="+label=Metadata +docs=Key value pairs to store additional metadata +usage=Key value pairs to store additional metadata +uiType=JsonInput",
|
|
42
|
+
)
|
|
43
|
+
version_alias: Optional[constr(strict=True, max_length=128)] = Field(
|
|
44
|
+
default=None,
|
|
45
|
+
description="+label=Version Alias +usage=The version alias should start with 'v' followed by alphanumeric and it can include '.' and '-' in between (e.g. v1.0.0, v1-prod, v3-dev, etc) +docs=The version alias should start with 'v' followed by alphanumeric and it can include '.' and '-' in between (e.g. v1.0.0, v1-prod, v3-dev, etc) +message=The version alias should start with 'v' followed by alphanumeric and it can include '.' and '-' in between (e.g. v1.0.0, v1-prod, v3-dev, etc)",
|
|
46
|
+
)
|
|
47
|
+
name: Optional[constr(strict=True, max_length=256)] = Field(
|
|
48
|
+
default=None,
|
|
49
|
+
description="+sort=1 +label=Name +message=The name should start with lowercase alphabets and can contain alphanumeric and can include '-' in between",
|
|
38
50
|
)
|
|
51
|
+
ml_repo: Optional[constr(strict=True)] = Field(
|
|
52
|
+
default=None,
|
|
53
|
+
description="+label=ML Repo +usage=name of the ML Repo +docs=name of the ML Repo +uiType=Hidden",
|
|
54
|
+
)
|
|
55
|
+
type: StrictStr = Field(default=..., description="+value=agent")
|
|
39
56
|
available_tools: conlist(constr(strict=True, min_length=1)) = Field(
|
|
40
57
|
default=..., description="+sort=30 +uiType=Hidden"
|
|
41
58
|
)
|
|
@@ -53,8 +70,12 @@ class AgentWithFQN(BaseModel):
|
|
|
53
70
|
id: StrictStr = Field(...)
|
|
54
71
|
fqn: StrictStr = Field(...)
|
|
55
72
|
__properties = [
|
|
56
|
-
"
|
|
73
|
+
"description",
|
|
74
|
+
"metadata",
|
|
75
|
+
"version_alias",
|
|
57
76
|
"name",
|
|
77
|
+
"ml_repo",
|
|
78
|
+
"type",
|
|
58
79
|
"available_tools",
|
|
59
80
|
"goal",
|
|
60
81
|
"instruction",
|
|
@@ -63,22 +84,49 @@ class AgentWithFQN(BaseModel):
|
|
|
63
84
|
"fqn",
|
|
64
85
|
]
|
|
65
86
|
|
|
66
|
-
@validator("
|
|
67
|
-
def
|
|
68
|
-
"""Validates the
|
|
69
|
-
if value
|
|
70
|
-
|
|
87
|
+
@validator("version_alias")
|
|
88
|
+
def version_alias_validate_regular_expression(cls, value):
|
|
89
|
+
"""Validates the regular expression"""
|
|
90
|
+
if value is None:
|
|
91
|
+
return value
|
|
92
|
+
|
|
93
|
+
if not re.match(r"^v[a-zA-Z0-9.-]*([a-zA-Z0-9]+)$", value):
|
|
94
|
+
raise ValueError(
|
|
95
|
+
r"must validate the regular expression /^v[a-zA-Z0-9.-]*([a-zA-Z0-9]+)$/"
|
|
96
|
+
)
|
|
71
97
|
return value
|
|
72
98
|
|
|
73
99
|
@validator("name")
|
|
74
100
|
def name_validate_regular_expression(cls, value):
|
|
75
101
|
"""Validates the regular expression"""
|
|
76
|
-
if
|
|
102
|
+
if value is None:
|
|
103
|
+
return value
|
|
104
|
+
|
|
105
|
+
if not re.match(r"^[A-Za-z0-9_\-]+$", value):
|
|
77
106
|
raise ValueError(
|
|
78
|
-
r"must validate the regular expression /^[
|
|
107
|
+
r"must validate the regular expression /^[A-Za-z0-9_\-]+$/"
|
|
79
108
|
)
|
|
80
109
|
return value
|
|
81
110
|
|
|
111
|
+
@validator("ml_repo")
|
|
112
|
+
def ml_repo_validate_regular_expression(cls, value):
|
|
113
|
+
"""Validates the regular expression"""
|
|
114
|
+
if value is None:
|
|
115
|
+
return value
|
|
116
|
+
|
|
117
|
+
if not re.match(r"^[a-zA-Z][a-zA-Z0-9\-]{1,98}[a-zA-Z0-9]$", value):
|
|
118
|
+
raise ValueError(
|
|
119
|
+
r"must validate the regular expression /^[a-zA-Z][a-zA-Z0-9\-]{1,98}[a-zA-Z0-9]$/"
|
|
120
|
+
)
|
|
121
|
+
return value
|
|
122
|
+
|
|
123
|
+
@validator("type")
|
|
124
|
+
def type_validate_enum(cls, value):
|
|
125
|
+
"""Validates the enum"""
|
|
126
|
+
if value not in ("agent",):
|
|
127
|
+
raise ValueError("must be one of enum values ('agent')")
|
|
128
|
+
return value
|
|
129
|
+
|
|
82
130
|
class Config:
|
|
83
131
|
"""Pydantic configuration"""
|
|
84
132
|
|
|
@@ -114,8 +162,12 @@ class AgentWithFQN(BaseModel):
|
|
|
114
162
|
|
|
115
163
|
_obj = AgentWithFQN.parse_obj(
|
|
116
164
|
{
|
|
117
|
-
"
|
|
165
|
+
"description": obj.get("description"),
|
|
166
|
+
"metadata": obj.get("metadata"),
|
|
167
|
+
"version_alias": obj.get("version_alias"),
|
|
118
168
|
"name": obj.get("name"),
|
|
169
|
+
"ml_repo": obj.get("ml_repo"),
|
|
170
|
+
"type": obj.get("type"),
|
|
119
171
|
"available_tools": obj.get("available_tools"),
|
|
120
172
|
"goal": obj.get("goal"),
|
|
121
173
|
"instruction": obj.get("instruction"),
|
|
@@ -35,16 +35,23 @@ class ArtifactVersionManifest(BaseModel):
|
|
|
35
35
|
"""
|
|
36
36
|
|
|
37
37
|
description: Optional[constr(strict=True, max_length=512)] = Field(
|
|
38
|
-
default=None,
|
|
39
|
-
description="+label=Description +usage=Description of the artifact or model version +docs=Description of the artifact or model version",
|
|
38
|
+
default=None, description="+sort=2 +label=Description"
|
|
40
39
|
)
|
|
41
40
|
metadata: Dict[str, Any] = Field(
|
|
42
41
|
default=...,
|
|
43
|
-
description="+label=Metadata +docs=
|
|
42
|
+
description="+label=Metadata +docs=Key value pairs to store additional metadata +usage=Key value pairs to store additional metadata +uiType=JsonInput",
|
|
44
43
|
)
|
|
45
44
|
version_alias: Optional[constr(strict=True, max_length=128)] = Field(
|
|
46
45
|
default=None,
|
|
47
|
-
description="+label=Version Alias +usage=The version alias
|
|
46
|
+
description="+label=Version Alias +usage=The version alias should start with 'v' followed by alphanumeric and it can include '.' and '-' in between (e.g. v1.0.0, v1-prod, v3-dev, etc) +docs=The version alias should start with 'v' followed by alphanumeric and it can include '.' and '-' in between (e.g. v1.0.0, v1-prod, v3-dev, etc) +message=The version alias should start with 'v' followed by alphanumeric and it can include '.' and '-' in between (e.g. v1.0.0, v1-prod, v3-dev, etc)",
|
|
47
|
+
)
|
|
48
|
+
name: Optional[constr(strict=True, max_length=256)] = Field(
|
|
49
|
+
default=None,
|
|
50
|
+
description="+sort=1 +label=Name +message=The name should start with lowercase alphabets and can contain alphanumeric and can include '-' in between",
|
|
51
|
+
)
|
|
52
|
+
ml_repo: Optional[constr(strict=True)] = Field(
|
|
53
|
+
default=None,
|
|
54
|
+
description="+label=ML Repo +usage=name of the ML Repo +docs=name of the ML Repo +uiType=Hidden",
|
|
48
55
|
)
|
|
49
56
|
type: Optional[StrictStr] = "artifact-version"
|
|
50
57
|
source: Source = Field(...)
|
|
@@ -55,6 +62,8 @@ class ArtifactVersionManifest(BaseModel):
|
|
|
55
62
|
"description",
|
|
56
63
|
"metadata",
|
|
57
64
|
"version_alias",
|
|
65
|
+
"name",
|
|
66
|
+
"ml_repo",
|
|
58
67
|
"type",
|
|
59
68
|
"source",
|
|
60
69
|
"step",
|
|
@@ -72,6 +81,30 @@ class ArtifactVersionManifest(BaseModel):
|
|
|
72
81
|
)
|
|
73
82
|
return value
|
|
74
83
|
|
|
84
|
+
@validator("name")
|
|
85
|
+
def name_validate_regular_expression(cls, value):
|
|
86
|
+
"""Validates the regular expression"""
|
|
87
|
+
if value is None:
|
|
88
|
+
return value
|
|
89
|
+
|
|
90
|
+
if not re.match(r"^[A-Za-z0-9_\-]+$", value):
|
|
91
|
+
raise ValueError(
|
|
92
|
+
r"must validate the regular expression /^[A-Za-z0-9_\-]+$/"
|
|
93
|
+
)
|
|
94
|
+
return value
|
|
95
|
+
|
|
96
|
+
@validator("ml_repo")
|
|
97
|
+
def ml_repo_validate_regular_expression(cls, value):
|
|
98
|
+
"""Validates the regular expression"""
|
|
99
|
+
if value is None:
|
|
100
|
+
return value
|
|
101
|
+
|
|
102
|
+
if not re.match(r"^[a-zA-Z][a-zA-Z0-9\-]{1,98}[a-zA-Z0-9]$", value):
|
|
103
|
+
raise ValueError(
|
|
104
|
+
r"must validate the regular expression /^[a-zA-Z][a-zA-Z0-9\-]{1,98}[a-zA-Z0-9]$/"
|
|
105
|
+
)
|
|
106
|
+
return value
|
|
107
|
+
|
|
75
108
|
@validator("type")
|
|
76
109
|
def type_validate_enum(cls, value):
|
|
77
110
|
"""Validates the enum"""
|
|
@@ -123,6 +156,8 @@ class ArtifactVersionManifest(BaseModel):
|
|
|
123
156
|
"description": obj.get("description"),
|
|
124
157
|
"metadata": obj.get("metadata"),
|
|
125
158
|
"version_alias": obj.get("version_alias"),
|
|
159
|
+
"name": obj.get("name"),
|
|
160
|
+
"ml_repo": obj.get("ml_repo"),
|
|
126
161
|
"type": obj.get("type")
|
|
127
162
|
if obj.get("type") is not None
|
|
128
163
|
else "artifact-version",
|