9
static void export_md(std::string fname, llama_example ex) {
10
std::ofstream file(fname, std::ofstream::out | std::ofstream::trunc);
13
auto ctx_arg = gpt_params_parser_init(params, ex);
15
file << "| Argument | Explanation |\n";
16
file << "| -------- | ----------- |\n";
17
for (auto & opt : ctx_arg.options) {
20
for (const auto & arg : opt.args) {
21
if (arg == opt.args.front()) {
23
if (opt.args.size() > 1) file << ", ";
25
file << arg << (arg != opt.args.back() ? ", " : "");
30
std::string md_value_hint(opt.value_hint);
31
string_replace_all(md_value_hint, "|", "\\|");
32
file << " " << md_value_hint;
34
if (opt.value_hint_2) {
35
std::string md_value_hint_2(opt.value_hint_2);
36
string_replace_all(md_value_hint_2, "|", "\\|");
37
file << " " << md_value_hint_2;
40
std::string md_help(opt.help);
41
string_replace_all(md_help, "\n", "<br/>");
42
string_replace_all(md_help, "|", "\\|");
43
file << "` | " << md_help << " |\n";
47
int main(int, char **) {
48
export_md("autogen-main.md", LLAMA_EXAMPLE_MAIN);
49
export_md("autogen-server.md", LLAMA_EXAMPLE_SERVER);