0010-Maintain-ordering-for-rules-for-grammar.patch 1004 B

12345678910111213141516171819202122
  1. From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  2. From: ParthSareen <parth.sareen@ollama.com>
  3. Date: Wed, 11 Dec 2024 15:37:32 -0800
  4. Subject: [PATCH] Maintain ordering for rules for grammar
  5. ---
  6. common/json-schema-to-grammar.cpp | 2 +-
  7. 1 file changed, 1 insertion(+), 1 deletion(-)
  8. diff --git a/common/json-schema-to-grammar.cpp b/common/json-schema-to-grammar.cpp
  9. index 3ebcc3d9..30c28808 100644
  10. --- a/common/json-schema-to-grammar.cpp
  11. +++ b/common/json-schema-to-grammar.cpp
  12. @@ -346,7 +346,7 @@ private:
  13. friend std::string build_grammar(const std::function<void(const common_grammar_builder &)> & cb, const common_grammar_options & options);
  14. std::function<json(const std::string &)> _fetch_json;
  15. bool _dotall;
  16. - std::map<std::string, std::string> _rules;
  17. + std::unordered_map<std::string, std::string> _rules;
  18. std::unordered_map<std::string, json> _refs;
  19. std::unordered_set<std::string> _refs_being_resolved;
  20. std::vector<std::string> _errors;