Skip to content

Commit

Permalink
Added src to docs retriever import
Browse files Browse the repository at this point in the history
  • Loading branch information
willtai committed May 2, 2024
1 parent eda12a4 commit 2445309
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 10 deletions.
6 changes: 4 additions & 2 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#

# You can set these variables from the command line.
VERSION = 0.1.2
PRODUCT = neo4j-genai-python
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
Expand Down Expand Up @@ -52,9 +54,9 @@ clean:
rm -rf $(BUILDDIR)/*

html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/$(PRODUCT)/$(VERSION)
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
@echo "Build finished. The HTML pages are in $(BUILDDIR)/$(PRODUCT)/$(VERSION)."

dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
Expand Down
10 changes: 10 additions & 0 deletions docs/source/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,13 @@ HybridCypherRetriever

.. autoclass:: neo4j_genai.retrievers.hybrid.HybridCypherRetriever
:members:



**********
Data Types
**********

.. include:: types/_vector-search-record-types.rst

See topic :ref:`vector-search-record-types` for more details.
5 changes: 5 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,13 @@
"sphinx.ext.coverage",
"sphinx.ext.ifconfig",
"sphinx.ext.intersphinx",
"sphinx.ext.napoleon",
]

intersphinx_mapping = {
"python": ("https://docs.python.org/3", None),
}

templates_path = ["_templates"]
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

Expand Down
7 changes: 6 additions & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,16 @@ fast to ship new features and high performing patterns and methods.
Topics
******

+ :ref:`api-documentation`
+ :ref:`vector-search-record-types`

.. toctree::
:maxdepth: 2
:maxdepth: 3
:caption: Contents:
:hidden:

api.rst
types/vector.rst


Usage
Expand Down
11 changes: 11 additions & 0 deletions docs/source/types/vector.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.. _vector-search-record-types:

*************************
Vector Search Record Type
*************************


VectorSearchRecord
==================

.. autoclass:: neo4j_genai.types.VectorSearchRecord
14 changes: 7 additions & 7 deletions src/neo4j_genai/retrievers/vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ def search(
- `db.index.vector.queryNodes() <https://neo4j.com/docs/operations-manual/5/reference/procedures/#procedure_db_index_vector_queryNodes>`_
Args:
query_vector (Optional[list[float]], optional): The vector embeddings to get the closest neighbors of. Defaults to None.
query_text (Optional[str], optional): The text to get the closest neighbors of. Defaults to None.
top_k (int, optional): The number of neighbors to return. Defaults to 5.
query_vector (Optional[list[float]]): The vector embeddings to get the closest neighbors of. Defaults to None.
query_text (Optional[str]): The text to get the closest neighbors of. Defaults to None.
top_k (int): The number of neighbors to return. Defaults to 5.
Raises:
ValueError: If validation of the input arguments fail.
Expand Down Expand Up @@ -138,10 +138,10 @@ def search(
- `db.index.vector.queryNodes() <https://neo4j.com/docs/operations-manual/5/reference/procedures/#procedure_db_index_vector_queryNodes>`_
Args:
query_vector (Optional[list[float]], optional): The vector embeddings to get the closest neighbors of. Defaults to None.
query_text (Optional[str], optional): The text to get the closest neighbors of. Defaults to None.
top_k (int, optional): The number of neighbors to return. Defaults to 5.
query_params (Optional[dict[str, Any]], optional): Parameters for the Cypher query. Defaults to None.
query_vector (Optional[list[float]]): The vector embeddings to get the closest neighbors of. Defaults to None.
query_text (Optional[str]): The text to get the closest neighbors of. Defaults to None.
top_k (int): The number of neighbors to return. Defaults to 5.
query_params (Optional[dict[str, Any]]): Parameters for the Cypher query. Defaults to None.
Raises:
ValueError: If validation of the input arguments fail.
Expand Down
7 changes: 7 additions & 0 deletions src/neo4j_genai/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@


class VectorSearchRecord(BaseModel):
"""
Represents a record returned from a vector search.
Attributes:
node (Any): The node data retrieved by the search.
score (float): The similarity score of the retrieved embedding.
"""
node: Any
score: float

Expand Down

0 comments on commit 2445309

Please sign in to comment.