From 83b1bfe2b9eb41fa7a34deb8cd73b46fc4f2e10b Mon Sep 17 00:00:00 2001 From: Jim Lloyd Date: Mon, 1 Jan 2024 01:27:17 -0800 Subject: [PATCH] fix string & ws rules in json_func_calls...gbnf --- .../grammars/json_func_calls_with_inner_thoughts.gbnf | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/memgpt/local_llm/grammars/json_func_calls_with_inner_thoughts.gbnf b/memgpt/local_llm/grammars/json_func_calls_with_inner_thoughts.gbnf index 4ab308cfd7..f6548a9cbf 100644 --- a/memgpt/local_llm/grammars/json_func_calls_with_inner_thoughts.gbnf +++ b/memgpt/local_llm/grammars/json_func_calls_with_inner_thoughts.gbnf @@ -19,7 +19,14 @@ ArchivalMemorySearchParams ::= "{" ws InnerThoughtsParam "," ws "\"quer InnerThoughtsParam ::= "\"inner_thoughts\":" ws string RequestHeartbeatParam ::= "\"request_heartbeat\":" ws boolean namestring ::= "\"human\"" | "\"persona\"" -string ::= "\"" ([^"\[\]{}]*) "\"" boolean ::= "true" | "false" -ws ::= "" number ::= [0-9]+ + +string ::= + "\"" ( + [^"\\] | + "\\" (["\\/bfnrt] | "u" [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F]) # escapes + )* "\"" ws + +# Optional space: by convention, applied in this grammar after literal chars when allowed +ws ::= ([ \t\n] ws)?