eino-ReAct模式
ReAct 模式(Reasoning + Acting)详解 ⚠️ 注意:这里的 ReAct 不是前端框架 React.js,而是 LLM Agent 领域的一个经典范式,全称 Reasoning + Acting,出自 2022 年论文 ReAct: Synergizing Reasoning and Acting in Language Models。 🔹 核心思想LLM 在一个循环中交替进行 思考(Reasoning) 和 行动(Acting): 12345678910111213141516循环开始 │ ├─ 🤔 Thought: "用户要提取 CSV 第一列,我先看看文件结构" ← 推理 ├─ 🛠️ Action: read_file(path="questions.csv", n_rows=5) ← 调用工具 ├─ 👁️ Observation: "type,question,options,answer,..." ← 工具返回 │ ├─ 🤔 Th...
git-fork后的操作
[任务规划]你的情况是:你已经在 GitHub 上 fork 了 cloudwego/eino-examples 到自己的账号下,但本地代码的 origin 还指向原始仓库(cloudwego/eino-examples)。你需要把 origin 改为指向你自己的 fork 仓库,这样才能 push 代码。 操作步骤1. 修改 origin 指向你自己的 fork 仓库假设你的 GitHub 用户名是 你的用户名,fork 后的仓库地址类似: 1git@github.com:你的用户名/eino-examples.git 执行以下命令将 origin 改为你自己的仓库: 1git remote set-url origin git@github.com:你的用户名/eino-examples.git 2. (可选)保留原始仓库作为 upstream,方便以后同步更新1git remote add upstream git@github.com:cloudwego/eino-examples.git 3. 验证配置1git remote -v 预期输出: 1234origi...
eino-example-DeepAgents项目分析(2/)
DeepAgent 示例:Tool 定义体系详解 📁 项目路径:adk/multiagent/deep/🎯 核心设计:两层工具分配 + 装饰器包装 + 子智能体委派 一、整体 Tool 架构本项目采用 两层 Tool 分配机制——主 Agent 和子 Agent 各自拥有不同的工具集: 123456789101112┌─ DeepAgent (主 Agent) ───────────────────────────────┐│ 工具:read_file, tree ← 只读能力 ││ ││ 子Agent: ││ ┌─ CodeAgent ─────────────────────────────────────┐ ││ │ 工具:bash, tree, edit_file, read_file, │ ││ │ ...
eino-example-DeepAgents项目分析(1/)
DeepAgent 项目分析 📁 项目路径:eino-examples/adk/multiagent/deep/🎯 核心模式:Plan-Execute(计划-执行) 多智能体编排 一、项目概览adk/multiagent/deep/ 是一个基于 Eino 框架 deep.New() 预构建 Agent 的多智能体 Excel/文件处理系统。它演示了 Plan-Execute(计划-执行) 模式: 1主 Agent 制定分步计划 → 将每一步委派给专业化的子 Agent 执行 🔗 与参考文档 ch04 的关系 参考文档 ch04_tool_backend_filesystem.md 本项目 adk/multiagent/deep/ deep.New() 最简用法 deep.New() 高级用法 仅配置 Backend + StreamingShell 手动构建自定义 Tools 和 SubAgents Agent 自动获得文件系统能力 展示多智能体编排能力 适合快速上手 适合生产级复杂任务 二、目录结构123456789101112...
go-字符串排序
Go 语言:字符串排序详解🔹 核心三步:字符串排序的标准流程1234567891011str := "eat"// 第一步:字符串 → 字节切片(因为 string 不可修改)s := []byte(str) // ['e', 'a', 't']// 第二步:对字节切片排序sort.Slice(s, func(i, j int) bool { return s[i] < s[j] }) // ['a', 'e', 't']// 第三步:字节切片 → 字符串sortedStr := string(s) // "aet" 🔹 为什么要转 []byte?因为 Go 的 string 是不可变的,不能原地修改: 12str := "eat"str[0] = 'x' /...
go-结构体成员Tag
《Go 程序设计语言》4.5 JSON — 结构体成员 Tag1. Tag 是什么?Tag(标签) 是附加在结构体字段上的元信息字符串,用反引号 ` 包裹: 123456type Movie struct { Title string Year int `json:"released"` Color bool `json:"color,omitempty"` Actors []string} 💡 Tag 不影响 Go 代码的逻辑,它是给 encoding/json 等包读取的”标注”,用来控制序列化/反序列化的行为。 2. Tag 的语法1`key:"value" key2:"value2"` 以 JSON 为例,通用格式为: 1`json:"字段名,选项"` 写法 含义 json:"released" JSON 字段名为 released json:"col...
go-结构体核心概念总结
《Go 程序设计语言》4.4 结构体 核心概念总结1. 基本定义结构体(struct)是聚合数据类型,将零个或多个不同类型的值组合成一个实体: 1234567891011type Employee struct { ID int Name string Address string DoB time.Time Position string Salary int ManagerID int}var dilbert Employee 🔹 相同类型成员可合并声明123type Point struct { X, Y int // 等价于 X int; Y int} 2. 成员访问与修改1234567891011// 点操作符访问dilbert.Name = "Alice"fmt.Println(dilbert.Salary)// 取成员地址(成员可寻址时)position := &dilbert.Positio...
go-切片用法-切片头详解(2/2)
Go 语言:切片头(Slice Header)深度解析🔹 切片头是什么?Go 中切片变量本身不直接存储数据,它只是一个包含三个字段的小结构体,这个结构体就叫切片头(Slice Header): 123456// Go 源码中的实际定义(reflect 包)type SliceHeader struct { Data uintptr // 指针,指向底层数组 Len int // 长度 Cap int // 容量} 🎯 形象比喻123456789切片变量 values┌──────────────────────┐│ Data: 0xABC (指针) ││ Len: 4 │ ← 这三个字段就是"切片头"│ Cap: 4 │└──────┬───────────────┘ │ ▼ 底层数组 [5, 3, 8, 1] ← 真正的数据在这里 💡 切片头就像一个遥控器,真正的数据(底层数组)...
go-结构体指针与返回值类型知识点汇总
Go 结构体指针与返回值类型 知识点汇总1. 函数返回指针 *T vs 返回值 T🔹 返回指针 *Employee — 可以直接修改原始数据1234567func EmployeeByID(id int) *Employee { /* ... */ }// ✅ 读取fmt.Println(EmployeeByID(id).Position)// ✅ 修改 — 修改的是原始数据EmployeeByID(id).Salary = 0 内存模型: 12EmployeeByID(id) → 指针 → 内存中的 Employee ↑ 修改 Salary,改的是它 💡 返回指针时,你拿到的是原始数据的地址,通过指针修改就是直接改原始数据。 🔹 返回值 Employee — 不能直接修改1234567func EmployeeByID(id int) Employee { /* ... */ }// ✅ 读取fmt.Println(EmployeeByID(id...
go-利用map构建set
Go 语言:使用 map[string]struct{} 实现 Set🔹 struct{} 是什么?struct{} 是空结构体,Go 中最小的类型: 12var s struct{}fmt.Println(unsafe.Sizeof(s)) // 0 —— 占用 0 字节内存 它只有一个可能的值:struct{}{}(空结构体的字面量) 不占用任何内存空间,是理想的”占位符”类型 🔹 为什么用它做 Set?Set(集合)只关心 key 存不存在,value 没有实际意义。对比两种写法: 12345// 方式一:map[string]bool — value 占 1 字节seen := map[string]bool{"alice": true, "bob": true}// 方式二:map[string]struct{} — value 占 0 字节 ✅ 更省内存seen := map[string]struct{}{"ali...