Skip to content

quotient-ai/quotient-typescript

Repository files navigation

quotientai

npm version

Overview

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.

Installation

npm install quotientai

Usage

Logging and Hallucination Detection

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);

Docs

For comprehensive documentation, please visit our docs.

About

Quotient TypeScript Client

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •