Skip to content

refactor(adk): rename constructors to New() for ChatModelAgentMiddleware#761

Merged
hi-pender merged 2 commits intoalpha/08from
feat/refact_name
Feb 5, 2026
Merged

refactor(adk): rename constructors to New() for ChatModelAgentMiddleware#761
hi-pender merged 2 commits intoalpha/08from
feat/refact_name

Conversation

@hi-pender
Copy link
Contributor

Summary

统一 middleware 包的构造函数命名规范,使返回 ChatModelAgentMiddleware 的构造函数使用 New() 作为主要入口。

Changes

函数名 返回类型 说明
skill New AgentMiddleware 保持不变,标记为 Deprecated
skill NewChatModelAgentMiddleware ChatModelAgentMiddleware 新函数(原 NewHandler
filesystem New ChatModelAgentMiddleware NewChatModelAgentMiddleware
reduction New ChatModelAgentMiddleware NewToolReductionMiddleware

Rationale

  • skill 包保持 New 函数不变以保持向后兼容性
  • filesystemreduction 包由于原来没有 New() 函数,可以直接使用 New() 作为主要构造函数

…tMiddleware

- skill: keep New (deprecated), NewHandler -> NewChatModelAgentMiddleware
- filesystem: NewChatModelAgentMiddleware -> New
- reduction: NewToolReductionMiddleware -> New
// NewToolReductionMiddleware creates tool reduction middleware from config
func NewToolReductionMiddleware(_ context.Context, config *ToolReductionMiddlewareConfig) (mw adk.ChatModelAgentMiddleware, err error) {
// New creates tool reduction middleware from config
func New(_ context.Context, config *ToolReductionMiddlewareConfig) (mw adk.ChatModelAgentMiddleware, err error) {
Copy link

Choose a reason for hiding this comment

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

🚨 Breaking API Changes Detected

Package: github.com/cloudwego/eino/adk/middlewares/reduction

Incompatible changes:

  • NewToolReductionMiddleware: removed
Review Guidelines

Please ensure that:

  • The changes are absolutely necessary
  • They are properly documented
  • Migration guides are provided if needed

⚠️ Please resolve this thread after reviewing the breaking changes.

@hi-pender hi-pender changed the title refactor(middlewares): rename constructors to New() for ChatModelAgentMiddleware refactor(adk): rename constructors to New() for ChatModelAgentMiddleware Feb 5, 2026
"compose",
"deep",
"dynamictool",
"filesystem",
Copy link

Choose a reason for hiding this comment

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

🚨 Breaking API Changes Detected

Package: github.com/cloudwego/eino/adk/middlewares/patchtoolcalls

Incompatible changes:

  • Config: removed
  • NewMiddleware: removed
Review Guidelines

Please ensure that:

  • The changes are absolutely necessary
  • They are properly documented
  • Migration guides are provided if needed

⚠️ Please resolve this thread after reviewing the breaking changes.

@codecov
Copy link

codecov bot commented Feb 5, 2026

Codecov Report

❌ Patch coverage is 33.33333% with 2 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (alpha/08@235a286). Learn more about missing BASE report.

Files with missing lines Patch % Lines
adk/middlewares/reduction/reduction.go 0.00% 1 Missing ⚠️
adk/middlewares/skill/skill.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             alpha/08     #761   +/-   ##
===========================================
  Coverage            ?   79.78%           
===========================================
  Files               ?      146           
  Lines               ?    15805           
  Branches            ?        0           
===========================================
  Hits                ?    12610           
  Misses              ?     2218           
  Partials            ?      977           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hi-pender hi-pender merged commit 788da21 into alpha/08 Feb 5, 2026
16 checks passed
@hi-pender hi-pender deleted the feat/refact_name branch February 5, 2026 04:31
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