Formatron v0.4.2
Formatron empowers everyone to control the output format of language models with minimal overhead.
Loading...
Searching...
No Matches
json.py File Reference

Go to the source code of this file.

Classes

class  formatron.formats.json.JsonExtractor
 An extractor that loads json data to an object from a string. More...
 

Namespaces

namespace  formatron
 
namespace  formatron.formats
 This subpackage contains modules that operate with concrete formats, like json.
 
namespace  formatron.formats.json
 The module defines the JsonExtractor class, which is used to extract data from a string in JSON format.
 

Functions

None formatron.formats.json.register_generate_nonterminal_def (typing.Callable[[typing.Type, str], typing.Optional[typing.Tuple[str, typing.List[typing.Tuple[typing.Type, str]]]]] generate_nonterminal_def)
 Register a callable to generate nonterminal definition from a type.
 
 formatron.formats.json._register_all_predefined_types ()
 
str formatron.formats.json._generate_kbnf_grammar (schemas.schema.Schema schema, str start_nonterminal)
 Generate a KBNF grammar string from a schema for JSON format.
 

Variables

str formatron.formats.json.SPACE_NONTERMINAL = "[ \t\n\r]*"
 
str formatron.formats.json.GRAMMAR_HEADER
 
list formatron.formats.json._type_to_nonterminals