# Variables

### ValueType

Variables can be defined and manipulated through ValueType and UIType. ValueType is useful to define and process the variables. For example,

```python
    "quiz_status": ValueType(
        type="str",
        value='default',
    ),  
```

```python
    "quiz_idx": ValueType(
        type="int",
        value="${min(quiz_idx + 1, len(words) - 1)}",
    ),    
```

In the above example, we can use ${} to wrap an expression to update a variable called qui\_idx.

the type of the ValueType can be&#x20;

```python
["str", "int", "float", "bool", "list", "dict"]
```

Variables from user inputs are handled by UIType. We support the following UITypes

### UIType

#### Dropdown

```python
    "level": Dropdown(
        value=None,
        choices=["easy", "medium", "hard"],
        label="Choose Level:"
    ),
```

to choose from some choices

#### Button

```python
    "level": Dropdown(
        value=None,
        choices=["easy", "medium", "hard"],
        label="Choose Level:"
    ),
```

often used as triggers, to submit a form or jump to next pages

#### Textbox

```python
    "quiz_info": Textbox(
        value='${f"{quiz_idx + 1} / {len(words)} words"}',
        label="Info"
    ),
```

display some information using plain-text

#### Image

```python
        "image": Image(
            value="${word2material[word_txt]['pic_path']}",
            show_label=False,
            height=image_height,
            width=image_height,
            show_download_button=False,
        ),
```

display an image, the size of the image can be manually controlled

#### Gallery

```python
    'word_images': Gallery(
        value="${[word2material[word]['pic_path'] for word in [choice_0, choice_1, choice_2, choice_3]]}",
        columns=2,
        height=550,
        show_label=False,
    ),
```

display a group of images

#### Audio

```python
    "audio_word": Audio(
        value="${word2material[word_txt]['word_tts_audio_path']}",
        label="Word Pronunciation",
    ),
```

play a audio, the value need to be the path of the audio

#### DisplayDropdown

```python
    "topic": DisplayDropdown(
        choices="${topics}",
        initial_choices=[""],
        interactive=True,
        label="Choose Topic:",
    ),  
```

used when the choices need to be dynamically updated


---

# 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://myshell-ai.gitbook.io/neuralautomata/variables.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.
