tool-call: add LLAMA_UPDATE_GOLDENS env for test-chat-template

This commit is contained in:
ochafik 2024-10-31 13:53:33 +00:00
parent c773516d57
commit b35aa4ae1c

View File

@ -117,8 +117,12 @@ static void test_jinja_templates() {
} catch (const std::runtime_error & e) { } catch (const std::runtime_error & e) {
actual = "ERROR: " + std::string(e.what()); actual = "ERROR: " + std::string(e.what());
} }
if (getenv("LLAMA_UPDATE_GOLDENS")) {
std::ofstream(golden_file) << actual;
} else {
assert_equals(expected, actual); assert_equals(expected, actual);
} }
}
if (!found_goldens) { if (!found_goldens) {
std::cerr << "No golden files found for " << tmpl_file << std::endl; std::cerr << "No golden files found for " << tmpl_file << std::endl;