ML Models#

class MLModelsClient(*, sdk_config: SDKConfiguration)[source]#

Bases: object

Client for logging ML model predictions and actuals to Arize.

This class is primarily intended for internal use within the SDK. Users are highly encouraged to access resource-specific functionality via arize.ArizeClient.

Parameters:

sdk_config (SDKConfiguration) – Resolved SDK configuration.

log_stream(*, space_id: str, model_name: str, model_type: ModelTypes, environment: Environments, model_version: str | None = None, prediction_id: PredictionIDType | None = None, prediction_timestamp: int | None = None, prediction_label: PredictionLabelTypes | None = None, actual_label: ActualLabelTypes | None = None, features: dict[str, str | bool | float | int | list[str] | TypedValue] | None = None, embedding_features: dict[str, Embedding] | None = None, shap_values: dict[str, float] | None = None, tags: dict[str, str | bool | float | int | TypedValue] | None = None, batch_id: str | None = None, prompt: str | Embedding | None = None, response: str | Embedding | None = None, prompt_template: str | None = None, prompt_template_version: str | None = None, llm_model_name: str | None = None, llm_params: dict[str, str | bool | float | int] | None = None, llm_run_metadata: LLMRunMetadata | None = None, timeout: float | None = None) cf.Future[source]#

Log a single model prediction or actual to Arize asynchronously.

This method sends a single prediction, actual, or both to Arize for ML monitoring. The request is made asynchronously and returns a Future that can be used to check the status or retrieve the response.

Parameters:
  • space_id (str) – The space ID where the model resides.

  • model_name (str) – A unique name to identify your model in the Arize platform.

  • model_type (ModelTypes) – The type of model. Supported types: BINARY, MULTI_CLASS, REGRESSION, RANKING, OBJECT_DETECTION. Note: GENERATIVE_LLM is not supported; use the spans module instead.

  • environment (Environments) – The environment this data belongs to (PRODUCTION, TRAINING, or VALIDATION).

  • model_version (str | None) – Optional version identifier for the model.

  • prediction_id (PredictionIDType | None) – Unique identifier for this prediction. If not provided, one will be auto-generated for PRODUCTION environment.

  • prediction_timestamp (int | None) – Unix timestamp (seconds) for when the prediction was made. If not provided, the current time is used. Must be within 1 year in the future and 2 years in the past from the current time.

  • prediction_label (PredictionLabelTypes | None) – The prediction output from your model. Type depends on model_type (e.g., string for categorical, float for numeric).

  • actual_label (ActualLabelTypes | None) – The ground truth label. Type depends on model_type.

  • features (dict[str, str | bool | float | int | list[str] | TypedValue] | None) – Dictionary of feature name to feature value. Values can be str, bool, float, int, list[str], or TypedValue.

  • embedding_features (dict[str, Embedding] | None) – Dictionary of embedding feature name to Embedding object. Maximum 50 embeddings per record. Object detection models support only 1.

  • shap_values (dict[str, float] | None) – Dictionary of feature name to SHAP value (float) for feature importance/explainability.

  • tags (dict[str, str | bool | float | int | TypedValue] | None) – Dictionary of metadata tags. Tag names cannot end with “_shap” or be reserved names. Values must be under 1000 characters (warning at 100).

  • batch_id (str | None) – Required for VALIDATION environment; identifies the validation batch.

  • prompt (str | Embedding | None) – For generative models, the prompt text or embedding sent to the model.

  • response (str | Embedding | None) – For generative models, the response text or embedding from the model.

  • prompt_template (str | None) – Template used to generate the prompt.

  • prompt_template_version (str | None) – Version identifier for the prompt template.

  • llm_model_name (str | None) – Name of the LLM model used (e.g., “gpt-4”).

  • llm_params (dict[str, str | bool | float | int] | None) – Dictionary of LLM configuration parameters (e.g., temperature, max_tokens).

  • llm_run_metadata (LLMRunMetadata | None) – Metadata about the LLM run including token counts and latency.

  • timeout (float | None) – Maximum time (in seconds) to wait for the request to complete.

Returns:

A concurrent.futures.Future object representing the async request. Call .result() to block and retrieve the Response object, or check .done() for completion status.

