mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-25 16:13:25 +00:00
community: Add deprecation warning for GigaChat integration in langchain-community (#28022)
- **Description:** We have released the [langchain-gigachat](https://github.com/ai-forever/langchain-gigachat?tab=readme-ov-file) with new GigaChat integration that support's function/tool calling. This PR deprecated legacy GigaChat class in community package. --------- Co-authored-by: Erick Friis <erick@langchain.dev>
This commit is contained in:
parent
567dc1e422
commit
2901fa20cc
@ -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."
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -22,7 +22,7 @@
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"%pip install --upgrade --quiet gigachat"
|
||||
"%pip install --upgrade --quiet langchain-gigachat"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -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
|
||||
},
|
||||
|
@ -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
|
||||
@ -25,7 +25,7 @@ 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
|
||||
@ -33,5 +33,5 @@ from langchain_community.chat_models import GigaChat
|
||||
See a [usage example](/docs/integrations/text_embedding/gigachat).
|
||||
|
||||
```python
|
||||
from langchain_community.embeddings import GigaChatEmbeddings
|
||||
from langchain_gigachat.embeddings import GigaChatEmbeddings
|
||||
```
|
@ -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"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -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\")"
|
||||
]
|
||||
@ -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": {},
|
||||
|
@ -13,6 +13,7 @@ from typing import (
|
||||
Type,
|
||||
)
|
||||
|
||||
from langchain_core._api.deprecation import deprecated
|
||||
from langchain_core.callbacks import (
|
||||
AsyncCallbackManagerForLLMRun,
|
||||
CallbackManagerForLLMRun,
|
||||
@ -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.
|
||||
|
||||
|
@ -4,6 +4,7 @@ import logging
|
||||
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
|
||||
@ -15,6 +16,11 @@ MAX_BATCH_SIZE_CHARS = 1000000
|
||||
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.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user