marvin.ai.images
generate_image
async
¶
Generates an image based on a provided prompt template.
This function uses the DALL-E API to generate an image based on a provided prompt template. The function supports additional arguments for the prompt and the model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
prompt_template
|
str
|
The template for the prompt. |
required |
prompt_kwargs
|
dict
|
Additional keyword arguments for the prompt. Defaults to None. |
None
|
model_kwargs
|
dict
|
Additional keyword arguments for the language model. Defaults to None. |
None
|
Returns:
Name | Type | Description |
---|---|---|
ImagesResponse |
ImagesResponse
|
The response from the DALL-E API, which includes the generated image. |
image
¶
A decorator that transforms a function's output into an image.
This decorator takes a function that returns a string, and uses that string as instructions to generate an image. The generated image is then returned.
The decorator can be used with or without parentheses. If used without
parentheses, the decorated function's output is used as the instructions
for the image. If used with parentheses, an optional literal
argument can
be provided. If literal
is set to True
, the function's output is used
as the literal instructions for the image, without any modifications.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fn
|
callable
|
The function to decorate. If |
None
|
literal
|
bool
|
Whether to use the function's output as the
literal instructions for the image. Defaults to |
False
|
Returns:
Name | Type | Description |
---|---|---|
callable |
The decorated function. |
paint
¶
Generates an image based on the provided instructions and context.
This function uses the DALLE-3 API to generate an image based on the provided
instructions and context. By default, the API modifies prompts to add detail
and style. This behavior can be disabled by setting literal=True
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
instructions
|
str
|
The instructions for the image generation. Defaults to None. |
None
|
context
|
dict
|
The context for the image generation. Defaults to None. |
None
|
literal
|
bool
|
Whether to disable the API's default behavior of modifying prompts. Defaults to False. |
False
|
model_kwargs
|
dict
|
Additional keyword arguments for the language model. Defaults to None. |
None
|
Returns:
Name | Type | Description |
---|---|---|
ImagesResponse |
The response from the DALLE-3 API, which includes the generated image. |
paint_async
async
¶
Generates an image based on the provided instructions and context.
This function uses the DALLE-3 API to generate an image based on the provided
instructions and context. By default, the API modifies prompts to add detail
and style. This behavior can be disabled by setting literal=True
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
instructions
|
str
|
The instructions for the image generation. Defaults to None. |
None
|
context
|
dict
|
The context for the image generation. Defaults to None. |
None
|
literal
|
bool
|
Whether to disable the API's default behavior of modifying prompts. Defaults to False. |
False
|
model_kwargs
|
dict
|
Additional keyword arguments for the language model. Defaults to None. |
None
|
Returns:
Name | Type | Description |
---|---|---|
ImagesResponse |
The response from the DALLE-3 API, which includes the generated image. |