stackit-modelserving 0.0.1a0__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 (30) hide show
  1. stackit/modelserving/__init__.py +55 -0
  2. stackit/modelserving/api/__init__.py +4 -0
  3. stackit/modelserving/api/default_api.py +2137 -0
  4. stackit/modelserving/api_client.py +627 -0
  5. stackit/modelserving/api_response.py +23 -0
  6. stackit/modelserving/configuration.py +138 -0
  7. stackit/modelserving/exceptions.py +199 -0
  8. stackit/modelserving/models/__init__.py +36 -0
  9. stackit/modelserving/models/chat_model_details.py +189 -0
  10. stackit/modelserving/models/create_token_payload.py +108 -0
  11. stackit/modelserving/models/create_token_response.py +93 -0
  12. stackit/modelserving/models/embedding_model_details.py +160 -0
  13. stackit/modelserving/models/error_message_response.py +83 -0
  14. stackit/modelserving/models/get_chat_model_response.py +93 -0
  15. stackit/modelserving/models/get_embeddings_model_resp.py +93 -0
  16. stackit/modelserving/models/get_token_response.py +93 -0
  17. stackit/modelserving/models/list_models_response.py +99 -0
  18. stackit/modelserving/models/list_token_resp.py +99 -0
  19. stackit/modelserving/models/message_response.py +82 -0
  20. stackit/modelserving/models/model.py +153 -0
  21. stackit/modelserving/models/partial_update_token_payload.py +104 -0
  22. stackit/modelserving/models/sku.py +84 -0
  23. stackit/modelserving/models/token.py +122 -0
  24. stackit/modelserving/models/token_created.py +131 -0
  25. stackit/modelserving/models/update_token_response.py +93 -0
  26. stackit/modelserving/py.typed +0 -0
  27. stackit/modelserving/rest.py +149 -0
  28. stackit_modelserving-0.0.1a0.dist-info/METADATA +45 -0
  29. stackit_modelserving-0.0.1a0.dist-info/RECORD +30 -0
  30. stackit_modelserving-0.0.1a0.dist-info/WHEEL +4 -0