Raises:
  • ValueError – If model_type is GENERATIVE_LLM, or if validation environment is missing batch_id, or if training/validation environment is missing prediction or actual, or if timestamp is out of range, or if no data is provided (must have prediction_label, actual_label, tags, or shap_values), or if tag names end with “_shap” or exceed length limits.

  • MissingSpaceIDError – If space_id is not provided or empty.

  • MissingModelNameError – If model_name is not provided or empty.

  • InvalidValueType – If features, tags, or other parameters have incorrect types.

  • InvalidNumberOfEmbeddings – If more than 50 embedding features are provided.

  • KeyError – If tag names include reserved names.

Return type:

cf.Future

Notes

  • Timestamps must be within 1 year future and 2 years past from current time

  • Tag values are truncated at 1000 characters, with warnings at 100 characters

  • For GENERATIVE_LLM models, use the spans module or OTEL tracing instead

  • The Future returned can be monitored for request status asynchronously

log(*, space_id: str, model_name: str, model_type: ModelTypes, dataframe: pd.DataFrame, schema: BaseSchema, environment: Environments, model_version: str = '', batch_id: str = '', validate: bool = True, metrics_validation: list[Metrics] | None = None, surrogate_explainability: bool = False, timeout: float | None = None, tmp_dir: str = '') requests.Response[source]#

Log a batch of model predictions and actuals to Arize from a pandas.DataFrame.

This method uploads multiple records to Arize in a single batch operation using Apache Arrow format for efficient transfer. The dataframe structure is defined by the provided schema which maps dataframe columns to Arize data fields.

Parameters:
  • space_id (str) – The space ID where the model resides.

  • model_name (str) – A unique name to identify your model in the Arize platform.

  • model_type (ModelTypes) – The type of model. Supported types: BINARY, MULTI_CLASS, REGRESSION, RANKING, OBJECT_DETECTION. Note: GENERATIVE_LLM is not supported; use the spans module instead.

  • dataframe (pandas.DataFrame) – Pandas DataFrame containing the data to upload. Columns should correspond to the schema field mappings.

  • schema (BaseSchema) – Schema object (Schema or CorpusSchema) that defines the mapping between dataframe columns and Arize data fields (e.g., prediction_label_column_name, feature_column_names, etc.).

  • environment (Environments) – The environment this data belongs to (PRODUCTION, TRAINING, VALIDATION, or CORPUS).

  • model_version (str) – Optional version identifier for the model.

  • batch_id (str) – Required for VALIDATION environment; identifies the validation batch.

  • validate (bool) – When True, performs comprehensive validation before sending data. Includes checks for required fields, data types, and value constraints.

  • metrics_validation (list[Metrics] | None) – Optional list of metric families to validate against.

  • surrogate_explainability (bool) – When True, automatically generates SHAP values using MIMIC surrogate explainer. Requires the ‘mimic-explainer’ extra. Has no effect if shap_values_column_names is already specified in schema.

  • timeout (float | None) – Maximum time (in seconds) to wait for the request to complete.

  • tmp_dir (str) – Optional temporary directory to store serialized Arrow data before upload.

Returns:

A requests.Response object from the upload request (only returned on HTTP 2xx). Non-2xx responses raise exceptions rather than being returned.

Raises:
  • MissingSpaceIDError – If space_id is not provided or empty.

  • MissingModelNameError – If model_name is not provided or empty.

  • ValueError – If model_type is GENERATIVE_LLM, or if environment is CORPUS with non-CorpusSchema, or if training/validation records are incomplete.

  • ValidationFailure – If validate=True and validation checks fail. Contains list of validation error messages.

  • pa.ArrowInvalid – If the dataframe cannot be converted to Arrow format, typically due to mixed types in columns not specified in the schema.

  • AuthenticationError – If the server returns HTTP 401 or 403 (invalid API key or space ID). Raised immediately to prevent further uploads with bad credentials.

  • APIError – If the server returns any other non-2xx response (e.g. 400, 422, 429, 5xx). Raised immediately to prevent further uploads when the server signals an error.

Return type:

requests.Response

