Microsoft.Extensions.AI
The canonical .NET AI abstraction. Every later piece in this guide — Agent Framework, RAG, function calling, observability — is built on top of IChatClient and friends. Understand this layer first.
Topics (canonical order)
-
The contract, the middleware/pipeline pattern, building a custom delegating client
-
The embeddings contract, batching, dimensionality, cross-vendor portability
-
The image-generation contract, prompts, models, output formats
-
FunctionChoiceBehavior.Auto, declaring functions, why auto function calling supersedes deprecated planners -
Built-in
OpenTelemetryMiddleware, distributed tracing of LLM calls, response caching, redaction
Why this order
Contract first (IChatClient), then siblings (embeddings, images), then the killer capability layered on top (function calling), then cross-cutting middleware (telemetry, caching). Each topic depends on the previous.
Cross-references
- IChatClient references Connecting to Each from .NET.
- Function calling feeds Agent Basics.
- Telemetry feeds AI Observability.