Add Google Gemini as an LLM provider#6
Open
Ahmed-Ezzat20 wants to merge 1 commit into
Open
Conversation
c30773e to
08280f1
Compare
Adds a _GeminiClient that implements the same client.chat.completions.create() interface used by the OpenAI and Ollama backends, routing to the google-genai SDK internally. Supports text, multimodal (images), and streaming. Auto-retries without penalty params when the model rejects them. Usage: pass --gemini-api-key or set GEMINI_API_KEY, then use any Gemini model name (e.g. --llm-model gemini-2.5-flash) for translation/analysis stages.
08280f1 to
d79fbe2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
_GeminiClientthat mimics theclient.chat.completions.create()interface, so all existing pipeline stages (describe, review, translate, resegment, thumbnails) work without changesgenerate_content_streamContent/Parttypes (includingsystem→system_instruction)pip install "mazinger[llm-gemini]"Changes
llm.py_GeminiChatCompletions,_GeminiChat,_GeminiClientclasses;gemini_api_keyparam onbuild_client()cli/_groups.pyadd_gemini()helper, wired intoadd_llm()andmake_llm_client()cli/_dub.pygemini_api_keytoMazingerDubbercli/_transcribe.pygemini_api_keytobuild_client()for ASR reviewpipeline.pygemini_api_keyon__init__and_llm_client()pyproject.tomlllm-geminioptional extra (google-genai>=1.0)Usage
Test plan
gemini-2.5-flash— correct response and usage metricsMazingerDubberaccepts and passesgemini_api_keythrough tobuild_client()dubpipeline end-to-end with Gemini as LLM provider