Class ChatTransformation<TInput, TOutput>

Sends each incoming row as JSON to an Microsoft.Extensions.AI.IChatClient and writes the returned object back into the data flow. Typed output requests a JSON schema derived from TOutput; ExpandoObject output uses JSON mode.

Inherited Members
Namespace: ETLBox.AI
Assembly: ETLBox.AI.dll
Syntax
    public class ChatTransformation<TInput, TOutput> : DataFlowTransformation<TInput, TOutput>, IDataFlowTransformation<TInput, TOutput>, IDataFlowSource<TOutput>, IDataFlowSource, IDataFlowDestination<TInput>, IDataFlowDestination, IDataFlowComponent, ILoggableTask
Type Parameters
NameDescription
TInput

Type of ingoing data.

TOutput

Type of outgoing data.

Constructors

ChatTransformation()

Declaration
    public ChatTransformation()

ChatTransformation(IChatClient)

Declaration
    public ChatTransformation(IChatClient chatClient)
Parameters
TypeNameDescription
IChatClientchatClient

Properties

ChatClient

Chat client created by the caller, for example from OpenAI or Azure OpenAI.

Declaration
    public IChatClient ChatClient { get; set; }
Property Value
TypeDescription
IChatClient

ChatOptions

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
TypeDescription
ChatOptions

SourceBlock

SourceBlock from the underlying TPL.Dataflow which is used as output buffer for the component.

Declaration
    public override ISourceBlock<TOutput> SourceBlock { get; }
Property Value
TypeDescription
ISourceBlock<TOutput>
Overrides

SystemPrompt

Optional system prompt sent as a system message.

Declaration
    public string SystemPrompt { get; set; }
Property Value
TypeDescription
string

TargetBlock

TargetBlock from the underlying TPL.Dataflow which is used as input buffer for the component.

Declaration
    public override ITargetBlock<TInput> TargetBlock { get; }
Property Value
TypeDescription
ITargetBlock<TInput>
Overrides

UserPrompt

Optional user prompt sent in front of the serialized row.

Declaration
    public string UserPrompt { get; set; }
Property Value
TypeDescription
string

Methods

CheckParameter()

Declaration
    protected override void CheckParameter()
Overrides

CleanUpOnFaulted(Exception)

Declaration
    protected override void CleanUpOnFaulted(Exception e)
Parameters
TypeNameDescription
Exceptione
Overrides

CleanUpOnSuccess()

Declaration
    protected override void CleanUpOnSuccess()
Overrides

InitComponent()

Declaration
    protected override void InitComponent()
Overrides

Reset()

Declaration
    protected override void Reset()
Overrides

Implements