Skip to main content
Quotient integrates into your RAG or agent system in minutes. This guide will walk you from installation to logging your first query, viewing detections, and generating reports.
1

Install the SDK

Install the Quotient SDK for your language of choice.
pip install quotientai
Make sure your environment has Python 3.9+ or Node.js 18+.
2

Create an API Key

Go to your Quotient dashboard and create an API key.Export it as an environment variable so the SDK can authenticate:
bash
export QUOTIENT_API_KEY=your-api-key
Tip: use different keys for dev, staging, and prod to keep environments separate.
3

Initialize the Logger

The logger is the entry point for sending logs to Quotient. It records queries, model outputs, and retrieved documents.
from quotientai import QuotientAI, DetectionType

# initialize the quotient client
quotient = QuotientAI()

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

# log your first event
response = quotient.log(
  user_query="How do I cook a goose?",
  model_output="The capital of France is Paris",
  documents=["Here is an excellent goose recipe..."]
)

print(response)
Note: in development, set detection_sample_rate=1.0 for full coverage. In production, reduce it to balance cost and coverage.
4

Run the Script

Run the script with your API key set:
QUOTIENT_API_KEY=your-api-key python logging.py
If successful, you’ll see detection results printed in your console.
5

View Your Logs

Open the Detections Dashboard.Each log includes:
  • the original query
  • retrieved documents
  • the model’s output
  • detection scores (hallucination, document relevance, tool correctness)
This gives you immediate visibility into whether your output was grounded in the right evidence.
6

Get Reports & Insights

After sending at least 100 logs, Quotient automatically generates your first Report.Reports show:
  • Clusters of queries with similar failure modes
  • Hallucination and document relevance rates over time
  • Retrieval drift across environments
Reports are designed to help you move from debugging one-off issues to spotting systemic reliability problems.

Tips for Developers

  • Environments: keep logs separated by dev, staging, prod.
  • Privacy: anonymize or filter out PII before logging.
  • Iterate fast: start by logging a few queries manually, then integrate Quotient into your agent loop.

What’s Next

I