arthurai.client.client.ArthurAI#

class arthurai.client.client.ArthurAI(config=None, verify_ssl=None, url=None, access_key=None, offline=False, login=None, password=None, organization_id=None, allow_insecure=False)#

Bases: object

A client that interacts with Arthur’s servers.

Methods

create_service_account

Create a new service account

get_current_org

Retrieves the current organization that the client is operating in

get_model

Retrieve an existing model by id

get_model_group

(BETA) Retrieve an existing model group by id

get_service_accounts

Retrieve service accounts

model

Create a new multistage model.

set_current_org

Sets the current organization that the client's requests apply to

create_service_account(description, role)#

Create a new service account

Parameters
  • description (str) – the description for the new service account

  • role (Role) – the Role of the new service account

Returns

parsed response in the following format:

{
    "id": "<service account id>",
    "organization_id": "<organization id>",
    "description": "<service account description>",
    "token": "<service account api key>"
}

get_current_org()#

Retrieves the current organization that the client is operating in

Return type

Dict[str, str]

Returns

a string with the UUID of the current organization

Permissions

N/A

get_model(identifier, id_type='id')#

Retrieve an existing model by id

Param

identifier: Id to get the model by

Param

id_type: Type of id the identifier is, possible options are [‘id’, ‘partner_model_id’]

Raises
  • ArthurUserError – failed due to user error

  • ArthurInternalError – failed due to an internal error

Permissions

model read

Return type

ArthurModel

get_model_group(id_or_model)#

(BETA) Retrieve an existing model group by id

Param

identifier: Id to get the model group by

Raises
  • ArthurUserError – failed due to user error

  • ArthurInternalError – failed due to an internal error

Permissions

model_group read

Return type

ArthurModelGroup

get_service_accounts(description=None)#

Retrieve service accounts

Parameters

description (Optional[str]) – an optional description that returned account should match

Returns

parsed response containing a list of service accounts, in the following format:

[
    {
        "id": "<service account id>",
        "organization_id": "<organization id>",
        "description": "<service account description>",
        "token": "<service account api key>"
    }
]

model(partner_model_id=None, input_type=None, output_type=None, model_type=None, display_name=None, description=None, tags=None, classifier_threshold=None, is_batch=False, text_delimiter=None, expected_throughput_gb_per_day=None, pixel_height=None, pixel_width=None)#

Create a new multistage model.

Parameters
  • partner_model_id (Optional[str]) – The string external id of the model. If display_name is provided without partner_model_id, we will generate a unique partner_model_id.

  • input_type (Optional[InputType]) – the InputType

  • output_type (Optional[OutputType]) – the OutputType

  • model_type (Optional[OutputType]) –

    Deprecated since version version: 2.0.0 Use output_type instead.

  • display_name (Optional[str]) – Optional name to display on dashboard, will default to the external id

  • description (Optional[str]) – Optional description for the model

  • tags (Optional[List[str]]) – A list of string tags to associate with the model

  • classifier_threshold (Optional[float]) – For binary classification models this is the threshold to determine a positive class, defaults to 0.5

  • is_batch (bool) – boolean value which signifies whether the model sends inferences by batch or streaming

  • text_delimiter (Optional[TextDelimiter]) – TextDelimiter used in NLP models to split documents into tokens for explanations

  • expected_throughput_gb_per_day (Optional[int]) – Expected amount of throughput. Used to provision resources

  • pixel_height (Optional[int]) – Image height in pixels. Needed for CV models which require images to be one size

  • pixel_width (Optional[int]) – Image width in pixels. Needed for CV models which require images to be one size

Return type

ArthurModel

Returns

An ArthurModel

set_current_org(org_id)#

Sets the current organization that the client’s requests apply to

Parameters

org_id (str) – The ID of the organization to set

Return type

None

Returns

None

Permissions

N/A