Logs
Learn how to log inputs and outputs to Quotient.
You can use Quotient’s SDK to log inputs and outputs from your retrieval or search-augmented AI applications.
Initialize the Logger
Initialize the Quotient logger with configuration settings for your application:
Parameters:
Name of your application. Core parameter used to identify the source of logs in the Quotient dashboard.
Environment where your application is running (e.g., “dev”, “staging”, “prod”). Core parameter used to help segregate logs by deployment environment.
Key-value pairs for categorizing and filtering logs. Useful for slicing analytics by dimensions like customer, feature, model version, etc.
Example: {"model": "gpt-4", "feature": "customer-support"}
Value that determines what percent of logs to persist. Valid range of 0.0 to 1.0.
Enable automatic detection of potential hallucinations in model outputs.
Value that determines what percent of logs to run hallucination detection on. Valid range of 0.0 to 1.0.
Returns:
A QuotientLogger object.
Send Logs
Log model interactions with context and metadata for analysis.
Parameters:
The input query or prompt sent to the model.
The response generated by the model.
List of document contents used as context for the model. Can be strings or dictionaries with page_content
and optional metadata
.
Used in hallucination detection and attribution analysis.
If a dictionary is passed, it must have the key page_content
, containing the document text, and optionally metadata
, containing any document metadata you want to capture about the document.
Example:
NOTE: One of documents
, message_history
, or instructions
is required.
Previous messages in the conversation, following the OpenAI message format with role
and content
keys.
Used in hallucination detection and attribution analysis.
Example:
NOTE: One of documents
, message_history
, or instructions
is required.
List of instructions provided to the model.
Used in hallucination detection and attribution analysis.
Example:
NOTE: One of documents
, message_history
, or instructions
is required.
Additional tags to associate with each log entry.
Example: {"model": "gpt-4", "feature": "customer-support"}
Returns:
A UUID representing the unique identifier for the logged event.
Retrieve Logs
Retrieve logs sent to Quotient using the client.
Returns:
An array of Log objects containing the following fields:
Asynchronous Python client
You can also use the asynchronous Python client to log data and retrieve logs.