feat(yaml-parser): add input_files shorthand to EVAL.yaml test cases#605
Merged
feat(yaml-parser): add input_files shorthand to EVAL.yaml test cases#605
Conversation
Adds `input_files:` as a shorthand at the test level that expands to
type:file content blocks prepended before the type:text block in the
user message. Only supported with a string `input` in v1.
Expansion rule (file blocks first, text block last):
input_files:
- path/to/file.csv
input: "Summarize this."
expands to:
input:
- role: user
content:
- type: file
value: path/to/file.csv
- type: text
value: "Summarize this."
Paths are resolved using the same convention as explicit type:file blocks.
Multi-turn array inputs are not supported in v1 (returns undefined).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
input_files:as a shorthand at the test level in EVAL.yaml that expands totype: filecontent blocks prepended before atype: textblock in the user messageshorthand-expansion.ts) — no provider or evaluator changesinputin v1; multi-turn array inputs returnundefined(no expansion)type: fileblocksExpansion rule:
expands to:
Changes
packages/core/src/evaluation/loaders/shorthand-expansion.ts— newexpandInputFilesShorthand()function; updatedresolveInputMessages()to checkinput_filesfirstpackages/core/src/evaluation/yaml-parser.ts— addedinput_files?: JsonValuetoRawEvalCasetypepackages/core/test/evaluation/loaders/shorthand-expansion.test.ts— 8 new unit tests forexpandInputFilesShorthand, 4 new tests forresolveInputMessageswithinput_filespackages/core/test/evaluation/input-files-shorthand.test.ts— 4 new yaml-parser integration tests (including parity test between shorthand and explicit form)examples/features/input-files-shorthand/— new example eval demonstrating single-file, multi-file, and explicit-form equivalenceRisk
Low — purely additive parser change. No existing behavior changes. All 1300 tests pass.
closes #602