Skip to content

digiLab-ai/uncertainty-engine-sdk

Repository files navigation

Uncertainty Engine banner

Python SDK for the Uncertainty Engine

PyPI Python Versions

Requirements

  • Python >=3.10, <3.13
  • Valid Uncertainty Engine account

Installation

pip install uncertainty-engine

With optional dependencies:

pip install "uncertainty_engine[vis,notebook,data]"

Usage

Setting your username and password

To run and queue workflows you must have your Uncertainty Engine username and password set up. To do this you can run the following in your terminal:

export UE_USERNAME="your_username"
export UE_PASSWORD="your_password"

Creating a client

All interactions with the Uncertainty Engine API are performed via a Client. The client can be defined as follows:

from uncertainty_engine import Client

client = Client()

To create a Client for a named environment:

from uncertainty_engine import Client

client = Client(env="<NAME>")

# For example:
client = Client(env="dev")

To create a Client for a custom environment:

from uncertainty_engine import Client, Environment

client = Client(
   env=Environment(
        cognito_user_pool_client_id="<COGNITO USER POOL APPLICATION CLIENT ID>",
        core_api="<UNCERTAINTY ENGINE CORE API URL>",
        region="<REGION>",
        resource_api="<UNCERTAINTY ENGINE RESOURCE SERVICE API URL>",
   ),
)

# For example:
client = Client(
   env=Environment(
        cognito_user_pool_client_id="3n437fei4uhp4ouj8b4mmt09l9",
        core_api="https://s0r8fczyag.execute-api.eu-west-2.amazonaws.com",
        region="eu-west-2",
        resource_api="https://hmqdnx48x6.execute-api.eu-west-2.amazonaws.com",
   ),
)

Running a node

from pprint import pprint

from uncertainty_engine import Client, Environment
from uncertainty_engine.nodes.basic import Add

# Set up the client
client = Client(
   env=Environment(
        cognito_user_pool_client_id="<COGNITO USER POOL APPLICATION CLIENT ID>",
        core_api="<UNCERTAINTY ENGINE CORE API URL>",
        region="<REGION>",
        resource_api="<UNCERTAINTY ENGINE RESOURCE SERVICE API URL>",
   ),
)

# Create a node
add = Add(lhs=1, rhs=2)

# Run the node on the server
response = client.run_node(add)

# Get the result
result = response.outputs

pprint(result)

For more some more in-depth examples checkout our example notebooks.

Support

For any support needs please visit our support page.

About

Python SDK for the Uncertainty Engine

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 6