diff --git a/content/LangChain for LLM Application Development/1.开篇介绍.md b/content/LangChain for LLM Application Development/1.开篇介绍.md deleted file mode 100644 index 67e9cbd..0000000 --- a/content/LangChain for LLM Application Development/1.开篇介绍.md +++ /dev/null @@ -1,33 +0,0 @@ -## 吴恩达 LangChain大模型应用开发 开端篇 - -## LangChain for LLM Application Development - -欢迎来到LangChain大模型应用开发短期课程👏🏻👏🏻 - -本课程由哈里森·蔡斯 (Harrison Chase,LangChain作者)与Deeplearning.ai合作开发,旨在教大家使用这个神奇工具。 - -### 🚀 LangChain的诞生和发展 - -通过对LLM或大型语言模型给出提示(prompt),现在可以比以往更快地开发AI应用程序,但是一个应用程序可能需要进行多轮提示以及解析输出。 - -在此过程有很多胶水代码需要编写,基于此需求,哈里森·蔡斯 (Harrison Chase) 创建了LangChain,使开发过程变得更加丝滑。 - -LangChain开源社区快速发展,贡献者已达数百人,正以惊人的速度更新代码和功能。 - - -### 📚 课程基本内容 - -LangChain是用于构建大模型应用程序的开源框架,有Python和JavaScript两个不同版本的包。LangChain基于模块化组合,有许多单独的组件,可以一起使用或单独使用。此外LangChain还拥有很多应用案例,帮助我们了解如何将这些模块化组件以链式方式组合,以形成更多端到端的应用程序 。 - -在本课程中,我们将介绍LandChain的常见组件。具体而言我们会讨论一下几个方面 -- 模型(Models) -- 提示(Prompts): 使模型执行操作的方式 -- 索引(Indexes): 获取数据的方式,可以与模型结合使用 -- 链式(Chains): 端到端功能实现 -- 代理(Agents): 使用模型作为推理引擎 - - - -### 🌹致谢课程重要贡献者 - -最后特别感谢Ankush Gholar(LandChain的联合作者)、Geoff Ladwig,、Eddy Shyu 以及 Diala Ezzedine,他们也为本课程内容贡献颇多~ \ No newline at end of file diff --git a/content/LangChain for LLM Application Development/1.简介.ipynb b/content/LangChain for LLM Application Development/1.简介.ipynb new file mode 100644 index 0000000..62cee6b --- /dev/null +++ b/content/LangChain for LLM Application Development/1.简介.ipynb @@ -0,0 +1,87 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "cfab521b-77fa-41be-a964-1f50f2ef4689", + "metadata": {}, + "source": [ + "# 1. 简介\n", + "
\n", + "\n", + "欢迎来到LangChain大模型应用开发短期课程👏🏻👏🏻\n", + "\n", + "本课程由哈里森·蔡斯 (Harrison Chase,LangChain作者)与Deeplearning.ai合作开发,旨在教大家使用这个神奇工具。\n", + "\n", + "\n", + "\n", + "## 1.1 LangChain的诞生和发展\n", + "\n", + "通过对LLM或大型语言模型给出提示(prompt),现在可以比以往更快地开发AI应用程序,但是一个应用程序可能需要进行多轮提示以及解析输出。\n", + "\n", + "在此过程有很多胶水代码需要编写,基于此需求,哈里森·蔡斯 (Harrison Chase) 创建了LangChain,使开发过程变得更加丝滑。\n", + "\n", + "LangChain开源社区快速发展,贡献者已达数百人,正以惊人的速度更新代码和功能。\n", + "\n", + "\n", + "## 1.2 课程基本内容\n", + "\n", + "LangChain是用于构建大模型应用程序的开源框架,有Python和JavaScript两个不同版本的包。LangChain基于模块化组合,有许多单独的组件,可以一起使用或单独使用。此外LangChain还拥有很多应用案例,帮助我们了解如何将这些模块化组件以链式方式组合,以形成更多端到端的应用程序 。\n", + "\n", + "在本课程中,我们将介绍LandChain的常见组件。具体而言我们会讨论一下几个方面\n", + "- 模型(Models)\n", + "- 提示(Prompts): 使模型执行操作的方式\n", + "- 索引(Indexes): 获取数据的方式,可以与模型结合使用\n", + "- 链式(Chains): 端到端功能实现\n", + "- 代理(Agents): 使用模型作为推理引擎\n", + "\n", + " \n", + "\n", + "## 1.3 致谢课程重要贡献者\n", + "\n", + "最后特别感谢Ankush Gholar(LandChain的联合作者)、Geoff Ladwig,、Eddy Shyu 以及 Diala Ezzedine,他们也为本课程内容贡献颇多~ " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e3618ca8", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.12" + }, + "toc": { + "base_numbering": 1, + "nav_menu": {}, + "number_sections": false, + "sideBar": true, + "skip_h1_title": false, + "title_cell": "Table of Contents", + "title_sidebar": "Contents", + "toc_cell": false, + "toc_position": {}, + "toc_section_display": true, + "toc_window_display": true + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/content/LangChain for LLM Application Development/2.模型、提示和解析器.ipynb b/content/LangChain for LLM Application Development/2.模型、提示和解析器.ipynb index d06b746..734ec03 100644 --- a/content/LangChain for LLM Application Development/2.模型、提示和解析器.ipynb +++ b/content/LangChain for LLM Application Development/2.模型、提示和解析器.ipynb @@ -32,19 +32,29 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "# 下载需要的包python-dotenv和openai\n", "# 如果你需要查看安装过程日志,可删除 -q \n", "!pip install -q python-dotenv\n", - "!pip install -q openai" + "!pip install -q openai\n" ] }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "# 将自己的 API-KEY 导入系统环境变量(关于如何设置参考这篇文章:https://zhuanlan.zhihu.com/p/627665725)\n", + "!export OPENAI_API_KEY='api-key' #api_key替换为自己的" + ] + }, + { + "cell_type": "code", + "execution_count": 1, "metadata": { "tags": [] }, @@ -52,11 +62,13 @@ "source": [ "import os\n", "import openai\n", - "# 运行此API配置,需要将目录中的.env中api_key替换为自己的\n", "from dotenv import load_dotenv, find_dotenv\n", - "_ = load_dotenv(find_dotenv()) # read local .env file\n", - "# 导入 OpenAI API_KEY\n", - "openai.api_key = os.environ['OPENAI_API_KEY']" + "\n", + "# 读取本地的环境变量 \n", + "_ = load_dotenv(find_dotenv())\n", + "\n", + "# 获取环境变量 OPENAI_API_KEY\n", + "openai.api_key = os.environ['OPENAI_API_KEY'] " ] }, { @@ -72,7 +84,7 @@ "\n", "`get_completion`函数是基于`openai`的封装函数,对于给定提示(prompt)输出相应的回答。其包含两个参数\n", " \n", - " - `prompt` 必需输入参数。 你给模型的提示,可以是一个问题,可以是你需要模型帮助你做的事(改变文本写作风格,翻译,回复消息等等)。\n", + " - `prompt` 必需输入参数。 你给模型的**提示,可以是一个问题,可以是你需要模型帮助你做的事**(改变文本写作风格,翻译,回复消息等等)。\n", " - `model` 非必需输入参数。默认使用gpt-3.5-turbo。你也可以选择其他模型。\n", " \n", "这里的提示对应我们给chatgpt的问题,函数给出的输出则对应chatpgt给我们的答案。" @@ -80,7 +92,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 2, "metadata": { "tags": [] }, @@ -115,7 +127,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -124,12 +136,12 @@ "'1+1等于2。'" ] }, - "execution_count": 5, "metadata": {}, - "output_type": "execute_result" + "output_type": "display_data" } ], "source": [ + "# 中文\n", "get_completion(\"1+1是什么?\")" ] }, @@ -152,6 +164,7 @@ } ], "source": [ + "# 英文\n", "get_completion(\"What is 1+1?\")" ] }, @@ -264,10 +277,8 @@ }, { "cell_type": "code", - "execution_count": 9, - "metadata": { - "tags": [] - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "response = get_completion(prompt)" @@ -309,6 +320,136 @@ "✨ 你可以尝试修改提示,看可以得到什么不一样的结果😉" ] }, + { + "attachments": {}, + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 中文" + ] + }, + { + "attachments": {}, + "cell_type": "markdown", + "metadata": {}, + "source": [ + "假设我们是电商公司员工,我们的顾客是一名海盗A,他在我们的网站上买了一个榨汁机用来做奶昔,在制作奶昔的过程中,奶昔的盖子飞了出去,弄得厨房墙上到处都是。于是海盗A给我们的客服中心写来以下邮件:`customer_email`" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "# 非正式用语\n", + "customer_email = \"\"\" \n", + "阿,我很生气,\\\n", + "因为我的搅拌机盖掉了,\\\n", + "把奶昔溅到了厨房的墙上!\\\n", + "更糟糕的是,保修不包括打扫厨房的费用。\\\n", + "我现在需要你的帮助,伙计!\n", + "\"\"\"" + ] + }, + { + "attachments": {}, + "cell_type": "markdown", + "metadata": {}, + "source": [ + "我们的客服人员对于海盗的措辞表达觉得有点难以理解。 现在我们想要实现两个小目标:\n", + "\n", + "- 让模型用比较正式的普通话的表达方式将海盗的邮件进行翻译,客服人员可以更好理解。\n", + "- 让模型在翻译是用平和尊重的语气进行表达,客服人员的心情也会更好。\n", + "\n", + "根据这两个小目标,定义一下文本表达风格:`style`" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [], + "source": [ + "# 普通话 + 平静、尊敬的语调\n", + "style = \"\"\"正式普通话 \\\n", + "用一个平静、尊敬的语调\n", + "\"\"\"" + ] + }, + { + "attachments": {}, + "cell_type": "markdown", + "metadata": {}, + "source": [ + "下一步需要做的是将`customer_email`和`style`结合起来构造我们的提示:`prompt`" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "把由三个反引号分隔的文本text翻译成一种正式普通话 用一个平静、尊敬的语调\n", + "风格。\n", + "text: ``` \n", + "阿,我很生气,因为我的搅拌机盖掉了,把奶昔溅到了厨房的墙上!更糟糕的是,保修不包括打扫厨房的费用。我现在需要你的帮助,伙计!\n", + "```\n", + "\n" + ] + } + ], + "source": [ + "# 要求模型根据给出的语调进行转化\n", + "prompt = f\"\"\"把由三个反引号分隔的文本text\\\n", + "翻译成一种{style}风格。\n", + "text: ```{customer_email}```\n", + "\"\"\"\n", + "\n", + "print(prompt)" + ] + }, + { + "attachments": {}, + "cell_type": "markdown", + "metadata": {}, + "source": [ + "`prompt` 构造好了,我们可以调用`get_completion`得到我们想要的结果 - 用平和尊重的普通话语气去表达一封带着方言表达方式的邮件" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [], + "source": [ + "response = get_completion(prompt)" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'尊敬的朋友,我感到不安,因为我的搅拌机盖子不慎掉落,导致奶昔溅到了厨房的墙壁上!更加令人糟心的是,保修并不包含厨房清洁的费用。此刻,我需要你的帮助,亲爱的朋友!'" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "response" + ] + }, { "attachments": {}, "cell_type": "markdown", @@ -318,18 +459,26 @@ "source": [ "## Chat API:LangChain\n", "\n", - "在前面一部分,我们通过封装函数`get_completion`直接调用了OpenAI完成了对海岛邮件进行了翻译,得到用平和尊重的语气、美式英语表达的邮件。\n", + "在前面一部分,我们通过封装函数`get_completion`直接调用了OpenAI完成了对方言邮件进行了的翻译,得到用平和尊重的语气、正式的普通话表达的邮件。\n", "\n", "让我们尝试使用LangChain来实现相同的功能。" ] }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 14, "metadata": { "tags": [] }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "^C\n" + ] + } + ], "source": [ "# 如果你需要查看安装过程日志,可删除 -q \n", "# --upgrade 让我们可以安装到最新版本的 langchain\n", @@ -350,7 +499,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 15, "metadata": { "tags": [] }, @@ -361,7 +510,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 13, "metadata": { "tags": [] }, @@ -369,10 +518,10 @@ { "data": { "text/plain": [ - "ChatOpenAI(verbose=False, callbacks=None, callback_manager=None, client=| \n", + " | 0 | \n", + "1 | \n", + "
|---|---|---|
| 0 | \n", + "product_name | \n", + "description | \n", + "
| 1 | \n", + "全自动咖啡机 | \n", + "规格:\\n大型 - 尺寸:13.8'' x 17.3''。\\n中型 - 尺寸:11.5'' ... | \n", + "
| 2 | \n", + "电动牙刷 | \n", + "规格:\\n一般大小 - 高度:9.5'',宽度:1''。\\n\\n为什么我们热爱它:\\n我们的... | \n", + "
| 3 | \n", + "橙味维生素C泡腾片 | \n", + "规格:\\n每盒含有20片。\\n\\n为什么我们热爱它:\\n我们的橙味维生素C泡腾片是快速补充维... | \n", + "
| 4 | \n", + "无线蓝牙耳机 | \n", + "规格:\\n单个耳机尺寸:1.5'' x 1.3''。\\n\\n为什么我们热爱它:\\n这款无线蓝... | \n", + "
| 5 | \n", + "瑜伽垫 | \n", + "规格:\\n尺寸:24'' x 68''。\\n\\n为什么我们热爱它:\\n我们的瑜伽垫拥有出色的... | \n", + "
| 6 | \n", + "防水运动手表 | \n", + "规格:\\n表盘直径:40mm。\\n\\n为什么我们热爱它:\\n这款防水运动手表配备了心率监测和... | \n", + "
| 7 | \n", + "书籍:《机器学习基础》 | \n", + "规格:\\n页数:580页。\\n\\n为什么我们热爱它:\\n《机器学习基础》以易懂的语言讲解了机... | \n", + "
| 8 | \n", + "空气净化器 | \n", + "规格:\\n尺寸:15'' x 15'' x 20''。\\n\\n为什么我们热爱它:\\n我们的空... | \n", + "
| 9 | \n", + "陶瓷保温杯 | \n", + "规格:\\n容量:350ml。\\n\\n为什么我们热爱它:\\n我们的陶瓷保温杯设计优雅,保温效果... | \n", + "
| 10 | \n", + "宠物自动喂食器 | \n", + "规格:\\n尺寸:14'' x 9'' x 15''。\\n\\n为什么我们热爱它:\\n我们的宠物... | \n", + "
| 11 | \n", + "高清电视机 | \n", + "规格:\\n尺寸:50''。\\n\\n为什么我们热爱它:\\n我们的高清电视机拥有出色的画质和强大... | \n", + "
| 12 | \n", + "旅行背包 | \n", + "规格:\\n尺寸:18'' x 12'' x 6''。\\n\\n为什么我们热爱它:\\n我们的旅行... | \n", + "
| 13 | \n", + "太阳能庭院灯 | \n", + "规格:\\n高度:18''。\\n\\n为什么我们热爱它:\\n我们的太阳能庭院灯无需电源,只需将其... | \n", + "
| 14 | \n", + "厨房刀具套装 | \n", + "规格:\\n一套包括8把刀。\\n\\n为什么我们热爱它:\\n我们的厨房刀具套装由专业级不锈钢制成... | \n", + "
| 15 | \n", + "迷你无线蓝牙音箱 | \n", + "规格:\\n直径:3'',高度:2''。\\n\\n为什么我们热爱它:\\n我们的迷你无线蓝牙音箱体... | \n", + "
| 16 | \n", + "抗菌洗手液 | \n", + "规格:\\n容量:500ml。\\n\\n为什么我们热爱它:\\n我们的抗菌洗手液含有天然植物精华,... | \n", + "
| 17 | \n", + "纯棉T恤 | \n", + "规格:\\n尺码:S, M, L, XL, XXL。\\n\\n为什么我们热爱它:\\n我们的纯棉T... | \n", + "
| 18 | \n", + "自动咖啡机 | \n", + "规格:\\n尺寸:12'' x 8'' x 14''。\\n\\n为什么我们热爱它:\\n我们的自动... | \n", + "
| 19 | \n", + "摄像头保护套 | \n", + "规格:\\n适用于各种品牌和型号的摄像头。\\n\\n为什么我们热爱它:\\n我们的摄像头保护套可以... | \n", + "
| 20 | \n", + "玻璃保护膜 | \n", + "规格:\\n适用于各种尺寸的手机屏幕。\\n\\n为什么我们热爱它:\\n我们的玻璃保护膜可以有效防... | \n", + "
| 21 | \n", + "儿童益智玩具 | \n", + "规格:\\n适合3岁以上的儿童。\\n\\n为什么我们热爱它:\\n我们的儿童益智玩具设计独特,色彩... | \n", + "
| 22 | \n", + "迷你书架 | \n", + "规格:\\n尺寸:20'' x 8'' x 24''。\\n\\n为什么我们热爱它:\\n我们的迷你... | \n", + "
| 23 | \n", + "防滑瑜伽垫 | \n", + "规格:\\n尺寸:72'' x 24''。\\n\\n为什么我们热爱它:\\n我们的防滑瑜伽垫采用高... | \n", + "
| 24 | \n", + "LED台灯 | \n", + "规格:\\n尺寸:6'' x 6'' x 18''。\\n\\n为什么我们热爱它:\\n我们的LED... | \n", + "
| 25 | \n", + "水晶酒杯 | \n", + "规格:\\n容量:250ml。\\n\\n为什么我们热爱它:\\n我们的水晶酒杯采用高品质水晶玻璃制... | \n", + "
思考:我可以使用`sorted()`函数按姓氏和名字的顺序对客户列表进行排序。我需要为`sorted()`提供一个键函数,该函数返回一个元组,元组中按顺序包含姓氏和名字。
\n", - "\n", - "2. 模型基于思考采取行动(Action), 因为使用的工具不同,Action的输出也和之前有所不同,这里输出的为python代码\n", - "行动: 使用Python编程,输入以下代码
\n", - " \n", - " \n", - " ```python\n", - " customers = [['Harrison', 'Chase'], ['Lang', 'Chain'], ['Dolly', 'Too'], ['Elle', 'Elem'], ['Geoff', 'Fusion'], ['Trance', 'Former'], ['Jen', 'Ayai']]\n", - " sorted_customers = sorted(customers, key=lambda x: (x[1], x[0]))\n", - " for customer in sorted_customers:\n", - " print(customer)\n", - " ```\n", - "观测:
\n", - " \n", - " ```\n", - " ['Jen', 'Ayai']\n", - " ['Lang', 'Chain']\n", - " ['Harrison', 'Chase']\n", - " ['Elle', 'Elem']\n", - " ['Trance', 'Former']\n", - " ['Geoff', 'Fusion']\n", - " ['Dolly', 'Too']\n", - " ```\n", - "思考: 现在客户按照姓氏和名字的顺序进行了排序。
\n", - "\n", - "5. 给出最终答案(Final Answer)\n", - "最终答案: [['Jen', 'Ayai'], ['Lang', 'Chain'], ['Harrison', 'Chase'], ['Elle', 'Elem'], ['Trance', 'Former'], ['Geoff', 'Fusion'], ['Dolly', 'Too']]
\n", - "6. 返回最终答案。" + "agent.run(f\"\"\"在这些客户名字转换为拼音\\\n", + "并打印输出列表: {customer_list}\\\n", + "思考过程请使用中文。\"\"\") " ] }, { + "attachments": {}, "cell_type": "markdown", "id": "16f530a5-8c50-4648-951f-4e65d15ca93f", "metadata": { @@ -497,6 +744,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "951048dc-0414-410d-a0e9-6ef32bbdda89", "metadata": { @@ -527,7 +775,7 @@ }, { "cell_type": "code", - "execution_count": 36, + "execution_count": 25, "id": "92b8961b-b990-4540-a7f9-e4701dfaa616", "metadata": {}, "outputs": [ @@ -537,11 +785,11 @@ "text": [ "\u001b[32;1m\u001b[1;3m[chain/start]\u001b[0m \u001b[1m[1:chain:AgentExecutor] Entering Chain run with input:\n", "\u001b[0m{\n", - " \"input\": \"Sort these customers by last name and then first name and print the output: [['Harrison', 'Chase'], ['Lang', 'Chain'], ['Dolly', 'Too'], ['Elle', 'Elem'], ['Geoff', 'Fusion'], ['Trance', 'Former'], ['Jen', 'Ayai']]\"\n", + " \"input\": \"在这些客户名字转换为拼音并打印输出列表: ['小明', '小黄', '小红', '小蓝', '小橘', '小绿']思考过程请使用中文。\"\n", "}\n", "\u001b[32;1m\u001b[1;3m[chain/start]\u001b[0m \u001b[1m[1:chain:AgentExecutor > 2:chain:LLMChain] Entering Chain run with input:\n", "\u001b[0m{\n", - " \"input\": \"Sort these customers by last name and then first name and print the output: [['Harrison', 'Chase'], ['Lang', 'Chain'], ['Dolly', 'Too'], ['Elle', 'Elem'], ['Geoff', 'Fusion'], ['Trance', 'Former'], ['Jen', 'Ayai']]\",\n", + " \"input\": \"在这些客户名字转换为拼音并打印输出列表: ['小明', '小黄', '小红', '小蓝', '小橘', '小绿']思考过程请使用中文。\",\n", " \"agent_scratchpad\": \"\",\n", " \"stop\": [\n", " \"\\nObservation:\",\n", @@ -551,18 +799,18 @@ "\u001b[32;1m\u001b[1;3m[llm/start]\u001b[0m \u001b[1m[1:chain:AgentExecutor > 2:chain:LLMChain > 3:llm:ChatOpenAI] Entering LLM run with input:\n", "\u001b[0m{\n", " \"prompts\": [\n", - " \"Human: You are an agent designed to write and execute python code to answer questions.\\nYou have access to a python REPL, which you can use to execute python code.\\nIf you get an error, debug your code and try again.\\nOnly use the output of your code to answer the question. \\nYou might know the answer without running any code, but you should still run the code to get the answer.\\nIf it does not seem like you can write code to answer the question, just return \\\"I don't know\\\" as the answer.\\n\\n\\nPython REPL: A Python shell. Use this to execute python commands. Input should be a valid python command. If you want to see the output of a value, you should print it out with `print(...)`.\\n\\nUse the following format:\\n\\nQuestion: the input question you must answer\\nThought: you should always think about what to do\\nAction: the action to take, should be one of [Python REPL]\\nAction Input: the input to the action\\nObservation: the result of the action\\n... (this Thought/Action/Action Input/Observation can repeat N times)\\nThought: I now know the final answer\\nFinal Answer: the final answer to the original input question\\n\\nBegin!\\n\\nQuestion: Sort these customers by last name and then first name and print the output: [['Harrison', 'Chase'], ['Lang', 'Chain'], ['Dolly', 'Too'], ['Elle', 'Elem'], ['Geoff', 'Fusion'], ['Trance', 'Former'], ['Jen', 'Ayai']]\\nThought:\"\n", + " \"Human: You are an agent designed to write and execute python code to answer questions.\\nYou have access to a python REPL, which you can use to execute python code.\\nIf you get an error, debug your code and try again.\\nOnly use the output of your code to answer the question. \\nYou might know the answer without running any code, but you should still run the code to get the answer.\\nIf it does not seem like you can write code to answer the question, just return \\\"I don't know\\\" as the answer.\\n\\n\\nPython_REPL: A Python shell. Use this to execute python commands. Input should be a valid python command. If you want to see the output of a value, you should print it out with `print(...)`.\\n\\nUse the following format:\\n\\nQuestion: the input question you must answer\\nThought: you should always think about what to do\\nAction: the action to take, should be one of [Python_REPL]\\nAction Input: the input to the action\\nObservation: the result of the action\\n... (this Thought/Action/Action Input/Observation can repeat N times)\\nThought: I now know the final answer\\nFinal Answer: the final answer to the original input question\\n\\nBegin!\\n\\nQuestion: 在这些客户名字转换为拼音并打印输出列表: ['小明', '小黄', '小红', '小蓝', '小橘', '小绿']思考过程请使用中文。\\nThought:\"\n", " ]\n", "}\n", - "\u001b[36;1m\u001b[1;3m[llm/end]\u001b[0m \u001b[1m[1:chain:AgentExecutor > 2:chain:LLMChain > 3:llm:ChatOpenAI] [12.25s] Exiting LLM run with output:\n", + "\u001b[36;1m\u001b[1;3m[llm/end]\u001b[0m \u001b[1m[1:chain:AgentExecutor > 2:chain:LLMChain > 3:llm:ChatOpenAI] [2.91s] Exiting LLM run with output:\n", "\u001b[0m{\n", " \"generations\": [\n", " [\n", " {\n", - " \"text\": \"I can use the sorted() function to sort the list of customers by last name and then first name. I will need to provide a key function to sorted() that returns a tuple of the last name and first name in that order.\\nAction: Python REPL\\nAction Input:\\n```\\ncustomers = [['Harrison', 'Chase'], ['Lang', 'Chain'], ['Dolly', 'Too'], ['Elle', 'Elem'], ['Geoff', 'Fusion'], ['Trance', 'Former'], ['Jen', 'Ayai']]\\nsorted_customers = sorted(customers, key=lambda x: (x[1], x[0]))\\nprint(sorted_customers)\\n```\",\n", + " \"text\": \"我需要使用拼音转换库来将这些客户名字转换为拼音。我可以使用Python的pinyin库来完成这个任务。\\nAction: Python_REPL\\nAction Input: import pinyin\",\n", " \"generation_info\": null,\n", " \"message\": {\n", - " \"content\": \"I can use the sorted() function to sort the list of customers by last name and then first name. I will need to provide a key function to sorted() that returns a tuple of the last name and first name in that order.\\nAction: Python REPL\\nAction Input:\\n```\\ncustomers = [['Harrison', 'Chase'], ['Lang', 'Chain'], ['Dolly', 'Too'], ['Elle', 'Elem'], ['Geoff', 'Fusion'], ['Trance', 'Former'], ['Jen', 'Ayai']]\\nsorted_customers = sorted(customers, key=lambda x: (x[1], x[0]))\\nprint(sorted_customers)\\n```\",\n", + " \"content\": \"我需要使用拼音转换库来将这些客户名字转换为拼音。我可以使用Python的pinyin库来完成这个任务。\\nAction: Python_REPL\\nAction Input: import pinyin\",\n", " \"additional_kwargs\": {},\n", " \"example\": false\n", " }\n", @@ -571,29 +819,26 @@ " ],\n", " \"llm_output\": {\n", " \"token_usage\": {\n", - " \"prompt_tokens\": 327,\n", - " \"completion_tokens\": 138,\n", - " \"total_tokens\": 465\n", + " \"prompt_tokens\": 322,\n", + " \"completion_tokens\": 50,\n", + " \"total_tokens\": 372\n", " },\n", " \"model_name\": \"gpt-3.5-turbo\"\n", - " }\n", + " },\n", + " \"run\": null\n", "}\n", - "\u001b[36;1m\u001b[1;3m[chain/end]\u001b[0m \u001b[1m[1:chain:AgentExecutor > 2:chain:LLMChain] [12.25s] Exiting Chain run with output:\n", + "\u001b[36;1m\u001b[1;3m[chain/end]\u001b[0m \u001b[1m[1:chain:AgentExecutor > 2:chain:LLMChain] [2.91s] Exiting Chain run with output:\n", "\u001b[0m{\n", - " \"text\": \"I can use the sorted() function to sort the list of customers by last name and then first name. I will need to provide a key function to sorted() that returns a tuple of the last name and first name in that order.\\nAction: Python REPL\\nAction Input:\\n```\\ncustomers = [['Harrison', 'Chase'], ['Lang', 'Chain'], ['Dolly', 'Too'], ['Elle', 'Elem'], ['Geoff', 'Fusion'], ['Trance', 'Former'], ['Jen', 'Ayai']]\\nsorted_customers = sorted(customers, key=lambda x: (x[1], x[0]))\\nprint(sorted_customers)\\n```\"\n", + " \"text\": \"我需要使用拼音转换库来将这些客户名字转换为拼音。我可以使用Python的pinyin库来完成这个任务。\\nAction: Python_REPL\\nAction Input: import pinyin\"\n", "}\n", - "\u001b[32;1m\u001b[1;3m[tool/start]\u001b[0m \u001b[1m[1:chain:AgentExecutor > 4:tool:Python REPL] Entering Tool run with input:\n", - "\u001b[0m\"```\n", - "customers = [['Harrison', 'Chase'], ['Lang', 'Chain'], ['Dolly', 'Too'], ['Elle', 'Elem'], ['Geoff', 'Fusion'], ['Trance', 'Former'], ['Jen', 'Ayai']]\n", - "sorted_customers = sorted(customers, key=lambda x: (x[1], x[0]))\n", - "print(sorted_customers)\n", - "```\"\n", - "\u001b[36;1m\u001b[1;3m[tool/end]\u001b[0m \u001b[1m[1:chain:AgentExecutor > 4:tool:Python REPL] [2.2239999999999998ms] Exiting Tool run with output:\n", - "\u001b[0m\"[['Jen', 'Ayai'], ['Lang', 'Chain'], ['Harrison', 'Chase'], ['Elle', 'Elem'], ['Trance', 'Former'], ['Geoff', 'Fusion'], ['Dolly', 'Too']]\"\n", + "\u001b[32;1m\u001b[1;3m[tool/start]\u001b[0m \u001b[1m[1:chain:AgentExecutor > 4:tool:Python_REPL] Entering Tool run with input:\n", + "\u001b[0m\"import pinyin\"\n", + "\u001b[36;1m\u001b[1;3m[tool/end]\u001b[0m \u001b[1m[1:chain:AgentExecutor > 4:tool:Python_REPL] [0.0ms] Exiting Tool run with output:\n", + "\u001b[0m\"\"\n", "\u001b[32;1m\u001b[1;3m[chain/start]\u001b[0m \u001b[1m[1:chain:AgentExecutor > 5:chain:LLMChain] Entering Chain run with input:\n", "\u001b[0m{\n", - " \"input\": \"Sort these customers by last name and then first name and print the output: [['Harrison', 'Chase'], ['Lang', 'Chain'], ['Dolly', 'Too'], ['Elle', 'Elem'], ['Geoff', 'Fusion'], ['Trance', 'Former'], ['Jen', 'Ayai']]\",\n", - " \"agent_scratchpad\": \"I can use the sorted() function to sort the list of customers by last name and then first name. I will need to provide a key function to sorted() that returns a tuple of the last name and first name in that order.\\nAction: Python REPL\\nAction Input:\\n```\\ncustomers = [['Harrison', 'Chase'], ['Lang', 'Chain'], ['Dolly', 'Too'], ['Elle', 'Elem'], ['Geoff', 'Fusion'], ['Trance', 'Former'], ['Jen', 'Ayai']]\\nsorted_customers = sorted(customers, key=lambda x: (x[1], x[0]))\\nprint(sorted_customers)\\n```\\nObservation: [['Jen', 'Ayai'], ['Lang', 'Chain'], ['Harrison', 'Chase'], ['Elle', 'Elem'], ['Trance', 'Former'], ['Geoff', 'Fusion'], ['Dolly', 'Too']]\\n\\nThought:\",\n", + " \"input\": \"在这些客户名字转换为拼音并打印输出列表: ['小明', '小黄', '小红', '小蓝', '小橘', '小绿']思考过程请使用中文。\",\n", + " \"agent_scratchpad\": \"我需要使用拼音转换库来将这些客户名字转换为拼音。我可以使用Python的pinyin库来完成这个任务。\\nAction: Python_REPL\\nAction Input: import pinyin\\nObservation: \\nThought:\",\n", " \"stop\": [\n", " \"\\nObservation:\",\n", " \"\\n\\tObservation:\"\n", @@ -602,18 +847,33 @@ "\u001b[32;1m\u001b[1;3m[llm/start]\u001b[0m \u001b[1m[1:chain:AgentExecutor > 5:chain:LLMChain > 6:llm:ChatOpenAI] Entering LLM run with input:\n", "\u001b[0m{\n", " \"prompts\": [\n", - " \"Human: You are an agent designed to write and execute python code to answer questions.\\nYou have access to a python REPL, which you can use to execute python code.\\nIf you get an error, debug your code and try again.\\nOnly use the output of your code to answer the question. \\nYou might know the answer without running any code, but you should still run the code to get the answer.\\nIf it does not seem like you can write code to answer the question, just return \\\"I don't know\\\" as the answer.\\n\\n\\nPython REPL: A Python shell. Use this to execute python commands. Input should be a valid python command. If you want to see the output of a value, you should print it out with `print(...)`.\\n\\nUse the following format:\\n\\nQuestion: the input question you must answer\\nThought: you should always think about what to do\\nAction: the action to take, should be one of [Python REPL]\\nAction Input: the input to the action\\nObservation: the result of the action\\n... (this Thought/Action/Action Input/Observation can repeat N times)\\nThought: I now know the final answer\\nFinal Answer: the final answer to the original input question\\n\\nBegin!\\n\\nQuestion: Sort these customers by last name and then first name and print the output: [['Harrison', 'Chase'], ['Lang', 'Chain'], ['Dolly', 'Too'], ['Elle', 'Elem'], ['Geoff', 'Fusion'], ['Trance', 'Former'], ['Jen', 'Ayai']]\\nThought:I can use the sorted() function to sort the list of customers by last name and then first name. I will need to provide a key function to sorted() that returns a tuple of the last name and first name in that order.\\nAction: Python REPL\\nAction Input:\\n```\\ncustomers = [['Harrison', 'Chase'], ['Lang', 'Chain'], ['Dolly', 'Too'], ['Elle', 'Elem'], ['Geoff', 'Fusion'], ['Trance', 'Former'], ['Jen', 'Ayai']]\\nsorted_customers = sorted(customers, key=lambda x: (x[1], x[0]))\\nprint(sorted_customers)\\n```\\nObservation: [['Jen', 'Ayai'], ['Lang', 'Chain'], ['Harrison', 'Chase'], ['Elle', 'Elem'], ['Trance', 'Former'], ['Geoff', 'Fusion'], ['Dolly', 'Too']]\\n\\nThought:\"\n", + " \"Human: You are an agent designed to write and execute python code to answer questions.\\nYou have access to a python REPL, which you can use to execute python code.\\nIf you get an error, debug your code and try again.\\nOnly use the output of your code to answer the question. \\nYou might know the answer without running any code, but you should still run the code to get the answer.\\nIf it does not seem like you can write code to answer the question, just return \\\"I don't know\\\" as the answer.\\n\\n\\nPython_REPL: A Python shell. Use this to execute python commands. Input should be a valid python command. If you want to see the output of a value, you should print it out with `print(...)`.\\n\\nUse the following format:\\n\\nQuestion: the input question you must answer\\nThought: you should always think about what to do\\nAction: the action to take, should be one of [Python_REPL]\\nAction Input: the input to the action\\nObservation: the result of the action\\n... (this Thought/Action/Action Input/Observation can repeat N times)\\nThought: I now know the final answer\\nFinal Answer: the final answer to the original input question\\n\\nBegin!\\n\\nQuestion: 在这些客户名字转换为拼音并打印输出列表: ['小明', '小黄', '小红', '小蓝', '小橘', '小绿']思考过程请使用中文。\\nThought:我需要使用拼音转换库来将这些客户名字转换为拼音。我可以使用Python的pinyin库来完成这个任务。\\nAction: Python_REPL\\nAction Input: import pinyin\\nObservation: \\nThought:\"\n", " ]\n", - "}\n", - "\u001b[36;1m\u001b[1;3m[llm/end]\u001b[0m \u001b[1m[1:chain:AgentExecutor > 5:chain:LLMChain > 6:llm:ChatOpenAI] [6.94s] Exiting LLM run with output:\n", + "}\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Retrying langchain.chat_models.openai.ChatOpenAI.completion_with_retry.观测: 2023-06-03
\n", + "观测: 2023-07-04
\n", " \n", " \n", " \n", @@ -830,7 +1166,7 @@ "思考: 我已成功使用 time 工具检索到了今天的日期
\n", "\n", "5. 给出最终答案(Final Answer)\n", - "最终答案: 今天的日期是2023-06-03.
\n", + "最终答案: 今天的日期是2023-07-04.
\n", "6. 返回最终答案。" ] } @@ -851,7 +1187,20 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.12" + "version": "3.9.16" + }, + "toc": { + "base_numbering": 1, + "nav_menu": {}, + "number_sections": false, + "sideBar": true, + "skip_h1_title": false, + "title_cell": "Table of Contents", + "title_sidebar": "Contents", + "toc_cell": false, + "toc_position": {}, + "toc_section_display": true, + "toc_window_display": true } }, "nbformat": 4, diff --git a/content/LangChain for LLM Application Development/8.总结.ipynb b/content/LangChain for LLM Application Development/8.总结.ipynb new file mode 100644 index 0000000..1a3e885 --- /dev/null +++ b/content/LangChain for LLM Application Development/8.总结.ipynb @@ -0,0 +1,64 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "87f7cfaa", + "metadata": {}, + "source": [ + "# 8. 总结\n", + "\n", + "\n", + "本次简短课程涵盖了一系列LangChain的应用实践,包括处理顾客评论和基于文档回答问题,以及通过LLM判断何时求助外部工具 (如网站) 来回答复杂问题。\n", + "\n", + "**👍🏻 LangChain如此强大**\n", + "\n", + "构建这类应用曾经需要耗费数周时间,而现在只需要非常少的代码,就可以通过LangChain高效构建所需的应用程序。LangChain已成为开发大模型应用的有力范式,希望大家拥抱这个强大工具,积极探索更多更广泛的应用场景。\n", + "\n", + "**🌈 不同组合, 更多可能性**\n", + "\n", + "LangChain还可以协助我们做什么呢:基于CSV文件回答问题、查询sql数据库、与api交互,有很多例子通过Chain以及不同的提示(Prompts)和输出解析器(output parsers)组合得以实现。\n", + "\n", + "**💪🏻 出发 去探索新世界吧**\n", + "\n", + "因此非常感谢社区中做出贡献的每一个人,无论是协助文档的改进,还是让其他人更容易上手,还是构建新的Chain打开一个全新的世界。\n", + "\n", + "如果你还没有这样做,快去打开电脑,运行 pip install LangChain,然后去使用LangChain、搭建惊艳的应用吧~\n", + "\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.12" + }, + "toc": { + "base_numbering": 1, + "nav_menu": {}, + "number_sections": false, + "sideBar": true, + "skip_h1_title": false, + "title_cell": "Table of Contents", + "title_sidebar": "Contents", + "toc_cell": false, + "toc_position": {}, + "toc_section_display": true, + "toc_window_display": true + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/content/LangChain for LLM Application Development/8.课程总结.md b/content/LangChain for LLM Application Development/8.课程总结.md deleted file mode 100644 index ce57191..0000000 --- a/content/LangChain for LLM Application Development/8.课程总结.md +++ /dev/null @@ -1,20 +0,0 @@ -## 吴恩达 LangChain大模型应用开发 总结篇 - -## LangChain for LLM Application Development - -本次简短课程涵盖了一系列LangChain的应用实践,包括处理顾客评论和基于文档回答问题,以及通过LLM判断何时求助外部工具 (如网站) 来回答复杂问题。 - -### 👍🏻 LangChain如此强大 - -构建这类应用曾经需要耗费数周时间,而现在只需要非常少的代码,就可以通过LangChain高效构建所需的应用程序。LangChain已成为开发大模型应用的有力范式,希望大家拥抱这个强大工具,积极探索更多更广泛的应用场景。 - -### 🌈 不同组合->更多可能性 - -LangChain还可以协助我们做什么呢:基于CSV文件回答问题、查询sql数据库、与api交互,有很多例子通过Chain以及不同的提示(Prompts)和输出解析器(output parsers)组合得以实现。 - -### 💪🏻 出发~去探索新世界吧~ - -因此非常感谢社区中做出贡献的每一个人,无论是协助文档的改进,还是让其他人更容易上手,还是构建新的Chain打开一个全新的世界。 - -如果你还没有这样做,快去打开电脑,运行 pip install LangChain,然后去使用LangChain、搭建惊艳的应用吧~ - diff --git a/content/LangChain for LLM Application Development/product_data.csv b/content/LangChain for LLM Application Development/product_data.csv new file mode 100644 index 0000000..a3f8362 --- /dev/null +++ b/content/LangChain for LLM Application Development/product_data.csv @@ -0,0 +1,434 @@ +product_name,description +全自动咖啡机,"规格: +大型 - 尺寸:13.8'' x 17.3''。 +中型 - 尺寸:11.5'' x 15.2''。 + +为什么我们热爱它: +这款全自动咖啡机是爱好者的理想选择。 一键操作,即可研磨豆子并沏制出您喜爱的咖啡。它的耐用性和一致性使它成为家庭和办公室的理想选择。 + +材质与护理: +清洁时只需轻擦。 + +构造: +由高品质不锈钢制成。 + +其他特性: +内置研磨器和滤网。 +预设多种咖啡模式。 +在中国制造。 + +有问题? 请随时联系我们的客户服务团队,他们会解答您的所有问题。" +电动牙刷,"规格: +一般大小 - 高度:9.5'',宽度:1''。 + +为什么我们热爱它: +我们的电动牙刷采用先进的刷头设计和强大的电机,为您提供超凡的清洁力和舒适的刷牙体验。 + +材质与护理: +不可水洗,只需用湿布清洁。 + +构造: +由食品级塑料和尼龙刷毛制成。 + +其他特性: +具有多种清洁模式和定时功能。 +USB充电。 +在日本制造。 + +有问题?请随时联系我们的客户服务团队,他们会解答您的所有问题。" +橙味维生素C泡腾片,"规格: +每盒含有20片。 + +为什么我们热爱它: +我们的橙味维生素C泡腾片是快速补充维生素C的理想方式。每片含有500mg的维生素C,可以帮助提升免疫力,保护您的健康。 + +材质与护理: +请存放在阴凉干燥的地方,避免阳光直射。 + +构造: +主要成分为维生素C和柠檬酸钠。 + +其他特性: +含有天然橙味。 +易于携带。 +在美国制造。 + +有问题?请随时联系我们的客户服务团队,他们会解答您的所有问题。" +无线蓝牙耳机,"规格: +单个耳机尺寸:1.5'' x 1.3''。 + +为什么我们热爱它: +这款无线蓝牙耳机配备了降噪技术和长达8小时的电池续航力,让您无论在哪里都可以享受无障碍的音乐体验。 + +材质与护理: +只需用湿布清洁。 + +构造: +由耐用的塑料和金属构成,配备有软质耳塞。 + +其他特性: +快速充电功能。 +内置麦克风,支持接听电话。 +在韩国制造。 + +有问题?请随时联系我们的客户服务团队,他们会解答您的所有问题。" +瑜伽垫,"规格: +尺寸:24'' x 68''。 + +为什么我们热爱它: +我们的瑜伽垫拥有出色的抓地力和舒适度,无论是做瑜伽还是健身,都是理想的选择。 + +材质与护理: +可用清水清洁,自然晾干。 + +构造: +由环保PVC材料制成。 + +其他特性: +附带便携包和绑带。 +在印度制造。 + +有问题?请随时联系我们的客户服务团队,他们会解答您的所有问题。" +防水运动手表,"规格: +表盘直径:40mm。 + +为什么我们热爱它: +这款防水运动手表配备了心率监测和计步功能,不仅适合日常佩戴,也是户外运动的理想伙伴。 + +材质与护理: +只需用湿布清洁。 + +构造: +由不锈钢和硅胶制成。 + +其他特性: +内置可充电电池。 +支持蓝牙连接手机。 +在瑞士制造。 + +有问题?请随时联系我们的客户服务团队,他们会解答您的所有问题。" +书籍:《机器学习基础》,"规格: +页数:580页。 + +为什么我们热爱它: +《机器学习基础》以易懂的语言讲解了机器学习的基本概念和方法,适合初学者阅读。 + +材质与护理: +纸质封面,存放在阴凉干燥处。 + +构造: +由环保纸张和油墨印刷。 + +其他特性: +附带实例和习题。 +在美国印刷。 + +有问题?请随时联系我们的客户服务团队,他们会解答您的所有问题。" +空气净化器,"规格: +尺寸:15'' x 15'' x 20''。 + +为什么我们热爱它: +我们的空气净化器采用了先进的HEPA过滤技术,能有效去除空气中的微粒和异味,为您提供清新的室内环境。 + +材质与护理: +清洁时使用干布擦拭。 + +构造: +由塑料和电子元件制成。 + +其他特性: +三档风速,附带定时功能。 +在德国制造。 + +有问题?请随时联系我们的客户服务团队,他们会解答您的所有问题。" +陶瓷保温杯,"规格: +容量:350ml。 + +为什么我们热爱它: +我们的陶瓷保温杯设计优雅,保温效果好,是办公室和户外活动的理想伴侣。 + +材质与护理: +可以手洗或洗碗机清洗。 + +构造: +由高品质陶瓷和不锈钢制成。 + +其他特性: +有多种颜色可选。 +在中国制造。 + +有问题?请随时联系我们的客户服务团队,他们会解答您的所有问题。" +宠物自动喂食器,"规格: +尺寸:14'' x 9'' x 15''。 + +为什么我们热爱它: +我们的宠物自动喂食器可以定时定量投放食物,让您无论在家或外出都能确保宠物的饮食。 + +材质与护理: +可用湿布清洁。 + +构造: +由塑料和电子元件制成。 + +其他特性: +配备LCD屏幕,操作简单。 +可以设置多次投食。 +在美国制造。 + +有问题?请随时联系我们的客户服务团队,他们会解答您的所有问题。" +高清电视机,"规格: +尺寸:50''。 + +为什么我们热爱它: +我们的高清电视机拥有出色的画质和强大的音效,带来沉浸式的观看体验。 + +材质与护理: +使用干布清洁。 + +构造: +由塑料、金属和电子元件制成。 + +其他特性: +支持网络连接,可以在线观看视频。 +配备遥控器。 +在韩国制造。 + +有问题?请随时联系我们的客户服务团队,他们会解答您的所有问题。" +旅行背包,"规格: +尺寸:18'' x 12'' x 6''。 + +为什么我们热爱它: +我们的旅行背包拥有多个实用的内外袋,轻松装下您的必需品,是短途旅行的理想选择。 + +材质与护理: +可以手洗,自然晾干。 + +构造: +由防水尼龙制成。 + +其他特性: +附带可调节背带和安全锁。 +在中国制造。 + +有问题?请随时联系我们的客户服务团队,他们会解答您的所有问题。" +太阳能庭院灯,"规格: +高度:18''。 + +为什么我们热爱它: +我们的太阳能庭院灯无需电源,只需将其放在阳光下即可充电。到了晚上,它会自动点亮,为您的庭院增添温馨的氛围。 + +材质与护理: +可以用湿布清洁。 + +构造: +由塑料和太阳能板制成。 + +其他特性: +自动感应,日落后自动点亮。 +在中国制造。 + +有问题?请随时联系我们的客户服务团队,他们会解答您的所有问题。" +厨房刀具套装,"规格: +一套包括8把刀。 + +为什么我们热爱它: +我们的厨房刀具套装由专业级不锈钢制成,刀身坚固,刀刃锋利,切割效果出色,是厨房必备工具。 + +材质与护理: +建议手洗并立即擦干,以保持最佳状况。 + +构造: +由高品质不锈钢制成。 + +其他特性: +包括多种类型的刀,适合不同的用途。 +在德国制造。 + +有问题?请随时联系我们的客户服务团队,他们会解答您的所有问题。" +迷你无线蓝牙音箱,"规格: +直径:3'',高度:2''。 + +为什么我们热爱它: +我们的迷你无线蓝牙音箱体积小巧,音质出色,可以轻松带给您音乐的享受。 + +材质与护理: +使用湿布擦拭清洁。 + +构造: +由塑料和金属构成。 + +其他特性: +内置可充电电池,充满后可播放5小时。 +在中国制造。 + +有问题?请随时联系我们的客户服务团队,他们会解答您的所有问题。" +抗菌洗手液,"规格: +容量:500ml。 + +为什么我们热爱它: +我们的抗菌洗手液含有天然植物精华,能有效杀灭细菌,同时滋润双手。 + +材质与护理: +直接涂抹在手上,然后用水冲洗。 + +构造: +由天然植物精华和抗菌成分制成。 + +其他特性: +具有清新的柠檬香味。 +在法国制造。 + +有问题?请随时联系我们的客户服务团队,他们会解答您的所有问题。" +纯棉T恤,"规格: +尺码:S, M, L, XL, XXL。 + +为什么我们热爱它: +我们的纯棉T恤采用高品质棉质,柔软舒适,透气性好,是日常穿着的理想选择。 + +材质与护理: +可以机洗,建议反面洗涤,以保持颜色鲜艳。 + +构造: +由100%纯棉制成。 + +其他特性: +有多种颜色可选。 +在中国制造。 + +有问题?请随时联系我们的客户服务团队,他们会解答您的所有问题。" +自动咖啡机,"规格: +尺寸:12'' x 8'' x 14''。 + +为什么我们热爱它: +我们的自动咖啡机可以轻松制作美味的咖啡,只需按一下钮,就能享受到新鲜的咖啡。 + +材质与护理: +可以用湿布清洁外部,内部配件可以拆卸清洗。 + +构造: +由不锈钢和塑料制成。 + +其他特性: +可调节咖啡浓度。 +在意大利制造。 + +有问题?请随时联系我们的客户服务团队,他们会解答您的所有问题。" +摄像头保护套,"规格: +适用于各种品牌和型号的摄像头。 + +为什么我们热爱它: +我们的摄像头保护套可以有效保护您的摄像头不受灰尘和刮擦的影响。 + +材质与护理: +使用湿布擦拭。 + +构造: +由耐磨的合成纤维制成。 + +其他特性: +设计简洁,易于安装。 +在中国制造。 + +有问题?请随时联系我们的客户服务团队,他们会解答您的所有问题。" +玻璃保护膜,"规格: +适用于各种尺寸的手机屏幕。 + +为什么我们热爱它: +我们的玻璃保护膜可以有效防止手机屏幕刮伤和破裂,而且不影响触控的灵敏度。 + +材质与护理: +使用干布擦拭。 + +构造: +由高强度的玻璃材料制成。 + +其他特性: +安装简单,适合自行安装。 +在日本制造。 + +有问题?请随时联系我们的客户服务团队,他们会解答您的所有问题。" +儿童益智玩具,"规格: +适合3岁以上的儿童。 + +为什么我们热爱它: +我们的儿童益智玩具设计独特,色彩鲜艳,能够引发孩子的兴趣,同时训练他们的手眼协调能力和逻辑思维。 + +材质与护理: +使用湿布擦拭。 + +构造: +由环保无毒的塑料制成。 + +其他特性: +具有教育和娱乐的双重功能。 +在中国制造。 + +有问题?请随时联系我们的客户服务团队,他们会解答您的所有问题。" +迷你书架,"规格: +尺寸:20'' x 8'' x 24''。 + +为什么我们热爱它: +我们的迷你书架占地面积小,设计简约,能够有效存放和展示您的书籍。 + +材质与护理: +使用干布擦拭。 + +构造: +由实木制成。 + +其他特性: +拥有3层收纳空间。 +在中国制造。 + +有问题?请随时联系我们的客户服务团队,他们会解答您的所有问题。" +防滑瑜伽垫,"规格: +尺寸:72'' x 24''。 + +为什么我们热爱它: +我们的防滑瑜伽垫采用高品质环保材料,触感舒适,防滑效果好,是瑜伽爱好者的理想选择。 + +材质与护理: +可以用湿布清洁。 + +构造: +由环保PVC材料制成。 + +其他特性: +有多种颜色可选。 +在中国制造。 + +有问题?请随时联系我们的客户服务团队,他们会解答您的所有问题。" +LED台灯,"规格: +尺寸:6'' x 6'' x 18''。 + +为什么我们热爱它: +我们的LED台灯亮度可调,采用节能LED灯珠,不仅可以提供明亮的光照,还可以节省能源。 + +材质与护理: +使用湿布擦拭。 + +构造: +由金属和塑料制成。 + +其他特性: +具有触控开关和调光功能。 +在中国制造。 + +有问题?请随时联系我们的客户服务团队,他们会解答您的所有问题。" +水晶酒杯,"规格: +容量:250ml。 + +为什么我们热爱它: +我们的水晶酒杯采用高品质水晶玻璃制成,造型优雅,是享受美酒的理想选择。 + +材质与护理: +建议手洗。 + +构造: +由水晶玻璃制成。 + +其他特性: +适合各种场合使用。 +在法国制造。 + +有问题?请随时联系我们的客户服务团队,他们会解答您的所有问题。" diff --git a/content/LangChain for LLM Application Development/readme.md b/content/LangChain for LLM Application Development/readme.md index 2a99c32..ea3b506 100644 --- a/content/LangChain for LLM Application Development/readme.md +++ b/content/LangChain for LLM Application Development/readme.md @@ -4,7 +4,7 @@ ### 目录 1. 简介 Introduction @Sarai -2. 模型,提示和解析器 Models, Prompts and Output Parsers @Joye +2. 模型、提示和解析器 Models, Prompts and Output Parsers @Joye 3. 存储 Memory @徐虎 4. 模型链 Chains @徐虎 5. 基于文档的问答 Question and Answer @苟晓攀