| page_type | sample | |
|---|---|---|
| languages |
|
|
| products |
|
|
| name | Reference implementations of MEAI interfaces | |
| urlFragment | meai-interface-implementations |
This project contains a set of samples with reference implementations for the interfaces included in the Microsoft.Extensions.AI.Abstractions and Microsoft.Extensions.AI NuGet packages.
- Open the AbstractionImplementationExamples.sln solution.
- Set AbstractionImplementationExamples as the startup project.
- Press F5.
-
Open your terminal
-
Navigate to the AbstractionImplementationExamples project directory
-
Run the application using
dotnet rundotnet run
- When the application starts, select Choose sample.
- Select one of the samples from the dropdown to run it.
- After the selected sample runs, you can choose to run another sample or select Quit to stop the application.
The following are a set of reference implementations of the interfaces provided by Microsoft.Extensions.AI.Abstractions package.
| Implementation | Description |
|---|---|
| SampleChatClient | Sample implementation of IChatClient interface. |
| SampleEmbeddingGenerator | Sample implementation of IEmbeddingGenerator interface. |
| LoggingChatClient | Sample implementation of DelegatingChatClient that extends IChatClient with logging functionality. |
| LoggingEmbeddingGenerator | Sample implementation of DelegatingEmbeddingGenerator that extends IEmbeddingGenerator with logging functionality. |
| Example | Description |
|---|---|
| Chat | Use IChatClient to send and receive chat messages |
| Chat + Conversation History | Use IChatClient alongside conversation history to send and receive chat messages |
| Streaming | Use IChatClient to send and receive a stream of chat messages |
| Caching | Use prompt caching middleware |
| OpenTelemetry | Use OpenTelemetry middleware |
| Tool Calling | Use tool calling middleware |
| Middleware | Use prompt caching, OpenTelemetry and tool calling middleware |
| Dependency Injection | Register an IChatClient and middleware using Dependency Injection |
| Text Embedding | Use text embedding generator |
| Text Embedding + Caching | Use text embedding generator with caching middleware |
| Logging Chat Client | Use LoggingChatClient implementation |
| Logging Embedding Generator | Use LoggingEmbeddingGenerator implementation |