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

# File Inputs

> Learn how to use and files as inputs to the converse API.

Files enable you to pass documents, PDFs, images, and other file types to the converse API. This guide shows you how to upload files and include them in your conversations.

```python Python theme={null}
import os
from datagrid_ai import Datagrid

client = Datagrid(api_key=os.environ.get("DATAGRID_API_KEY"))

# Step 1: Upload a file
with open("report.pdf", "rb") as file:
    uploaded_file = client.files.create(file=file)

# Step 2: Include the file in a conversation
response = client.converse(
    prompt=[
        {
            "role": "user",
            "content": [
                {"type": "input_text", "text": "Summarize this document"},
                {"type": "input_file", "file_id": uploaded_file.id}
            ]
        }
    ]
)

print(response.content[0].text)
```

```javascript JavaScript theme={null}
import Datagrid from 'datagrid-ai';
import fs from 'fs';

const client = new Datagrid({
  apiKey: process.env['DATAGRID_API_KEY']
});

// Step 1: Upload a file
const uploadedFile = await client.files.create({
  file: fs.createReadStream('report.pdf')
});

// Step 2: Include the file in a conversation
const response = await client.converse({
  prompt: [
    {
      role: 'user',
      content: [
        { type: 'input_text', text: 'Summarize this document' },
        { type: 'input_file', file_id: uploadedFile.id }
      ]
    }
  ]
});

console.log(response.content[0].text);
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.