Spaces:
Sleeping
Sleeping
File size: 1,452 Bytes
baaa888 2100726 baaa888 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | from types import SimpleNamespace
from app.shared.vector_store.aws_pgvector import (
_configured_read_contract_signatures,
_read_contract_is_ready,
)
def _functions(search_v2: bool) -> dict[str, dict[str, object]]:
return {
"match_places": {"exists": True, "executable": True},
"match_posts": {"exists": True, "executable": True},
"search_resource_embeddings": {
"exists": True,
"executable": True,
"candidate_filters_v2": search_v2,
},
"get_post_feed_features": {"exists": True, "executable": True},
}
def test_readiness_rejects_legacy_search_function() -> None:
assert _read_contract_is_ready(True, _functions(search_v2=False)) is False
def test_readiness_accepts_search_candidate_v2_contract() -> None:
assert _read_contract_is_ready(True, _functions(search_v2=True)) is True
def test_readiness_includes_configured_places_semantic_contract() -> None:
signatures = _configured_read_contract_signatures(
SimpleNamespace(
places_pgvector_match_function="match_places_semantic_v1",
places_pgvector_hybrid_function="search_places_semantic_v1",
)
)
assert signatures["match_places_semantic_v1"] == (
"match_places_semantic_v1(vector, integer, jsonb)"
)
assert signatures["search_places_semantic_v1"] == (
"search_places_semantic_v1(text, vector, integer, jsonb)"
)
|