Skip to content

Core

Client

Client(
    address: str,
    username: str | None = None,
    password: str | None = None,
    token_provider: Callable[[], str] | None = None,
    verify: bool | str = True,
    backend_version_override: str | None = None,
    authentication_method: str | None = None,
)

Connect with a Driverless AI server and interact with it.

Parameters:

  • address (str) –

    Full URL to the Driverless AI server to connect with.

  • username (str | None, default: None ) –

    username to authenticate with the server.

  • password (str | None, default: None ) –

    password to authenticate with the server.

  • token_provider (Callable[[], str] | None, default: None ) –

    A function that returns a token to authenticate with the server. This precedes username & password authentication.

  • verify (bool | str, default: True ) –

    Enable or disable SSL certificate verification when using HTTP to connect to the server. Pass a string path to a CA bundle file to use it for SSL verification. See requests docs for more details.

  • backend_version_override (str | None, default: None ) –

    Disables server version detection and use the specified server version. Set to "latest" to use the most recent server backend support.

  • authentication_method (str | None, default: None ) –

    The authentication method used to connect to the Driverless AI server as described in link.

Example: Connect with a username and password
client = driverlessai.Client(
    address="http://localhost:12345",
    username="alice",
    password="alice-password",
)
Example: Connect with an OAuth token
  • This assumes the Driverless AI server is configured to allow clients to authenticate through tokens.
  • Set up an OAuth token provider with a refresh token from the Driverless AI web UI.
    token_provider = driverlessai.token_providers.OAuth2TokenProvider(
        refresh_token="eyJhbGciOiJIUzI1N...",
        client_id="python_client",
        token_endpoint_url="https://keycloak-server/auth/realms/..."
        token_introspection_url="https://keycloak-server/auth/realms/..."
    )
    
  • Then use the token provider to authorize and connect to the server.
    client = driverlessai.Client(
        address="https://localhost:12345",
        token_provider=token_provider.ensure_fresh_token
    )
    
Example: Connect with a newer server version

An older Client version will refuse to connect to a newer Driverless AI server version. Even though it is not recommended, you can still force the Client to connect to the server.

client = driverlessai.Client(
    address="http://localhost:12345",
    username="bob",
    password="bob-password",
    backend_version_override="latest",
)

Example: Connect using an alternative authentication method
client = driverlessai.Client(
    address="http://localhost:12345",
    username="alice",
    password="alice-password",
    authentication_method="ldap",
)

admin property

admin: Admin

Perform administrative tasks on the Driverless AI server.

Driverless AI version requirement

Requires Driverless AI server 1.10.3 or higher.

Returns:

autodocs property

autodocs: AutoDocs

Interact with AutoDocs in the Driverless AI server.

Beta API

A beta API that is subject to future changes.

Returns:

autoviz property

autoviz: AutoViz

Interact with dataset visualizations in the Driverless AI server.

Returns:

connectors property

connectors: Connectors

Interact with data sources that are enabled in the Driverless AI server.

Returns:

datasets property

datasets: Datasets

Interact with datasets in the Driverless AI server.

Returns:

deployments property

deployments: Deployments

Interact with deployments in the Driverless AI server.

Driverless AI version requirement

Requires Driverless AI server 1.10.6 or higher.

Beta API

A beta API that is subject to future changes.

Returns:

experiments property

experiments: Experiments

Interact with experiments in the Driverless AI server.

Returns:

mli property

mli: MLI

Interact with experiment interpretations in the Driverless AI server.

Returns:

model_diagnostics property

model_diagnostics: ModelDiagnostics

Interact with model diagnostics in the Driverless AI server.

Returns:

projects property

projects: Projects

Interact with projects in the Driverless AI server.

Returns:

recipes property

recipes: Recipes

Interact with recipes in the Driverless AI server.

Returns:

server property

server: Server

Interact with the connected Driverless AI server

Returns:

is_server_up

is_server_up(
    address: str, timeout: int = 10, verify: bool | str = False
) -> bool

Checks whether a Driverless AI server is up and running.

Parameters:

  • address (str) –

    The full URL to the Driverless AI server.

  • timeout (int, default: 10 ) –

    The maximum time in seconds to wait for a response from the server.

  • verify (bool | str, default: False ) –

    Enable or disable SSL certificate verification when using HTTP to connect to the server. Pass a string path to a CA bundle file to use it for SSL verification. See requests docs for more details.

Returns:

  • bool

    True if the server is up, otherwise False.

Example
is_up = driverlessai.is_server_up("http://localhost:12345")
if is_up:
    print("Driverless AI server is up")

__version__ module-attribute

__version__: str = build_info['version']

Returns package version.

Returns: