File retrieval gives your AI assistant direct access to the full contents of uploaded files. Unlike File Search (which queries a vector index), file retrieval returns raw file content for the model to process directly.
| Use Case | Recommended Tool |
|---|---|
| "Find the section about X in this document" | File Search |
| "Read this CSV and calculate the totals" | File Retrieval |
| "Compare these two documents" | File Retrieval |
| Large knowledge bases (many documents) | File Search |
| Single files that need full context | File Retrieval |
{
"organization_id": "org_your_org_id",
"assistant_id": "asst_abc123",
"tools": [{"type": "file_retrieval"}],
"inputs": [
{
"role": "user",
"content": [
{"type": "text", "text": "Analyze this data file and summarize the trends."},
{"type": "file", "file_id": "file_abc123"}
]
}
]
}You can attach files directly to a message as input content:
response = requests.post(
"https://api.aitronos.com/v1/model/response",
headers={"X-API-Key": os.environ["FREDDY_API_KEY"]},
json={
"organization_id": "org_your_org_id",
"model": "gpt-4o",
"inputs": [
{
"role": "user",
"content": [
{"type": "text", "text": "What does this document contain?"},
{"type": "file", "file_id": "file_abc123"},
],
}
],
},
)| Mode | Behavior |
|---|---|
auto | Model retrieves files when needed |
on | Always retrieve attached files |
off | Disable file retrieval |
Text-based files work best for retrieval:
- PDF, Word documents (
.pdf,.docx) - Plain text and Markdown (
.txt,.md) - Code files (
.py,.js,.ts, etc.) - CSV and structured data (
.csv) - JSON (
.json)
- Maximum file size: 512 MB per file
- Maximum content extracted: Approximately 2M tokens per file
Very large files may be truncated. Use file search for large document collections.
- System Tools Overview — All available built-in tools
- File Search — Semantic search across documents
- Files API — Uploading files
- Assistants — Configuring tools on an assistant