Class ChatBatchTransformation<TInput, TOutput> Sends each batch to an Microsoft.Extensions.AI.IChatClient as one request and emits the returned rows in the order they came back.
The batch is sent as {"Items":[...]} and the same envelope is expected in the response.
Set RequireSameItemCount to enforce one item per input row. Default batch size is 10.
Inheritance ChatBatchTransformation<TInput, TOutput>
Namespace : ETLBox.AIAssembly : ETLBox.AI.dll public class ChatBatchTransformation < TInput , TOutput > : DataFlowTransformation < TInput , TOutput >, IDataFlowTransformation < TInput , TOutput >, IDataFlowSource < TOutput >, IDataFlowSource , IDataFlowDestination < TInput >, IDataFlowDestination , IDataFlowComponent , ILoggableTask Type Parameters Name Description TInput Type of ingoing data.
TOutput Type of outgoing data.
Constructors
Declaration public ChatBatchTransformation ()
Declaration public ChatBatchTransformation ( IChatClient chatClient ) Parameters Type Name Description IChatClient chatClient
Declaration public ChatBatchTransformation ( IChatClient chatClient , int batchSize ) Parameters Type Name Description IChatClient chatClient int batchSize
Properties The number of rows sent to the chat client in one request. Default is 10.
Declaration public int BatchSize { get ; set ; } Property Value Chat client created by the caller, for example from OpenAI or Azure OpenAI.
Declaration public IChatClient ChatClient { get ; set ; } Property Value Type Description IChatClient
Optional chat options such as model or temperature. These options are not modified.
If no response format is set, a suitable one is added automatically.
Declaration public ChatOptions ChatOptions { get ; set ; } Property Value Type Description ChatOptions
If true, the response must contain exactly one item per input row, otherwise an exception is thrown.
Default is false, so the chat client may return more or fewer items than the batch contains.
Declaration public bool RequireSameItemCount { get ; set ; } Property Value SourceBlock from the underlying TPL.Dataflow which is used as output buffer for the component.
Declaration public override ISourceBlock < TOutput > SourceBlock { get ; } Property Value Overrides Optional system prompt sent as a system message.
Declaration public string SystemPrompt { get ; set ; } Property Value TargetBlock from the underlying TPL.Dataflow which is used as input buffer for the component.
Declaration public override ITargetBlock < TInput > TargetBlock { get ; } Property Value Overrides Optional user prompt sent in front of the serialized batch.
Declaration public string UserPrompt { get ; set ; } Property Value Methods
Declaration protected override void CheckParameter () Overrides
Declaration protected override void CleanUpOnFaulted ( Exception e ) Parameters Overrides
Declaration protected override void CleanUpOnSuccess () Overrides
Declaration protected override void CompleteBuffer () Overrides
Declaration protected override void FaultBuffer ( Exception e ) Parameters Overrides
Declaration protected override void InitComponent () Overrides
Declaration protected override void Reset () Overrides Implements#