mirror of
https://github.com/ggerganov/llama.cpp.git
synced 2024-12-30 21:34:36 +00:00
11 lines
395 B
JavaScript
11 lines
395 B
JavaScript
|
import { readFileSync } from "fs"
|
||
|
import { SchemaConverter } from "../examples/server/public/json-schema-to-grammar.mjs"
|
||
|
|
||
|
const [, , file] = process.argv
|
||
|
const url = `file://${file}`
|
||
|
let schema = JSON.parse(readFileSync(file, "utf8"));
|
||
|
const converter = new SchemaConverter({})
|
||
|
schema = await converter.resolveRefs(schema, url)
|
||
|
converter.visit(schema, '')
|
||
|
console.log(converter.formatGrammar())
|