platform-api-python-client 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. platform_api_python_client/__init__.py +78 -0
  2. platform_api_python_client/api/__init__.py +5 -0
  3. platform_api_python_client/api/external_api.py +7341 -0
  4. platform_api_python_client/api_client.py +797 -0
  5. platform_api_python_client/api_response.py +21 -0
  6. platform_api_python_client/configuration.py +458 -0
  7. platform_api_python_client/exceptions.py +199 -0
  8. platform_api_python_client/models/__init__.py +61 -0
  9. platform_api_python_client/models/add_hardware_request.py +87 -0
  10. platform_api_python_client/models/api_key_request.py +87 -0
  11. platform_api_python_client/models/api_key_response.py +92 -0
  12. platform_api_python_client/models/c_serve_recipe_input.py +166 -0
  13. platform_api_python_client/models/c_serve_recipe_output.py +166 -0
  14. platform_api_python_client/models/c_serve_recipe_perf.py +98 -0
  15. platform_api_python_client/models/c_serve_recipe_response.py +105 -0
  16. platform_api_python_client/models/client_secret_response.py +87 -0
  17. platform_api_python_client/models/create_c_serve_deployment_request.py +117 -0
  18. platform_api_python_client/models/create_c_serve_deployment_response.py +92 -0
  19. platform_api_python_client/models/create_compute_deployment_response.py +94 -0
  20. platform_api_python_client/models/create_compute_deployment_v2_request.py +107 -0
  21. platform_api_python_client/models/create_inference_deployment_response.py +92 -0
  22. platform_api_python_client/models/create_inference_deployment_v2_request.py +141 -0
  23. platform_api_python_client/models/create_payment_request.py +89 -0
  24. platform_api_python_client/models/credits_response.py +87 -0
  25. platform_api_python_client/models/daily_bill_response.py +90 -0
  26. platform_api_python_client/models/deployment_status.py +38 -0
  27. platform_api_python_client/models/deployment_status_request.py +88 -0
  28. platform_api_python_client/models/deployment_status_response_v2.py +115 -0
  29. platform_api_python_client/models/deployment_type.py +43 -0
  30. platform_api_python_client/models/deployment_usage_value.py +89 -0
  31. platform_api_python_client/models/feedback_request.py +91 -0
  32. platform_api_python_client/models/get_c_serve_deployment_response.py +210 -0
  33. platform_api_python_client/models/get_cluster_response.py +89 -0
  34. platform_api_python_client/models/get_compute_v2_deployment_response.py +134 -0
  35. platform_api_python_client/models/get_deployment_log_response.py +94 -0
  36. platform_api_python_client/models/get_deployment_usage_response.py +95 -0
  37. platform_api_python_client/models/get_deployment_v2_response.py +111 -0
  38. platform_api_python_client/models/get_inference_v2_deployment_response.py +145 -0
  39. platform_api_python_client/models/hardware_instance_response.py +99 -0
  40. platform_api_python_client/models/health_status.py +40 -0
  41. platform_api_python_client/models/http_validation_error.py +95 -0
  42. platform_api_python_client/models/list_api_key_response.py +95 -0
  43. platform_api_python_client/models/list_c_serve_recipe_response.py +95 -0
  44. platform_api_python_client/models/list_daily_bill_response.py +95 -0
  45. platform_api_python_client/models/list_get_cluster_response.py +95 -0
  46. platform_api_python_client/models/list_get_deployment_v2_response.py +95 -0
  47. platform_api_python_client/models/list_hardware_instance_response.py +95 -0
  48. platform_api_python_client/models/list_payment_method_response.py +87 -0
  49. platform_api_python_client/models/list_prebuilt_image_response.py +95 -0
  50. platform_api_python_client/models/metric.py +38 -0
  51. platform_api_python_client/models/prebuilt_image_response.py +94 -0
  52. platform_api_python_client/models/validation_error.py +99 -0
  53. platform_api_python_client/models/validation_error_loc_inner.py +138 -0
  54. platform_api_python_client/py.typed +0 -0
  55. platform_api_python_client/rest.py +257 -0
  56. platform_api_python_client-0.1.0.dist-info/METADATA +16 -0
  57. platform_api_python_client-0.1.0.dist-info/RECORD +59 -0
  58. platform_api_python_client-0.1.0.dist-info/WHEEL +5 -0
  59. platform_api_python_client-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,61 @@
