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 evaluation.
  • 🧪 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.3.tar.gz (6.5 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.3-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aluora-1.0.3.tar.gz
  • Upload date:
  • Size: 6.5 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.3.tar.gz
Algorithm Hash digest
SHA256 37d7353c1b23b464a604b7ff46fda2d387afbf4274b217146807535274fd6927
MD5 8850baf2f33c599ef82be21744b3ea18
BLAKE2b-256 2c908d2097cddaa8720686379e8275b482e68483bfc11e960e47b9645a4e3ef7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: aluora-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 7.4 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 0b9b66d0fef68070aa6318dd88c5b4e467c6ed2d93afa7379781386dede6a4ca
MD5 07ca4f5ef76d9cb3c069011ef2f8ac0e
BLAKE2b-256 e488a0fca51908b224cdee9ba06dbafe589fd1e5f817f1043d4de3194668c9a8

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