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:
Copy
Ask AI
from quotientai import QuotientAI, DetectionType# initialize the quotient clientquotient = QuotientAI()# initialize the loggerquotient.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 eventresponse = 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)
4
Run the Script
Using your API key, run the script to create your first log:
Copy
Ask AI
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 or document relevancy evaluations.
6
Analyze and Improve
Use the Detections Dashboard to:
Track hallucinations in your LLM responses
Evaluate document relevancy for your retrieval system
Analyze attribution between responses and source documents
Calculate hallucination rates across different environments