Documentation
¶
Index ¶
- func Detachable(ctx context.Context, nJobs, nWorkers, nMaxDetached int, ...) error
- func For(ctx context.Context, nJobs, nWorkers int, worker func(int)) error
- func ForEach[T any](ctx context.Context, a []T, nWorkers int, worker func(int, T)) error
- func InitChatCompletionLimiters(rpm, tpm int)
- func InitEmbeddingLimiters(rpm, tpm int)
- func Parallel(ctx context.Context, nJobs, nWorkers int, ...) error
- func Split[T any](a []T, n int) [][]T
- type Context
- type RateLimiter
- type Unlimited
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Detachable ¶ added in v0.5.1
func InitChatCompletionLimiters ¶
func InitChatCompletionLimiters(rpm, tpm int)
func InitEmbeddingLimiters ¶
func InitEmbeddingLimiters(rpm, tpm int)
func Parallel ¶
func Parallel(ctx context.Context, nJobs, nWorkers int, worker func(workerId, jobId int) error) error
Parallel schedules and runs tasks in parallel. nTask is the number of tasks. nJob is the number of executors. worker is the executed function which passed a range of task Names (begin, end). The ctx argument allows callers to cancel outstanding work.
Types ¶
type RateLimiter ¶
var ( ChatCompletionBackoff = time.Duration(0) ChatCompletionRequestsLimiter RateLimiter = &Unlimited{} ChatCompletionTokensLimiter RateLimiter = &Unlimited{} EmbeddingBackoff = time.Duration(0) EmbeddingRequestsLimiter RateLimiter = &Unlimited{} EmbeddingTokensLimiter RateLimiter = &Unlimited{} )
Click to show internal directories.
Click to hide internal directories.