logger#
Use this to log evaluations or spans to Arize in bulk. Read our quickstart guide for logging evaluations to Arize.
To use in your code, import the following:
from arize.pandas.logger import Client
- class Client(api_key=None, space_id=None, space_key=None, uri='https://api.arize.com/v1', additional_headers=None, request_verify=True, developer_key=None, host=None, port=None)#
Bases:
object
Arize API Client
- log_evaluations(dataframe, model_id=None, model_version=None, validate=True, path=None, timeout=None, verbose=False, project_name=None)#
Logs a pandas dataframe containing LLM evaluations data to Arize via a POST request. The dataframe must contain a column context.span_id such that Arize can assign each evaluation to its respective span. Returns a
Response
object from the Requests HTTP library to ensure successful delivery of records.- Parameters:
dataframe (pd.DataFrame) – A dataframe containing LLM evaluations data.
model_id (str) – A unique name to identify your model in the Arize platform. (Deprecated: Use project_name instead.)
model_version (str, optional) – Used to group a subset of traces a given model_id to compare and track changes. It should match the model_id of the spans sent previously, to which evaluations will be assigned. Defaults to None.
validate (bool, optional) – When set to True, validation is run before sending data. Defaults to True.
path (str, optional) – Temporary directory/file to store the serialized data in binary before sending to Arize.
timeout (float, optional) – You can stop waiting for a response after a given number of seconds with the timeout parameter. Defaults to None.
verbose – (bool, optional) = When set to true, info messages are printed. Defaults to False.
project_name (str, optional) – A unique name to identify your project in the Arize platform. Either model_id or project_name must be provided.
- Returns:
Response object
- log_evaluations_sync(dataframe, model_id=None, model_version=None, validate=True, timeout=None, verbose=False, project_name=None)#
Logs a pandas dataframe containing LLM evaluations data to Arize via a Flight gRPC request. The dataframe must contain a column context.span_id such that Arize can assign each evaluation to its respective span.
- Parameters:
dataframe (pd.DataFrame) – A dataframe containing LLM evaluations data.
model_id (str) – A unique name to identify your model in the Arize platform. (Deprecated: Use project_name instead.)
model_version (str, optional) – Used to group a subset of traces a given model_id to compare and track changes. It should match the model_id of the spans sent previously, to which evaluations will be assigned. Defaults to None.
validate (bool, optional) – When set to True, validation is run before sending data. Defaults to True.
path (str, optional) – Temporary directory/file to store the serialized data in binary before sending to Arize.
timeout (float, optional) – You can stop waiting for a response after a given number of seconds with the timeout parameter. Defaults to None.
verbose – (bool, optional) = When set to true, info messages are printed. Defaults to False.
project_name (str, optional) – A unique name to identify your project in the Arize platform. Either model_id or project_name must be provided.
- log_spans(dataframe, model_id=None, model_version=None, evals_dataframe=None, datetime_format=DEFAULT_DATETIME_FMT, validate=True, path=None, timeout=None, verbose=False, project_name=None)#
Logs a pandas dataframe containing LLM tracing data to Arize via a POST request. Returns a
Response
object from the Requests HTTP library to ensure successful delivery of records.- Parameters:
dataframe (pd.DataFrame) – The dataframe containing the LLM traces.
model_id (str) – A unique name to identify your model in the Arize platform. (Deprecated: Use project_name instead.)
model_version (str, optional) – Used to group a subset of traces a given model_id to compare and track changes. Defaults to None.
evals_dataframe (pd.DataFrame, optional) – A dataframe containing LLM evaluations data. The evaluations are joined to their corresponding spans via a left outer join, i.e., using only context.span_id from the spans dataframe. Defaults to None.
datetime_format (str) – format for the timestamp captured in the LLM traces. Defaults to “%Y-%m-%dT%H:%M:%S.%f+00:00”.
validate (bool, optional) – When set to True, validation is run before sending data. Defaults to True.
path (str, optional) – Temporary directory/file to store the serialized data in binary before sending to Arize.
timeout (float, optional) – You can stop waiting for a response after a given number of seconds with the timeout parameter. Defaults to None.
verbose – (bool, optional) = When set to true, info messages are printed. Defaults to False.
project_name (str, optional) – A unique name to identify your project in the Arize platform. Either model_id or project_name must be provided.
- Returns:
Response object