mirror of
				https://github.com/ggml-org/llama.cpp.git
				synced 2025-10-29 08:41:22 +00:00 
			
		
		
		
	 53f925074d
			
		
	
	53f925074d
	
	
	
		
			
			* sync : vendor ggml-ci * cont : fix httplib version ggml-ci * cont : fix lint * cont : fix lint * vendor : move to common folder /vendor ggml-ci * cont : fix lint * cont : move httplib to /vendor + use json_fwd.hpp ggml-ci * cont : fix server build ggml-ci * cont : add missing headers ggml-ci * cont : header clean-up ggml-ci
		
			
				
	
	
		
			22 lines
		
	
	
		
			701 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			22 lines
		
	
	
		
			701 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| #pragma once
 | |
| 
 | |
| #include <nlohmann/json_fwd.hpp>
 | |
| 
 | |
| #include <functional>
 | |
| #include <string>
 | |
| 
 | |
| std::string json_schema_to_grammar(const nlohmann::ordered_json & schema,
 | |
|                                    bool force_gbnf = false);
 | |
| 
 | |
| struct common_grammar_builder {
 | |
|     std::function<std::string(const std::string &, const std::string &)> add_rule;
 | |
|     std::function<std::string(const std::string &, const nlohmann::ordered_json &)> add_schema;
 | |
|     std::function<void(nlohmann::ordered_json &)> resolve_refs;
 | |
| };
 | |
| 
 | |
| struct common_grammar_options {
 | |
|     bool dotall = false;
 | |
| };
 | |
| 
 | |
| std::string build_grammar(const std::function<void(const common_grammar_builder &)> & cb, const common_grammar_options & options = {});
 |