Skip to content

Commit

Permalink
Bump version and lint
Browse files Browse the repository at this point in the history
  • Loading branch information
jonbesga committed Mar 18, 2024
1 parent 385ce00 commit f857e14
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "neo4j-genai"
version = "0.1.0"
version = "0.1.1"
description = "Python package to allow easy integration to Neo4j's GenAI features"
authors = ["Neo4j, Inc <[email protected]>"]
license = "Apache License, Version 2.0"
Expand Down
15 changes: 12 additions & 3 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from neo4j_genai.types import Neo4jRecord
from unittest.mock import patch, MagicMock


def test_genai_client_supported_aura_version(driver):
driver.execute_query.return_value = [[{"versions": ["5.11-aura"]}], None, None]

Expand Down Expand Up @@ -85,6 +86,7 @@ def test_drop_index(client):
{"name": "my-index"},
)


@patch("neo4j_genai.GenAIClient._verify_version")
def test_similarity_search_vector_happy_path(_verify_version_mock, driver):
custom_embeddings = MagicMock()
Expand All @@ -106,7 +108,9 @@ def test_similarity_search_vector_happy_path(_verify_version_mock, driver):
YIELD node, score
"""

records = client.similarity_search(name=index_name, query_vector=query_vector, top_k=top_k)
records = client.similarity_search(
name=index_name, query_vector=query_vector, top_k=top_k
)

custom_embeddings.embed_query.assert_not_called()

Expand Down Expand Up @@ -145,7 +149,9 @@ def test_similarity_search_text_happy_path(_verify_version_mock, driver):
YIELD node, score
"""

records = client.similarity_search(name=index_name, query_text=query_text, top_k=top_k)
records = client.similarity_search(
name=index_name, query_text=query_text, top_k=top_k
)

custom_embeddings.embed_query.assert_called_once_with(query_text)

Expand Down Expand Up @@ -186,6 +192,7 @@ def test_similarity_search_both_text_and_vector(client):
top_k=top_k,
)


@patch("neo4j_genai.GenAIClient._verify_version")
def test_similarity_search_vector_bad_results(_verify_version_mock, driver):
custom_embeddings = MagicMock()
Expand All @@ -208,7 +215,9 @@ def test_similarity_search_vector_bad_results(_verify_version_mock, driver):
"""

with pytest.raises(ValueError):
client.similarity_search(name=index_name, query_vector=query_vector, top_k=top_k)
client.similarity_search(
name=index_name, query_vector=query_vector, top_k=top_k
)

custom_embeddings.embed_query.assert_not_called()

Expand Down

0 comments on commit f857e14

Please sign in to comment.