Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions python/semantic_kernel/data/vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -1760,7 +1760,7 @@ async def search(
self,
values: Any,
*,
vector_field_name: str | None = None,
vector_property_name: str | None = None,
filter: OptionalOneOrList[Callable | str] = None,
top: int = 3,
skip: int = 0,
Expand All @@ -1773,7 +1773,7 @@ async def search(
Args:
values: The values to search for. These will be vectorized,
either by the store or using the provided generator.
vector_field_name: The name of the vector field to use for the search.
vector_property_name: The name of the vector field to use for the search.
filter: The filter to apply to the search.
top: The number of results to return.
skip: The number of results to skip.
Expand All @@ -1796,7 +1796,7 @@ async def search(
self,
*,
vector: Sequence[float | int],
vector_field_name: str | None = None,
vector_property_name: str | None = None,
filter: OptionalOneOrList[Callable | str] = None,
top: int = 3,
skip: int = 0,
Expand All @@ -1808,7 +1808,7 @@ async def search(

Args:
vector: The vector to search for
vector_field_name: The name of the vector field to use for the search.
vector_property_name: The name of the vector field to use for the search.
filter: The filter to apply to the search.
top: The number of results to return.
skip: The number of results to skip.
Expand Down
13 changes: 13 additions & 0 deletions python/tests/unit/data/test_vector_search_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,16 @@ async def test_create_search_function_preserves_filter_for_invalid_invocation_op

mock_search.assert_awaited_once()
assert mock_search.await_args.kwargs["filter"] == search_filter


def test_search_overloads_match_implementation_parameters():
"""The public `search` overloads must only advertise keyword arguments the implementation accepts."""
import inspect
from typing import get_overloads

impl_params = set(inspect.signature(VectorSearch.search).parameters)
for overload in get_overloads(VectorSearch.search):
overload_params = set(inspect.signature(overload).parameters)
assert "vector_field_name" not in overload_params
assert "vector_property_name" in overload_params
assert overload_params - {"kwargs"} <= impl_params | {"kwargs"}
Loading