The generic OpenAI-compatible reranker hardcoded `truncate_prompt_tokens:
511` on every /rerank request. Providers that honor this vLLM-specific
field (e.g. SiliconFlow serving Qwen3-Reranker) keep only the last 511
tokens of the templated rerank prompt, cutting the instruction and query
off any document longer than ~511 tokens. Every relevance score then
collapses to near zero (~0.0067 instead of ~0.998), falls below the score
threshold, and knowledge-base search returns empty results. A direct curl
without the field returns the correct scores.
WeKnora already removed this exact hardcoded parameter from the embedding
path in #960; the rerank path was never fixed.
- Add `omitempty` to `truncate_prompt_tokens` and `additional_data` so
empty optional fields are not sent.
- Make truncation opt-in via `extra_config.truncate_prompt_tokens`
(validated > 0 at construction), preserving an escape hatch for
self-hosted vLLM deployments with small-context rerankers.
- Add regression tests reproducing the collapsed-score symptom and the
opt-in path.
Fixes#2143