Prompt Image Generation Tool
This tool allows LLMs to generate images from a text prompt.
from griptape.drivers import AmazonBedrockImageGenerationDriver, BedrockStableDiffusionImageGenerationModelDriver
from griptape.engines import PromptImageGenerationEngine
from griptape.structures import Agent
from griptape.tools import PromptImageGenerationTool
# Create a driver configured to use Stable Diffusion via Bedrock.
driver = AmazonBedrockImageGenerationDriver(
image_generation_model_driver=BedrockStableDiffusionImageGenerationModelDriver(),
model="stability.stable-diffusion-xl-v0",
)
# Create an engine configured to use the driver.
engine = PromptImageGenerationEngine(
image_generation_driver=driver,
)
# Create a tool configured to use the engine.
tool = PromptImageGenerationTool(
engine=engine,
)
# Create an agent and provide the tool to it.
Agent(tools=[tool]).run("Generate an image of a mountain on a summer day.")