WeKnora/internal
Martín Alcalá Rubí 83da0903b6 fix(rerank): stop sending vLLM truncate_prompt_tokens by default
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
2026-07-21 12:12:56 +08:00
..
agent feat(agent): enhance suggested questions API with tag scopes 2026-07-17 10:19:43 +08:00
application feat(session): gate IM/embed/API channel sessions behind admin 2026-07-20 20:31:54 +08:00
assets feat(assets): add ASR test audio file and embed it in the application 2026-04-02 21:27:27 +08:00
common fix(redis): harden TLS tests and surface TLS config at startup 2026-07-06 23:04:52 +08:00
config refactor(terminology): rename user-facing tenant labels to workspace 2026-07-14 16:14:43 +08:00
container feat(web-search): add Zhipu AI web search provider support 2026-07-20 12:15:35 +08:00
database feat(system-info): surface DB migration errors with troubleshooting links 2026-05-14 16:34:50 +08:00
datasource feat(im,datasource): support Lark, Feishu's international edition 2026-07-17 11:05:54 +08:00
errors refactor(terminology): rename user-facing tenant labels to workspace 2026-07-14 16:14:43 +08:00
event feat(mcp): prompt and resume OAuth authorization mid-conversation 2026-06-29 23:22:28 +08:00
handler feat(session): gate IM/embed/API channel sessions behind admin 2026-07-20 20:31:54 +08:00
im feat(im,datasource): support Lark, Feishu's international edition 2026-07-17 11:05:54 +08:00
infrastructure feat(web-search): add Zhipu AI web search provider support 2026-07-20 12:15:35 +08:00
llmreference feat(agent): add per-agent citation output toggle 2026-07-17 10:19:43 +08:00
llmresource fix(tests): update resource alias syntax from 'res:' to 'res://' in tests and registry 2026-07-15 17:02:43 +08:00
logger feat(tracing): migrate langfuse client to OTLP/OTel wire protocol 2026-07-17 16:30:45 +08:00
mcp feat(im): include per-service MCP OAuth URLs in IM auth notices 2026-07-01 17:53:54 +08:00
middleware fix(api-keys): allow scoped file serve and ingest batch routes 2026-07-20 19:52:13 +08:00
models fix(rerank): stop sending vLLM truncate_prompt_tokens by default 2026-07-21 12:12:56 +08:00
ratelimit feat(embed): add backend embed channels with auth and rate limiting (#1657) 2026-06-12 23:10:39 +08:00
router fix(api-keys): allow scoped file serve and ingest batch routes 2026-07-20 19:52:13 +08:00
runtime fix(redis): harden TLS tests and surface TLS config at startup 2026-07-06 23:04:52 +08:00
sandbox perf(sandbox): compile command-substitution regexps once 2026-06-16 19:51:32 +08:00
searchutil fix(chat): use Markdown for LLM image context and normalize legacy XML 2026-07-15 18:10:31 +08:00
storageallowlist fix(storage): align default provider fallback with STORAGE_ALLOW_LIST 2026-07-15 11:05:00 +08:00
stream feat(redis): support TLS for Redis connections (#1930) 2026-07-06 23:02:02 +08:00
tracing/langfuse fix(tracing): merge Langfuse finish metadata and export auto root spans 2026-07-17 16:58:40 +08:00
types fix(types): use correct GORM tag separator in Message.KnowledgeReferences 2026-07-21 12:06:48 +08:00
utils feat(resource): add stable resource registry with LLM-context alias compaction 2026-07-15 17:02:43 +08:00