mirror of
https://github.com/ollama/ollama.git
synced 2025-03-30 04:32:02 +02:00
llama: parse JSON schema using nlohmann::ordered_json to maintain ordering (#8071)
This commit is contained in:
parent
18f6a98bd6
commit
c216850523
2
llama/sampling_ext.cpp
vendored
2
llama/sampling_ext.cpp
vendored
@ -49,7 +49,7 @@ int schema_to_grammar(const char *json_schema, char *grammar, size_t max_len)
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
nlohmann::json schema = nlohmann::json::parse(json_schema);
|
nlohmann::ordered_json schema = nlohmann::ordered_json::parse(json_schema);
|
||||||
std::string grammar_str = json_schema_to_grammar(schema);
|
std::string grammar_str = json_schema_to_grammar(schema);
|
||||||
size_t len = grammar_str.length();
|
size_t len = grammar_str.length();
|
||||||
if (len >= max_len)
|
if (len >= max_len)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user