Skip to content

support agentic message in chatwitheino#222

Open
tangchaojun-bytedance wants to merge 14 commits into
cloudwego:alpha/09from
tangchaojun-bytedance:feat/chatwitheino-agentic-message
Open

support agentic message in chatwitheino#222
tangchaojun-bytedance wants to merge 14 commits into
cloudwego:alpha/09from
tangchaojun-bytedance:feat/chatwitheino-agentic-message

Conversation

@tangchaojun-bytedance
Copy link
Copy Markdown
Collaborator

Summary

  • Make chatwitheino generic over schema.Message and schema.AgenticMessage.
  • Add runtime MESSAGE_KIND selection plus separate session storage for message and agenticmessage.
  • Reuse official Eino/Eino-Ext model implementations for OpenAI, Ark, agenticopenai, and agenticark.
  • Update tutorial chapters and docs for both message kinds.

Validation

  • go test ./... in quickstart/chatwitheino.
  • Ark live smoke: ch01-ch09, cmd/ch10, and root server passed for message and agenticmessage with doubao-seed-2-0-code-preview-260215.
  • OpenAI live smoke: ch01-ch09, cmd/ch10, and root server passed for message and agenticmessage after spacing requests to avoid QPM limits.

@tangchaojun-bytedance tangchaojun-bytedance marked this pull request as ready for review May 14, 2026 13:04
@tangchaojun-bytedance tangchaojun-bytedance changed the title [codex] support agentic message in chatwitheino support agentic message in chatwitheino May 14, 2026
@tangchaojun-bytedance tangchaojun-bytedance marked this pull request as draft May 15, 2026 02:35
@tangchaojun-bytedance tangchaojun-bytedance marked this pull request as ready for review May 15, 2026 03:01
@shentongmartin
Copy link
Copy Markdown
Contributor

PR #222 Review Summary

Overall Assessment: 可以合并,无 Blocker。

这是一个高质量的 PR,设计原则清晰(泛型 M adk.MessageType 贯穿全栈 + msgops 统一抽象层),实现正确(编译通过、现有 7 个测试全部 PASS、额外 16 个攻击测试全部 PASS,未发现 confirmed bug)。


Design Review Scorecard

Dimension Rating Notes
Concept Coherence ⭐⭐⭐⭐ msgops.Kind 是清晰的新概念
API Usability ⭐⭐⭐⭐ NewUser[M](), Text[M]() 直观
Minimum API Surface ⭐⭐⭐ AssistantDeltaText = AssistantText 可合并
Backward Compatibility ⭐⭐⭐⭐⭐ 独立 module,不影响其他
Module Separation ⭐⭐⭐⭐ msgops / chatmodel / a2ui 职责清晰
Cohesion vs. Tension ⭐⭐⭐ ch05-ch09 大量代码重复
Elegance vs. Complexity ⭐⭐⭐⭐ 泛型方案简洁
Naming ⭐⭐⭐⭐ KindMessage/KindAgentic 语义明确
Readability ⭐⭐⭐ msgops.go 568 行可拆分
Duplication ⭐⭐ safeToolMiddleware × 6, printAndCollect × 8
Documentation ⭐⭐⭐⭐ 每个导出函数有 GoDoc
Internal Comments ⭐⭐⭐⭐ 关键逻辑有注释

Top 3 Suggestions

  1. 🟡 减少跨 chapter 的代码重复safeToolMiddleware × 6 份、printAndCollectAssistantFromEvents × 8 份副本。建议提取到共享包(如 helpers/),降低维护成本。
  2. 🟡 合并或文档化 AssistantDeltaText / AssistantText:两者实现完全相同(msgops/msgops.go L169-171),对用户而言名字暗示不同语义。如果是预留未来分化空间,建议添加注释说明。
  3. 🟡 为 ModelRetryConfig 仅限 Message 类型的设计添加注释:代码中多处 if msgops.KindOf[M]() == msgops.KindMessage { cfg.ModelRetryConfig = ... },应说明 Agentic 模式不启用重试的原因。

Attack Review: 16/16 PASS ✅

核心 msgops 抽象层在以下维度全部验证通过:

  • Nil 安全(不 panic)
  • 类型断言安全
  • JSON 往返正确
  • ValidateKind 边界条件健壮
  • 角色标签正确(Tool vs You)
  • 空消息/空工具结果处理正确

Additional Suggestions

  1. 🟢 考虑将 msgops.go 拆分为多个文件(kind.go + construct.go + extract.go + variant.go)以提高可读性。
  2. 🟢 为核心 msgops 包添加单元测试

Copy link
Copy Markdown
Contributor

@shentongmartin shentongmartin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inline suggestions — see individual file comments below.

Comment thread quickstart/chatwitheino/msgops/msgops.go
Comment thread quickstart/chatwitheino/agent.go Outdated
Comment thread quickstart/chatwitheino/cmd/ch05/main.go Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants