Skip to content

Commit

Permalink
Merge branch 'master' into docs-integrations-missed-references-fix-21
Browse files Browse the repository at this point in the history
  • Loading branch information
efriis authored Oct 16, 2024
2 parents a76f22f + b8bfebd commit 6089ebe
Show file tree
Hide file tree
Showing 9 changed files with 1,021 additions and 807 deletions.
20 changes: 10 additions & 10 deletions docs/docs/integrations/platforms/google.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -72,27 +72,27 @@ See a [usage example](/docs/integrations/chat/google_vertex_ai_palm).
from langchain_google_vertexai import ChatVertexAI
```

### Chat Anthropic on Vertex AI Model Garden
### Anthropic on Vertex AI Model Garden

See a [usage example](/docs/integrations/llms/google_vertex_ai_palm).

```python
from langchain_google_vertexai.model_garden import ChatAnthropicVertex
```

### Chat Llama on Vertex AI Model Garden
### Llama on Vertex AI Model Garden

```python
from langchain_google_vertexai.model_garden_maas.llama import VertexModelGardenLlama
```

### Chat Mistral on Vertex AI Model Garden
### Mistral on Vertex AI Model Garden

```python
from langchain_google_vertexai.model_garden_maas.mistral import VertexModelGardenMistral
```

### Chat Gemma local from Hugging Face
### Gemma local from Hugging Face

>Local `Gemma` model loaded from `HuggingFace`.
Expand All @@ -106,7 +106,7 @@ pip install langchain-google-vertexai
from langchain_google_vertexai.gemma import GemmaChatLocalHF
```

### Chat Gemma local from Kaggle
### Gemma local from Kaggle

>Local `Gemma` model loaded from `Kaggle`.
Expand All @@ -120,7 +120,7 @@ pip install langchain-google-vertexai
from langchain_google_vertexai.gemma import GemmaChatLocalKaggle
```

### Chat Gemma on Vertex AI Model Garden
### Gemma on Vertex AI Model Garden

We need to install `langchain-google-vertexai` python package.

Expand All @@ -132,7 +132,7 @@ pip install langchain-google-vertexai
from langchain_google_vertexai.gemma import GemmaChatVertexAIModelGarden
```

### Vertex AI image captioning chat
### Vertex AI image captioning

>Implementation of the `Image Captioning model` as a chat.
Expand All @@ -146,7 +146,7 @@ pip install langchain-google-vertexai
from langchain_google_vertexai.vision_models import VertexAIImageCaptioningChat
```

### Vertex AI image editor chat
### Vertex AI image editor

>Given an image and a prompt, edit the image. Currently only supports mask-free editing.
Expand All @@ -160,7 +160,7 @@ pip install langchain-google-vertexai
from langchain_google_vertexai.vision_models import VertexAIImageEditorChat
```

### Vertex AI image generator chat
### Vertex AI image generator

>Generates an image from a prompt.
Expand All @@ -174,7 +174,7 @@ pip install langchain-google-vertexai
from langchain_google_vertexai.vision_models import VertexAIImageGeneratorChat
```

### Vertex AI visual QnA chat
### Vertex AI visual QnA

>Chat implementation of a visual QnA model
Expand Down
7 changes: 7 additions & 0 deletions libs/community/langchain_community/chat_models/databricks.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
import logging
from urllib.parse import urlparse

from langchain_core._api import deprecated

from langchain_community.chat_models.mlflow import ChatMlflow

logger = logging.getLogger(__name__)


@deprecated(
since="0.3.3",
removal="1.0",
alternative_import="langchain_databricks.ChatDatabricks",
)
class ChatDatabricks(ChatMlflow):
"""`Databricks` chat models API.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,13 @@ def _run_query(self) -> List[Dict[str, Any]]:
cursor.execute(self.query)
columns = [col[0] for col in cursor.description]
data = cursor.fetchall()
data = [dict(zip(columns, row)) for row in data]
data = [
{
i: (j if not isinstance(j, oracledb.LOB) else j.read())
for i, j in zip(columns, row)
}
for row in data
]
except oracledb.DatabaseError as e:
print("Got error while connecting: " + str(e)) # noqa: T201
data = []
Expand Down
7 changes: 7 additions & 0 deletions libs/community/langchain_community/embeddings/databricks.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
from typing import Iterator, List
from urllib.parse import urlparse

from langchain_core._api import deprecated

from langchain_community.embeddings.mlflow import MlflowEmbeddings


Expand All @@ -11,6 +13,11 @@ def _chunk(texts: List[str], size: int) -> Iterator[List[str]]:
yield texts[i : i + size]


@deprecated(
since="0.3.3",
removal="1.0",
alternative_import="langchain_databricks.DatabricksEmbeddings",
)
class DatabricksEmbeddings(MlflowEmbeddings):
"""Databricks embeddings.
Expand Down
6 changes: 6 additions & 0 deletions libs/community/langchain_community/llms/databricks.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from typing import Any, Callable, Dict, List, Mapping, Optional

import requests
from langchain_core._api import deprecated
from langchain_core.callbacks import CallbackManagerForLLMRun
from langchain_core.language_models import LLM
from pydantic import (
Expand Down Expand Up @@ -262,6 +263,11 @@ def _pickle_fn_to_hex_string(fn: Callable) -> str:
raise ValueError(f"Failed to pickle the function: {e}")


@deprecated(
since="0.3.3",
removal="1.0",
alternative_import="langchain_databricks.ChatDatabricks",
)
class Databricks(LLM):
"""Databricks serving endpoint or a cluster driver proxy app for LLM.
Expand Down
11 changes: 8 additions & 3 deletions libs/community/langchain_community/llms/vllm.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,19 @@ def _generate(
**kwargs: Any,
) -> LLMResult:
"""Run the LLM on the given prompt and input."""

from vllm import SamplingParams

# build sampling parameters
params = {**self._default_params, **kwargs, "stop": stop}
sampling_params = SamplingParams(**params)

# filter params for SamplingParams
known_keys = SamplingParams.__annotations__.keys()
sample_params = SamplingParams(
**{k: v for k, v in params.items() if k in known_keys}
)

# call the model
outputs = self.client.generate(prompts, sampling_params)
outputs = self.client.generate(prompts, sample_params)

generations = []
for output in outputs:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
)

import numpy as np
from langchain_core._api import warn_deprecated
from langchain_core._api import deprecated, warn_deprecated
from langchain_core.documents import Document
from langchain_core.embeddings import Embeddings
from langchain_core.vectorstores import VST, VectorStore
Expand All @@ -29,6 +29,11 @@
logger = logging.getLogger(__name__)


@deprecated(
since="0.3.3",
removal="1.0",
alternative_import="langchain_databricks.DatabricksVectorSearch",
)
class DatabricksVectorSearch(VectorStore):
"""`Databricks Vector Search` vector store.
Expand Down
Loading

0 comments on commit 6089ebe

Please sign in to comment.