From ee74a39a776bdea850adc5199e00ec03457f35ca Mon Sep 17 00:00:00 2001 From: mateo-berri <277851410+mateo-berri@users.noreply.github.com> Date: Wed, 11 Nov 2026 14:33:48 -0800 Subject: [PATCH] fix(vector_stores): drop rewrite_query false from the chat file_search tool False asks for the default search every store already runs, and MongoDB rejects the field outright, so forwarding it made a MongoDB chat lose the store's context for a no-op flag. True is still forwarded. --- litellm/types/vector_stores.py | 2 +- tests/unit/vector_stores/test_vector_store_registry.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/litellm/types/vector_stores.py b/litellm/types/vector_stores.py index 255d00baa3d..b154d161e13 100644 --- a/litellm/types/vector_stores.py +++ b/litellm/types/vector_stores.py @@ -362,7 +362,7 @@ class VectorStoreToolParams: "filters": self.filters, "max_num_results": self.max_num_results, "ranking_options": self.ranking_options, - "rewrite_query": self.rewrite_query, + "rewrite_query": self.rewrite_query or None, }.items() if v is not None } diff --git a/tests/unit/vector_stores/test_vector_store_registry.py b/tests/unit/vector_stores/test_vector_store_registry.py index 0568836e270..588dbf35678 100644 --- a/tests/unit/vector_stores/test_vector_store_registry.py +++ b/tests/unit/vector_stores/test_vector_store_registry.py @@ -502,7 +502,7 @@ def test_vector_store_ids_to_run_reads_every_store_id_a_malformed_vector_store_i [ ("query_image", {"type": "base64", "media_type": "image/jpeg", "data": "/9j/"}, {"max_num_results": 3}), ("rewrite_query", True, {"max_num_results": 3, "rewrite_query": True}), - ("rewrite_query", False, {"max_num_results": 3, "rewrite_query": False}), + ("rewrite_query", False, {"max_num_results": 3}), ], ) def test_file_search_tool_passes_its_store_only_the_fields_a_store_search_takes(