Views
No views yet
1import sys
2sys.path.insert(0, "LettuceDetect") # clone from github.com/KRLabsOrg/LettuceDetect
3from lettucedetect.models.inference import HallucinationDetector
4
5detector = HallucinationDetector(
6 method="transformer",
7 model_path="ssurface/tool-calling-hallucination-modernbert-large-glaive-100pct",
8)
9
10# Single example
11result = detector.predict(
12 context="{"name": "get_weather", "results": {"temp": 72, "city": "NYC"}}",
13 question="What is the weather in NYC?",
14 answer="The temperature in NYC is 85°F.", # hallucinated — model said 72
15)
16print(result)
17# [({'start': 34, 'end': 39, 'label': 'hallucination'})]1python scripts/evaluate_model.py \
2 --model ssurface/tool-calling-hallucination-modernbert-large-glaive-100pct \
3 --data lettucedetect_data/tool_calling_hallucination.json \
4 --split test --by-type1python LettuceDetect/scripts/train.py \
2 --ragtruth-path lettucedetect_data/tool_calling_hallucination.json \
3 --model-name answerdotai/ModernBERT-large \
4 --output-dir results/ \
5 --batch-size 1 --grad-accum 8 \
6 --epochs 6 --learning-rate 1e-5