abacusai.streaming_client

Classes

BaseApiClient

Abstract Base API Client

ClientOptions

Options for configuring the ApiClient

StreamingClient

Abacus.AI Streaming API Client. Does not utilize authentication and only contains public streaming methods

Module Contents

class abacusai.streaming_client.BaseApiClient(api_key=None, server=None, client_options=None, skip_version_check=False)

Abstract Base API Client

Parameters:
  • api_key (str) – The api key to use as authentication to the server

  • server (str) – The base server url to use to send API requets to

  • client_options (ClientOptions) – Optional API client configurations

  • skip_version_check (bool) – If true, will skip checking the server’s current API version on initializing the client

client_version = '1.3.2'
_get_prediction_endpoint(deployment_id, deployment_token)
Parameters:
  • deployment_id (str)

  • deployment_token (str)

_get_proxy_endpoint(deployment_id, deployment_token)
Parameters:
  • deployment_id (str)

  • deployment_token (str)

_get_streaming_endpoint(streaming_token, model_id=None, feature_group_id=None)
Parameters:
  • streaming_token (str)

  • model_id (str)

  • feature_group_id (str)

_clean_api_objects(obj)
_call_api(action, method, query_params=None, body=None, files=None, parse_type=None, streamable_response=False, server_override=None, timeout=None, retry_500=False, data=None)
Parameters:

retry_500 (bool)

_proxy_request(name, method='POST', query_params=None, body=None, files=None, parse_type=None, is_sync=False, streamable_response=False)
Parameters:
_build_class(return_class, values)
_request(url, method, query_params=None, headers=None, body=None, files=None, stream=False, timeout=None, retry_500=False, data=None)
Parameters:

retry_500 (bool)

_poll(obj, wait_states, delay=15, timeout=300, poll_args={}, status_field=None)
Parameters:
_validate_pandas_df(df, clean_column_names)
Parameters:

clean_column_names (bool)

_upload_from_pandas(upload, df, clean_column_names=False)
Return type:

abacusai.dataset.Dataset

_upload_from_spark(upload, df)
Return type:

abacusai.dataset.Dataset

class abacusai.streaming_client.ClientOptions(exception_on_404=True, server=DEFAULT_SERVER)

Options for configuring the ApiClient

Parameters:
  • exception_on_404 (bool) – If true, will raise an exception on a 404 from the server, else will return None.

  • server (str) – The default server endpoint to use for API requests

class abacusai.streaming_client.StreamingClient(client_options=None)

Bases: abacusai.client.BaseApiClient

Abacus.AI Streaming API Client. Does not utilize authentication and only contains public streaming methods

Parameters:

client_options (ClientOptions) – Optional API client configurations

upsert_item_embeddings(streaming_token, model_id, item_id, vector, catalog_id=None)

Upserts an embedding vector for an item id for a model_id.

Parameters:
  • streaming_token (str) – The streaming token for authenticating requests to the model.

  • model_id (str) – A unique string identifier for the model to upsert item embeddings to.

  • item_id (str) – The item id for which its embeddings will be upserted.

  • vector (list) – The embedding vector.

  • catalog_id (str) – The name of the catalog in the model to update.

delete_item_embeddings(streaming_token, model_id, item_ids, catalog_id=None)

Deletes KNN embeddings for a list of item IDs for a given model ID.

Parameters:
  • streaming_token (str) – The streaming token for authenticating requests to the model.

  • model_id (str) – A unique string identifier for the model from which to delete item embeddings.

  • item_ids (list) – A list of item IDs whose embeddings will be deleted.

  • catalog_id (str) – An optional name to specify which catalog in a model to update.

upsert_multiple_item_embeddings(streaming_token, model_id, upserts, catalog_id=None)

Upserts a knn embedding for multiple item ids for a model_id.

Parameters:
  • streaming_token (str) – The streaming token for authenticating requests to the model.

  • model_id (str) – The unique string identifier of the model to upsert item embeddings to.

  • upserts (list) – A list of dictionaries of the form {‘itemId’: …, ‘vector’: […]} for each upsert.

  • catalog_id (str) – Name of the catalog in the model to update.

append_data(feature_group_id, streaming_token, data)

Appends new data into the feature group for a given lookup key recordId.

Parameters:
  • feature_group_id (str) – Unique string identifier for the streaming feature group to record data to.

  • streaming_token (str) – The streaming token for authenticating requests.

  • data (dict) – The data to record as a JSON object.

append_multiple_data(feature_group_id, streaming_token, data)

Appends new data into the feature group for a given lookup key recordId.

Parameters:
  • feature_group_id (str) – Unique string identifier of the streaming feature group to record data to.

  • streaming_token (str) – Streaming token for authenticating requests.

  • data (list) – Data to record, as a list of JSON objects.