Skip to contents

Uploads a file from the local filesystem to an assistant for processing. The assistant will process the file for use in RAG operations.

Usage

assistant_upload_file(
  assistant_name,
  file_path,
  metadata = NULL,
  multimodal = NULL
)

Arguments

assistant_name

Name of the assistant

file_path

Path to the local file to upload

metadata

Optional metadata to attach to the file (named list)

multimodal

Optional flag to enable multimodal processing (PDFs only). When TRUE, images in PDFs are processed for visual context.

Value

List with http response, content (file details), and status_code. Content includes: - id: File UUID - name: File name - status: File status ("Processing" initially, then "Available" or "Failed") - size: File size in bytes - metadata: File metadata - created_on: Creation timestamp - updated_on: Last update timestamp - percent_done: Processing progress

Details

Supported file types include: PDF, TXT, MD, JSON, and more. File processing may take several minutes depending on file size. Use assistant_describe_file() to check processing status.

Examples

if (FALSE) { # \dontrun{
# Upload a file
assistant_upload_file("my-assistant", "/path/to/document.pdf")

# Upload with metadata
assistant_upload_file(
  assistant_name = "my-assistant",
  file_path = "/path/to/document.pdf",
  metadata = list(company = "acme", document_type = "report")
)

# Upload PDF with multimodal processing (for images in PDF)
assistant_upload_file(
  assistant_name = "my-assistant",
  file_path = "/path/to/document.pdf",
  multimodal = TRUE
)
} # }