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

# Multi-Modality

The term 'Multi-Modal' refers to the ability to support more than just text, encompassing images, videos, audio and files.

## Voice Assistant

Chainlit let's you access the user's microphone audio stream and process it in real-time. This can be used to create voice assistants, transcribe audio, or even process audio in real-time.

<Note>
  The user will only be able to use the microphone if you implemented the
  [@cl.on\_audio\_chunk](/api-reference/lifecycle-hooks/on-audio-chunk) decorator.
</Note>

<CardGroup cols={2}>
  <Card title="OpenAI Realtime" icon="microphone-lines" color="#0285c7" href="https://github.com/Chainlit/cookbook/tree/main/realtime-assistant">
    Cookbook example showcasing how to use Chainlit with realtime audio APIs.
  </Card>

  <Card title="Text To Speech -> Speech to Text" color="F80061" icon="microphone" href="https://github.com/Chainlit/cookbook/blob/main/openai-whisper/app.py">
    Cookbook example showcasing speech to text -> answer generation -> text to speech.
  </Card>
</CardGroup>

<Frame caption="OpenAI Realtime Example">
  <video controls loop src="https://mintcdn.com/chainlit-43/b2WeFP1vh0enOZXn/images/openai-realtime.mp4?fit=max&auto=format&n=b2WeFP1vh0enOZXn&q=85&s=4edc48802b642519ade60be021f55bc4" data-path="images/openai-realtime.mp4" />
</Frame>

## Spontaneous File Uploads

Within the Chainlit application, users have the flexibility to attach any file to their messages. This can be achieved either by utilizing the drag and drop feature or by clicking on the `attach` button located in the chat bar.

<Frame caption="Attach files to a message">
  <img src="https://mintcdn.com/chainlit-43/b2WeFP1vh0enOZXn/images/multi-modal.gif?s=f154129ee5df7b82586c0a4a0297d9c9" width="1188" height="720" data-path="images/multi-modal.gif" />
</Frame>

As a developer, you have the capability to access these attached files through the [cl.on\_message](/api-reference/lifecycle-hooks/on-message) decorated function.

```py theme={null}
import chainlit as cl


@cl.on_message
async def on_message(msg: cl.Message):
    if not msg.elements:
        await cl.Message(content="No file attached").send()
        return

    # Processing images exclusively
    images = [file for file in msg.elements if "image" in file.mime]

    # Read the first image
    with open(images[0].path, "r") as f:
        pass

    await cl.Message(content=f"Received {len(images)} image(s)").send()

```

### Disabling Spontaneous File Uploads

If you wish to disable this feature (which would prevent users from attaching files to their messages), you can do so by setting `features.spontaneous_file_upload.enabled=false` in your Chainlit [config](/backend/config/features) file.
