|
| 1 | +# coding=utf-8 |
| 2 | +# -------------------------------------------------------------------------- |
| 3 | +# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.9.5, generator: @autorest/python@6.4.11) |
| 4 | +# Changes may cause incorrect behavior and will be lost if the code is regenerated. |
| 5 | +# -------------------------------------------------------------------------- |
| 6 | + |
| 7 | +from copy import deepcopy |
| 8 | +from typing import Any |
| 9 | + |
| 10 | +from azure.core import PipelineClient |
| 11 | +from azure.core.rest import HttpRequest, HttpResponse |
| 12 | + |
| 13 | +from . import models as _models |
| 14 | +from ._configuration import LlamaCppPythonAPIConfiguration |
| 15 | +from ._serialization import Deserializer, Serializer |
| 16 | +from .operations import CreateOperations, GetOperations |
| 17 | + |
| 18 | + |
| 19 | +class LlamaCppPythonAPI: # pylint: disable=client-accepts-api-version-keyword |
| 20 | + """LlamaCppPythonAPI. |
| 21 | +
|
| 22 | + :ivar create: CreateOperations operations |
| 23 | + :vartype create: llama_cpp.client.operations.CreateOperations |
| 24 | + :ivar get: GetOperations operations |
| 25 | + :vartype get: llama_cpp.client.operations.GetOperations |
| 26 | + :keyword endpoint: Service URL. Required. Default value is "". |
| 27 | + :paramtype endpoint: str |
| 28 | + """ |
| 29 | + |
| 30 | + def __init__( # pylint: disable=missing-client-constructor-parameter-credential |
| 31 | + self, *, endpoint: str = "", **kwargs: Any |
| 32 | + ) -> None: |
| 33 | + self._config = LlamaCppPythonAPIConfiguration(**kwargs) |
| 34 | + self._client: PipelineClient = PipelineClient( |
| 35 | + base_url=endpoint, config=self._config, **kwargs |
| 36 | + ) |
| 37 | + |
| 38 | + client_models = { |
| 39 | + k: v for k, v in _models.__dict__.items() if isinstance(v, type) |
| 40 | + } |
| 41 | + self._serialize = Serializer(client_models) |
| 42 | + self._deserialize = Deserializer(client_models) |
| 43 | + self._serialize.client_side_validation = False |
| 44 | + self.create = CreateOperations( |
| 45 | + self._client, self._config, self._serialize, self._deserialize |
| 46 | + ) |
| 47 | + self.get = GetOperations( |
| 48 | + self._client, self._config, self._serialize, self._deserialize |
| 49 | + ) |
| 50 | + |
| 51 | + def send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: |
| 52 | + """Runs the network request through the client's chained policies. |
| 53 | +
|
| 54 | + >>> from azure.core.rest import HttpRequest |
| 55 | + >>> request = HttpRequest("GET", "https://www.example.org/") |
| 56 | + <HttpRequest [GET], url: 'https://www.example.org/'> |
| 57 | + >>> response = client.send_request(request) |
| 58 | + <HttpResponse: 200 OK> |
| 59 | +
|
| 60 | + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request |
| 61 | +
|
| 62 | + :param request: The network request you want to make. Required. |
| 63 | + :type request: ~azure.core.rest.HttpRequest |
| 64 | + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. |
| 65 | + :return: The response of your network call. Does not do error handling on your response. |
| 66 | + :rtype: ~azure.core.rest.HttpResponse |
| 67 | + """ |
| 68 | + |
| 69 | + request_copy = deepcopy(request) |
| 70 | + request_copy.url = self._client.format_url(request_copy.url) |
| 71 | + return self._client.send_request(request_copy, **kwargs) |
| 72 | + |
| 73 | + def close(self) -> None: |
| 74 | + self._client.close() |
| 75 | + |
| 76 | + def __enter__(self) -> "LlamaCppPythonAPI": |
| 77 | + self._client.__enter__() |
| 78 | + return self |
| 79 | + |
| 80 | + def __exit__(self, *exc_details: Any) -> None: |
| 81 | + self._client.__exit__(*exc_details) |
0 commit comments