Create Image
The Create Image tool is part of AgentiPy. Based on its name and implementation, it is used for generating images using OpenAI's DALL·E models. The tool requires an OpenAI API key to be configured within the SolanaAgentKit.
Functionality
This tool is implemented in the ImageGenerator class.
Key Methods:
create_image(agent: SolanaAgentKit, prompt: str, size: str = "1024x1024", n: int = 1):Takes a
SolanaAgentKitinstance (which should haveopenai_api_keyset), a textpromptfor the image generation, the desiredsize(defaulting to "1024x1024"), and the number of imagesnto generate (defaulting to 1).Checks if the
openai_api_keyis present in the agent's configuration.Uses the
openai.Image.createmethod (from theopenailibrary) to request image generation based on the provided parameters.Returns a dictionary containing a list of URLs for the generated images.
Note: This tool interacts with the OpenAI API and requires a valid API key. Ensure that the openai library is installed and that your API key has the necessary permissions and quota for image generation.
Source Code
You can find the source code for this tool on GitHub: https://github.com/niceberginc/agentipy/blob/main/agentipy/tools/create_image.py
Last updated
