Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: Prithvi Kannan <[email protected]>
  • Loading branch information
prithvikannan committed Dec 9, 2024
1 parent de0d309 commit 3938f2d
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 18 deletions.
1 change: 0 additions & 1 deletion integrations/langchain/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ requires-python = ">=3.9"
dependencies = [
"langchain>=0.2.0",
"langchain-community>=0.2.0",
"langchain-databricks>=0.1.1",
"databricks-ai-bridge",
]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Import modules from langchain-databricks
from databricks_langchain.chat_models import ChatDatabricks
from databricks_langchain.embeddings import DatabricksEmbeddings
from databricks_langchain.genie import GenieAgent
Expand Down
16 changes: 8 additions & 8 deletions integrations/langchain/src/databricks_langchain/chat_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
from langchain_core.tools import BaseTool
from langchain_core.utils.function_calling import convert_to_openai_tool
from langchain_core.utils.pydantic import is_basemodel_subclass
from langchain_databricks.utils import get_deployment_client
from databricks_langchain.utils import get_deployment_client
from mlflow.deployments import BaseDeploymentClient # type: ignore
from pydantic import BaseModel, Field

Expand All @@ -61,11 +61,11 @@ class ChatDatabricks(BaseChatModel):
"""Databricks chat model integration.
Setup:
Install ``langchain-databricks``.
Install ``databricks-langchain``.
.. code-block:: bash
pip install -U langchain-databricks
pip install -U databricks-langchain
If you are outside Databricks, set the Databricks workspace hostname and personal access token to environment variables:
Expand Down Expand Up @@ -93,7 +93,7 @@ class ChatDatabricks(BaseChatModel):
Instantiate:
.. code-block:: python
from langchain_databricks import ChatDatabricks
from databricks_langchain import ChatDatabricks
llm = ChatDatabricks(
endpoint="databricks-meta-llama-3-1-405b-instruct",
Expand Down Expand Up @@ -481,7 +481,7 @@ def with_structured_output(
Example: Function-calling, Pydantic schema (method="function_calling", include_raw=False):
.. code-block:: python
from langchain_databricks import ChatDatabricks
from databricks_langchain import ChatDatabricks
from pydantic import BaseModel
Expand All @@ -505,7 +505,7 @@ class AnswerWithJustification(BaseModel):
Example: Function-calling, Pydantic schema (method="function_calling", include_raw=True):
.. code-block:: python
from langchain_databricks import ChatDatabricks
from databricks_langchain import ChatDatabricks
from pydantic import BaseModel
Expand All @@ -529,7 +529,7 @@ class AnswerWithJustification(BaseModel):
Example: Function-calling, dict schema (method="function_calling", include_raw=False):
.. code-block:: python
from langchain_databricks import ChatDatabricks
from databricks_langchain import ChatDatabricks
from langchain_core.utils.function_calling import convert_to_openai_tool
from pydantic import BaseModel
Expand All @@ -554,7 +554,7 @@ class AnswerWithJustification(BaseModel):
Example: JSON mode, Pydantic schema (method="json_mode", include_raw=True):
.. code-block::
from langchain_databricks import ChatDatabricks
from databricks_langchain import ChatDatabricks
from pydantic import BaseModel
class AnswerWithJustification(BaseModel):
Expand Down
8 changes: 4 additions & 4 deletions integrations/langchain/src/databricks_langchain/embeddings.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
from typing import Any, Dict, Iterator, List

from langchain_core.embeddings import Embeddings
from langchain_databricks.utils import get_deployment_client
from databricks_langchain.utils import get_deployment_client
from pydantic import BaseModel, PrivateAttr


class DatabricksEmbeddings(Embeddings, BaseModel):
"""Databricks embedding model integration.
Setup:
Install ``langchain-databricks``.
Install ``databricks-langchain``.
.. code-block:: bash
pip install -U langchain-databricks
pip install -U databricks-langchain
If you are outside Databricks, set the Databricks workspace
hostname and personal access token to environment variables:
Expand All @@ -35,7 +35,7 @@ class DatabricksEmbeddings(Embeddings, BaseModel):
Instantiate:
.. code-block:: python
from langchain_databricks import DatabricksEmbeddings
from databricks_langchain import DatabricksEmbeddings
embed = DatabricksEmbeddings(
endpoint="databricks-bge-large-en",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from langchain_core.documents import Document
from langchain_core.embeddings import Embeddings
from langchain_core.vectorstores import VST, VectorStore
from langchain_databricks.utils import maximal_marginal_relevance
from databricks_langchain.utils import maximal_marginal_relevance

logger = logging.getLogger(__name__)

Expand All @@ -41,11 +41,11 @@ class DatabricksVectorSearch(VectorStore):
"""Databricks vector store integration.
Setup:
Install ``langchain-databricks`` and ``databricks-vectorsearch`` python packages.
Install ``databricks-langchain`` and ``databricks-vectorsearch`` python packages.
.. code-block:: bash
pip install -U langchain-databricks databricks-vectorsearch
pip install -U databricks-langchain databricks-vectorsearch
If you don't have a Databricks Vector Search endpoint already, you can create one by following the instructions here: https://docs.databricks.com/en/generative-ai/create-query-vector-search.html
Expand Down Expand Up @@ -100,7 +100,7 @@ class DatabricksVectorSearch(VectorStore):
.. code-block:: python
from langchain_databricks.vectorstores import DatabricksVectorSearch
from databricks_langchain.vectorstores import DatabricksVectorSearch
vector_store = DatabricksVectorSearch(index_name="<your-index-name>")
Expand Down

0 comments on commit 3938f2d

Please sign in to comment.