type
status
date
slug
summary
tags
category
icon
password
一 多模型强应用:AI2.0 时代应用开发者机会
- Ai Agent将是Ai的未来
- "人工智能代理(Agent)不仅会改变每个人与计算机交互的方式。它们还将
颠覆软件行业,带来自我们从键入命令到点击图标以来最大的计算革命。"
- from say someting to do someting
- 能做什么
- AI协同工作
- 自我迭代学习
- 软件开发
- 数据可视化
- 客户服务
- 财务管理
- 健康管理
- 私人助理
- 学习Agent可结合自己的业务和长处,去开发各种Agent来实现业务的倍增
- 国内外主要的LLM及特点介绍

2024 年腾讯和阿里的大模型已经开源了
- 大模型的不足以及解决方案

- AI产业拆解以及常见名词


- 如何拥抱aigc

二 初识 langchain: LLM大模型与AI应用的粘合剂
- langchain 是什么以及发展过程

- langchain能做什么以及能力
- 开发:使用 LangChain 的开源构建模块和组件构建应用程序。使用第三方集成(opens in a new tab)和模板(opens in a new tab)快速上手。
- 生产化:使用LangSmith检查、监控和评估你的链条,以便你可以持续优化和自信地部署。
- 部署:使用LangServe(opens in a new tab)将任何链条转变为 API。



LangChain 是一个基于大型语言模型(LLM)开发应用程序的框架。
LangChain 简化了LLM应用程序生命周期的每个阶段:
‣
- langchain的第一个示例

三 LangChain核心模块与实战:用prompts模板调教LLM的输入出
- 模型IO:大预言模型的交互接口
- 模型LLM 和chatModel的区别是什么呢 ? todo

- prompts末班:更加高级和灵活的提示词工程
- 字符串模板-promptTemplate
- 对话模板 chatPromptTemplate
- 自定义模板
- 使用jinji2 与 f-string来实现提示词模板格式化
- pipeline-PromptTemplate组合多层级
- 序列化:使用文件来管理提示词模板,load_prompt



对话可以作为上下文
或者指定消息类型直接创建


- 兼容窗口的示例选择器
- 输入和输出窗口是有限制的
- prompt写的越详细,字越多.
- 示例选择器
- 基于长度的
- ‣
- 最大边际相关的
- ‣
- Ngram重叠
- 相似度

- 核心组件LLm vs chat models

流式输出
追踪token使用
- 不止聊天, outputParse

四 LangChain知识库构建与RAG设计:增强自己大模型能力,实现与各种文档对话

为LLM提供来自外部知识源的额外信息的概念。这允许它们生成更准确和有上下文的答案,同时减少幻觉
(1)检索:外部相似搜索(2)增强:提示词更新(3)生成:更详细的的提示词输入LLM
LangChain中RAG的实现



- loader(100 多种)

- 文档转换分割
- 文档切割器和文字转换
- 将文档分成小的、有意义的块(句子)
- 将小的块组合成一个更大的块,直到达到一定的大小。
- 一旦达到一定的大小,接着开始创建与下一个块重叠的部分。
- 代码文档切分
- 按照token切分文档
- 总结,提炼,翻译
- 如何解决长文本切分信息丢失

#对检索结果进行重新排序,根据论文的方案
#问题相关性越低的内容块放在中间
#问题相关性越高的内容块放在头尾
- 文本向量化


向量化文档,向量化查询
切分文档→向量化→嵌入缓存
- 向量数据服务(向量数据库)


五 LangChain链与记忆处理:带你实现大模型记忆增强,让你的大模型更加智能
- chain(重要的组成部件)
- 看着是一次调用,背后是一系列的操作


- 四中基础内置链



- 自定义链或者load使用别人开源链
- 预制链处理文档,实现文档对话




- Memory:解决大模型无状态问题


利用内存实现短时记忆
利用 Entity memory 构建实体记忆
利用知识图谱来构建记忆
利用对话摘要来兼容内存中的长对话
使用 token 来刷新内存缓冲区
使用向量数据库实现长时记忆
- Memory in chains

在 LLMChain 上增加记忆
在对话链中加载记忆
自定义记忆
在同一个链中合并使用多个记忆
向一个多参数链中添加记忆
- 主要的预制链


六 Agent核心与实践:初窥未来机器人,学Agent基本开发,让大模型不止于聊天
agents是什么

AI Agent是指人工智能代理(Artificial Intelligence Agent),是一种能够感知环境、进行决策和执行动作的智能实体。 举个例子,AI Agent 就像是一个小爱同学,住在你的手机或电脑里,有智慧和观察能力。agent是一种能够自主理解、规划决策、执行复杂任务的智能体
‣

本质上Agents是一个LLM的编排与执行 ; 一个精简的Agents的决策流程,一个循环任务
langchain在agents中如何实现




将memory插入到提示词模板中


LCEL:langchain表达式语言







最佳开发实践



七 AI Agent智能体开发:工善其事,必利其器,一步步教你搭建agent开发环境
技术架构


- 作者:coderma4k
- 链接:https://coderma4k.com//article/14ebd2a3-ceeb-8097-9055-f5c0eb53a129
- 声明:本文采用 CC BY-NC-SA 4.0 许可协议,转载请注明出处。