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.
Inheritance
Implements
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, ILoggableTaskType Parameters
| Name | Description |
|---|---|
| TInput | Type of ingoing data. |
| TOutput | Type of outgoing data. |
Constructors
ChatTransformation()
Declaration
public ChatTransformation()ChatTransformation(IChatClient)
Declaration
public ChatTransformation(IChatClient chatClient)Parameters
| Type | Name | Description |
|---|---|---|
| IChatClient | chatClient |
Properties
ChatClient
Chat client created by the caller, for example from OpenAI or Azure OpenAI.
Declaration
public IChatClient ChatClient { get; set; }Property Value
| Type | Description |
|---|---|
| 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
| Type | Description |
|---|---|
| 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
| Type | Description |
|---|---|
| ISourceBlock<TOutput> |
Overrides
SystemPrompt
Optional system prompt sent as a system message.
Declaration
public string SystemPrompt { get; set; }Property Value
| Type | Description |
|---|---|
| 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
| Type | Description |
|---|---|
| ITargetBlock<TInput> |
Overrides
UserPrompt
Optional user prompt sent in front of the serialized row.
Declaration
public string UserPrompt { get; set; }Property Value
| Type | Description |
|---|---|
| string |
Methods
CheckParameter()
Declaration
protected override void CheckParameter()Overrides
CleanUpOnFaulted(Exception)
Declaration
protected override void CleanUpOnFaulted(Exception e)Parameters
| Type | Name | Description |
|---|---|---|
| Exception | e |
Overrides
CleanUpOnSuccess()
Declaration
protected override void CleanUpOnSuccess()Overrides
InitComponent()
Declaration
protected override void InitComponent()Overrides
Reset()
Declaration
protected override void Reset()