@@ -0,0 +1,99 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT Model Serving API
5
+
6
+ This API provides endpoints for the model serving api
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: model-serving@mail.schwarz
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501 docstring might be too long
14
+
15
+ from __future__ import annotations
16
+
17
+ import json
18
+ import pprint
19
+ from typing import Any, ClassVar, Dict, List, Optional, Set
20
+
21
+ from pydantic import BaseModel, ConfigDict, StrictStr
22
+ from typing_extensions import Self
23
+
24
+ from stackit.modelserving.models.model import Model
25
+
26
+
27
+ class ListModelsResponse(BaseModel):
28
+ """
29
+ ListModelsResponse
30
+ """
31
+
32
+ message: Optional[StrictStr] = None
33
+ models: List[Model]
34
+ __properties: ClassVar[List[str]] = ["message", "models"]
35
+
36
+ model_config = ConfigDict(
37
+ populate_by_name=True,
38
+ validate_assignment=True,
39
+ protected_namespaces=(),
40
+ )
41
+
42
+ def to_str(self) -> str:
43
+ """Returns the string representation of the model using alias"""
44
+ return pprint.pformat(self.model_dump(by_alias=True))
45
+
46
+ def to_json(self) -> str:
47
+ """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
+
51
+ @classmethod
52
+ def from_json(cls, json_str: str) -> Optional[Self]:
53
+ """Create an instance of ListModelsResponse from a JSON string"""
54
+ return cls.from_dict(json.loads(json_str))
55
+
56
+ def to_dict(self) -> Dict[str, Any]:
57
+ """Return the dictionary representation of the model using alias.
58
+
59
+ This has the following differences from calling pydantic's
60
+ `self.model_dump(by_alias=True)`:
61
+
62
+ * `None` is only added to the output dict for nullable fields that
63
+ were set at model initialization. Other fields with value `None`
64
+ are ignored.
65
+ """
66
+ excluded_fields: Set[str] = set([])
67
+
68
+ _dict = self.model_dump(
69
+ by_alias=True,
70
+ exclude=excluded_fields,
71
+ exclude_none=True,
72
+ )
73
+ # override the default output from pydantic by calling `to_dict()` of each item in models (list)
74
+ _items = []
75
+ if self.models:
76
+ for _item in self.models:
77
+ if _item:
78
+ _items.append(_item.to_dict())
79
+ _dict["models"] = _items
80
+ return _dict
81
+
82
+ @classmethod
83
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
84
+ """Create an instance of ListModelsResponse from a dict"""
85
+ if obj is None:
86
+ return None
87
+
88
+ if not isinstance(obj, dict):
89
+ return cls.model_validate(obj)
90
+
91
+ _obj = cls.model_validate(
92
+ {
93
+ "message": obj.get("message"),
94
+ "models": (
95
+ [Model.from_dict(_item) for _item in obj["models"]] if obj.get("models") is not None else None
96
+ ),
97
+ }
98
+ )
99
+ return _obj
@@ -0,0 +1,99 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT Model Serving API
5
+
6
+ This API provides endpoints for the model serving api
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: model-serving@mail.schwarz
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501 docstring might be too long
14
+
15
+ from __future__ import annotations
16
+
17
+ import json
18
+ import pprint
19
+ from typing import Any, ClassVar, Dict, List, Optional, Set
20
+
21
+ from pydantic import BaseModel, ConfigDict, StrictStr
22
+ from typing_extensions import Self
23
+
24
+ from stackit.modelserving.models.token import Token
25
+
26
+
27
+ class ListTokenResp(BaseModel):
28
+ """
29
+ ListTokenResp
30
+ """
31
+
32
+ message: Optional[StrictStr] = None
33
+ tokens: List[Token]
34
+ __properties: ClassVar[List[str]] = ["message", "tokens"]
35
+
36
+ model_config = ConfigDict(
37
+ populate_by_name=True,
38
+ validate_assignment=True,
39
+ protected_namespaces=(),
40
+ )
41
+
42
+ def to_str(self) -> str:
43
+ """Returns the string representation of the model using alias"""
44
+ return pprint.pformat(self.model_dump(by_alias=True))
45
+
46
+ def to_json(self) -> str:
47
+ """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
+
51
+ @classmethod
52
+ def from_json(cls, json_str: str) -> Optional[Self]:
53
+ """Create an instance of ListTokenResp from a JSON string"""
54
+ return cls.from_dict(json.loads(json_str))
55
+
56
+ def to_dict(self) -> Dict[str, Any]:
57
+ """Return the dictionary representation of the model using alias.
58
+
59
+ This has the following differences from calling pydantic's
60
+ `self.model_dump(by_alias=True)`:
61
+
62
+ * `None` is only added to the output dict for nullable fields that
63
+ were set at model initialization. Other fields with value `None`
64
+ are ignored.
65
+ """
66
+ excluded_fields: Set[str] = set([])
67
+
68
+ _dict = self.model_dump(
69
+ by_alias=True,
70
+ exclude=excluded_fields,
71
+ exclude_none=True,
72
+ )
73
+ # override the default output from pydantic by calling `to_dict()` of each item in tokens (list)
74
+ _items = []
75
+ if self.tokens:
76
+ for _item in self.tokens:
77
+ if _item:
78
+ _items.append(_item.to_dict())
79
+ _dict["tokens"] = _items
80
+ return _dict
81
+
82
+ @classmethod
83
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
84
+ """Create an instance of ListTokenResp from a dict"""
85
+ if obj is None:
86
+ return None
87
+
88
+ if not isinstance(obj, dict):
89
+ return cls.model_validate(obj)
90
+
91
+ _obj = cls.model_validate(
92
+ {
93
+ "message": obj.get("message"),
94
+ "tokens": (
95
+ [Token.from_dict(_item) for _item in obj["tokens"]] if obj.get("tokens") is not None else None
96
+ ),
97
+ }
98
+ )
99
+ return _obj
@@ -0,0 +1,82 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT Model Serving API
5
+
6
+ This API provides endpoints for the model serving api
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: model-serving@mail.schwarz
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501 docstring might be too long
14
+
15
+ from __future__ import annotations
16
+
17
+ import json
18
+ import pprint
19
+ from typing import Any, ClassVar, Dict, List, Optional, Set
20
+
21
+ from pydantic import BaseModel, ConfigDict, StrictStr
22
+ from typing_extensions import Self
23
+
24
+
25
+ class MessageResponse(BaseModel):
26
+ """
27
+ MessageResponse
28
+ """
29
+
30
+ message: Optional[StrictStr] = None
31
+ __properties: ClassVar[List[str]] = ["message"]
32
+
33
+ model_config = ConfigDict(
34
+ populate_by_name=True,
35
+ validate_assignment=True,
36
+ protected_namespaces=(),
37
+ )
38
+
39
+ def to_str(self) -> str:
40
+ """Returns the string representation of the model using alias"""
41
+ return pprint.pformat(self.model_dump(by_alias=True))
42
+
43
+ def to_json(self) -> str:
44
+ """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
+
48
+ @classmethod
49
+ def from_json(cls, json_str: str) -> Optional[Self]:
50
+ """Create an instance of MessageResponse from a JSON string"""
51
+ return cls.from_dict(json.loads(json_str))
52
+
53
+ def to_dict(self) -> Dict[str, Any]:
54
+ """Return the dictionary representation of the model using alias.
55
+
56
+ This has the following differences from calling pydantic's
57
+ `self.model_dump(by_alias=True)`:
58
+
59
+ * `None` is only added to the output dict for nullable fields that
60
+ were set at model initialization. Other fields with value `None`
61
+ are ignored.
62
+ """
63
+ excluded_fields: Set[str] = set([])
64
+
65
+ _dict = self.model_dump(
66
+ by_alias=True,
67
+ exclude=excluded_fields,
68
+ exclude_none=True,
69
+ )
70
+ return _dict
71
+
72
+ @classmethod
73
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
74
+ """Create an instance of MessageResponse from a dict"""
75
+ if obj is None:
76
+ return None
77
+
78
+ if not isinstance(obj, dict):
79
+ return cls.model_validate(obj)
80
+
81
+ _obj = cls.model_validate({"message": obj.get("message")})
82
+ return _obj
@@ -0,0 +1,153 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT Model Serving API
5
+
6
+ This API provides endpoints for the model serving api
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: model-serving@mail.schwarz
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501 docstring might be too long
14
+
15
+ from __future__ import annotations
16
+
17
+ import json
18
+ import pprint
19
+ import re
20
+ from typing import Any, ClassVar, Dict, List, Optional, Set
21
+
22
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
23
+ from typing_extensions import Annotated, Self
24
+
25
+ from stackit.modelserving.models.sku import SKU
26
+
27
+
28
+ class Model(BaseModel):
29
+ """
30
+ Model
31
+ """
32
+
33
+ category: StrictStr
34
+ description: Annotated[str, Field(strict=True, max_length=2000)]
35
+ displayed_name: Annotated[str, Field(min_length=1, strict=True, max_length=200)] = Field(alias="displayedName")
36
+ id: StrictStr = Field(description="generated uuid to identify a model")
37
+ name: Annotated[str, Field(min_length=1, strict=True, max_length=200)] = Field(description="huggingface name")
38
+ region: StrictStr
39
+ skus: List[SKU]
40
+ tags: Optional[List[StrictStr]] = None
41
+ type: StrictStr
42
+ url: Annotated[str, Field(min_length=1, strict=True, max_length=200)] = Field(description="url of the model")
43
+ __properties: ClassVar[List[str]] = [
44
+ "category",
45
+ "description",
46
+ "displayedName",
47
+ "id",
48
+ "name",
49
+ "region",
50
+ "skus",
51
+ "tags",
52
+ "type",
53
+ "url",
54
+ ]
55
+
56
+ @field_validator("category")
57
+ def category_validate_enum(cls, value):
58
+ """Validates the enum"""
59
+ if value not in set(["standard", "plus", "premium"]):
60
+ raise ValueError("must be one of enum values ('standard', 'plus', 'premium')")
61
+ return value
62
+
63
+ @field_validator("description")
64
+ def description_validate_regular_expression(cls, value):
65
+ """Validates the regular expression"""
66
+ if not re.match(r"^[0-9a-zA-Z\s.:\/\-]+$", value):
67
+ raise ValueError(r"must validate the regular expression /^[0-9a-zA-Z\s.:\/\-]+$/")
68
+ return value
69
+
70
+ @field_validator("displayed_name")
71
+ def displayed_name_validate_regular_expression(cls, value):
72
+ """Validates the regular expression"""
73
+ if not re.match(r"^[0-9a-zA-Z\s_-]+$", value):
74
+ raise ValueError(r"must validate the regular expression /^[0-9a-zA-Z\s_-]+$/")
75
+ return value
76
+
77
+ @field_validator("type")
78
+ def type_validate_enum(cls, value):
79
+ """Validates the enum"""
80
+ if value not in set(["chat", "embedding"]):
81
+ raise ValueError("must be one of enum values ('chat', 'embedding')")
82
+ return value
83
+
84
+ model_config = ConfigDict(
85
+ populate_by_name=True,
86
+ validate_assignment=True,
87
+ protected_namespaces=(),
88
+ )
89
+
90
+ def to_str(self) -> str:
91
+ """Returns the string representation of the model using alias"""
92
+ return pprint.pformat(self.model_dump(by_alias=True))
93
+
94
+ def to_json(self) -> str:
95
+ """Returns the JSON representation of the model using alias"""
96
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
97
+ return json.dumps(self.to_dict())
98
+
99
+ @classmethod
100
+ def from_json(cls, json_str: str) -> Optional[Self]:
101
+ """Create an instance of Model from a JSON string"""
102
+ return cls.from_dict(json.loads(json_str))
103
+
104
+ def to_dict(self) -> Dict[str, Any]:
105
+ """Return the dictionary representation of the model using alias.
106
+
107
+ This has the following differences from calling pydantic's
108
+ `self.model_dump(by_alias=True)`:
109
+
110
+ * `None` is only added to the output dict for nullable fields that
111
+ were set at model initialization. Other fields with value `None`
112
+ are ignored.
113
+ """
114
+ excluded_fields: Set[str] = set([])
115
+
116
+ _dict = self.model_dump(
117
+ by_alias=True,
118
+ exclude=excluded_fields,
119
+ exclude_none=True,
120
+ )
121
+ # override the default output from pydantic by calling `to_dict()` of each item in skus (list)
122
+ _items = []
123
+ if self.skus:
124
+ for _item in self.skus:
125
+ if _item:
126
+ _items.append(_item.to_dict())
127
+ _dict["skus"] = _items
128
+ return _dict
129
+
130
+ @classmethod
131
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
132
+ """Create an instance of Model from a dict"""
133
+ if obj is None:
134
+ return None
135
+
136
+ if not isinstance(obj, dict):
137
+ return cls.model_validate(obj)
138
+
139
+ _obj = cls.model_validate(
140
+ {
141
+ "category": obj.get("category"),
142
+ "description": obj.get("description"),
143
+ "displayedName": obj.get("displayedName"),
144
+ "id": obj.get("id"),
145
+ "name": obj.get("name"),
146
+ "region": obj.get("region"),
147
+ "skus": [SKU.from_dict(_item) for _item in obj["skus"]] if obj.get("skus") is not None else None,
148
+ "tags": obj.get("tags"),
149
+ "type": obj.get("type"),
150
+ "url": obj.get("url"),
151
+ }
152
+ )
153
+ return _obj
@@ -0,0 +1,104 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT Model Serving API
5
+
6
+ This API provides endpoints for the model serving api
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: model-serving@mail.schwarz
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501 docstring might be too long
14
+
15
+ from __future__ import annotations
16
+
17
+ import json
18
+ import pprint
19
+ import re
20
+ from typing import Any, ClassVar, Dict, List, Optional, Set
21
+
22
+ from pydantic import BaseModel, ConfigDict, Field, field_validator
23
+ from typing_extensions import Annotated, Self
24
+
25
+
26
+ class PartialUpdateTokenPayload(BaseModel):
27
+ """
28
+ PartialUpdateTokenPayload
29
+ """
30
+
31
+ description: Optional[Annotated[str, Field(strict=True, max_length=2000)]] = None
32
+ name: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=200)]] = None
33
+ __properties: ClassVar[List[str]] = ["description", "name"]
34
+
35
+ @field_validator("description")
36
+ def description_validate_regular_expression(cls, value):
37
+ """Validates the regular expression"""
38
+ if value is None:
39
+ return value
40
+
41
+ if not re.match(r"^[0-9a-zA-Z\s.:\/\-]+$", value):
42
+ raise ValueError(r"must validate the regular expression /^[0-9a-zA-Z\s.:\/\-]+$/")
43
+ return value
44
+
45
+ @field_validator("name")
46
+ def name_validate_regular_expression(cls, value):
47
+ """Validates the regular expression"""
48
+ if value is None:
49
+ return value
50
+
51
+ if not re.match(r"^[0-9a-zA-Z\s_-]+$", value):
52
+ raise ValueError(r"must validate the regular expression /^[0-9a-zA-Z\s_-]+$/")
53
+ return value
54
+
55
+ model_config = ConfigDict(
56
+ populate_by_name=True,
57
+ validate_assignment=True,
58
+ protected_namespaces=(),
59
+ )
60
+
61
+ def to_str(self) -> str:
62
+ """Returns the string representation of the model using alias"""
63
+ return pprint.pformat(self.model_dump(by_alias=True))
64
+
65
+ def to_json(self) -> str:
66
+ """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())
69
+
70
+ @classmethod
71
+ def from_json(cls, json_str: str) -> Optional[Self]:
72
+ """Create an instance of PartialUpdateTokenPayload from a JSON string"""
73
+ return cls.from_dict(json.loads(json_str))
74
+
75
+ def to_dict(self) -> Dict[str, Any]:
76
+ """Return the dictionary representation of the model using alias.
77
+
78
+ This has the following differences from calling pydantic's
79
+ `self.model_dump(by_alias=True)`:
80
+
81
+ * `None` is only added to the output dict for nullable fields that
82
+ were set at model initialization. Other fields with value `None`
83
+ are ignored.
84
+ """
85
+ excluded_fields: Set[str] = set([])
86
+
87
+ _dict = self.model_dump(
88
+ by_alias=True,
89
+ exclude=excluded_fields,
90
+ exclude_none=True,
91
+ )
92
+ return _dict
93
+
94
+ @classmethod
95
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
96
+ """Create an instance of PartialUpdateTokenPayload from a dict"""
97
+ if obj is None:
98
+ return None
99
+
100
+ if not isinstance(obj, dict):
101
+ return cls.model_validate(obj)
102
+
103
+ _obj = cls.model_validate({"description": obj.get("description"), "name": obj.get("name")})
104
+ return _obj
@@ -0,0 +1,84 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT Model Serving API
5
+
6
+ This API provides endpoints for the model serving api
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: model-serving@mail.schwarz
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501 docstring might be too long
14
+
15
+ from __future__ import annotations
16
+
17
+ import json
18
+ import pprint
19
+ from typing import Any, ClassVar, Dict, List, Optional, Set
20
+
21
+ from pydantic import BaseModel, ConfigDict, StrictStr
22
+ from typing_extensions import Self
23
+
24
+
25
+ class SKU(BaseModel):
26
+ """
27
+ SKU
28
+ """
29
+
30
+ description: Optional[StrictStr] = None
31
+ id: StrictStr
32
+ type: Optional[StrictStr] = None
33
+ __properties: ClassVar[List[str]] = ["description", "id", "type"]
34
+
35
+ model_config = ConfigDict(
36
+ populate_by_name=True,
37
+ validate_assignment=True,
38
+ protected_namespaces=(),
39
+ )
40
+
41
+ def to_str(self) -> str:
42
+ """Returns the string representation of the model using alias"""
43
+ return pprint.pformat(self.model_dump(by_alias=True))
44
+
45
+ def to_json(self) -> str:
46
+ """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
+
50
+ @classmethod
51
+ def from_json(cls, json_str: str) -> Optional[Self]:
52
+ """Create an instance of SKU from a JSON string"""
53
+ return cls.from_dict(json.loads(json_str))
54
+
55
+ def to_dict(self) -> Dict[str, Any]:
56
+ """Return the dictionary representation of the model using alias.
57
+
58
+ This has the following differences from calling pydantic's
59
+ `self.model_dump(by_alias=True)`:
60
+
61
+ * `None` is only added to the output dict for nullable fields that
62
+ were set at model initialization. Other fields with value `None`
63
+ are ignored.
64
+ """
65
+ excluded_fields: Set[str] = set([])
66
+
67
+ _dict = self.model_dump(
68
+ by_alias=True,
69
+ exclude=excluded_fields,
70
+ exclude_none=True,
71
+ )
72
+ return _dict
73
+
74
+ @classmethod
75
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
76
+ """Create an instance of SKU from a dict"""
77
+ if obj is None:
78
+ return None
79
+
80
+ if not isinstance(obj, dict):
81
+ return cls.model_validate(obj)
82
+
83
+ _obj = cls.model_validate({"description": obj.get("description"), "id": obj.get("id"), "type": obj.get("type")})
84
+ return _obj