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.4.tar.gz (6.4 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.4-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aluora-1.0.4.tar.gz
  • Upload date:
  • Size: 6.4 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.4.tar.gz
Algorithm Hash digest
SHA256 7a0d11496ed9e3220ff3704e30f5db47e1b9b36b1aa6eede2c5b9f7a6e227d96
MD5 8751dcb90341e5413a1c4a03dc23f704
BLAKE2b-256 3a7b9fd7c8544df535236ef685f5f177b58500fb34e9815bea73c12e2c138c74

See more details on using hashes here.

File details

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

File metadata

  • Download URL: aluora-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 7.2 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 d486f5cc61f6b19209071049a165545a3b3319a522855909d085dcc512a512af
MD5 6ead4a7861cf397d869dde2211aff993
BLAKE2b-256 4167b6e0bc56be02a24f5f4431c6e364b58c54fa51529a03f57d6a79acf95097

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