You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Added result_formatter to all vector, hybrid, and t2c retrievers
* Added unit tests to test retrievers work with a format function
* Ruff formatting and fixed weaviate e2e tests
* Fixed Weaviate tests
* Typo in docs
* Added neo4j.Record variables in result_formatter in docstring
* Update CHANGELOG
---------
Co-authored-by: Will Tai <wtaisen@gmail.com>
Copy file name to clipboardExpand all lines: src/neo4j_genai/retrievers/external/pinecone/pinecone.py
+5-2Lines changed: 5 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -38,6 +38,7 @@
38
38
EmbedderModel,
39
39
Neo4jDriverModel,
40
40
RawSearchResult,
41
+
RetrieverResultItem,
41
42
)
42
43
43
44
logger=logging.getLogger(__name__)
@@ -78,7 +79,7 @@ class PineconeNeo4jRetriever(ExternalRetriever):
78
79
id_property_neo4j (str): The name of the Neo4j node property that's used as the identifier for relating matches from Weaviate to Neo4j nodes.
79
80
embedder (Optional[Embedder]): Embedder object to embed query text.
80
81
return_properties (Optional[list[str]]): List of node properties to return.
81
-
result_formatter (Optional[Callable[[Any], Any]]): Function to transform a neo4j.Record to a RetrieverResultItem.
82
+
result_formatter (Optional[Callable[[neo4j.Record], RetrieverResultItem]]): Function to transform a neo4j.Record to a RetrieverResultItem.
82
83
neo4j_database (Optional[str]): The name of the Neo4j database. If not provided, this defaults to "neo4j" in the database (`see reference to documentation <https://neo4j.com/docs/operations-manual/current/database-administration/#manage-databases-default>`_).
@@ -69,7 +74,7 @@ class WeaviateNeo4jRetriever(ExternalRetriever):
69
74
id_property_neo4j (str): The name of the Neo4j node property that's used as the identifier for relating matches from Weaviate to Neo4j nodes.
70
75
embedder (Optional[Embedder]): Embedder object to embed query text.
71
76
return_properties (Optional[list[str]]): List of node properties to return.
72
-
result_formatter (Optional[Callable[[Any], Any]]): Function to transform a neo4j.Record to a RetrieverResultItem.
77
+
result_formatter (Optional[Callable[[neo4j.Record], RetrieverResultItem]]): Function to transform a neo4j.Record to a RetrieverResultItem.
73
78
neo4j_database (Optional[str]): The name of the Neo4j database. If not provided, this defaults to "neo4j" in the database (`see reference to documentation <https://neo4j.com/docs/operations-manual/current/database-administration/#manage-databases-default>`_).
Copy file name to clipboardExpand all lines: src/neo4j_genai/retrievers/hybrid.py
+16-3Lines changed: 16 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -70,7 +70,12 @@ class HybridRetriever(Retriever):
70
70
embedder (Optional[Embedder]): Embedder object to embed query text.
71
71
return_properties (Optional[list[str]]): List of node properties to return.
72
72
neo4j_database (Optional[str]): The name of the Neo4j database. If not provided, this defaults to "neo4j" in the database (`see reference to documentation <https://neo4j.com/docs/operations-manual/current/database-administration/#manage-databases-default>`_).
73
+
result_formatter (Optional[Callable[[neo4j.Record], RetrieverResultItem]]): Provided custom function to transform a neo4j.Record to a RetrieverResultItem.
73
74
75
+
Two variables are provided in the neo4j.Record:
76
+
77
+
- node: Represents the node retrieved from the vector index search.
@@ -219,7 +229,7 @@ class HybridCypherRetriever(Retriever):
219
229
fulltext_index_name (str): Fulltext index name.
220
230
retrieval_query (str): Cypher query that gets appended.
221
231
embedder (Optional[Embedder]): Embedder object to embed query text.
222
-
result_formatter (Optional[Callable[[Any], Any]]): Provided custom function to transform a neo4j.Record to a RetrieverResultItem.
232
+
result_formatter (Optional[Callable[[neo4j.Record], RetrieverResultItem]]): Provided custom function to transform a neo4j.Record to a RetrieverResultItem.
223
233
neo4j_database (Optional[str]): The name of the Neo4j database. If not provided, this defaults to "neo4j" in the database (`see reference to documentation <https://neo4j.com/docs/operations-manual/current/database-administration/#manage-databases-default>`_).
Copy file name to clipboardExpand all lines: src/neo4j_genai/retrievers/vector.py
+18-3Lines changed: 18 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -65,6 +65,13 @@ class VectorRetriever(Retriever):
65
65
index_name (str): Vector index name.
66
66
embedder (Optional[Embedder]): Embedder object to embed query text.
67
67
return_properties (Optional[list[str]]): List of node properties to return.
68
+
result_formatter (Optional[Callable[[neo4j.Record], RetrieverResultItem]]): Provided custom function to transform a neo4j.Record to a RetrieverResultItem.
69
+
70
+
Two variables are provided in the neo4j.Record:
71
+
72
+
- node: Represents the node retrieved from the vector index search.
73
+
- score: Denotes the similarity score.
74
+
68
75
neo4j_database (Optional[str]): The name of the Neo4j database. If not provided, this defaults to "neo4j" in the database (`see reference to documentation <https://neo4j.com/docs/operations-manual/current/database-administration/#manage-databases-default>`_).
@@ -222,7 +234,7 @@ class VectorCypherRetriever(Retriever):
222
234
index_name (str): Vector index name.
223
235
retrieval_query (str): Cypher query that gets appended.
224
236
embedder (Optional[Embedder]): Embedder object to embed query text.
225
-
result_formatter (Optional[Callable[[Any], Any]]): Provided custom function to transform a neo4j.Record to a RetrieverResultItem.
237
+
result_formatter (Optional[Callable[[neo4j.Record], RetrieverResultItem]]): Provided custom function to transform a neo4j.Record to a RetrieverResultItem.
226
238
neo4j_database (Optional[str]): The name of the Neo4j database. If not provided, this defaults to "neo4j" in the database (`see reference to documentation <https://neo4j.com/docs/operations-manual/current/database-administration/#manage-databases-default>`_).
0 commit comments