How rudradudhat2509/gemma4-starter works
Gemma 4 Starter is both a set of runnable learning examples and a copyable Gradio app foundation. The principal app workflow takes a user question—with an optional image—through the app’s handler to Gemma, or through an agent that can dispatch model-requested tools and return their results. The shared client handles model requests, chat and image inputs, caching, and call limits. The README also documents standalone examples for system instructions and function calling. Edges are limited to relationships visible in the excerpts or README; unsampled implementation details are not inferred.
Main entry points: gemma_client.py Gemma client · app.py Gradio app · agent.py Agent loop · tools.py Built-in tools
Components 18
Starter app
- Gradio app
app_template/app.py
Gemma access
- Gemma client
gemma_client.py - Text generation
gemma_client.py - Image questions
gemma_client.py - Chat memory
gemma_client.py - Response cache
gemma_client.py - Usage counter
gemma_client.py
Tool agent
- Agent loop
harness/agent.py - Tool registry
harness/tools.py - Built-in tools
harness/tools.py - Notes file
harness/tools.py
Learning examples
- First request
01_hello.py - System instructions
02_system_instruction.py - Chat example
03_chat.py - Image example
04_image.py - Function calling
05_function_calling.py
Other components
- App user
- Gemini API
Connections 18
- App user → Gradio app: asks
app_template/app.py - Gradio app → Image questions: asks about image
app_template/app.py - Gradio app → Text generation: asks text
app_template/app.py - Gradio app → Agent loop: runs agent
app_template/app.py - Image questions → Gemma client: delegates to
app_template/app.py - Text generation → Gemma client: delegates to
app_template/app.py - Agent loop → Gemma client: generates with
harness/agent.py - Agent loop → Tool registry: gets declarations
harness/agent.py - Agent loop → Built-in tools: runs requested
harness/agent.py - Built-in tools → Notes file: appends note
harness/tools.py - Gemma client → Gemini API: calls API
gemma_client.py - Gemma client → Response cache: reads and writes
gemma_client.py - Gemma client → Usage counter: records calls
gemma_client.py - First request → Gemma client: asks text
01_hello.py - System instructions → Gemma client: asks with rules
02_system_instruction.py - Chat example → Gemma client: starts chat
03_chat.py - Image example → Gemma client: asks with image
04_image.py - Function calling → Gemma client: requests generation
05_function_calling.py