TranscriptLoggingChatClient
NexusLabs.Needlr.AgentFramework.Workflows¶
NexusLabs.Needlr.AgentFramework.Workflows.Middleware¶
TranscriptLoggingChatClient Class¶
Microsoft.Extensions.AI.DelegatingChatClient middleware that intercepts GetResponseAsync(IEnumerable<ChatMessage>, ChatOptions, CancellationToken) calls and writes request/response pairs to an ITranscriptWriter.
Inheritance System.Object 🡒 Microsoft.Extensions.AI.DelegatingChatClient 🡒 TranscriptLoggingChatClient
Remarks¶
Set CurrentStageName before each pipeline stage to tag
transcript entries with the originating stage. If not set, entries default
to "unknown".
This middleware does not buffer or transform messages — it records them as-is and delegates to the inner client unchanged.
Constructors¶
TranscriptLoggingChatClient(IChatClient, ITranscriptWriter) Constructor¶
public TranscriptLoggingChatClient(Microsoft.Extensions.AI.IChatClient innerClient, NexusLabs.Needlr.AgentFramework.Workflows.Middleware.ITranscriptWriter writer);
Parameters¶
innerClient Microsoft.Extensions.AI.IChatClient
The inner chat client to delegate to.
writer ITranscriptWriter
The transcript writer to record entries into.
Properties¶
TranscriptLoggingChatClient.CurrentStageName Property¶
Gets or sets the current stage name used to tag transcript entries. Call this before each stage execution.
Property Value¶
Methods¶
TranscriptLoggingChatClient.GetResponseAsync(IEnumerable<ChatMessage>, ChatOptions, CancellationToken) Method¶
Sends chat messages and returns the response.
public override System.Threading.Tasks.Task<Microsoft.Extensions.AI.ChatResponse> GetResponseAsync(System.Collections.Generic.IEnumerable<Microsoft.Extensions.AI.ChatMessage> messages, Microsoft.Extensions.AI.ChatOptions? options=null, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));
Parameters¶
messages System.Collections.Generic.IEnumerable<Microsoft.Extensions.AI.ChatMessage>
The sequence of chat messages to send.
options Microsoft.Extensions.AI.ChatOptions
The chat options with which to configure the request.
cancellationToken System.Threading.CancellationToken
The System.Threading.CancellationToken to monitor for cancellation requests. The default is System.Threading.CancellationToken.None.
Implements GetResponseAsync(IEnumerable<ChatMessage>, ChatOptions, CancellationToken)
Returns¶
System.Threading.Tasks.Task<Microsoft.Extensions.AI.ChatResponse>
The response messages generated by the client.