Skip to content

databricks_langchain 0.4.2 release #98

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# CHANGELOG

## databricks-langchain 0.4.2, (2025-04-08)

### Bugfix
- Improve validation for `index_name` for vectorIndex

## databrick-ai-bridge 0.4.1, databricks-langchain 0.4.1, databricks-openai 0.3.1 (2025-03-27)

### Improvements
Expand Down Expand Up @@ -43,6 +48,6 @@ Initial version of databricks-ai-bridge and databricks-langchain packages
Features:

- Support for Databricks AI/BI Genie via the `databricks_langchain.GenieAgent` API in `databricks-langchain`
- Support for most functionality in the existing `langchain-databricks` under `databricks-langchain`. Specifically, this
- Support for most functionality in the existing `langchain-databricks` under `databricks-langchain`. Specifically, this
release introduces `databricks_langchain.ChatDatabricks`, `databricks_langchain.DatabricksEmbeddings`, and
`databricks_langchain.DatabricksVectorSearch` APIs.
`databricks_langchain.DatabricksVectorSearch` APIs.
2 changes: 1 addition & 1 deletion integrations/langchain/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "databricks-langchain"
version = "0.4.1.dev0"
version = "0.4.2"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't want to commit removing the dev0 here right?

Copy link
Contributor Author

@sunishsheth2009 sunishsheth2009 Apr 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is against the databricks-ai-bridge-0.4.1 branch. In master yes we want to keep the .dev0 but in the branch we want to remove it.

Let me know if I am missing something

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah okay, looks good 👍

description = "Support for Databricks AI support in LangChain"
authors = [
{ name="Databricks", email="agent-feedback@databricks.com" },
Expand Down
12 changes: 7 additions & 5 deletions integrations/langchain/src/databricks_langchain/vectorstores.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import asyncio
import logging
import re
import uuid
from functools import partial
from typing import (
Expand Down Expand Up @@ -35,7 +34,6 @@

_DIRECT_ACCESS_ONLY_MSG = "`%s` is only supported for direct-access index."
_NON_MANAGED_EMB_ONLY_MSG = "`%s` is not supported for index with Databricks-managed embeddings."
_INDEX_NAME_PATTERN = re.compile(r"^[a-zA-Z0-9_]+\.[a-zA-Z0-9_]+\.[a-zA-Z0-9_]+$")


class DatabricksVectorSearch(VectorStore):
Expand Down Expand Up @@ -227,10 +225,14 @@ def __init__(
workspace_client: Optional[WorkspaceClient] = None,
client_args: Optional[Dict[str, Any]] = None,
):
if not (isinstance(index_name, str) and _INDEX_NAME_PATTERN.match(index_name)):
if not isinstance(index_name, str):
raise ValueError(
"The `index_name` parameter must be a string in the format "
f"'catalog.schema.index'. Received: {index_name}"
f"The `index_name` parameter must be a string, but got {type(index_name).__name__}."
)

if index_name.count(".") != 2:
raise ValueError(
f"The `index_name` parameter must be in the format 'catalog.schema.name', but got {index_name!r}."
)

try:
Expand Down
4 changes: 3 additions & 1 deletion integrations/langchain/tests/unit_tests/test_vectorstores.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ def test_init_with_endpoint_name() -> None:
assert vectorsearch.index.describe() == INDEX_DETAILS[DELTA_SYNC_INDEX]


@pytest.mark.parametrize("index_name", [None, "invalid", 123, MagicMock(spec=VectorSearchIndex)])
@pytest.mark.parametrize(
"index_name", [None, 123, "invalid.name", MagicMock(spec=VectorSearchIndex)]
)
def test_init_fail_invalid_index_name(index_name) -> None:
with pytest.raises(ValueError, match="The `index_name` parameter must be"):
DatabricksVectorSearch(index_name=index_name)
Expand Down