# Gen AI Blocks: Generate and Extract Content in Workflows

Generate text or JSON from a prompt or your Knowledge Base, and extract details and intents from messages, inside a workflow.

> Source: https://www.robylon.ai/docs/product/gen-ai
> Section: Automation

Gen AI blocks use AI to produce content inside a workflow: write a reply or a summary from a prompt or from your Knowledge Base, or pull structured details out of free text. To hand the conversation itself to an AI agent, use the [AI Agent blocks](https://www.robylon.ai/docs/product/ai-agent-blocks) instead.

Find them under **Gen AI** in the workflow builder's toolbar.

| Block | Use it to |
| --- | --- |
| Generate | Write text or JSON with AI, from a prompt or from your Knowledge Base. |
| Extract | Pull entities and intents out of a message or variable. |

**Summarise** and **Label** also appear in the toolbar but are not available yet. The **AI Agent** block also sits under **Gen AI** in the toolbar; it is covered with the other [AI Agent blocks](https://www.robylon.ai/docs/product/ai-agent-blocks).

## How the Generate block works

**Generate** writes text with AI and saves it in a variable. Under **Generate From**, choose the source:

* **AI Model:** the model follows your prompt. Use it to summarise a ticket, draft a reply, check whether a question was answered, or turn text into JSON.
* **Knowledge Base:** the block searches your [Knowledge Base](https://www.robylon.ai/docs/knowledgebase) with a question you set and writes an answer following your response instructions.

You also choose:

* **Output:** plain text, or JSON when later blocks need structured fields.
* **Inputs:** what the AI can see: the latest reply, the conversation history (and how many messages of it), internal replies and attachments.
* **Model:** which model to use. See [model comparison](https://www.robylon.ai/docs/model-comparison).
* **Prompt Additional Context URLs:** with **Generate From** set to **AI Model**, click **Add Image URLs** to give the AI images to look at with the prompt. Enter a link or a `{variable}` in each row; a variable holding several links separated by commas adds each one. Images must be PNG, JPEG or WebP, up to 5 MB each and 10 MB in total. A link that does not load, or a file over the limit, is skipped and the block still runs.

Generate has a success exit and an error exit, so you can handle the case where the AI call fails.

For example, a ticket workflow can use Generate with an AI Model prompt to summarise the images a customer attached, then pass the summary to an AI agent.

## How the Extract block works

**Extract** reads a message or a variable and pulls out the [entities](https://www.robylon.ai/docs/data-and-integrations/entities) and [intents](https://www.robylon.ai/docs/inbox/intents) you choose, saving each into its variable. Use it when the details you need are buried in free text, for example a date, an order number and a reason in one email.

Extract is more flexible than the **Capture** block in [Listen](https://www.robylon.ai/docs/product/listen): Capture works on the customer's next reply, while Extract works on any text already in the workflow and can pull out several values at once.
