From e020fab1e647de4d3c6e00fbeffa84dff3559325 Mon Sep 17 00:00:00 2001 From: Luke Schaefer Date: Fri, 9 Oct 2026 21:57:49 +0000 Subject: [PATCH] fix(huggingface): allow truncate / truncation_direction passthrough in rerank --- litellm/llms/huggingface/rerank/transformation.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/litellm/llms/huggingface/rerank/transformation.py b/litellm/llms/huggingface/rerank/transformation.py index 334c60ee848..a5f751b93ff 100644 --- a/litellm/llms/huggingface/rerank/transformation.py +++ b/litellm/llms/huggingface/rerank/transformation.py @@ -85,6 +85,8 @@ class HuggingFaceRerankConfig(BaseRerankConfig): "documents", "top_n", "return_documents", + "truncate", + "truncation_direction", ] def map_cohere_rerank_params( @@ -115,6 +117,10 @@ class HuggingFaceRerankConfig(BaseRerankConfig): optional_rerank_params["texts"] = v elif k == "query" and v is not None: optional_rerank_params["query"] = v + elif k == "truncate" and v is not None and isinstance(v, bool): + optional_rerank_params["truncate"] = v + elif k == "truncation_direction" and v is not None: + optional_rerank_params["truncation_direction"] = v return OptionalRerankParams(**optional_rerank_params)