Files
openclaw/docs
SunnyShu d75601478a docs(gateway): document llamacpp toolSchemaProfile for custom llama.cpp endpoints (#117120)
* docs(gateway): document llamacpp toolSchemaProfile for custom llama.cpp endpoints

Custom openai-completions providers pointed at a llama.cpp / llama-server
endpoint bypass the GBNF-safe schema normalization that built-in llama-cpp,
ollama, and lmstudio providers apply automatically. The toolSchemaProfile:
"llamacpp" switch activates it, but the supported value was never named in
the docs, so users hit llama.cpp 400 'failed to parse grammar' on tools with
large minLength/maxLength (e.g. cron trigger.script, maxLength 65536).

- Expand the toolSchemaProfile row to name the values recognized on a model's
  compat (llamacpp, gemini) and when llamacpp must be set explicitly;
  cross-reference the unsupportedToolSchemaKeywords escape hatch.
- Add a 'Local models (llama.cpp / llama-server)' provider example showing
  the required compat.toolSchemaProfile: "llamacpp" on a custom endpoint.

Related to #117070

Co-Authored-By: iCodeMate <noreply@anthropic.com>

* docs(gateway): describe llamacpp profile as stripping, not clamping

Address review feedback on #117120: the fallback sentence claimed the
llamacpp profile "also clamps" constraints, but cleanSchemaForLlamacppGbnf
only removes `pattern` outright and drops `maxLength` at or above the
2000-repetition threshold (LLAMACPP_GBNF_MAX_REPETITION_THRESHOLD). It
never clamps a value, and small bounds like `minLength: 1` are preserved
(confirmed by the projection test at src/plugin-sdk/provider-tools.test.ts).

Reword the escape-hatch sentence to describe the implemented stripping
behavior and contrast it with the unconditional keyword-list drops, so
operators do not expect a preserved bounded constraint.

No code or behavior changes; documentation only.

* docs(gateway): scope llamacpp profile description to its actual transformations

Address follow-up review on #117120: the toolSchemaProfile table row
described `llamacpp` as "rewriting tool schemas into the JSON Schema
subset llama.cpp can compile to GBNF," which overstates what
cleanSchemaForLlamacppGbnf does. The cleaner only removes `pattern`
outright and drops `maxLength` at or above the 2000-repetition threshold
(LLAMACPP_GBNF_MAX_REPETITION_THRESHOLD); it leaves every other keyword
and `minLength` untouched, and those are not guaranteed GBNF-safe.

Reword the row to state the exact transformation contract and explicitly
note it is a targeted compatibility cleaner, not a blanket GBNF-safety
guarantee. No code or behavior changes; documentation only.

Co-Authored-By: iCodeMate <noreply@anthropic.com>

* docs(gateway): tighten llama.cpp profile contract

* docs(gateway): order local model examples

---------

Co-authored-by: iCodeMate <noreply@anthropic.com>
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
2026-08-01 14:11:22 +08:00
..