Skip to content
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

community: Add deprecation warning for GigaChat integration in langchain-community #28022

Merged
merged 3 commits into from
Nov 20, 2024
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
10 changes: 5 additions & 5 deletions docs/docs/integrations/chat/gigachat.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"source": [
"# GigaChat\n",
"This notebook shows how to use LangChain with [GigaChat](https://developers.sber.ru/portal/products/gigachat).\n",
"To use you need to install ```gigachat``` python package."
"To use you need to install ```langchain_gigachat``` python package."
]
},
{
Expand All @@ -22,7 +22,7 @@
},
"outputs": [],
"source": [
"%pip install --upgrade --quiet gigachat"
"%pip install --upgrade --quiet langchain-gigachat"
]
},
{
Expand Down Expand Up @@ -53,20 +53,20 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"from langchain_community.chat_models import GigaChat\n",
"from langchain_gigachat import GigaChat\n",
"\n",
"chat = GigaChat(verify_ssl_certs=False, scope=\"GIGACHAT_API_PERS\")"
]
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 6,
"metadata": {
"collapsed": false
},
Expand Down
6 changes: 3 additions & 3 deletions docs/docs/integrations/providers/salute_devices.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ For more info how to get access to GigaChat [follow here](https://developers.sbe
GigaChat package can be installed via pip from PyPI:

```bash
pip install gigachat
pip install langchain-gigachat
```

## LLMs
Expand All @@ -25,13 +25,13 @@ from langchain_community.llms import GigaChat
See a [usage example](/docs/integrations/chat/gigachat).

```python
from langchain_community.chat_models import GigaChat
from langchain_gigachat.chat_models import GigaChat
```

## Embeddings

See a [usage example](/docs/integrations/text_embedding/gigachat).

```python
from langchain_community.embeddings import GigaChatEmbeddings
from langchain_gigachat.embeddings import GigaChatEmbeddings
```
19 changes: 8 additions & 11 deletions docs/docs/integrations/text_embedding/gigachat.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"pycharm": {
"is_executing": true
}
},
"outputs": [],
"source": [
"%pip install --upgrade --quiet gigachat"
"%pip install --upgrade --quiet langchain-gigachat"
]
},
{
Expand Down Expand Up @@ -50,13 +53,13 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"from langchain_community.embeddings import GigaChatEmbeddings\n",
"from langchain_gigachat import GigaChatEmbeddings\n",
"\n",
"embeddings = GigaChatEmbeddings(verify_ssl_certs=False, scope=\"GIGACHAT_API_PERS\")"
]
Expand All @@ -81,13 +84,7 @@
"outputs": [
{
"data": {
"text/plain": [
"[0.8398333191871643,\n",
" -0.14180311560630798,\n",
" -0.6161925792694092,\n",
" -0.17103666067123413,\n",
" 1.2884578704833984]"
]
"text/plain": "[0.8398333191871643,\n -0.14180311560630798,\n -0.6161925792694092,\n -0.17103666067123413,\n 1.2884578704833984]"
},
"execution_count": 8,
"metadata": {},
Expand Down
6 changes: 6 additions & 0 deletions libs/community/langchain_community/chat_models/gigachat.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
Type,
)

from langchain_core._api.deprecation import deprecated
from langchain_core.callbacks import (
AsyncCallbackManagerForLLMRun,
CallbackManagerForLLMRun,
Expand Down Expand Up @@ -113,6 +114,11 @@ def _convert_delta_to_message_chunk(
return default_class(content=content) # type: ignore[call-arg]


@deprecated(
since="0.3.5",
removal="1.0",
alternative_import="langchain_gigachat.GigaChat",
)
class GigaChat(_BaseGigaChat, BaseChatModel):
"""`GigaChat` large language models API.

Expand Down
6 changes: 6 additions & 0 deletions libs/community/langchain_community/embeddings/gigachat.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from functools import cached_property
from typing import Any, Dict, List, Optional

from langchain_core._api.deprecation import deprecated
from langchain_core.embeddings import Embeddings
from langchain_core.utils import pre_init
from langchain_core.utils.pydantic import get_fields
Expand All @@ -15,6 +16,11 @@
MAX_BATCH_SIZE_PARTS = 90


@deprecated(
since="0.3.5",
removal="1.0",
alternative_import="langchain_gigachat.GigaChatEmbeddings",
)
class GigaChatEmbeddings(BaseModel, Embeddings):
"""GigaChat Embeddings models.

Expand Down
Loading