From 1d1d45d22972ce616c7f0a0d628ecfefff461a50 Mon Sep 17 00:00:00 2001 From: platform CI Date: Mon, 2 Jun 2025 15:09:45 +0000 Subject: [PATCH] Update clients to latest platform release (4.0.12) --- README.md | 3 +- docs/CreateCServeV2DeploymentRequest.md | 1 + docs/CreateRagDeploymentRequest.md | 1 + docs/DeploymentUsage.md | 30 ++++++ docs/GetCServeV2DeploymentResponse.md | 1 + docs/GetDeploymentUsageResponse.md | 2 +- docs/GetRagDeploymentResponse.md | 1 + docs/Metric.md | 8 ++ platform_api_python_client/__init__.py | 3 +- platform_api_python_client/api_client.py | 2 +- platform_api_python_client/configuration.py | 2 +- platform_api_python_client/models/__init__.py | 1 + .../create_c_serve_v2_deployment_request.py | 9 +- .../models/create_rag_deployment_request.py | 9 +- .../models/deployment_usage.py | 97 +++++++++++++++++++ .../get_c_serve_v2_deployment_response.py | 9 +- .../models/get_deployment_usage_response.py | 6 +- .../models/get_rag_deployment_response.py | 9 +- platform_api_python_client/models/metric.py | 4 + pyproject.toml | 2 +- setup.py | 2 +- ...st_create_c_serve_v2_deployment_request.py | 1 + test/test_create_rag_deployment_request.py | 1 + test/test_deployment_usage.py | 66 +++++++++++++ ...test_get_c_serve_v2_deployment_response.py | 1 + test/test_get_deployment_usage_response.py | 24 +++-- test/test_get_rag_deployment_response.py | 1 + 27 files changed, 276 insertions(+), 20 deletions(-) create mode 100644 docs/DeploymentUsage.md create mode 100644 platform_api_python_client/models/deployment_usage.py create mode 100644 test/test_deployment_usage.py diff --git a/README.md b/README.md index 2f47960..f19071a 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ No description provided (generated by Openapi Generator https://github.com/opena This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: - API version: 0.1.0 -- Package version: 4.0.10 +- Package version: 4.0.12 - Generator version: 7.9.0 - Build package: org.openapitools.codegen.languages.PythonClientCodegen @@ -163,6 +163,7 @@ Class | Method | HTTP request | Description - [DeploymentStatusRequest](docs/DeploymentStatusRequest.md) - [DeploymentStatusResponse](docs/DeploymentStatusResponse.md) - [DeploymentType](docs/DeploymentType.md) + - [DeploymentUsage](docs/DeploymentUsage.md) - [DeploymentUsageValue](docs/DeploymentUsageValue.md) - [GetAutochargePreferencesResponse](docs/GetAutochargePreferencesResponse.md) - [GetCServeV2DeploymentResponse](docs/GetCServeV2DeploymentResponse.md) diff --git a/docs/CreateCServeV2DeploymentRequest.md b/docs/CreateCServeV2DeploymentRequest.md index 7a4fb17..9ef3b56 100644 --- a/docs/CreateCServeV2DeploymentRequest.md +++ b/docs/CreateCServeV2DeploymentRequest.md @@ -9,6 +9,7 @@ Name | Type | Description | Notes **cluster_id** | **int** | | **hardware_instance_id** | **int** | | **recipe** | [**CServeV2Recipe**](CServeV2Recipe.md) | | +**cserve_version** | **str** | | [optional] **hf_token** | **str** | | [optional] **endpoint_bearer_token** | **str** | | [optional] **endpoint_certificate_authority** | **str** | | [optional] diff --git a/docs/CreateRagDeploymentRequest.md b/docs/CreateRagDeploymentRequest.md index 07360ba..e249d50 100644 --- a/docs/CreateRagDeploymentRequest.md +++ b/docs/CreateRagDeploymentRequest.md @@ -9,6 +9,7 @@ Name | Type | Description | Notes **cluster_id** | **int** | | **hardware_instance_id** | **int** | | **recipe** | [**CServeV2Recipe**](CServeV2Recipe.md) | | +**cserve_version** | **str** | | [optional] **hf_token** | **str** | | [optional] **llm_model** | **str** | | **centml_api_key** | **str** | | diff --git a/docs/DeploymentUsage.md b/docs/DeploymentUsage.md new file mode 100644 index 0000000..c89cf72 --- /dev/null +++ b/docs/DeploymentUsage.md @@ -0,0 +1,30 @@ +# DeploymentUsage + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**metric** | **Dict[str, str]** | | +**values** | [**List[DeploymentUsageValue]**](DeploymentUsageValue.md) | | + +## Example + +```python +from platform_api_python_client.models.deployment_usage import DeploymentUsage + +# TODO update the JSON string below +json = "{}" +# create an instance of DeploymentUsage from a JSON string +deployment_usage_instance = DeploymentUsage.from_json(json) +# print the JSON string representation of the object +print(DeploymentUsage.to_json()) + +# convert the object into a dict +deployment_usage_dict = deployment_usage_instance.to_dict() +# create an instance of DeploymentUsage from a dict +deployment_usage_from_dict = DeploymentUsage.from_dict(deployment_usage_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/GetCServeV2DeploymentResponse.md b/docs/GetCServeV2DeploymentResponse.md index 9556dc3..364ef32 100644 --- a/docs/GetCServeV2DeploymentResponse.md +++ b/docs/GetCServeV2DeploymentResponse.md @@ -15,6 +15,7 @@ Name | Type | Description | Notes **created_at** | **datetime** | | **hardware_instance_id** | **int** | | **recipe** | [**CServeV2Recipe**](CServeV2Recipe.md) | | +**cserve_version** | **str** | | [optional] **min_scale** | **int** | | **max_scale** | **int** | | **initial_scale** | **int** | | [optional] diff --git a/docs/GetDeploymentUsageResponse.md b/docs/GetDeploymentUsageResponse.md index 99330d3..5818f45 100644 --- a/docs/GetDeploymentUsageResponse.md +++ b/docs/GetDeploymentUsageResponse.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**values** | [**List[DeploymentUsageValue]**](DeploymentUsageValue.md) | | +**values** | [**List[DeploymentUsage]**](DeploymentUsage.md) | | ## Example diff --git a/docs/GetRagDeploymentResponse.md b/docs/GetRagDeploymentResponse.md index 994a884..14c989d 100644 --- a/docs/GetRagDeploymentResponse.md +++ b/docs/GetRagDeploymentResponse.md @@ -15,6 +15,7 @@ Name | Type | Description | Notes **created_at** | **datetime** | | **hardware_instance_id** | **int** | | **recipe** | [**CServeV2Recipe**](CServeV2Recipe.md) | | +**cserve_version** | **str** | | [optional] **llm_model** | **str** | | **centml_api_key** | **str** | | **min_scale** | **int** | | [optional] [default to 1] diff --git a/docs/Metric.md b/docs/Metric.md index 903c347..cd9acd1 100644 --- a/docs/Metric.md +++ b/docs/Metric.md @@ -11,12 +11,20 @@ * `HTTP_REQUESTS` (value: `'http_requests'`) +* `HTTP_REQUESTS_BY_STATUS` (value: `'http_requests_by_status'`) + +* `ERROR_CODE` (value: `'error_code'`) + * `REQUEST_LATENCY_50_PERCENTILE` (value: `'request_latency_50_percentile'`) * `REQUEST_LATENCY_90_PERCENTILE` (value: `'request_latency_90_percentile'`) * `REQUEST_LATENCY_99_PERCENTILE` (value: `'request_latency_99_percentile'`) +* `TOKENS_PER_SECOND` (value: `'tokens_per_second'`) + +* `TIME_TO_FIRST_TOKEN` (value: `'time_to_first_token'`) + [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/platform_api_python_client/__init__.py b/platform_api_python_client/__init__.py index 4cd7be7..ce022f1 100644 --- a/platform_api_python_client/__init__.py +++ b/platform_api_python_client/__init__.py @@ -14,7 +14,7 @@ """ # noqa: E501 -__version__ = "4.0.10" +__version__ = "4.0.12" # import apis into sdk package from platform_api_python_client.api.external_api import EXTERNALApi @@ -55,6 +55,7 @@ from platform_api_python_client.models.deployment_status_request import DeploymentStatusRequest from platform_api_python_client.models.deployment_status_response import DeploymentStatusResponse from platform_api_python_client.models.deployment_type import DeploymentType +from platform_api_python_client.models.deployment_usage import DeploymentUsage from platform_api_python_client.models.deployment_usage_value import DeploymentUsageValue from platform_api_python_client.models.get_autocharge_preferences_response import GetAutochargePreferencesResponse from platform_api_python_client.models.get_c_serve_v2_deployment_response import GetCServeV2DeploymentResponse diff --git a/platform_api_python_client/api_client.py b/platform_api_python_client/api_client.py index a818d4f..e9f480d 100644 --- a/platform_api_python_client/api_client.py +++ b/platform_api_python_client/api_client.py @@ -90,7 +90,7 @@ def __init__( self.default_headers[header_name] = header_value self.cookie = cookie # Set default User-Agent. - self.user_agent = 'OpenAPI-Generator/4.0.10/python' + self.user_agent = 'OpenAPI-Generator/4.0.12/python' self.client_side_validation = configuration.client_side_validation def __enter__(self): diff --git a/platform_api_python_client/configuration.py b/platform_api_python_client/configuration.py index fcd6799..93a045f 100644 --- a/platform_api_python_client/configuration.py +++ b/platform_api_python_client/configuration.py @@ -392,7 +392,7 @@ def to_debug_report(self): "OS: {env}\n"\ "Python Version: {pyversion}\n"\ "Version of the API: 0.1.0\n"\ - "SDK Package Version: 4.0.10".\ + "SDK Package Version: 4.0.12".\ format(env=sys.platform, pyversion=sys.version) def get_host_settings(self): diff --git a/platform_api_python_client/models/__init__.py b/platform_api_python_client/models/__init__.py index 61a75bc..d0ea2b7 100644 --- a/platform_api_python_client/models/__init__.py +++ b/platform_api_python_client/models/__init__.py @@ -38,6 +38,7 @@ from platform_api_python_client.models.deployment_status_request import DeploymentStatusRequest from platform_api_python_client.models.deployment_status_response import DeploymentStatusResponse from platform_api_python_client.models.deployment_type import DeploymentType +from platform_api_python_client.models.deployment_usage import DeploymentUsage from platform_api_python_client.models.deployment_usage_value import DeploymentUsageValue from platform_api_python_client.models.get_autocharge_preferences_response import GetAutochargePreferencesResponse from platform_api_python_client.models.get_c_serve_v2_deployment_response import GetCServeV2DeploymentResponse diff --git a/platform_api_python_client/models/create_c_serve_v2_deployment_request.py b/platform_api_python_client/models/create_c_serve_v2_deployment_request.py index b4aca9c..767ec12 100644 --- a/platform_api_python_client/models/create_c_serve_v2_deployment_request.py +++ b/platform_api_python_client/models/create_c_serve_v2_deployment_request.py @@ -32,6 +32,7 @@ class CreateCServeV2DeploymentRequest(BaseModel): cluster_id: StrictInt hardware_instance_id: StrictInt recipe: CServeV2Recipe + cserve_version: Optional[StrictStr] = None hf_token: Optional[StrictStr] = None endpoint_bearer_token: Optional[StrictStr] = None endpoint_certificate_authority: Optional[StrictStr] = None @@ -40,7 +41,7 @@ class CreateCServeV2DeploymentRequest(BaseModel): initial_scale: Optional[StrictInt] = None concurrency: Optional[StrictInt] = None env_vars: Optional[Dict[str, StrictStr]] = None - __properties: ClassVar[List[str]] = ["name", "cluster_id", "hardware_instance_id", "recipe", "hf_token", "endpoint_bearer_token", "endpoint_certificate_authority", "min_scale", "max_scale", "initial_scale", "concurrency", "env_vars"] + __properties: ClassVar[List[str]] = ["name", "cluster_id", "hardware_instance_id", "recipe", "cserve_version", "hf_token", "endpoint_bearer_token", "endpoint_certificate_authority", "min_scale", "max_scale", "initial_scale", "concurrency", "env_vars"] @field_validator('name') def name_validate_regular_expression(cls, value): @@ -91,6 +92,11 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of recipe if self.recipe: _dict['recipe'] = self.recipe.to_dict() + # set to None if cserve_version (nullable) is None + # and model_fields_set contains the field + if self.cserve_version is None and "cserve_version" in self.model_fields_set: + _dict['cserve_version'] = None + # set to None if hf_token (nullable) is None # and model_fields_set contains the field if self.hf_token is None and "hf_token" in self.model_fields_set: @@ -132,6 +138,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "cluster_id": obj.get("cluster_id"), "hardware_instance_id": obj.get("hardware_instance_id"), "recipe": CServeV2Recipe.from_dict(obj["recipe"]) if obj.get("recipe") is not None else None, + "cserve_version": obj.get("cserve_version"), "hf_token": obj.get("hf_token"), "endpoint_bearer_token": obj.get("endpoint_bearer_token"), "endpoint_certificate_authority": obj.get("endpoint_certificate_authority"), diff --git a/platform_api_python_client/models/create_rag_deployment_request.py b/platform_api_python_client/models/create_rag_deployment_request.py index 3d424c1..86f4519 100644 --- a/platform_api_python_client/models/create_rag_deployment_request.py +++ b/platform_api_python_client/models/create_rag_deployment_request.py @@ -32,6 +32,7 @@ class CreateRagDeploymentRequest(BaseModel): cluster_id: StrictInt hardware_instance_id: StrictInt recipe: CServeV2Recipe + cserve_version: Optional[StrictStr] = None hf_token: Optional[StrictStr] = None llm_model: StrictStr centml_api_key: StrictStr @@ -42,7 +43,7 @@ class CreateRagDeploymentRequest(BaseModel): endpoint_certificate_authority: Optional[StrictStr] = None concurrency: Optional[StrictInt] = None env_vars: Optional[Dict[str, StrictStr]] = None - __properties: ClassVar[List[str]] = ["name", "cluster_id", "hardware_instance_id", "recipe", "hf_token", "llm_model", "centml_api_key", "min_scale", "max_scale", "initial_scale", "endpoint_bearer_token", "endpoint_certificate_authority", "concurrency", "env_vars"] + __properties: ClassVar[List[str]] = ["name", "cluster_id", "hardware_instance_id", "recipe", "cserve_version", "hf_token", "llm_model", "centml_api_key", "min_scale", "max_scale", "initial_scale", "endpoint_bearer_token", "endpoint_certificate_authority", "concurrency", "env_vars"] @field_validator('name') def name_validate_regular_expression(cls, value): @@ -93,6 +94,11 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of recipe if self.recipe: _dict['recipe'] = self.recipe.to_dict() + # set to None if cserve_version (nullable) is None + # and model_fields_set contains the field + if self.cserve_version is None and "cserve_version" in self.model_fields_set: + _dict['cserve_version'] = None + # set to None if hf_token (nullable) is None # and model_fields_set contains the field if self.hf_token is None and "hf_token" in self.model_fields_set: @@ -134,6 +140,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "cluster_id": obj.get("cluster_id"), "hardware_instance_id": obj.get("hardware_instance_id"), "recipe": CServeV2Recipe.from_dict(obj["recipe"]) if obj.get("recipe") is not None else None, + "cserve_version": obj.get("cserve_version"), "hf_token": obj.get("hf_token"), "llm_model": obj.get("llm_model"), "centml_api_key": obj.get("centml_api_key"), diff --git a/platform_api_python_client/models/deployment_usage.py b/platform_api_python_client/models/deployment_usage.py new file mode 100644 index 0000000..fe0eb37 --- /dev/null +++ b/platform_api_python_client/models/deployment_usage.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Platform External API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List +from platform_api_python_client.models.deployment_usage_value import DeploymentUsageValue +from typing import Optional, Set +from typing_extensions import Self + +class DeploymentUsage(BaseModel): + """ + DeploymentUsage + """ # noqa: E501 + metric: Dict[str, StrictStr] + values: List[DeploymentUsageValue] + __properties: ClassVar[List[str]] = ["metric", "values"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DeploymentUsage from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in values (list) + _items = [] + if self.values: + for _item_values in self.values: + if _item_values: + _items.append(_item_values.to_dict()) + _dict['values'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DeploymentUsage from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "metric": obj.get("metric"), + "values": [DeploymentUsageValue.from_dict(_item) for _item in obj["values"]] if obj.get("values") is not None else None + }) + return _obj + + diff --git a/platform_api_python_client/models/get_c_serve_v2_deployment_response.py b/platform_api_python_client/models/get_c_serve_v2_deployment_response.py index 9296af2..0b591fa 100644 --- a/platform_api_python_client/models/get_c_serve_v2_deployment_response.py +++ b/platform_api_python_client/models/get_c_serve_v2_deployment_response.py @@ -40,6 +40,7 @@ class GetCServeV2DeploymentResponse(BaseModel): created_at: datetime hardware_instance_id: StrictInt recipe: CServeV2Recipe + cserve_version: Optional[StrictStr] = None min_scale: StrictInt max_scale: StrictInt initial_scale: Optional[StrictInt] = None @@ -47,7 +48,7 @@ class GetCServeV2DeploymentResponse(BaseModel): endpoint_bearer_token: Optional[StrictStr] = None concurrency: Optional[StrictInt] = None env_vars: Optional[Dict[str, StrictStr]] = None - __properties: ClassVar[List[str]] = ["cluster_id", "id", "name", "endpoint_url", "image_url", "type", "status", "created_at", "hardware_instance_id", "recipe", "min_scale", "max_scale", "initial_scale", "endpoint_certificate_authority", "endpoint_bearer_token", "concurrency", "env_vars"] + __properties: ClassVar[List[str]] = ["cluster_id", "id", "name", "endpoint_url", "image_url", "type", "status", "created_at", "hardware_instance_id", "recipe", "cserve_version", "min_scale", "max_scale", "initial_scale", "endpoint_certificate_authority", "endpoint_bearer_token", "concurrency", "env_vars"] model_config = ConfigDict( populate_by_name=True, @@ -96,6 +97,11 @@ def to_dict(self) -> Dict[str, Any]: if self.image_url is None and "image_url" in self.model_fields_set: _dict['image_url'] = None + # set to None if cserve_version (nullable) is None + # and model_fields_set contains the field + if self.cserve_version is None and "cserve_version" in self.model_fields_set: + _dict['cserve_version'] = None + # set to None if initial_scale (nullable) is None # and model_fields_set contains the field if self.initial_scale is None and "initial_scale" in self.model_fields_set: @@ -138,6 +144,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "created_at": obj.get("created_at"), "hardware_instance_id": obj.get("hardware_instance_id"), "recipe": CServeV2Recipe.from_dict(obj["recipe"]) if obj.get("recipe") is not None else None, + "cserve_version": obj.get("cserve_version"), "min_scale": obj.get("min_scale"), "max_scale": obj.get("max_scale"), "initial_scale": obj.get("initial_scale"), diff --git a/platform_api_python_client/models/get_deployment_usage_response.py b/platform_api_python_client/models/get_deployment_usage_response.py index 867c6d2..a10e9f3 100644 --- a/platform_api_python_client/models/get_deployment_usage_response.py +++ b/platform_api_python_client/models/get_deployment_usage_response.py @@ -19,7 +19,7 @@ from pydantic import BaseModel, ConfigDict from typing import Any, ClassVar, Dict, List -from platform_api_python_client.models.deployment_usage_value import DeploymentUsageValue +from platform_api_python_client.models.deployment_usage import DeploymentUsage from typing import Optional, Set from typing_extensions import Self @@ -27,7 +27,7 @@ class GetDeploymentUsageResponse(BaseModel): """ GetDeploymentUsageResponse """ # noqa: E501 - values: List[DeploymentUsageValue] + values: List[DeploymentUsage] __properties: ClassVar[List[str]] = ["values"] model_config = ConfigDict( @@ -88,7 +88,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "values": [DeploymentUsageValue.from_dict(_item) for _item in obj["values"]] if obj.get("values") is not None else None + "values": [DeploymentUsage.from_dict(_item) for _item in obj["values"]] if obj.get("values") is not None else None }) return _obj diff --git a/platform_api_python_client/models/get_rag_deployment_response.py b/platform_api_python_client/models/get_rag_deployment_response.py index 53b85f1..c80b11c 100644 --- a/platform_api_python_client/models/get_rag_deployment_response.py +++ b/platform_api_python_client/models/get_rag_deployment_response.py @@ -40,6 +40,7 @@ class GetRagDeploymentResponse(BaseModel): created_at: datetime hardware_instance_id: StrictInt recipe: CServeV2Recipe + cserve_version: Optional[StrictStr] = None llm_model: StrictStr centml_api_key: StrictStr min_scale: Optional[StrictInt] = 1 @@ -49,7 +50,7 @@ class GetRagDeploymentResponse(BaseModel): endpoint_bearer_token: Optional[StrictStr] = None concurrency: Optional[StrictInt] = None env_vars: Optional[Dict[str, StrictStr]] = None - __properties: ClassVar[List[str]] = ["cluster_id", "id", "name", "endpoint_url", "image_url", "type", "status", "created_at", "hardware_instance_id", "recipe", "llm_model", "centml_api_key", "min_scale", "max_scale", "initial_scale", "endpoint_certificate_authority", "endpoint_bearer_token", "concurrency", "env_vars"] + __properties: ClassVar[List[str]] = ["cluster_id", "id", "name", "endpoint_url", "image_url", "type", "status", "created_at", "hardware_instance_id", "recipe", "cserve_version", "llm_model", "centml_api_key", "min_scale", "max_scale", "initial_scale", "endpoint_certificate_authority", "endpoint_bearer_token", "concurrency", "env_vars"] model_config = ConfigDict( populate_by_name=True, @@ -98,6 +99,11 @@ def to_dict(self) -> Dict[str, Any]: if self.image_url is None and "image_url" in self.model_fields_set: _dict['image_url'] = None + # set to None if cserve_version (nullable) is None + # and model_fields_set contains the field + if self.cserve_version is None and "cserve_version" in self.model_fields_set: + _dict['cserve_version'] = None + # set to None if initial_scale (nullable) is None # and model_fields_set contains the field if self.initial_scale is None and "initial_scale" in self.model_fields_set: @@ -140,6 +146,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "created_at": obj.get("created_at"), "hardware_instance_id": obj.get("hardware_instance_id"), "recipe": CServeV2Recipe.from_dict(obj["recipe"]) if obj.get("recipe") is not None else None, + "cserve_version": obj.get("cserve_version"), "llm_model": obj.get("llm_model"), "centml_api_key": obj.get("centml_api_key"), "min_scale": obj.get("min_scale") if obj.get("min_scale") is not None else 1, diff --git a/platform_api_python_client/models/metric.py b/platform_api_python_client/models/metric.py index bd4b8d6..e8d145b 100644 --- a/platform_api_python_client/models/metric.py +++ b/platform_api_python_client/models/metric.py @@ -30,9 +30,13 @@ class Metric(str, Enum): MEMORY = 'memory' GPU = 'gpu' HTTP_REQUESTS = 'http_requests' + HTTP_REQUESTS_BY_STATUS = 'http_requests_by_status' + ERROR_CODE = 'error_code' REQUEST_LATENCY_50_PERCENTILE = 'request_latency_50_percentile' REQUEST_LATENCY_90_PERCENTILE = 'request_latency_90_percentile' REQUEST_LATENCY_99_PERCENTILE = 'request_latency_99_percentile' + TOKENS_PER_SECOND = 'tokens_per_second' + TIME_TO_FIRST_TOKEN = 'time_to_first_token' @classmethod def from_json(cls, json_str: str) -> Self: diff --git a/pyproject.toml b/pyproject.toml index e028a76..539be8f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "platform_api_python_client" -version = "4.0.10" +version = "4.0.12" description = "Platform External API" authors = ["OpenAPI Generator Community "] license = "NoLicense" diff --git a/setup.py b/setup.py index 3018dc4..a831b88 100644 --- a/setup.py +++ b/setup.py @@ -21,7 +21,7 @@ # prerequisite: setuptools # http://pypi.python.org/pypi/setuptools NAME = "platform-api-python-client" -VERSION = "4.0.10" +VERSION = "4.0.12" PYTHON_REQUIRES = ">= 3.8" REQUIRES = [ "urllib3 >= 1.25.3, < 3.0.0", diff --git a/test/test_create_c_serve_v2_deployment_request.py b/test/test_create_c_serve_v2_deployment_request.py index 26b7672..006759c 100644 --- a/test/test_create_c_serve_v2_deployment_request.py +++ b/test/test_create_c_serve_v2_deployment_request.py @@ -39,6 +39,7 @@ def make_instance(self, include_optional) -> CreateCServeV2DeploymentRequest: cluster_id = 56, hardware_instance_id = 56, recipe = { }, + cserve_version = '', hf_token = '', endpoint_bearer_token = '', endpoint_certificate_authority = '', diff --git a/test/test_create_rag_deployment_request.py b/test/test_create_rag_deployment_request.py index 398bc93..0ecf919 100644 --- a/test/test_create_rag_deployment_request.py +++ b/test/test_create_rag_deployment_request.py @@ -39,6 +39,7 @@ def make_instance(self, include_optional) -> CreateRagDeploymentRequest: cluster_id = 56, hardware_instance_id = 56, recipe = { }, + cserve_version = '', hf_token = '', llm_model = '', centml_api_key = '', diff --git a/test/test_deployment_usage.py b/test/test_deployment_usage.py new file mode 100644 index 0000000..c30d259 --- /dev/null +++ b/test/test_deployment_usage.py @@ -0,0 +1,66 @@ +# coding: utf-8 + +""" + Platform External API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from platform_api_python_client.models.deployment_usage import DeploymentUsage + +class TestDeploymentUsage(unittest.TestCase): + """DeploymentUsage unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> DeploymentUsage: + """Test DeploymentUsage + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `DeploymentUsage` + """ + model = DeploymentUsage() + if include_optional: + return DeploymentUsage( + metric = { + 'key' : '' + }, + values = [ + platform_api_python_client.models.deployment_usage_value.DeploymentUsageValue( + timestamp = 56, + value = 1.337, ) + ] + ) + else: + return DeploymentUsage( + metric = { + 'key' : '' + }, + values = [ + platform_api_python_client.models.deployment_usage_value.DeploymentUsageValue( + timestamp = 56, + value = 1.337, ) + ], + ) + """ + + def testDeploymentUsage(self): + """Test DeploymentUsage""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_get_c_serve_v2_deployment_response.py b/test/test_get_c_serve_v2_deployment_response.py index 13a720b..764cb3f 100644 --- a/test/test_get_c_serve_v2_deployment_response.py +++ b/test/test_get_c_serve_v2_deployment_response.py @@ -45,6 +45,7 @@ def make_instance(self, include_optional) -> GetCServeV2DeploymentResponse: created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), hardware_instance_id = 56, recipe = { }, + cserve_version = '', min_scale = 56, max_scale = 56, initial_scale = 56, diff --git a/test/test_get_deployment_usage_response.py b/test/test_get_deployment_usage_response.py index 8f4b11b..36ac8d2 100644 --- a/test/test_get_deployment_usage_response.py +++ b/test/test_get_deployment_usage_response.py @@ -36,17 +36,29 @@ def make_instance(self, include_optional) -> GetDeploymentUsageResponse: if include_optional: return GetDeploymentUsageResponse( values = [ - platform_api_python_client.models.deployment_usage_value.DeploymentUsageValue( - timestamp = 56, - value = 1.337, ) + platform_api_python_client.models.deployment_usage.DeploymentUsage( + metric = { + 'key' : '' + }, + values = [ + platform_api_python_client.models.deployment_usage_value.DeploymentUsageValue( + timestamp = 56, + value = 1.337, ) + ], ) ] ) else: return GetDeploymentUsageResponse( values = [ - platform_api_python_client.models.deployment_usage_value.DeploymentUsageValue( - timestamp = 56, - value = 1.337, ) + platform_api_python_client.models.deployment_usage.DeploymentUsage( + metric = { + 'key' : '' + }, + values = [ + platform_api_python_client.models.deployment_usage_value.DeploymentUsageValue( + timestamp = 56, + value = 1.337, ) + ], ) ], ) """ diff --git a/test/test_get_rag_deployment_response.py b/test/test_get_rag_deployment_response.py index 712452a..636c4a5 100644 --- a/test/test_get_rag_deployment_response.py +++ b/test/test_get_rag_deployment_response.py @@ -45,6 +45,7 @@ def make_instance(self, include_optional) -> GetRagDeploymentResponse: created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), hardware_instance_id = 56, recipe = { }, + cserve_version = '', llm_model = '', centml_api_key = '', min_scale = 56,