Skip to main content

Table of Contents

Module spoon_ai.llm.providers.gemini_provider

Gemini Provider implementation for the unified LLM interface.

GeminiProvider Objects​

@register_provider("gemini", [
ProviderCapability.CHAT,
ProviderCapability.COMPLETION,
ProviderCapability.STREAMING,
ProviderCapability.TOOLS,
ProviderCapability.IMAGE_GENERATION,
ProviderCapability.VISION
])
class GeminiProvider(LLMProviderInterface)

Gemini provider implementation.

initialize​

async def initialize(config: Dict[str, Any]) -> None

Initialize the Gemini provider with configuration.

chat​

async def chat(messages: List[Message], **kwargs) -> LLMResponse

Send chat request to Gemini.

chat_stream​

async def chat_stream(messages: List[Message],
callbacks: Optional[List] = None,
**kwargs) -> AsyncIterator[LLMResponseChunk]

Send streaming chat request to Gemini with callback support.

Yields:

  • LLMResponseChunk - Structured streaming response chunks

completion​

async def completion(prompt: str, **kwargs) -> LLMResponse

Send completion request to Gemini.

chat_with_tools​

async def chat_with_tools(messages: List[Message], tools: List[Dict],
**kwargs) -> LLMResponse

Send chat request with tools to Gemini using native function calling.

get_metadata​

def get_metadata() -> ProviderMetadata

Get Gemini provider metadata.

health_check​

async def health_check() -> bool

Check if Gemini provider is healthy.

cleanup​

async def cleanup() -> None

Cleanup Gemini provider resources.