From 994a82dc7f414e6b98ac17a6170d36dcdaefb4fb Mon Sep 17 00:00:00 2001 From: yangdx Date: Wed, 5 Nov 2025 18:25:28 +0800 Subject: [PATCH] Suppress token usage warnings for custom OpenAI-compatible endpoints MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Add warning filter for token usage • Support vLLM, SGLang endpoints • Non-critical for RAGAS evaluation --- lightrag/evaluation/eval_rag_quality.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lightrag/evaluation/eval_rag_quality.py b/lightrag/evaluation/eval_rag_quality.py index e1b04005..dfc89019 100644 --- a/lightrag/evaluation/eval_rag_quality.py +++ b/lightrag/evaluation/eval_rag_quality.py @@ -62,6 +62,15 @@ warnings.filterwarnings( category=DeprecationWarning, ) +# Suppress token usage warning for custom OpenAI-compatible endpoints +# Custom endpoints (vLLM, SGLang, etc.) often don't return usage information +# This is non-critical as token tracking is not required for RAGAS evaluation +warnings.filterwarnings( + "ignore", + message=".*Unexpected type for token usage.*", + category=UserWarning, +) + # Add parent directory to path sys.path.insert(0, str(Path(__file__).parent.parent.parent))