Skip to content
Last updated

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 CaseRecommended 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 contextFile Retrieval

Enabling 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"}
 ]
 }
 ]
}

Attaching Files to Messages

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"},
 ],
 }
 ],
 },
)

Tool Modes

ModeBehavior
autoModel retrieves files when needed
onAlways retrieve attached files
offDisable file retrieval

Supported File Types

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)

File Size Limits

  • 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.