Raise typed errors from OpenAIClient and BedrockClient
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 68/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- aws, python
- Ambito
- backend-api-design
Direzione di ricerca
Start with lettucedetect/detectors/llm_client.py and tests/test_llm_client_pytest.py; run the pytest command in the issue to see the current behavior. Check how provider exceptions and Bedrock replies are handled, then cover the listed error mappings, causes, and empty response in tests. Done means the mapped errors are raised, caller-owned LLMClient errors remain unwrapped, and the old behavior assertions are updated.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Parent: #156 · Epic: #126 · Blocked by: #138
Branch from stateless_core; open the PR against it.
Problem
Provider failures surface as OpenAI's own exceptions, and an empty Bedrock reply returns "", which parses as "no hallucination found". A service can't tell its misconfiguration from a provider outage.
Current behavior
lettucedetect/detectors/llm_client.py:243OpenAIClient.completeletsopenaiexceptions propagate.llm_client.py:327-328BedrockClient.completelogs "no tool-use block; returning empty result" andreturn "".llm_client.py:230-241OpenAIClient.__init__readsOPENAI_API_KEYandOPENAI_API_BASEand falls back to"EMPTY"(leave as is; the LLM-call layer replaces it).
Steps
- In
OpenAIClient.complete, map authentication and quota errors toConfigurationError(authentication_failed,quota_exceeded) and timeouts, connection errors, rate limits and server errors toUpstreamError(upstream_unavailable). Chain withraise ... from. - In
BedrockClient.complete, raiseUpstreamError(empty_response) when the reply has no tool-use block instead of returning"". - Errors from a caller's own
LLMClientmust propagate unwrapped (no wrapping in detectors). - Don't log and raise the same error.
Acceptance criteria
- Tests with a fake
openaiclient raising each OpenAI error class check the mapped class,codeand__cause__. - A Bedrock reply with no tool call raises
UpstreamError(empty_response); the test usespytest.importorskip("boto3")only if it needs boto3. -
tests/test_llm_client_pytest.pyis updated only where it asserted the old""or raw-exception behavior (an intended change; say so in the PR).
Start here
uv run --extra dev pytest tests/test_llm_client_pytest.py -q
- Lingua principale
- Python
- Stelle
- 615
- Fork
- 60
- Merge medio
- 1g 8h
- PR unite (30g)
- 10
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di KRLabsOrg/LettuceDetect
-
Stop-hook --min-confidence drops every --llm-model span (missing confidence treated as 0.0), reporting hallucinated answers as cleanForse già presa @Clannad47 l’ha presa 18 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
KRLabsOrg/LettuceDetect#117 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
KRLabsOrg/LettuceDetect#108 ·
I maintainer di solito rispondono entro 1 giorno
-
documentation
Difficoltà 2/5 Mezza giornata Idoneità per principianti 70/100
KRLabsOrg/LettuceDetect#104 ·
I maintainer di solito rispondono entro 1 giorno
-
ready-for-agent
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
KRLabsOrg/LettuceDetect#181 ·
I maintainer di solito rispondono entro 1 giorno
-
ready-for-agent
Difficoltà 5/5 Più di una settimana Idoneità per principianti 22/100
KRLabsOrg/LettuceDetect#180 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di KRLabsOrg/LettuceDetect
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
igormcsouza/tether#278 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 91/100
aws-samples/sample-per-model-bedrock#803 ·
I maintainer di solito rispondono entro 1 giorno
-
documentation p1
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
huggingface/accelerate#4511 ·
I maintainer di solito rispondono entro 1 giorno
-
follow-up
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno