Skip to content

Commit

Permalink
CrateDB: Vector Store -- rename to CrateDBVectorStore
Browse files Browse the repository at this point in the history
  • Loading branch information
amotl committed Oct 31, 2024
1 parent 6b6ad4e commit ebabf7e
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 55 deletions.
6 changes: 3 additions & 3 deletions libs/community/langchain_community/vectorstores/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
CouchbaseVectorStore,
)
from langchain_community.vectorstores.cratedb import (
CrateDBVectorSearch,
CrateDBVectorStore,
)
from langchain_community.vectorstores.dashvector import (
DashVector,
Expand Down Expand Up @@ -337,7 +337,7 @@
"Clickhouse",
"ClickhouseSettings",
"CouchbaseVectorStore",
"CrateDBVectorSearch",
"CrateDBVectorStore",
"DashVector",
"DatabricksVectorSearch",
"DeepLake",
Expand Down Expand Up @@ -442,7 +442,7 @@
"Clickhouse": "langchain_community.vectorstores.clickhouse",
"ClickhouseSettings": "langchain_community.vectorstores.clickhouse",
"CouchbaseVectorStore": "langchain_community.vectorstores.couchbase",
"CrateDBVectorSearch": "langchain_community.vectorstores.cratedb",
"CrateDBVectorStore": "langchain_community.vectorstores.cratedb",
"DashVector": "langchain_community.vectorstores.dashvector",
"DatabricksVectorSearch": "langchain_community.vectorstores.databricks_vector_search", # noqa: E501
"DeepLake": "langchain_community.vectorstores.deeplake",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from .base import CrateDBVectorSearch
from .extended import CrateDBVectorSearchMultiCollection
from .base import CrateDBVectorStore
from .extended import CrateDBVectorStoreMultiCollection

__all__ = [
"CrateDBVectorSearch",
"CrateDBVectorSearchMultiCollection",
"CrateDBVectorStore",
"CrateDBVectorStoreMultiCollection",
]
12 changes: 6 additions & 6 deletions libs/community/langchain_community/vectorstores/cratedb/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def _results_to_docs(docs_and_scores: Any) -> List[Document]:
return [doc for doc, _ in docs_and_scores]


class CrateDBVectorSearch(PGVector):
class CrateDBVectorStore(PGVector):
"""`CrateDB` vector store.
To use it, you should have the ``crate[sqlalchemy]`` python package installed.
Expand All @@ -62,13 +62,13 @@ class CrateDBVectorSearch(PGVector):
Example:
.. code-block:: python
from langchain.vectorstores import CrateDBVectorSearch
from langchain.vectorstores import CrateDBVectorStore
from langchain.embeddings.openai import OpenAIEmbeddings
CONNECTION_STRING = "crate://crate@localhost:4200/test3"
COLLECTION_NAME = "state_of_the_union_test"
embeddings = OpenAIEmbeddings()
vectorestore = CrateDBVectorSearch.from_documents(
vectorestore = CrateDBVectorStore.from_documents(
embedding=embeddings,
documents=docs,
collection_name=COLLECTION_NAME,
Expand Down Expand Up @@ -337,7 +337,7 @@ def _query_collection_multi(

@classmethod
def from_texts( # type: ignore[override]
cls: Type[CrateDBVectorSearch],
cls: Type[CrateDBVectorStore],
texts: List[str],
embedding: Embeddings,
metadatas: Optional[List[dict]] = None,
Expand All @@ -346,7 +346,7 @@ def from_texts( # type: ignore[override]
ids: Optional[List[str]] = None,
pre_delete_collection: bool = False,
**kwargs: Any,
) -> CrateDBVectorSearch:
) -> CrateDBVectorStore:
"""
Return VectorStore initialized from texts and embeddings.
Database connection string is required.
Expand Down Expand Up @@ -431,7 +431,7 @@ def _select_relevance_score_fn(self) -> Callable[[float], float]:
raise ValueError(
"No supported normalization function for distance_strategy of "
f"{self._distance_strategy}. Consider providing relevance_score_fn to "
"CrateDBVectorSearch constructor."
"CrateDBVectorStore constructor."
)

@staticmethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@

from langchain_community.vectorstores.cratedb.base import (
DEFAULT_DISTANCE_STRATEGY,
CrateDBVectorSearch,
CrateDBVectorStore,
DistanceStrategy,
)
from langchain_community.vectorstores.pgvector import _LANGCHAIN_DEFAULT_COLLECTION_NAME


class CrateDBVectorSearchMultiCollection(CrateDBVectorSearch):
class CrateDBVectorStoreMultiCollection(CrateDBVectorStore):
"""
Provide functionality for searching multiple collections.
It can not be used for indexing documents.
Expand All @@ -27,15 +27,15 @@ class CrateDBVectorSearchMultiCollection(CrateDBVectorSearch):
Synopsis::
from langchain.vectorstores.cratedb import CrateDBVectorSearchMultiCollection
from langchain_community.vectorstores.cratedb import CrateDBVectorStoreMultiCollection
multisearch = CrateDBVectorSearchMultiCollection(
multisearch = CrateDBVectorStoreMultiCollection(
collection_names=["collection_foo", "collection_bar"],
embedding_function=embeddings,
connection_string=CONNECTION_STRING,
)
docs_with_score = multisearch.similarity_search_with_score(query)
"""
""" # noqa: E501

def __init__(
self,
Expand Down
Loading

0 comments on commit ebabf7e

Please sign in to comment.