Code
cookbook/tools/dalle_tools.py
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
You are viewing v1 docs. For the latest documentation, visit docs.agno.com
from pathlib import Path
from agno.agent import Agent
from agno.tools.dalle import DalleTools
from agno.utils.media import download_image
agent = Agent(tools=[DalleTools()], name="DALL-E Image Generator")
agent.print_response(
"Generate an image of a futuristic city with flying cars and tall skyscrapers",
markdown=True,
)
custom_dalle = DalleTools(
model="dall-e-3", size="1792x1024", quality="hd", style="natural"
)
agent_custom = Agent(
tools=[custom_dalle],
name="Custom DALL-E Generator",
show_tool_calls=True,
)
response = agent_custom.run(
"Create a panoramic nature scene showing a peaceful mountain lake at sunset",
markdown=True,
)
if response.images:
download_image(
url=response.images[0].url,
save_path=Path(__file__).parent.joinpath("tmp/nature.jpg"),
)
Create a virtual environment
Terminal and create a python virtual environment.python3 -m venv .venv
source .venv/bin/activate
Was this page helpful?