DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.
Python ai-agentsai-tutorclawbotcli-tooldeepresearchinteractive-learninglearningmulti-agent-systemsrag
feat(diagnostics): make LLM probe max_tokens configurable via env
Roman Barlos245d6ca16029
diff --git a/.env.example b/.env.exampleindex 4696fdd09..0cb750aa2 100644--- a/.env.example+++ b/.env.example@@ -19,6 +19,10 @@ LLM_MODEL=gpt-4o-miniLLM_API_KEY=sk-xxxLLM_HOST=https://api.openai.com/v1LLM_API_VERSION=+# Max completion tokens used by the Settings → LLM diagnostic probe.+# Bump this if you point the probe at a reasoning model (thinking tokens+# eat into the budget and empty out the visible response otherwise).+LLM_TEST_MAX_TOKENS=1024# --------------------------------------------# Embedding (Required for knowledge base features)diff --git a/deeptutor/services/config/test_runner.py b/deeptutor/services/config/test_runner.pyindex 164165077..16457b138 100644--- a/deeptutor/services/config/test_runner.py+++ b/deeptutor/services/config/test_runner.py@@ -155,7 +155,14 @@ class ConfigTestRunner:)run.emit("info", f"Resolved model `{llm_config.model}` with binding `{llm_config.binding}`.")run.emit("info", f"Request target: {llm_config.base_url}")- token_kwargs = get_token_limit_kwargs(llm_config.model, max_tokens=200)+ # Reasoning models spend part of the budget on internal thinking;+ # too tight a cap makes them return empty content. Override via+ # LLM_TEST_MAX_TOKENS when the default (1024) isn't enough.+ try:+ max_tokens = max(1, int(os.getenv("LLM_TEST_MAX_TOKENS", "1024")))+ except ValueError:+ max_tokens = 1024+ token_kwargs = get_token_limit_kwargs(llm_config.model, max_tokens=max_tokens)run.emit("info", f"Token options: {json.dumps(token_kwargs)}")response = await llm_complete(model=llm_config.model,diff --git a/docker-compose.yml b/docker-compose.ymlindex 6345115d0..509721eb6 100644--- a/docker-compose.yml+++ b/docker-compose.yml@@ -42,6 +42,7 @@ services:- LLM_API_KEY=${LLM_API_KEY}- LLM_HOST=${LLM_HOST}- LLM_API_VERSION=${LLM_API_VERSION:-}+ - LLM_TEST_MAX_TOKENS=${LLM_TEST_MAX_TOKENS:-1024}- DISABLE_SSL_VERIFY=${DISABLE_SSL_VERIFY:-false}# Embedding Configuration (Required for Knowledge Base)- EMBEDDING_BINDING=${EMBEDDING_BINDING:-openai}