1

Install the Quotient SDK

pip install quotientai
2

Create an API Key

Next, create an API key to authenticate yourself. You can create an API key in your settings.

3

Initialize the Logger

Create a script to initialize the Quotient logger:

from quotientai import QuotientAI

# initialize the quotient client
quotient = QuotientAI()

# initialize the logger
quotient_logger = quotient.logger.init(
    app_name="my-first-app",
    environment="dev",
    sample_rate=1.0,
    hallucination_detection=True,
    hallucination_detection_sample_rate=1.0
)

# log your first event
response = quotient_logger.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)
4

Run the Script

Using your API key, run the script to create your first log:

QUOTIENT_API_KEY=your-api-key python logging.py
5

View Your Logs

You just created your first log! Now you can go to the Detections Dashboard to see your logs and any detected hallucinations.

6

Analyze and Improve

Use the Detections Dashboard to:

  • Track hallucinations in your LLM responses
  • Analyze attribution between responses and source documents
  • Calculate hallucination rates across different environments
  • Optimize your prompts and retrieval system