feat: add per-model output caps and dynamic reasoning effort - #915
feat: add per-model output caps and dynamic reasoning effort#915penica wants to merge 6 commits into
Conversation
Add capabilities.max_output_tokens metadata and enforce it for OpenAI-compatible generation requests. - expose configured limits through /v1/models and aliases - cap chat, completions, and responses token parameters - document and test configuration and request enforcement
Expose and enforce configured per-model reasoning effort through llama-swap's OpenAI-compatible API. - advertise derived input limits and reasoning metadata for models and aliases - forward verified dynamic budgets and reject unavailable explicit selections - validate reasoning configurations, document usage, and cover request handling
Accept OpenAI's nested reasoning.effort selector on Responses requests while retaining llama-swap's top-level compatibility alias. - reject ambiguous requests that supply both selector shapes - remove consumed selectors before applying llama.cpp reasoning controls - document model metadata extensions and endpoint-specific behavior
Document OpenAI request shapes and cover nested Responses reasoning for configured aliases. - restore Model customization list indentation - add output-cap and reasoning compatibility guidance - verify alias resolution reaches upstream reasoning transformation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
| Filename | Overview |
|---|---|
| internal/process/process_command.go | Adds llama.cpp build detection and request rewriting for explicit reasoning-effort selections. |
| internal/server/filters.go | Adds max-output-token capping after configured JSON filters and resolves caps through aliases. |
| internal/config/model_config.go | Adds reasoning config fields and runtime validation for effort names, defaults, and token budgets. |
| config-schema.json | Adds schema fields for output caps and reasoning, but misses the runtime dependency on max_output_tokens. |
| internal/server/api.go | Extends model-list metadata with output-token and reasoning fields. |
Reviews (1): Last reviewed commit: "docs: clarify reasoning effort compatibi..." | Re-trigger Greptile
Keep configuration schema validation aligned with runtime reasoning requirements. - require max_output_tokens to be positive when reasoning is configured - cover rejected missing-cap and accepted positive-cap schema cases
…nd-reasoning # Conflicts: # internal/config/model_config.go
Summary
Adds configurable per-model output-token caps and dynamic reasoning-effort handling for llama.cpp-backed models.
none,low,medium,high, andxhigh.reasoning_effortand Responsesreasoning.effort; top-level Responsesreasoning_effortremains a compatibility alias./v1/modelsextension fields.Compatibility
Dynamic reasoning selection requires official llama.cpp build
b8605or newer. Explicit effort is rejected when the model uses fixed--reasoning-budgetorLLAMA_ARG_THINK_BUDGET.When effort is omitted or
default, llama-swap sends no thinking overrides, preserving upstream/default behavior.Validation
go test -count=1 ./internal/config ./internal/process ./internal/servergit diff --check main...HEAD