mirror of
https://github.com/ggerganov/llama.cpp.git
synced 2024-12-27 11:54:35 +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())
|