|
| 1 | +--- |
| 2 | +title: "Overview" |
| 3 | +description: "Understand how Quotient detections work and how to enable them in your logging pipeline." |
| 4 | +icon: "eye" |
| 5 | +--- |
| 6 | + |
| 7 | +<CardGroup> |
| 8 | + <Card title="Initialize the Logger" icon="chevron-right" href="#initialize-the-logger-with-detections"> |
| 9 | + Configure detection types and sampling without leaving this page. |
| 10 | + </Card> |
| 11 | + <Card title="Hallucination Detection" icon="flag" href="/tools/detections/hallucination-detection"> |
| 12 | + See how Quotient scores extrinsic hallucinations. |
| 13 | + </Card> |
| 14 | + <Card title="Document Relevance" icon="bug" href="/tools/detections/document-relevance"> |
| 15 | + Measure whether retrieved documents support an answer. |
| 16 | + </Card> |
| 17 | + <Card title="Polling & Results" icon="clock" href="/tools/detections/polling-and-results-api"> |
| 18 | + Retrieve detection results via the SDK. |
| 19 | + </Card> |
| 20 | +</CardGroup> |
| 21 | + |
| 22 | +# What are Detections? |
| 23 | + |
| 24 | +Detections are asynchronous analyses that run whenever you ship logs or traces to Quotient. They continuously score outputs for hallucinations, document relevance, and other reliability risks so you can intervene before they impact users. |
| 25 | + |
| 26 | +Once configured, detections execute in the background. You can review outcomes in the dashboard or poll for them programmatically. |
| 27 | + |
| 28 | +## Why enable detections |
| 29 | + |
| 30 | +- **Catch issues fast:** surface hallucinations or irrelevant context without manually reviewing transcripts. |
| 31 | +- **Quantify reliability:** trend hallucination rate and document relevance over time or by tag. |
| 32 | +- **Prioritize fixes:** combine detection scores with tags (model version, customer tier) to see where to invest engineering time. |
| 33 | + |
| 34 | +<Tip> |
| 35 | + Keep `detection_sample_rate` high during development to observe every interaction. Dial it down in production once metrics stabilize. |
| 36 | +</Tip> |
| 37 | + |
| 38 | +## Configure detections in three steps |
| 39 | + |
| 40 | +1. **Initialize the logger** with the detection types and sample rate that make sense for your workload. |
| 41 | +2. **Send logs or traces** that include the user prompt, model output, and supporting evidence. |
| 42 | +3. **Review the results** in the dashboard or via the SDK once detections finish processing. |
| 43 | + |
| 44 | +# Initialize the Logger with Detections |
| 45 | + |
| 46 | +Enable detections during logger initialization: |
| 47 | + |
| 48 | +<CodeGroup> |
| 49 | + |
| 50 | +```python logging.py |
| 51 | +from quotientai import QuotientAI, DetectionType |
| 52 | + |
| 53 | +quotient = QuotientAI(api_key="your-quotient-api-key") |
| 54 | + |
| 55 | +logger = quotient.logger.init( |
| 56 | + app_name="my-first-app", |
| 57 | + environment="dev", |
| 58 | + sample_rate=1.0, |
| 59 | + # automatically run hallucination and document relevance detection on every output |
| 60 | + detections=[DetectionType.HALLUCINATION, DetectionType.DOCUMENT_RELEVANCY], |
| 61 | + detection_sample_rate=1.0, |
| 62 | +) |
| 63 | +``` |
| 64 | + |
| 65 | +```typescript logging.ts |
| 66 | +import { QuotientAI, DetectionType } from "quotientai"; |
| 67 | + |
| 68 | +const quotient = new QuotientAI({ apiKey: "your-quotient-api-key" }); |
| 69 | + |
| 70 | +const logger = quotient.logger.init({ |
| 71 | + appName: "my-first-app", |
| 72 | + environment: "dev", |
| 73 | + sampleRate: 1.0, |
| 74 | + // automatically run hallucination and document relevance detection on every output |
| 75 | + detections: [DetectionType.HALLUCINATION, DetectionType.DOCUMENT_RELEVANCY], |
| 76 | + detectionSampleRate: 1.0, |
| 77 | +}); |
| 78 | +``` |
| 79 | + |
| 80 | +</CodeGroup> |
| 81 | + |
| 82 | +# Send logs with detections enabled |
| 83 | + |
| 84 | +After initialization, send logs that include the user query, model output, and any documents, instructions, or message history you want Quotient to evaluate. |
| 85 | + |
| 86 | +<CodeGroup> |
| 87 | + |
| 88 | +```python logging.py |
| 89 | +log_id = quotient.log( |
| 90 | + user_query="What is the capital of France?", |
| 91 | + model_output="The capital of France is Paris.", |
| 92 | + documents=[ |
| 93 | + "France is a country in Western Europe.", |
| 94 | + "Paris is the capital of France.", |
| 95 | + ], |
| 96 | +) |
| 97 | +``` |
| 98 | + |
| 99 | +```typescript logging.ts |
| 100 | +const logId = await quotient.log({ |
| 101 | + userQuery: "What is the capital of France?", |
| 102 | + modelOutput: "The capital of France is Paris.", |
| 103 | + documents: ["France is a country in Western Europe.", "Paris is the capital of France."], |
| 104 | +}); |
| 105 | +``` |
| 106 | + |
| 107 | +</CodeGroup> |
| 108 | + |
| 109 | +# Interpret detection outcomes |
| 110 | + |
| 111 | +Each detection result is attached to the originating log. In the dashboard you can: |
| 112 | + |
| 113 | +- Inspect hallucination highlights and see which sentences lack evidence. |
| 114 | +- Review document relevance scores to spot noisy retrieval results. |
| 115 | +- Filter by tags (environment, customer, model) to zero in on problematic slices. |
| 116 | + |
| 117 | +Head to the [Detections Dashboard](https://app.quotientai.co/detections) to review results, export findings, or share links with teammates. |
| 118 | + |
| 119 | +<Tip> |
| 120 | + Combine detections with [Reports](/tools/reports) to move from single-log triage to trend analysis. |
| 121 | +</Tip> |
| 122 | + |
| 123 | + |
| 124 | + |
| 125 | +Continue with [Hallucination Detection](./hallucination-detection). |
0 commit comments