Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Gaussia

PyPI version PyPI - Python Version PyPI - Downloads PyPI - License

AI evaluation framework for measuring fairness, quality, and safety of AI models and assistants.

Installation

pip install gaussia

With specific metric dependencies:

pip install gaussia[toxicity]              # Toxicity analysis
pip install gaussia[bias]                  # Bias detection
pip install gaussia[privacy-presidio]      # Privacy with the Presidio detector
pip install gaussia[privacy-huggingface]   # Privacy with a HuggingFace NER detector
pip install gaussia[evalhub]               # EvalHub provider adapter
pip install gaussia[metrics]               # All metrics
pip install gaussia[all]                   # Everything

Roast Me ships its own extras, deliberately outside metrics and all, so whoever only profiles an assistant pays for neither retrieval nor training:

pip install gaussia[roastme]      # The three corpus-reading probe engines
pip install gaussia[roastme-rl]   # The above, plus the reinforcement-learning search

Most metrics judge with a LangChain-compatible chat model, which you install separately: langchain-openai, langchain-anthropic, langchain-google-genai, langchain-groq, langchain-ollama.

Quick Start

from gaussia import Retriever, Dataset, Batch
from gaussia.metrics.context import Context
from langchain_openai import ChatOpenAI

# 1. Define your data source
class MyRetriever(Retriever):
    def load_dataset(self) -> list[Dataset]:
        return [
            Dataset(
                session_id="session-1",
                assistant_id="assistant-1",
                language="en",
                context="France is a country in Western Europe.",
                conversation=[
                    Batch(
                        qa_id="q1",
                        query="Where is France?",
                        assistant="France is located in Western Europe.",
                        ground_truth_assistant="France is a country in Western Europe.",
                    )
                ],
            )
        ]

# 2. Run a metric. `run` takes the retriever *class* and instantiates it for you.
metrics = Context.run(MyRetriever, model=ChatOpenAI(model="gpt-4o-mini", temperature=0.0))

Metrics are imported from their own modules — gaussia.metrics declares the surface but imports nothing, so no metric drags in another's optional dependencies.

Metrics

Metric Description Install extra
Context Evaluates response alignment with provided context —
Conversational Dialogue quality via Grice's maxims (memory, language, quality, quantity, relation, manner) —
BestOf King-of-the-hill tournament comparison of multiple assistants —
Agentic Agent evaluation with pass@K and tool correctness —
Escalation Whether a case reached a person when the policy required it, and stayed with the assistant when it did not —
ForbiddenAction Whether a tool-using assistant executed a tool the oversight policy forbids, with one incident per call —
RoleAdherence Whether the assistant stays inside its defined role, scored from judge first-token logprobs —
Substitution Whether an approved action ran with the parameters the person approved, compared by declared type —
Toxicity Cluster-based toxicity profiling with demographic and sentiment analysis [toxicity]
Bias Bias detection across protected attributes using guardians [bias]
Privacy Domain-adjusted detection score rating one PII/PHI detector's fitness for a regulated domain [privacy-presidio] / [privacy-huggingface]
PrivacyRanker The same score across several detectors, ranked, to decide which one to ship [privacy-presidio] / [privacy-huggingface]
Humanity Emotion, empathy, and human-like quality analysis [humanity]
Regulatory Compliance evaluation against regulatory documents [regulatory]
VisionSimilarity VLM description comparison via semantic similarity [vision]
VisionHallucination Hallucination detection in VLM outputs [vision]

Features

Guardians

Pluggable bias detection backends. The guardian is passed as a class, like the retriever:

from gaussia.guardians import IBMGranite, LLamaGuard
from gaussia.metrics.bias import Bias

metrics = Bias.run(MyRetriever, guardian=IBMGranite)

PII Detectors

Pluggable detection backends behind the PIIDetector contract, the same way guardians sit behind Guardian. A detector carries the expert [0, 1] scalars that place it in your domain, so it is passed as an instance:

from gaussia.detectors.presidio import PresidioDetector
from gaussia.metrics.privacy import Privacy
from gaussia.schemas.privacy import PrivacyDomainConfig

domain = PrivacyDomainConfig(
    classes=frozenset({"email_address", "phone_number"}),
    criticality_weights={"email_address": 0.6, "phone_number": 0.4},
    fn_severity_weights={"email_address": 0.7, "phone_number": 0.3},
    regulatory_framework="GDPR",
)
detector = PresidioDetector(name="presidio", domain_fit=0.9, regulatory_fit=0.8)

metrics = Privacy.run(MyRetriever, detector=detector, domain_config=domain)

PrivacyRanker takes detectors=[...] instead and ranks them under the same domain config.

Role Adherence

