dotnet-microsoft-extensions-ai

Build provider-agnostic .NET AI integrations using Microsoft.Extensions.AI abstractions and middleware.

Updated Mar 31, 2026
One-click install
npx skills add https://github.com/zhenpengLai/myuseskill --skill dotnet-microsoft-extensions-ai-zhenpenglai
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: dotnet-microsoft-extensions-ai
Source: https://github.com/zhenpengLai/myuseskill/tree/main/dotnet-microsoft-extensions-ai
Command: npx skills add https://github.com/zhenpengLai/myuseskill --skill dotnet-microsoft-extensions-ai-zhenpenglai

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Choosing and wiring the right .NET AI abstraction layer is error-prone: developers often rebuild middleware by hand, confuse stateless and stateful chat flows, or under-model agentic requirements as simple chat calls. This Skill guides correct use of Microsoft.Extensions.AI for chat, embeddings, tool calling, vector search, and evaluation. ## Core Features & Use Cases - Provider-Agnostic Composition: Model IChatClient and IEmbeddingGenerator pipelines in DI with explicit caching, telemetry, logging, and function-invocation middleware. - Tool Calling & Structured Output: Use AIFunction, FunctionInvokingChatClient, and typed GetResponseAsync<T> helpers with validated inputs and scoped tool registration. - RAG & Evaluation: Combine IEmbeddingGenerator with Microsoft.Extensions.VectorData and DataIngestion pipelines, plus Microsoft.Extensions.AI.Evaluation packages for quality, NLP, and safety gates. - Use Case: When adding streaming chat with tool calling to an ASP.NET Core service, this Skill helps you register the client pipeline correctly, handle stateless vs stateful ConversationId flows, and add evaluation baselines before shipping. ## Quick Start Ask the assistant to design a DI-registered IChatClient pipeline with caching, OpenTelemetry, and function invocation for your .NET application.

Frequently Asked Questions about dotnet-microsoft-extensions-ai

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add tool calling to IChatClient in .NET?▼

Define tools with AIFunction and AIFunctionFactory, then wrap your client with FunctionInvokingChatClient to handle the invocation loop automatically. Validate tool arguments explicitly and keep tool registration scoped to the current conversation to control token costs.

Should I reference Microsoft.Extensions.AI or Microsoft.Extensions.AI.Abstractions?▼

Applications and services should reference Microsoft.Extensions.AI, which includes middleware, caching, telemetry, and function invocation. Reference only the Abstractions package when authoring provider libraries or reusable connectors at the contract layer.

How does IChatClient handle conversation state across providers?▼

For stateless providers, resend the full message history each turn. For stateful providers, propagate ConversationId from ChatResponse into ChatOptions instead of replaying history. Check the response ConversationId to detect which mode applies.

Can I use Microsoft.Extensions.AI with local models like Ollama?▼

Yes, Ollama-backed clients implement the same IChatClient abstraction, enabling low-cost local prototyping and offline development. You still own chat history replay, latency, and model-quality tradeoffs when using local models.

When should I use Microsoft Agent Framework instead of Microsoft.Extensions.AI?▼

Escalate to Agent Framework when you need agent threads, multi-agent orchestration, durable execution, workflows, or remote agent hosting. Microsoft.Extensions.AI covers provider abstraction and middleware composition, not autonomous orchestration.

How do I add evaluation gates to a .NET AI application?▼

Use the Microsoft.Extensions.AI.Evaluation packages: Quality evaluators for relevance and groundedness, NLP evaluators like BLEU and F1 for cheap baseline checks, and Safety evaluators for harmful content. Cache responses and publish reports so CI runs stay comparable.