quotientai
is an SDK and CLI for logging data to Quotient, running hallucination and document attribution detections for retrieval and search-augmented AI systems, and automatically tracing AI/ML applications.
npm install quotientai
Create an API key on Quotient and set it as an environment variable called QUOTIENT_API_KEY
. Then follow the examples below or see our docs for a more comprehensive walkthrough.
Send your first log and detect hallucinations. Run the code below and see your Logs and Detections on your Quotient Dashboard.
import { QuotientAI } from 'quotientai';
const quotient = new QuotientAI(apiKey?: string);
// initialize the logger
const quotientLogger = quotient.logger.init({
appName: 'my-app',
environment: 'dev',
sampleRate: 1.0,
hallucinationDetection: true,
hallucinationDetectionSampleRate: 1.0,
});
// create a log
const logId = await quotientLogger.log({
userQuery: 'How do I cook a goose?',
modelOutput: 'The capital of France is Paris',
documents: ['Here is an excellent goose recipe...'],
});
// optionally, you can poll for detection results for further actions
const detectionResults = await quotientLogger.pollForDetections(logId);
For comprehensive documentation, please visit our docs.