WeKnora/internal/models/rerank
ZW. 99b4c3a9b0
feat(rerank): support Hugging Face TEI protocol (#3956)
* feat(rerank): support Hugging Face TEI protocol

* style(rerank): satisfy TEI lint checks

* fix(rerank): cap Hugging Face TEI batches at 32 documents

TEI rejects requests above --max-client-batch-size, which defaults to 32.
Without a declared ceiling the shared batching layer sends the whole
candidate set in one request, so a default TEI deployment fails rerank
whenever hybrid retrieval returns more than 32 candidates.

* fix(rerank): send truncate and merge extra_body in the TEI client

TEI before 1.9 starts with --auto-truncate=false and rejects the whole
/rerank call when one passage is longer than the model's input limit, so
retrieval silently falls back to the original order. Ask for truncation
explicitly, as the NIM client does with truncate=END.

The TEI client also ignored compat extra_body, unlike the Cohere, NIM and
DashScope clients. Merge it the same way: query, texts and raw_scores stay
owned by the client, truncate is a default that extra_body may override.

---------

Co-authored-by: bigdu332 <bigdu332@users.noreply.github.com>
Co-authored-by: wizardchen <wizardchen@tencent.com>
2026-10-08 14:02:49 +08:00
..
catalog_matrix_test.go refactor(models): separate provider definitions, model catalogs, and runtime configuration (#3589) 2026-09-23 14:20:08 +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 fix(retrieval): fix recall correctness, score scales, cost and agent tools (#3687) 2026-09-25 10:48:18 +08:00
lkeap_reranker.go refactor(models): separate provider definitions, model catalogs, and runtime configuration (#3589) 2026-09-23 14:20:08 +08:00
llm_debug.go fix(retrieval): fix recall correctness, score scales, cost and agent tools (#3687) 2026-09-25 10:48:18 +08:00
logging.go feat: enhance multimodal support and image handling 2026-03-16 02:26:47 +08:00
passage_limit_test.go fix(retrieval): fix recall correctness, score scales, cost and agent tools (#3687) 2026-09-25 10:48:18 +08:00
protocol.go fix(retrieval): fix recall correctness, score scales, cost and agent tools (#3687) 2026-09-25 10:48:18 +08:00
protocol_test.go refactor(models): separate provider definitions, model catalogs, and runtime configuration (#3589) 2026-09-23 14:20:08 +08:00
provider_detection_test.go refactor(models): separate provider definitions, model catalogs, and runtime configuration (#3589) 2026-09-23 14:20:08 +08:00
reranker.go feat(rerank): support Hugging Face TEI protocol (#3956) 2026-10-08 14:02:49 +08:00
reranker_test.go feat: Compatibility with rerank API output fields 2025-09-08 11:20:40 +08:00
sdk_clients_test.go refactor(models): separate provider definitions, model catalogs, and runtime configuration (#3589) 2026-09-23 14:20:08 +08:00
transport.go fix(retrieval): fix recall correctness, score scales, cost and agent tools (#3687) 2026-09-25 10:48:18 +08:00
transport_security_test.go refactor(rerank): move the wire formats into protocol packages, and correct the vendor facts (#3488) 2026-09-21 10:36:26 +08:00
volcengine_reranker.go refactor(models): separate provider definitions, model catalogs, and runtime configuration (#3589) 2026-09-23 14:20:08 +08:00
wire_test.go feat(rerank): support Hugging Face TEI protocol (#3956) 2026-10-08 14:02:49 +08:00