828华为云征文 | 云服务器Flexus X实例:开源项目 LangChain 部署,实例测试

news2024/9/22 5:19:57

目录

一、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实例 部署开源项目 LangChainLangChain 能够为大模型相关开发提供支持,是一个应用程序开发框架。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 langchain
  Downloading langchain-0.3.0-py3-none-any.whl (1.0 MB)
     |████████████████████████████████| 1.0 MB 963 kB/s 
Collecting aiohttp<4.0.0,>=3.8.3
  Downloading 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.0
  Downloading 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.4
  Downloading 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.17
  Downloading 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.0
  Downloading tenacity-8.5.0-py3-none-any.whl (28 kB)
Collecting langchain-text-splitters<0.4.0,>=0.3.0
  Downloading langchain_text_splitters-0.3.0-py3-none-any.whl (25 kB)
Collecting SQLAlchemy<3,>=1.4
  Downloading 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.5
  Downloading 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_community
  Downloading 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.0
  Downloading 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.7
  Downloading 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.0
  Using 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.0
  Using cached typing_inspect-0.9.0-py3-none-any.whl (8.8 kB)
Collecting marshmallow<4.0.0,>=3.18.0
  Downloading 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.0
  Downloading 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 qianfan
  Downloading qianfan-0.4.8.1-py3-none-any.whl (463 kB)
     |████████████████████████████████| 463 kB 955 kB/s 
Collecting pyyaml<7.0.0,>=6.0.1
  Downloading 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.38
  Downloading prompt_toolkit-3.0.47-py3-none-any.whl (386 kB)
     |████████████████████████████████| 386 kB 103.7 MB/s 
Collecting rich>=13.0.0
  Using cached rich-13.8.1-py3-none-any.whl (241 kB)
Collecting multiprocess>=0.70.12
  Downloading 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.0
  Using 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.79
  Downloading bce_python_sdk-0.9.22-py3-none-any.whl (336 kB)
     |████████████████████████████████| 336 kB 104.5 MB/s 
Collecting diskcache>=5.6.3
  Using cached diskcache-5.6.3-py3-none-any.whl (45 kB)
Collecting cachetools>=5.0.0
  Using 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.24
  Using cached requests-2.32.3-py3-none-any.whl (64 kB)
Collecting aiolimiter>=1.1.0
  Downloading aiolimiter-1.1.0-py3-none-any.whl (7.2 kB)
Collecting wcwidth
  Downloading wcwidth-0.2.13-py2.py3-none-any.whl (34 kB)
Collecting markdown-it-py>=2.2.0
  Downloading 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 os

from 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 os

from 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实例 具有灵活自定义规格、性能稳定强劲、按需灵活计费等优势,有需要的小伙伴赶紧用起来吧!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2154235.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

【Delphi】通过 LiveBindings Designer 链接控件示例

本教程展示了如何使用 LiveBindings Designer 可视化地创建控件之间的 LiveBindings&#xff0c;以便创建只需很少或无需源代码的应用程序。 在本教程中&#xff0c;您将创建一个高清多设备应用程序&#xff0c;该应用程序使用 LiveBindings 绑定多个对象&#xff0c;以更改圆…

[SAP ABAP] 生成表维护视图

SAP由于数据量较大&#xff0c;很多自定义表都需要通过用户自行去维护&#xff0c;一般可以直接在SE16N对数据字典进行维护数据&#xff0c;但不是每个用户都有其操作权限&#xff0c;而且直接在数据字典上操作数据有很高的风险&#xff0c;因此SAP提供了表维护视图生成器&…

算法学习2

学习目录 一.插入排序 一.插入排序 从数组的第一个元素开始&#xff0c;当前元素与其前一个元素进行比较&#xff1b; 大于&#xff08;或小于时&#xff09;将其进行交换&#xff0c;即当前元素替换到前一位&#xff1b; 再将该元素与替换后位置的前一个元素进行交换&#xf…

