Documentation
¶
Index ¶
- type RateLimiter
- func (rl *RateLimiter) GetUsage(provider string) map[string]interface{}
- func (rl *RateLimiter) RecordRequest(provider string, tokenCount int)
- func (rl *RateLimiter) RegisterProvider(provider string, requestsPerMin, tokensPerMin int)
- func (rl *RateLimiter) Wait(ctx context.Context, provider string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RateLimiter ¶
type RateLimiter struct {
// contains filtered or unexported fields
}
RateLimiter provides rate limiting functionality for API calls
func (*RateLimiter) GetUsage ¶
func (rl *RateLimiter) GetUsage(provider string) map[string]interface{}
GetUsage returns the current usage statistics
func (*RateLimiter) RecordRequest ¶
func (rl *RateLimiter) RecordRequest(provider string, tokenCount int)
RecordRequest records that a request was made
func (*RateLimiter) RegisterProvider ¶
func (rl *RateLimiter) RegisterProvider(provider string, requestsPerMin, tokensPerMin int)
RegisterProvider registers a provider with rate limits
Click to show internal directories.
Click to hide internal directories.