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.5.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.5-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aluora-1.0.5.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.5.tar.gz
Algorithm Hash digest
SHA256 3d67a7227f3758d3fcc0debd68caa2c44ddc7e2d38471127adb5a91a71629817
MD5 9e80b79356949d602c850f6a9358701a
BLAKE2b-256 19d31563668337eb7a4989d8644429d15b323e932318b2d3dfd3160cfee3cfec

See more details on using hashes here.

File details

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

File metadata

  • Download URL: aluora-1.0.5-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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 919f04c9dbd91198eb5dc63a748391b9ac058891bb6cf933f22e36284d5e33ee
MD5 c678976b10786bcea2baf0ba867bd617
BLAKE2b-256 d4935685357393364dcfaab0c209d561e47aa21f494dce558f26db721986851c

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