Skip to content

fix: add native Gemini embedding driver#997

Open
chethanuk wants to merge 3 commits intoRightNow-AI:mainfrom
chethanuk:feat/gemini-embedding-2
Open

fix: add native Gemini embedding driver#997
chethanuk wants to merge 3 commits intoRightNow-AI:mainfrom
chethanuk:feat/gemini-embedding-2

Conversation

@chethanuk
Copy link
Copy Markdown

This pull request introduces support for Gemini embedding models by adding API key auto-detection for Gemini and Google, implementing a new GeminiEmbeddingDriver, and configuring default model settings. It also includes minor refactorings for MCP transport configuration and formatting cleanups in the web fetch and search modules. Feedback was provided regarding the use of unwrap_or_default() when reading response bodies, which could mask underlying network or API errors.

Summary

  • add a native Gemini embedding driver for memory embeddings
  • detect when Gemini batch embedding access is unavailable and fall back to single embedContent requests
  • auto-detect Gemini embedding credentials and default model selection
  • update MCP transport config usage for rmcp 1.3 compatibility

Validation

  • cargo fmt --all -- --check
  • cargo test --workspace embedding --quiet
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo build --release -p openfang-cli
  • live local daemon verification with Gemini embeddings enabled
  • live verification of batch-to-single fallback behavior

New Features

  • Added Google Gemini as a supported embeddings provider with automatic API key detection (GEMINI_API_KEY and GOOGLE_API_KEY).
  • Updated default embedding model for Gemini/Google to a higher-capacity embedding.
  • Bug Fixes / Reliability

    • Improved embedding request behavior with automatic fallback from batch to single requests for greater robustness.
  • Tests

    • Simplified/clarified unit test assertions for readability.
  • Refactor

    • Minor code and configuration cleanups for HTTP client setup and formatting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant