Skip to content

Commit

Permalink
remove precise score checking and fix skip condition
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanrfrazier committed Apr 22, 2024
1 parent f5d4b8e commit f9ee3cb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
11 changes: 6 additions & 5 deletions libs/astradb/tests/integration_tests/test_vectorstores.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,16 @@ def store_parseremb(


@pytest.fixture(scope="function")
@pytest.mark.skipif(not is_vector_service_available(), reason="vectorize unavailable")
def vectorize_store(
astradb_credentials: AstraDBCredentials,
) -> Iterable[AstraDBVectorStore]:
"""
astra db vector store with server-side embeddings using the nvidia model
"""
# Only available in dev us-west-2 now
if not is_vector_service_available():
pytest.skip("vectorize unavailable")

options = CollectionVectorServiceOptions(
provider="nvidia", model_name="NV-Embed-QA"
)
Expand Down Expand Up @@ -565,10 +568,9 @@ def test_astradb_vectorstore_crud(
res3 = vstore.similarity_search_with_score_id(
query="cc", k=1, filter={"k": "c_new"}
)
doc3, score3, id3 = res3[0]
doc3, _, id3 = res3[0]
assert doc3.page_content == "cc"
assert doc3.metadata == {"k": "c_new", "ord": 102}
assert score3 > 0.999 # leaving some leeway for approximations...
assert id3 == "c"
# delete and count again
del1_res = vstore.delete(["b"])
Expand Down Expand Up @@ -627,10 +629,9 @@ async def test_astradb_vectorstore_crud_async(
res3 = await vstore.asimilarity_search_with_score_id(
query="cc", k=1, filter={"k": "c_new"}
)
doc3, score3, id3 = res3[0]
doc3, _, id3 = res3[0]
assert doc3.page_content == "cc"
assert doc3.metadata == {"k": "c_new", "ord": 102}
assert score3 > 0.999 # leaving some leeway for approximations...
assert id3 == "c"
# delete and count again
del1_res = await vstore.adelete(["b"])
Expand Down
1 change: 0 additions & 1 deletion libs/astradb/tests/unit_tests/test_vectorstores.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
AstraDBVectorStore,
)


class SomeEmbeddings(Embeddings):

Check failure on line 13 in libs/astradb/tests/unit_tests/test_vectorstores.py

View workflow job for this annotation

GitHub Actions / cd libs/astradb / make lint #3.8

Ruff (I001)

tests/unit_tests/test_vectorstores.py:1:1: I001 Import block is un-sorted or un-formatted

Check failure on line 13 in libs/astradb/tests/unit_tests/test_vectorstores.py

View workflow job for this annotation

GitHub Actions / cd libs/astradb / make lint #3.11

Ruff (I001)

tests/unit_tests/test_vectorstores.py:1:1: I001 Import block is un-sorted or un-formatted
"""
Turn a sentence into an embedding vector in some way.
Expand Down

0 comments on commit f9ee3cb

Please sign in to comment.