A test case that carries a file is skipped by every metric that reads the input, because evaluators cannot read files yet. Score the output instead, with a metric such as JSON Field Match.
Workflow
1
Attach the documents
Add an
input_file_paths column to your dataset CSV. The SDK uploads each file and attaches it to that row’s input.2
Read the test cases back
galtea.test_cases.list() returns the text in input and the attachments in input_files.3
Download each attached file
galtea.storage.download() saves a file locally and returns the path it wrote.4
Answer and score
Run your own pipeline over the local files, then log the answer and evaluate it.
1. Attach the documents
Name the local files in aninput_file_paths column. Separate several paths with ; or |. A row may attach files and leave input empty, which is how you write a test case that is only a document:
expected_output here is a JSON object, because the metric below compares it field by field. CSV escapes a quote by doubling it, which is why every " inside those cells appears as "".
2. Write your pipeline
This is the step Galtea cannot do. It takes the question and the local file paths, and returns whatever your product would answer:3. Read, download, answer, score
test_case.inputisNonefor a document-only test case. The document is the whole input, so there is no text to read. Usetest_case.input_datawhen you need the full structured input, including the file parts.include_legacy=Falsereturns only the current revision of each test case. Leave it at its default and an edited test case comes back once per revision, so you download the same document again for each one.- The file is saved under the name you uploaded it with. Storage keys are random ids, so without
filenameyou would get9f3c1a.pdfon disk.download()reads the name from theInputFile. - A failed download raises. The message names the file and the cause, never the presigned link. Wrap the loop in
try/exceptif one unreadable document should not stop the rest.
galtea.storage.download() also takes a plain URI, so it fetches any file your organization uploaded, not only test case attachments. See Download File.Next Steps
File inputs
The limits, the accepted file types, and how editing a document test case works.
Storage Service
Upload and download files directly, for any purpose.
Run Dataset-Based Evaluations
The same loop for test cases that are plain text.
JSON Field Match
Score a structured answer field by field, without reading the input.