feat:add trpc-agent-go for token-limit#605
Open
zhuyanhuazhuyanhua wants to merge 3 commits intoalibaba:ospp/llm-token-rate-limitfrom
Open
feat:add trpc-agent-go for token-limit#605zhuyanhuazhuyanhua wants to merge 3 commits intoalibaba:ospp/llm-token-rate-limitfrom
zhuyanhuazhuyanhua wants to merge 3 commits intoalibaba:ospp/llm-token-rate-limitfrom
Conversation
There was a problem hiding this comment.
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.
Author
Author
Author
|
@LearningGp Thank you for your review in your busy schedule. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


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