Skip to content

Implement Test Coverage for Gemini Provider #69

@Furisto

Description

@Furisto

Overview

The Gemini provider (`gemini.go`) is fully implemented with streaming, tool calling, and JSON schema conversion. However, there are no test files for this provider.

Current State

  • ✅ Provider implementation complete with streaming support
  • ✅ Tool calling fully integrated
  • ✅ JSON schema conversion for Gemini API format
  • ✅ Message transformation implemented
  • ✅ Model definitions included (gemini-2.5-pro, gemini-2.5-flash, gemini-2.5-flash-lite)
  • ❌ No test coverage

What Needs to be Done

Implement comprehensive unit tests for the Gemini provider to ensure reliability and catch regressions.

Test Coverage Requirements

  1. Basic Invocation Tests

    • Test successful model invocation with valid inputs
    • Verify correct message formatting and transformation
    • Validate response structure and content
  2. Streaming Tests

    • Test streaming callback functionality
    • Verify chunks are properly accumulated
    • Test handling of empty/incomplete streams
    • Test tool call streaming
  3. Tool Calling Tests

    • Test tool transformation to Gemini format
    • Verify tool calling integration
    • Test handling of multiple tool calls
    • Test function response handling
  4. Error Handling Tests

    • Missing or empty API key
    • Missing required fields (model, system prompt, messages)
    • Invalid message types
    • API errors and network failures
    • Invalid model profiles
  5. Message Transformation Tests

    • User messages with text content
    • Model messages with text and tool calls
    • Tool result messages
    • Mixed message types in conversation history
  6. JSON Schema Conversion Tests

    • Test conversion of JSON schema to Gemini schema format
    • Test property type conversions (string, number, boolean, array, object)
    • Test nested object handling
    • Test enum value handling
    • Test required fields

Files to Modify

  • `backend/model/gemini.go` - Create new test file

References

  • Implementation: `backend/model/gemini.go`
  • Provider interface: `backend/model/provider.go`

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions