From dc699b67ef692c628c72fc1c1d2effc9584c55ac Mon Sep 17 00:00:00 2001 From: GGrassia Date: Fri, 28 Nov 2025 16:06:49 +0100 Subject: [PATCH] fix (token_tracker): removed all duplications --- lightrag/api/lightrag_server.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lightrag/api/lightrag_server.py b/lightrag/api/lightrag_server.py index 99316ba3..e0f45cbd 100644 --- a/lightrag/api/lightrag_server.py +++ b/lightrag/api/lightrag_server.py @@ -328,6 +328,10 @@ def create_app(args): if config_cache.openai_llm_options: kwargs.update(config_cache.openai_llm_options) + # Remove token_tracker from kwargs if it exists to avoid duplicate argument error + # (we pass it explicitly below) + kwargs.pop("token_tracker", None) + return await openai_complete_if_cache( args.llm_model, prompt, @@ -370,6 +374,10 @@ def create_app(args): kwargs["timeout"] = llm_timeout if config_cache.azure_openai_llm_options: kwargs.update(config_cache.azure_openai_llm_options) + # Remove token_tracker from kwargs if it exists to avoid duplicate argument error + # (we pass it explicitly below) + kwargs.pop("token_tracker", None) + return await azure_openai_complete_if_cache( args.llm_model,