Skip to main content

Librería para detectar alucinaciones

Project description

Aluora

Aluora is a Python library for hallucination detection in text generated by large language models (LLMs). It integrates multiple detection methods to assess the risk that a given response is unsupported or fabricated relative to its context and question.

🔍 Features

  • HalluDetect: Dropout-based DenseNet model with MC Dropout and mutual information for uncertainty estimation.
  • HHEM: Semantic consistency scoring using a pretrained transformer classifier.
  • LettuceDetect: Span-level hallucination detection using contextual lexical evaluatio
  • JSON Output for structured evaluation results.

Installation

pip install aluora

Example Usage

from Aluora.core.extractor import hallucination_metrics

hallucination_metrics(
    context="The robot was built in 2023.",
    question="When was the robot built?",
    answer="The robot was built in 2023.",
    output_json_path="results.json"  # path to save output as JSON
)

Output Structure

{
  "halludetect": {
    "predicted_class": 0,
    "label": "Hallucination",
    "probability_class_1": 0.15,
    "mutual_information": 0.08
  },
  "hhem": {
    "prob_no_hallucination": 0.02,
    "risk_level": "HIGH"
  },
  "lettuce": {
    "detected_spans": [...],
    "estimated_risk": "MEDIUM"
  }
}

License

MIT License

Author

Pedro Sarmiento — GitHub

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

aluora-1.0.6.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

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

aluora-1.0.6-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file aluora-1.0.6.tar.gz.

File metadata

  • Download URL: aluora-1.0.6.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for aluora-1.0.6.tar.gz
Algorithm Hash digest
SHA256 d44442814530c920c42e77fcbe0366dd646d35f1e4cbbd1d34f31471138b55be
MD5 9df65fbe3bc896640f33c4bfd7b714e5
BLAKE2b-256 3856f3cdeb9a257c570f764a3be31a8b00197fc9a3eb143b46a2ef99439ab5d2

See more details on using hashes here.

File details

Details for the file aluora-1.0.6-py3-none-any.whl.

File metadata

  • Download URL: aluora-1.0.6-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for aluora-1.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 c1c552b7c1bc5b75c7ce3022deb6acc2cc9ef716112feeb2de8513f95e8290c3
MD5 955de1f3756a67d3442ba67088f2981a
BLAKE2b-256 d8e4ec4eb4985cdf26ef4267ccc80119fe26d66bbce60110fbf3ea28eaf5e119

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