motleycrew.tools.image.dall_e
Functions
|
Classes
|
A tool for generating images using the OpenAI DALL-E API. |
|
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:
MotleyToolA 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:
BaseModelInput for the Dall-E tool.
- description: str
- model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[Dict[str, FieldInfo]] = {'description': FieldInfo(annotation=str, required=True, description='image description')}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.
This replaces Model.__fields__ from Pydantic V1.
- 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)