Install & Compatibility
Where this runs
tested against v0.20.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
py 3.10
✕ build_error
✓ 59.4s
py 3.11
✕ build_error
✓ 57.3s
py 3.12
✕ build_error
✓ 50.3s
py 3.13
✕ build_error
✕ build_error
py 3.9
✕ build_error
✓ 51.4s
953MB installed
● package 953MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
ChatDatabricks
✓ from databricks_langchain import ChatDatabricks
✗ from langchain_community.chat_models import ChatDatabricks
Demonstrates how to initialize and use `ChatDatabricks` for interacting with Databricks-hosted LLMs. It highlights setting up authentication credentials (host and token) via environment variables and making simple API calls with both string and message list inputs.
import os
from langchain_community.chat_models import ChatDatabricks
from langchain_core.messages import HumanMessage
# Ensure these environment variables are set for authentication:
# os.environ["DATABRICKS_HOST"] = "https://<your-workspace-url>"
# os.environ["DATABRICKS_TOKEN"] = "dapixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
# Retrieve credentials from environment variables
host = os.environ.get("DATABRICKS_HOST", "")
token = os.environ.get("DATABRICKS_TOKEN", "")
if not host or not token:
print("Error: DATABRICKS_HOST and DATABRICKS_TOKEN environment variables must be set.")
# In a production environment, you would likely raise an exception or handle gracefully.
exit(1)
# Initialize the Databricks chat model
llm = ChatDatabricks(
databricks_host=host,
databricks_token=token,
temperature=0.1,
model="databricks-mixtral-8x7b-instruct" # Use an appropriate model available in your workspace
)
# Invoke the model with a string prompt
response = llm.invoke("Explain the concept of RAG in LLMs in one sentence.")
print(f"\nString prompt response: {response.content}")
# Example with a list of messages (common for chat models)
messages = [
HumanMessage(content="What is the capital of France?"),
]
response_chat = llm.invoke(messages)
print(f"\nChat response: {response_chat.content}")
Debug
Known issues
gotchaAuthentication failures are common. Ensure `DATABRICKS_HOST` and `DATABRICKS_TOKEN` environment variables are correctly set or passed directly. The host URL should include the `https://` prefix.fixVerify `os.environ.get('DATABRICKS_HOST')` and `os.environ.get('DATABRICKS_TOKEN')` return valid values. Check Databricks workspace URL and the scope/permissions of your access token. affects: All
gotchaIncorrect import paths. While the package name is `databricks-langchain`, its components are integrated into LangChain's community modules and should be imported from `langchain_community`.fixAlways use `from langchain_community.<component_type> import <Class>` (e.g., `from langchain_community.chat_models import ChatDatabricks`). Directly importing from `databricks_langchain` will likely fail or lead to unexpected behavior.
affects: All versions >=0.1.0
gotchaPydantic version conflicts are frequent within the LangChain ecosystem. `databricks-langchain` currently requires `pydantic<3`. If other libraries in your environment demand `pydantic>=2`, you may encounter dependency resolution issues.fixUse dedicated virtual environments for your projects. If conflicts arise, try to find compatible versions across all your LangChain-related dependencies or consider isolating conflicting parts of your application.
affects: All versions where `pydantic<2` or similar constraint is specified in `install_requires` (current: `<3`).
gotchaThe `model` parameter for `ChatDatabricks` (and similar components) must refer to a valid and accessible LLM deployment within your Databricks workspace. Using an incorrect or unavailable model name will result in an API error.fixConsult your Databricks workspace's serving endpoints configuration (e.g., through the UI or Databricks SDK) to confirm the exact names of available LLM deployments and ensure they are accessible from your execution environment.
affects: All
Upgrade
Version history
0.20.0latest on PyPI · released Jun 10, 2026
Audit
Dependencies
langchainrequiredCore LangChain framework components are required for integration.
langchain-corerequiredFundamental LangChain abstractions and utilities.
pydanticrequiredData validation and settings management, common across the LangChain ecosystem.