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.
- stackit/modelserving/__init__.py +55 -0
- stackit/modelserving/api/__init__.py +4 -0
- stackit/modelserving/api/default_api.py +2137 -0
- stackit/modelserving/api_client.py +627 -0
- stackit/modelserving/api_response.py +23 -0
- stackit/modelserving/configuration.py +138 -0
- stackit/modelserving/exceptions.py +199 -0
- stackit/modelserving/models/__init__.py +36 -0
- stackit/modelserving/models/chat_model_details.py +189 -0
- stackit/modelserving/models/create_token_payload.py +108 -0
- stackit/modelserving/models/create_token_response.py +93 -0
- stackit/modelserving/models/embedding_model_details.py +160 -0
- stackit/modelserving/models/error_message_response.py +83 -0
- stackit/modelserving/models/get_chat_model_response.py +93 -0
- stackit/modelserving/models/get_embeddings_model_resp.py +93 -0
- stackit/modelserving/models/get_token_response.py +93 -0
- stackit/modelserving/models/list_models_response.py +99 -0
- stackit/modelserving/models/list_token_resp.py +99 -0
- stackit/modelserving/models/message_response.py +82 -0
- stackit/modelserving/models/model.py +153 -0
- stackit/modelserving/models/partial_update_token_payload.py +104 -0
- stackit/modelserving/models/sku.py +84 -0
- stackit/modelserving/models/token.py +122 -0
- stackit/modelserving/models/token_created.py +131 -0
- stackit/modelserving/models/update_token_response.py +93 -0
- stackit/modelserving/py.typed +0 -0
- stackit/modelserving/rest.py +149 -0
- stackit_modelserving-0.0.1a0.dist-info/METADATA +45 -0
- stackit_modelserving-0.0.1a0.dist-info/RECORD +30 -0
- stackit_modelserving-0.0.1a0.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,93 @@
|
|
|
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_created import TokenCreated
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class CreateTokenResponse(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
CreateTokenResponse
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
message: Optional[StrictStr] = None
|
|
33
|
+
token: TokenCreated
|
|
34
|
+
__properties: ClassVar[List[str]] = ["message", "token"]
|
|
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 CreateTokenResponse 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 token
|
|
74
|
+
if self.token:
|
|
75
|
+
_dict["token"] = self.token.to_dict()
|
|
76
|
+
return _dict
|
|
77
|
+
|
|
78
|
+
@classmethod
|
|
79
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
80
|
+
"""Create an instance of CreateTokenResponse from a dict"""
|
|
81
|
+
if obj is None:
|
|
82
|
+
return None
|
|
83
|
+
|
|
84
|
+
if not isinstance(obj, dict):
|
|
85
|
+
return cls.model_validate(obj)
|
|
86
|
+
|
|
87
|
+
_obj = cls.model_validate(
|
|
88
|
+
{
|
|
89
|
+
"message": obj.get("message"),
|
|
90
|
+
"token": TokenCreated.from_dict(obj["token"]) if obj.get("token") is not None else None,
|
|
91
|
+
}
|
|
92
|
+
)
|
|
93
|
+
return _obj
|
|
@@ -0,0 +1,160 @@
|
|
|
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, StrictInt, StrictStr, field_validator
|
|
23
|
+
from typing_extensions import Annotated, Self
|
|
24
|
+
|
|
25
|
+
from stackit.modelserving.models.sku import SKU
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class EmbeddingModelDetails(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
EmbeddingModelDetails
|
|
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
|
+
output_dimension: StrictInt = Field(alias="outputDimension")
|
|
39
|
+
region: StrictStr
|
|
40
|
+
skus: List[SKU]
|
|
41
|
+
tags: Optional[List[StrictStr]] = None
|
|
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
|
+
"outputDimension",
|
|
50
|
+
"region",
|
|
51
|
+
"skus",
|
|
52
|
+
"tags",
|
|
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("name")
|
|
78
|
+
def name_validate_regular_expression(cls, value):
|
|
79
|
+
"""Validates the regular expression"""
|
|
80
|
+
if not re.match(r"^[0-9a-zA-Z\s.:\/\-]+$", value):
|
|
81
|
+
raise ValueError(r"must validate the regular expression /^[0-9a-zA-Z\s.:\/\-]+$/")
|
|
82
|
+
return value
|
|
83
|
+
|
|
84
|
+
@field_validator("url")
|
|
85
|
+
def url_validate_regular_expression(cls, value):
|
|
86
|
+
"""Validates the regular expression"""
|
|
87
|
+
if not re.match(r"^[0-9a-zA-Z\s.:\/\-]+$", value):
|
|
88
|
+
raise ValueError(r"must validate the regular expression /^[0-9a-zA-Z\s.:\/\-]+$/")
|
|
89
|
+
return value
|
|
90
|
+
|
|
91
|
+
model_config = ConfigDict(
|
|
92
|
+
populate_by_name=True,
|
|
93
|
+
validate_assignment=True,
|
|
94
|
+
protected_namespaces=(),
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
def to_str(self) -> str:
|
|
98
|
+
"""Returns the string representation of the model using alias"""
|
|
99
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
100
|
+
|
|
101
|
+
def to_json(self) -> str:
|
|
102
|
+
"""Returns the JSON representation of the model using alias"""
|
|
103
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
104
|
+
return json.dumps(self.to_dict())
|
|
105
|
+
|
|
106
|
+
@classmethod
|
|
107
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
108
|
+
"""Create an instance of EmbeddingModelDetails from a JSON string"""
|
|
109
|
+
return cls.from_dict(json.loads(json_str))
|
|
110
|
+
|
|
111
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
112
|
+
"""Return the dictionary representation of the model using alias.
|
|
113
|
+
|
|
114
|
+
This has the following differences from calling pydantic's
|
|
115
|
+
`self.model_dump(by_alias=True)`:
|
|
116
|
+
|
|
117
|
+
* `None` is only added to the output dict for nullable fields that
|
|
118
|
+
were set at model initialization. Other fields with value `None`
|
|
119
|
+
are ignored.
|
|
120
|
+
"""
|
|
121
|
+
excluded_fields: Set[str] = set([])
|
|
122
|
+
|
|
123
|
+
_dict = self.model_dump(
|
|
124
|
+
by_alias=True,
|
|
125
|
+
exclude=excluded_fields,
|
|
126
|
+
exclude_none=True,
|
|
127
|
+
)
|
|
128
|
+
# override the default output from pydantic by calling `to_dict()` of each item in skus (list)
|
|
129
|
+
_items = []
|
|
130
|
+
if self.skus:
|
|
131
|
+
for _item in self.skus:
|
|
132
|
+
if _item:
|
|
133
|
+
_items.append(_item.to_dict())
|
|
134
|
+
_dict["skus"] = _items
|
|
135
|
+
return _dict
|
|
136
|
+
|
|
137
|
+
@classmethod
|
|
138
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
139
|
+
"""Create an instance of EmbeddingModelDetails from a dict"""
|
|
140
|
+
if obj is None:
|
|
141
|
+
return None
|
|
142
|
+
|
|
143
|
+
if not isinstance(obj, dict):
|
|
144
|
+
return cls.model_validate(obj)
|
|
145
|
+
|
|
146
|
+
_obj = cls.model_validate(
|
|
147
|
+
{
|
|
148
|
+
"category": obj.get("category"),
|
|
149
|
+
"description": obj.get("description"),
|
|
150
|
+
"displayedName": obj.get("displayedName"),
|
|
151
|
+
"id": obj.get("id"),
|
|
152
|
+
"name": obj.get("name"),
|
|
153
|
+
"outputDimension": obj.get("outputDimension"),
|
|
154
|
+
"region": obj.get("region"),
|
|
155
|
+
"skus": [SKU.from_dict(_item) for _item in obj["skus"]] if obj.get("skus") is not None else None,
|
|
156
|
+
"tags": obj.get("tags"),
|
|
157
|
+
"url": obj.get("url"),
|
|
158
|
+
}
|
|
159
|
+
)
|
|
160
|
+
return _obj
|
|
@@ -0,0 +1,83 @@
|
|
|
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 ErrorMessageResponse(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
ErrorMessageResponse
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
error: Optional[StrictStr] = None
|
|
31
|
+
message: Optional[StrictStr] = None
|
|
32
|
+
__properties: ClassVar[List[str]] = ["error", "message"]
|
|
33
|
+
|
|
34
|
+
model_config = ConfigDict(
|
|
35
|
+
populate_by_name=True,
|
|
36
|
+
validate_assignment=True,
|
|
37
|
+
protected_namespaces=(),
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
def to_str(self) -> str:
|
|
41
|
+
"""Returns the string representation of the model using alias"""
|
|
42
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
43
|
+
|
|
44
|
+
def to_json(self) -> str:
|
|
45
|
+
"""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
|
+
|
|
49
|
+
@classmethod
|
|
50
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
51
|
+
"""Create an instance of ErrorMessageResponse from a JSON string"""
|
|
52
|
+
return cls.from_dict(json.loads(json_str))
|
|
53
|
+
|
|
54
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
55
|
+
"""Return the dictionary representation of the model using alias.
|
|
56
|
+
|
|
57
|
+
This has the following differences from calling pydantic's
|
|
58
|
+
`self.model_dump(by_alias=True)`:
|
|
59
|
+
|
|
60
|
+
* `None` is only added to the output dict for nullable fields that
|
|
61
|
+
were set at model initialization. Other fields with value `None`
|
|
62
|
+
are ignored.
|
|
63
|
+
"""
|
|
64
|
+
excluded_fields: Set[str] = set([])
|
|
65
|
+
|
|
66
|
+
_dict = self.model_dump(
|
|
67
|
+
by_alias=True,
|
|
68
|
+
exclude=excluded_fields,
|
|
69
|
+
exclude_none=True,
|
|
70
|
+
)
|
|
71
|
+
return _dict
|
|
72
|
+
|
|
73
|
+
@classmethod
|
|
74
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
75
|
+
"""Create an instance of ErrorMessageResponse from a dict"""
|
|
76
|
+
if obj is None:
|
|
77
|
+
return None
|
|
78
|
+
|
|
79
|
+
if not isinstance(obj, dict):
|
|
80
|
+
return cls.model_validate(obj)
|
|
81
|
+
|
|
82
|
+
_obj = cls.model_validate({"error": obj.get("error"), "message": obj.get("message")})
|
|
83
|
+
return _obj
|
|
@@ -0,0 +1,93 @@
|
|
|
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.chat_model_details import ChatModelDetails
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class GetChatModelResponse(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
GetChatModelResponse
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
message: Optional[StrictStr] = None
|
|
33
|
+
model: ChatModelDetails
|
|
34
|
+
__properties: ClassVar[List[str]] = ["message", "model"]
|
|
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 GetChatModelResponse 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 model
|
|
74
|
+
if self.model:
|
|
75
|
+
_dict["model"] = self.model.to_dict()
|
|
76
|
+
return _dict
|
|
77
|
+
|
|
78
|
+
@classmethod
|
|
79
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
80
|
+
"""Create an instance of GetChatModelResponse from a dict"""
|
|
81
|
+
if obj is None:
|
|
82
|
+
return None
|
|
83
|
+
|
|
84
|
+
if not isinstance(obj, dict):
|
|
85
|
+
return cls.model_validate(obj)
|
|
86
|
+
|
|
87
|
+
_obj = cls.model_validate(
|
|
88
|
+
{
|
|
89
|
+
"message": obj.get("message"),
|
|
90
|
+
"model": ChatModelDetails.from_dict(obj["model"]) if obj.get("model") is not None else None,
|
|
91
|
+
}
|
|
92
|
+
)
|
|
93
|
+
return _obj
|
|
@@ -0,0 +1,93 @@
|
|
|
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.embedding_model_details import EmbeddingModelDetails
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class GetEmbeddingsModelResp(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
GetEmbeddingsModelResp
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
message: Optional[StrictStr] = None
|
|
33
|
+
model: EmbeddingModelDetails
|
|
34
|
+
__properties: ClassVar[List[str]] = ["message", "model"]
|
|
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 GetEmbeddingsModelResp 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 model
|
|
74
|
+
if self.model:
|
|
75
|
+
_dict["model"] = self.model.to_dict()
|
|
76
|
+
return _dict
|
|
77
|
+
|
|
78
|
+
@classmethod
|
|
79
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
80
|
+
"""Create an instance of GetEmbeddingsModelResp from a dict"""
|
|
81
|
+
if obj is None:
|
|
82
|
+
return None
|
|
83
|
+
|
|
84
|
+
if not isinstance(obj, dict):
|
|
85
|
+
return cls.model_validate(obj)
|
|
86
|
+
|
|
87
|
+
_obj = cls.model_validate(
|
|
88
|
+
{
|
|
89
|
+
"message": obj.get("message"),
|
|
90
|
+
"model": EmbeddingModelDetails.from_dict(obj["model"]) if obj.get("model") is not None else None,
|
|
91
|
+
}
|
|
92
|
+
)
|
|
93
|
+
return _obj
|
|
@@ -0,0 +1,93 @@
|
|
|
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 GetTokenResponse(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
GetTokenResponse
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
message: Optional[StrictStr] = None
|
|
33
|
+
token: Token
|
|
34
|
+
__properties: ClassVar[List[str]] = ["message", "token"]
|
|
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 GetTokenResponse 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 token
|
|
74
|
+
if self.token:
|
|
75
|
+
_dict["token"] = self.token.to_dict()
|
|
76
|
+
return _dict
|
|
77
|
+
|
|
78
|
+
@classmethod
|
|
79
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
80
|
+
"""Create an instance of GetTokenResponse from a dict"""
|
|
81
|
+
if obj is None:
|
|
82
|
+
return None
|
|
83
|
+
|
|
84
|
+
if not isinstance(obj, dict):
|
|
85
|
+
return cls.model_validate(obj)
|
|
86
|
+
|
|
87
|
+
_obj = cls.model_validate(
|
|
88
|
+
{
|
|
89
|
+
"message": obj.get("message"),
|
|
90
|
+
"token": Token.from_dict(obj["token"]) if obj.get("token") is not None else None,
|
|
91
|
+
}
|
|
92
|
+
)
|
|
93
|
+
return _obj
|