forked from ENTERPILOT/GoModel
-
Notifications
You must be signed in to change notification settings - Fork 0
feat(kimicode): default quota trip rules for the Kimi for Coding plan #109
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
Open
weselben
wants to merge
7
commits into
feat/quota-breaker-trip
Choose a base branch
from
feat/kimicode-quota-defaults
base: feat/quota-breaker-trip
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5ecd5d1
feat(kimicode): default quota trip rules for the Kimi for Coding plan
weselben c33003c
fix(kimicode): satisfy testifylint in trip default tests
weselben 3062133
fix(kimicode): address CodeRabbit findings on trip defaults
weselben c0cef78
fix(kimicode): address Greptile review findings on trip defaults
weselben 5f26c9c
fix(kimicode): drive factory-created provider in e2e, document trip d…
weselben f552ca5
test(kimicode): split trip-rule tests into trip_defaults_test.go
weselben 8fe4a56
feat(kimicode): named default trip groups, evaluation ordered by grou…
weselben File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| package kimicode | ||
|
|
||
| import ( | ||
| "time" | ||
|
|
||
| "github.com/enterpilot/gomodel/config" | ||
| ) | ||
|
|
||
| // Default trip rules for the Kimi for Coding plan. | ||
| // | ||
| // Each pattern is anchored against the raw error body (message + code field | ||
| // concatenated by llmclient.quotaTripTTL). The regexes are compiled lazily | ||
| // at package init so provider creation is cheap and pattern errors surface at | ||
| // startup, not at runtime. | ||
| // | ||
| // Observed upstream error fragments (from kimicode-weselben audit log): | ||
| // | ||
| // "You've reached your weekly (7-day) usage limit" | ||
| // "5-hour usage limit reached" | ||
| // "usage limit reached" / "quota exceeded" | ||
| // | ||
| // Pin the exact body fragments in unit tests (see kimicode_test.go). | ||
|
|
||
| // Group names double as evaluation priority: resolution evaluates rules in | ||
| // name order, so the most specific pattern sorts first. | ||
| func kimicodeDefaultTripOn() config.TripRuleMap { | ||
| return config.TripRuleMap{ | ||
| // Weekly 7-day plan limit → 4 hour cooldown. | ||
| "1_weekly_limit": {Match: `weekly \(7-day\) usage limit`, TTL: 4 * time.Hour}, | ||
| // 5-hour sliding-window limit. | ||
| "2_five_hour_limit": {Match: `5-hour usage limit`, TTL: 30 * time.Minute}, | ||
| // Catch-all for usage-limit and quota-exceeded errors. "quota" alone | ||
| // is deliberately not matched: non-limit 403s mentioning quota must | ||
| // not trip the breaker. | ||
| "3_usage_limit": {Match: `usage limit|quota exceeded`, TTL: 15 * time.Minute}, | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.