Enforce deterministic gateway task policies

Make the server authoritative for thinking, model, search, tools, retry, and output budgets while preserving legacy client behavior.
This commit is contained in:
Rocky
2026-08-19 20:55:05 +08:00
parent 3edc86a9a0
commit 11ec34dacb
17 changed files with 667 additions and 44 deletions
+32 -1
View File
@@ -356,6 +356,11 @@ paths:
/v1/gateway/llm/{capability}:
post:
summary: Run a metered polish, AI, or agent request
description: |
The server deterministically selects model, thinking, search, tools, retry,
and output-budget policy from `capability` plus optional `taskKind`. It
never infers task type from `input` or `context`, and clients cannot
supply provider parameters. Search and tools are currently disabled.
parameters:
- $ref: "#/components/parameters/RequestId"
- name: capability
@@ -1374,9 +1379,35 @@ components:
properties:
input: { type: string, minLength: 1, maxLength: 32000 }
context: { type: ["string", "null"], maxLength: 32000 }
maxOutputTokens: { type: integer, minimum: 1, maximum: 4096, default: 512 }
maxOutputTokens:
type: integer
minimum: 1
maximum: 4096
default: 512
description: |
Requested output budget. The server clamps dictation polish and
edit-last-input to 512 tokens; translation, clipboard transform,
and custom skill to 2,048; and reasoning tasks to 4,096.
temperature: { type: number, minimum: 0, maximum: 1, default: 0.2 }
stream: { type: boolean, default: false }
taskKind:
type: ["string", "null"]
enum:
- dictation_polish
- translation
- edit_last_input
- ai_question
- clipboard_transform
- custom_skill
- agent_planning
- null
description: |
Optional deterministic task selector. Allowed combinations are:
`polish` with `dictation_polish`, `translation`, or `edit_last_input`;
`ai` with `ai_question`, `clipboard_transform`, or `custom_skill`;
and `agent` with `agent_planning`. Omission defaults respectively to
`dictation_polish`, `ai_question`, and `agent_planning`. A mismatch
returns `400 invalid_request`.
requestSource:
type: ["string", "null"]
enum: [hotword, null]