This commit is contained in:
Me
2026-05-26 00:31:45 -07:00
parent 87bfcbd5bd
commit f59e8f3891
14 changed files with 1722 additions and 0 deletions

10
tools/tool_rules.gbnf Normal file
View File

@@ -0,0 +1,10 @@
root ::= object
object ::= "{" ws "\"thought\":" ws string "," ws "\"tool_call\":" ws tool-call ws "}"
tool-call ::= "{" ws "\"name\":" ws string "," ws "\"arguments\":" ws tool-args ws "}"
tool-args ::= "{" ws ( pair ("," ws pair)* )? ws "}"
pair ::= string ws ":" ws value
value ::= string | number | "true" | "false" | "null" | tool-args | array
array ::= "[" ws ( value ("," ws value)* )? ws "]"
string ::= "\"" ([^"\\\x00-\x1F] | "\\" (["\\/bfnrt] | "u" [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F]))* "\""
number ::= "-"? ([0-9]+ | [0-9]* "." [0-9]+) ([eE] [+-]? [0-9]+)?
ws ::= [ \t\n\r]*