Parent Issue
Part of the dotnet-ai plugin proposal: #225
Summary
Add the meai-chat-integration skill to the dotnet-ai plugin.
This skill guides developers through integrating LLM chat capabilities into .NET applications using Microsoft.Extensions.AI (MEAI) and the IChatClient abstraction. It is the foundation layer that most other AI skills build upon.
What This Skill Covers
- IChatClient setup with any provider (OpenAI, Azure OpenAI, Ollama, etc.)
- ChatClientBuilder middleware pipeline —
UseFunctionInvocation(), UseOpenTelemetry(), UseDistributedCache()
- Streaming via
GetStreamingChatCompletionAsync()
- Structured output with
GetResponseAsync<T>() for typed JSON responses
- Retry/resilience via
Microsoft.Extensions.Http.Resilience and StandardResilienceHandler
- Model pinning with
ChatOptions.ModelId
- Token cost awareness — extracting
Usage from ChatResponse
- Token counting and tokenizer selection — using
Microsoft.ML.Tokenizers for context window management and text truncation (detailed API in references/tokenizers.md)
- Output validation — checking
FinishReason for truncation
What This Skill Does NOT Cover
- Embeddings (use
meai-embeddings)
- Agent workflows / tool calling (use
agentic-workflow)
- ML.NET classical ML (use
mlnet)
- Running pre-trained ONNX models (use
onnx-runtime-inference)
Reference Files
| File |
Purpose |
references/tokenizers.md |
Microsoft.ML.Tokenizers API — all 8 tokenizer types (Tiktoken, BPE, SentencePiece, Llama, BERT, WordPiece, CodeGen, Phi2), token counting, truncation, encoding/decoding. Used by this skill for context window management and also referenced by data-ingestion-pipeline, onnx-runtime-inference, and rag-pipeline for their tokenization needs. |
Files
plugins/dotnet-ai/skills/meai-chat-integration/
SKILL.md
references/
tokenizers.md
tests/dotnet-ai/meai-chat-integration/eval.yaml
Eval Scenarios
- ASP.NET Core chat endpoint — prompt asks to add chat to an API; expects IChatClient with DI registration, streaming, and middleware pipeline
Key Packages
Microsoft.Extensions.AI (core)
Microsoft.ML.Tokenizers (token counting and context window management)
- Provider:
OpenAI, Azure.AI.OpenAI, or OllamaSharp
Dependencies
Requires the plugin scaffold (sub-issue #1) to be merged first.
Acceptance Criteria
Parent Issue
Part of the
dotnet-aiplugin proposal: #225Summary
Add the
meai-chat-integrationskill to thedotnet-aiplugin.This skill guides developers through integrating LLM chat capabilities into .NET applications using
Microsoft.Extensions.AI(MEAI) and theIChatClientabstraction. It is the foundation layer that most other AI skills build upon.What This Skill Covers
UseFunctionInvocation(),UseOpenTelemetry(),UseDistributedCache()GetStreamingChatCompletionAsync()GetResponseAsync<T>()for typed JSON responsesMicrosoft.Extensions.Http.ResilienceandStandardResilienceHandlerChatOptions.ModelIdUsagefromChatResponseMicrosoft.ML.Tokenizersfor context window management and text truncation (detailed API inreferences/tokenizers.md)FinishReasonfor truncationWhat This Skill Does NOT Cover
meai-embeddings)agentic-workflow)mlnet)onnx-runtime-inference)Reference Files
references/tokenizers.mdFiles
Eval Scenarios
Key Packages
Microsoft.Extensions.AI(core)Microsoft.ML.Tokenizers(token counting and context window management)OpenAI,Azure.AI.OpenAI, orOllamaSharpDependencies
Requires the plugin scaffold (sub-issue #1) to be merged first.
Acceptance Criteria
nameanddescriptionreferences/tokenizers.mdcovers all 8 tokenizer types, CountTokens, EncodeToIds, Decode, GetIndexByTokenCount