目录
一、LangChain 介绍
二、部署 LangChain
2.1 安装 langchain
2.2 安装 langchain_community
2.3 安装 qianfan
三、实例运行
3.1 Chat Models
3.2 LLMs
3.3 Embedding Models
四、总结
本篇文章主要通过 Flexus云服务器X实例 部署开源项目 LangChain,LangChain 能够为大模型相关开发提供支持,是一个应用程序开发框架。Flexus云服务器X实例 能够支持电商店铺管理、企业建站、小程序后台、小游戏、开发测试环境、云端学习、搭建博客等多种场景,而且,Flexus云服务器X实例 能够提供完备的产品能力,可以基于业务诉求灵活自定义拓扑组网,大模型QoS保障,计算性能强劲稳定,满足更高负载业务诉求等优势,需要的小伙伴赶紧用起来吧!
一、LangChain 介绍
LangChain 是一个由大型语言模型 (LLM) 驱动的应用程序开发框架。对于这些应用程序,LangChain 简化了整个应用程序生命周期:
开源库:使用 LangChain 的开源构建块、组件和第三方集成构建您的应用程序。使用 LangGraph 构建具有一流流式传输和人机交互支持的状态代理。
生产化:使用 LangSmith 检查、监控和评估您的应用程序,以便您可以不断优化和自信地部署。
部署:使用 LangGraph Cloud 将您的 LangGraph 应用程序转变为可用于生产的 API 和助手。
开源库 langchain-core:基本抽象和 LangChain 表达语言。
langchain-community:第三方集成。 一些集成已进一步拆分为仅依赖 langchain-core 的合作伙伴包。示例包括 langchain_openai 和 langchain_anthropic。
langchain:构成应用程序认知架构的链、代理和检索策略。
LangGraph:一个库,用于通过将步骤建模为图中的边和节点,使用 LLM 构建强大且有状态的多参与者应用程序。与 LangChain 顺利集成,但可以在没有它的情况下使用。
二、部署 LangChain
2.1 安装 langchain
安装 langchain 软件包,执行如下命令安装。
root@flexusx-7305:~# pip install langchain
Collecting langchainDownloading langchain-0.3.0-py3-none-any.whl (1.0 MB)|████████████████████████████████| 1.0 MB 963 kB/s
Collecting aiohttp<4.0.0,>=3.8.3Downloading aiohttp-3.10.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB)|████████████████████████████████| 1.2 MB 77.1 MB/s
Collecting langchain-core<0.4.0,>=0.3.0Downloading langchain_core-0.3.2-py3-none-any.whl (399 kB)|████████████████████████████████| 399 kB 92.2 MB/s
Collecting async-timeout<5.0.0,>=4.0.0; python_version < "3.11"Downloading async_timeout-4.0.3-py3-none-any.whl (5.7 kB)
Collecting numpy<2,>=1; python_version < "3.12"Using cached numpy-1.26.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (18.2 MB)
Requirement already satisfied: PyYAML>=5.3 in /usr/lib/python3/dist-packages (from langchain) (5.3.1)
Collecting pydantic<3.0.0,>=2.7.4Downloading pydantic-2.9.2-py3-none-any.whl (434 kB)|████████████████████████████████| 434 kB 115.1 MB/s
Requirement already satisfied: requests<3,>=2 in /usr/lib/python3/dist-packages (from langchain) (2.22.0)
Collecting langsmith<0.2.0,>=0.1.17Downloading langsmith-0.1.125-py3-none-any.whl (290 kB)|████████████████████████████████| 290 kB 125.3 MB/s
Collecting tenacity!=8.4.0,<9.0.0,>=8.1.0Downloading tenacity-8.5.0-py3-none-any.whl (28 kB)
Collecting langchain-text-splitters<0.4.0,>=0.3.0Downloading langchain_text_splitters-0.3.0-py3-none-any.whl (25 kB)
Collecting SQLAlchemy<3,>=1.4Downloading SQLAlchemy-2.0.35-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.1 MB)|████████████████████████████████| 3.1 MB 127.6 MB/s
Collecting multidict<7.0,>=4.5Downloading multidict-6.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (124 kB)|████████████████████████████████| 124 kB 128.8 MB/s
通过 pip 查看 langchain 是否安装成功。
root@flexusx-7305:~# pip list | grep langchain
langchain 0.3.0
langchain-core 0.3.2
langchain-text-splitters 0.3.0
root@flexusx-7305:~#
2.2 安装 langchain_community
安装 langchain_community,执行如下命令安装。
root@flexusx-7305:~/langchain# pip install langchain_community
Collecting langchain_communityDownloading langchain_community-0.3.0-py3-none-any.whl (2.3 MB)|████████████████████████████████| 2.3 MB 983 kB/s
Collecting pydantic-settings<3.0.0,>=2.4.0Downloading pydantic_settings-2.5.2-py3-none-any.whl (26 kB)
Requirement already satisfied: requests<3,>=2 in /usr/lib/python3/dist-packages (from langchain_community) (2.22.0)
Requirement already satisfied: PyYAML>=5.3 in /usr/lib/python3/dist-packages (from langchain_community) (5.3.1)
Requirement already satisfied: langchain<0.4.0,>=0.3.0 in /usr/local/lib/python3.10/dist-packages (from langchain_community) (0.3.0)
Requirement already satisfied: langsmith<0.2.0,>=0.1.112 in /usr/local/lib/python3.10/dist-packages (from langchain_community) (0.1.125)
Requirement already satisfied: numpy<2,>=1; python_version < "3.12" in /usr/local/lib/python3.10/dist-packages (from langchain_community) (1.26.4)
Requirement already satisfied: langchain-core<0.4.0,>=0.3.0 in /usr/local/lib/python3.10/dist-packages (from langchain_community) (0.3.2)
Requirement already satisfied: tenacity!=8.4.0,<9.0.0,>=8.1.0 in /usr/local/lib/python3.10/dist-packages (from langchain_community) (8.5.0)
Collecting dataclasses-json<0.7,>=0.5.7Downloading dataclasses_json-0.6.7-py3-none-any.whl (28 kB)
Requirement already satisfied: SQLAlchemy<3,>=1.4 in /usr/local/lib/python3.10/dist-packages (from langchain_community) (2.0.35)
Requirement already satisfied: aiohttp<4.0.0,>=3.8.3 in /usr/local/lib/python3.10/dist-packages (from langchain_community) (3.10.5)
Requirement already satisfied: pydantic>=2.7.0 in /usr/local/lib/python3.10/dist-packages (from pydantic-settings<3.0.0,>=2.4.0->langchain_community) (2.9.2)
Collecting python-dotenv>=0.21.0Using cached python_dotenv-1.0.1-py3-none-any.whl (19 kB)
Requirement already satisfied: langchain-text-splitters<0.4.0,>=0.3.0 in /usr/local/lib/python3.10/dist-packages (from langchain<0.4.0,>=0.3.0->langchain_community) (0.3.0)
Requirement already satisfied: async-timeout<5.0.0,>=4.0.0; python_version < "3.11" in /usr/local/lib/python3.10/dist-packages (from langchain<0.4.0,>=0.3.0->langchain_community) (4.0.3)
Requirement already satisfied: orjson<4.0.0,>=3.9.14 in /usr/local/lib/python3.10/dist-packages (from langsmith<0.2.0,>=0.1.112->langchain_community) (3.10.7)
Requirement already satisfied: httpx<1,>=0.23.0 in /usr/local/lib/python3.10/dist-packages (from langsmith<0.2.0,>=0.1.112->langchain_community) (0.27.2)
Requirement already satisfied: packaging<25,>=23.2 in /usr/local/lib/python3.10/dist-packages (from langchain-core<0.4.0,>=0.3.0->langchain_community) (24.1)
Requirement already satisfied: typing-extensions>=4.7 in /usr/local/lib/python3.10/dist-packages (from langchain-core<0.4.0,>=0.3.0->langchain_community) (4.12.2)
Requirement already satisfied: jsonpatch<2.0,>=1.33 in /usr/local/lib/python3.10/dist-packages (from langchain-core<0.4.0,>=0.3.0->langchain_community) (1.33)
Collecting typing-inspect<1,>=0.4.0Using cached typing_inspect-0.9.0-py3-none-any.whl (8.8 kB)
Collecting marshmallow<4.0.0,>=3.18.0Downloading marshmallow-3.22.0-py3-none-any.whl (49 kB)|████████████████████████████████| 49 kB 16.5 MB/s
Requirement already satisfied: greenlet!=0.4.17; python_version < "3.13" and (platform_machine == "aarch64" or (platform_machine == "ppc64le" or (platform_machine == "x86_64" or (platform_machine == "amd64" or (platform_machine == "AMD64" or (platform_machine == "win32" or platform_machine == "WIN32")))))) in /usr/local/lib/python3.10/dist-packages (from SQLAlchemy<3,>=1.4->langchain_community) (3.1.0)
Requirement already satisfied: aiohappyeyeballs>=2.3.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4.0.0,>=3.8.3->langchain_community) (2.4.0)
Requirement already satisfied: aiosignal>=1.1.2 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4.0.0,>=3.8.3->langchain_community) (1.3.1)
Requirement already satisfied: yarl<2.0,>=1.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4.0.0,>=3.8.3->langchain_community) (1.11.1)
Requirement already satisfied: multidict<7.0,>=4.5 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4.0.0,>=3.8.3->langchain_community) (6.1.0)
Requirement already satisfied: attrs>=17.3.0 in /usr/lib/python3/dist-packages (from aiohttp<4.0.0,>=3.8.3->langchain_community) (19.3.0)
Requirement already satisfied: frozenlist>=1.1.1 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4.0.0,>=3.8.3->langchain_community) (1.4.1)
Requirement already satisfied: pydantic-core==2.23.4 in /usr/local/lib/python3.10/dist-packages (from pydantic>=2.7.0->pydantic-settings<3.0.0,>=2.4.0->langchain_community) (2.23.4)
Requirement already satisfied: annotated-types>=0.6.0 in /usr/local/lib/python3.10/dist-packages (from pydantic>=2.7.0->pydantic-settings<3.0.0,>=2.4.0->langchain_community) (0.7.0)
Requirement already satisfied: sniffio in /usr/local/lib/python3.10/dist-packages (from httpx<1,>=0.23.0->langsmith<0.2.0,>=0.1.112->langchain_community) (1.3.1)
Requirement already satisfied: idna in /usr/lib/python3/dist-packages (from httpx<1,>=0.23.0->langsmith<0.2.0,>=0.1.112->langchain_community) (2.8)
Requirement already satisfied: certifi in /usr/lib/python3/dist-packages (from httpx<1,>=0.23.0->langsmith<0.2.0,>=0.1.112->langchain_community) (2019.11.28)
Requirement already satisfied: anyio in /usr/local/lib/python3.10/dist-packages (from httpx<1,>=0.23.0->langsmith<0.2.0,>=0.1.112->langchain_community) (4.5.0)
Requirement already satisfied: httpcore==1.* in /usr/local/lib/python3.10/dist-packages (from httpx<1,>=0.23.0->langsmith<0.2.0,>=0.1.112->langchain_community) (1.0.5)
Requirement already satisfied: jsonpointer>=1.9 in /usr/local/lib/python3.10/dist-packages (from jsonpatch<2.0,>=1.33->langchain-core<0.4.0,>=0.3.0->langchain_community) (3.0.0)
Collecting mypy-extensions>=0.3.0Downloading mypy_extensions-1.0.0-py3-none-any.whl (4.7 kB)
Requirement already satisfied: exceptiongroup>=1.0.2; python_version < "3.11" in /usr/local/lib/python3.10/dist-packages (from anyio->httpx<1,>=0.23.0->langsmith<0.2.0,>=0.1.112->langchain_community) (1.2.2)
Requirement already satisfied: h11<0.15,>=0.13 in /usr/local/lib/python3.10/dist-packages (from httpcore==1.*->httpx<1,>=0.23.0->langsmith<0.2.0,>=0.1.112->langchain_community) (0.14.0)
Installing collected packages: python-dotenv, pydantic-settings, mypy-extensions, typing-inspect, marshmallow, dataclasses-json, langchain-community
Successfully installed dataclasses-json-0.6.7 langchain-community-0.3.0 marshmallow-3.22.0 mypy-extensions-1.0.0 pydantic-settings-2.5.2 python-dotenv-1.0.1 typing-inspect-0.9.0
通过 pip 查看 langchain_commity 是否安装成功。
root@flexusx-7305:~/langchain# pip list | grep langchain
langchain 0.3.0
langchain-community 0.3.0
langchain-core 0.3.2
langchain-text-splitters 0.3.0
root@flexusx-7305:~/langchain#
2.3 安装 qianfan
安装 qianfan 软件包,以便访问千帆相关大模型,执行如下命令。
root@flexusx-7305:~/langchain# pip install qianfan
Collecting qianfanDownloading qianfan-0.4.8.1-py3-none-any.whl (463 kB)|████████████████████████████████| 463 kB 955 kB/s
Collecting pyyaml<7.0.0,>=6.0.1Downloading PyYAML-6.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (751 kB)|████████████████████████████████| 751 kB 23.3 MB/s
Collecting prompt-toolkit>=3.0.38Downloading prompt_toolkit-3.0.47-py3-none-any.whl (386 kB)|████████████████████████████████| 386 kB 103.7 MB/s
Collecting rich>=13.0.0Using cached rich-13.8.1-py3-none-any.whl (241 kB)
Collecting multiprocess>=0.70.12Downloading multiprocess-0.70.16-py310-none-any.whl (134 kB)|████████████████████████████████| 134 kB 73.5 MB/s
Requirement already satisfied: pydantic>=1.0 in /usr/local/lib/python3.10/dist-packages (from qianfan) (2.9.2)
Collecting typer>=0.9.0Using cached typer-0.12.5-py3-none-any.whl (47 kB)
Requirement already satisfied: tenacity<9.0.0,>=8.2.3 in /usr/local/lib/python3.10/dist-packages (from qianfan) (8.5.0)
Collecting bce-python-sdk>=0.8.79Downloading bce_python_sdk-0.9.22-py3-none-any.whl (336 kB)|████████████████████████████████| 336 kB 104.5 MB/s
Collecting diskcache>=5.6.3Using cached diskcache-5.6.3-py3-none-any.whl (45 kB)
Collecting cachetools>=5.0.0Using cached cachetools-5.5.0-py3-none-any.whl (9.5 kB)
Requirement already satisfied: aiohttp>=3.7.0 in /usr/local/lib/python3.10/dist-packages (from qianfan) (3.10.5)
Requirement already satisfied: python-dotenv>=1.0; python_version >= "3.8" in /usr/local/lib/python3.10/dist-packages (from qianfan) (1.0.1)
Collecting requests>=2.24Using cached requests-2.32.3-py3-none-any.whl (64 kB)
Collecting aiolimiter>=1.1.0Downloading aiolimiter-1.1.0-py3-none-any.whl (7.2 kB)
Collecting wcwidthDownloading wcwidth-0.2.13-py2.py3-none-any.whl (34 kB)
Collecting markdown-it-py>=2.2.0Downloading markdown_it_py-3.0.0-py3-none-any.whl (87 kB)
通过 pip 命令查看 qianfan 是否安装成功,如下所示。
root@flexusx-7305:~# pip list | grep qianfan
qianfan 0.4.8.1
root@flexusx-7305:~#
如果在安装 qianfan 过程中报错如下。
ERROR: Cannot uninstall 'PyYAML'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
可以先执行如下命令后,再安装 qianfan,如下所示。
pip install --ignore-installed PyYAML
三、实例运行
3.1 Chat Models
要使用 qianfan 大模型,需要现在百度千帆平台注册,申请对应的 API Key。
下面就来看一下通过 qianfan 模型测试 langchain 的使用,执行代码如下所示。
# 导入包
import os
#import qianfan
from langchain_community.chat_models import QianfanChatEndpoint
from langchain_core.language_models.chat_models import HumanMessage# 配置API
os.environ["QIANFAN_AK"] = "62vLXXXX"
os.environ["QIANFAN_SK"] = "R5obqXXXX"# 创建LLM
chat = QianfanChatEndpoint(streaming=False)
messages = [HumanMessage(content="你好")]
res = chat.invoke(messages)
print(res.content)
输出如下所示。
[WARNING][2024-09-20 22:23:33.999] redis_rate_limiter.py:21 [t:140401586898752]: no redis installed, RedisRateLimiter unavailable
[INFO][2024-09-20 22:23:34.025] oauth.py:277 [t:140401586898752]: trying to refresh token for ak `62vLn7***`
[INFO][2024-09-20 22:23:34.093] oauth.py:304 [t:140401586898752]: successfully refresh token
你好!有什么需要我帮助的吗?
root@flexusx-7305:~/langchain#
如上所示,需要先设置 QIANFAN_AK 和 QIANFAN_SK 两个环境变量,都是千帆大模型的 API Key。
3.2 LLMs
下面来试下直接询问 LLM 问题,执行代码如下所示。
"""For basic init and call"""
import osfrom langchain_community.llms import QianfanLLMEndpoint# 配置API
os.environ["QIANFAN_AK"] = "62vLnXXX"
os.environ["QIANFAN_SK"] = "R5obqzXXXXX"llm = QianfanLLMEndpoint(streaming=True)
res = llm.invoke("hi")
print(res)
输出如下所示。
(autogenstudy) E:\code\example\langchain>python langchain_LLMs.py
[INFO][2024-09-21 09:43:00.714] oauth.py:277 [t:8748]: trying to refresh token for ak `62vLn7***`
[INFO][2024-09-21 09:43:00.924] oauth.py:304 [t:8748]: successfully refresh token
你好!有什么我可以帮助你的吗?(autogenstudy) E:\code\example\langchain>
3.3 Embedding Models
下面来试下嵌入模型,执行代码如下所示。
"""For basic init and call"""
import osfrom langchain_community.embeddings import QianfanEmbeddingsEndpoint# 配置API
os.environ["QIANFAN_AK"] = "62vLn7qWXXXXXXX"
os.environ["QIANFAN_SK"] = "R5obqzSXXXXXXXX"embed = QianfanEmbeddingsEndpoint()
res = embed.embed_documents(["hi", "world"])print(res)
输出如下所示。
(autogenstudy) E:\code\example\langchain>python langchain_embedding.py
D:\Software\anaconda3\envs\autogenstudy\lib\site-packages\pydantic\_internal\_fields.py:161: UserWarning: Field "model_kwargs" has conflict with protected namespace "model_".You may be able to resolve this warning by setting `model_config['protected_namespaces'] = ()`.warnings.warn(
[INFO][2024-09-21 09:48:08.590] oauth.py:277 [t:11932]: trying to refresh token for ak `62vLn7***`
[INFO][2024-09-21 09:48:08.782] oauth.py:304 [t:11932]: successfully refresh token
[[0.0427522286772728, -0.030367236584424973, -0.14847028255462646, 0.055074431002140045, -0.04177454113960266, -0.059512972831726074, -0.043774791061878204, 0.0028191760648041964, 0.0015296273631975055, 0.02662835083901882, -0.0016772364033386111, -0.02373325265944004, 0.024989519268274307, 0.06767582148313522, -0.06782594323158264, 0.02233727276325226, -0.012279014103114605, -0.08887967467308044, 0.023348454385995865, 0.04054414480924606, 0.11744552105665207, 0.004404750652611256, 0.008202494122087955, -0.06102106347680092, 0.001682055415585637, -0.03669474273920059, 0.02882954478263855, -0.02552802488207817, -0.1043526828289032, -0.004301837179809809, -0.03723869100213051, 0.041527390480041504, 0.06227671355009079, -0.028846537694334984, -0.03222361579537392, 0.053921137005090714, -0.057439591735601425, -0.027258194983005524, 0.014361499808728695, -0.020327182486653328, -0.028207872062921524, 0.04774445667862892, -0.008892212994396687, -0.004255489446222782, -0.07189597934484482, -0.06943569332361221, -0.009772798046469688, -0.03148236870765686, -0.021970124915242195, -0.004490712657570839, -0.021300600841641426, 0.06742624938488007, -0.02278980426490307, 0.025378653779625893, -0.0023580489214509726, -0.01684032566845417, -0.019045790657401085, -0.009767942130565643, -0.03494847193360329, -0.006324518006294966, 0.015791021287441254, 0.0814887061715126, -0.019954567775130272, -0.03879446163773537, 0.09949671477079391, -0.047984056174755096, -0.03141402825713158, -0.019796323031187057, 0.001525534433312714, -0.055970169603824615, 0.11803789436817169, -0.020574478432536125, -0.07584436237812042, 0.014085214585065842, -0.09957952797412872, 0.05886165425181389, -0.04138653725385666, -0.02076001837849617, -0.03342568874359131, -0.009152845479547977, 0.0343589186668396, -0.0376022569835186, 0.06923042982816696, 0.028698215261101723, -0.03108092211186886, 0.040469683706760406, 0.12807528674602509, -0.00032946758437901735, 0.08630502969026566, 0.049593232572078705, 0.027012968435883522, -0.11663230508565903, -0.0033974924590438604, -0.021856820210814476, 0.001159213948994875, -0.08227662742137909, -0.04855923727154732, -0.08197946846485138, 0.004231704398989677, -0.06559735536575317, -0.013115216977894306, 0.015022491104900837, -0.06832803785800934, 0.06324171274900436, 0.11512979120016098, -0.01695367693901062, -0.00844004936516285, -0.031247880309820175, -0.02078307792544365, -0.13746888935565948, -0.005060920957475901, 0.14066295325756073, -0.0741814523935318, 0.0645018070936203, 0.048955485224723816, 0.01903589256107807, -0.13829661905765533, 0.07276704907417297, -0.03666973114013672, 0.007012984715402126, -0.03327294439077377, -0.027376169338822365, 0.01019356306642294, 0.1634300947189331, -0.005177486687898636, -0.05798298120498657, -0.0041793170385062695, 0.024489175528287888, -0.003274972317740321, 0.038939468562603, 0.06731753796339035, 0.032610900700092316, -0.061137642711400986, 0.06468665599822998, 0.006699994672089815, -0.012153852730989456, 0.039766356348991394, -0.1581954061985016, -0.07795630395412445, -0.013338014483451843, -0.1264740228652954, 0.11244021356105804, 0.056906573474407196, 0.029164792969822884, -0.07761921733617783, 0.03973625227808952, 0.02950984053313732, 0.1025955080986023, 0.039099037647247314, -0.06865023821592331, -0.0895981714129448, 0.03678714111447334, -0.17113333940505981, -0.05097765475511551, -0.05910571292042732, 0.11929547041654587, 0.05118923261761665, 0.02071736939251423, -7.767366332700476e-05, -0.0737384557723999, -0.026805777102708817, -0.05486055091023445, 0.012425889261066914, -0.03866921365261078, 0.06286909431219101, -0.020704273134469986, 0.054168038070201874, 0.030059928074479103, 0.021440552547574043, 0.01557223591953516, -0.12936235964298248, 0.14318996667861938, 0.09802967309951782, -0.03322954103350639, 0.08495988696813583, -0.03257136791944504, -0.0029122657142579556, 0.10647979378700256, -0.03285961225628853, 0.012172551825642586, -0.007439840584993362, -0.005475893151015043, 0.01250776369124651, -0.060743991285562515, 0.007818746380507946, -0.06538071483373642, 0.05875682458281517, 0.09281481057405472, 0.017310649156570435, -0.02429690770804882, 0.008005285635590553, 0.0017676890129223466, -0.03491242602467537, -0.026719175279140472, 0.04081546887755394, 0.04552198201417923, 0.00994018279016018, -0.0624847449362278, 0.033771175891160965, -0.036876607686281204, 0.024911854416131973, 0.03518271446228027, 0.07251821458339691, -0.006280520930886269, 0.03848915174603462, 0.03412255644798279, -0.0008442272082902491, 0.003427108284085989, 0.0017983054276555777, 0.04687068611383438, 0.023944102227687836, 0.056354016065597534, -0.03847957029938698, -0.09339233487844467, 0.05074654147028923, 0.09738742560148239, 0.1306542456150055, -0.08720067888498306, 0.1621125340461731, 0.012593713589012623, 0.012935473583638668, -0.10135147720575333, 0.018252482637763023, -0.025217251852154732, 0.029768573120236397, 0.057100050151348114, 0.05541665107011795, 0.008498246781527996, -0.04371420666575432, -0.10206279158592224, 0.05202249437570572, 0.0005387852434068918, -0.031057218089699745, 0.10769116878509521, -0.01624862290918827, 0.018111281096935272, -0.048865124583244324, -0.04744061082601547, 0.009832643903791904, -0.008080363273620605, 0.002501097274944186, 0.007648073602467775, 0.15769971907138824, -0.08782845735549927, 0.029670733958482742, 0.015653152018785477, 0.04055802524089813, -0.028582056984305382, -0.005974169820547104, 0.009643495082855225, -0.0700642317533493, -0.010517951101064682, -0.009966008365154266, -0.009451213292777538, -0.019620848819613457, -0.017584435641765594, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -0.36175060272216797, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0.03803155943751335, -0.013231384567916393, 0.0032379645854234695, 0.015074018388986588, -0.006529552862048149, -0.13813287019729614, 0.03297128155827522, 0.044519297778606415, -0.08646591007709503, -0.037307120859622955, 0.06656266003847122, -0.11962700635194778, 0.07230007648468018, -0.07078737020492554, -0.038724612444639206, 0.049646347761154175, -0.03840867429971695, 0.014726407825946808, -0.03581535071134567, 0.007896782830357552, 0.03380471095442772, -0.11329233646392822, -0.017762117087841034, 0.0011431502643972635, 0.04967585206031799, 0.05226016789674759, -0.014677902683615685, 0.0028542056679725647, 0.04947531968355179, 0.06531941890716553, -0.06499949097633362, 0.05327882617712021, 0.04474387690424919, -0.05078141763806343, 0.0005905363359488547, 0.10895922780036926, 0.027925828471779823, 0.005935891065746546, -0.09716738015413284, 0.06653039157390594, -0.01911454275250435, 0.013199672102928162, -0.07219313085079193, -0.02111777663230896, 0.044956982135772705, -0.12210141122341156, -0.07491625100374222, -0.07078894227743149, -0.07549860328435898, -0.0466330349445343, 0.03794679418206215, 0.021631071344017982, 0.09911273419857025, 0.06780899316072464, 0.07717966288328171, 0.002732659690082073, -0.10758297145366669, -0.005902791861444712, 0.06937941163778305, -0.04486368969082832, -0.08554692566394806, 0.023176362738013268, 0.1081351786851883, 0.05717672035098076, 0.03235813230276108, 0.03412460535764694, -0.08494877815246582, 0.06614935398101807, 0.07469704747200012, 0.021401546895503998, 0.029690811410546303, -0.09332005679607391, 0.05121683329343796, 0.015342717990279198, -0.016238031908869743, -0.01802397519350052, -0.001029244507662952, 0.031240155920386314, 0.12874679267406464, -0.010938992723822594, -0.04098162427544594, -0.007148142904043198, 0.02510128542780876, 0.007004745304584503, -0.10119995474815369, -0.0073225609958171844, 0.03733961656689644, 0.020198803395032883, -0.009225967340171337, -0.06051730364561081, -0.10844972729682922, -0.03256922960281372, 0.05340907350182533, -0.05323617905378342, -0.12766879796981812, -0.07649963349103928, -0.05790446326136589, 0.05832531303167343, 0.07291557639837265, -0.03677757456898689, -0.045708417892456055, 0.08064126968383789, -0.009974413551390171, 0.029759712517261505, 0.08100734651088715, -0.05531909316778183, -0.12016095966100693, -0.04446253925561905, 0.06807274371385574, -0.015322030521929264, -0.11547733843326569, 0.02439188025891781, -0.03558140620589256, -0.0293342974036932, 0.0009162131464108825, 0.054568372666835785, -0.008070315234363079, -0.0446196049451828, -0.08299365639686584, -0.02393576130270958, -0.012521671131253242, 0.07468061149120331, -0.05762399733066559, 0.08730564266443253, -0.039049774408340454, 0.03843923658132553, -0.11914210766553879, 0.016294404864311218, -5.648607384500792e-06, 0.15457335114479065, 0.029045872390270233, -0.012776081450283527, -0.008811134845018387, -0.05834332853555679, 0.04340386763215065, 0.04625416174530983, -0.02345692366361618, -0.05251571908593178, -0.027090055868029594, 0.0584932416677475, -0.017770566046237946, 0.02546255849301815, 0.008156168274581432, -0.02961161732673645, -0.00374617544002831, 0.042533352971076965, 0.07673060894012451, -0.011488307267427444, 0.004311175551265478, 0.04836355149745941, -0.046425994485616684, 0.02545974589884281, 0.023349164053797722, 0.0016245297156274319, -0.03236101195216179, 0.001546622021123767, 0.10114837437868118, -0.06582029163837433, -0.08525561541318893, 0.019862396642565727, -0.007253663614392281, 0.02542901039123535, 0.047377023845911026, -0.06772463023662567, -0.01704506389796734, 0.03996584564447403, -0.1341584175825119, -0.0025763127487152815, 0.06666072458028793, 0.06746456027030945, -0.036479659378528595, 0.012304270640015602, -0.03719504550099373, -0.07890186458826065, 0.08608832210302353, 0.04892297461628914, 0.09758329391479492, 0.0228110421448946, 0.05598039552569389, -0.04221566766500473, -0.06909886747598648, -0.05267439782619476, 0.04622204229235649, -0.07155222445726395, -0.01828089728951454, 0.030920468270778656, 0.022206081077456474, 0.05283673107624054, 0.0987224131822586, 0.027800340205430984, 0.05365709215402603, 0.15527567267417908, -0.007088017649948597, -0.036441072821617126, -0.000695409718900919, 0.017118478193879128, -0.016662422567605972, -0.06546050310134888, -0.07852878421545029, 0.0025951152201741934, -0.015527557581663132, 0.08013276755809784, -0.029598286375403404, -0.06339055299758911, -0.008696185424923897, -0.013328490778803825, -0.03060576319694519, -0.05429801717400551, -0.016875796020030975, -0.031708236783742905, -0.021614093333482742, 0.06565926223993301, -0.06548643112182617, -0.0773853287100792, 0.014884935691952705, 0.09261588752269745, -0.05569826811552048, -0.06994108855724335, 0.12692520022392273, 0.033276285976171494, -0.03882686793804169, 0.07795173674821854, 0.14661654829978943, -0.01259585376828909, 0.018884439021348953, -0.03070089966058731, 0.004043017979711294, 0.009217348881065845, 0.03708619996905327, -0.03993246331810951, -0.0389876514673233, -0.014170861802995205, 0.050645168870687485, 0.11175169050693512, 0.0034148935228586197, 0.027684077620506287, -0.05998023971915245, -0.005322862882167101, 0.019126376137137413, 0.026251960545778275, -0.06900851428508759, 0.02829221822321415, 0.02465403825044632, -0.08576758950948715, 0.039924170821905136, -0.029523015022277832, 0.1774134486913681, 0.043678902089595795, 0.0017398922936990857, 0.047836195677518845, -0.017070481553673744, -0.04592495411634445, -0.005801195278763771, 0.01494352612644434, -0.011580687947571278, -0.09708375483751297, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -0.36232587695121765, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]](autogenstudy) E:\code\example\langchain>
四、总结
通过本篇文章,使用 Flexus云服务器X实例 实例部署了开源项目 LangChain,通过 pip 可以直接安装依赖,包括:langchain、langchain_community、qianfan 等软件包,而且 Flexus云服务器X实例 具有灵活自定义规格、性能稳定强劲、按需灵活计费等优势,有需要的小伙伴赶紧用起来吧!