Demo Gemma
Code
1from pathlib import Path23from kern.agent import Agent4from kern.media import Image5from kern.models.ollama import Ollama67agent = Agent(model=Ollama(id="gemma3:12b"), markdown=True)89image_path = Path(__file__).parent.joinpath("super-agents.png")10agent.print_response(11 "Write a 3 sentence fiction story about the image",12 images=[Image(filepath=image_path)],13 stream=True,14)Usage
Set up your virtual environment
1uv venv --python 3.122source .venv/bin/activate1uv venv --python 3.122.venv\Scripts\activateInstall Ollama
Follow the Ollama installation guide and run:
1ollama pull gemma3:12bInstall dependencies
1uv pip install -U ollama kern-aiRun Agent
1python cookbook/11_models/ollama/demo_gemma.py