Skip to content

[feat] Support test.args.{ file } for string types #1935

@bennbollay

Description

@bennbollay

Product

BAML

Problem Statement / Use Case

Currently even the "helper" AI on the documentation things that the following is legal:

function Extract(input: string) -> Meaning

test sample_1_data {
  functions [Extract]
  args {
    input {
      file "./full_of_meaning.txt"
    }
  }
}

The { file } approach is currently valid for image and audio parameter types, but being able to hoist string types as well from filesystem files makes a ton of sense. Not being able to do so violated my principle of least surprise when I was writing test cases.

Proposed Solution

Support { file } when loading string arguments in test sections.

Alternative Solutions

There's a variety of middling approaches or external scripts that can insert the data in, but none of them are "conformant" with the expectations around BAML.

Additional Context

Tagging @sxlijin and @Elijas regarding the thread in Discord on this topic.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions