diff --git a/libs/langchain/langchain/vectorstores/__init__.py b/libs/langchain/langchain/vectorstores/__init__.py index d815c5a6551..d8e3664e001 100644 --- a/libs/langchain/langchain/vectorstores/__init__.py +++ b/libs/langchain/langchain/vectorstores/__init__.py @@ -78,60 +78,60 @@ __all__ = [ "AlibabaCloudOpenSearchSettings", "AnalyticDB", "Annoy", + "Annoy", + "AtlasDB", "AtlasDB", "AwaDB", "AzureSearch", "Bagel", "Cassandra", "Chroma", + "Chroma", + "Clarifai", "Clickhouse", "ClickhouseSettings", "DashVector", "DeepLake", + "DeepLake", "Dingo", "DocArrayHnswSearch", "DocArrayInMemorySearch", - "ElasticVectorSearch", "ElasticKnnSearch", + "ElasticVectorSearch", "ElasticsearchStore", "Epsilla", "FAISS", - "PGEmbedding", "Hologres", "LanceDB", - "MatchingEngine", "Marqo", + "MatchingEngine", "Meilisearch", "Milvus", - "Zilliz", - "SingleStoreDB", - "Chroma", - "Clarifai", - "OpenSearchVectorSearch", - "AtlasDB", - "DeepLake", - "Annoy", "MongoDBAtlasVectorSearch", "MyScale", "MyScaleSettings", "OpenSearchVectorSearch", + "OpenSearchVectorSearch", + "PGEmbedding", + "PGVector", "Pinecone", "Qdrant", "Redis", "Rockset", - "ScaNN", "SKLearnVectorStore", + "ScaNN", + "SingleStoreDB", "SingleStoreDB", "StarRocks", "SupabaseVectorStore", "Tair", "Tigris", "Typesense", + "USearch", "Vectara", "VectorStore", "Weaviate", "ZepVectorStore", "Zilliz", - "PGVector", - "USearch", + "Zilliz", ] diff --git a/libs/langchain/langchain/vectorstores/_pgvector_data_models.py b/libs/langchain/langchain/vectorstores/_pgvector_data_models.py index f44bd2e3527..1a4b6077653 100644 --- a/libs/langchain/langchain/vectorstores/_pgvector_data_models.py +++ b/libs/langchain/langchain/vectorstores/_pgvector_data_models.py @@ -9,6 +9,8 @@ from langchain.vectorstores.pgvector import BaseModel class CollectionStore(BaseModel): + """Collection store.""" + __tablename__ = "langchain_pg_collection" name = sqlalchemy.Column(sqlalchemy.String) @@ -48,6 +50,8 @@ class CollectionStore(BaseModel): class EmbeddingStore(BaseModel): + """Embedding store.""" + __tablename__ = "langchain_pg_embedding" collection_id = sqlalchemy.Column( diff --git a/libs/langchain/langchain/vectorstores/alibabacloud_opensearch.py b/libs/langchain/langchain/vectorstores/alibabacloud_opensearch.py index f8cf664cc4d..672994bc384 100644 --- a/libs/langchain/langchain/vectorstores/alibabacloud_opensearch.py +++ b/libs/langchain/langchain/vectorstores/alibabacloud_opensearch.py @@ -12,7 +12,7 @@ logger = logging.getLogger() class AlibabaCloudOpenSearchSettings: - """Alibaba Cloud Opensearch Client Configuration. + """`Alibaba Cloud Opensearch` client configuration. Attribute: endpoint (str) : The endpoint of opensearch instance, You can find it @@ -90,7 +90,7 @@ def create_metadata(fields: Dict[str, Any]) -> Dict[str, Any]: class AlibabaCloudOpenSearch(VectorStore): - """Alibaba Cloud OpenSearch Vector Store""" + """`Alibaba Cloud OpenSearch` vector store.""" def __init__( self, @@ -102,7 +102,7 @@ class AlibabaCloudOpenSearch(VectorStore): from alibabacloud_ha3engine import client, models from alibabacloud_tea_util import models as util_models except ImportError: - raise ValueError( + raise ImportError( "Could not import alibaba cloud opensearch python package. " "Please install it with `pip install alibabacloud-ha3engine`." ) diff --git a/libs/langchain/langchain/vectorstores/analyticdb.py b/libs/langchain/langchain/vectorstores/analyticdb.py index b565a65a216..22e8dd18a9c 100644 --- a/libs/langchain/langchain/vectorstores/analyticdb.py +++ b/libs/langchain/langchain/vectorstores/analyticdb.py @@ -1,4 +1,3 @@ -"""VectorStore wrapper around a Postgres/PGVector database.""" from __future__ import annotations import logging @@ -25,7 +24,7 @@ Base = declarative_base() # type: Any class AnalyticDB(VectorStore): - """VectorStore implementation using AnalyticDB. + """`AnalyticDB` (distributed PostgreSQL) vector store. AnalyticDB is a distributed full postgresql syntax cloud-native database. - `connection_string` is a postgres connection string. diff --git a/libs/langchain/langchain/vectorstores/annoy.py b/libs/langchain/langchain/vectorstores/annoy.py index f4b7cecf08b..22c569781bb 100644 --- a/libs/langchain/langchain/vectorstores/annoy.py +++ b/libs/langchain/langchain/vectorstores/annoy.py @@ -1,4 +1,3 @@ -"""Wrapper around Annoy vector database.""" from __future__ import annotations import os @@ -26,7 +25,7 @@ def dependable_annoy_import() -> Any: try: import annoy except ImportError: - raise ValueError( + raise ImportError( "Could not import annoy python package. " "Please install it with `pip install --user annoy` " ) @@ -34,7 +33,7 @@ def dependable_annoy_import() -> Any: class Annoy(VectorStore): - """Wrapper around Annoy vector database. + """`Annoy` vector store. To use, you should have the ``annoy`` python package installed. diff --git a/libs/langchain/langchain/vectorstores/atlas.py b/libs/langchain/langchain/vectorstores/atlas.py index 31bccb6b426..bdc86e17ecf 100644 --- a/libs/langchain/langchain/vectorstores/atlas.py +++ b/libs/langchain/langchain/vectorstores/atlas.py @@ -1,4 +1,3 @@ -"""Wrapper around Atlas by Nomic.""" from __future__ import annotations import logging @@ -15,7 +14,9 @@ logger = logging.getLogger(__name__) class AtlasDB(VectorStore): - """Wrapper around Atlas: Nomic's neural database and rhizomatic instrument. + """`Atlas` vector store. + + Atlas is the `Nomic's` neural database and `rhizomatic` instrument. To use, you should have the ``nomic`` python package installed. @@ -61,7 +62,7 @@ class AtlasDB(VectorStore): import nomic from nomic import AtlasProject except ImportError: - raise ValueError( + raise ImportError( "Could not import nomic python package. " "Please install it with `pip install nomic`." ) diff --git a/libs/langchain/langchain/vectorstores/awadb.py b/libs/langchain/langchain/vectorstores/awadb.py index 44317b93711..7f5daf1710d 100644 --- a/libs/langchain/langchain/vectorstores/awadb.py +++ b/libs/langchain/langchain/vectorstores/awadb.py @@ -1,4 +1,3 @@ -"""Wrapper around AwaDB for embedding vectors""" from __future__ import annotations import logging @@ -20,7 +19,7 @@ DEFAULT_TOPN = 4 class AwaDB(VectorStore): - """Interface implemented by AwaDB vector stores.""" + """`AwaDB` vector store.""" _DEFAULT_TABLE_NAME = "langchain_awadb" @@ -50,7 +49,7 @@ class AwaDB(VectorStore): try: import awadb except ImportError: - raise ValueError( + raise ImportError( "Could not import awadb python package. " "Please install it with `pip install awadb`." ) diff --git a/libs/langchain/langchain/vectorstores/azuresearch.py b/libs/langchain/langchain/vectorstores/azuresearch.py index 5f2a45e9361..32b6d03f187 100644 --- a/libs/langchain/langchain/vectorstores/azuresearch.py +++ b/libs/langchain/langchain/vectorstores/azuresearch.py @@ -1,4 +1,3 @@ -"""Wrapper around Azure Cognitive Search.""" from __future__ import annotations import base64 @@ -177,7 +176,7 @@ def _get_search_client( class AzureSearch(VectorStore): - """Azure Cognitive Search vector store.""" + """`Azure Cognitive Search` vector store.""" def __init__( self, @@ -526,7 +525,7 @@ class AzureSearch(VectorStore): class AzureSearchVectorStoreRetriever(BaseRetriever): - """Retriever that uses Azure Search to find similar documents.""" + """Retriever that uses `Azure Cognitive Search`.""" vectorstore: AzureSearch """Azure Search instance used to find similar documents.""" diff --git a/libs/langchain/langchain/vectorstores/bageldb.py b/libs/langchain/langchain/vectorstores/bageldb.py index ab0e7868caa..5b4590933cc 100644 --- a/libs/langchain/langchain/vectorstores/bageldb.py +++ b/libs/langchain/langchain/vectorstores/bageldb.py @@ -1,4 +1,3 @@ -"""BagelDB integration""" from __future__ import annotations import uuid @@ -43,7 +42,7 @@ def _results_to_docs_and_scores(results: Any) -> List[Tuple[Document, float]]: class Bagel(VectorStore): - """Wrapper around BagelDB.ai vector store. + """``BagelDB.ai`` vector store. To use, you should have the ``betabageldb`` python package installed. @@ -70,7 +69,7 @@ class Bagel(VectorStore): import bagel import bagel.config except ImportError: - raise ValueError("Please install bagel `pip install betabageldb`.") + raise ImportError("Please install bagel `pip install betabageldb`.") if client is not None: self._client_settings = client_settings self._client = client diff --git a/libs/langchain/langchain/vectorstores/base.py b/libs/langchain/langchain/vectorstores/base.py index 5bc624add4d..2c9ce74ee1a 100644 --- a/libs/langchain/langchain/vectorstores/base.py +++ b/libs/langchain/langchain/vectorstores/base.py @@ -1,5 +1,3 @@ -"""Interface for vector stores.""" - from __future__ import annotations import asyncio @@ -37,7 +35,7 @@ VST = TypeVar("VST", bound="VectorStore") class VectorStore(ABC): - """Interface for vector stores.""" + """Interface for vector store.""" @abstractmethod def add_texts( @@ -520,7 +518,7 @@ class VectorStore(ABC): class VectorStoreRetriever(BaseRetriever): - """Retriever class for VectorStore.""" + """Base Retriever class for VectorStore.""" vectorstore: VectorStore """VectorStore to use for retrieval.""" diff --git a/libs/langchain/langchain/vectorstores/cassandra.py b/libs/langchain/langchain/vectorstores/cassandra.py index d844a89e126..cc6541b5f7e 100644 --- a/libs/langchain/langchain/vectorstores/cassandra.py +++ b/libs/langchain/langchain/vectorstores/cassandra.py @@ -1,4 +1,3 @@ -"""Wrapper around Cassandra vector-store capabilities, based on cassIO.""" from __future__ import annotations import typing @@ -19,8 +18,9 @@ CVST = TypeVar("CVST", bound="Cassandra") class Cassandra(VectorStore): - """Wrapper around Cassandra embeddings platform. + """`Cassandra` vector store. + It based on the Cassandra vector-store capabilities, based on cassIO. There is no notion of a default table name, since each embedding function implies its own vector dimension, which is part of the schema. diff --git a/libs/langchain/langchain/vectorstores/chroma.py b/libs/langchain/langchain/vectorstores/chroma.py index 9457419c56d..76469357a23 100644 --- a/libs/langchain/langchain/vectorstores/chroma.py +++ b/libs/langchain/langchain/vectorstores/chroma.py @@ -1,4 +1,3 @@ -"""Wrapper around ChromaDB embeddings platform.""" from __future__ import annotations import logging @@ -50,7 +49,7 @@ def _results_to_docs_and_scores(results: Any) -> List[Tuple[Document, float]]: class Chroma(VectorStore): - """Wrapper around ChromaDB embeddings platform. + """`ChromaDB` vector store. To use, you should have the ``chromadb`` python package installed. @@ -76,12 +75,12 @@ class Chroma(VectorStore): client: Optional[chromadb.Client] = None, relevance_score_fn: Optional[Callable[[float], float]] = None, ) -> None: - """Initialize with Chroma client.""" + """Initialize with a Chroma client.""" try: import chromadb import chromadb.config except ImportError: - raise ValueError( + raise ImportError( "Could not import chromadb python package. " "Please install it with `pip install chromadb`." ) diff --git a/libs/langchain/langchain/vectorstores/clarifai.py b/libs/langchain/langchain/vectorstores/clarifai.py index 9db4408b2a9..51d01118fd4 100644 --- a/libs/langchain/langchain/vectorstores/clarifai.py +++ b/libs/langchain/langchain/vectorstores/clarifai.py @@ -16,7 +16,7 @@ logger = logging.getLogger(__name__) class Clarifai(VectorStore): - """Wrapper around Clarifai AI platform's vector store. + """`Clarifai AI` vector store. To use, you should have the ``clarifai`` python package installed. @@ -55,7 +55,7 @@ class Clarifai(VectorStore): from clarifai.auth.helper import DEFAULT_BASE, ClarifaiAuthHelper from clarifai.client import create_stub except ImportError: - raise ValueError( + raise ImportError( "Could not import clarifai python package. " "Please install it with `pip install clarifai`." ) diff --git a/libs/langchain/langchain/vectorstores/clickhouse.py b/libs/langchain/langchain/vectorstores/clickhouse.py index c0916ec446b..68de429633a 100644 --- a/libs/langchain/langchain/vectorstores/clickhouse.py +++ b/libs/langchain/langchain/vectorstores/clickhouse.py @@ -1,5 +1,3 @@ -"""Wrapper around open source ClickHouse VectorSearch capability.""" - from __future__ import annotations import json @@ -33,7 +31,7 @@ def has_mul_sub_str(s: str, *args: Any) -> bool: class ClickhouseSettings(BaseSettings): - """ClickHouse Client Configuration + """`ClickHouse` client configuration. Attribute: clickhouse_host (str) : An URL to connect to MyScale backend. @@ -101,7 +99,7 @@ class ClickhouseSettings(BaseSettings): class Clickhouse(VectorStore): - """Wrapper around ClickHouse vector database + """`ClickHouse VectorSearch` vector store. You need a `clickhouse-connect` python package, and a valid account to connect to ClickHouse. @@ -130,7 +128,7 @@ class Clickhouse(VectorStore): try: from clickhouse_connect import get_client except ImportError: - raise ValueError( + raise ImportError( "Could not import clickhouse connect python package. " "Please install it with `pip install clickhouse-connect`." ) diff --git a/libs/langchain/langchain/vectorstores/dashvector.py b/libs/langchain/langchain/vectorstores/dashvector.py index 714c76c0083..f3559384ace 100644 --- a/libs/langchain/langchain/vectorstores/dashvector.py +++ b/libs/langchain/langchain/vectorstores/dashvector.py @@ -1,4 +1,3 @@ -"""Wrapper around DashVector vector database.""" from __future__ import annotations import logging @@ -23,7 +22,7 @@ logger = logging.getLogger(__name__) class DashVector(VectorStore): - """Wrapper around DashVector vector database. + """`DashVector` vector store. To use, you should have the ``dashvector`` python package installed. diff --git a/libs/langchain/langchain/vectorstores/deeplake.py b/libs/langchain/langchain/vectorstores/deeplake.py index c04d71aced6..ed76018322f 100644 --- a/libs/langchain/langchain/vectorstores/deeplake.py +++ b/libs/langchain/langchain/vectorstores/deeplake.py @@ -1,4 +1,3 @@ -"""Wrapper around Activeloop Deep Lake.""" from __future__ import annotations import logging @@ -24,9 +23,9 @@ logger = logging.getLogger(__name__) class DeepLake(VectorStore): - """Wrapper around Deep Lake, a data lake for deep learning applications. + """`Activeloop Deep Lake` vector store. - We integrated deeplake's similarity search and filtering for fast prototyping, + We integrated deeplake's similarity search and filtering for fast prototyping. Now, it supports Tensor Query Language (TQL) for production use cases over billion rows. @@ -126,7 +125,7 @@ class DeepLake(VectorStore): self.verbose = verbose if _DEEPLAKE_INSTALLED is False: - raise ValueError( + raise ImportError( "Could not import deeplake python package. " "Please install it with `pip install deeplake[enterprise]`." ) @@ -135,7 +134,7 @@ class DeepLake(VectorStore): kwargs.get("runtime") == {"tensor_db": True} and version_compare(deeplake.__version__, "3.6.7") == -1 ): - raise ValueError( + raise ImportError( "To use tensor_db option you need to update deeplake to `3.6.7`. " f"Currently installed deeplake version is {deeplake.__version__}. " ) diff --git a/libs/langchain/langchain/vectorstores/dingo.py b/libs/langchain/langchain/vectorstores/dingo.py index 44765cdd310..e6d3419c794 100644 --- a/libs/langchain/langchain/vectorstores/dingo.py +++ b/libs/langchain/langchain/vectorstores/dingo.py @@ -1,4 +1,3 @@ -"""Wrapper around the Dingo vector database.""" from __future__ import annotations import logging @@ -16,7 +15,7 @@ logger = logging.getLogger(__name__) class Dingo(VectorStore): - """Wrapper around Dingo vector database. + """`Dingo` vector store. To use, you should have the ``dingodb`` python package installed. diff --git a/libs/langchain/langchain/vectorstores/docarray/base.py b/libs/langchain/langchain/vectorstores/docarray/base.py index 2e693bcde14..d3b048610b8 100644 --- a/libs/langchain/langchain/vectorstores/docarray/base.py +++ b/libs/langchain/langchain/vectorstores/docarray/base.py @@ -33,6 +33,8 @@ def _check_docarray_import() -> None: class DocArrayIndex(VectorStore, ABC): + """Base class for `DocArray` based vector stores.""" + def __init__( self, doc_index: "BaseDocIndex", @@ -67,7 +69,7 @@ class DocArrayIndex(VectorStore, ABC): metadatas: Optional[List[dict]] = None, **kwargs: Any, ) -> List[str]: - """Run more texts through the embeddings and add to the vectorstore. + """Embed texts and add to the vector store. Args: texts: Iterable of strings to add to the vectorstore. diff --git a/libs/langchain/langchain/vectorstores/docarray/hnsw.py b/libs/langchain/langchain/vectorstores/docarray/hnsw.py index 26ed4afacd5..e1fdc6f070f 100644 --- a/libs/langchain/langchain/vectorstores/docarray/hnsw.py +++ b/libs/langchain/langchain/vectorstores/docarray/hnsw.py @@ -1,4 +1,3 @@ -"""Wrapper around Hnswlib store.""" from __future__ import annotations from typing import Any, List, Literal, Optional @@ -11,7 +10,7 @@ from langchain.vectorstores.docarray.base import ( class DocArrayHnswSearch(DocArrayIndex): - """Wrapper around HnswLib storage. + """`HnswLib` storage using `DocArray` package. To use it, you should have the ``docarray`` package with version >=0.32.0 installed. You can install it with `pip install "langchain[docarray]"`. diff --git a/libs/langchain/langchain/vectorstores/docarray/in_memory.py b/libs/langchain/langchain/vectorstores/docarray/in_memory.py index 77570c0b063..9c3b3dcf368 100644 --- a/libs/langchain/langchain/vectorstores/docarray/in_memory.py +++ b/libs/langchain/langchain/vectorstores/docarray/in_memory.py @@ -11,7 +11,7 @@ from langchain.vectorstores.docarray.base import ( class DocArrayInMemorySearch(DocArrayIndex): - """Wrapper around in-memory storage for exact search. + """In-memory `DocArray` storage for exact search. To use it, you should have the ``docarray`` package with version >=0.32.0 installed. You can install it with `pip install "langchain[docarray]"`. diff --git a/libs/langchain/langchain/vectorstores/elastic_vector_search.py b/libs/langchain/langchain/vectorstores/elastic_vector_search.py index f3b8c37e03e..978da1d5ce6 100644 --- a/libs/langchain/langchain/vectorstores/elastic_vector_search.py +++ b/libs/langchain/langchain/vectorstores/elastic_vector_search.py @@ -53,9 +53,9 @@ def _default_script_query(query_vector: List[float], filter: Optional[dict]) -> @deprecated("0.0.265", alternative="ElasticsearchStore class.", pending=True) class ElasticVectorSearch(VectorStore): - """Wrapper around Elasticsearch as a vector database. + """[DEPRECATED] `Elasticsearch` vector store. - To connect to an Elasticsearch instance that does not require + To connect to an `Elasticsearch` instance that does not require login credentials, pass the Elasticsearch URL and index name along with the embedding object to the constructor. @@ -340,11 +340,10 @@ class ElasticVectorSearch(VectorStore): class ElasticKnnSearch(VectorStore): - """ - ElasticKnnSearch is a class for performing k-nearest neighbor - (k-NN) searches on text data using Elasticsearch. + """[DEPRECATED] `Elasticsearch` with k-nearest neighbor search + (`k-NN`) vector store. - This class is used to create an Elasticsearch index of text data that + It creates an Elasticsearch index of text data that can be searched using k-NN search. The text data is transformed into vector embeddings using a provided embedding model, and these embeddings are stored in the Elasticsearch index. diff --git a/libs/langchain/langchain/vectorstores/elasticsearch.py b/libs/langchain/langchain/vectorstores/elasticsearch.py index 27f0ef30744..d2dd7f76804 100644 --- a/libs/langchain/langchain/vectorstores/elasticsearch.py +++ b/libs/langchain/langchain/vectorstores/elasticsearch.py @@ -1,5 +1,3 @@ -"""Wrapper around Elasticsearch vector database.""" - import logging import uuid from abc import ABC, abstractmethod @@ -28,6 +26,8 @@ logger = logging.getLogger(__name__) class BaseRetrievalStrategy(ABC): + """Base class for `Elasticsearch` retrieval strategies.""" + @abstractmethod def query( self, @@ -109,6 +109,8 @@ class BaseRetrievalStrategy(ABC): class ApproxRetrievalStrategy(BaseRetrievalStrategy): + """Approximate retrieval strategy using the `HNSW` algorithm.""" + def __init__( self, query_model_id: Optional[str] = None, @@ -211,6 +213,8 @@ class ApproxRetrievalStrategy(BaseRetrievalStrategy): class ExactRetrievalStrategy(BaseRetrievalStrategy): + """Exact retrieval strategy using the `script_score` query.""" + def query( self, query_vector: Union[List[float], None], @@ -276,6 +280,8 @@ class ExactRetrievalStrategy(BaseRetrievalStrategy): class SparseRetrievalStrategy(BaseRetrievalStrategy): + """Sparse retrieval strategy using the `text_expansion` processor.""" + def __init__(self, model_id: Optional[str] = None): self.model_id = model_id or ".elser_model_1" @@ -355,8 +361,7 @@ class SparseRetrievalStrategy(BaseRetrievalStrategy): class ElasticsearchStore(VectorStore): - - """Wrapper around Elasticsearch search database. + """`Elasticsearch` vector store. Example: .. code-block:: python diff --git a/libs/langchain/langchain/vectorstores/faiss.py b/libs/langchain/langchain/vectorstores/faiss.py index 7e9cb109e34..a8c835e5ca2 100644 --- a/libs/langchain/langchain/vectorstores/faiss.py +++ b/libs/langchain/langchain/vectorstores/faiss.py @@ -1,4 +1,3 @@ -"""Wrapper around FAISS vector database.""" from __future__ import annotations import operator @@ -65,7 +64,7 @@ def _len_check_if_sized(x: Any, y: Any, x_name: str, y_name: str) -> None: class FAISS(VectorStore): - """Wrapper around FAISS vector database. + """`Meta Faiss` vector store. To use, you must have the ``faiss`` python package installed. diff --git a/libs/langchain/langchain/vectorstores/hologres.py b/libs/langchain/langchain/vectorstores/hologres.py index 092dc24c364..ce816e8f904 100644 --- a/libs/langchain/langchain/vectorstores/hologres.py +++ b/libs/langchain/langchain/vectorstores/hologres.py @@ -1,4 +1,3 @@ -"""VectorStore wrapper around a Hologres database.""" from __future__ import annotations import json @@ -16,7 +15,7 @@ _LANGCHAIN_DEFAULT_TABLE_NAME = "langchain_pg_embedding" class HologresWrapper: - """Wrapper around Hologres service.""" + """`Hologres API` wrapper.""" def __init__(self, connection_string: str, ndims: int, table_name: str) -> None: """Initialize the wrapper. @@ -114,7 +113,7 @@ document text);""" class Hologres(VectorStore): - """VectorStore implementation using Hologres. + """`Hologres API` vector store. - `connection_string` is a hologres connection string. - `embedding_function` any embedding function implementing diff --git a/libs/langchain/langchain/vectorstores/lancedb.py b/libs/langchain/langchain/vectorstores/lancedb.py index 2b29f92c7a3..1a166d4e12f 100644 --- a/libs/langchain/langchain/vectorstores/lancedb.py +++ b/libs/langchain/langchain/vectorstores/lancedb.py @@ -1,4 +1,3 @@ -"""Wrapper around LanceDB vector database""" from __future__ import annotations import uuid @@ -10,7 +9,7 @@ from langchain.vectorstores.base import VectorStore class LanceDB(VectorStore): - """Wrapper around LanceDB vector database. + """`LanceDB` vector store. To use, you should have ``lancedb`` python package installed. @@ -36,7 +35,7 @@ class LanceDB(VectorStore): try: import lancedb except ImportError: - raise ValueError( + raise ImportError( "Could not import lancedb python package. " "Please install it with `pip install lancedb`." ) diff --git a/libs/langchain/langchain/vectorstores/marqo.py b/libs/langchain/langchain/vectorstores/marqo.py index 0d1dfe0489e..b18731e08c1 100644 --- a/libs/langchain/langchain/vectorstores/marqo.py +++ b/libs/langchain/langchain/vectorstores/marqo.py @@ -1,4 +1,3 @@ -"""Wrapper around weaviate vector database.""" from __future__ import annotations import json @@ -25,7 +24,7 @@ if TYPE_CHECKING: class Marqo(VectorStore): - """Wrapper around Marqo database. + """`Marqo` vector store. Marqo indexes have their own models associated with them to generate your embeddings. This means that you can selected from a range of different models diff --git a/libs/langchain/langchain/vectorstores/matching_engine.py b/libs/langchain/langchain/vectorstores/matching_engine.py index 9d8c55ed4a7..2bf27af6479 100644 --- a/libs/langchain/langchain/vectorstores/matching_engine.py +++ b/libs/langchain/langchain/vectorstores/matching_engine.py @@ -1,4 +1,3 @@ -"""Vertex Matching Engine implementation of the vector store.""" from __future__ import annotations import json @@ -21,7 +20,7 @@ logger = logging.getLogger() class MatchingEngine(VectorStore): - """Vertex Matching Engine implementation of the vector store. + """`Google Vertex AI Matching Engine` vector store. While the embeddings are stored in the Matching Engine, the embedded documents will be stored in GCS. diff --git a/libs/langchain/langchain/vectorstores/meilisearch.py b/libs/langchain/langchain/vectorstores/meilisearch.py index 313ae681631..05ffb9700fe 100644 --- a/libs/langchain/langchain/vectorstores/meilisearch.py +++ b/libs/langchain/langchain/vectorstores/meilisearch.py @@ -1,4 +1,3 @@ -"""Wrapper around Meilisearch vector database.""" from __future__ import annotations import uuid @@ -45,7 +44,7 @@ def _create_client( class Meilisearch(VectorStore): - """Initialize wrapper around Meilisearch vector database. + """`Meilisearch` vector store. To use this, you need to have `meilisearch` python package installed, and a running Meilisearch instance. diff --git a/libs/langchain/langchain/vectorstores/milvus.py b/libs/langchain/langchain/vectorstores/milvus.py index c6a5301ff92..e5ee2a015ce 100644 --- a/libs/langchain/langchain/vectorstores/milvus.py +++ b/libs/langchain/langchain/vectorstores/milvus.py @@ -1,4 +1,3 @@ -"""Wrapper around the Milvus vector database.""" from __future__ import annotations import logging @@ -24,19 +23,18 @@ DEFAULT_MILVUS_CONNECTION = { class Milvus(VectorStore): - """Initialize wrapper around the milvus vector database. + """`Milvus` vector store. - In order to use this you need to have `pymilvus` installed and a - running Milvus + You need to install `pymilvus` and run Milvus. See the following documentation for how to run a Milvus instance: https://milvus.io/docs/install_standalone-docker.md If looking for a hosted Milvus, take a look at this documentation: https://zilliz.com/cloud and make use of the Zilliz vectorstore found in - this project, + this project. - IF USING L2/IP metric IT IS HIGHLY SUGGESTED TO NORMALIZE YOUR DATA. + IF USING L2/IP metric, IT IS HIGHLY SUGGESTED TO NORMALIZE YOUR DATA. Args: embedding_function (Embeddings): Function used to embed the text. diff --git a/libs/langchain/langchain/vectorstores/mongodb_atlas.py b/libs/langchain/langchain/vectorstores/mongodb_atlas.py index b7cd5136ddb..3476c0eb5a0 100644 --- a/libs/langchain/langchain/vectorstores/mongodb_atlas.py +++ b/libs/langchain/langchain/vectorstores/mongodb_atlas.py @@ -32,7 +32,7 @@ DEFAULT_INSERT_BATCH_SIZE = 100 class MongoDBAtlasVectorSearch(VectorStore): - """Wrapper around MongoDB Atlas Vector Search. + """`MongoDB Atlas Vector Search` vector store. To use, you should have both: - the ``pymongo`` python package installed diff --git a/libs/langchain/langchain/vectorstores/myscale.py b/libs/langchain/langchain/vectorstores/myscale.py index ef4db34eade..3c4361fcdcd 100644 --- a/libs/langchain/langchain/vectorstores/myscale.py +++ b/libs/langchain/langchain/vectorstores/myscale.py @@ -1,4 +1,3 @@ -"""Wrapper around MyScale vector database.""" from __future__ import annotations import json @@ -32,7 +31,7 @@ def has_mul_sub_str(s: str, *args: Any) -> bool: class MyScaleSettings(BaseSettings): - """MyScale Client Configuration + """MyScale client configuration. Attribute: myscale_host (str) : An URL to connect to MyScale backend. @@ -93,13 +92,13 @@ class MyScaleSettings(BaseSettings): class MyScale(VectorStore): - """Wrapper around MyScale vector database + """`MyScale` vector store. You need a `clickhouse-connect` python package, and a valid account to connect to MyScale. - MyScale can not only search with simple vector indexes, - it also supports complex query with multiple conditions, + MyScale can not only search with simple vector indexes. + It also supports a complex query with multiple conditions, constraints and even sub-queries. For more information, please visit @@ -122,7 +121,7 @@ class MyScale(VectorStore): try: from clickhouse_connect import get_client except ImportError: - raise ValueError( + raise ImportError( "Could not import clickhouse connect python package. " "Please install it with `pip install clickhouse-connect`." ) diff --git a/libs/langchain/langchain/vectorstores/opensearch_vector_search.py b/libs/langchain/langchain/vectorstores/opensearch_vector_search.py index 8e84835df23..ddc2e72ac3b 100644 --- a/libs/langchain/langchain/vectorstores/opensearch_vector_search.py +++ b/libs/langchain/langchain/vectorstores/opensearch_vector_search.py @@ -1,4 +1,3 @@ -"""Wrapper around OpenSearch vector database.""" from __future__ import annotations import uuid @@ -26,7 +25,7 @@ def _import_opensearch() -> Any: try: from opensearchpy import OpenSearch except ImportError: - raise ValueError(IMPORT_OPENSEARCH_PY_ERROR) + raise ImportError(IMPORT_OPENSEARCH_PY_ERROR) return OpenSearch @@ -35,7 +34,7 @@ def _import_bulk() -> Any: try: from opensearchpy.helpers import bulk except ImportError: - raise ValueError(IMPORT_OPENSEARCH_PY_ERROR) + raise ImportError(IMPORT_OPENSEARCH_PY_ERROR) return bulk @@ -44,7 +43,7 @@ def _import_not_found_error() -> Any: try: from opensearchpy.exceptions import NotFoundError except ImportError: - raise ValueError(IMPORT_OPENSEARCH_PY_ERROR) + raise ImportError(IMPORT_OPENSEARCH_PY_ERROR) return NotFoundError @@ -54,7 +53,7 @@ def _get_opensearch_client(opensearch_url: str, **kwargs: Any) -> Any: opensearch = _import_opensearch() client = opensearch(opensearch_url, **kwargs) except ValueError as e: - raise ValueError( + raise ImportError( f"OpenSearch client string provided is not in proper format. " f"Got error: {e} " ) @@ -315,7 +314,7 @@ def _get_kwargs_value(kwargs: Any, key: str, default_value: Any) -> Any: class OpenSearchVectorSearch(VectorStore): - """Wrapper around OpenSearch as a vector database. + """`Amazon OpenSearch Vector Engine` vector store. Example: .. code-block:: python diff --git a/libs/langchain/langchain/vectorstores/pgembedding.py b/libs/langchain/langchain/vectorstores/pgembedding.py index 4c820636c62..ecdb20a8f51 100644 --- a/libs/langchain/langchain/vectorstores/pgembedding.py +++ b/libs/langchain/langchain/vectorstores/pgembedding.py @@ -1,4 +1,3 @@ -"""VectorStore wrapper around a Postgres database.""" from __future__ import annotations import logging @@ -23,11 +22,15 @@ _LANGCHAIN_DEFAULT_COLLECTION_NAME = "langchain" class BaseModel(Base): + """Base model for all SQL stores.""" + __abstract__ = True uuid = sqlalchemy.Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4) class CollectionStore(BaseModel): + """Collection store.""" + __tablename__ = "langchain_pg_collection" name = sqlalchemy.Column(sqlalchemy.String) @@ -67,6 +70,8 @@ class CollectionStore(BaseModel): class EmbeddingStore(BaseModel): + """Embedding store.""" + __tablename__ = "langchain_pg_embedding" collection_id = sqlalchemy.Column( @@ -87,15 +92,14 @@ class EmbeddingStore(BaseModel): class QueryResult: - """QueryResult is a result from a query.""" + """Result from a query.""" EmbeddingStore: EmbeddingStore distance: float class PGEmbedding(VectorStore): - """ - VectorStore implementation using Postgres and the pg_embedding extension. + """`Postgres` with the `pg_embedding` extension as a vector store. pg_embedding uses sequential scan by default. but you can create a HNSW index using the create_hnsw_index method. diff --git a/libs/langchain/langchain/vectorstores/pgvector.py b/libs/langchain/langchain/vectorstores/pgvector.py index 9581bdc3b0b..a86a88cb108 100644 --- a/libs/langchain/langchain/vectorstores/pgvector.py +++ b/libs/langchain/langchain/vectorstores/pgvector.py @@ -1,4 +1,3 @@ -"""VectorStore wrapper around a Postgres/PGVector database.""" from __future__ import annotations import enum @@ -46,12 +45,14 @@ _LANGCHAIN_DEFAULT_COLLECTION_NAME = "langchain" class BaseModel(Base): + """Base model for the SQL stores.""" + __abstract__ = True uuid = sqlalchemy.Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4) class PGVector(VectorStore): - """VectorStore implementation using Postgres and pgvector. + """`Postgres`/`PGVector` vector store. To use, you should have the ``pgvector`` python package installed. diff --git a/libs/langchain/langchain/vectorstores/pinecone.py b/libs/langchain/langchain/vectorstores/pinecone.py index 6ecf0b291b2..c6793b4de81 100644 --- a/libs/langchain/langchain/vectorstores/pinecone.py +++ b/libs/langchain/langchain/vectorstores/pinecone.py @@ -1,4 +1,3 @@ -"""Wrapper around Pinecone vector database.""" from __future__ import annotations import logging @@ -17,7 +16,7 @@ logger = logging.getLogger(__name__) class Pinecone(VectorStore): - """Wrapper around Pinecone vector database. + """`Pinecone` vector store. To use, you should have the ``pinecone-client`` python package installed. diff --git a/libs/langchain/langchain/vectorstores/qdrant.py b/libs/langchain/langchain/vectorstores/qdrant.py index f18b2cc9124..7b9d9869ce9 100644 --- a/libs/langchain/langchain/vectorstores/qdrant.py +++ b/libs/langchain/langchain/vectorstores/qdrant.py @@ -1,4 +1,3 @@ -"""Wrapper around Qdrant vector database.""" from __future__ import annotations import asyncio @@ -40,7 +39,7 @@ if TYPE_CHECKING: class QdrantException(Exception): - """Base class for all the Qdrant related exceptions""" + """`Qdrant` related exceptions.""" def sync_call_fallback(method: Callable) -> Callable: @@ -68,7 +67,7 @@ def sync_call_fallback(method: Callable) -> Callable: class Qdrant(VectorStore): - """Wrapper around Qdrant vector database. + """`Qdrant` vector store. To use you should have the ``qdrant-client`` package installed. @@ -102,7 +101,7 @@ class Qdrant(VectorStore): try: import qdrant_client except ImportError: - raise ValueError( + raise ImportError( "Could not import qdrant-client python package. " "Please install it with `pip install qdrant-client`." ) diff --git a/libs/langchain/langchain/vectorstores/redis.py b/libs/langchain/langchain/vectorstores/redis.py index 198e5d706a3..56429bea86c 100644 --- a/libs/langchain/langchain/vectorstores/redis.py +++ b/libs/langchain/langchain/vectorstores/redis.py @@ -1,5 +1,3 @@ -"""Wrapper around Redis vector database.""" - from __future__ import annotations import json @@ -96,7 +94,7 @@ def _default_relevance_score(val: float) -> float: class Redis(VectorStore): - """Wrapper around Redis vector database. + """`Redis` vector store. To use, you should have the ``redis`` python package installed. @@ -184,7 +182,7 @@ class Redis(VectorStore): from redis.commands.search.field import TextField, VectorField from redis.commands.search.indexDefinition import IndexDefinition, IndexType except ImportError: - raise ValueError( + raise ImportError( "Could not import redis python package. " "Please install it with `pip install redis`." ) @@ -612,7 +610,7 @@ class Redis(VectorStore): class RedisVectorStoreRetriever(VectorStoreRetriever): - """Retriever for Redis VectorStore.""" + """Retriever for `Redis` vector store.""" vectorstore: Redis """Redis VectorStore.""" diff --git a/libs/langchain/langchain/vectorstores/rocksetdb.py b/libs/langchain/langchain/vectorstores/rocksetdb.py index 5b2fc234a46..67447377418 100644 --- a/libs/langchain/langchain/vectorstores/rocksetdb.py +++ b/libs/langchain/langchain/vectorstores/rocksetdb.py @@ -1,4 +1,3 @@ -"""Wrapper around Rockset vector database.""" from __future__ import annotations import logging @@ -13,7 +12,7 @@ logger = logging.getLogger(__name__) class Rockset(VectorStore): - """Wrapper arpund Rockset vector database. + """`Rockset` vector store. To use, you should have the `rockset` python package installed. Note that to use this, the collection being used must already exist in your Rockset instance. diff --git a/libs/langchain/langchain/vectorstores/scann.py b/libs/langchain/langchain/vectorstores/scann.py index a1ce4af4808..434080e7e23 100644 --- a/libs/langchain/langchain/vectorstores/scann.py +++ b/libs/langchain/langchain/vectorstores/scann.py @@ -1,4 +1,3 @@ -"""Wrapper around ScaNN vector database.""" from __future__ import annotations import operator @@ -25,7 +24,7 @@ def normalize(x: np.ndarray) -> np.ndarray: def dependable_scann_import() -> Any: """ - Import scann if available, otherwise raise error. + Import `scann` if available, otherwise raise error. """ try: import scann @@ -38,7 +37,7 @@ def dependable_scann_import() -> Any: class ScaNN(VectorStore): - """Wrapper around ScaNN vector database. + """`ScaNN` vector store. To use, you should have the ``scann`` python package installed. diff --git a/libs/langchain/langchain/vectorstores/singlestoredb.py b/libs/langchain/langchain/vectorstores/singlestoredb.py index 7c05778c835..983f3f7f030 100644 --- a/libs/langchain/langchain/vectorstores/singlestoredb.py +++ b/libs/langchain/langchain/vectorstores/singlestoredb.py @@ -1,5 +1,3 @@ -"""Wrapper around SingleStore DB.""" - from __future__ import annotations import json @@ -35,8 +33,7 @@ ORDERING_DIRECTIVE: dict = { class SingleStoreDB(VectorStore): - """ - This class serves as a Pythonic interface to the SingleStore DB database. + """`SingleStore DB` vector store. The prerequisite for using this class is the installation of the ``singlestoredb`` Python package. diff --git a/libs/langchain/langchain/vectorstores/sklearn.py b/libs/langchain/langchain/vectorstores/sklearn.py index dcc6237c257..d4f49c96589 100644 --- a/libs/langchain/langchain/vectorstores/sklearn.py +++ b/libs/langchain/langchain/vectorstores/sklearn.py @@ -21,7 +21,7 @@ DEFAULT_FETCH_K = 20 # Number of Documents to initially fetch during MMR search class BaseSerializer(ABC): - """Abstract base class for saving and loading data.""" + """Base class for serializing data.""" def __init__(self, persist_path: str) -> None: self.persist_path = persist_path @@ -57,7 +57,7 @@ class JsonSerializer(BaseSerializer): class BsonSerializer(BaseSerializer): - """Serializes data in binary json using the bson python package.""" + """Serializes data in binary json using the `bson` python package.""" def __init__(self, persist_path: str) -> None: super().__init__(persist_path) @@ -77,7 +77,7 @@ class BsonSerializer(BaseSerializer): class ParquetSerializer(BaseSerializer): - """Serializes data in Apache Parquet format using the pyarrow package.""" + """Serializes data in `Apache Parquet` format using the `pyarrow` package.""" def __init__(self, persist_path: str) -> None: super().__init__(persist_path) @@ -125,8 +125,8 @@ class SKLearnVectorStoreException(RuntimeError): class SKLearnVectorStore(VectorStore): - """A simple in-memory vector store based on the scikit-learn library - NearestNeighbors implementation.""" + """Simple in-memory vector store based on the `scikit-learn` library + `NearestNeighbors` implementation.""" def __init__( self, diff --git a/libs/langchain/langchain/vectorstores/starrocks.py b/libs/langchain/langchain/vectorstores/starrocks.py index d6abc40af88..a172d1bbb6d 100644 --- a/libs/langchain/langchain/vectorstores/starrocks.py +++ b/libs/langchain/langchain/vectorstores/starrocks.py @@ -1,5 +1,3 @@ -"""Wrapper around open source StarRocks VectorSearch capability.""" - from __future__ import annotations import json @@ -69,7 +67,7 @@ def get_named_result(connection: Any, query: str) -> List[dict[str, Any]]: class StarRocksSettings(BaseSettings): - """StarRocks Client Configuration + """StarRocks client configuration. Attribute: StarRocks_host (str) : An URL to connect to MyScale backend. @@ -121,7 +119,7 @@ class StarRocksSettings(BaseSettings): class StarRocks(VectorStore): - """Wrapper around StarRocks vector database + """`StarRocks` vector store. You need a `pymysql` python package, and a valid account to connect to StarRocks. diff --git a/libs/langchain/langchain/vectorstores/supabase.py b/libs/langchain/langchain/vectorstores/supabase.py index a0f9183097c..d911965346f 100644 --- a/libs/langchain/langchain/vectorstores/supabase.py +++ b/libs/langchain/langchain/vectorstores/supabase.py @@ -26,7 +26,9 @@ if TYPE_CHECKING: class SupabaseVectorStore(VectorStore): - """VectorStore for a Supabase postgres database. Assumes you have the `pgvector` + """`Supabase Postgres` vector store. + + It assumes you have the `pgvector` extension installed and a `match_documents` (or similar) function. For more details: https://integrations.langchain.com/vectorstores?integration_name=SupabaseVectorStore @@ -92,7 +94,7 @@ class SupabaseVectorStore(VectorStore): try: import supabase # noqa: F401 except ImportError: - raise ValueError( + raise ImportError( "Could not import supabase python package. " "Please install it with `pip install supabase`." ) diff --git a/libs/langchain/langchain/vectorstores/tair.py b/libs/langchain/langchain/vectorstores/tair.py index 26108da5923..e55ea42834e 100644 --- a/libs/langchain/langchain/vectorstores/tair.py +++ b/libs/langchain/langchain/vectorstores/tair.py @@ -1,4 +1,3 @@ -"""Wrapper around Tair Vector.""" from __future__ import annotations import json @@ -19,7 +18,7 @@ def _uuid_key() -> str: class Tair(VectorStore): - """Wrapper around Tair Vector store.""" + """`Tair` vector store.""" def __init__( self, diff --git a/libs/langchain/langchain/vectorstores/tigris.py b/libs/langchain/langchain/vectorstores/tigris.py index 036103999fe..6abbfe6762f 100644 --- a/libs/langchain/langchain/vectorstores/tigris.py +++ b/libs/langchain/langchain/vectorstores/tigris.py @@ -15,12 +15,14 @@ if TYPE_CHECKING: class Tigris(VectorStore): + """`Tigris` vector store.""" + def __init__(self, client: TigrisClient, embeddings: Embeddings, index_name: str): - """Initialize Tigris vector store""" + """Initialize Tigris vector store.""" try: import tigrisdb # noqa: F401 except ImportError: - raise ValueError( + raise ImportError( "Could not import tigrisdb python package. " "Please install it with `pip install tigrisdb`" ) diff --git a/libs/langchain/langchain/vectorstores/typesense.py b/libs/langchain/langchain/vectorstores/typesense.py index a35b2cf0ccc..cdaaa5155e9 100644 --- a/libs/langchain/langchain/vectorstores/typesense.py +++ b/libs/langchain/langchain/vectorstores/typesense.py @@ -1,4 +1,3 @@ -"""Wrapper around Typesense vector search""" from __future__ import annotations import uuid @@ -15,7 +14,7 @@ if TYPE_CHECKING: class Typesense(VectorStore): - """Wrapper around Typesense vector search. + """`Typesense` vector store. To use, you should have the ``typesense`` python package installed. @@ -61,7 +60,7 @@ class Typesense(VectorStore): try: from typesense import Client except ImportError: - raise ValueError( + raise ImportError( "Could not import typesense python package. " "Please install it with `pip install typesense`." ) diff --git a/libs/langchain/langchain/vectorstores/usearch.py b/libs/langchain/langchain/vectorstores/usearch.py index 1d0e754e1d1..cb4e8c6eb26 100644 --- a/libs/langchain/langchain/vectorstores/usearch.py +++ b/libs/langchain/langchain/vectorstores/usearch.py @@ -1,4 +1,3 @@ -"""Wrapper around USearch vector database.""" from __future__ import annotations from typing import Any, Dict, Iterable, List, Optional, Tuple @@ -27,7 +26,8 @@ def dependable_usearch_import() -> Any: class USearch(VectorStore): - """Wrapper around USearch vector database. + """`USearch` vector store. + To use, you should have the ``usearch`` python package installed. """ diff --git a/libs/langchain/langchain/vectorstores/vectara.py b/libs/langchain/langchain/vectorstores/vectara.py index cd8ee9c9fad..eee2f1abe1f 100644 --- a/libs/langchain/langchain/vectorstores/vectara.py +++ b/libs/langchain/langchain/vectorstores/vectara.py @@ -1,4 +1,3 @@ -"""Wrapper around Vectara vector database.""" from __future__ import annotations import json @@ -18,7 +17,7 @@ logger = logging.getLogger(__name__) class Vectara(VectorStore): - """Implementation of Vector Store using Vectara. + """`Vectara API` vector store. See (https://vectara.com). @@ -426,7 +425,7 @@ class Vectara(VectorStore): class VectaraRetriever(VectorStoreRetriever): - """Retriever class for Vectara.""" + """Retriever class for `Vectara`.""" vectorstore: Vectara """Vectara vectorstore.""" diff --git a/libs/langchain/langchain/vectorstores/weaviate.py b/libs/langchain/langchain/vectorstores/weaviate.py index 0f54801f933..5f09a785d44 100644 --- a/libs/langchain/langchain/vectorstores/weaviate.py +++ b/libs/langchain/langchain/vectorstores/weaviate.py @@ -1,4 +1,3 @@ -"""Wrapper around weaviate vector database.""" from __future__ import annotations import datetime @@ -44,7 +43,7 @@ def _create_weaviate_client(**kwargs: Any) -> Any: try: import weaviate except ImportError: - raise ValueError( + raise ImportError( "Could not import weaviate python package. " "Please install it with `pip install weaviate-client`" ) @@ -70,7 +69,7 @@ def _json_serializable(value: Any) -> Any: class Weaviate(VectorStore): - """Wrapper around Weaviate vector database. + """`Weaviate` vector store. To use, you should have the ``weaviate-client`` python package installed. diff --git a/libs/langchain/langchain/vectorstores/xata.py b/libs/langchain/langchain/vectorstores/xata.py index ef25bc1a6e6..441fee825d8 100644 --- a/libs/langchain/langchain/vectorstores/xata.py +++ b/libs/langchain/langchain/vectorstores/xata.py @@ -1,5 +1,3 @@ -"""Wrapper around Xata as a vector database.""" - from __future__ import annotations import time @@ -12,7 +10,9 @@ from langchain.vectorstores.base import VectorStore class XataVectorStore(VectorStore): - """VectorStore for a Xata database. Assumes you have a Xata database + """`Xata` vector store. + + It assumes you have a Xata database created with the right schema. See the guide at: https://integrations.langchain.com/vectorstores?integration_name=XataVectorStore @@ -29,7 +29,7 @@ class XataVectorStore(VectorStore): try: from xata.client import XataClient # noqa: F401 except ImportError: - raise ValueError( + raise ImportError( "Could not import xata python package. " "Please install it with `pip install xata`." ) diff --git a/libs/langchain/langchain/vectorstores/zep.py b/libs/langchain/langchain/vectorstores/zep.py index faf04a139fe..98593ec91aa 100644 --- a/libs/langchain/langchain/vectorstores/zep.py +++ b/libs/langchain/langchain/vectorstores/zep.py @@ -22,8 +22,7 @@ logger = logging.getLogger() @dataclass class CollectionConfig: - """ - A configuration class for a Zep Collection. + """Configuration for a `Zep Collection`. If the collection does not exist, it will be created. @@ -46,9 +45,9 @@ class CollectionConfig: class ZepVectorStore(VectorStore): - """ - ZepVectorStore is a VectorStore implementation that uses the Zep long-term memory - store as a backend. It provides methods for adding texts or documents to the store, + """`Zep` vector store. + + It provides methods for adding texts or documents to the store, searching for similar documents, and deleting documents. Search scores are calculated using cosine similarity normalized to [0, 1]. diff --git a/libs/langchain/langchain/vectorstores/zilliz.py b/libs/langchain/langchain/vectorstores/zilliz.py index 835a03a74ac..8a571aca3bf 100644 --- a/libs/langchain/langchain/vectorstores/zilliz.py +++ b/libs/langchain/langchain/vectorstores/zilliz.py @@ -10,9 +10,9 @@ logger = logging.getLogger(__name__) class Zilliz(Milvus): - """Initialize wrapper around the Zilliz vector database. + """`Zilliz` vector store. - In order to use this you need to have `pymilvus` installed and a + You need to have `pymilvus` installed and a running Zilliz database. See the following documentation for how to run a Zilliz instance: