AsyncBatchConfigurationBuilder<TBatch>
Helpers & Utilities · AiDotNet.Extensions
Builder for configuring async batch iteration with a fluent API.
Implements: IAsyncEnumerable<TBatch>
How It Works
This builder allows chaining configuration methods before async iteration. Implements IAsyncEnumerable to support await foreach loops.
Constructors
| Constructor | Summary |
|---|---|
AsyncBatchConfigurationBuilder(IBatchIterable<TBatch> source, int? batchSize, int prefetchCount) |
Initializes a new instance of the AsyncBatchConfigurationBuilder. |
Methods
| Method | Summary |
|---|---|
AsyncBatchConfigurationBuilder<TBatch> DropLast() |
Drops the last incomplete batch if the dataset doesn’t divide evenly. |
AsyncBatchConfigurationBuilder<TBatch> KeepLast() |
Keeps the last batch even if incomplete. |
AsyncBatchConfigurationBuilder<TBatch> NoShuffle() |
Disables shuffling of data before batching. |
AsyncBatchConfigurationBuilder<TBatch> Shuffled() |
Enables shuffling of data before batching. |
AsyncBatchConfigurationBuilder<TBatch> WithSeed(int seed) |
Sets a random seed for reproducible shuffling. |
IAsyncEnumerator<TBatch> GetAsyncEnumerator(CancellationToken cancellationToken) |
Returns an async enumerator that iterates through the batches. |