motleycrew.tools.image.dall_e

Functions

create_dalle_image_generator_langchain_tool([...])

run_dalle_and_save_images(description[, ...])

Classes

DallEImageGeneratorTool([images_directory, ...])

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

DallEToolInput(*, description)

Input for the Dall-E tool.

class motleycrew.tools.image.dall_e.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, exceptions_to_reflect: List[Exception] | None = None)

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, exceptions_to_reflect: List[Exception] | None = None)
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.dall_e.DallEToolInput(*, description: str)

Bases: BaseModel

Input for the Dall-E tool.

description: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

motleycrew.tools.image.dall_e.run_dalle_and_save_images(description: str, 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, file_name_length: int = 8) list[str] | None
motleycrew.tools.image.dall_e.create_dalle_image_generator_langchain_tool(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)