Skip to content

fix(go-agent): support Aliyun tool calls - #17099

Merged
yuzhichang merged 2 commits into
infiniflow:mainfrom
Harry-Hz-Zhang:fix/LLM-tool-aliyun-siliconflow
Jul 20, 2026
Merged

yuzhichang merged 2 commits into
infiniflow:mainfrom
Harry-Hz-Zhang:fix/LLM-tool-aliyun-siliconflow

Conversation

@Harry-Hz-Zhang

Copy link
Copy Markdown
Contributor

Summary

  • Enable synchronous and streaming tool calls for Aliyun models.
  • Preserve provider-specific chat endpoints and prevent repeated qwen-flash tool calls.
  • Restrict retrieval tool inputs to model-provided query parameters.

Testing

  • bash build.sh --test ./internal/entity/models ./internal/agent/component ./internal/agent/tool
  • Manual frontend UI testing passed.

@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. 🐞 bug Something isn't working, pull request that fix bug. 💞 feature Feature request, pull request that fullfill a new feature. labels Jul 20, 2026
@coderabbitai

coderabbitai Bot commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 97556a16-eacb-4604-b28d-fd3ca4cfaa94

📥 Commits

Reviewing files that changed from the base of the PR and between 6de8a99 and d9a6afa.

📒 Files selected for processing (1)
  • internal/service/agent.go

📝 Walkthrough

Walkthrough

Aliyun models now support tool calls in non-streaming and streaming chat paths. Agent chat model creation uses shared provider-backed driver resolution with base URL overrides. Retrieval metadata and canvas invocation error handling were updated with corresponding tests.

Changes

Aliyun tool-call support

Layer / File(s) Summary
Request and response tool-call handling
conf/models/aliyun.json, internal/entity/models/aliyun.go, internal/entity/models/aliyun_test.go
Aliyun models advertise tool support, send tool metadata, parse returned tool calls, and preserve tool-message behavior.
Streaming tool-call aggregation
internal/entity/models/aliyun.go, internal/entity/models/aliyun_test.go
Streaming tool-call deltas are merged, ordered, validated for terminal completion, and exposed through ToolCallsResult.

Chat model driver resolution

Layer / File(s) Summary
Provider-backed driver construction
internal/agent/component/llm.go, internal/agent/component/agent.go, internal/agent/component/model_driver_test.go
Chat invocation and agent construction use shared provider drivers, optional base URL overrides, dummy-driver handling, and preserved provider chat suffixes.

Metadata and runtime error classification

Layer / File(s) Summary
Schema and invocation error validation
internal/agent/tool/retrieval.go, internal/agent/tool/retrieval_test.go, internal/service/agent.go, internal/service/agent_run_e2e_test.go
Retrieval metadata excludes Canvas configuration fields, while agent invocation failures retain canvas context and avoid storage-error classification.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

Suggested labels: go

Poem

A rabbit watched tool calls hop,
Through streams and messages—plop!
Drivers found their proper way,
Errors spoke more clear today.
Schemas shed fields out of sight—
Carrots cheer the code tonight!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main change: adding Aliyun tool call support.
Description check ✅ Passed The description includes the required Summary section and adds useful testing details, so it mostly matches the template.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Harry-Hz-Zhang Harry-Hz-Zhang added the ci Continue Integration label Jul 20, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@internal/agent/component/llm.go`:
- Around line 299-330: Trim whitespace from override at the start of
newChatModelDriver, then use the normalized value for the provider and
dummy-driver base URL handling. Preserve the existing empty-check and
trailing-slash removal behavior using the cleaned override.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2ea963ad-985a-4af2-9ee5-73340287c457

📥 Commits

Reviewing files that changed from the base of the PR and between b2e88c9 and 6de8a99.

📒 Files selected for processing (9)
  • conf/models/aliyun.json
  • internal/agent/component/agent.go
  • internal/agent/component/llm.go
  • internal/agent/component/model_driver_test.go
  • internal/agent/tool/retrieval.go
  • internal/agent/tool/retrieval_test.go
  • internal/entity/models/aliyun.go
  • internal/entity/models/aliyun_test.go
  • internal/service/agent_run_e2e_test.go
💤 Files with no reviewable changes (1)
  • internal/agent/tool/retrieval.go

Comment thread internal/agent/component/llm.go Resolved
@yuzhichang

Copy link
Copy Markdown
Member

LGTM

@yuzhichang
yuzhichang merged commit e87008e into infiniflow:main Jul 20, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 bug Something isn't working, pull request that fix bug. ci Continue Integration 💞 feature Feature request, pull request that fullfill a new feature. size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants