Skip to content

Uploaded files available in subsequent EDSL questions #2498

Description

@johnjosephhorton

Goal

Enable workflows where a QuestionFileUpload answer from Humanize can be used directly by a downstream AI question, including thinking_question(...).

Example:

  q1 = QuestionFileUpload(
      question_name="receipt",
      question_text="Upload a receipt.",
  )

  q2 = thinking_question(
      QuestionFreeText(
          question_name="receipt_table",
          question_text="Please create a markdown table from {{ receipt.answer }}.",
      )
  )

  q3 = QuestionYesNo(
      question_name="looks_right",
      question_text="Does {{ receipt_table.answer }} look right?",
  )

  s = Survey([q1, q2, q3])

Desired behavior

When q2 runs, EDSL should recognize that {{ receipt.answer }} refers to a Humanize file-upload answer and attach the uploaded file to the model call.

The rendered prompt can contain a simple placeholder such as:

Please create a markdown table from [uploaded file: receipt.pdf].

The actual file should be passed through the existing files_list mechanism so model services that support file inputs can process it.

Current state

Humanize file-upload responses are represented as uploaded-file metadata, likely a list of dicts containing fields such as gcs_path, name, mime_type, and extension.

EDSL already has helpers for converting these responses after the fact:

FileStore.from_file_upload_answer(file_info)
FileStoreList.from_file_upload_answers(files)

EDSL also already has model-call plumbing for file inputs via files_list, and thinking_question(...) preserves that path through InvigilatorThinkingAI.

Needed work

Add normalization for Humanize file-upload answers during survey execution, before downstream AI questions are rendered/called.

Specifically:

  1. Detect when a referenced prior answer came from a QuestionFileUpload.
  2. Convert the Humanize upload metadata into model-attachable file objects:

FileStore.from_file_upload_answer(uploaded_files[0])

or, for multiple files:

FileStoreList.from_file_upload_answers(uploaded_files)

  1. Add the resulting FileStore objects to the prompt’s files_list.
  2. Render the Jinja reference as a useful text placeholder rather than the raw metadata dict/list.
  3. Ensure this works for wrapped questions created by thinking_question(...).
  4. Add tests covering:

QuestionFileUpload -> thinking_question(QuestionFreeText) -> QuestionYesNo

with a mocked Humanize upload response and mocked file download/signing path.

Open design questions

Should QuestionFileUpload be single-file by default, multi-file by default, or configurable?

Should the Jinja-rendered text be the filename, a structured file summary, or a fixed placeholder?

Should FileStore.from_file_upload_answer(...) download immediately, or should we support a lazy/remote FileStore that can pass a signed URL or GCS reference directly to providers that
support remote file inputs?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions