motleycrew.tools.image.replicate_tool

Functions

create_replicate_image_generator_langchain_tool(...)

run_model_in_replicate(model_name, prompt, ...)

run_model_in_replicate_and_save_images(...)

Classes

ImageToolInput(*, description)

Input for the Dall-E tool.

ReplicateImageGeneratorTool(model_name[, ...])

motleycrew.tools.image.replicate_tool.run_model_in_replicate(model_name: str, prompt: str, **kwargs) str | List[str]
motleycrew.tools.image.replicate_tool.run_model_in_replicate_and_save_images(model_name: str, prompt: str, directory_name: str | None = None, **kwargs) List[str]
class motleycrew.tools.image.replicate_tool.ImageToolInput(*, description: str)

Bases: BaseModel

Input 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.

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

Bases: MotleyTool

__init__(model_name: str, images_directory: str | None = None, return_direct: bool = False, exceptions_to_reflect: List[Exception] | None = None, **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

motleycrew.tools.image.replicate_tool.create_replicate_image_generator_langchain_tool(model_name: str, images_directory: str | None = None, **kwargs)