Skip to content

Commit bcaf91e

Browse files
authored
Add --system-prompt parameter
1 parent 2cc4a5e commit bcaf91e

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

common/arg.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -813,13 +813,18 @@ common_params_context common_params_parser_init(common_params & params, llama_ex
813813
).set_env("LLAMA_ARG_FLASH_ATTN"));
814814
add_opt(common_arg(
815815
{"-p", "--prompt"}, "PROMPT",
816-
ex == LLAMA_EXAMPLE_MAIN
817-
? "prompt to start generation with\nif -cnv is set, this will be used as system prompt"
818-
: "prompt to start generation with",
816+
"prompt to start generation with",
819817
[](common_params & params, const std::string & value) {
820818
params.prompt = value;
821819
}
822820
).set_excludes({LLAMA_EXAMPLE_SERVER}));
821+
add_opt(common_arg(
822+
{"-sys", "--system-prompt"}, "PROMPT",
823+
"system prompt to use with model (if applicable)",
824+
[](common_params & params, const std::string & value) {
825+
params.system_prompt = value;
826+
}
827+
).set_examples({LLAMA_EXAMPLE_MAIN}));
823828
add_opt(common_arg(
824829
{"--no-perf"},
825830
string_format("disable internal libllama performance timings (default: %s)", params.no_perf ? "true" : "false"),

common/common.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ struct common_params {
261261
std::string hf_repo = ""; // HF repo // NOLINT
262262
std::string hf_file = ""; // HF file // NOLINT
263263
std::string prompt = ""; // NOLINT
264+
std::string system_prompt = ""; // NOLINT
264265
std::string prompt_file = ""; // store the external prompt file name // NOLINT
265266
std::string path_prompt_cache = ""; // path to file for saving/loading prompt eval state // NOLINT
266267
std::string input_prefix = ""; // string to prefix user inputs with // NOLINT

0 commit comments

Comments
 (0)