Table of Contents

Method AddOnnxChat

Namespace
Qavren.Edge.Chat
Assembly
Qavren.Edge.Chat.Onnx.dll

AddOnnxChat(EdgeBuilder, ChatPreset, Action<EdgeChatOptions>?, Action<ChatClientBuilder>?)

Calls AddOnnx() (so sub-project 2's order-200 OrtEnv task, model paths, resource monitor and model store are present and correctly ordered), registers the device profile, the model host, the provisioner, the order-400 startup task, the lifecycle observer and the diagnostics contributor, then delegates to services.AddChatClient.

Registration goes through MEAI's own AddChatClient and not a hand-rolled IChatClient descriptor, because that is the descriptor Agent Framework and Semantic Kernel resolve, and because its factory is ChatClientBuilder.Build - so the pipeline is constructed lazily from the app's provider and the order of builder calls does not matter. AddChatClient and AddKeyedChatClient live in the Microsoft.Extensions.DependencyInjection namespace, not Microsoft.Extensions.AI (plan adjustment 10).

Returns EdgeBuilder rather than ChatClientBuilder, matching AddOnnxEmbeddings and the rest of the suite's chaining idiom; the MEAI pipeline is the optional pipeline callback. Remember MEAI's ordering contract: ChatClientBuilder.Build applies factories in REVERSE, so the FIRST Use() call is the OUTERMOST client.

public static EdgeBuilder AddOnnxChat(this EdgeBuilder builder, ChatPreset preset, Action<EdgeChatOptions>? configure = null, Action<ChatClientBuilder>? pipeline = null)

Parameters

builder EdgeBuilder

The Qavren.Edge builder.

preset ChatPreset

Required. There is no default - see ChatPresets.

configure Action<EdgeChatOptions>

Configures this registration's EdgeChatOptions.

pipeline Action<ChatClientBuilder>

The MEAI pipeline over the client.

Returns

EdgeBuilder

The same builder.

Exceptions

ArgumentNullException

builder or preset is null.

AddOnnxChat(EdgeBuilder, string, ChatPreset, Action<EdgeChatOptions>?, Action<ChatClientBuilder>?)

Keyed registration, mirroring sub-project 1's named databases and sub-project 2's named generators. Uses AddKeyedChatClient.

public static EdgeBuilder AddOnnxChat(this EdgeBuilder builder, string name, ChatPreset preset, Action<EdgeChatOptions>? configure = null, Action<ChatClientBuilder>? pipeline = null)

Parameters

builder EdgeBuilder

The Qavren.Edge builder.

name string

The service key.

preset ChatPreset

Required. There is no default.

configure Action<EdgeChatOptions>

Configures this registration's EdgeChatOptions.

pipeline Action<ChatClientBuilder>

The MEAI pipeline over the client.

Returns

EdgeBuilder

The same builder.

Exceptions

ArgumentNullException

builder or preset is null.

ArgumentException

name is null or whitespace.