# Gen AI

This is integrated off the shelf with Zerve Canvas and can be used for analytics workflows out of the box. Read more about Bedrock here - <https://aws.amazon.com/bedrock/>

## List of Models supported

The GenAI block supports the following models

<table><thead><tr><th width="240">Model Name</th><th width="396">Version</th><th>Output Type</th></tr></thead><tbody><tr><td>Titan Text Large</td><td>amazon.titan-tg1-large</td><td>Text</td></tr><tr><td>Titan Image Generator G1</td><td>amazon.titan-image ganerator-v1</td><td>Image</td></tr><tr><td>Titan Text G1 - Lite</td><td>amazon.titan-text-lite-vt</td><td>Text</td></tr><tr><td>Titan Text G1 - Express</td><td>amazon.titan-text-express-vi</td><td>Text</td></tr><tr><td>SDXL 0.8</td><td>stability.stable-diffusion-xl</td><td>Image</td></tr><tr><td>SDXL 0.8</td><td>stability.stable-diffusion-xl-v0</td><td>Image</td></tr><tr><td>SDXL 1.0</td><td>stability.stable-diffusion-xl-v1</td><td>Image</td></tr><tr><td>J2 Grande Instruct</td><td>ai21.j2-grande-instruct</td><td>Text</td></tr><tr><td>J2 Jumbo Instruct</td><td>ai21.j2-jumbo-instruct</td><td>Text</td></tr><tr><td>Jurassic-2 Mid</td><td>ai21.j2-mid</td><td>Text</td></tr><tr><td>Jurassic-2 Mid</td><td>ai21.j2-mid-v1</td><td>Text</td></tr><tr><td>Jurassic-2 Ultra</td><td>ai21.j2-ultra</td><td>Text</td></tr><tr><td>Jurassic-2 Ultra</td><td>ai21.j2-ultra-v1</td><td>Text</td></tr><tr><td>Claude Instant</td><td>anthropic.claude-instant-v1</td><td>Text</td></tr><tr><td>Claude</td><td>anthropic.claude-v2:1</td><td>Text</td></tr><tr><td>Claude</td><td>anthropic.claude-v2</td><td>Text</td></tr><tr><td>Claude 3 Sonnet</td><td>anthropic.claude-3- sonnet-20240229-v1:0</td><td>Text</td></tr><tr><td>Claude 3 Haiku</td><td>anthropic.claude-3- sonnet-hlku-20240507-v1:0</td><td>Text</td></tr><tr><td>Command</td><td>cohere.command-text-v14</td><td>Text</td></tr><tr><td>Command Light</td><td>cohere.command-light-text-v14</td><td>Text</td></tr><tr><td>Lama 2 Chat 13B</td><td>meta.lama2-13B-chat-v1</td><td>Text</td></tr><tr><td>Lama 2 Chat 70B</td><td>meta.lama2-70B-chat-v1</td><td>Text</td></tr><tr><td>Llama 3 8B Instruct</td><td>meta.lama3-8B-instruct-v1:0</td><td>Text</td></tr><tr><td>Llama 3 70B Instruct</td><td>meta.lama3-70B-instruct-v1:0</td><td>Text</td></tr><tr><td>Mistral 7B Instruct</td><td>mistral.mistral-7B-instruct-v0:2</td><td>Text</td></tr><tr><td>Mixtral 8x7B Instruct</td><td>mistral.mixtral-8x7b-instruct-v0:1</td><td>Text</td></tr><tr><td>Mistral Large</td><td>mistral.mistral-large-2402-v1:0</td><td>Text</td></tr><tr><td>All OpenAI Models</td><td>as per api</td><td>Text</td></tr></tbody></table>

GenAI can be used in two distinct ways.

## Usage

&#x20;The first involves passing prompts within the prompt block to generate output

<figure><img src="https://1018070783-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIQKNeqjEeOp9UwUcB9R9%2Fuploads%2FWJyIOEj0YXTNzEXplC6B%2FScreenshot%202025-04-04%20at%2012.13.28%E2%80%AFPM.png?alt=media&#x26;token=81696c9f-7f80-4995-858f-a533eeb59aaa" alt=""><figcaption><p>Prompt</p></figcaption></figure>

<figure><img src="https://1018070783-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIQKNeqjEeOp9UwUcB9R9%2Fuploads%2FIbuEG2954BhunEO2xsVz%2FScreenshot%202025-04-04%20at%2012.14.39%E2%80%AFPM.png?alt=media&#x26;token=1ef2463b-c5b3-4507-8a7e-00b8a4c9b18d" alt=""><figcaption><p>Output</p></figcaption></figure>

<figure><img src="https://1018070783-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIQKNeqjEeOp9UwUcB9R9%2Fuploads%2FFIB47RKkroIB0FvzTdVZ%2FScreenshot%202025-04-04%20at%2012.39.40%E2%80%AFPM.png?alt=media&#x26;token=9bafc471-7cc9-4516-9ad5-63650bc54151" alt=""><figcaption><p>Prompt to Image</p></figcaption></figure>

## Using Variable

Additionally, the prompt blocks can be linked with a Python layer, allowing input to be passed as a variable from Python blocks to the prompt blocks. This makes it easier to use Gen AI as part of existing analytics workflows without complex agent integrations.

<figure><img src="https://1018070783-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIQKNeqjEeOp9UwUcB9R9%2Fuploads%2FzEVJYKxGS144lE1C6yn2%2FScreenshot%202025-04-04%20at%2012.47.22%E2%80%AFPM.png?alt=media&#x26;token=fa610001-d5db-42d8-98fb-f343e6025608" alt=""><figcaption><p>Variable to text</p></figcaption></figure>

<figure><img src="https://1018070783-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIQKNeqjEeOp9UwUcB9R9%2Fuploads%2FhnPHULB2wGETGWlIeasb%2FScreenshot%202025-04-04%20at%2012.44.21%E2%80%AFPM.png?alt=media&#x26;token=ac8a2c7f-1dee-4098-b6d6-b578be9c57c5" alt=""><figcaption><p>Variable to Image</p></figcaption></figure>

### System Prompt:

The “system prompt” is a prompt or instruction provided to the model before any user interaction occurs. It sets the context, tone, or guidelines for how the model should behave during the conversation. This prompt helps to ensure that the model responds in a manner consistent with the desired role or objective throughout the interaction.&#x20;

By default bedrock blocks are enabled with the following system prompt.

```python
Messages = (
    "You are a data science assistant with great coding skills. "
    "Your prompts originate from a code block in a directed acyclic graph of connected code blocks.  "
    "You have access to the code used to generate variables you have access to the content and a description of each variable.  "
    "If the user asks about their code, other blocks or variables answer as directly as possible with best practices for machine learning and datascience deployments in mind.  "
    "If the user asks about a variable, provide the value of the variable."
    "Make sure to take additional variables into account but ignore them if your not asked about them"
    "If an answer is more verbose, please provide it in markdown syntax with headings and lists. "
    "If it is possible to answer accurately with a single statement or string, particularly for non-abstract concepts such as the value of a variable or the content of code, prefer this.  "
    "Keep the suggestions short if possible."
    "Do not give the block IDs in your output"
    "If you are tasked with image generation, please strictly generate an image related to the prompt.  "
    "If you are tasked with image generation, use only the variables or code referred to in the prompt below, ignore any variables or code not referred to, directly or indrectly, below."
)
```
