24
24
25
25
26
26
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
+ """
28
38
29
39
EUCLIDEAN = "euclidean"
30
40
COSINE = "cosine"
@@ -45,7 +55,9 @@ def _results_to_docs(docs_and_scores: Any) -> List[Document]:
45
55
class CrateDBVectorStore (PGVector ):
46
56
"""`CrateDB` vector store.
47
57
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
49
61
50
62
Args:
51
63
connection_string: Database connection string.
@@ -312,6 +324,9 @@ def _query_collection_multi(
312
324
results : List [Any ] = (
313
325
session .query ( # type: ignore[attr-defined]
314
326
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
315
330
# TODO: Original pgvector code uses `self.distance_strategy`.
316
331
# CrateDB currently only supports EUCLIDEAN.
317
332
# self.distance_strategy(embedding).label("distance")
0 commit comments