Gemini
Description
The Gemini provider integrates Google Gemini chat + embeddings behind IFlexAIProvider.
Provider capabilities (based on the implementation):
Chat completions:
ChatAsync(...)Streaming chat:
ChatStreamAsync(...)Embeddings:
EmbedAsync(...)
Important concepts
Application code should depend on
IFlexAIProvider.Flex generates Queries/Handlers that consume
IFlexAIProvider; you only register the provider.Defaults (when not overridden by request/config):
Chat model:
gemini-2.0-flashEmbedding model:
text-embedding-004
Implementation note: the provider extracts the system instruction from system messages and passes it via Gemini’s system-instruction mechanism.
Configuration in DI
appsettings.json
Configuration section: FlexBase:AI:Gemini
Examples (template-based)
These examples mirror the generated Query and PostBus handler templates. You do not register these types manually.
Query: generate a completion
PostBus handler: generate a completion
Provider considerations
System messages: system instructions are extracted and handled specially; keep system content concise and stable.
Embeddings: embeddings are generated per input; batch large datasets thoughtfully to control throughput.
Secrets: keep
ApiKeyin a secure store.
Last updated