feat(ai): Implement Gemini provider with streaming and tool support

- Added GeminiLLM provider implementation with GoogleGenerativeAI SDK
- Supports streaming with text/thinking content and completion signals
- Handles Gemini's parts-based content system (text, thought, functionCall)
- Implements tool/function calling with proper format conversion
- Maps between unified types and Gemini-specific formats (model vs assistant role)
- Added test example matching other provider patterns
- Fixed typo in AssistantMessage type (stopResaon -> stopReason) across all providers
This commit is contained in:
Mario Zechner 2025-08-24 20:41:10 +02:00
parent cb4c32faaa
commit a8ba19f0b4
8 changed files with 360 additions and 14 deletions

View file

@ -186,7 +186,7 @@ export class AnthropicLLM implements LLM<AnthropicLLMOptions> {
toolCalls,
model: this.model,
usage,
stopResaon: this.mapStopReason(msg.stop_reason),
stopReason: this.mapStopReason(msg.stop_reason),
};
} catch (error) {
return {
@ -198,7 +198,7 @@ export class AnthropicLLM implements LLM<AnthropicLLMOptions> {
cacheRead: 0,
cacheWrite: 0,
},
stopResaon: "error",
stopReason: "error",
error: error instanceof Error ? error.message : String(error),
};
}