forked from ollama/ollama
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
llama: enable JSON schema key ordering for generating grammars (ollam…
- Loading branch information
1 parent
b1fd7fe
commit 18f6a98
Showing
3 changed files
with
24 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
llama/patches/0012-Maintain-ordering-for-rules-for-grammar.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: ParthSareen <[email protected]> | ||
Date: Wed, 11 Dec 2024 15:37:32 -0800 | ||
Subject: [PATCH] Maintain ordering for rules for grammar | ||
|
||
--- | ||
common/json-schema-to-grammar.cpp | 2 +- | ||
1 file changed, 1 insertion(+), 1 deletion(-) | ||
|
||
diff --git a/common/json-schema-to-grammar.cpp b/common/json-schema-to-grammar.cpp | ||
index dadc18c8..2a8dbd22 100644 | ||
--- a/common/json-schema-to-grammar.cpp | ||
+++ b/common/json-schema-to-grammar.cpp | ||
@@ -391,7 +391,7 @@ class SchemaConverter { | ||
private: | ||
std::function<json(const std::string &)> _fetch_json; | ||
bool _dotall; | ||
- std::map<std::string, std::string> _rules; | ||
+ std::unordered_map<std::string, std::string> _rules; | ||
std::unordered_map<std::string, json> _refs; | ||
std::unordered_set<std::string> _refs_being_resolved; | ||
std::vector<std::string> _errors; |