Skip to content

feat: assistant-prefill for prompt-based tools, structured output + KV-cache opt-ins - #122

Merged
hellodk merged 6 commits into
masterfrom
feat/prefill-structured-output
Aug 28, 2026
Merged

feat: assistant-prefill for prompt-based tools, structured output + KV-cache opt-ins#122
hellodk merged 6 commits into
masterfrom
feat/prefill-structured-output

Conversation

@hellodk

@hellodk hellodk commented Aug 28, 2026

Copy link
Copy Markdown
Owner

feat: assistant-prefill for prompt-based tools, structured output + KV-cache opt-ins

Prompt-based local models often narrate ('Let me check that file…')
instead of emitting a tool call, wasting a round-trip and polluting
history with fake results. On tool-continuation turns we now append a
trailing assistant seed (the <tool_call> opener plus ) so the
backend begins its next output inside the XML format. If the model
answers with prose instead of completing a call, the seed is stripped
before it reaches history or the UI.

Also adds two per-provider YAML opt-ins:

  • structuredOutput: pins response_format/format json on chat bodies,
    never on tool-call turns (the XML tool prompt needs free text)
  • cachePrompt: sends options.cache_prompt so the backend keeps the
    processed prompt across turns instead of recomputing the full prefix

Closes #121

Tests

  • 18 new tests in test/unit/providers/prefill-structured-output.test.ts
  • Full suite: 1743 passed, 5 skipped (199 files)
  • check-types clean, lint 0 errors (3 pre-existing warnings)

…files, prefill

Adds the full design for removing the legacy champ.* settings layer in favour
of a single guided setup wizard, plus runtime context-window truth, task-aware
decode profiles, and prefill/structured-output workstreams. Ticket map: #118-121.
…d of a hardcoded 8192

Adds a context-window resolver that prioritises the runtime num_ctx from
/api/show parameters and modelfile over model_info defaults, caps the
effective window with providers.<id>.contextWindow from YAML, and threads
that cap through ProviderFactory into every provider config.

Tests: num_ctx precedence, cap semantics, degenerate-value guards.

Closes #119
Adds per-task decode defaults (deterministic tool calls at 0.2, tighter
coding turns, fixed autocomplete seed) with an effective-parameter merge:
explicit request options win, then the YAML providers.<id>.options block,
then the task profile, then built-in defaults.

Backend field mapping: Ollama native options.* (temperature, top_k, min_p,
repeat_penalty, seed, stop), OpenAI-compatible camelCase fields on the
wire. Config schema now validates options.* types and bounds and rejects a
non-integer contextWindow at load time.

Tests: resolver precedence, per-backend request-body mapping, schema
bounds.

Closes #120
Closes #118

The configure-provider command walks provider -> endpoint -> (401?)
API key capture -> live model discovery and merges the result into the
effective .champ/config.yaml via the new merge-preserving writer, then
hot-reloads the provider. Cloud providers with a stored key keep their
current model; self-hosted providers only prompt for a key when the
endpoint probe actually returns 401/403.

configSource is gone: YAML is the single source of truth. The legacy
workspace-settings layer, its champ.* flat keys, and the
createFromConfig() factory path are deleted so there is nowhere left to
fall back to.
…V-cache opt-ins

Prompt-based local models often narrate ('Let me check that file…')
instead of emitting a tool call, wasting a round-trip and polluting
history with fake results. On tool-continuation turns we now append a
trailing assistant seed (the <tool_call> opener plus <name>) so the
backend begins its next output inside the XML format. If the model
answers with prose instead of completing a call, the seed is stripped
before it reaches history or the UI.

Also adds two per-provider YAML opt-ins:
- structuredOutput: pins response_format/format json on chat bodies,
  never on tool-call turns (the XML tool prompt needs free text)
- cachePrompt: sends options.cache_prompt so the backend keeps the
  processed prompt across turns instead of recomputing the full prefix

Closes #121
@hellodk
hellodk merged commit 24203e0 into master Aug 28, 2026
4 of 6 checks passed
@hellodk
hellodk deleted the feat/prefill-structured-output branch August 28, 2026 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Prefill & structured output: tool-call correctness on local models

1 participant