Skip to main content

CLI for evaluating large language models with Quotient

Project description

quotientai

PyPI version

Overview

quotientai is an SDK and CLI built to manage artifacts (prompts, datasets), and run evaluations on Quotient.

Installation

pip install quotientai

Usage

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.

Examples

Create a prompt:

from quotientai import QuotientAI

quotient = QuotientAI()

new_prompt = quotient.prompts.create(
    name="customer-support-inquiry"
    system_prompt="You are a helpful assistant.",
    user_prompt="How can I assist you today?"
)

print(new_prompt)

Create a dataset:

from quotientai import QuotientAI

quotient = QuotientAI()

new_dataset = quotient.datasets.create(
    name="my-sample-dataset"
    description="My first dataset",
    rows=[
        {"input": "Sample input", "expected": "Sample output"},
        {"input": "Another input", "expected": "Another output"}
    ]
)

print(new_dataset)

Create a log with hallucination detection: Log an event with hallucination detection. This will create a log event in Quotient and perform hallucination detection on the model output, input, and documents. This is a fire and forget operation, so it will not block the execution of your code.

Additional examples can be found in the examples directory.

from quotientai import QuotientAI

quotient = QuotientAI()
quotient_logger = quotient.logger.init(
    # Required
    app_name="my-app",
    environment="dev",
    # dynamic labels for slicing/dicing analytics e.g. by customer, feature, etc
    tags={"model": "gpt-4o", "feature": "customer-support"},
    hallucination_detection=True,
    inconsistency_detection=True,
)

quotient_logger.log(
    model_input="Sample input",
    model_output="Sample output",
    # Documents from your retriever used to generate the model output
    documents=[{"page_content": "Sample document"}], 
    # optional additional context to help with hallucination detection, e.g. rules, constraints, etc
    contexts=["Sample context"], 
)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

quotientai-0.1.4.tar.gz (18.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

quotientai-0.1.4-py3-none-any.whl (22.3 kB view details)

Uploaded Python 3

File details

Details for the file quotientai-0.1.4.tar.gz.

File metadata

  • Download URL: quotientai-0.1.4.tar.gz
  • Upload date:
  • Size: 18.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for quotientai-0.1.4.tar.gz
Algorithm Hash digest
SHA256 da3f967c6c61a309d9517d08fe1a425666a84c3e2537855869f101702c991bcb
MD5 ada43f36cb5ae811ba392f54fe8eabe7
BLAKE2b-256 9ceb6b4411f2175d2a43e64c781be5d8c29917c808045dde330a5a6f1b0184e6

See more details on using hashes here.

File details

Details for the file quotientai-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: quotientai-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 22.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for quotientai-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 335d2b563604de53b511c1b9c5e2b54a191a5254382d11401d0bacc523ccaa4a
MD5 cd6727280975d3cec08581faa4396072
BLAKE2b-256 ba594784028005ff814d58b518f2c4046b822f8f7fe5a73c545befe9458b2dfc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page