# Input types

Canonical URL: https://developers.iagenify.com/sdk/concepts/inputs/
Language: en

An input is typed, and it can be text, a picture, a document, a recording, a clip or a set of passages. Each one can arrive as a value or a URL.

Status: 7 types · content · url

## The shape {#shape}

```javascript
{ type, content?, url?, mime? }
```

| type | Carries |
| --- | --- |
| text | a string, in content |
| image | a picture: url, or base64 in content |
| video | a clip: url, or base64 in content |
| audio | a recording: url, or base64 in content |
| speech | audio meant to be transcribed rather than described |
| passages | pieces of text to rank or compare, rather than read as one |
| file | a document such as a PDF: url only, never content |

## Two ways to supply one {#sources}

```javascript
import { readFileSync } from "node:fs";

await assistant.generate({
  inputs: [
    { type: "text",  content: "What changed between these two?" },
    { type: "image", url: "https://example.com/before.png" },      // fetched for you
    { type: "image", content: base64Png, mime: "image/png" },      // already in hand
    // A local file is content too — read it yourself, there is no "path" input:
    { type: "image", content: readFileSync("./after.png").toString("base64"), mime: "image/png" },
  ],
});
```

> **Set mime when you pass raw content**
>
> With a url the type is worked out for you from what the server fetches. With base64 in content — your own bytes, or a file you just read — there is nothing to work it out from, so set mime yourself.

## Order is meaning {#order}

Inputs are read in the order you give them. Put the question before the material when you want it read with that question in mind, and after when you want an unprompted description first.

## passages is not just more text {#passages}

Several `text` inputs are one body to read. `passages` is a set of separate items to be ranked or compared — which is what a reranking call needs.

```javascript
await reranker.generate({
  inputs: [
    { type: "text", content: "Which of these answers the question best?" },
    { type: "passages", content: [chunkA, chunkB, chunkC] },
  ],
});
```

```python
{"type": ..., "content": ..., "url": ..., "mime": ...}
```

```python
import base64
from pathlib import Path

assistant.generate(inputs=[
    {"type": "text", "content": "What changed between these two?"},
    {"type": "image", "url": "https://example.com/before.png"},          # fetched for you
    {"type": "image", "content": base64_png, "mime": "image/png"},       # already in hand
    # A local file is content too — read it yourself, there is no "path" input:
    {"type": "image", "content": base64.b64encode(Path("after.png").read_bytes()).decode(),
     "mime": "image/png"},
])
```

```python
reranker.generate(inputs=[
    {"type": "text", "content": "Which of these answers the question best?"},
    {"type": "passages", "content": [chunk_a, chunk_b, chunk_c]},
])
```