Notes

  • Categorical dtype columns are automatically converted to string

  • Extraneous columns not in the schema are removed before upload

  • Surrogate explainability requires ‘mimic-explainer’ extra

  • For GENERATIVE_LLM models, use the spans module or OTEL tracing instead

  • If logging actuals without predictions, ensure predictions were logged first

  • Data is sent via Apache Arrow for efficient large batch transfers

export_to_df(*, space_id: str, model_name: str, environment: Environments, start_time: datetime, end_time: datetime, include_actuals: bool = False, model_version: str = '', batch_id: str = '', where: str = '', columns: list | None = None, similarity_search_params: SimilaritySearchParams | None = None, stream_chunk_size: int | None = None) pd.DataFrame[source]#

Export model data from Arize to a pandas.DataFrame.

Retrieves prediction and optional actual data for a model within a specified time range and returns it as a pandas.DataFrame for analysis.

Parameters:
  • space_id (str) – The space ID where the model resides.

  • model_name (str) – The name of the model to export data from.

  • environment (Environments) – The environment to export from (PRODUCTION, TRAINING, or VALIDATION).

  • start_time (datetime) – Start of the time range (inclusive) as a datetime object.

  • end_time (datetime) – End of the time range (inclusive) as a datetime object.

  • include_actuals (bool) – When True, includes actual labels in the export. When False, only predictions are returned.

  • model_version (str) – Optional model version to filter by. Empty string returns all versions.

  • batch_id (str) – Optional batch ID to filter by (for VALIDATION environment).

  • where (str) – Optional SQL-like WHERE clause to filter rows (e.g., “feature_x > 0.5”).

  • columns (list | None) – Optional list of column names to include. If None, all columns are returned.

  • similarity_search_params (SimilaritySearchParams | None) – Optional parameters for embedding similarity search filtering.

  • stream_chunk_size (int | None) – Optional chunk size for streaming large result sets.

Returns:

A pandas DataFrame containing the exported data

with columns for predictions, actuals (if requested), features, tags, timestamps, and other model metadata.

Return type:

pandas.DataFrame

Raises:

RuntimeError – If the Flight client request fails or returns no response.

Notes

  • Uses Apache Arrow Flight for efficient data transfer

  • Large exports may benefit from specifying stream_chunk_size

  • The where clause supports SQL-like filtering syntax

export_to_parquet(*, path: str, space_id: str, model_name: str, environment: Environments, start_time: datetime, end_time: datetime, include_actuals: bool = False, model_version: str = '', batch_id: str = '', where: str = '', columns: list | None = None, similarity_search_params: SimilaritySearchParams | None = None, stream_chunk_size: int | None = None) None[source]#

Export model data from Arize to a Parquet file.

Retrieves prediction and optional actual data for a model within a specified time range and writes it directly to a Parquet file at the specified path.

Parameters:
  • path (str) – The file path where the Parquet file will be written.

  • space_id (str) – The space ID where the model resides.

  • model_name (str) – The name of the model to export data from.

  • environment (Environments) – The environment to export from (PRODUCTION, TRAINING, or VALIDATION).

  • start_time (datetime) – Start of the time range (inclusive) as a datetime object.

  • end_time (datetime) – End of the time range (inclusive) as a datetime object.

  • include_actuals (bool) – When True, includes actual labels in the export. When False, only predictions are returned.

  • model_version (str) – Optional model version to filter by. Empty string returns all versions.

  • batch_id (str) – Optional batch ID to filter by (for VALIDATION environment).

  • where (str) – Optional SQL-like WHERE clause to filter rows (e.g., “feature_x > 0.5”).

  • columns (list | None) – Optional list of column names to include. If None, all columns are returned.

  • similarity_search_params (SimilaritySearchParams | None) – Optional parameters for embedding similarity search filtering.

  • stream_chunk_size (int | None) – Optional chunk size for streaming large result sets.

Raises:

RuntimeError – If the Flight client request fails or returns no response.

Return type:

None

Notes

  • Uses Apache Arrow Flight for efficient data transfer

  • Data is written directly to the specified path as a Parquet file

  • Large exports may benefit from specifying stream_chunk_size

Schema and Column Names#

