Example: Using the GeminiTools Toolkit for Image Generation
Make sure you have set the GOOGLE_API_KEY environment variable.
Make sure you have set the GOOGLE_API_KEY environment variable. Example prompts to try: - “Create a surreal painting of a floating city in the clouds at sunset” - “Generate a photorealistic image of a cozy coffee shop interior” - “Design a cute cartoon mascot for a tech startup, vector style” - “Create an artistic portrait of a cyberpunk samurai in a rainy city”
Copy
Ask AI
"""Example: Using the GeminiTools Toolkit for Image GenerationMake sure you have set the GOOGLE_API_KEY environment variable.Example prompts to try:- "Create a surreal painting of a floating city in the clouds at sunset"- "Generate a photorealistic image of a cozy coffee shop interior"- "Design a cute cartoon mascot for a tech startup, vector style"- "Create an artistic portrait of a cyberpunk samurai in a rainy city"Run `uv pip install google-genai agno` to install the necessary dependencies."""from agno.agent import Agentfrom agno.models.openai import OpenAIChatfrom agno.tools.models.gemini import GeminiToolsfrom agno.utils.media import save_base64_data# ---------------------------------------------------------------------------# Create Agent# ---------------------------------------------------------------------------agent = Agent( model=OpenAIChat(id="gpt-4o"), tools=[GeminiTools()],)agent.print_response( "Create an artistic portrait of a cyberpunk samurai in a rainy city",)response = agent.run_responseif response and response.images: save_base64_data(str(response.images[0].content), "tmp/cyberpunk_samurai.png")# ---------------------------------------------------------------------------# Run Agent# ---------------------------------------------------------------------------if __name__ == "__main__": pass