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

# Multimodal data

> Send images along with text in your prompts.

A `prompt` method can return images along with text. This guide writes a recipe for each photo of ingredients.

<Steps>
  <Step title="Create a dataset with image links">
    ```python theme={null}
    from datasets import Dataset

    ingredients = Dataset.from_list([
        {
            "spice_level": "very spicy",
            "image_url": "https://cdn.tasteatlas.com//images/ingredients/fcee541cd2354ed8b68b50d1aa1acad8.jpeg",
        },
        {
            "spice_level": "not so spicy",
            "image_url": "https://cdn.tasteatlas.com//images/dishes/da5fd425608f48b09555f5257a8d3a86.jpg",
        },
    ])
    ```
  </Step>

  <Step title="Return the text and the image from prompt">
    Return a tuple with the text and a `curator.types.Image`.

    ```python theme={null}
    from bespokelabs import curator


    class RecipeGenerator(curator.LLM):
        """Generate a recipe from a photo of ingredients."""

        def prompt(self, input: dict):
            text = f"Create me a {input['spice_level']} recipe from the ingredients image."
            return text, curator.types.Image(url=input["image_url"])

        def parse(self, input: dict, response: str) -> dict:
            return {"recipe": response}
    ```
  </Step>

  <Step title="Run it with a model that accepts images">
    ```python theme={null}
    recipe_generator = RecipeGenerator(model_name="gpt-4o-mini", backend="openai")

    recipes = recipe_generator(ingredients)
    print(recipes.dataset.to_pandas())
    ```
  </Step>
</Steps>

## Image sources

You can create a `curator.types.Image` in two ways. Set exactly one of `url` or `content`.

* `url` is a web link or a path to a local file. Curator reads a local file and sends it as base64.
* `content` is the image as bytes, as a PIL image, or as a base64 string.

The [multimodal examples](https://github.com/bespokelabsai/curator/tree/main/examples/multimodal) on GitHub show more cases.
