{"id":2458,"library":"databricks-vectorsearch","title":"Databricks Vector Search Client","description":"The `databricks-vectorsearch` Python client library provides programmatic access to Databricks Vector Search, a serverless similarity search engine. It enables users to manage vector search endpoints and indexes, facilitating the creation of Retrieval Augmented Generation (RAG) applications. The library integrates seamlessly with the Databricks Data Intelligence Platform and Unity Catalog for data governance. Currently at version 0.67, it is actively developed with regular updates.","status":"active","version":"0.67","language":"en","source_language":"en","source_url":"https://docs.databricks.com/en/generative-ai/vector-search.html","tags":["Databricks","Vector Search","AI","ML","RAG","Database Client","Embeddings"],"install":[{"cmd":"pip install databricks-vectorsearch","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Internal dependency for handling deprecated features.","package":"deprecation","optional":false},{"reason":"Likely for integration with MLflow for model serving or tracking.","package":"mlflow-skinny","optional":false},{"reason":"Common dependency for data serialization.","package":"protobuf","optional":false},{"reason":"Used for making HTTP requests to the Databricks Vector Search API.","package":"requests","optional":false}],"imports":[{"symbol":"VectorSearchClient","correct":"from databricks.vector_search.client import VectorSearchClient"}],"quickstart":{"code":"import os\nfrom databricks.vector_search.client import VectorSearchClient\n\n# Replace with your Databricks workspace URL and Personal Access Token\nworkspace_url = os.environ.get(\"DATABRICKS_WORKSPACE_URL\", \"https://<your-workspace-url>.databricks.com\")\npat = os.environ.get(\"DATABRICKS_TOKEN\", \"\")\n\nif not pat:\n    print(\"Warning: DATABRICKS_TOKEN environment variable not set. This example may not work without authentication.\")\n\n# Initialize the Vector Search Client\nclient = VectorSearchClient(workspace_url=workspace_url, personal_access_token=pat)\n\n# Replace with your endpoint and index names\nendpoint_name = \"<your-vector-search-endpoint>\"\nindex_name = \"<your-catalog>.<your-schema>.<your-index-name>\"\n\ntry:\n    # Get an existing index instance\n    index = client.get_index(index_name=index_name)\n\n    # Perform a similarity search\n    query_text = \"What is Databricks Vector Search?\"\n    results = index.similarity_search(\n        query_text=query_text,\n        num_results=2,\n        columns=[\"text\", \"id\"] # specify columns to return\n    )\n\n    print(f\"Similarity search results for '{query_text}':\")\n    for result in results.get('result', {}).get('data_array', []):\n        print(f\"  ID: {result}, Text: {result[:100]}...\")\n\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")\n    print(\"Please ensure the Vector Search endpoint and index exist and your credentials are correct.\")","lang":"python","description":"Initializes the VectorSearchClient and performs a similarity search on an existing index. Ensure `DATABRICKS_WORKSPACE_URL` and `DATABRICKS_TOKEN` environment variables are set or replaced with actual values."},"warnings":[{"fix":"Update your SQL queries to use `query_text` for text-based searches or `query_vector` for vector-based searches, depending on your index configuration.","message":"In Databricks Runtime 15.3 and above, the `vector_search()` SQL function's `query` argument was replaced by `query_text` or `query_vector`. Using `query` in newer runtimes will result in an error.","severity":"breaking","affected_versions":"Databricks Runtime <=15.2 (for `query`), >=15.3 (for `query_text`/`query_vector`)"},{"fix":"Always interact with index objects obtained via `VectorSearchClient` methods.","message":"The `VectorSearchIndex` class should not be instantiated directly. Instead, obtain an index instance using methods provided by the `VectorSearchClient` (e.g., `client.get_index()`).","severity":"gotcha","affected_versions":"All"},{"fix":"Configure your client with `service_principal_client_id` and `service_principal_client_secret` along with `azure_tenant_id` for Azure, or equivalent for other clouds, and enable service principal usage for vector search index ownership.","message":"For production deployments, Databricks strongly recommends using Service Principals for authentication instead of Personal Access Tokens (PATs). Service Principals offer better security and can improve query performance.","severity":"gotcha","affected_versions":"All"},{"fix":"When creating or modifying Vector Search Indexes, ensure a Service Principal is assigned as the owner.","message":"Removing the owner of a Vector Search Index can break associated Databricks Liquid (DLT) pipelines and other dependencies, requiring index recreation. Assigning a Service Principal as the index owner prevents this issue.","severity":"gotcha","affected_versions":"All"},{"fix":"Use the `usage_policy_id` parameter instead of `budget_policy_id` when creating or updating endpoints and indexes.","message":"The `budget_policy_id` parameter for creating Vector Search endpoints and indexes has been deprecated. It has been replaced by `usage_policy_id`.","severity":"deprecated","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-10T00:00:00.000Z","next_check":"2026-07-09T00:00:00.000Z"}