import io
from pathlib import Path
# Mixing different file input types
file1 = "document.pdf" # Path string
file2 = Path("image.png") # Path object
file3 = open("data.csv", "rb") # File object
file4 = b"Hello, world!" # Bytes (requires filename)
file5 = io.BytesIO(b"Some in-memory data") # BytesIO (requires filename)
result = db.ingest_files(
files=[file1, file2, file3, file4, file5],
metadata=[
{"type": "document"},
{"type": "image"},
{"type": "data"},
{"type": "text", "filename": "hello.txt"},
{"type": "text", "filename": "memory-data.txt"}
]
)
# Don't forget to close file objects
file3.close()