# 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="/files/Wgc2AzyFipiKj2ajG98o" alt=""><figcaption><p>Prompt</p></figcaption></figure>

<figure><img src="/files/DBs1etp9QQLoi7LUv8r6" alt=""><figcaption><p>Output</p></figcaption></figure>

<figure><img src="/files/ekBBHK1fQyv0cvtclZfG" 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="/files/RY8glJvGJnY4GXQSmmYr" alt=""><figcaption><p>Variable to text</p></figcaption></figure>

<figure><img src="/files/bKiySKV6r91W5eqgRz9t" 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."
)
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.zerve.ai/guide/canvas-view/blocks-and-connections/block-types/gen-ai.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
