{"id":8263,"library":"langchain-databricks","title":"Databricks Integration (Deprecated)","description":"The `langchain-databricks` package was an integration library connecting LangChain with Databricks AI features, including LLMs, vector search, and MLflow. It has been superseded by `databricks-langchain` to consolidate Databricks-related LangChain components. The last published version of `langchain-databricks` is 0.1.2, and it is no longer actively maintained or receiving new features. Users should migrate to the `databricks-langchain` package for continued support and new functionality.","status":"deprecated","version":"0.1.2","language":"en","source_language":"en","source_url":"https://github.com/langchain-ai/langchain-databricks","tags":["langchain","databricks","llm","ai","integration","deprecated","mlflow","vector search"],"install":[{"cmd":"pip install langchain-databricks","lang":"bash","label":"Install Deprecated Package"},{"cmd":"pip install databricks-langchain","lang":"bash","label":"Install Recommended Replacement"}],"dependencies":[{"reason":"Core LangChain framework, implicitly required for using the integrations.","package":"langchain","optional":false},{"reason":"Many Databricks integrations were initially in or moved to langchain-community before the dedicated databricks-langchain package. Often installed alongside.","package":"langchain-community","optional":true},{"reason":"Required for MLflow integration features, such as logging and tracking LangChain models.","package":"mlflow>=2.9.0","optional":true},{"reason":"Often needed for authentication and programmatic interaction with Databricks services, especially when running outside a Databricks Workspace.","package":"databricks-sdk","optional":true}],"imports":[{"note":"The original import path for ChatDatabricks is deprecated. Use the new `databricks_langchain` package.","wrong":"from langchain_databricks import ChatDatabricks","symbol":"ChatDatabricks","correct":"from databricks_langchain import ChatDatabricks"},{"note":"The original import path for DatabricksEmbeddings is deprecated. Use the new `databricks_langchain` package.","wrong":"from langchain_databricks import DatabricksEmbeddings","symbol":"DatabricksEmbeddings","correct":"from databricks_langchain import DatabricksEmbeddings"},{"note":"The original import path for DatabricksVectorSearch is deprecated. Use the new `databricks_langchain` package.","wrong":"from langchain_databricks import DatabricksVectorSearch","symbol":"DatabricksVectorSearch","correct":"from databricks_langchain import DatabricksVectorSearch"}],"quickstart":{"code":"import os\nfrom databricks_langchain import ChatDatabricks\nfrom langchain_core.messages import HumanMessage\n\n# --- IMPORTANT: FOR RUNNING OUTSIDE DATABRICKS WORKSPACE ---\n# Set these environment variables or pass them directly to the ChatDatabricks constructor.\n# os.environ[\"DATABRICKS_HOST\"] = os.environ.get(\"DATABRICKS_HOST\", \"https://your-databricks-workspace.cloud.databricks.com\")\n# os.environ[\"DATABRICKS_TOKEN\"] = os.environ.get(\"DATABRICKS_TOKEN\", \"dapi********************************\")\n\n# Instantiate the chat model using a Databricks Model Serving endpoint\n# Replace 'databricks-meta-llama-3-70b-instruct' with your actual endpoint name.\n# Ensure DATABRICKS_HOST and DATABRICKS_TOKEN are set if running outside Databricks workspace.\nchat_model = ChatDatabricks(\n    endpoint=\"databricks-meta-llama-3-70b-instruct\",\n    temperature=0.1,\n    max_tokens=256\n)\n\n# Invoke the model\nresponse = chat_model.invoke([HumanMessage(content=\"What is MLflow?\")])\nprint(response.content)\n\n# --- DEPRECATED PACKAGE USAGE (for context, prefer databricks-langchain) ---\n# from langchain_databricks import ChatDatabricks\n# deprecated_chat_model = ChatDatabricks(endpoint=\"your-deprecated-endpoint\")\n# print(\"WARNING: Using deprecated langchain-databricks package.\")\n","lang":"python","description":"This quickstart demonstrates how to instantiate and use `ChatDatabricks` from the *recommended* `databricks-langchain` package to interact with a Databricks Model Serving endpoint. If running outside a Databricks Workspace, ensure `DATABRICKS_HOST` and `DATABRICKS_TOKEN` environment variables are set for authentication. The code for the deprecated `langchain-databricks` is shown for historical context but should not be used in new projects."},"warnings":[{"fix":"Migrate your `pip install` command to `pip install databricks-langchain` and update all imports from `langchain_databricks` to `databricks_langchain`.","message":"The `langchain-databricks` package is deprecated. All features have been consolidated into the new `databricks-langchain` package. Future updates and new features will be released exclusively in `databricks-langchain`.","severity":"breaking","affected_versions":"<0.1.2"},{"fix":"Set `DATABRICKS_HOST` and `DATABRICKS_TOKEN` environment variables or pass `databricks_host` and `databricks_token` directly during class instantiation (e.g., `ChatDatabricks(endpoint=..., databricks_host=..., databricks_token=...)`).","message":"When running outside a Databricks workspace, you must explicitly set Databricks authentication credentials (hostname and personal access token).","severity":"gotcha","affected_versions":"All"},{"fix":"Double-check that the `endpoint` name passed to `ChatDatabricks` or `DatabricksEmbeddings` exactly matches the configured endpoint name in your Databricks workspace. Verify associated API keys and resource configurations.","message":"Model serving endpoint name mismatches or incorrect API key/configuration are common causes for invocation failures.","severity":"gotcha","affected_versions":"All"},{"fix":"Use `mlflow.langchain.log_model(lc_model=..., registered_model_name='your_catalog.your_schema.your_model', model_config={'chain_type': 'stuff'})`.","message":"When logging LangChain models with MLflow, ensure the model name adheres to the three-level Unity Catalog path (`<catalog>.<schema>.<model>`) and that `chain_type` is passed in `model_config` for proper reconstruction.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Install the new package (`pip install databricks-langchain`) and update your import statements to use `from databricks_langchain import ...`.","cause":"Attempting to import from the deprecated `langchain_databricks` package when it's not installed or when the new `databricks_langchain` package is expected.","error":"ModuleNotFoundError: No module named 'langchain_databricks'"},{"fix":"Ensure `endpoint` is provided, e.g., `ChatDatabricks(endpoint=\"your-model-serving-endpoint\")`.","cause":"The `endpoint` parameter is missing when initializing `ChatDatabricks` or `DatabricksEmbeddings` during MLflow logging or direct use.","error":"MlflowException: Failed to save runnable sequence: ... ChatDatabricks -- 1 validation error for ChatDatabricks\\nendpoint\\n Field required"},{"fix":"Rebuild your LangChain chain components to ensure all instances of Databricks classes (like `ChatDatabricks`) are explicitly re-imported and re-instantiated from `databricks_langchain`. You might also need to include `langchain-databricks` in `pip_requirements` during `mlflow.langchain.log_model` as a temporary shim if full migration isn't immediate.","cause":"MLflow is attempting to serialize a `ChatDatabricks` object that still resolves to the deprecated `langchain_databricks` module, even if your current code uses `databricks_langchain` imports. This often happens if the object wasn't fully re-instantiated after migration.","error":"MlflowException: Failed to save runnable sequence: ... trying to import ChatDatabricks from the legacy module path “langchain_databricks”"},{"fix":"Verify the expected input format for your specific Databricks Model Serving endpoint. Ensure your LangChain `invoke` call provides the prompt in the correct format (e.g., as a `HumanMessage` in a list for chat models). If custom transformation is used, check `transform_input_fn` parameters.","cause":"The input to the Databricks LLM endpoint is not in the expected string format, or the `transform_input_fn` is misconfigured. Some endpoints expect a dictionary or specific JSON structure, not just a raw string.","error":"str type expected (type=type_error.str)"}]}