# coding: utf-8

"""
    XingChen 开放接口定义

    No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

    The version of the OpenAPI document: v2
    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 typing import Optional, Union
from pydantic import BaseModel, Field, StrictFloat, StrictInt, StrictStr, StrictBool


class ModelParameters(BaseModel):
    """
    ModelParameters
    """
    model_name: Optional[StrictStr] = Field(None, alias="modelName")
    top_p: Optional[Union[StrictFloat, StrictInt]] = Field(None, alias="topP")
    top_k: Optional[StrictInt] = Field(None, alias="topK")
    seed: Optional[StrictInt] = None
    max_length: Optional[StrictInt] = Field(None, alias="maxLength")
    min_length: Optional[StrictInt] = Field(None, alias="minLength")
    temperature: Optional[Union[StrictFloat, StrictInt]] = None
    incremental_output: Optional[StrictBool] = Field(False, alias="incrementalOutput")

    __properties = ["modelName", "topP", "topK", "seed", "maxLength", "minLength", "temperature", "incrementalOutput"]

    class Config:
        """Pydantic configuration"""
        allow_population_by_field_name = True
        validate_assignment = True

    def to_str(self) -> str:
        """Returns the string representation of the model using alias"""
        return pprint.pformat(self.dict(by_alias=True))

    def to_json(self) -> str:
        """Returns the JSON representation of the model using alias"""
        return json.dumps(self.to_dict())

    @classmethod
    def from_json(cls, json_str: str) -> ModelParameters:
        """Create an instance of ModelParameters from a JSON string"""
        return cls.from_dict(json.loads(json_str))

    def to_dict(self):
        """Returns the dictionary representation of the model using alias"""
        _dict = self.dict(by_alias=True,
                          exclude={
                          },
                          exclude_none=True)
        return _dict

    @classmethod
    def from_dict(cls, obj: dict) -> ModelParameters:
        """Create an instance of ModelParameters from a dict"""
        if obj is None:
            return None

        if not isinstance(obj, dict):
            return ModelParameters.parse_obj(obj)

        _obj = ModelParameters.parse_obj({
            "model_name": obj.get("modelName"),
            "top_p": obj.get("topP"),
            "top_k": obj.get("topK"),
            "seed": obj.get("seed"),
            "max_length": obj.get("maxLength"),
            "min_length": obj.get("minLength"),
            "temperature": obj.get("temperature"),
            "incremental_output": obj.get("incrementalOutput")
        })
        return _obj


