wallaroo.wallaroo_ml_ops_api_client.api.model.models_upload_stream API documentation

# wallaroo.wallaroo_ml_ops_api_client.api.model.models_upload_stream

View Source

      1from typing import Any, Dict, Optional, Union
      2
      3import httpx
      4
      5from ...client import Client
      6from ...models.models_upload_stream_response_200 import \
      7    ModelsUploadStreamResponse200
      8from ...models.models_upload_stream_response_400 import \
      9    ModelsUploadStreamResponse400
     10from ...models.models_upload_stream_response_401 import \
     11    ModelsUploadStreamResponse401
     12from ...models.models_upload_stream_response_500 import \
     13    ModelsUploadStreamResponse500
     14from ...models.models_upload_stream_visibility import \
     15    ModelsUploadStreamVisibility
     16from ...types import UNSET, Response
     17
     18
     19def _get_kwargs(
     20    *,
     21    client: Client,
     22    name: str,
     23    filename: str,
     24    visibility: ModelsUploadStreamVisibility,
     25    workspace_id: int,
     26
     27) -> Dict[str, Any]:
     28    url = "{}/v1/api/models/upload_stream".format(
     29        client.base_url)
     30
     31    headers: Dict[str, str] = client.get_headers()
     32    cookies: Dict[str, Any] = client.get_cookies()
     33
     34
     35
     36
     37
     38    params: Dict[str, Any] = {}
     39    params["name"] = name
     40
     41
     42    params["filename"] = filename
     43
     44
     45    json_visibility = visibility.value
     46
     47    params["visibility"] = json_visibility
     48
     49
     50    params["workspace_id"] = workspace_id
     51
     52
     53
     54    params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
     55
     56
     57
     58
     59
     60
     61    return {
     62	    "method": "post",
     63        "url": url,
     64        "headers": headers,
     65        "cookies": cookies,
     66        "timeout": client.get_timeout(),
     67        "params": params,
     68    }
     69
     70
     71def _parse_response(*, response: httpx.Response) -> Optional[Union[ModelsUploadStreamResponse200, ModelsUploadStreamResponse400, ModelsUploadStreamResponse401, ModelsUploadStreamResponse500]]:
     72    if response.status_code == 500:
     73        response_500 = ModelsUploadStreamResponse500.from_dict(response.json())
     74
     75
     76
     77        return response_500
     78    if response.status_code == 400:
     79        response_400 = ModelsUploadStreamResponse400.from_dict(response.json())
     80
     81
     82
     83        return response_400
     84    if response.status_code == 401:
     85        response_401 = ModelsUploadStreamResponse401.from_dict(response.json())
     86
     87
     88
     89        return response_401
     90    if response.status_code == 200:
     91        response_200 = ModelsUploadStreamResponse200.from_dict(response.json())
     92
     93
     94
     95        return response_200
     96    return None
     97
     98
     99def _build_response(*, response: httpx.Response) -> Response[Union[ModelsUploadStreamResponse200, ModelsUploadStreamResponse400, ModelsUploadStreamResponse401, ModelsUploadStreamResponse500]]:
    100    return Response(
    101        status_code=response.status_code,
    102        content=response.content,
    103        headers=response.headers,
    104        parsed=_parse_response(response=response),
    105    )
    106
    107
    108def sync_detailed(
    109    *,
    110    client: Client,
    111    name: str,
    112    filename: str,
    113    visibility: ModelsUploadStreamVisibility,
    114    workspace_id: int,
    115
    116) -> Response[Union[ModelsUploadStreamResponse200, ModelsUploadStreamResponse400, ModelsUploadStreamResponse401, ModelsUploadStreamResponse500]]:
    117    """Stream a large model directly into storage
    118
    119     Streams a potentially large model directly into storage.
    120
    121    Args:
    122        name (str):  Name of the model in the workspace.
    123        filename (str):  Model filename.
    124        visibility (ModelsUploadStreamVisibility):  Desired model visibility.
    125        workspace_id (int):  Workspace identifier.
    126
    127    Returns:
    128        Response[Union[ModelsUploadStreamResponse200, ModelsUploadStreamResponse400, ModelsUploadStreamResponse401, ModelsUploadStreamResponse500]]
    129    """
    130
    131
    132    kwargs = _get_kwargs(
    133        client=client,
    134name=name,
    135filename=filename,
    136visibility=visibility,
    137workspace_id=workspace_id,
    138
    139    )
    140
    141    response = httpx.request(
    142        verify=client.verify_ssl,
    143        **kwargs,
    144    )
    145
    146    return _build_response(response=response)
    147
    148def sync(
    149    *,
    150    client: Client,
    151    name: str,
    152    filename: str,
    153    visibility: ModelsUploadStreamVisibility,
    154    workspace_id: int,
    155
    156) -> Optional[Union[ModelsUploadStreamResponse200, ModelsUploadStreamResponse400, ModelsUploadStreamResponse401, ModelsUploadStreamResponse500]]:
    157    """Stream a large model directly into storage
    158
    159     Streams a potentially large model directly into storage.
    160
    161    Args:
    162        name (str):  Name of the model in the workspace.
    163        filename (str):  Model filename.
    164        visibility (ModelsUploadStreamVisibility):  Desired model visibility.
    165        workspace_id (int):  Workspace identifier.
    166
    167    Returns:
    168        Response[Union[ModelsUploadStreamResponse200, ModelsUploadStreamResponse400, ModelsUploadStreamResponse401, ModelsUploadStreamResponse500]]
    169    """
    170
    171
    172    return sync_detailed(
    173        client=client,
    174name=name,
    175filename=filename,
    176visibility=visibility,
    177workspace_id=workspace_id,
    178
    179    ).parsed
    180
    181async def asyncio_detailed(
    182    *,
    183    client: Client,
    184    name: str,
    185    filename: str,
    186    visibility: ModelsUploadStreamVisibility,
    187    workspace_id: int,
    188
    189) -> Response[Union[ModelsUploadStreamResponse200, ModelsUploadStreamResponse400, ModelsUploadStreamResponse401, ModelsUploadStreamResponse500]]:
    190    """Stream a large model directly into storage
    191
    192     Streams a potentially large model directly into storage.
    193
    194    Args:
    195        name (str):  Name of the model in the workspace.
    196        filename (str):  Model filename.
    197        visibility (ModelsUploadStreamVisibility):  Desired model visibility.
    198        workspace_id (int):  Workspace identifier.
    199
    200    Returns:
    201        Response[Union[ModelsUploadStreamResponse200, ModelsUploadStreamResponse400, ModelsUploadStreamResponse401, ModelsUploadStreamResponse500]]
    202    """
    203
    204
    205    kwargs = _get_kwargs(
    206        client=client,
    207name=name,
    208filename=filename,
    209visibility=visibility,
    210workspace_id=workspace_id,
    211
    212    )
    213
    214    async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
    215        response = await _client.request(
    216            **kwargs
    217        )
    218
    219    return _build_response(response=response)
    220
    221async def asyncio(
    222    *,
    223    client: Client,
    224    name: str,
    225    filename: str,
    226    visibility: ModelsUploadStreamVisibility,
    227    workspace_id: int,
    228
    229) -> Optional[Union[ModelsUploadStreamResponse200, ModelsUploadStreamResponse400, ModelsUploadStreamResponse401, ModelsUploadStreamResponse500]]:
    230    """Stream a large model directly into storage
    231
    232     Streams a potentially large model directly into storage.
    233
    234    Args:
    235        name (str):  Name of the model in the workspace.
    236        filename (str):  Model filename.
    237        visibility (ModelsUploadStreamVisibility):  Desired model visibility.
    238        workspace_id (int):  Workspace identifier.
    239
    240    Returns:
    241        Response[Union[ModelsUploadStreamResponse200, ModelsUploadStreamResponse400, ModelsUploadStreamResponse401, ModelsUploadStreamResponse500]]
    242    """
    243
    244
    245    return (await asyncio_detailed(
    246        client=client,
    247name=name,
    248filename=filename,
    249visibility=visibility,
    250workspace_id=workspace_id,
    251
    252    )).parsed

