diff options
author | Johannes Gäßler <johannesg@5d6.de> | 2024-05-08 21:53:08 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-08 21:53:08 +0200 |
commit | c12452c7aec8a02264afc00196a13caa591a13ac (patch) | |
tree | 59fb7c3e827b71dac73312194cb24592eebac7a0 /examples/server/utils.hpp | |
parent | 9da243b36ac0b9d609adfaaa4c8f1cc8c592f737 (diff) |
JSON: [key] -> .at(key), assert() -> GGML_ASSERT (#7143)
Diffstat (limited to 'examples/server/utils.hpp')
-rw-r--r-- | examples/server/utils.hpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/examples/server/utils.hpp b/examples/server/utils.hpp index af12f497..d872b63f 100644 --- a/examples/server/utils.hpp +++ b/examples/server/utils.hpp @@ -3,6 +3,8 @@ #include "llama.h" #include "common.h" +// Change JSON_ASSERT from assert() to GGML_ASSERT: +#define JSON_ASSERT GGML_ASSERT #include "json.hpp" #include <string> @@ -373,11 +375,11 @@ static json oaicompat_completion_params_parse( llama_params["top_p"] = json_value(body, "top_p", 1.0); // Apply chat template to the list of messages - llama_params["prompt"] = format_chat(model, chat_template, body["messages"]); + llama_params["prompt"] = format_chat(model, chat_template, body.at("messages")); // Handle "stop" field - if (body.contains("stop") && body["stop"].is_string()) { - llama_params["stop"] = json::array({body["stop"].get<std::string>()}); + if (body.contains("stop") && body.at("stop").is_string()) { + llama_params["stop"] = json::array({body.at("stop").get<std::string>()}); } else { llama_params["stop"] = json_value(body, "stop", json::array()); } |