feat: add persistent model-aware reasoning effort settings

This commit is contained in:
2026-11-15 18:45:22 -08:00
parent 91c7c0310e
commit 92a16a39c0
22 changed files with 678 additions and 36 deletions
+7 -3
View File
@@ -58,7 +58,8 @@ Web presentation note: `/lite` uses these same chat streams and existing search
"additionalSystemPrompt": "optional one-off system prompt",
"enabledTools": ["web_search", "fetch_url"],
"temperature": 0.2,
"maxTokens": 256
"maxTokens": 256,
"reasoningEffort": null
}
```
@@ -73,6 +74,8 @@ Notes:
- For persisted streams, backend stores only new non-assistant input history rows to avoid duplicates.
- `additionalSystemPrompt`, when present directly or loaded from stored chat settings, is prepended to the provider request as a `system` message and is not inserted into the persisted chat transcript by this endpoint.
- `enabledTools` limits Sybil-managed tools for this request. When omitted for a saved chat, the stored chat setting is used; otherwise all available tools are enabled by default. An empty array disables Sybil-managed tools.
- Optional `reasoningEffort` accepts `null` or `none|minimal|low|medium|high|xhigh|max`. Load the selected provider/model's supported levels from `GET /v1/models` → `reasoningCapabilities` ([REST contract](./rest.md#models)). Omission inherits the chat's saved effort only for the exact same provider/model; `null` explicitly selects Model default. Unknown models and unsupported combinations normalize to `null`; invalid enum strings are rejected. The backend omits the effort parameter for Model default and unsupported combinations, letting the provider choose its model-specific default. `"none"` is an explicit setting and differs from `null`.
- Ordinary persisted streams save the effective effort with the last-used provider/model. Non-persistent streams and Quick Questions do not save it. Inline `@sybil` turns use the separate Agent settings. OpenAI Responses requests use `reasoning: { effort }`, and Chat Completions requests use `reasoning_effort`, including subsequent tool rounds. Explicit reasoning efforts other than `none` omit `temperature`; allowlisted reasoning models use Chat Completions `max_completion_tokens` for `maxTokens`. SSE event shapes are unchanged.
- `maxTokens` is optional. For `anthropic`, when omitted the backend requests the selected model's maximum output token limit from Anthropic's Models API and uses that as `max_tokens`; if the model limit cannot be loaded, the fallback is 128000. For other providers, omitted `maxTokens` is not sent as an explicit cap.
- Attachments are optional and are persisted under `message.metadata.attachments` on stored user messages when `persist` is `true`.
- For a persisted ordinary chat, a literal case-insensitive `@sybil` token in the latest user message invokes the existing persistent Sybil Agent instead of the selected provider. Email addresses, code spans/fences, indented code, and Markdown quote lines do not trigger it. The visible user message and inline Agent reply remain in the ordinary chat and are marked with backend-owned `metadata.agentAside`; the backend excludes both from later selected-provider context without deleting the visible rows. This routing does not apply to the special Agent tab or Quick Questions.
@@ -112,7 +115,8 @@ Request body:
"enabledTools": ["web_search", "fetch_url"],
"userLocation": "optional city, region, country",
"temperature": 0.2,
"maxTokens": 256
"maxTokens": 256,
"reasoningEffort": null
}
```
@@ -122,7 +126,7 @@ Behavior notes:
- The server prepends a Quick Question system prompt that asks for a succinct, direct, self-contained answer without follow-up questions. Clients do not send or maintain this prompt.
- Quick Questions are always non-persistent. The endpoint does not create a chat or store messages, tool-call logs, assistant output, or `LlmCall` metadata.
- The response uses the same `meta`, `tool_call`, `delta`, `done`, and `error` SSE events as chat completion streams. The `meta` event has `chatId: null` and `callId: null`.
- `enabledTools`, `temperature`, and `maxTokens` are optional and behave as they do for chat completion streams. When `enabledTools` is omitted, all available Sybil-managed tools are enabled by default.
- `enabledTools`, `temperature`, `maxTokens`, and `reasoningEffort` are optional and behave as they do for chat completion streams. When `enabledTools` is omitted, all available Sybil-managed tools are enabled by default. Omitted/null `reasoningEffort` uses the model default; Quick Questions never inherit ordinary chat settings. Existing Quick Question clients omit it.
- User location is inferred from the same request headers as chat completion streams when `userLocation` is omitted.
## Event Stream Contract