> ## Documentation Index
> Fetch the complete documentation index at: https://docs.odella.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Multi-Modal Draft Block

> Generate various document types using AI-powered drafting capabilities with text and image inputs

## Overview

The Multi-Modal Draft Block leverages AI to generate various types of documents based on user prompts, context, and images. It offers a set of example templates for common document types and an optimized custom template feature for more specific drafting needs. This block intelligently incorporates both textual and visual information to create comprehensive and context-aware documents.

<Frame>
  <img src="https://mintcdn.com/odella/I7v1Fbrp2kx7rLoj/block-reference/assets/draft_light.png?fit=max&auto=format&n=I7v1Fbrp2kx7rLoj&q=85&s=2b2d4bc41f952fb2ffda991fb102fba3" alt="Multi-Modal Draft Block Screenshot" className="block dark:hidden" width="852" height="520" data-path="block-reference/assets/draft_light.png" />

  <img src="https://mintcdn.com/odella/I7v1Fbrp2kx7rLoj/block-reference/assets/draft_dark.png?fit=max&auto=format&n=I7v1Fbrp2kx7rLoj&q=85&s=6e890183478004b296f3e3e25cfcb847" alt="Multi-Modal Draft Block Screenshot" className="hidden dark:block" width="892" height="536" data-path="block-reference/assets/draft_dark.png" />
</Frame>

## Inputs

<ParamField path="systemPrompt" type="string" optional>
  The system prompt to send to the model. This provides high-level instructions or context for the AI model.
</ParamField>

<ParamField path="prompt" type="string" optional>
  The prompt to send to the model. Only available when "Use Prompt Input" is enabled.
</ParamField>

<ParamField path="images" type="image[]" optional>
  An array of images to be analyzed and incorporated into the document. Only available when "Multi-Modal" is enabled.
</ParamField>

<ParamField path="(Template Variables)" type="string" optional>
  When using templates, additional inputs are dynamically generated based on the template's variables. These inputs are used to customize the template output.
</ParamField>

## Outputs

<ResponseField name="output" type="string">
  The generated document draft based on the inputs and template.
</ResponseField>

<ResponseField name="duration" type="number">
  The time taken to generate the draft in milliseconds.
</ResponseField>

<ResponseField name="wordCount" type="number">
  The number of words in the generated draft.
</ResponseField>

## Editor Settings

<ParamField path="AI Model" type="string" default="gpt-4">
  The AI model to use for document generation. Available models are dynamically populated based on your configuration.
</ParamField>

<ParamField path="Multi-Modal" type="boolean" default={false}>
  When enabled, allows the block to process both text and image inputs to generate the output.
</ParamField>

<ParamField path="Use Prompt Input" type="boolean" default={false}>
  When enabled, allows direct prompt input instead of using templates.
</ParamField>

<ParamField path="Drafting Prompt Template" type="string" default="Legal Brief">
  Select from predefined templates: Legal Brief, Research Report, Email, or Letter. Only available when "Use Prompt Input" is disabled.
</ParamField>

<ParamField path="Word Count" type="number" default={800} min={500} max={2000}>
  The target word count for the generated document. Only available when "Use Prompt Input" is disabled.
</ParamField>

## Example Templates

The Draft Block includes the following pre-configured templates:

* Legal Brief
* Research Report
* Email
* Letter

Each template is optimized for its specific use case and includes relevant variables for customization.

## Example: Using a Template

1. Add a Draft Block to your flow
2. Select your desired template from "Drafting Prompt Template"
3. Configure the word count and other settings
4. Connect required inputs based on the template variables
5. Run the flow to generate your document

<Frame>
  <img src="https://mintcdn.com/odella/63rQpScaEp0bDpCd/images/draft-block-example.png?fit=max&auto=format&n=63rQpScaEp0bDpCd&q=85&s=f0f663f0284d1e9954480af6602fdba8" alt="Draft Block Example" width="2482" height="1522" data-path="images/draft-block-example.png" />
</Frame>

## Error Handling

The Draft Block includes robust error handling with automatic retries for:

* API rate limit exceeded (429 errors)
* API timeouts (408 errors)
* Network failures
* Other recoverable errors

The block will display appropriate error messages and retry automatically when possible.

<Warning>
  The block has a maximum retry time of 5 minutes and will throw an error if unable to complete within this timeframe.
</Warning>

## FAQ

<AccordionGroup>
  <Accordion title="How does Multi-Modal drafting work?">
    When Multi-Modal is enabled, the block can process both text and image inputs simultaneously. The AI model analyzes the images and incorporates relevant visual information into the generated document.
  </Accordion>

  <Accordion title="What's the difference between using a template and direct prompt input?">
    Templates provide structured, pre-configured prompts optimized for specific document types. Direct prompt input gives you more flexibility but requires you to craft your own prompting strategy.
  </Accordion>

  <Accordion title="How are retries handled?">
    The block automatically retries failed attempts with exponential backoff, with delays between 500ms and 5000ms. It handles rate limits and timeouts gracefully while keeping you informed of retry status.
  </Accordion>
</AccordionGroup>

## See Also

* [Ask AI Block](/block-reference/ai/ai)
* [Text Block](/block-reference/data/text)
* [Image Block](/block-reference/data/image)
* [Object Block](/block-reference/data/object)