def sync_detailed( *, client: wallaroo.wallaroo_ml_ops_api_client.client.Client, name: str, filename: str, visibility: wallaroo.wallaroo_ml_ops_api_client.models.models_upload_stream_visibility.ModelsUploadStreamVisibility, workspace_id: int) -> wallaroo.wallaroo_ml_ops_api_client.types.Response[typing.Union[wallaroo.wallaroo_ml_ops_api_client.models.models_upload_stream_response_200.ModelsUploadStreamResponse200, wallaroo.wallaroo_ml_ops_api_client.models.models_upload_stream_response_400.ModelsUploadStreamResponse400, wallaroo.wallaroo_ml_ops_api_client.models.models_upload_stream_response_401.ModelsUploadStreamResponse401, wallaroo.wallaroo_ml_ops_api_client.models.models_upload_stream_response_500.ModelsUploadStreamResponse500]]: View Source

    109def sync_detailed(
    110    *,
    111    client: Client,
    112    name: str,
    113    filename: str,
    114    visibility: ModelsUploadStreamVisibility,
    115    workspace_id: int,
    116
    117) -> Response[Union[ModelsUploadStreamResponse200, ModelsUploadStreamResponse400, ModelsUploadStreamResponse401, ModelsUploadStreamResponse500]]:
    118    """Stream a large model directly into storage
    119
    120     Streams a potentially large model directly into storage.
    121
    122    Args:
    123        name (str):  Name of the model in the workspace.
    124        filename (str):  Model filename.
    125        visibility (ModelsUploadStreamVisibility):  Desired model visibility.
    126        workspace_id (int):  Workspace identifier.
    127
    128    Returns:
    129        Response[Union[ModelsUploadStreamResponse200, ModelsUploadStreamResponse400, ModelsUploadStreamResponse401, ModelsUploadStreamResponse500]]
    130    """
    131
    132
    133    kwargs = _get_kwargs(
    134        client=client,
    135name=name,
    136filename=filename,
    137visibility=visibility,
    138workspace_id=workspace_id,
    139
    140    )
    141
    142    response = httpx.request(
    143        verify=client.verify_ssl,
    144        **kwargs,
    145    )
    146
    147    return _build_response(response=response)

