-
Notifications
You must be signed in to change notification settings - Fork 451
feat:add trpc-agent-go for token-limit #605
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: ospp/llm-token-rate-limit
Are you sure you want to change the base?
feat:add trpc-agent-go for token-limit #605
Conversation
There was a problem hiding this 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.
|
@LearningGp Thank you for your review in your busy schedule. |


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