class Schema(prediction_id_column_name: str | None = None, feature_column_names: list[str] | TypedColumns | None = None, tag_column_names: list[str] | TypedColumns | None = None, timestamp_column_name: str | None = None, prediction_label_column_name: str | None = None, prediction_score_column_name: str | None = None, actual_label_column_name: str | None = None, actual_score_column_name: str | None = None, shap_values_column_names: dict[str, str] | None = None, embedding_feature_column_names: dict[str, EmbeddingColumnNames] | None = None, prediction_group_id_column_name: str | None = None, rank_column_name: str | None = None, attributions_column_name: str | None = None, relevance_score_column_name: str | None = None, relevance_labels_column_name: str | None = None, object_detection_prediction_column_names: ObjectDetectionColumnNames | None = None, object_detection_actual_column_names: ObjectDetectionColumnNames | None = None, prompt_column_names: str | EmbeddingColumnNames | None = None, response_column_names: str | EmbeddingColumnNames | None = None, prompt_template_column_names: PromptTemplateColumnNames | None = None, llm_config_column_names: LLMConfigColumnNames | None = None, llm_run_metadata_column_names: LLMRunMetadataColumnNames | None = None, retrieved_document_ids_column_name: str | None = None, multi_class_threshold_scores_column_name: str | None = None, semantic_segmentation_prediction_column_names: SemanticSegmentationColumnNames | None = None, semantic_segmentation_actual_column_names: SemanticSegmentationColumnNames | None = None, instance_segmentation_prediction_column_names: InstanceSegmentationPredictionColumnNames | None = None, instance_segmentation_actual_column_names: InstanceSegmentationActualColumnNames | None = None)[source]#

Bases: BaseSchema

Used to organize and map column names containing model data within your Pandas dataframe to Arize.

Parameters:
  • prediction_id_column_name (str | None) – Column name for the predictions unique identifier. Unique IDs are used to match a prediction to delayed actuals or feature importances in Arize. If prediction ids are not provided, it will default to an empty string “” and, when possible, Arize will create a random prediction id on the server side. Prediction id must be a string column with each row indicating a unique prediction event.

  • feature_column_names (list[str] | TypedColumns | None) – Column names for features. The content of feature columns can be int, float, string. If TypedColumns is used, the columns will be cast to the provided types prior to logging.

  • tag_column_names (list[str] | TypedColumns | None) – Column names for tags. The content of tag columns can be int, float, string. If TypedColumns is used, the columns will be cast to the provided types prior to logging.

  • timestamp_column_name (str | None) – Column name for timestamps. The content of this column must be int Unix Timestamps in seconds.

  • prediction_label_column_name (str | None) – Column name for categorical prediction values. The content of this column must be convertible to string.

  • prediction_score_column_name (str | None) – Column name for numeric prediction values. The content of this column must be int/float or list of dictionaries mapping class names to int/float scores in the case of MULTI_CLASS model types.

  • actual_label_column_name (str | None) – Column name for categorical ground truth values. The content of this column must be convertible to string.

  • actual_score_column_name (str | None) – Column name for numeric ground truth values. The content of this column must be int/float or list of dictionaries mapping class names to int/float scores in the case of MULTI_CLASS model types.

  • shap_values_column_names (dict[str, str] | None) – Dictionary mapping feature column name and corresponding SHAP feature importance column name. e.g. {{“feat_A”: “feat_A_shap”, “feat_B”: “feat_B_shap”}}

  • embedding_feature_column_names (dict[str, EmbeddingColumnNames] | None) – Dictionary mapping embedding display names to EmbeddingColumnNames objects.

  • prediction_group_id_column_name (str | None) – Column name for ranking groups or lists in ranking models. The content of this column must be string and is limited to 128 characters.

  • rank_column_name (str | None) – Column name for rank of each element on the its group or list. The content of this column must be integer between 1-100.

  • relevance_score_column_name (str | None) – Column name for ranking model type numeric ground truth values. The content of this column must be int/float.

  • relevance_labels_column_name (str | None) – Column name for ranking model type categorical ground truth values. The content of this column must be a string.

  • object_detection_prediction_column_names (ObjectDetectionColumnNames | None) – ObjectDetectionColumnNames object containing information defining the predicted bounding boxes’ coordinates, categories, and scores.

  • object_detection_actual_column_names (ObjectDetectionColumnNames | None) – ObjectDetectionColumnNames object containing information defining the actual bounding boxes’ coordinates, categories, and scores.

  • prompt_column_names (str | EmbeddingColumnNames | None) – column names for text that is passed to the GENERATIVE_LLM model. It accepts a string (if sending only a text column) or EmbeddingColumnNames object containing the embedding vector data (required) and raw text (optional) for the input text your model acts on.

  • response_column_names (str | EmbeddingColumnNames | None) – column names for text generated by the GENERATIVE_LLM model. It accepts a string (if sending only a text column) or EmbeddingColumnNames object containing the embedding vector data (required) and raw text (optional) for the text your model generates.

  • prompt_template_column_names (PromptTemplateColumnNames | None) – PromptTemplateColumnNames object containing the prompt template and the prompt template version.

  • llm_config_column_names (LLMConfigColumnNames | None) – LLMConfigColumnNames object containing the LLM’s model name and its hyper parameters used at inference.

  • llm_run_metadata_column_names (LLMRunMetadataColumnNames | None) – LLMRunMetadataColumnNames object containing token counts and latency metrics

  • retrieved_document_ids_column_name (str | None) – Column name for retrieved document ids. The content of this column must be lists with entries convertible to strings.

  • multi_class_threshold_scores_column_name (str | None) – Column name for dictionary that maps class names to threshold values. The content of this column must be dictionary of str -> int/float.

  • semantic_segmentation_prediction_column_names (SemanticSegmentationColumnNames | None) – SemanticSegmentationColumnNames object containing information defining the predicted polygon coordinates and categories.

  • semantic_segmentation_actual_column_names (SemanticSegmentationColumnNames | None) – SemanticSegmentationColumnNames object containing information defining the actual polygon coordinates and categories.

  • instance_segmentation_prediction_column_names (InstanceSegmentationPredictionColumnNames | None) – InstanceSegmentationPredictionColumnNames object containing information defining the predicted polygon coordinates, categories, scores, and bounding box coordinates.

  • instance_segmentation_actual_column_names (InstanceSegmentationActualColumnNames | None) – InstanceSegmentationActualColumnNames object containing information defining the actual polygon coordinates, categories, scores, and bounding box coordinates.

  • attributions_column_name (str | None)

prediction_id_column_name: str | None = None#
feature_column_names: list[str] | TypedColumns | None = None#
tag_column_names: list[str] | TypedColumns | None = None#
timestamp_column_name: str | None = None#
prediction_label_column_name: str | None = None#
prediction_score_column_name: str | None = None#
actual_label_column_name: str | None = None#
actual_score_column_name: str | None = None#
shap_values_column_names: dict[str, str] | None = None#
embedding_feature_column_names: dict[str, EmbeddingColumnNames] | None = None#
prediction_group_id_column_name: str | None = None#
rank_column_name: str | None = None#
attributions_column_name: str | None = None#
relevance_score_column_name: str | None = None#
relevance_labels_column_name: str | None = None#
object_detection_prediction_column_names: ObjectDetectionColumnNames | None = None#
object_detection_actual_column_names: ObjectDetectionColumnNames | None = None#
prompt_column_names: str | EmbeddingColumnNames | None = None#
response_column_names: str | EmbeddingColumnNames | None = None#
prompt_template_column_names: PromptTemplateColumnNames | None = None#
llm_config_column_names: LLMConfigColumnNames | None = None#
llm_run_metadata_column_names: LLMRunMetadataColumnNames | None = None#
retrieved_document_ids_column_name: str | None = None#
multi_class_threshold_scores_column_name: str | None = None#
semantic_segmentation_prediction_column_names: SemanticSegmentationColumnNames | None = None#
semantic_segmentation_actual_column_names: SemanticSegmentationColumnNames | None = None#
instance_segmentation_prediction_column_names: InstanceSegmentationPredictionColumnNames | None = None#
instance_segmentation_actual_column_names: InstanceSegmentationActualColumnNames | None = None#
get_used_columns_counts() dict[str, int][source]#

Return a dict mapping column names to their usage count.

Return type:

dict[str, int]

has_prediction_columns() bool[source]#

Return True if prediction columns are configured.

Return type:

bool

has_actual_columns() bool[source]#

Return True if actual label columns are configured.

Return type:

bool

has_feature_importance_columns() bool[source]#

Return True if feature importance columns are configured.

