On a reasoning model the reasoning is spent from the same completion budget
and it goes first, so a small ceiling truncates the actual reply away. It
fails silently and looks exactly like a model that cannot follow the system
prompt, which is the expensive way to debug it.
Measured on gpt-oss-20b against the real ~3.5k-token system prompt, same
prompt and same model, only the ceiling changing:
1400 an empty string, 0 bytes, after 27s
2048 a truncated half-Korean fragment, none of the required blocks
8000 99% English prose, no romanization, 0 batchim violations in the
task lines, all three blocks, 11s
The old comment justified 2048 by worrying about 4k-context local models.
That reasoning was wrong: the system prompt alone is ~3.5k tokens, so such
a model cannot run this app at all and there was nothing to protect.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
40 lines
1.7 KiB
Plaintext
40 lines
1.7 KiB
Plaintext
# Copy to .env and fill in. Never commit .env.
|
|
|
|
# The `hankan` database in your existing Postgres. `postgres` here is the
|
|
# service name on the shared docker network, not a hostname on the Pi.
|
|
DATABASE_URL=postgres://hankan:CHANGE_ME@postgres:5432/hankan
|
|
|
|
# Shared secret between the app and this server. Generate one:
|
|
# openssl rand -base64 32
|
|
HANKAN_TOKEN=CHANGE_ME
|
|
|
|
# Which model serves the tutor: anthropic (default) | openai | echo.
|
|
# Omit the whole tutor config and sync still works — the app falls back to
|
|
# its local stand-in tutor.
|
|
HANKAN_TUTOR_BACKEND=anthropic
|
|
|
|
# For HANKAN_TUTOR_BACKEND=anthropic.
|
|
ANTHROPIC_API_KEY=
|
|
|
|
# For HANKAN_TUTOR_BACKEND=openai — anything speaking /chat/completions:
|
|
# LM Studio, Ollama, llama.cpp, vLLM, LiteLLM, OpenRouter, OpenAI.
|
|
# From a container, localhost is the container: use the host's LAN address
|
|
# or host.docker.internal, not 127.0.0.1.
|
|
# LM Studio http://<host>:1234/v1 model = the id shown in its UI
|
|
# Ollama http://<host>:11434/v1 model = e.g. qwen2.5:14b
|
|
# llama.cpp http://<host>:8080/v1
|
|
# OpenRouter https://openrouter.ai/api/v1
|
|
HANKAN_OPENAI_BASE_URL=http://host.docker.internal:1234/v1
|
|
HANKAN_OPENAI_MODEL=local-model
|
|
# Local servers ignore this; hosted ones require it. Leave blank for local.
|
|
HANKAN_OPENAI_API_KEY=
|
|
# Completion ceiling. Do not lower this much: on a reasoning model the
|
|
# reasoning comes out of the same budget and goes first, so a small value
|
|
# truncates the actual lesson away. gpt-oss-20b returns an empty string at
|
|
# 1400 and a broken half-Korean fragment at 2048.
|
|
HANKAN_OPENAI_MAX_TOKENS=8192
|
|
|
|
# The docker network your existing Postgres and Caddy are on.
|
|
# docker network ls
|
|
HANKAN_NETWORK=caddy_default
|