Download lib/python3.11/site-packages/dashscope/models.py from michaelu0826/phantom_env: direct link, hf CLI and curl.
- Browser
- Download file 1.46 kB
-
https://huggingface.co/datasets/michaelu0826/phantom_env/resolve/main/lib/python3.11/site-packages/dashscope/models.py
- Command line
-
hf download hf://datasets/michaelu0826/phantom_env/lib/python3.11/site-packages/dashscope/models.py
-
curl -L -o models.py https://huggingface.co/datasets/michaelu0826/phantom_env/resolve/main/lib/python3.11/site-packages/dashscope/models.py
1.46 kB
| # -*- coding: utf-8 -*- | |
| # Copyright (c) Alibaba, Inc. and its affiliates. | |
| from dashscope.api_entities.dashscope_response import DashScopeAPIResponse | |
| from dashscope.client.base_api import GetMixin, ListMixin | |
| class Models(ListMixin, GetMixin): | |
| SUB_PATH = "models" | |
| def get( # type: ignore[override] | |
| cls, | |
| name: str, | |
| api_key: str = None, | |
| **kwargs, | |
| ) -> DashScopeAPIResponse: | |
| """Get the model information. | |
| Args: | |
| name (str): The model name. | |
| api_key (str, optional): The api key. Defaults to None. | |
| workspace (str): The dashscope workspace id. | |
| Returns: | |
| DashScopeAPIResponse: The model information. | |
| """ | |
| return super().get(name, api_key, **kwargs) # type: ignore | |
| def list( # type: ignore[override] | |
| cls, | |
| page=1, | |
| page_size=10, | |
| api_key: str = None, | |
| **kwargs, | |
| ) -> DashScopeAPIResponse: | |
| """List models. | |
| Args: | |
| api_key (str, optional): The api key | |
| page (int, optional): Page number. Defaults to 1. | |
| page_size (int, optional): Items per page. Defaults to 10. | |
| Returns: | |
| DashScopeAPIResponse: The models. | |
| """ | |
| # type: ignore | |
| return super().list(page, page_size, api_key=api_key, **kwargs) # type: ignore[return-value] # pylint: disable=line-too-long # noqa: E501 | |