Source code for langchain_community.vectorstores.databricks_vector_search
from __future__ import annotations
import json
import logging
import uuid
from typing import TYPE_CHECKING, Any, Iterable, List, Optional, Tuple, Type
from langchain_core.documents import Document
from langchain_core.embeddings import Embeddings
from langchain_core.vectorstores import VST, VectorStore
if TYPE_CHECKING:
    from databricks.vector_search.client import VectorSearchIndex
logger = logging.getLogger(__name__)
[docs]class DatabricksVectorSearch(VectorStore):
    """`Databricks Vector Search` vector store.
    To use, you should have the ``databricks-vectorsearch`` python package installed.
    Example:
        .. code-block:: python
            from langchain_community.vectorstores import DatabricksVectorSearch
            from databricks.vector_search.client import VectorSearchClient
            vs_client = VectorSearchClient()
            vs_index = vs_client.get_index(
              endpoint_name="vs_endpoint",
              index_name="ml.llm.index"
            )
            vectorstore = DatabricksVectorSearch(vs_index)
    Args:
        index: A Databricks Vector Search index object.
        embedding: The embedding model.
                  Required for direct-access index or delta-sync index
                  with self-managed embeddings.
        text_column: The name of the text column to use for the embeddings.
                    Required for direct-access index or delta-sync index
                    with self-managed embeddings.
                    Make sure the text column specified is in the index.
        columns: The list of column names to get when doing the search.
                Defaults to ``[primary_key, text_column]``.
    Delta-sync index with Databricks-managed embeddings manages the ingestion, deletion,
    and embedding for you.