Registry / llm-agents / databricks-langchain

databricks-langchain

JSON →
library0.20.0pypypi✓ verified 23d ago

The databricks-langchain library provides support for integrating Databricks AI capabilities, such as LLMs and Vector Search, directly into LangChain applications. It enables developers to leverage Databricks-hosted models and data artifacts within the LangChain ecosystem. The current version is 0.18.0, with releases typically aligning with LangChain community updates and Databricks feature rollouts.

pip install databricks-langchain
INSTALL
IMPORT
SIG · DATABRICKS-LANGCHA
D
databricks-langchain
llm-agentspythonv0.20.0
Install
54.6s avg
Import
16260ms
Disk
953MB
Pass rate
4/ 10
Env Coverage4 / 10
glibc
3.93.13
musl
3.93.13
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
musl
glibc
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.
fix
Verify `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`.
fix
Always 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.
fix
Use 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.
fix
Consult 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.
Agent activity
61 hits · last 30 days
node
52
OpenAI (training)
1
Resources