mirror of
				https://github.com/ggml-org/llama.cpp.git
				synced 2025-10-28 08:31:25 +00:00 
			
		
		
		
	 1d36b3670b
			
		
	
	1d36b3670b
	
	
	
		
			
			* llama : move end-user examples to tools directory --------- Co-authored-by: Xuan Son Nguyen <son@huggingface.co>
		
			
				
	
	
		
			11 lines
		
	
	
		
			399 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			11 lines
		
	
	
		
			399 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| import { readFileSync } from "fs"
 | |
| import { SchemaConverter } from "../tools/server/public_legacy/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())
 |