Skip to content

armgit / letta

Public Imported from GitHub
0

Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.

fix string & ws rules in json_func_calls...gbnf (#754)

Jim Lloyd9c06056443d5
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 4ab308cfd..f6548a9cb 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)?