Stream a large model directly into storage

Streams a potentially large model directly into storage.

Args: name (str): Name of the model in the workspace. filename (str): Model filename. visibility (ModelsUploadStreamVisibility): Desired model visibility. workspace_id (int): Workspace identifier.

Returns: Response[Union[ModelsUploadStreamResponse200, ModelsUploadStreamResponse400, ModelsUploadStreamResponse401, ModelsUploadStreamResponse500]]

def sync( *, client: wallaroo.wallaroo_ml_ops_api_client.client.Client, name: str, filename: str, visibility: wallaroo.wallaroo_ml_ops_api_client.models.models_upload_stream_visibility.ModelsUploadStreamVisibility, workspace_id: int) -> Union[wallaroo.wallaroo_ml_ops_api_client.models.models_upload_stream_response_200.ModelsUploadStreamResponse200, wallaroo.wallaroo_ml_ops_api_client.models.models_upload_stream_response_400.ModelsUploadStreamResponse400, wallaroo.wallaroo_ml_ops_api_client.models.models_upload_stream_response_401.ModelsUploadStreamResponse401, wallaroo.wallaroo_ml_ops_api_client.models.models_upload_stream_response_500.ModelsUploadStreamResponse500, NoneType]: View Source

    149def sync(
    150    *,
    151    client: Client,
    152    name: str,
    153    filename: str,
    154    visibility: ModelsUploadStreamVisibility,
    155    workspace_id: int,
    156
    157) -> Optional[Union[ModelsUploadStreamResponse200, ModelsUploadStreamResponse400, ModelsUploadStreamResponse401, ModelsUploadStreamResponse500]]:
    158    """Stream a large model directly into storage
    159
    160     Streams a potentially large model directly into storage.
    161
    162    Args:
    163        name (str):  Name of the model in the workspace.
    164        filename (str):  Model filename.
    165        visibility (ModelsUploadStreamVisibility):  Desired model visibility.
    166        workspace_id (int):  Workspace identifier.
    167
    168    Returns:
    169        Response[Union[ModelsUploadStreamResponse200, ModelsUploadStreamResponse400, ModelsUploadStreamResponse401, ModelsUploadStreamResponse500]]
    170    """
    171
    172
    173    return sync_detailed(
    174        client=client,
    175name=name,
    176filename=filename,
    177visibility=visibility,
    178workspace_id=workspace_id,
    179
    180    ).parsed

Stream a large model directly into storage

Streams a potentially large model directly into storage.

Args: name (str): Name of the model in the workspace. filename (str): Model filename. visibility (ModelsUploadStreamVisibility): Desired model visibility. workspace_id (int): Workspace identifier.

Returns: Response[Union[ModelsUploadStreamResponse200, ModelsUploadStreamResponse400, ModelsUploadStreamResponse401, ModelsUploadStreamResponse500]]

