Python reference

class ArizeExportClient

The ArizeExportClient class encapsulates the required connection parameters for the Arize exporter.

Note that the ArizeExportClient is available with the Arize SDK >= 7.0.3. You can install this with pip install arize >= 7.0.3

The ArizeExportClient requires an Arize API key. You can get this one of two ways:

  1. Use the export functionality on our Embeddings, Performance Tracing, or Datasets tabs to generate a code snippet. Copying the code snippet will copy your API key as well. Take a look here for more details.

  2. Get the API key from the GraphQL explorer. Follow these instructions here.

Once you have the API key - you can initialize the client. The client reads the key from one of two places.

By default, the ArizeExportClient looks for the API key from an environment variable called ARIZE_API_KEY.

import os
from arize.exporter import ArizeExportClient

# Make sure to do this before initializing the client
os.environ['ARIZE_API_KEY'] = <ARIZE_API_KEY>

client = ArizeExportClient()

Reference

ArgumentTypeDescription

api_key

Optional[str]

Arize provided personal API key associated with your user profile, located on the API Explorer page. API key is required to initiate a new client, it can be passed in explicitly, or set up as an environment variable or in profile file.

host

Optional[str]

URI endpoint host to send your export request to Arize AI.

Defaults to https://flight.arize.com

port

Optional[int]

URI endpoint port to send your export request to Arize AI. Defaults to 443.

#export_model_to_df

This method is invoke on an instance of ArizeExportClient and is the primary method for exporting data from Arize to a Pandas DataFrame.

To use this method, you first need to get your space id and your model id.

Space id:

The easiest way to get your space id is to get it from the URL when you visit the Arize platform. If your url is this:

https://app.arize.com/organizations/.../spaces/U3BhY2U6NzU0

Your space id is the series of numbers and letters right after /spaces/. In this case, my space id is U3BhY2U6NzU0

Model id:

Your model id is the same as the display name of your model. For example, for our demo fraud model, the model id is arize-demo-fraud-use-case.

Code examples:

from arize.exporter import ArizeExportClient
from arize.utils.types import Environments

client = ArizeExportClient()

df = client.export_model_to_df(
    space_id='U3BhY2U6NzU0',
    model_id='arize-demo-fraud-use-case',
    environment=Environments.PRODUCTION,
    start_time=datetime.fromisoformat('2022-05-04T01:10:26.249+00:00'),
    end_time=datetime.fromisoformat('2022-05-04T01:10:27.249+00:00'),
)

Reference:

ArgumentTypeDescription

space_id

str

The id for the space where to export models from, can be retrieved from the url of the Space Overview page in the Arize UI.

model_id

str

The name of the model to export, can be found in the Model Overview tab in the Arize UI.

environment

Environment

The environment for the model to export (can be Production, Training, or Validation). Needs to be of the Environments enum in utils.types.

start_time

datetime

The start time for the data to export for the model, start time is inclusive. Time interval has hourly granularity. Must be a python datetime object.

end_time

datetime

The end time for the data to export for the model, end time is not inclusive. Time interval has hourly granularity. Must a python datetime object.

include_actuals

Optional[bool]

An optional input to indicate whether to include actuals / ground truth in the data to export. include_actuals only applies to the Production environment and defaults to False.

model_version

Optional[str]

An optional input to indicate the version of the model to export. Model versions for all model environments can be found in the Datasets tab on the model page in the Arize UI.

batch_id

Optional[str]

An optional input to indicate the batch name of the model to export. Batches only apply to the Validation environment, and can be found in the Datasets tab on the model page in the Arize UI.

Last updated

Copyright © 2023 Arize AI, Inc