Skip to content

Commit 08d26ed

Browse files
Merge pull request #833 from yasinBursali/fix/reasoning-token-budget
fix: disable reasoning by default to prevent empty chat responses
2 parents 5728fe9 + fdecb46 commit 08d26ed

5 files changed

Lines changed: 74 additions & 7 deletions

File tree

dream-server/.env.schema.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,21 @@
228228
"description": "Dashboard API authentication key",
229229
"secret": true
230230
},
231+
"DREAM_AGENT_KEY": {
232+
"type": "string",
233+
"description": "API key for the Dream Host Agent (falls back to DASHBOARD_API_KEY if unset)",
234+
"secret": true
235+
},
236+
"APE_API_KEY": {
237+
"type": "string",
238+
"description": "API key for the APE (AI Proxy Engine) extension",
239+
"secret": true
240+
},
241+
"SHIELD_API_KEY": {
242+
"type": "string",
243+
"description": "API key for the Privacy Shield extension",
244+
"secret": true
245+
},
231246
"OPENCODE_SERVER_PASSWORD": {
232247
"type": "string",
233248
"description": "OpenCode web UI authentication password",
@@ -454,6 +469,12 @@
454469
"type": "string",
455470
"description": "GPU UUIDs assigned to llama-server (comma-separated, used by NVIDIA_VISIBLE_DEVICES)"
456471
},
472+
"LLAMA_REASONING": {
473+
"type": "string",
474+
"description": "llama.cpp reasoning/thinking mode: off (default) | auto | on. Off prevents thinking models from consuming the entire token budget on internal reasoning.",
475+
"enum": ["off", "auto", "on"],
476+
"default": "off"
477+
},
457478
"LLAMA_ARG_SPLIT_MODE": {
458479
"type": "string",
459480
"description": "llama.cpp split mode (LLAMA_ARG_SPLIT_MODE): none | layer (pipeline) | row (tensor/hybrid)"

dream-server/docker-compose.base.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ services:
2222
# Serves OpenAI-compatible API on port 8080
2323
# ============================================
2424
llama-server:
25+
image: ${LLAMA_SERVER_IMAGE:-ghcr.io/ggml-org/llama.cpp:server-b8248}
2526
container_name: dream-llama-server
2627
restart: unless-stopped
2728
volumes:
@@ -47,6 +48,8 @@ services:
4748
- --parallel
4849
- "${LLAMA_PARALLEL:-1}"
4950
- --metrics
51+
environment:
52+
- LLAMA_ARG_REASONING=${LLAMA_REASONING:-off}
5053
security_opt:
5154
- no-new-privileges:true
5255
logging: *default-logging

dream-server/installers/macos/dream-macos.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,21 @@ start_native_llama() {
148148

149149
mkdir -p "$(dirname "$LLAMA_SERVER_PID_FILE")"
150150

151+
local reasoning="${ENV_LLAMA_REASONING:-off}"
152+
# Map .env values (off/on/auto) to llama-server --reasoning-format values
153+
local reasoning_fmt
154+
case "$reasoning" in
155+
off) reasoning_fmt="none" ;;
156+
on) reasoning_fmt="deepseek" ;;
157+
*) reasoning_fmt="$reasoning" ;;
158+
esac
159+
151160
"$LLAMA_SERVER_BIN" \
152161
--host 0.0.0.0 --port 8080 \
153162
--model "$model_path" \
154163
--ctx-size "$ctx_size" \
155164
--n-gpu-layers 999 \
165+
--reasoning-format "$reasoning_fmt" \
156166
--metrics \
157167
> "$LLAMA_SERVER_LOG" 2>&1 &
158168
local pid=$!

dream-server/installers/macos/install-macos.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,11 +545,23 @@ else
545545
fi
546546
fi
547547

548+
# Read reasoning mode from .env (default off to prevent thinking models
549+
# from consuming the entire token budget on internal reasoning)
550+
_reasoning=$(grep '^LLAMA_REASONING=' "$INSTALL_DIR/.env" 2>/dev/null | cut -d= -f2 || echo "")
551+
[[ -z "$_reasoning" ]] && _reasoning="off"
552+
# Map .env values (off/on/auto) to llama-server --reasoning-format values
553+
case "$_reasoning" in
554+
off) _reasoning_fmt="none" ;;
555+
on) _reasoning_fmt="deepseek" ;;
556+
*) _reasoning_fmt="$_reasoning" ;;
557+
esac
558+
548559
"$LLAMA_SERVER_BIN" \
549560
--host 0.0.0.0 --port 8080 \
550561
--model "$MODEL_FULL_PATH" \
551562
--ctx-size "$MAX_CONTEXT" \
552563
--n-gpu-layers 999 \
564+
--reasoning-format "$_reasoning_fmt" \
553565
--metrics \
554566
> "$LLAMA_SERVER_LOG" 2>&1 &
555567
LLAMA_PID=$!