async def asyncio_detailed( *, client: wallaroo.wallaroo_ml_ops_api_client.client.Client, name: str, filename: str, visibility: wallaroo.wallaroo_ml_ops_api_client.models.models_upload_stream_visibility.ModelsUploadStreamVisibility, workspace_id: int) -> wallaroo.wallaroo_ml_ops_api_client.types.Response[typing.Union[wallaroo.wallaroo_ml_ops_api_client.models.models_upload_stream_response_200.ModelsUploadStreamResponse200, wallaroo.wallaroo_ml_ops_api_client.models.models_upload_stream_response_400.ModelsUploadStreamResponse400, wallaroo.wallaroo_ml_ops_api_client.models.models_upload_stream_response_401.ModelsUploadStreamResponse401, wallaroo.wallaroo_ml_ops_api_client.models.models_upload_stream_response_500.ModelsUploadStreamResponse500]]: View Source

    182async def asyncio_detailed(
    183    *,
    184    client: Client,
    185    name: str,
    186    filename: str,
    187    visibility: ModelsUploadStreamVisibility,
    188    workspace_id: int,
    189
    190) -> Response[Union[ModelsUploadStreamResponse200, ModelsUploadStreamResponse400, ModelsUploadStreamResponse401, ModelsUploadStreamResponse500]]:
    191    """Stream a large model directly into storage
    192
    193     Streams a potentially large model directly into storage.
    194
    195    Args:
    196        name (str):  Name of the model in the workspace.
    197        filename (str):  Model filename.
    198        visibility (ModelsUploadStreamVisibility):  Desired model visibility.
    199        workspace_id (int):  Workspace identifier.
    200
    201    Returns:
    202        Response[Union[ModelsUploadStreamResponse200, ModelsUploadStreamResponse400, ModelsUploadStreamResponse401, ModelsUploadStreamResponse500]]
    203    """
    204
    205
    206    kwargs = _get_kwargs(
    207        client=client,
    208name=name,
    209filename=filename,
    210visibility=visibility,
    211workspace_id=workspace_id,
    212
    213    )
    214
    215    async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
    216        response = await _client.request(
    217            **kwargs
    218        )
    219
    220    return _build_response(response=response)

Stream a large model directly into storage

Streams a potentially large model directly into storage.

Args: name (str): Name of the model in the workspace. filename (str): Model filename. visibility (ModelsUploadStreamVisibility): Desired model visibility. workspace_id (int): Workspace identifier.

Returns: Response[Union[ModelsUploadStreamResponse200, ModelsUploadStreamResponse400, ModelsUploadStreamResponse401, ModelsUploadStreamResponse500]]

async def asyncio( *, client: wallaroo.wallaroo_ml_ops_api_client.client.Client, name: str, filename: str, visibility: wallaroo.wallaroo_ml_ops_api_client.models.models_upload_stream_visibility.ModelsUploadStreamVisibility, workspace_id: int) -> Union[wallaroo.wallaroo_ml_ops_api_client.models.models_upload_stream_response_200.ModelsUploadStreamResponse200, wallaroo.wallaroo_ml_ops_api_client.models.models_upload_stream_response_400.ModelsUploadStreamResponse400, wallaroo.wallaroo_ml_ops_api_client.models.models_upload_stream_response_401.ModelsUploadStreamResponse401, wallaroo.wallaroo_ml_ops_api_client.models.models_upload_stream_response_500.ModelsUploadStreamResponse500, NoneType]: View Source

    222async def asyncio(
    223    *,
    224    client: Client,
    225    name: str,
    226    filename: str,
    227    visibility: ModelsUploadStreamVisibility,
    228    workspace_id: int,
    229
    230) -> Optional[Union[ModelsUploadStreamResponse200, ModelsUploadStreamResponse400, ModelsUploadStreamResponse401, ModelsUploadStreamResponse500]]:
    231    """Stream a large model directly into storage
    232
    233     Streams a potentially large model directly into storage.
    234
    235    Args:
    236        name (str):  Name of the model in the workspace.
    237        filename (str):  Model filename.
    238        visibility (ModelsUploadStreamVisibility):  Desired model visibility.
    239        workspace_id (int):  Workspace identifier.
    240
    241    Returns:
    242        Response[Union[ModelsUploadStreamResponse200, ModelsUploadStreamResponse400, ModelsUploadStreamResponse401, ModelsUploadStreamResponse500]]
    243    """
    244
    245
    246    return (await asyncio_detailed(
    247        client=client,
    248name=name,
    249filename=filename,
    250visibility=visibility,
    251workspace_id=workspace_id,
    252
    253    )).parsed

Stream a large model directly into storage

Streams a potentially large model directly into storage.

Args: name (str): Name of the model in the workspace. filename (str): Model filename. visibility (ModelsUploadStreamVisibility): Desired model visibility. workspace_id (int): Workspace identifier.

Returns: Response[Union[ModelsUploadStreamResponse200, ModelsUploadStreamResponse400, ModelsUploadStreamResponse401, ModelsUploadStreamResponse500]]