fix(vector-stores): log effective query when extra_body overrides it

When a caller passes a query inside extra_body, the outbound Vertex Search
request used that value but model_call_details recorded the original, so the
echoed search_query was stale. Log the effective query from the request body.
This commit is contained in:
ryan-crabbe-berri 2026-06-01 17:18:23 -07:00
parent 26a79f4524
commit 569154ef9f
2 changed files with 16 additions and 1 deletions

View file

@ -152,7 +152,9 @@ class VertexSearchAPIVectorStoreConfig(BaseVectorStoreConfig, VertexBase):
if isinstance(extra_body, dict):
request_body.update(extra_body)
litellm_logging_obj.model_call_details["query"] = query
litellm_logging_obj.model_call_details["query"] = request_body.get(
"query", query
)
return url, request_body

View file

@ -194,3 +194,16 @@ def test_search_request_joins_list_query():
_, body = _search_request(query=["foo", "bar"])
assert body["query"] == "foo bar"
def test_search_request_logs_effective_query_when_extra_body_overrides_query():
log = SimpleNamespace(model_call_details={})
_, body = _search_request(
query="original",
extra_body={"query": "from-extra-body"},
litellm_logging_obj=log,
)
assert body["query"] == "from-extra-body"
assert log.model_call_details["query"] == "from-extra-body"