Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement Approximate Nearest Neighbor support for DDL (CREATE TABLE, CREATE VECTOR INDEX) #124

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -253,3 +253,9 @@ Disclaimer

This is not an officially supported Google product.


Limitations
-----------

* Approximate Nearest Neighbors (ANN) strategies are only supported for the GoogleSQL dialect
* ANN's `ALTER VECTOR INDEX` is not yet supported by [Google Cloud Spanner](https://cloud.google.com/spanner/docs/find-approximate-nearest-neighbors#limitations)
2 changes: 1 addition & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import os
import pathlib
import shutil
from pathlib import Path

import nox

Expand All @@ -33,6 +32,7 @@
"docfx",
"docs",
"format",
"integration",
"lint",
"unit",
]
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
google-cloud-spanner==3.49.1
langchain-core==0.3.9
google-cloud-spanner==3.51.0
langchain-core==0.3.15
langchain-community==0.3.1
pydantic==2.9.1
1 change: 1 addition & 0 deletions src/langchain_google_spanner/graph_qa.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ def _call(
inputs: Dict[str, Any],
run_manager: Optional[CallbackManagerForChainRun] = None,
) -> Dict[str, str]:

intermediate_steps: List = []

"""Generate gql statement, uses it to look up in db and answer question."""
Expand Down
2 changes: 1 addition & 1 deletion src/langchain_google_spanner/graph_retriever.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def __clean_element(self, element: dict[str, Any], embedding_column: str) -> Non
del element["properties"][embedding_column]

def __get_distance_function(
self, distance_strategy=DistanceStrategy.EUCLIDEIAN
self, distance_strategy=DistanceStrategy.EUCLIDEAN
) -> str:
"""Gets the vector distance function."""
if distance_strategy == DistanceStrategy.COSINE:
Expand Down
Loading