Buckets:

download
raw
1.74 kB
"""Run `uv pip install openai` to install dependencies."""
from pathlib import Path
from agno.agent import Agent
from agno.tools.dalle import DalleTools
from agno.utils.media import download_image
# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------
# Example 1: Basic DALL-E agent with all functions enabled
agent = Agent(tools=[DalleTools(all=True)], name="DALL-E Image Generator")
# Example 2: Enable specific DALL-E functions
agent_specific = Agent(
tools=[
DalleTools(
enable_create_image=True,
model="dall-e-3",
size="1024x1024",
quality="standard",
)
],
name="Basic DALL-E Generator",
)
# Example 3: High-quality custom DALL-E generator
custom_dalle = DalleTools(all=True, model="dall-e-3", size="1792x1024", quality="hd")
agent_custom = Agent(
tools=[custom_dalle],
name="Custom DALL-E Generator",
)
# Test basic generation
# ---------------------------------------------------------------------------
# Run Agent
# ---------------------------------------------------------------------------
if __name__ == "__main__":
agent.print_response(
"Generate an image of a futuristic city with flying cars and tall skyscrapers",
markdown=True,
)
response = agent_custom.run(
"Create a panoramic nature scene showing a peaceful mountain lake at sunset",
markdown=True,
)
if response.images and response.images[0].url:
download_image(
url=response.images[0].url,
output_path=str(Path(__file__).parent.joinpath("tmp/nature.jpg")),
)

Xet Storage Details

Size:
1.74 kB
·
Xet hash:
9c285378bb7ccadbd2af5a6abb96705c2e888621a5de5d4e5090b9a765c0505f

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.