dream-server/scripts/bootstrap-upgrade.sh

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -176,16 +176,25 @@ else
176176
fi
177177

178178
# ── Phase 2: Verify integrity (if SHA256 provided) ──
179-
if [[ -n "$FULL_GGUF_SHA256" ]] && command -v sha256sum &>/dev/null; then
179+
if [[ -n "$FULL_GGUF_SHA256" ]]; then
180180
write_status "verifying" 100 "$TOTAL_BYTES" "$TOTAL_BYTES" 0 ""
181181
log "Verifying SHA256..."
182-
ACTUAL_HASH=$(sha256sum "$MODELS_DIR/$FULL_GGUF_FILE" 2>/dev/null | awk '{print $1}')
183-
if [[ "$ACTUAL_HASH" != "$FULL_GGUF_SHA256" ]]; then
184-
rm -f "$MODELS_DIR/$FULL_GGUF_FILE"
185-
write_status "failed"
186-
fail "SHA256 mismatch (expected: $FULL_GGUF_SHA256, got: $ACTUAL_HASH). Deleted corrupt file."
182+
if command -v sha256sum &>/dev/null; then
183+
ACTUAL_HASH=$(sha256sum "$MODELS_DIR/$FULL_GGUF_FILE" 2>/dev/null | awk '{print $1}')
184+
elif command -v shasum &>/dev/null; then
185+
ACTUAL_HASH=$(shasum -a 256 "$MODELS_DIR/$FULL_GGUF_FILE" 2>/dev/null | awk '{print $1}')
186+
else
187+
log "WARNING: No checksum tool available — skipping SHA256 verification"
188+
ACTUAL_HASH=""
189+
fi
190+
if [[ -n "$ACTUAL_HASH" ]]; then
191+
if [[ "$ACTUAL_HASH" != "$FULL_GGUF_SHA256" ]]; then
192+
rm -f "$MODELS_DIR/$FULL_GGUF_FILE"
193+
write_status "failed"
194+
fail "SHA256 mismatch (expected: $FULL_GGUF_SHA256, got: $ACTUAL_HASH). Deleted corrupt file."
195+
fi
196+
log "SHA256 verified"
187197
fi
188-
log "SHA256 verified"
189198
write_status "complete"
190199
fi
191200

@@ -327,13 +336,24 @@ elif [[ -f "$INSTALL_DIR/data/.llama-server.pid" ]]; then
327336
fi
328337
fi
329338

339+
# Read reasoning mode from .env (default off to prevent thinking models
340+
# from consuming the entire token budget on internal reasoning)
341+
_reasoning=$(grep '^LLAMA_REASONING=' "$ENV_FILE" 2>/dev/null | cut -d= -f2 || echo "")
342+
[[ -z "$_reasoning" ]] && _reasoning="off"
343+
case "$_reasoning" in
344+
off) _reasoning_fmt="none" ;;
345+
on) _reasoning_fmt="deepseek" ;;
346+
*) _reasoning_fmt="$_reasoning" ;;
347+
esac
348+
330349
# Relaunch with new model
331350
log "Starting native llama-server with ${_gguf_file}..."
332351
"$LLAMA_SERVER_BIN" \
333352
--host 0.0.0.0 --port 8080 \
334353
--model "$_model_path" \
335354
--ctx-size "$_ctx_size" \
336355
--n-gpu-layers 999 \
356+
--reasoning-format "$_reasoning_fmt" \
337357
--metrics \
338358
> "$LLAMA_SERVER_LOG" 2>&1 &
339359
_new_pid=$!
@@ -365,6 +385,7 @@ elif [[ -f "$INSTALL_DIR/data/.llama-server.pid" ]]; then
365385
--model "$_old_model_path" \
366386
--ctx-size "$_ctx_size" \
367387
--n-gpu-layers 999 \
388+
--reasoning-format "${_reasoning_fmt:-none}" \
368389
--metrics \
369390
> "$LLAMA_SERVER_LOG" 2>&1 &
370391
_rollback_pid=$!

0 commit comments

Comments
 (0)