# Source: https://docs.lancedb.com/integrations/embedding/colpali.md

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

# ColPali

export const PyEmbeddingColpaliTextSearch = "actual = (\n    table.search(\"a furry pet\", vector_column_name=\"vector\")\n    .limit(1)\n    .to_pydantic(Images)[0]\n)\nprint(actual.label)\n";

export const PyEmbeddingColpaliSetup = "import tempfile\nfrom pathlib import Path\n\nimport lancedb\nimport pandas as pd\nimport requests\nfrom lancedb.embeddings import get_registry\nfrom lancedb.pydantic import LanceModel, MultiVector\n\ndb = lancedb.connect(str(Path(tempfile.mkdtemp()) / \"colpali-demo\"))\nfunc = get_registry().get(\"colpali\").create()\n\nclass Images(LanceModel):\n    label: str\n    image_uri: str = func.SourceField()\n    image_bytes: bytes = func.SourceField()\n    vector: MultiVector(func.ndims()) = func.VectorField()\n    vec_from_bytes: MultiVector(func.ndims()) = func.VectorField()\n\ntable = db.create_table(\"images\", schema=Images)\nlabels = [\"cat\", \"dog\", \"horse\"]\nuris = [\n    \"http://farm1.staticflickr.com/53/167798175_7c7845bbbd_z.jpg\",\n    \"http://farm9.staticflickr.com/8387/8602747737_2e5c2a45d4_z.jpg\",\n    \"http://farm9.staticflickr.com/8216/8434969557_d37882c42d_z.jpg\",\n]\nimage_bytes = [requests.get(uri).content for uri in uris]\ntable.add(\n    pd.DataFrame({\"label\": labels, \"image_uri\": uris, \"image_bytes\": image_bytes})\n)\n";

We support [ColPali](https://github.com/illuin-tech/colpali) model embeddings for multimodal multi-vector retrieval. ColPali produces multiple embedding vectors per input (multi-vector), enabling more nuanced similarity matching between text queries and image documents.

Using ColPali requires the colpali-engine package, which can be installed using `pip install colpali-engine`.

<Info>
  ColPali produces **multi-vector** embeddings, meaning each input generates multiple embedding vectors rather than a single vector. Use `MultiVector(func.ndims())` instead of `Vector(func.ndims())` when defining your schema.
</Info>

Supported models are:

* Metric-AI/ColQwen2.5-3b-multilingual-v1.0 (default)
* vidore/colpali-v1.3
* vidore/colqwen2-v1.0
* vidore/colSmol-256M

Supported parameters (to be passed in `create` method) are:

| Parameter             | Type                           | Default Value                                 | Description                                                               |
| --------------------- | ------------------------------ | --------------------------------------------- | ------------------------------------------------------------------------- |
| `model_name`          | `str`                          | `"Metric-AI/ColQwen2.5-3b-multilingual-v1.0"` | The name of the model to use.                                             |
| `device`              | `str`                          | `"auto"`                                      | The device for inference. Can be `"auto"`, `"cpu"`, `"cuda"`, or `"mps"`. |
| `dtype`               | `str`                          | `"bfloat16"`                                  | Data type for model weights (bfloat16, float16, float32, float64).        |
| `pooling_strategy`    | `str`                          | `"hierarchical"`                              | Token pooling strategy: `"hierarchical"`, `"lambda"`, or `None`.          |
| `pool_factor`         | `int`                          | `2`                                           | Factor to reduce sequence length when pooling is enabled.                 |
| `batch_size`          | `int`                          | `2`                                           | Batch size for processing inputs.                                         |
| `quantization_config` | `Optional[BitsAndBytesConfig]` | `None`                                        | Quantization configuration for the model (requires bitsandbytes).         |

This embedding function supports ingesting images as both bytes and URLs. You can query them using text.

<CodeGroup>
  <CodeBlock filename="Python" language="Python" icon="python">
    {PyEmbeddingColpaliSetup}
  </CodeBlock>
</CodeGroup>

Now we can search using text queries:

<CodeGroup>
  <CodeBlock filename="Python" language="Python" icon="python">
    {PyEmbeddingColpaliTextSearch}
  </CodeBlock>
</CodeGroup>