Agent作为Langchain框架中驱动决策制定的实体。它可以访问一组工具,并可以根据用户的输入决定调用哪个工具。正确地使用agent,可以让它变得非常强大。 Agents 有以下几个核心概念: Tool:执行特定的功能。可以是谷歌搜索,数据库查找,Python REPL,其他暴露API借口的任意工具。工具的接口目前是一个函数,期望以字符串作为输入,...
Langchain通过chain将各个组件进行链接,以及chain之间进行链接,用于简化复杂应用程序的实现。其中主要有LLMChain、Sequential Chain以及Route Chain。 2.3.1 LLMChain 最基本的链为LLMChain,由PromptTemplate、LLM和OutputParser组成。LLM的输出一般为文本,OutputParser用于让LLM结构化输出并进行结果解析,方便后续的调用。 图5...
http://shiyanjun.cn/archives/2613.html https://python.langchain.com/docs/get_started/introduction https://www.langchain.asia/ https://aws.amazon.com/cn/what-is/langchain/ https://github.com/liaokongVFX/LangChain-Chinese-Getting-Started-Guide ...
loader = UnstructuredFileLoader(fr"D:\a\program\pythonProject\b.txt") # 将文本转成 Document 对象 document = loader.load() print(f'documents:{len(document)}') # 初始化文本分割器 text_splitter = RecursiveCharacterTextSplitter( chunk_size=500, ...
# 如果搜索完想再让他再用python的print做点简单的计算,可以这样写 # tools=load_tools(["serpapi","python_repl"]) """ agent:代理类型 zero-shot-react-description: 根据工具的描述和请求内容的来决定使用哪个工具(最常用) react-docstore: 使用 ReAct 框架和 docstore 交互, 使用Search 和Lookup 工具, ...
[!WARNING] Docker Desktop 的4.24.x版本中存在影响python应用程序的性能问题。请在使用此栈之前升级到最新版本。 启动所有服务 代码语言:javascript 代码运行次数:0 运行 AI代码解释 docker compose up 如果构建脚本有所更改,重新构建。 代码语言:javascript ...
python --version 安装chroma(同上),参考:https://docs.trychroma.com/getting-started 验证-执行: chroma run 3.1.2 集成LangChain4j <properties> <langchain4j.version>0.31.0</langchain4j.version> </properties> <dependency> <groupId>dev.langchain4j</groupId> ...
1、https://python.langchain.com/docs/get_started/introduction.html 2、https://github.com/liaokongVFX/LangChain-Chinese-Getting-Started-Guide 3、https://www.deeplearning.ai/short-courses/langchain-for-llm-application-development/ 4、https://lilianweng.github.io/posts/2023-06-23-agent/ 5、http...
python_repl则是python的普通命令,可以执行python代码。这些都是官方开箱即用的工具。如果觉得不合你的胃口,它也支持自定义工具。关于agents中tools的更多信息,可以去官方查看:https://python.langchain.com/en/latest/modules/agents/tools/getting_started.html 2.4 给LLM加更多 除了上面那些,langchain还有其他...
Getting Started 里说明,需要python 3.11以上的版本 LangChain from dotenv import load_dotenv import os load_dotenv() os.environ['TAVILY_API_KEY'] = os.getenv('TAVILY_API_KEY') from langchain_community.tools.tavily_search import TavilySearchResults search = TavilySearchResults(max_results=2)...