mirror of
https://github.com/ggerganov/llama.cpp.git
synced 2024-11-14 14:59:52 +00:00
21 lines
431 B
Python
21 lines
431 B
Python
|
import json, subprocess, sys, os
|
||
|
|
||
|
assert len(sys.argv) >= 2
|
||
|
[_, pattern, *rest] = sys.argv
|
||
|
|
||
|
print(subprocess.check_output(
|
||
|
[
|
||
|
"python",
|
||
|
os.path.join(
|
||
|
os.path.dirname(os.path.realpath(__file__)),
|
||
|
"json-schema-to-grammar.py"),
|
||
|
*rest,
|
||
|
"-",
|
||
|
"--raw-pattern",
|
||
|
],
|
||
|
text=True,
|
||
|
input=json.dumps({
|
||
|
"type": "string",
|
||
|
"pattern": pattern,
|
||
|
}, indent=2)))
|