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

@@ -163,7 +163,7 @@ export class OpenAICompletionsLLM implements LLM<OpenAICompletionsLLMOptions> {
toolCalls: toolCalls.length > 0 ? toolCalls : undefined,
model: this.model,
usage,
stopResaon: this.mapStopReason(finishReason),
stopReason: this.mapStopReason(finishReason),
};
} catch (error) {
return {
@@ -175,7 +175,7 @@ export class OpenAICompletionsLLM implements LLM<OpenAICompletionsLLMOptions> {
cacheRead: 0,
cacheWrite: 0,
},
stopResaon: "error",
stopReason: "error",
error: error instanceof Error ? error.message : String(error),
};
}