Skip to content

Commit ffda5c8

Browse files
committed
CrateDB: Vector Store -- improve inline documentation
1 parent ebabf7e commit ffda5c8

File tree

1 file changed

+17
-2
lines changed
  • libs/community/langchain_community/vectorstores/cratedb

1 file changed

+17
-2
lines changed

libs/community/langchain_community/vectorstores/cratedb/base.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,17 @@
2424

2525

2626
class DistanceStrategy(str, enum.Enum):
27-
"""Enumerator of the Distance strategies."""
27+
"""
28+
Enumerator of the Distance strategies.
29+
30+
Note that CrateDB and Lucene currently only implement
31+
similarity based on the Euclidean distance.
32+
33+
> Today, when creating a FLOAT_VECTOR, it uses the default
34+
> EUCLIDEAN_HNSW (L2) similarity.
35+
>
36+
> -- https://github.com/crate/crate/issues/15768
37+
"""
2838

2939
EUCLIDEAN = "euclidean"
3040
COSINE = "cosine"
@@ -45,7 +55,9 @@ def _results_to_docs(docs_and_scores: Any) -> List[Document]:
4555
class CrateDBVectorStore(PGVector):
4656
"""`CrateDB` vector store.
4757
48-
To use it, you should have the ``crate[sqlalchemy]`` python package installed.
58+
To use it, please install the Python package `sqlalchemy-cratedb`.
59+
60+
uv pip install --upgrade sqlalchemy-cratedb
4961
5062
Args:
5163
connection_string: Database connection string.
@@ -312,6 +324,9 @@ def _query_collection_multi(
312324
results: List[Any] = (
313325
session.query( # type: ignore[attr-defined]
314326
self.EmbeddingStore,
327+
# FIXME: Using `_score` is definitively the wrong choice.
328+
# - https://github.com/crate-workbench/langchain/issues/19
329+
# - https://github.com/crate/crate/issues/15835
315330
# TODO: Original pgvector code uses `self.distance_strategy`.
316331
# CrateDB currently only supports EUCLIDEAN.
317332
# self.distance_strategy(embedding).label("distance")

0 commit comments

Comments
 (0)