Skip to content

Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.

fix: guard against empty choices and message=None in LLM response

Your Name5deffbd769c6
diff --git a/dataset/qa_dataset.py b/dataset/qa_dataset.py
index 45f8265bb..df4ee5229 100644
--- a/dataset/qa_dataset.py
+++ b/dataset/qa_dataset.py
@@ -177,6 +177,8 @@ Answer:"""
messages=[{"role": "user", "content": prompt}],
temperature=0.3,
)
+ if not response.choices or response.choices[0].message is None:
+ raise ValueError("LLM returned empty or filtered response")
return response.choices[0].message.content