Skip to main content
FileStore represents a file and its contents for use in EDSL or storage on Expected Parrot. A scenario can contain a FileStore attachment, or rows extracted from a file can become separate scenarios. For complete examples of asking questions about PDFs, images, video, and audio, see Files and media as scenarios.

Portable document inputs from the CLI

Give each interview one original document by putting one file in each scenario.
Reference {{ scenario.artwork }} in the question that needs the attachment. The resulting ScenarioList contains the file contents and the source filename for each row. When a CSV or Excel sheet already assigns the documents, import the named column. For example, a sheet in handoff/placements.csv can contain these records.
EDSL resolves each path inside the sheet’s directory and replaces that cell with a FileStore. Row order, repeated assignments and the other fields are preserved. Repeat --file-column for another attachment field. Use the imported field names after any header normalization. The import embeds original bytes without running a document parser. To extract text later, use the FileStore’s extract_text() with the appropriate file-format extras installed. Add --id-field placement during import to include placement IDs in the error report. Missing or out-of-directory paths are reported together, before EDSL writes the output. To verify the delivered package, list its attachment digests.
The receipt contains the row, field, filename, MIME type, byte count and SHA-256 of each top-level attachment.

Rows from a CSV and a whole-file attachment

This self-contained example writes a two-row CSV using Python’s CSV writer, constructs a FileStore, and loads the rows as scenarios. It makes no model calls or uploads.
rows has two scenarios, each with record_id and feedback. The attachment scenario instead holds the complete file under document. Loading a CSV into rows is useful for one classification per record; attaching a whole document is useful when the model needs the document itself.

Images, PDFs, and other media

Use a FileStore value in a scenario and reference its field in the question. For example, Scenario({"image": FileStore("image.png")}) attaches an image that the question can reference with {{ scenario.image }}. A plain path string carries only the filename. The Scenarios page contains worked examples for:

Storage and sharing

Creating a FileStore reads local data. Calling push() uploads it to Expected Parrot and requires authentication. Set visibility explicitly and retain the returned identifier. See Saving and sharing objects for posting and retrieving research materials. For example, save a PDF on Expected Parrot and retrieve it as a scenario attachment:
Reference {{ scenario.document }} in your question, then pass document to question.by(document). You can also pass a shared file URL to FileStore.pull(). Access follows the object’s sharing permissions. To extract PDF text after retrieval, use ScenarioList.from_source("pdf", retrieved_report.to_tempfile()) after importing ScenarioList.

Common methods

Using the CSV created in the example above:
attachment contains one complete file, while rows contains the CSV records. Choose the input that matches what each respondent should evaluate.

Read, preview, and convert files

FileStore.from_file_upload_answer(file_info) retrieves one uploaded file from a human survey answer; see file upload responses.

Generate image inputs

ImageGeneration produces FileStore objects that can be attached to scenarios. This example uses a local test service that returns a tiny placeholder image, without a provider request:
For actual generation, choose a model supported by the image service, for example ImageGeneration(model="MODEL_NAME", service_name="google"), with the provider credential configured. Image generation can incur costs. Pass input_images=[file] when the chosen service supports editing or image-conditioned generation. Provider-specific parameters can be supplied at construction or to generate(). In a notebook with an active event loop or an asynchronous function, use await generator.async_generate(prompt) instead of generate(). A single generated image returns one FileStore; multiple images return a list. With return_type="generated_image", the return value instead contains GeneratedImage metadata. Use its to_filestore() to access the file, token_usage() for usage information, and cost() for the model-price-based cost calculation; missing usage can be estimated rather than measured.