Return type:

bool

has_typed_columns() bool[source]#

Return True if typed columns are configured.

Return type:

bool

typed_column_fields() set[str][source]#

Return the set of field names with typed columns.

Return type:

set[str]

is_delayed() bool[source]#

Check if the schema has inherently latent information.

Determines this based on the columns provided by the user.

Returns:

True if the schema is “delayed”, i.e., does not possess prediction columns and has actual or feature importance columns.

Return type:

bool

class TypedColumns(inferred: list[str] | None = None, to_str: list[str] | None = None, to_int: list[str] | None = None, to_float: list[str] | None = None)[source]#

Bases: object

Optional class used for explicit type enforcement of feature and tag columns in the dataframe.

When initializing a Schema, use TypedColumns in place of a list of string column names:

feature_column_names = TypedColumns(
    inferred=["feature_1", "feature_2"],
    to_str=["feature_3"],
    to_int=["feature_4"],
)

Notes

  • If a TypedColumns object is included in a Schema, pandas version 1.0.0 or higher is required.

  • Pandas StringDType is still considered an experimental field.

  • Columns not present in any field will not be captured in the Schema.

  • StringDType, Int64DType, and Float64DType are all nullable column types. Null values will be ingested and represented in Arize as empty values.

Parameters:
inferred: list[str] | None = None#
to_str: list[str] | None = None#
to_int: list[str] | None = None#
to_float: list[str] | None = None#
get_all_column_names() list[str][source]#

Return all column names across all conversion lists.

Return type:

list[str]

has_duplicate_columns() tuple[bool, set[str]][source]#

Check for duplicate columns and return (has_duplicates, duplicate_set).

Return type:

tuple[bool, set[str]]

is_empty() bool[source]#

Return True if no columns are configured for conversion.

Return type:

bool

class EmbeddingColumnNames(vector_column_name: str = '', data_column_name: str | None = None, link_to_data_column_name: str | None = None)[source]#

Bases: object

Column names for embedding feature data.

Parameters:
  • vector_column_name (str)

  • data_column_name (str | None)

  • link_to_data_column_name (str | None)

vector_column_name: str = ''#
data_column_name: str | None = None#
class ObjectDetectionColumnNames(bounding_boxes_coordinates_column_name: str, categories_column_name: str, scores_column_name: str | None = None)[source]#

Bases: NamedTuple

Used to log object detection prediction and actual values.

These values are assigned to the prediction or actual schema parameter.

Parameters:
  • bounding_boxes_coordinates_column_name (str) – Column name containing the coordinates of the rectangular outline that locates an object within an image or video. Pascal VOC format required. The contents of this column must be a List[List[float]].

  • categories_column_name (str) – Column name containing the predefined classes or labels used by the model to classify the detected objects. The contents of this column must be List[str].

  • scores_column_names – Column name containing the confidence scores that the model assigns to it’s predictions, indicating how certain the model is that the predicted class is contained within the bounding box. This argument is only applicable for prediction values. The contents of this column must be List[float].

  • scores_column_name (str | None)

Create new instance of ObjectDetectionColumnNames(bounding_boxes_coordinates_column_name, categories_column_name, scores_column_name)

bounding_boxes_coordinates_column_name: str#

Alias for field number 0

categories_column_name: str#

Alias for field number 1

scores_column_name: str | None#

Alias for field number 2

class SemanticSegmentationColumnNames(polygon_coordinates_column_name: str, categories_column_name: str)[source]#

Bases: NamedTuple

Used to log semantic segmentation prediction and actual values.

These values are assigned to the prediction or actual schema parameter.

Parameters:
  • polygon_coordinates_column_name (str) – Column name containing the coordinates of the vertices of the polygon mask within an image or video. The first sublist contains the coordinates of the outline of the polygon. The subsequent sublists contain the coordinates of any cutouts within the polygon. The contents of this column must be a List[List[float]].

  • categories_column_name (str) – Column name containing the predefined classes or labels used by the model to classify the detected objects. The contents of this column must be List[str].

Create new instance of SemanticSegmentationColumnNames(polygon_coordinates_column_name, categories_column_name)

polygon_coordinates_column_name: str#

Alias for field number 0

categories_column_name: str#

Alias for field number 1