1
+ # coding: utf-8
2
+
3
+ # flake8: noqa
4
+ """
5
+ Platform External API
6
+
7
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
8
+
9
+ The version of the OpenAPI document: 0.1.0
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ # import models into model package
17
+ from platform_api_python_client.models.api_key_request import APIKeyRequest
18
+ from platform_api_python_client.models.api_key_response import APIKeyResponse
19
+ from platform_api_python_client.models.add_hardware_request import AddHardwareRequest
20
+ from platform_api_python_client.models.c_serve_recipe_input import CServeRecipeInput
21
+ from platform_api_python_client.models.c_serve_recipe_output import CServeRecipeOutput
22
+ from platform_api_python_client.models.c_serve_recipe_perf import CServeRecipePerf
23
+ from platform_api_python_client.models.c_serve_recipe_response import CServeRecipeResponse
24
+ from platform_api_python_client.models.client_secret_response import ClientSecretResponse
25
+ from platform_api_python_client.models.create_c_serve_deployment_request import CreateCServeDeploymentRequest
26
+ from platform_api_python_client.models.create_c_serve_deployment_response import CreateCServeDeploymentResponse
27
+ from platform_api_python_client.models.create_compute_deployment_response import CreateComputeDeploymentResponse
28
+ from platform_api_python_client.models.create_compute_deployment_v2_request import CreateComputeDeploymentV2Request
29
+ from platform_api_python_client.models.create_inference_deployment_response import CreateInferenceDeploymentResponse
30
+ from platform_api_python_client.models.create_inference_deployment_v2_request import CreateInferenceDeploymentV2Request
31
+ from platform_api_python_client.models.create_payment_request import CreatePaymentRequest
32
+ from platform_api_python_client.models.credits_response import CreditsResponse
33
+ from platform_api_python_client.models.daily_bill_response import DailyBillResponse
34
+ from platform_api_python_client.models.deployment_status import DeploymentStatus
35
+ from platform_api_python_client.models.deployment_status_request import DeploymentStatusRequest
36
+ from platform_api_python_client.models.deployment_status_response_v2 import DeploymentStatusResponseV2
37
+ from platform_api_python_client.models.deployment_type import DeploymentType
38
+ from platform_api_python_client.models.deployment_usage_value import DeploymentUsageValue
39
+ from platform_api_python_client.models.feedback_request import FeedbackRequest
40
+ from platform_api_python_client.models.get_c_serve_deployment_response import GetCServeDeploymentResponse
41
+ from platform_api_python_client.models.get_cluster_response import GetClusterResponse
42
+ from platform_api_python_client.models.get_compute_v2_deployment_response import GetComputeV2DeploymentResponse
43
+ from platform_api_python_client.models.get_deployment_log_response import GetDeploymentLogResponse
44
+ from platform_api_python_client.models.get_deployment_usage_response import GetDeploymentUsageResponse
45
+ from platform_api_python_client.models.get_deployment_v2_response import GetDeploymentV2Response
46
+ from platform_api_python_client.models.get_inference_v2_deployment_response import GetInferenceV2DeploymentResponse
47
+ from platform_api_python_client.models.http_validation_error import HTTPValidationError
48
+ from platform_api_python_client.models.hardware_instance_response import HardwareInstanceResponse
49
+ from platform_api_python_client.models.health_status import HealthStatus
50
+ from platform_api_python_client.models.list_api_key_response import ListAPIKeyResponse
51
+ from platform_api_python_client.models.list_c_serve_recipe_response import ListCServeRecipeResponse
52
+ from platform_api_python_client.models.list_daily_bill_response import ListDailyBillResponse
53
+ from platform_api_python_client.models.list_get_cluster_response import ListGetClusterResponse
54
+ from platform_api_python_client.models.list_get_deployment_v2_response import ListGetDeploymentV2Response
55
+ from platform_api_python_client.models.list_hardware_instance_response import ListHardwareInstanceResponse
56
+ from platform_api_python_client.models.list_payment_method_response import ListPaymentMethodResponse
57
+ from platform_api_python_client.models.list_prebuilt_image_response import ListPrebuiltImageResponse
58
+ from platform_api_python_client.models.metric import Metric
59
+ from platform_api_python_client.models.prebuilt_image_response import PrebuiltImageResponse
60
+ from platform_api_python_client.models.validation_error import ValidationError
61
+ from platform_api_python_client.models.validation_error_loc_inner import ValidationErrorLocInner
@@ -0,0 +1,87 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Platform External API
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: 0.1.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, StrictStr
21
+ from typing import Any, ClassVar, Dict, List
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+
25
+ class AddHardwareRequest(BaseModel):
26
+ """
27
+ AddHardwareRequest
28
+ """ # noqa: E501
29
+ message: StrictStr
30
+ __properties: ClassVar[List[str]] = ["message"]
31
+
32
+ model_config = ConfigDict(
33
+ populate_by_name=True,
34
+ validate_assignment=True,
35
+ protected_namespaces=(),
36
+ )
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 AddHardwareRequest 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
+
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 AddHardwareRequest 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({
83
+ "message": obj.get("message")
84
+ })
85
+ return _obj
86
+
87
+
@@ -0,0 +1,87 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Platform External API
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: 0.1.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, StrictStr
21
+ from typing import Any, ClassVar, Dict, List
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+
25
+ class APIKeyRequest(BaseModel):
26
+ """
27
+ APIKeyRequest
28
+ """ # noqa: E501
29
+ name: StrictStr
30
+ __properties: ClassVar[List[str]] = ["name"]
31
+
32
+ model_config = ConfigDict(
33
+ populate_by_name=True,
34
+ validate_assignment=True,
35
+ protected_namespaces=(),
36
+ )
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 APIKeyRequest 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
+
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 APIKeyRequest 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({
83
+ "name": obj.get("name")
84
+ })
85
+ return _obj
86
+
87
+
@@ -0,0 +1,92 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Platform External API
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: 0.1.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from datetime import datetime
21
+ from pydantic import BaseModel, ConfigDict, StrictStr
22
+ from typing import Any, ClassVar, Dict, List
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class APIKeyResponse(BaseModel):
27
+ """
28
+ APIKeyResponse
29
+ """ # noqa: E501
30
+ name: StrictStr
31
+ id: StrictStr
32
+ created_at: datetime
33
+ __properties: ClassVar[List[str]] = ["name", "id", "created_at"]
34
+
35
+ model_config = ConfigDict(
36
+ populate_by_name=True,
37
+ validate_assignment=True,
38
+ protected_namespaces=(),
39
+ )
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 APIKeyResponse 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
+
69
+ _dict = self.model_dump(
70
+ by_alias=True,
71
+ exclude=excluded_fields,
72
+ exclude_none=True,
73
+ )
74
+ return _dict
75
+
76
+ @classmethod
77
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
78
+ """Create an instance of APIKeyResponse from a dict"""
79
+ if obj is None:
80
+ return None
81
+
82
+ if not isinstance(obj, dict):
83
+ return cls.model_validate(obj)
84
+
85
+ _obj = cls.model_validate({
86
+ "name": obj.get("name"),
87
+ "id": obj.get("id"),
88
+ "created_at": obj.get("created_at")
89
+ })
90
+ return _obj
91
+
92
+
@@ -0,0 +1,166 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Platform External API
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: 0.1.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr
21
+ from typing import Any, ClassVar, Dict, List, Optional, Union
22
+ from typing_extensions import Annotated
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class CServeRecipeInput(BaseModel):
27
+ """
28
+ Base class for deployment planner
29
+ """ # noqa: E501
30
+ model: StrictStr
31
+ is_embedding_model: Optional[StrictBool] = False
32
+ tensor_parallel_size: StrictInt
33
+ pipeline_parallel_size: StrictInt
34
+ block_size: Optional[StrictInt] = 32
35
+ swap_space: Optional[Annotated[int, Field(strict=True, ge=0)]] = 0
36
+ gpu_mem_util: Optional[Union[Annotated[float, Field(le=1.0, strict=True, ge=0.0)], Annotated[int, Field(le=1, strict=True, ge=0)]]] = 0.95
37
+ max_num_seqs: Optional[StrictInt] = 256
38
+ use_prefix_caching: Optional[StrictBool] = None
39
+ offloading_num: Optional[StrictInt] = 0
40
+ use_flashinfer: Optional[StrictBool] = False
41
+ max_model_len: Optional[Annotated[int, Field(strict=True, ge=128)]] = None
42
+ dtype: Optional[StrictStr] = 'auto'
43
+ tokenizer: Optional[StrictStr] = None
44
+ spec_proposer: Optional[StrictStr] = None
45
+ spec_draft_model: Optional[StrictStr] = None
46
+ spec_tokens: Optional[StrictInt] = None
47
+ spec_prompt_lookup_min: Optional[Annotated[int, Field(strict=True, ge=1)]] = None
48
+ spec_prompt_lookup_max: Optional[Annotated[int, Field(strict=True, ge=1)]] = None
49
+ seed: Optional[StrictInt] = 0
50
+ __properties: ClassVar[List[str]] = ["model", "is_embedding_model", "tensor_parallel_size", "pipeline_parallel_size", "block_size", "swap_space", "gpu_mem_util", "max_num_seqs", "use_prefix_caching", "offloading_num", "use_flashinfer", "max_model_len", "dtype", "tokenizer", "spec_proposer", "spec_draft_model", "spec_tokens", "spec_prompt_lookup_min", "spec_prompt_lookup_max", "seed"]
51
+
52
+ model_config = ConfigDict(
53
+ populate_by_name=True,
54
+ validate_assignment=True,
55
+ protected_namespaces=(),
56
+ )
57
+
58
+
59
+ def to_str(self) -> str:
60
+ """Returns the string representation of the model using alias"""
61
+ return pprint.pformat(self.model_dump(by_alias=True))
62
+
63
+ def to_json(self) -> str:
64
+ """Returns the JSON representation of the model using alias"""
65
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
66
+ return json.dumps(self.to_dict())
67
+
68
+ @classmethod
69
+ def from_json(cls, json_str: str) -> Optional[Self]:
70
+ """Create an instance of CServeRecipeInput from a JSON string"""
71
+ return cls.from_dict(json.loads(json_str))
72
+
73
+ def to_dict(self) -> Dict[str, Any]:
74
+ """Return the dictionary representation of the model using alias.
75
+
76
+ This has the following differences from calling pydantic's
77
+ `self.model_dump(by_alias=True)`:
78
+
79
+ * `None` is only added to the output dict for nullable fields that
80
+ were set at model initialization. Other fields with value `None`
81
+ are ignored.
82
+ """
83
+ excluded_fields: Set[str] = set([
84
+ ])
85
+
86
+ _dict = self.model_dump(
87
+ by_alias=True,
88
+ exclude=excluded_fields,
89
+ exclude_none=True,
90
+ )
91
+ # set to None if use_prefix_caching (nullable) is None
92
+ # and model_fields_set contains the field
93
+ if self.use_prefix_caching is None and "use_prefix_caching" in self.model_fields_set:
94
+ _dict['use_prefix_caching'] = None
95
+
96
+ # set to None if max_model_len (nullable) is None
97
+ # and model_fields_set contains the field
98
+ if self.max_model_len is None and "max_model_len" in self.model_fields_set:
99
+ _dict['max_model_len'] = None
100
+
101
+ # set to None if tokenizer (nullable) is None
102
+ # and model_fields_set contains the field
103
+ if self.tokenizer is None and "tokenizer" in self.model_fields_set:
104
+ _dict['tokenizer'] = None
105
+
106
+ # set to None if spec_proposer (nullable) is None
107
+ # and model_fields_set contains the field
108
+ if self.spec_proposer is None and "spec_proposer" in self.model_fields_set:
109
+ _dict['spec_proposer'] = None
110
+
111
+ # set to None if spec_draft_model (nullable) is None
112
+ # and model_fields_set contains the field
113
+ if self.spec_draft_model is None and "spec_draft_model" in self.model_fields_set:
114
+ _dict['spec_draft_model'] = None
115
+
116
+ # set to None if spec_tokens (nullable) is None
117
+ # and model_fields_set contains the field
118
+ if self.spec_tokens is None and "spec_tokens" in self.model_fields_set:
119
+ _dict['spec_tokens'] = None
120
+
121
+ # set to None if spec_prompt_lookup_min (nullable) is None
122
+ # and model_fields_set contains the field
123
+ if self.spec_prompt_lookup_min is None and "spec_prompt_lookup_min" in self.model_fields_set:
124
+ _dict['spec_prompt_lookup_min'] = None
125
+
126
+ # set to None if spec_prompt_lookup_max (nullable) is None
127
+ # and model_fields_set contains the field
128
+ if self.spec_prompt_lookup_max is None and "spec_prompt_lookup_max" in self.model_fields_set:
129
+ _dict['spec_prompt_lookup_max'] = None
130
+
131
+ return _dict
132
+
133
+ @classmethod
134
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
135
+ """Create an instance of CServeRecipeInput from a dict"""
136
+ if obj is None:
137
+ return None
138
+
139
+ if not isinstance(obj, dict):
140
+ return cls.model_validate(obj)
141
+
142
+ _obj = cls.model_validate({
143
+ "model": obj.get("model"),
144
+ "is_embedding_model": obj.get("is_embedding_model") if obj.get("is_embedding_model") is not None else False,
145
+ "tensor_parallel_size": obj.get("tensor_parallel_size"),
146
+ "pipeline_parallel_size": obj.get("pipeline_parallel_size"),
147
+ "block_size": obj.get("block_size") if obj.get("block_size") is not None else 32,
148
+ "swap_space": obj.get("swap_space") if obj.get("swap_space") is not None else 0,
149
+ "gpu_mem_util": obj.get("gpu_mem_util") if obj.get("gpu_mem_util") is not None else 0.95,
150
+ "max_num_seqs": obj.get("max_num_seqs") if obj.get("max_num_seqs") is not None else 256,
151
+ "use_prefix_caching": obj.get("use_prefix_caching"),
152
+ "offloading_num": obj.get("offloading_num") if obj.get("offloading_num") is not None else 0,
153
+ "use_flashinfer": obj.get("use_flashinfer") if obj.get("use_flashinfer") is not None else False,
154
+ "max_model_len": obj.get("max_model_len"),
155
+ "dtype": obj.get("dtype") if obj.get("dtype") is not None else 'auto',
156
+ "tokenizer": obj.get("tokenizer"),
157
+ "spec_proposer": obj.get("spec_proposer"),
158
+ "spec_draft_model": obj.get("spec_draft_model"),
159
+ "spec_tokens": obj.get("spec_tokens"),
160
+ "spec_prompt_lookup_min": obj.get("spec_prompt_lookup_min"),
161
+ "spec_prompt_lookup_max": obj.get("spec_prompt_lookup_max"),
162
+ "seed": obj.get("seed") if obj.get("seed") is not None else 0
163
+ })
164
+ return _obj
165
+
166
+
@@ -0,0 +1,166 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Platform External API
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: 0.1.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr
21
+ from typing import Any, ClassVar, Dict, List, Optional, Union
22
+ from typing_extensions import Annotated
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class CServeRecipeOutput(BaseModel):
27
+ """
28
+ Base class for deployment planner
29
+ """ # noqa: E501
30
+ model: StrictStr
31
+ is_embedding_model: StrictBool
32
+ tensor_parallel_size: StrictInt
33
+ pipeline_parallel_size: StrictInt
34
+ block_size: StrictInt
35
+ swap_space: Annotated[int, Field(strict=True, ge=0)]
36
+ gpu_mem_util: Union[Annotated[float, Field(le=1.0, strict=True, ge=0.0)], Annotated[int, Field(le=1, strict=True, ge=0)]]
37
+ max_num_seqs: StrictInt
38
+ use_prefix_caching: Optional[StrictBool]
39
+ offloading_num: StrictInt
40
+ use_flashinfer: StrictBool
41
+ max_model_len: Optional[Annotated[int, Field(strict=True, ge=128)]]
42
+ dtype: StrictStr
43
+ tokenizer: Optional[StrictStr]
44
+ spec_proposer: Optional[StrictStr]
45
+ spec_draft_model: Optional[StrictStr]
46
+ spec_tokens: Optional[StrictInt]
47
+ spec_prompt_lookup_min: Optional[Annotated[int, Field(strict=True, ge=1)]]
48
+ spec_prompt_lookup_max: Optional[Annotated[int, Field(strict=True, ge=1)]]
49
+ seed: StrictInt
50
+ __properties: ClassVar[List[str]] = ["model", "is_embedding_model", "tensor_parallel_size", "pipeline_parallel_size", "block_size", "swap_space", "gpu_mem_util", "max_num_seqs", "use_prefix_caching", "offloading_num", "use_flashinfer", "max_model_len", "dtype", "tokenizer", "spec_proposer", "spec_draft_model", "spec_tokens", "spec_prompt_lookup_min", "spec_prompt_lookup_max", "seed"]
51
+
52
+ model_config = ConfigDict(
53
+ populate_by_name=True,
54
+ validate_assignment=True,
55
+ protected_namespaces=(),
56
+ )
57
+
58
+
59
+ def to_str(self) -> str:
60
+ """Returns the string representation of the model using alias"""
61
+ return pprint.pformat(self.model_dump(by_alias=True))
62
+
63
+ def to_json(self) -> str:
64
+ """Returns the JSON representation of the model using alias"""
65
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
66
+ return json.dumps(self.to_dict())
67
+
68
+ @classmethod
69
+ def from_json(cls, json_str: str) -> Optional[Self]:
70
+ """Create an instance of CServeRecipeOutput from a JSON string"""
71
+ return cls.from_dict(json.loads(json_str))
72
+
73
+ def to_dict(self) -> Dict[str, Any]:
74
+ """Return the dictionary representation of the model using alias.
75
+
76
+ This has the following differences from calling pydantic's
77
+ `self.model_dump(by_alias=True)`:
78
+
79
+ * `None` is only added to the output dict for nullable fields that
80
+ were set at model initialization. Other fields with value `None`
81
+ are ignored.
82
+ """
83
+ excluded_fields: Set[str] = set([
84
+ ])
85
+
86
+ _dict = self.model_dump(
87
+ by_alias=True,
88
+ exclude=excluded_fields,
89
+ exclude_none=True,
90
+ )
91
+ # set to None if use_prefix_caching (nullable) is None
92
+ # and model_fields_set contains the field
93
+ if self.use_prefix_caching is None and "use_prefix_caching" in self.model_fields_set:
94
+ _dict['use_prefix_caching'] = None
95
+
96
+ # set to None if max_model_len (nullable) is None
97
+ # and model_fields_set contains the field
98
+ if self.max_model_len is None and "max_model_len" in self.model_fields_set:
99
+ _dict['max_model_len'] = None
100
+
101
+ # set to None if tokenizer (nullable) is None
102
+ # and model_fields_set contains the field
103
+ if self.tokenizer is None and "tokenizer" in self.model_fields_set:
104
+ _dict['tokenizer'] = None
105
+
106
+ # set to None if spec_proposer (nullable) is None
107
+ # and model_fields_set contains the field
108
+ if self.spec_proposer is None and "spec_proposer" in self.model_fields_set:
109
+ _dict['spec_proposer'] = None
110
+
111
+ # set to None if spec_draft_model (nullable) is None
112
+ # and model_fields_set contains the field
113
+ if self.spec_draft_model is None and "spec_draft_model" in self.model_fields_set:
114
+ _dict['spec_draft_model'] = None
115
+
116
+ # set to None if spec_tokens (nullable) is None
117
+ # and model_fields_set contains the field
118
+ if self.spec_tokens is None and "spec_tokens" in self.model_fields_set:
119
+ _dict['spec_tokens'] = None
120
+
121
+ # set to None if spec_prompt_lookup_min (nullable) is None
122
+ # and model_fields_set contains the field
123
+ if self.spec_prompt_lookup_min is None and "spec_prompt_lookup_min" in self.model_fields_set:
124
+ _dict['spec_prompt_lookup_min'] = None
125
+
126
+ # set to None if spec_prompt_lookup_max (nullable) is None
127
+ # and model_fields_set contains the field
128
+ if self.spec_prompt_lookup_max is None and "spec_prompt_lookup_max" in self.model_fields_set:
129
+ _dict['spec_prompt_lookup_max'] = None
130
+
131
+ return _dict
132
+
133
+ @classmethod
134
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
135
+ """Create an instance of CServeRecipeOutput from a dict"""
136
+ if obj is None:
137
+ return None
138
+
139
+ if not isinstance(obj, dict):
140
+ return cls.model_validate(obj)
141
+
142
+ _obj = cls.model_validate({
143
+ "model": obj.get("model"),
144
+ "is_embedding_model": obj.get("is_embedding_model") if obj.get("is_embedding_model") is not None else False,
145
+ "tensor_parallel_size": obj.get("tensor_parallel_size"),
146
+ "pipeline_parallel_size": obj.get("pipeline_parallel_size"),
147
+ "block_size": obj.get("block_size") if obj.get("block_size") is not None else 32,
148
+ "swap_space": obj.get("swap_space") if obj.get("swap_space") is not None else 0,
149
+ "gpu_mem_util": obj.get("gpu_mem_util") if obj.get("gpu_mem_util") is not None else 0.95,
150
+ "max_num_seqs": obj.get("max_num_seqs") if obj.get("max_num_seqs") is not None else 256,
151
+ "use_prefix_caching": obj.get("use_prefix_caching"),
152
+ "offloading_num": obj.get("offloading_num") if obj.get("offloading_num") is not None else 0,
153
+ "use_flashinfer": obj.get("use_flashinfer") if obj.get("use_flashinfer") is not None else False,
154
+ "max_model_len": obj.get("max_model_len"),
155
+ "dtype": obj.get("dtype") if obj.get("dtype") is not None else 'auto',
156
+ "tokenizer": obj.get("tokenizer"),
157
+ "spec_proposer": obj.get("spec_proposer"),
158
+ "spec_draft_model": obj.get("spec_draft_model"),
159
+ "spec_tokens": obj.get("spec_tokens"),
160
+ "spec_prompt_lookup_min": obj.get("spec_prompt_lookup_min"),
161
+ "spec_prompt_lookup_max": obj.get("spec_prompt_lookup_max"),
162
+ "seed": obj.get("seed") if obj.get("seed") is not None else 0
163
+ })
164
+ return _obj
165
+
166
+