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

@ -144,7 +144,7 @@ export class OpenAIResponsesLLM implements LLM<OpenAIResponsesLLMOptions> {
role: "assistant",
model: this.model,
usage,
stopResaon: "error",
stopReason: "error",
error: `Code ${event.code}: ${event.message}` || "Unknown error",
};
}
@ -158,7 +158,7 @@ export class OpenAIResponsesLLM implements LLM<OpenAIResponsesLLMOptions> {
toolCalls: toolCalls.length > 0 ? toolCalls : undefined,
model: this.model,
usage,
stopResaon: stopReason,
stopReason,
};
} catch (error) {
return {
@ -170,7 +170,7 @@ export class OpenAIResponsesLLM implements LLM<OpenAIResponsesLLMOptions> {
cacheRead: 0,
cacheWrite: 0,
},
stopResaon: "error",
stopReason: "error",
error: error instanceof Error ? error.message : String(error),
};
}