Documentation
¶
Index ¶
- func BatchParallel(nJobs, nWorkers, batchSize int, ...) error
- func Detachable(nJobs, nWorkers, nMaxDetached int, worker func(*Context, int))
- func For(nJobs, nWorkers int, worker func(int))
- func ForEach[T any](a []T, nWorkers int, worker func(int, T))
- func InitChatCompletionLimiters(rpm, tpm int)
- func InitEmbeddingLimiters(rpm, tpm int)
- func Parallel(nJobs, nWorkers int, worker func(workerId, jobId int) error) error
- func Split[T any](a []T, n int) [][]T
- type ConcurrentPool
- type ConditionChannel
- type Context
- type Pool
- type RateLimiter
- type SequentialPool
- type Unlimited
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BatchParallel ¶
func BatchParallel(nJobs, nWorkers, batchSize int, worker func(workerId, beginJobId, endJobId int) error) error
BatchParallel run parallel jobs in batches to reduce the cost of context switch.
func Detachable ¶ added in v0.5.1
func InitChatCompletionLimiters ¶
func InitChatCompletionLimiters(rpm, tpm int)
func InitEmbeddingLimiters ¶
func InitEmbeddingLimiters(rpm, tpm int)
Types ¶
type ConcurrentPool ¶
type ConcurrentPool struct {
// contains filtered or unexported fields
}
func NewConcurrentPool ¶
func NewConcurrentPool(size int) *ConcurrentPool
func (*ConcurrentPool) Run ¶
func (p *ConcurrentPool) Run(runner func())
func (*ConcurrentPool) Wait ¶
func (p *ConcurrentPool) Wait()
type ConditionChannel ¶
type ConditionChannel struct {
C chan struct{} // output channel
// contains filtered or unexported fields
}
func NewConditionChannel ¶
func NewConditionChannel() *ConditionChannel
func (*ConditionChannel) Close ¶
func (c *ConditionChannel) Close()
func (*ConditionChannel) Signal ¶
func (c *ConditionChannel) Signal()
type RateLimiter ¶
var ( ChatCompletionBackoff = time.Duration(0) ChatCompletionRequestsLimiter RateLimiter = &Unlimited{} ChatCompletionTokensLimiter RateLimiter = &Unlimited{} EmbeddingBackoff = time.Duration(0) EmbeddingRequestsLimiter RateLimiter = &Unlimited{} EmbeddingTokensLimiter RateLimiter = &Unlimited{} )
type SequentialPool ¶
type SequentialPool struct{}
func NewSequentialPool ¶
func NewSequentialPool() *SequentialPool
func (*SequentialPool) Run ¶
func (p *SequentialPool) Run(runner func())
func (*SequentialPool) Wait ¶
func (p *SequentialPool) Wait()
Click to show internal directories.
Click to hide internal directories.