Microsoft.Extensions.AI Integration
Cross-SDK comparison
See the centralized MEAI documentation for feature matrices and comparisons across all tryAGI SDKs.
The Cohere SDK implements IChatClient and IEmbeddingGenerator<string, Embedding<float>> and provides AIFunction tool wrappers, all compatible with Microsoft.Extensions.AI.
Namespace Conflict
This SDK has a generated IChatClient interface that conflicts with Microsoft.Extensions.AI.IChatClient. Use the Meai alias pattern shown below.
Streaming
Cohere's chat API does not support true server-sent events streaming. The GetStreamingResponseAsync method simulates streaming by returning the full response as a single update.
Supported Interfaces
| Interface | Support Level |
|---|---|
IChatClient |
Partial (text, tool calling; no true streaming) |
IEmbeddingGenerator<string, Embedding<float>> |
Full |
IChatClient
Installation
1 | |
Basic Usage
Because the SDK generates its own IChatClient interface, you must use a namespace alias:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | |
Tool Calling
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | |
Accessing Client Metadata
When using the Meai alias, call extension methods explicitly:
1 2 | |
IEmbeddingGenerator
Basic Usage
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | |