WeKnora/internal/models/vlm
Rene Zander d823ef61ae fix(vlm): use max_completion_tokens for GPT-5 / o-series vision models
The VLM path sent max_tokens and temperature, both rejected by reasoning
and GPT-5 models. go-openai's reasoning validator failed the request
client-side, so every OCR and caption call errored with "this model is
not supported MaxTokens, please use MaxCompletionTokens" and no image
chunk was ever created.

The chat path already solved this in shapeOpenAIReasoning (issue #1283);
the VLM path was never wired to it. Reuse the shared
provider.IsOpenAIReasoningOrGPT5Model predicate so both paths agree on
which models are affected. Migrating max_tokens alone is not enough --
the VLM default temperature of 0.1 is independently rejected.

Also report an empty completion with finish_reason=length as an error.
max_completion_tokens covers reasoning tokens, so an exhausted budget
returns empty content rather than an API error, which was previously
recorded as no_extracted_content and looked identical to an image with
no text.

Fixes #2537

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-09 08:46:17 +08:00
..
concurrency_wrapper.go feat(system): expose model concurrency stats on runtime queues dashboard 2026-07-11 07:17:28 +08:00
config_from_model_test.go feat(models): support custom HTTP headers across all remote model calls 2026-04-23 23:36:40 +08:00
langfuse_wrapper.go feat(observability): integrate Langfuse for LLM token tracking and tracing 2026-04-24 10:29:19 +08:00
llm_debug.go feat(logger): implement LLM debug logging functionality 2026-04-16 23:15:02 +08:00
ollama.go feat(video): update ASR terminology and file type labels for improved clarity 2026-04-14 22:59:14 +08:00
remote_api.go fix(vlm): use max_completion_tokens for GPT-5 / o-series vision models 2026-08-09 08:46:17 +08:00
remote_api_reasoning_test.go fix(vlm): use max_completion_tokens for GPT-5 / o-series vision models 2026-08-09 08:46:17 +08:00
transport.go fix(security): harden model client redirects 2026-07-02 19:15:46 +08:00
transport_security_test.go fix(security): harden model client redirects 2026-07-02 19:15:46 +08:00
vlm.go feat(models): add max concurrency setting for background tasks 2026-07-09 20:40:51 +08:00
weknoracloud.go fix(security): harden model client redirects 2026-07-02 19:15:46 +08:00