AI Providers
Description
Important concepts
Configuration in DI
// using Sumeru.Flex; // IFlexAIProvider
public static class OtherApplicationServicesConfig
{
public static IServiceCollection AddOtherApplicationServices(
this IServiceCollection services,
IConfiguration configuration)
{
// Pick ONE (or register multiple with different compositions).
services.AddFlexOpenAI(configuration);
// services.AddFlexAzureOpenAI(configuration);
// services.AddFlexGemini(configuration);
// services.AddFlexOllama(configuration);
// services.AddFlexAnthropic(configuration);
return services;
}
}appsettings.json
Examples (template-based)
Chat completion (Query)
Chat completion (PostBus handler)
Implementation notes (hot-topic additions)
Popular Ollama Models
Type
Models
Usage
Basic Chat
Advanced Chat with Options
Multi-turn Conversation
Streaming Responses
Generate Embeddings
JSON Mode
Key Points to Consider
Provider Comparison
Feature
Azure OpenAI
OpenAI
Anthropic
Gemini
Ollama
Best Practices
Cost Optimization
Multiple Providers
Error Handling
Examples
Complete RAG Implementation
Content Moderation
Summarization
Testing
See Also
Last updated