Skip to content

pixano.inference.client

PixanoInferenceClient

Bases: Settings

Pixano Inference Client.

connect(url) staticmethod

Connect to pixano inference.

Parameters:

Name Type Description Default
url str

The URL of the pixano inference server.

required
Source code in pixano/inference/client.py
@staticmethod
def connect(url: str) -> "PixanoInferenceClient":
    """Connect to pixano inference.

    Args:
        url: The URL of the pixano inference server.
    """
    settings = Settings.model_validate_json(requests.get(f"{url}/app/settings").json())
    client = PixanoInferenceClient(url=url, **settings.model_dump())
    return client

delete(path)

Perform a DELETE request to the pixano inference server.

Parameters:

Name Type Description Default
path str

The path of the request.

required
Source code in pixano/inference/client.py
def delete(self, path: str) -> Response:
    """Perform a DELETE request to the pixano inference server.

    Args:
        path: The path of the request.
    """
    return self._rest_call(path=path, method="DELETE")

get(path)

Perform a GET request to the pixano inference server.

Parameters:

Name Type Description Default
path str

The path of the request.

required
Source code in pixano/inference/client.py
def get(self, path: str) -> Response:
    """Perform a GET request to the pixano inference server.

    Args:
        path: The path of the request.
    """
    return self._rest_call(path=path, method="GET")

list_models()

List all models.

Source code in pixano/inference/client.py
def list_models(self) -> list[ModelInfo]:
    """List all models."""
    response = self.get("app/models")
    return [ModelInfo.model_validate(model) for model in response.json()]

post(path, **kwargs)

Perform a POST request to the pixano inference server.

Parameters:

Name Type Description Default
path str

The path of the request.

required
kwargs Any

The keyword arguments to pass to the request.

{}
Source code in pixano/inference/client.py
def post(self, path: str, **kwargs: Any) -> Response:
    """Perform a POST request to the pixano inference server.

    Args:
        path: The path of the request.
        kwargs: The keyword arguments to pass to the request.
    """
    return self._rest_call(path=path, method="POST", **kwargs)

put(path, **kwargs)

Perform a PUT request to the pixano inference server.

Parameters:

Name Type Description Default
path str

The path of the request.

required
kwargs Any

The keyword arguments to pass to the request.

{}
Source code in pixano/inference/client.py
def put(self, path: str, **kwargs: Any) -> Response:
    """Perform a PUT request to the pixano inference server.

    Args:
        path: The path of the request.
        kwargs: The keyword arguments to pass to the request.
    """
    return self._rest_call(path=path, method="PUT", **kwargs)