Whether the assistant stayed in the role it was given, scored per turn and aggregated per session. The judge derives a calibrated [0, 1] score from first-token logprobs, so it needs a provider that exposes them — StructuredOutputJudgeStrategy is the fallback for providers that do not:

from gaussia.metrics.role_adherence import RoleAdherence, LLMJudgeStrategy
from langchain_openai import ChatOpenAI

strategy = LLMJudgeStrategy(model=ChatOpenAI(model="gpt-4o-mini"))
metrics = RoleAdherence.run(MyRetriever, scoring_strategy=strategy)

Statistical Modes

Choose between frequentist and Bayesian aggregation:

from gaussia import FrequentistMode, BayesianMode
from gaussia.metrics.context import Context

metrics = Context.run(MyRetriever, model=judge, statistical_mode=FrequentistMode())
metrics = Context.run(MyRetriever, model=judge, statistical_mode=BayesianMode())

Synthetic Data Generation

Generate evaluation datasets from documents:

from gaussia.generators import BaseGenerator, create_markdown_loader
from langchain_openai import ChatOpenAI

generator = BaseGenerator(model=ChatOpenAI(model="gpt-4o-mini"))
loader = create_markdown_loader()

datasets = await generator.generate_dataset(
    context_loader=loader,
    source="./docs/knowledge_base.md",
    assistant_id="my-assistant",
)

Roast Me

Adversarial evaluation as a search problem: profile an assistant's weaknesses from tagged probes, then look for the categories of realistic question that break it reproducibly. A generator subsystem, not a metric — nothing subclasses Gaussia. What enters the metric pipeline is the Roast Dataset it emits, which existing metrics consume unchanged.

from gaussia.generators.roastme import ProbeLibrary, Profiler, to_dataset

probes = ProbeLibrary(engines).generate(documents, catalogue)
result = Profiler(contract=contract, target=your_adapter).profile(probes)

dataset = to_dataset(
    probes,
    result.outcomes,
    session_id="roast-run-1",
    assistant_id="support-assistant",
    context="Roast Me run over the policy knowledge base",
)

Every number Roast Me produces is a judge-only measurement: one language model's estimate of whether another one misbehaved. No grader here has been calibrated against human labels, so read a violation rate as evidence to look at, never as a measured error rate.

Explainability

Token-level attribution analysis. The method is a class, not a string:

from transformers import AutoModelForCausalLM, AutoTokenizer
from gaussia.explainability import AttributionExplainer, Lime

model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3-0.6B")
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen3-0.6B")

explainer = AttributionExplainer(model, tokenizer)
result = explainer.explain(
    prompt=tokenizer.apply_chat_template([{"role": "user", "content": "What is gravity?"}], tokenize=False),
    target="Gravity is the force of attraction between objects.",
    method=Lime,
)
print(result.get_top_k(5))

Prompt Optimization

Optimize prompts using evolutionary and multi-objective strategies:

from gaussia.prompt_optimizer import GEPAOptimizer, MIPROv2Optimizer

EvalHub Provider

Run Gaussia as an EvalHub BYOF provider:

python -m gaussia.integrations.evalhub.adapter

Documentation

Full documentation available at docs.gaussia.ai.

Requirements

  • Python >= 3.11

License

MIT

Metadata

Release files for gaussia 1.3.0b3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gaussia 1.3.0b3
File Size Uploaded Provenance Actions
gaussia-1.3.0b3.tar.gz 926.1 kB Without provenance Details for gaussia-1.3.0b3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gaussia 1.3.0b3
File Interpreter ABI Platform Actions
gaussia-1.3.0b3-py3-none-any.whl Python 3 none any Details for gaussia-1.3.0b3-py3-none-any.whl

Total release size: 1.9 MB

Release files / gaussia-1.3.0b3.tar.gz

Download URL gaussia-1.3.0b3.tar.gz
Size 926.1 kB
Tags Source
SHA-256 checksum
How to use checksums
fcaaac24bd97e3e36e5844b10ad9a80f7c262aa14ca87f2b92a0c7ec81d70602
BLAKE2b-256 checksum
How to use checksums
1ab2ec92824d1c1c605ea194f60069aa855c0bd0e18c2f93661c106177fcb76e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / gaussia-1.3.0b3-py3-none-any.whl

Download URL gaussia-1.3.0b3-py3-none-any.whl
Size 998.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
46708128acb11308e5d0a8e3828c6630d7259ffbdb684864650e930ae307e50c
BLAKE2b-256 checksum
How to use checksums
2c11fd29ed1b9705e96149b348bd32a0efb76e77f5ab1178440c34b9b7b8bd62
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for gaussia 1.3.0b3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page