motleycrew.tools.image

Modules

dall_e

download_image

replicate_tool

class motleycrew.tools.image.DallEImageGeneratorTool(images_directory: str | None = None, refine_prompt_with_llm: bool = True, dall_e_prompt_template: str | PromptTemplate = '{text}\nNote: Do not include any text in the images.\n', refine_prompt_template: str | PromptTemplate = 'Generate a detailed DALL-E prompt to generate an image\nbased on the following description:\n```{text}```\nYour output MUST NOT exceed 3500 characters', model: str = 'dall-e-3', quality: str = 'standard', size: str = '1024x1024', style: str | None = None, return_direct: bool = False, handle_exceptions: bool | List[Type[Exception]] = False)

Bases: MotleyTool

A tool for generating images using the OpenAI DALL-E API.

See the OpenAI API reference for more information: https://platform.openai.com/docs/guides/images/usage

__init__(images_directory: str | None = None, refine_prompt_with_llm: bool = True, dall_e_prompt_template: str | PromptTemplate = '{text}\nNote: Do not include any text in the images.\n', refine_prompt_template: str | PromptTemplate = 'Generate a detailed DALL-E prompt to generate an image\nbased on the following description:\n```{text}```\nYour output MUST NOT exceed 3500 characters', model: str = 'dall-e-3', quality: str = 'standard', size: str = '1024x1024', style: str | None = None, return_direct: bool = False, handle_exceptions: bool | List[Type[Exception]] = False)
Parameters:
  • images_directory – Directory to save the generated images.

  • refine_prompt_with_llm – Whether to refine the prompt using a language model.

  • model – DALL-E model to use.

  • quality – Image quality. Can be “standard” or “hd”.

  • size – Image size.

  • style – Style to use for the model.

class motleycrew.tools.image.ReplicateImageGeneratorTool(model_name: str, images_directory: str | None = None, return_direct: bool = False, handle_exceptions: bool | List[Type[Exception]] = False, **kwargs)

Bases: MotleyTool

__init__(model_name: str, images_directory: str | None = None, return_direct: bool = False, handle_exceptions: bool | List[Type[Exception]] = False, **kwargs)

A tool for generating images from text descriptions using the Replicate API. :param model_name: one of “sdxl”, “flux-pro”, “flux-dev”, “flux-schnell”, or a full model name supported by replicate :param images_directory: the directory to save the images to :param kwargs: model-specific parameters, from pages such as https://replicate.com/black-forest-labs/flux-dev/api/schema