class InstanceSegmentationPredictionColumnNames(polygon_coordinates_column_name: str, categories_column_name: str, scores_column_name: str | None = None, bounding_boxes_coordinates_column_name: str | None = None)[source]#

Bases: NamedTuple

Used to log instance segmentation prediction values for the prediction schema parameter.

Parameters:
  • polygon_coordinates_column_name (str) – Column name containing the coordinates of the vertices of the polygon mask within an image or video. The first sublist contains the coordinates of the outline of the polygon. The subsequent sublists contain the coordinates of any cutouts within the polygon. The contents of this column must be a List[List[float]].

  • categories_column_name (str) – Column name containing the predefined classes or labels used by the model to classify the detected objects. The contents of this column must be List[str].

  • scores_column_name (str | None) – Column name containing the confidence scores that the model assigns to it’s predictions, indicating how certain the model is that the predicted class is contained within the bounding box. This argument is only applicable for prediction values. The contents of this column must be List[float].

  • bounding_boxes_coordinates_column_name (str | None) – Column name containing the coordinates of the rectangular outline that locates an object within an image or video. Pascal VOC format required. The contents of this column must be a List[List[float]].

Create new instance of InstanceSegmentationPredictionColumnNames(polygon_coordinates_column_name, categories_column_name, scores_column_name, bounding_boxes_coordinates_column_name)

polygon_coordinates_column_name: str#

Alias for field number 0

categories_column_name: str#

Alias for field number 1

scores_column_name: str | None#

Alias for field number 2

bounding_boxes_coordinates_column_name: str | None#

Alias for field number 3

class InstanceSegmentationActualColumnNames(polygon_coordinates_column_name: str, categories_column_name: str, bounding_boxes_coordinates_column_name: str | None = None)[source]#

Bases: NamedTuple

Used to log instance segmentation actual values that are assigned to the actual schema parameter.

Parameters:
  • polygon_coordinates_column_name (str) – Column name containing the coordinates of the polygon that locates an object within an image or video. The contents of this column must be a List[List[float]].

  • categories_column_name (str) – Column name containing the predefined classes or labels used by the model to classify the detected objects. The contents of this column must be List[str].

  • bounding_boxes_coordinates_column_name (str | None) – Column name containing the coordinates of the rectangular outline that locates an object within an image or video. Pascal VOC format required. The contents of this column must be a List[List[float]].

Create new instance of InstanceSegmentationActualColumnNames(polygon_coordinates_column_name, categories_column_name, bounding_boxes_coordinates_column_name)

polygon_coordinates_column_name: str#

Alias for field number 0

categories_column_name: str#

Alias for field number 1

bounding_boxes_coordinates_column_name: str | None#

Alias for field number 2

class PromptTemplateColumnNames(template_column_name: str | None = None, template_version_column_name: str | None = None)[source]#

Bases: object

Column names for prompt template configuration in LLM schemas.

Parameters:
  • template_column_name (str | None)

  • template_version_column_name (str | None)

template_column_name: str | None = None#
template_version_column_name: str | None = None#
class LLMConfigColumnNames(model_column_name: str | None = None, params_column_name: str | None = None)[source]#

Bases: object

Column names for LLM configuration parameters in schemas.

Parameters:
  • model_column_name (str | None)

  • params_column_name (str | None)

model_column_name: str | None = None#
params_column_name: str | None = None#
class LLMRunMetadataColumnNames(total_token_count_column_name: str | None = None, prompt_token_count_column_name: str | None = None, response_token_count_column_name: str | None = None, response_latency_ms_column_name: str | None = None)[source]#

Bases: object

Column names for LLM run metadata fields in schemas.

Parameters:
  • total_token_count_column_name (str | None)

  • prompt_token_count_column_name (str | None)

  • response_token_count_column_name (str | None)

  • response_latency_ms_column_name (str | None)

total_token_count_column_name: str | None = None#
prompt_token_count_column_name: str | None = None#
response_token_count_column_name: str | None = None#
response_latency_ms_column_name: str | None = None#

Labels and Types#

class Embedding(vector: list[float], data: str | list[str] | None = None, link_to_data: str | None = None)[source]#

Bases: NamedTuple

Container for embedding vector data with optional raw data and links.

