stackit-modelserving 0.2.3__tar.gz → 0.3.0__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.
Files changed (33) hide show
  1. {stackit_modelserving-0.2.3 → stackit_modelserving-0.3.0}/PKG-INFO +1 -1
  2. {stackit_modelserving-0.2.3 → stackit_modelserving-0.3.0}/pyproject.toml +1 -1
  3. {stackit_modelserving-0.2.3 → stackit_modelserving-0.3.0}/src/stackit/modelserving/api_client.py +15 -17
  4. {stackit_modelserving-0.2.3 → stackit_modelserving-0.3.0}/src/stackit/modelserving/models/chat_model_details.py +16 -3
  5. {stackit_modelserving-0.2.3 → stackit_modelserving-0.3.0}/src/stackit/modelserving/models/create_token_payload.py +10 -3
  6. {stackit_modelserving-0.2.3 → stackit_modelserving-0.3.0}/src/stackit/modelserving/models/create_token_response.py +4 -3
  7. {stackit_modelserving-0.2.3 → stackit_modelserving-0.3.0}/src/stackit/modelserving/models/embedding_model_details.py +16 -3
  8. {stackit_modelserving-0.2.3 → stackit_modelserving-0.3.0}/src/stackit/modelserving/models/error_message_response.py +4 -3
  9. {stackit_modelserving-0.2.3 → stackit_modelserving-0.3.0}/src/stackit/modelserving/models/get_chat_model_response.py +4 -3
  10. {stackit_modelserving-0.2.3 → stackit_modelserving-0.3.0}/src/stackit/modelserving/models/get_embeddings_model_resp.py +4 -3
  11. {stackit_modelserving-0.2.3 → stackit_modelserving-0.3.0}/src/stackit/modelserving/models/get_token_response.py +4 -3
  12. {stackit_modelserving-0.2.3 → stackit_modelserving-0.3.0}/src/stackit/modelserving/models/list_models_response.py +4 -3
  13. {stackit_modelserving-0.2.3 → stackit_modelserving-0.3.0}/src/stackit/modelserving/models/list_token_resp.py +4 -3
  14. {stackit_modelserving-0.2.3 → stackit_modelserving-0.3.0}/src/stackit/modelserving/models/message_response.py +4 -3
  15. {stackit_modelserving-0.2.3 → stackit_modelserving-0.3.0}/src/stackit/modelserving/models/model.py +10 -3
  16. {stackit_modelserving-0.2.3 → stackit_modelserving-0.3.0}/src/stackit/modelserving/models/partial_update_token_payload.py +10 -3
  17. {stackit_modelserving-0.2.3 → stackit_modelserving-0.3.0}/src/stackit/modelserving/models/sku.py +4 -3
  18. {stackit_modelserving-0.2.3 → stackit_modelserving-0.3.0}/src/stackit/modelserving/models/token.py +10 -3
  19. {stackit_modelserving-0.2.3 → stackit_modelserving-0.3.0}/src/stackit/modelserving/models/token_created.py +13 -3
  20. {stackit_modelserving-0.2.3 → stackit_modelserving-0.3.0}/src/stackit/modelserving/models/update_token_response.py +4 -3
  21. {stackit_modelserving-0.2.3 → stackit_modelserving-0.3.0}/.gitignore +0 -0
  22. {stackit_modelserving-0.2.3 → stackit_modelserving-0.3.0}/LICENSE.md +0 -0
  23. {stackit_modelserving-0.2.3 → stackit_modelserving-0.3.0}/NOTICE.txt +0 -0
  24. {stackit_modelserving-0.2.3 → stackit_modelserving-0.3.0}/README.md +0 -0
  25. {stackit_modelserving-0.2.3 → stackit_modelserving-0.3.0}/src/stackit/modelserving/__init__.py +0 -0
  26. {stackit_modelserving-0.2.3 → stackit_modelserving-0.3.0}/src/stackit/modelserving/api/__init__.py +0 -0
  27. {stackit_modelserving-0.2.3 → stackit_modelserving-0.3.0}/src/stackit/modelserving/api/default_api.py +0 -0
  28. {stackit_modelserving-0.2.3 → stackit_modelserving-0.3.0}/src/stackit/modelserving/api_response.py +0 -0
  29. {stackit_modelserving-0.2.3 → stackit_modelserving-0.3.0}/src/stackit/modelserving/configuration.py +0 -0
  30. {stackit_modelserving-0.2.3 → stackit_modelserving-0.3.0}/src/stackit/modelserving/exceptions.py +0 -0
  31. {stackit_modelserving-0.2.3 → stackit_modelserving-0.3.0}/src/stackit/modelserving/models/__init__.py +0 -0
  32. {stackit_modelserving-0.2.3 → stackit_modelserving-0.3.0}/src/stackit/modelserving/py.typed +0 -0
  33. {stackit_modelserving-0.2.3 → stackit_modelserving-0.3.0}/src/stackit/modelserving/rest.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: stackit-modelserving
