Before sending any records you must initialize the logger. Initialization tells Quotient which app generated the data, which environment it came from, and which detections to run.

Basic Initialization

from quotientai import QuotientAI, DetectionType

quotient = QuotientAI(api_key="your-quotient-api-key")

quotient.logger.init(
    app_name="my-first-app",
    environment="dev",
    detections=[DetectionType.HALLUCINATION, DetectionType.DOCUMENT_RELEVANCY],
    detection_sample_rate=1.0,
)

Key Parameters

  • app_name (string): Logical application name. Used as the primary grouping dimension in the dashboard.
  • environment (string): Where the app is running (dev, staging, prod, etc.). Drives environment filters.
  • tags (object, optional): Default metadata applied to every log (e.g., { "team": "growth" }).
  • sample_rate (float): Percentage of logs to persist. 1.0 captures everything, lower values sample.
  • detections (array): Which automated checks to run, such as HALLUCINATION or DOCUMENT_RELEVANCY.
  • detection_sample_rate (float): Sampling rate for detections specifically. Defaults to 0.0 (disabled).

Tips

  • Call logger.init once during application startup; repeated calls reuse the same configuration.
  • Use configuration files or environment variables to keep app name and environment consistent across deploys.
  • Provide tags for metadata you want on every log (e.g., team, product surface).

Next: Send Logs