【全网最全】2024年华为杯研赛A题保奖思路+matlab/py代码+成品论文等(后续会更新完整

您的点赞收藏是我继续更新的最大动力&#xff01; 一定要点击如下卡片链接&#xff0c;那是获取资料的入口&#xff01; 点击链接加入【2024华为杯研赛资料汇总】&#xff1a;https://qm.qq.com/q/goQLLNwfgQhttps://qm.qq.com/q/goQLLNwfgQ A 风电场有功功率优化分配思路 这是…

分页插件、代码生成器

01-分页插件、代码生成器 分页插件使用 首先在pom.xml文件中导入依赖 然后再mybatis-config.xml文件中写入插件 在测试类中写入方法 在mybatis.xml文件中设置plugins标签里的属性helperDialectkeyi自动检查当前数据库用的什么,不用设置也行,默认就设置了 分页插件里面属性详解…

XXL-JOB分片概念讲解

3. 分片功能讲解 3.1 案例需求&#xff1a; 1.我们现在实现这样的需求&#xff0c;在指定节假日&#xff0c;需要给平台的所有用户去发送祝福的短信 3.2.编码实现&#xff1a; a.初始化数据 1.在数据库中导入xxl_job_demo.sql数据 b.集成Druid&MyBatis 1.添加依赖 &…

VisualPromptGFSS

COCO-20 i ^i i太大&#xff0c;不建议复现

利士策分享,华为三折叠手机:重塑未来科技生活的里程碑

利士策分享&#xff0c;华为三折叠手机&#xff1a;重塑未来科技生活的里程碑 在这个日新月异的科技时代&#xff0c;华为再次以惊人的创新力&#xff0c;引领我们迈向智能设备的全新纪元——华为三折叠手机&#xff0c; 不仅是技术的飞跃&#xff0c;更是对未来生活方式的一次…

初识set,map

已知快速查找&#xff1a; 1.暴力查找 2.排序二分查找&#xff08;插入删除麻烦&#xff09; 3.搜索树->二叉搜索树&#xff08;极端情况n&#xff09;->平衡树(AVL树&#xff0c;红黑树&#xff09;(logn高度太高&#xff0c;搜索次数多&#xff09;->多叉平衡搜索…

发现编程的全新境界——明基RD280U显示器使用体验

前言 在大学的四年里&#xff0c;我几乎每天都泡在实验室&#xff0c;盯着电脑屏幕&#xff0c;一行行地码代码。那时&#xff0c;学校提供的显示器是非常基础的款式&#xff0c;功能简单&#xff0c;几乎没有任何特别之处&#xff0c;甚至配置也比较低。那个时候&#xff0c;…

【MySQL 01】数据库基础

目录 1.数据库是什么 2.基本操作 数据库服务器连接操作 数据库和数据库表的创建 服务器&#xff0c;数据库&#xff0c;表关系 数据逻辑存储 3.MySQL架构 4.SQL分类 5.存储引擎 1.数据库是什么 mysql&&mysqld&#xff1a; mysql&#xff1a;这通常指的是 MySQL …

PMBOK® 第六版 排列活动顺序

目录 读后感—PMBOK第六版 目录 职场中有句玩笑话&#xff1a;“工作是永远做不完的&#xff0c;任何时候都不可能做完。”这里所吐槽的要点就在于工作任务繁多以及工作缺乏秩序。工作确实是做不完的&#xff0c;倘若工作都能完成&#xff0c;那也就不需要工作了。 工作中令人…

统信服务器操作系统【搭建FTP】设置介绍

如何在操作系统上安装vsftp服务。设置匿名用户登录、设置授权用户密码访问功能,并介绍使用匿名方式、授权用户方式访问vsftp服务。本文适用于A、D、E三个服务器操作系统版本,除安装方式的差异,其他设置均相同。 文章目录 功能概述一、功能介绍二、准备环境三、安装步骤1. 在…

MoFA: 迈向AIOS

再一次向朋友们致以中秋的祝福&#xff01; MoFA (Modular Framework for Agents)是一个独特的模块化AI智能体框架。MoFA以组合&#xff08;Composition)的逻辑和编程&#xff08;Programmable&#xff09;的方法构建AI智能体。开发者通过模版的继承、编程、定制智能体&#xf…

MobaXterm : Network error: Connection refused(连接被拒绝)

具体报错如下如所示&#xff1a; 首先进行问题排查 ① 检查SSH服务是否运行 sudo service ssh status ② 检查SSH服务是否已启动&#xff08;启用返回 enable&#xff09; sudo systemctl is-enabled ssh ③ 查看所有的端口 sudo netstat -tulnp ④ 查看SSH使用的22号端口有…

部标(JT/T1078)流媒体对接说明

1.前言 最近在配合客户开发流媒体相关的服务的时候&#xff0c;整理了一些对接过程资料&#xff0c;这里做个分享与记录。流媒体的对接主要牵扯到4个方面&#xff1a; &#xff08;1&#xff09;平台端&#xff1a;业务端系统&#xff0c;包含前端呈现界面。 &#xff08;2&a…

Spring IDEA 2024 自动生成get和set以及toString方法

1.简介 在IDEA中使用自带功能可以自动生成get和set以及toString方法 2.步骤 在目标类中右键&#xff0c;选择生成 选择Getter和Setter就可以生成每个属性对应的set和get方法&#xff0c; 选择toString就可以生成类的toString方法&#xff0c;

推荐一款PS VR2电脑PC适配器 / 转接板方案

一、引言 随着虚拟现实技术的不断发展&#xff0c;PS VR2 为用户带来了沉浸式的游戏和娱乐体验。然而&#xff0c;为了让 PS VR2 能够与电脑连接&#xff0c;充分发挥其性能并拓展使用场景&#xff0c;需要开发一款电脑适配器 / 转接板。本技术文档方案旨在详细阐述该适配器 / …

Linux软件包管理器、Linux开发工具、vim的配置等的介绍

文章目录 前言一、Linux软件包管理器yum二、Linux开发工具1. 命令模式2. 插入模式3. 底行模式4. 三种模式的切换5. 命令模式下的快捷键 三、vim的配置总结 前言 Linux软件包管理器、Linux开发工具、vim的配置等的介绍 一、Linux软件包管理器yum 关于rzsz 这个工具用于 window…

【深度学习】聊一聊正则化

在机器学习中&#xff0c;正则化是一种常用的技术&#xff0c;用于控制模型的复杂度&#xff0c;减少过拟合的风险。它通过在损失函数中引入额外的项来对模型的参数进行约束或惩罚&#xff0c;使模型更加简单、平滑或稀疏。我们在实际应用中&#xff0c;经常使用的是L1和L2正则…