Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

feat: add Google Gemini provider support to memU #371

Open
loki52501 wants to merge 1 commit intoNevaMind-AI:mainfrom
loki52501:main
Open

feat: add Google Gemini provider support to memU #371
loki52501 wants to merge 1 commit intoNevaMind-AI:mainfrom
loki52501:main

Conversation

@loki52501
Copy link

📝 Pull Request Summary

Add Google Gemini as a supported LLM and embedding provider via its OpenAI-compatible API endpoint.

✅ What does this PR do?

  • Adds GeminiLLMBackend in llm/backends/gemini.py that inherits from OpenAILLMBackend, using Gemini's
    /v1beta/openai/ OpenAI-compatible endpoint
  • Registers gemini in LLM_BACKENDS and the embedding backends map in llm/http_client.py
  • Adds provider="gemini" auto-defaults in LLMConfig.set_provider_defaults() — sets correct base_url,
    chat_model (gemini-2.5-flash), and embed_model (gemini-embedding-001) automatically
  • Adds a full test suite in tests/llm/test_gemini_provider.py covering settings defaults, backend
    registration, payload building, HTTP client initialization, and live API calls
  • Updates README.md with a Google Gemini Integration section

🤔 Why is this change needed?

  • Gemini is a widely used LLM provider with a free tier, making it a practical default for self-hosted
    memU deployments
  • Users running memU locally without an OpenAI subscription have no built-in alternative — this gives
    them a zero-cost path to get started
  • Gemini's /v1beta/openai/ endpoint is fully OpenAI-compatible, so no new HTTP client or request format
    was needed — the change is minimal and low-risk

🔍 Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Refactor / cleanup
  • Other

✅ PR Quality Checklist

  • PR title follows the conventional format (feat: add Google Gemini provider support)
  • Changes are limited in scope and easy to review (4 files modified, 2 files added)
  • Documentation updated — Gemini section added to README.md matching OpenRouter format
  • No breaking changes — existing providers (openai, grok, openrouter, doubao) are unaffected
  • Related issues or discussions linked — N/A (standalone addition)

📌 Optional

  • Live API tests confirmed passing — test_chat, test_summarize, test_embed all return 200 OK with
    gemini-2.5-flash and gemini-embedding-001
  • Edge cases considered — explicit config values are not overridden by defaults; free-tier quota limits
    noted in docs (gemini-2.0-flash has lower RPD than gemini-2.5-flash)
  • Follow-up tasks: consider adding gemini-embedding-exp-03-07 to the supported models table once it
    leaves experimental status

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