3
- Version: 0.2.3
3
+ Version: 0.3.0
4
4
  Summary: STACKIT Model Serving API
5
5
  Project-URL: Homepage, https://github.com/stackitcloud/stackit-sdk-python
6
6
  Project-URL: Issues, https://github.com/stackitcloud/stackit-sdk-python/issues
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "stackit-modelserving"
3
- version = "v0.2.3"
3
+ version = "v0.3.0"
4
4
  description = "STACKIT Model Serving API"
5
5
  authors = [{ name = "STACKIT Developer Tools", email = "developer-tools@stackit.cloud" }]
6
6
  requires-python = ">=3.9,<4.0"
@@ -67,6 +67,7 @@ class ApiClient:
67
67
  "date": datetime.date,
68
68
  "datetime": datetime.datetime,
69
69
  "decimal": decimal.Decimal,
70
+ "UUID": uuid.UUID,
70
71
  "object": object,
71
72
  }
72
73
  _pool = None
@@ -266,7 +267,7 @@ class ApiClient:
266
267
  response_text = None
267
268
  return_data = None
268
269
  try:
269
- if response_type == "bytearray":
270
+ if response_type in ("bytearray", "bytes"):
270
271
  return_data = response_data.data
271
272
  elif response_type == "file":
272
273
  return_data = self.__deserialize_file(response_data)
@@ -327,25 +328,20 @@ class ApiClient:
327
328
  return obj.isoformat()
328
329
  elif isinstance(obj, decimal.Decimal):
329
330
  return str(obj)
330
-
331
331
  elif isinstance(obj, dict):
332
- obj_dict = obj
332
+ return {key: self.sanitize_for_serialization(val) for key, val in obj.items()}
333
+
334
+ # Convert model obj to dict except
335
+ # attributes `openapi_types`, `attribute_map`
336
+ # and attributes which value is not None.
337
+ # Convert attribute name to json key in
338
+ # model definition for request.
339
+ if hasattr(obj, "to_dict") and callable(getattr(obj, "to_dict")): # noqa: B009
340
+ obj_dict = obj.to_dict()
333
341
  else:
334
- # Convert model obj to dict except
335
- # attributes `openapi_types`, `attribute_map`
336
- # and attributes which value is not None.
337
- # Convert attribute name to json key in
338
- # model definition for request.
339
- if hasattr(obj, "to_dict") and callable(getattr(obj, "to_dict")): # noqa: B009
340
- obj_dict = obj.to_dict()
341
- else:
342
- obj_dict = obj.__dict__
343
-
344
- if isinstance(obj_dict, list):
345
- # here we handle instances that can either be a list or something else, and only became a real list by calling to_dict() # noqa: E501
346
- return self.sanitize_for_serialization(obj_dict)
342
+ obj_dict = obj.__dict__
347
343
 
348
- return {key: self.sanitize_for_serialization(val) for key, val in obj_dict.items()}
344
+ return self.sanitize_for_serialization(obj_dict)
349
345
 
350
346
  def deserialize(self, response_text: str, response_type: str, content_type: Optional[str]):
351
347
  """Deserializes response into an object.
@@ -418,6 +414,8 @@ class ApiClient:
418
414
  return self.__deserialize_datetime(data)
419
415
  elif klass is decimal.Decimal:
420
416
  return decimal.Decimal(data)
417
+ elif klass is uuid.UUID:
418
+ return uuid.UUID(data)
421
419
  elif issubclass(klass, Enum):
422
420
  return self.__deserialize_enum(data, klass)
423
421
  else:
@@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set
21
21
  from uuid import UUID
22
22
 
23
23
  from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator
24
+ from pydantic_core import to_jsonable_python
24
25
  from typing_extensions import Annotated, Self
25
26
 
26
27
  from stackit.modelserving.models.sku import SKU
@@ -80,6 +81,9 @@ class ChatModelDetails(BaseModel):
80
81
  @field_validator("description")
81
82
  def description_validate_regular_expression(cls, value):
82
83
  """Validates the regular expression"""
84
+ if not isinstance(value, str):
85
+ value = str(value)
86
+
83
87
  if not re.match(r"^[0-9a-zA-Z\s.:\/\-]+$", value):
84
88
  raise ValueError(r"must validate the regular expression /^[0-9a-zA-Z\s.:\/\-]+$/")
85
89
  return value
@@ -87,6 +91,9 @@ class ChatModelDetails(BaseModel):
87
91
  @field_validator("displayed_name")
88
92
  def displayed_name_validate_regular_expression(cls, value):
89
93
  """Validates the regular expression"""
94
+ if not isinstance(value, str):
95
+ value = str(value)
96
+
90
97
  if not re.match(r"^[0-9a-zA-Z\s_-]+$", value):
91
98
  raise ValueError(r"must validate the regular expression /^[0-9a-zA-Z\s_-]+$/")
92
99
  return value
@@ -94,6 +101,9 @@ class ChatModelDetails(BaseModel):
94
101
  @field_validator("name")
95
102
  def name_validate_regular_expression(cls, value):
96
103
  """Validates the regular expression"""
104
+ if not isinstance(value, str):
105
+ value = str(value)
106
+
97
107
  if not re.match(r"^[0-9a-zA-Z\s.:\/\-]+$", value):
98
108
  raise ValueError(r"must validate the regular expression /^[0-9a-zA-Z\s.:\/\-]+$/")
99
109
  return value
@@ -111,12 +121,16 @@ class ChatModelDetails(BaseModel):
111
121
  @field_validator("url")
112
122
  def url_validate_regular_expression(cls, value):
113
123
  """Validates the regular expression"""
124
+ if not isinstance(value, str):
125
+ value = str(value)
126
+
114
127
  if not re.match(r"^[0-9a-zA-Z\s.:\/\-]+$", value):
115
128
  raise ValueError(r"must validate the regular expression /^[0-9a-zA-Z\s.:\/\-]+$/")
116
129
  return value
117
130
 
118
131
  model_config = ConfigDict(
119
- populate_by_name=True,
132
+ validate_by_name=True,
133
+ validate_by_alias=True,
120
134
  validate_assignment=True,
121
135
  protected_namespaces=(),
122
136
  )
@@ -127,8 +141,7 @@ class ChatModelDetails(BaseModel):
127
141
 
128
142
  def to_json(self) -> str:
129
143
  """Returns the JSON representation of the model using alias"""
130
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
131
- return json.dumps(self.to_dict())
144
+ return json.dumps(to_jsonable_python(self.to_dict()))
132
145
 
133
146
  @classmethod
134
147
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -20,6 +20,7 @@ import re # noqa: F401
20
20
  from typing import Any, ClassVar, Dict, List, Optional, Set
21
21
 
22
22
  from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
23
+ from pydantic_core import to_jsonable_python
23
24
  from typing_extensions import Annotated, Self
24
25
 
25
26
 
@@ -43,6 +44,9 @@ class CreateTokenPayload(BaseModel):
43
44
  if value is None:
44
45
  return value
45
46
 
47
+ if not isinstance(value, str):
48
+ value = str(value)
49
+
46
50
  if not re.match(r"^[0-9a-zA-Z\s.:\/\-]+$", value):
47
51
  raise ValueError(r"must validate the regular expression /^[0-9a-zA-Z\s.:\/\-]+$/")
48
52
  return value
@@ -50,12 +54,16 @@ class CreateTokenPayload(BaseModel):
50
54
  @field_validator("name")
51
55
  def name_validate_regular_expression(cls, value):
52
56
  """Validates the regular expression"""
57
+ if not isinstance(value, str):
58
+ value = str(value)
59
+
53
60
  if not re.match(r"^[0-9a-zA-Z\s_-]+$", value):
54
61
  raise ValueError(r"must validate the regular expression /^[0-9a-zA-Z\s_-]+$/")
55
62
  return value
56
63
 
57
64
  model_config = ConfigDict(
58
- populate_by_name=True,
65
+ validate_by_name=True,
66
+ validate_by_alias=True,
59
67
  validate_assignment=True,
60
68
  protected_namespaces=(),
61
69
  )
@@ -66,8 +74,7 @@ class CreateTokenPayload(BaseModel):
66
74
 
67
75
  def to_json(self) -> str:
68
76
  """Returns the JSON representation of the model using alias"""
69
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
70
- return json.dumps(self.to_dict())
77
+ return json.dumps(to_jsonable_python(self.to_dict()))
71
78
 
72
79
  @classmethod
73
80
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -19,6 +19,7 @@ import pprint
19
19
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
20
 
21
21
  from pydantic import BaseModel, ConfigDict, StrictStr
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Self
23
24
 
24
25
  from stackit.modelserving.models.token_created import TokenCreated
@@ -34,7 +35,8 @@ class CreateTokenResponse(BaseModel):
34
35
  __properties: ClassVar[List[str]] = ["message", "token"]
35
36
 
36
37
  model_config = ConfigDict(
37
- populate_by_name=True,
38
+ validate_by_name=True,
39
+ validate_by_alias=True,
38
40
  validate_assignment=True,
39
41
  protected_namespaces=(),
40
42
  )
@@ -45,8 +47,7 @@ class CreateTokenResponse(BaseModel):
45
47
 
46
48
  def to_json(self) -> str:
47
49
  """Returns the JSON representation of the model using alias"""
48
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
49
- return json.dumps(self.to_dict())
50
+ return json.dumps(to_jsonable_python(self.to_dict()))
50
51
 
51
52
  @classmethod
52
53
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set
21
21
  from uuid import UUID
22
22
 
23
23
  from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator
24
+ from pydantic_core import to_jsonable_python
24
25
  from typing_extensions import Annotated, Self
25
26
 
26
27
  from stackit.modelserving.models.sku import SKU
@@ -64,6 +65,9 @@ class EmbeddingModelDetails(BaseModel):
64
65
  @field_validator("description")
65
66
  def description_validate_regular_expression(cls, value):
66
67
  """Validates the regular expression"""
68
+ if not isinstance(value, str):
69
+ value = str(value)
70
+
67
71
  if not re.match(r"^[0-9a-zA-Z\s.:\/\-]+$", value):
68
72
  raise ValueError(r"must validate the regular expression /^[0-9a-zA-Z\s.:\/\-]+$/")
69
73
  return value
@@ -71,6 +75,9 @@ class EmbeddingModelDetails(BaseModel):
71
75
  @field_validator("displayed_name")
72
76
  def displayed_name_validate_regular_expression(cls, value):
73
77
  """Validates the regular expression"""
78
+ if not isinstance(value, str):
79
+ value = str(value)
80
+
74
81
  if not re.match(r"^[0-9a-zA-Z\s_-]+$", value):
75
82
  raise ValueError(r"must validate the regular expression /^[0-9a-zA-Z\s_-]+$/")
76
83
  return value
@@ -78,6 +85,9 @@ class EmbeddingModelDetails(BaseModel):
78
85
  @field_validator("name")
79
86
  def name_validate_regular_expression(cls, value):
80
87
  """Validates the regular expression"""
88
+ if not isinstance(value, str):
89
+ value = str(value)
90
+
81
91
  if not re.match(r"^[0-9a-zA-Z\s.:\/\-]+$", value):
82
92
  raise ValueError(r"must validate the regular expression /^[0-9a-zA-Z\s.:\/\-]+$/")
83
93
  return value
@@ -85,12 +95,16 @@ class EmbeddingModelDetails(BaseModel):
85
95
  @field_validator("url")
86
96
  def url_validate_regular_expression(cls, value):
87
97
  """Validates the regular expression"""
98
+ if not isinstance(value, str):
99
+ value = str(value)
100
+
88
101
  if not re.match(r"^[0-9a-zA-Z\s.:\/\-]+$", value):
89
102
  raise ValueError(r"must validate the regular expression /^[0-9a-zA-Z\s.:\/\-]+$/")
90
103
  return value
91
104
 
92
105
  model_config = ConfigDict(
93
- populate_by_name=True,
106
+ validate_by_name=True,
107
+ validate_by_alias=True,
94
108
  validate_assignment=True,
95
109
  protected_namespaces=(),
96
110
  )
@@ -101,8 +115,7 @@ class EmbeddingModelDetails(BaseModel):
101
115
 
102
116
  def to_json(self) -> str:
103
117
  """Returns the JSON representation of the model using alias"""
104
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
105
- return json.dumps(self.to_dict())
118
+ return json.dumps(to_jsonable_python(self.to_dict()))
106
119
 
107
120
  @classmethod
108
121
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -19,6 +19,7 @@ import pprint
19
19
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
20
 
21
21
  from pydantic import BaseModel, ConfigDict, StrictStr
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Self
23
24
 
24
25
 
@@ -32,7 +33,8 @@ class ErrorMessageResponse(BaseModel):
32
33
  __properties: ClassVar[List[str]] = ["error", "message"]
33
34
 
34
35
  model_config = ConfigDict(
35
- populate_by_name=True,
36
+ validate_by_name=True,
37
+ validate_by_alias=True,
36
38
  validate_assignment=True,
37
39
  protected_namespaces=(),
38
40
  )
@@ -43,8 +45,7 @@ class ErrorMessageResponse(BaseModel):
43
45
 
44
46
  def to_json(self) -> str:
45
47
  """Returns the JSON representation of the model using alias"""
46
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
47
- return json.dumps(self.to_dict())
48
+ return json.dumps(to_jsonable_python(self.to_dict()))
48
49
 
49
50
  @classmethod
50
51
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -19,6 +19,7 @@ import pprint
19
19
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
20
 
21
21
  from pydantic import BaseModel, ConfigDict, StrictStr
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Self
23
24
 
24
25
  from stackit.modelserving.models.chat_model_details import ChatModelDetails
@@ -34,7 +35,8 @@ class GetChatModelResponse(BaseModel):
34
35
  __properties: ClassVar[List[str]] = ["message", "model"]
35
36
 
36
37
  model_config = ConfigDict(
37
- populate_by_name=True,
38
+ validate_by_name=True,
39
+ validate_by_alias=True,
38
40
  validate_assignment=True,
39
41
  protected_namespaces=(),
40
42
  )
@@ -45,8 +47,7 @@ class GetChatModelResponse(BaseModel):
45
47
 
46
48
  def to_json(self) -> str:
47
49
  """Returns the JSON representation of the model using alias"""
48
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
49
- return json.dumps(self.to_dict())
50
+ return json.dumps(to_jsonable_python(self.to_dict()))
50
51
 
51
52
  @classmethod
52
53
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -19,6 +19,7 @@ import pprint
19
19
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
20
 
21
21
  from pydantic import BaseModel, ConfigDict, StrictStr
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Self
23
24
 
24
25
  from stackit.modelserving.models.embedding_model_details import EmbeddingModelDetails
@@ -34,7 +35,8 @@ class GetEmbeddingsModelResp(BaseModel):
34
35
  __properties: ClassVar[List[str]] = ["message", "model"]
35
36
 
36
37
  model_config = ConfigDict(
37
- populate_by_name=True,
38
+ validate_by_name=True,
39
+ validate_by_alias=True,
38
40
  validate_assignment=True,
39
41
  protected_namespaces=(),
40
42
  )
@@ -45,8 +47,7 @@ class GetEmbeddingsModelResp(BaseModel):
45
47
 
46
48
  def to_json(self) -> str:
47
49
  """Returns the JSON representation of the model using alias"""
48
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
49
- return json.dumps(self.to_dict())
50
+ return json.dumps(to_jsonable_python(self.to_dict()))
50
51
 
51
52
  @classmethod
52
53
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -19,6 +19,7 @@ import pprint
19
19
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
20
 
21
21
  from pydantic import BaseModel, ConfigDict, StrictStr
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Self
23
24
 
24
25
  from stackit.modelserving.models.token import Token
@@ -34,7 +35,8 @@ class GetTokenResponse(BaseModel):
34
35
  __properties: ClassVar[List[str]] = ["message", "token"]
35
36
 
36
37
  model_config = ConfigDict(
37
- populate_by_name=True,
38
+ validate_by_name=True,
39
+ validate_by_alias=True,
38
40
  validate_assignment=True,
39
41
  protected_namespaces=(),
40
42
  )
@@ -45,8 +47,7 @@ class GetTokenResponse(BaseModel):
45
47
 
46
48
  def to_json(self) -> str:
47
49
  """Returns the JSON representation of the model using alias"""
48
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
49
- return json.dumps(self.to_dict())
50
+ return json.dumps(to_jsonable_python(self.to_dict()))
50
51
 
51
52
  @classmethod
52
53
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -19,6 +19,7 @@ import pprint
19
19
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
20
 
21
21
  from pydantic import BaseModel, ConfigDict, StrictStr
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Self
23
24
 
24
25
  from stackit.modelserving.models.model import Model
@@ -34,7 +35,8 @@ class ListModelsResponse(BaseModel):
34
35
  __properties: ClassVar[List[str]] = ["message", "models"]
35
36
 
36
37
  model_config = ConfigDict(
37
- populate_by_name=True,
38
+ validate_by_name=True,
39
+ validate_by_alias=True,
38
40
  validate_assignment=True,
39
41
  protected_namespaces=(),
40
42
  )
@@ -45,8 +47,7 @@ class ListModelsResponse(BaseModel):
45
47
 
46
48
  def to_json(self) -> str:
47
49
  """Returns the JSON representation of the model using alias"""
48
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
49
- return json.dumps(self.to_dict())
50
+ return json.dumps(to_jsonable_python(self.to_dict()))
50
51
 
51
52
  @classmethod
52
53
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -19,6 +19,7 @@ import pprint
19
19
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
20
 
21
21
  from pydantic import BaseModel, ConfigDict, StrictStr
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Self
23
24
 
24
25
  from stackit.modelserving.models.token import Token
@@ -34,7 +35,8 @@ class ListTokenResp(BaseModel):
34
35
  __properties: ClassVar[List[str]] = ["message", "tokens"]
35
36
 
36
37
  model_config = ConfigDict(
37
- populate_by_name=True,
38
+ validate_by_name=True,
39
+ validate_by_alias=True,
38
40
  validate_assignment=True,
39
41
  protected_namespaces=(),
40
42
  )
@@ -45,8 +47,7 @@ class ListTokenResp(BaseModel):
45
47
 
46
48
  def to_json(self) -> str:
47
49
  """Returns the JSON representation of the model using alias"""
48
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
49
- return json.dumps(self.to_dict())
50
+ return json.dumps(to_jsonable_python(self.to_dict()))
50
51
 
51
52
  @classmethod
52
53
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -19,6 +19,7 @@ import pprint
19
19
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
20
 
21
21
  from pydantic import BaseModel, ConfigDict, StrictStr
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Self
23
24
 
24
25
 
@@ -31,7 +32,8 @@ class MessageResponse(BaseModel):
31
32
  __properties: ClassVar[List[str]] = ["message"]
32
33
 
33
34
  model_config = ConfigDict(
34
- populate_by_name=True,
35
+ validate_by_name=True,
36
+ validate_by_alias=True,
35
37
  validate_assignment=True,
36
38
  protected_namespaces=(),
37
39
  )
@@ -42,8 +44,7 @@ class MessageResponse(BaseModel):
42
44
 
43
45
  def to_json(self) -> str:
44
46
  """Returns the JSON representation of the model using alias"""
45
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
46
- return json.dumps(self.to_dict())
47
+ return json.dumps(to_jsonable_python(self.to_dict()))
47
48
 
48
49
  @classmethod
49
50
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set
21
21
  from uuid import UUID
22
22
 
23
23
  from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
24
+ from pydantic_core import to_jsonable_python
24
25
  from typing_extensions import Annotated, Self
25
26
 
26
27
  from stackit.modelserving.models.sku import SKU
@@ -64,6 +65,9 @@ class Model(BaseModel):
64
65
  @field_validator("description")
65
66
  def description_validate_regular_expression(cls, value):
66
67
  """Validates the regular expression"""
68
+ if not isinstance(value, str):
69
+ value = str(value)
70
+
67
71
  if not re.match(r"^[0-9a-zA-Z\s.:\/\-]+$", value):
68
72
  raise ValueError(r"must validate the regular expression /^[0-9a-zA-Z\s.:\/\-]+$/")
69
73
  return value
@@ -71,6 +75,9 @@ class Model(BaseModel):
71
75
  @field_validator("displayed_name")
72
76
  def displayed_name_validate_regular_expression(cls, value):
73
77
  """Validates the regular expression"""
78
+ if not isinstance(value, str):
79
+ value = str(value)
80
+
74
81
  if not re.match(r"^[0-9a-zA-Z\s_-]+$", value):
75
82
  raise ValueError(r"must validate the regular expression /^[0-9a-zA-Z\s_-]+$/")
76
83
  return value
@@ -83,7 +90,8 @@ class Model(BaseModel):
83
90
  return value
84
91
 
85
92
  model_config = ConfigDict(
86
- populate_by_name=True,
93
+ validate_by_name=True,
94
+ validate_by_alias=True,
87
95
  validate_assignment=True,
88
96
  protected_namespaces=(),
89
97
  )
@@ -94,8 +102,7 @@ class Model(BaseModel):
94
102
 
95
103
  def to_json(self) -> str:
96
104
  """Returns the JSON representation of the model using alias"""
97
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
98
- return json.dumps(self.to_dict())
105
+ return json.dumps(to_jsonable_python(self.to_dict()))
99
106
 
100
107
  @classmethod
101
108
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -20,6 +20,7 @@ import re # noqa: F401
20
20
  from typing import Any, ClassVar, Dict, List, Optional, Set
21
21
 
22
22
  from pydantic import BaseModel, ConfigDict, Field, field_validator
23
+ from pydantic_core import to_jsonable_python
23
24
  from typing_extensions import Annotated, Self
24
25
 
25
26
 
@@ -38,6 +39,9 @@ class PartialUpdateTokenPayload(BaseModel):
38
39
  if value is None:
39
40
  return value
40
41
 
42
+ if not isinstance(value, str):
43
+ value = str(value)
44
+
41
45
  if not re.match(r"^[0-9a-zA-Z\s.:\/\-]+$", value):
42
46
  raise ValueError(r"must validate the regular expression /^[0-9a-zA-Z\s.:\/\-]+$/")
43
47
  return value
@@ -48,12 +52,16 @@ class PartialUpdateTokenPayload(BaseModel):
48
52
  if value is None:
49
53
  return value
50
54
 
55
+ if not isinstance(value, str):
56
+ value = str(value)
57
+
51
58
  if not re.match(r"^[0-9a-zA-Z\s_-]+$", value):
52
59
  raise ValueError(r"must validate the regular expression /^[0-9a-zA-Z\s_-]+$/")
53
60
  return value
54
61
 
55
62
  model_config = ConfigDict(
56
- populate_by_name=True,
63
+ validate_by_name=True,
64
+ validate_by_alias=True,
57
65
  validate_assignment=True,
58
66
  protected_namespaces=(),
59
67
  )
@@ -64,8 +72,7 @@ class PartialUpdateTokenPayload(BaseModel):
64
72
 
65
73
  def to_json(self) -> str:
66
74
  """Returns the JSON representation of the model using alias"""
67
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
68
- return json.dumps(self.to_dict())
75
+ return json.dumps(to_jsonable_python(self.to_dict()))
69
76
 
70
77
  @classmethod
71
78
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -19,6 +19,7 @@ import pprint
19
19
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
20
 
21
21
  from pydantic import BaseModel, ConfigDict, StrictStr
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Self
23
24
 
24
25
 
@@ -33,7 +34,8 @@ class SKU(BaseModel):
33
34
  __properties: ClassVar[List[str]] = ["description", "id", "type"]
34
35
 
35
36
  model_config = ConfigDict(
36
- populate_by_name=True,
37
+ validate_by_name=True,
38
+ validate_by_alias=True,
37
39
  validate_assignment=True,
38
40
  protected_namespaces=(),
39
41
  )
@@ -44,8 +46,7 @@ class SKU(BaseModel):
44
46
 
45
47
  def to_json(self) -> str:
46
48
  """Returns the JSON representation of the model using alias"""
47
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
48
- return json.dumps(self.to_dict())
49
+ return json.dumps(to_jsonable_python(self.to_dict()))
49
50
 
50
51
  @classmethod
51
52
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -22,6 +22,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set
22
22
  from uuid import UUID
23
23
 
24
24
  from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
25
+ from pydantic_core import to_jsonable_python
25
26
  from typing_extensions import Annotated, Self
26
27
 
27
28
 
@@ -44,6 +45,9 @@ class Token(BaseModel):
44
45
  if value is None:
45
46
  return value
46
47
 
48
+ if not isinstance(value, str):
49
+ value = str(value)
50
+
47
51
  if not re.match(r"^[0-9a-zA-Z\s.:\/\-]+$", value):
48
52
  raise ValueError(r"must validate the regular expression /^[0-9a-zA-Z\s.:\/\-]+$/")
49
53
  return value
@@ -51,6 +55,9 @@ class Token(BaseModel):
51
55
  @field_validator("name")
52
56
  def name_validate_regular_expression(cls, value):
53
57
  """Validates the regular expression"""
58
+ if not isinstance(value, str):
59
+ value = str(value)
60
+
54
61
  if not re.match(r"^[0-9a-zA-Z\s_-]+$", value):
55
62
  raise ValueError(r"must validate the regular expression /^[0-9a-zA-Z\s_-]+$/")
56
63
  return value
@@ -76,7 +83,8 @@ class Token(BaseModel):
76
83
  return value
77
84
 
78
85
  model_config = ConfigDict(
79
- populate_by_name=True,
86
+ validate_by_name=True,
87
+ validate_by_alias=True,
80
88
  validate_assignment=True,
81
89
  protected_namespaces=(),
82
90
  )
@@ -87,8 +95,7 @@ class Token(BaseModel):
87
95
 
88
96
  def to_json(self) -> str:
89
97
  """Returns the JSON representation of the model using alias"""
90
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
91
- return json.dumps(self.to_dict())
98
+ return json.dumps(to_jsonable_python(self.to_dict()))
92
99
 
93
100
  @classmethod
94
101
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -22,6 +22,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set
22
22
  from uuid import UUID
23
23
 
24
24
  from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
25
+ from pydantic_core import to_jsonable_python
25
26
  from typing_extensions import Annotated, Self
26
27
 
27
28
 
@@ -42,6 +43,9 @@ class TokenCreated(BaseModel):
42
43
  @field_validator("content")
43
44
  def content_validate_regular_expression(cls, value):
44
45
  """Validates the regular expression"""
46
+ if not isinstance(value, str):
47
+ value = str(value)
48
+
45
49
  if not re.match(r"^[0-9a-zA-Z\s_-]+$", value):
46
50
  raise ValueError(r"must validate the regular expression /^[0-9a-zA-Z\s_-]+$/")
47
51
  return value
@@ -52,6 +56,9 @@ class TokenCreated(BaseModel):
52
56
  if value is None:
53
57
  return value
54
58
 
59
+ if not isinstance(value, str):
60
+ value = str(value)
61
+
55
62
  if not re.match(r"^[0-9a-zA-Z\s.:\/\-]+$", value):
56
63
  raise ValueError(r"must validate the regular expression /^[0-9a-zA-Z\s.:\/\-]+$/")
57
64
  return value
@@ -59,6 +66,9 @@ class TokenCreated(BaseModel):
59
66
  @field_validator("name")
60
67
  def name_validate_regular_expression(cls, value):
61
68
  """Validates the regular expression"""
69
+ if not isinstance(value, str):
70
+ value = str(value)
71
+
62
72
  if not re.match(r"^[0-9a-zA-Z\s_-]+$", value):
63
73
  raise ValueError(r"must validate the regular expression /^[0-9a-zA-Z\s_-]+$/")
64
74
  return value
@@ -84,7 +94,8 @@ class TokenCreated(BaseModel):
84
94
  return value
85
95
 
86
96
  model_config = ConfigDict(
87
- populate_by_name=True,
97
+ validate_by_name=True,
98
+ validate_by_alias=True,
88
99
  validate_assignment=True,
89
100
  protected_namespaces=(),
90
101
  )
@@ -95,8 +106,7 @@ class TokenCreated(BaseModel):
95
106
 
96
107
  def to_json(self) -> str:
97
108
  """Returns the JSON representation of the model using alias"""
98
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
99
- return json.dumps(self.to_dict())
109
+ return json.dumps(to_jsonable_python(self.to_dict()))
100
110
 
101
111
  @classmethod
102
112
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -19,6 +19,7 @@ import pprint
19
19
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
20
 
21
21
  from pydantic import BaseModel, ConfigDict, StrictStr
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Self
23
24
 
24
25
  from stackit.modelserving.models.token import Token
@@ -34,7 +35,8 @@ class UpdateTokenResponse(BaseModel):
34
35
  __properties: ClassVar[List[str]] = ["message", "token"]
35
36
 
36
37
  model_config = ConfigDict(
37
- populate_by_name=True,
38
+ validate_by_name=True,
39
+ validate_by_alias=True,
38
40
  validate_assignment=True,
39
41
  protected_namespaces=(),
40
42
  )
@@ -45,8 +47,7 @@ class UpdateTokenResponse(BaseModel):
45
47
 
46
48
  def to_json(self) -> str:
47
49
  """Returns the JSON representation of the model using alias"""
48
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
49
- return json.dumps(self.to_dict())
50
+ return json.dumps(to_jsonable_python(self.to_dict()))
50
51
 
51
52
  @classmethod
52
53
  def from_json(cls, json_str: str) -> Optional[Self]: