File search lets your AI assistant query and retrieve information from documents you've uploaded. The assistant can find relevant passages, answer questions about file contents, and cite sources from your knowledge base.
- Upload files to a vector store using the Files API
- Attach the vector store to your assistant
- When the user asks questions, the model automatically searches the files and incorporates relevant content into its response
{
"organization_id": "org_your_org_id",
"assistant_id": "asst_abc123",
"tools": [{"type": "file_search"}],
"inputs": [{"role": "user", "content": "What does the Q3 report say about revenue?"}]
}| Mode | Behavior |
|---|---|
auto | Model decides when to search (recommended) |
on | Always search files before responding |
off | Disable file search |
| Format | Extension |
|---|---|
.pdf | |
| Word documents | .docx, .doc |
| Text | .txt, .md |
| Code | .py, .js, .ts, .java, and more |
| CSV | .csv |
When file search is used, the response includes file_search_call output items:
{
"output": [
{
"type": "file_search_call",
"id": "fs_abc123",
"status": "completed",
"results": [
{
"file_id": "file_xyz789",
"filename": "q3-report.pdf",
"score": 0.94,
"text": "Q3 revenue increased 23% year-over-year..."
}
]
},
{
"type": "message",
"role": "assistant",
"content": [{"type": "output_text", "text": "According to the Q3 report, revenue..."}]
}
]
}import requests
# Upload a file
with open("report.pdf", "rb") as f:
response = requests.post(
"https://api.aitronos.com/v1/files",
headers={"X-API-Key": os.environ["FREDDY_API_KEY"]},
files={"file": f},
data={
"organization_id": "org_your_org_id",
"purpose": "assistants",
},
)
file_id = response.json()["id"]Then attach the file to a vector store and link the vector store to your assistant. See the Files API and Vector Stores API for details.
- System Tools Overview — All available built-in tools
- File Retrieval — Direct file content access
- Web Search — Search the internet
- Files API — Uploading files
- Assistants — Configuring tools on an assistant