Skip to main content

upload_file()

Upload a file from disk. Vrin accepts PDFs, CSVs, text files, and other common document formats.
result = client.upload_file("report.pdf")

Parameters

file_path
string | Path
required
Path to the file to upload. Accepts strings or pathlib.Path objects.
save_to_memory
bool
default:"True"
If True, persist extracted knowledge to the knowledge base. If False, the file is processed but facts are not stored permanently.
wait
bool
default:"True"
If True, poll until processing completes.
poll_interval
float
default:"3.0"
Seconds between status polls when wait=True.
max_wait
float
default:"120.0"
Maximum seconds to wait when wait=True.

Example

# Upload and wait for processing
result = client.upload_file("quarterly_report.pdf", save_to_memory=True)
print(f"Upload status: {result['status']}")

# Upload without waiting
result = client.upload_file("large_dataset.csv", wait=False)
upload_id = result.get("upload_id")

upload_bytes()

Upload raw bytes directly without a file on disk.
with open("data.csv", "rb") as f:
    result = client.upload_bytes(
        f.read(),
        "data.csv",
        content_type="text/csv"
    )

Parameters

file_bytes
bytes
required
File content as bytes.
filename
string
required
Name of the file. Used for MIME type detection and display.
content_type
string
MIME type (e.g. "application/pdf"). Auto-detected from filename if not provided.
save_to_memory
bool
default:"True"
If True, persist extracted knowledge.
wait
bool
default:"True"
If True, poll until processing completes.
poll_interval
float
default:"3.0"
Seconds between status polls.
max_wait
float
default:"120.0"
Maximum seconds to wait.

get_upload_status()

Check the processing status of a file upload.
status = client.get_upload_status("upload_abc123")
print(status["status"])  # "processing" | "completed" | "failed"

Parameters

upload_id
string
required
The upload ID returned by upload_file() or upload_bytes().

Supported file types

FormatExtensionNotes
PDF.pdfText extraction + OCR for scanned pages
CSV.csvRows parsed as structured records
Text.txtPlain text, inserted as-is
Markdown.mdParsed with section awareness

What happens during upload

  1. File is uploaded via multipart POST to the upload endpoint
  2. Vrin detects the file type and extracts text content
  3. Content is chunked, facts are extracted, and everything is indexed
  4. The upload status transitions: processing -> completed (or failed)