Create new instance of Embedding(vector, data, link_to_data)

Parameters:
vector: list[float]#

Alias for field number 0

data: str | list[str] | None#

Alias for field number 1

Alias for field number 2

validate(emb_name: str | int | float) None[source]#

Validates that the embedding object passed is of the correct format.

Ensures validations are passed for vector, data, and link_to_data fields.

Parameters:

emb_name (str | int | float) – Name of the embedding feature the vector belongs to.

Raises:

TypeError – If the embedding fields are of the wrong type.

Return type:

None

class LLMRunMetadata(total_token_count: int | None = None, prompt_token_count: int | None = None, response_token_count: int | None = None, response_latency_ms: int | float | None = None)[source]#

Bases: NamedTuple

Metadata for LLM execution including token counts and latency.

Create new instance of LLMRunMetadata(total_token_count, prompt_token_count, response_token_count, response_latency_ms)

Parameters:
  • total_token_count (int | None)

  • prompt_token_count (int | None)

  • response_token_count (int | None)

  • response_latency_ms (int | float | None)

total_token_count: int | None#

Alias for field number 0

prompt_token_count: int | None#

Alias for field number 1

response_token_count: int | None#

Alias for field number 2

response_latency_ms: int | float | None#

Alias for field number 3

validate() None[source]#

Validate the field values and constraints.

Return type:

None

class ObjectDetectionLabel(bounding_boxes_coordinates: list[list[float]], categories: list[str], scores: list[float] | None = None)[source]#

Bases: NamedTuple

Label data for object detection tasks with bounding boxes and categories.

Create new instance of ObjectDetectionLabel(bounding_boxes_coordinates, categories, scores)

Parameters:
bounding_boxes_coordinates: list[list[float]]#

Alias for field number 0

categories: list[str]#

Alias for field number 1

scores: list[float] | None#

Alias for field number 2

validate(prediction_or_actual: str) None[source]#

Validate the object detection label fields and constraints.

Parameters:

prediction_or_actual (str)

Return type:

None

class MultiClassPredictionLabel(prediction_scores: dict[str, float | int], threshold_scores: dict[str, float | int] | None = None)[source]#

Bases: NamedTuple

Used to log multi class prediction label.

Parameters:
  • prediction_scores (dict[str, float | int]) – The prediction scores of the classes.

  • threshold_scores (dict[str, float | int] | None) – The threshold scores of the classes. Only Multi Label will have threshold scores.

Create new instance of MultiClassPredictionLabel(prediction_scores, threshold_scores)

prediction_scores: dict[str, float | int]#

Alias for field number 0

threshold_scores: dict[str, float | int] | None#

Alias for field number 1

validate() None[source]#

Validate the field values and constraints.

Return type:

None

class MultiClassActualLabel(actual_scores: dict[str, float | int])[source]#

Bases: NamedTuple

Used to log multi class actual label.

Parameters:

actual_scores (dict[str, float | int]) – The actual scores of the classes. Any class in actual_scores with a score of 1 will be sent to arize.

Create new instance of MultiClassActualLabel(actual_scores,)

actual_scores: dict[str, float | int]#

Alias for field number 0

validate() None[source]#

Validate the field values and constraints.

Return type:

None

class RankingPredictionLabel(group_id: str, rank: int, score: float | None = None, label: str | None = None)[source]#

Bases: NamedTuple

Prediction label for ranking tasks with group and rank information.

Create new instance of RankingPredictionLabel(group_id, rank, score, label)

Parameters:
group_id: str#

Alias for field number 0

rank: int#

Alias for field number 1

score: float | None#

Alias for field number 2

label: str | None#

Alias for field number 3

validate() None[source]#

Validate the field values and constraints.

Return type:

None

class RankingActualLabel(relevance_labels: list[str] | None = None, relevance_score: float | None = None)[source]#

Bases: NamedTuple

Actual label for ranking tasks with relevance information.

Create new instance of RankingActualLabel(relevance_labels, relevance_score)

Parameters:
  • relevance_labels (list[str] | None)

  • relevance_score (float | None)

relevance_labels: list[str] | None#

Alias for field number 0

relevance_score: float | None#

Alias for field number 1

validate() None[source]#

Validate the field values and constraints.

Return type:

None