Skip to content

Conversation

@zhuyanhuazhuyanhua
Copy link

@zhuyanhuazhuyanhua zhuyanhuazhuyanhua commented Dec 15, 2025

Describe what this PR does / why we need it

Compatible with trpc-agent-go framework to realise token flow limitation

Does this pull request fix one issue?

https://github.com/alibaba/sentinel-golang/issues/596

Describe how you did it

Wrap the trpc-agent-go interface to implement a unified interface, similar to EINO and LangchainGo

Describe how to verify it

cd example
go run main.go

Special notes for reviews

@CLAassistant
Copy link

CLAassistant commented Dec 15, 2025

CLA assistant check
All committers have signed the CLA.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a new adapter for trpc-agent-go framework to enable token-based flow control for LLM operations using Sentinel. The implementation follows the existing patterns established by the eino and langchaingo adapters, wrapping the trpc-agent-go model.Model interface to integrate with Sentinel's LLM token rate limiting capabilities.

Key Changes

  • Implements LLM wrapper with sentinel entry management for token rate limiting
  • Adds configurable options for resource extraction, prompt extraction, and token info extraction
  • Handles trpc-agent-go's channel-based response pattern with comprehensive error handling

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 14 comments.

File Description
pkg/adapters/trpc/wrapper.go Core wrapper implementation that integrates trpc-agent-go with Sentinel token rate limiting
pkg/adapters/trpc/option.go Configuration options following the functional options pattern with default prompt extraction
pkg/adapters/trpc/go.mod Module definition with dependencies for trpc-agent-go v0.7.0
pkg/adapters/trpc/go.sum Dependency checksums for the module

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@zhuyanhuazhuyanhua
Copy link
Author

zhuyanhuazhuyanhua commented Dec 17, 2025

测试后正常
image

@zhuyanhuazhuyanhua
Copy link
Author

zhuyanhuazhuyanhua commented Dec 17, 2025

测试后正常
image

@zhuyanhuazhuyanhua
Copy link
Author

@LearningGp Thank you for your review in your busy schedule.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants