diff --git a/v0.4.9/.nojekyll b/v0.4.9/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/v0.4.9/RWKV_8py.html b/v0.4.9/RWKV_8py.html new file mode 100644 index 0000000..3b00f26 --- /dev/null +++ b/v0.4.9/RWKV_8py.html @@ -0,0 +1,170 @@ + + + + + + + + +Formatron: src/formatron/integrations/RWKV.py File Reference + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+ +
RWKV.py File Reference
+
+
+ +

Go to the source code of this file.

+ + + + + + + + +

+Classes

class  formatron.integrations.RWKV.PIPELINE_ARGS
 A wrapper for the arguments of the pipeline of RWKV. More...
 
class  formatron.integrations.RWKV.PIPELINE
 A wrapper for the pipeline of RWKV. More...
 
+ + + + + + + + + +

+Namespaces

namespace  formatron
 
namespace  formatron.integrations
 This subpackage contains integrations with other frameworks and libraries.
 
namespace  formatron.integrations.RWKV
 This module integrates the RWKV library by providing convenience utilities.
 
+ + + + +

+Functions

kbnf.Vocabulary formatron.integrations.RWKV.create_engine_vocabulary (str WORD_NAME, tokenizer)
 Create a vocabulary for the KBNF engine.
 
+
+
+ + + + diff --git a/v0.4.9/RWKV_8py.js b/v0.4.9/RWKV_8py.js new file mode 100644 index 0000000..7b50d03 --- /dev/null +++ b/v0.4.9/RWKV_8py.js @@ -0,0 +1,6 @@ +var RWKV_8py = +[ + [ "formatron.integrations.RWKV.PIPELINE_ARGS", "classformatron_1_1integrations_1_1RWKV_1_1PIPELINE__ARGS.html", "classformatron_1_1integrations_1_1RWKV_1_1PIPELINE__ARGS" ], + [ "formatron.integrations.RWKV.PIPELINE", "classformatron_1_1integrations_1_1RWKV_1_1PIPELINE.html", "classformatron_1_1integrations_1_1RWKV_1_1PIPELINE" ], + [ "create_engine_vocabulary", "RWKV_8py.html#a2fc99d20bbcc438cc823a728cbc999ea", null ] +]; \ No newline at end of file diff --git a/v0.4.9/RWKV_8py_source.html b/v0.4.9/RWKV_8py_source.html new file mode 100644 index 0000000..b329d7b --- /dev/null +++ b/v0.4.9/RWKV_8py_source.html @@ -0,0 +1,274 @@ + + + + + + + + +Formatron: src/formatron/integrations/RWKV.py Source File + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
RWKV.py
+
+
+Go to the documentation of this file.
1"""
+
2This module integrates the RWKV library by providing convenience utilities.
+
3"""
+
4import kbnf
+
5import rwkv.utils
+
6from kbnf import Token
+
7
+
8from formatron.config import EngineGenerationConfig
+
9from formatron.formatter import FormatterBuilder
+
10
+
11__all__ = ["create_engine_vocabulary", "PIPELINE", "PIPELINE_ARGS"]
+
12class PIPELINE_ARGS(rwkv.utils.PIPELINE_ARGS):
+
13 """
+
14 A wrapper for the arguments of the pipeline of RWKV.
+
15 """
+
+ +
17 def __init__(self,
+
+
18 temperature=1.0,
+
19 top_p=0.2,
+
20 top_k=0,
+
21 alpha_frequency=0.2,
+
22 alpha_presence=0.2,
+
23 alpha_decay=0.996,
+
24 token_ban=[],
+
25 token_stop=[],
+
26 chunk_len=256,
+
27 engine_gen_config=EngineGenerationConfig()):
+
28 super().__init__(temperature, top_p, top_k, alpha_frequency, alpha_presence, alpha_decay, token_ban, token_stop,
+
29 chunk_len)
+
30 self.engine_gen_config = engine_gen_config
+ +
32
+
33def create_engine_vocabulary(WORD_NAME: str, tokenizer) -> kbnf.Vocabulary: # NOSONAR
+
+
+
34 """
+
35 Create a vocabulary for the KBNF engine.
+
36 """
+
+
37 assert WORD_NAME == 'rwkv_vocab_v20230424', "Only world vocabulary is supported!"
+
38 return kbnf.Vocabulary({k: Token(v) for k, v in tokenizer.idx2token.items()},
+
39 {k: v.decode("UTF-8", errors="replace") for k, v in
+
40 tokenizer.idx2token.items()})
+
41
+
42
+
43class PIPELINE(rwkv.utils.PIPELINE): # NOSONAR
+
+
44 """
+
45 A wrapper for the pipeline of RWKV.
+
46 """
+
+ +
48 def __init__(self, model, WORD_NAME, formatter_builder: FormatterBuilder = None): # NOSONAR
+
+
49 super().__init__(model, WORD_NAME)
+
50 vocabulary = create_engine_vocabulary(WORD_NAME, self.tokenizer)
+
51 formatter = formatter_builder.build(vocabulary, lambda tokens: self.tokenizer.decode(tokens))
+
52 if formatter is not None:
+
53 self.formatter = formatter
+
54 else:
+
55 self.formatter = None
+
56
+
57 def generate(self, ctx, token_count=100, args=PIPELINE_ARGS(), callback=None, state=None):
+
+
+
58 all_tokens = []
+
59 out_last = 0
+
60 out_str = ''
+
61 occurrence = {}
+
62 if args.engine_gen_config.reset_at_beginning and self.formatter and self.formatter.is_completed():
+
63 self.formatter.reset()
+
64 for i in range(token_count):
+
65 # forward & adjust prob.
+
66 tokens = self.encode(ctx) if i == 0 else [token]
+
67 if self.formatter is not None:
+
68 if i == 0 and args.engine_gen_config.read_prompt:
+
69 for token in tokens:
+
70 self.formatter.accept_token(token)
+
71 while len(tokens) > 0:
+
72 out, state = self.model.forward(tokens[:args.chunk_len], state)
+
73 tokens = tokens[args.chunk_len:]
+
74 if self.formatter and self.formatter.is_completed():
+
75 break
+
76 for n in args.token_ban:
+
77 out[n] = -float('inf')
+
78 for n in occurrence:
+
79 out[n] -= (args.alpha_presence + occurrence[n] * args.alpha_frequency)
+
80 if self.formatter is not None:
+
81 formatter = self.formatter
+
82 formatter.compute_allowed_tokens()
+
83 out = out[:len(self.tokenizer.idx2token) + 1] # account for the padding `0` token
+
84 out = formatter.mask_logits(out)
+
85 # sampler
+
86 token = self.sample_logits(out, temperature=args.temperature, top_p=args.top_p, top_k=args.top_k)
+
87 if self.formatter:
+
88 self.formatter.accept_token(token)
+
89 if token in args.token_stop:
+
90 break
+
91 all_tokens += [token]
+
92 for xxx in occurrence:
+
93 occurrence[xxx] *= args.alpha_decay
+
94
+
95 ttt = self.decode([token])
+
96 www = 1
+
97 if ttt in ' \t0123456789':
+
98 www = 0
+
99 if token not in occurrence:
+
100 occurrence[token] = www
+
101 else:
+
102 occurrence[token] += www
+
103 # print(occurrence) # debug
+
104
+
105 # output
+
106 tmp = self.decode(all_tokens[out_last:])
+
107 if '\ufffd' not in tmp: # is valid utf-8 string?
+
108 if callback:
+
109 callback(tmp)
+
110 out_str += tmp
+
111 out_last = i + 1
+
112 if self.formatter and self.formatter.is_completed():
+
113 break
+
114 return out_str
+
+
+
A wrapper for the arguments of the pipeline of RWKV.
Definition RWKV.py:16
+
__init__(self, temperature=1.0, top_p=0.2, top_k=0, alpha_frequency=0.2, alpha_presence=0.2, alpha_decay=0.996, token_ban=[], token_stop=[], chunk_len=256, engine_gen_config=EngineGenerationConfig())
Definition RWKV.py:28
+ +
A wrapper for the pipeline of RWKV.
Definition RWKV.py:47
+ +
generate(self, ctx, token_count=100, args=PIPELINE_ARGS(), callback=None, state=None)
Definition RWKV.py:58
+
__init__(self, model, WORD_NAME, FormatterBuilder formatter_builder=None)
Definition RWKV.py:49
+
Configuration classes for Formatron.
Definition config.py:1
+
This module contains the Formatter class and its related classes.
Definition formatter.py:1
+
kbnf.Vocabulary create_engine_vocabulary(str WORD_NAME, tokenizer)
Create a vocabulary for the KBNF engine.
Definition RWKV.py:37
+ +
+
+ + + + diff --git a/v0.4.9/____init_____8py.html b/v0.4.9/____init_____8py.html new file mode 100644 index 0000000..a5145ae --- /dev/null +++ b/v0.4.9/____init_____8py.html @@ -0,0 +1,147 @@ + + + + + + + + +Formatron: src/formatron/__init__.py File Reference + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+ +
__init__.py File Reference
+
+
+ +

Go to the source code of this file.

+ + + + +

+Namespaces

namespace  formatron
 
+
+
+ + + + diff --git a/v0.4.9/____init_____8py_source.html b/v0.4.9/____init_____8py_source.html new file mode 100644 index 0000000..0fee984 --- /dev/null +++ b/v0.4.9/____init_____8py_source.html @@ -0,0 +1,138 @@ + + + + + + + + +Formatron: src/formatron/__init__.py Source File + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
__init__.py
+
+
+Go to the documentation of this file.
+
+
+ + + + diff --git a/v0.4.9/annotated.html b/v0.4.9/annotated.html new file mode 100644 index 0000000..5373950 --- /dev/null +++ b/v0.4.9/annotated.html @@ -0,0 +1,182 @@ + + + + + + + + +Formatron: Class List + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Class List
+
+
+
Here are the classes, structs, unions and interfaces with brief descriptions:
+
[detail level 1234]
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 Nformatron
 NconfigConfiguration classes for Formatron
 CEngineGenerationConfigConfiguration for how an KBNF engine should be used in text generation
 NextractorExtractors for extracting data from generated strings
 CChoiceExtractorAn extractor that uses multiple extractors to extract data
 CExtractorAn abstract extractor that extracts data from a string and offers its KBNF rules definition
 CLiteralExtractorAn extractor that extracts a literal string
 CNonterminalExtractorAn extractor that extracts data corresponding to a nonterminal
 CSubstringExtractorAn extractor that extracts a substring of a given string from the input string
 NformatsThis subpackage contains modules that operate with concrete formats, like json
 NjsonThe module defines the JsonExtractor class, which is used to extract data from a string in JSON format
 CJsonExtractorAn extractor that loads json data to an object from a string
 NregexThis module contains the RegexExtractor class, which is used to extract data using a regular expression
 CRegexComplementExtractorAn extractor that extracts data by matching a regex complement
 CRegexExtractorAn extractor that extracts a string using a regular expression
 NformatterThis module contains the Formatter class and its related classes
 CFormatter
 CFormatterBaseAn abstract Formatter that enforces a format on the string generated by a language model
 CFormatterBuilderA builder for creating a Formatter
 NintegrationsThis subpackage contains integrations with other frameworks and libraries
 Nexllamav2This module integrates the ExLlamaV2 library by providing convenience utilities
 CFormatterFilterExLlamaV2Filter that uses a formatter to mask logits
 NRWKVThis module integrates the RWKV library by providing convenience utilities
 CPIPELINEA wrapper for the pipeline of RWKV
 CPIPELINE_ARGSA wrapper for the arguments of the pipeline of RWKV
 NtransformersThis module integrates the transformers library by providing convenience utilities
 CFormattersLogitsProcessorLogit processor that uses formatters to mask batch logits
 NvllmThis module integrates the vllm library by providing convenience utilities
 CFormattersLogitsProcessorLogit processor that uses formatters to mask batch logits
 NschemasThis subpackage contains modules that define schemas creation from various sources
 Ndict_inferenceThis module contains utilities for inferring schemas from dictionaries
 CFieldInfo
 Njson_schemaThis module contains utilities for creating schemas from JSON schemas
 CFieldInfo
 NpydanticA module that implements the Schema interface using pydantic
 CClassSchemaA wrapper for pydantic BaseModel that implements the Schema interface
 CFieldInfoA wrapper for pydantic FieldInfo
 NschemaThis module contains the Schema abstract class and FieldInfo abstract class
 CFieldInfoAn abstract field info that describes a data field in a schema
 CSchemaAn abstract schema that describes some data
 CSubstringOfA metadata class that indicates that the field is a substring of the given string
 CTypeWithMetadataA type with metadata
+
+
+
+ + + + diff --git a/v0.4.9/annotated_dup.js b/v0.4.9/annotated_dup.js new file mode 100644 index 0000000..29d5a02 --- /dev/null +++ b/v0.4.9/annotated_dup.js @@ -0,0 +1,62 @@ +var annotated_dup = +[ + [ "formatron", "namespaceformatron.html", [ + [ "config", "namespaceformatron_1_1config.html", [ + [ "EngineGenerationConfig", "classformatron_1_1config_1_1EngineGenerationConfig.html", "classformatron_1_1config_1_1EngineGenerationConfig" ] + ] ], + [ "extractor", "namespaceformatron_1_1extractor.html", [ + [ "ChoiceExtractor", "classformatron_1_1extractor_1_1ChoiceExtractor.html", "classformatron_1_1extractor_1_1ChoiceExtractor" ], + [ "Extractor", "classformatron_1_1extractor_1_1Extractor.html", "classformatron_1_1extractor_1_1Extractor" ], + [ "LiteralExtractor", "classformatron_1_1extractor_1_1LiteralExtractor.html", "classformatron_1_1extractor_1_1LiteralExtractor" ], + [ "NonterminalExtractor", "classformatron_1_1extractor_1_1NonterminalExtractor.html", "classformatron_1_1extractor_1_1NonterminalExtractor" ], + [ "SubstringExtractor", "classformatron_1_1extractor_1_1SubstringExtractor.html", "classformatron_1_1extractor_1_1SubstringExtractor" ] + ] ], + [ "formats", "namespaceformatron_1_1formats.html", [ + [ "json", "namespaceformatron_1_1formats_1_1json.html", [ + [ "JsonExtractor", "classformatron_1_1formats_1_1json_1_1JsonExtractor.html", "classformatron_1_1formats_1_1json_1_1JsonExtractor" ] + ] ], + [ "regex", "namespaceformatron_1_1formats_1_1regex.html", [ + [ "RegexComplementExtractor", "classformatron_1_1formats_1_1regex_1_1RegexComplementExtractor.html", "classformatron_1_1formats_1_1regex_1_1RegexComplementExtractor" ], + [ "RegexExtractor", "classformatron_1_1formats_1_1regex_1_1RegexExtractor.html", "classformatron_1_1formats_1_1regex_1_1RegexExtractor" ] + ] ] + ] ], + [ "formatter", "namespaceformatron_1_1formatter.html", [ + [ "Formatter", "classformatron_1_1formatter_1_1Formatter.html", "classformatron_1_1formatter_1_1Formatter" ], + [ "FormatterBase", "classformatron_1_1formatter_1_1FormatterBase.html", "classformatron_1_1formatter_1_1FormatterBase" ], + [ "FormatterBuilder", "classformatron_1_1formatter_1_1FormatterBuilder.html", "classformatron_1_1formatter_1_1FormatterBuilder" ] + ] ], + [ "integrations", "namespaceformatron_1_1integrations.html", [ + [ "exllamav2", "namespaceformatron_1_1integrations_1_1exllamav2.html", [ + [ "FormatterFilter", "classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html", "classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter" ] + ] ], + [ "RWKV", "namespaceformatron_1_1integrations_1_1RWKV.html", [ + [ "PIPELINE", "classformatron_1_1integrations_1_1RWKV_1_1PIPELINE.html", "classformatron_1_1integrations_1_1RWKV_1_1PIPELINE" ], + [ "PIPELINE_ARGS", "classformatron_1_1integrations_1_1RWKV_1_1PIPELINE__ARGS.html", "classformatron_1_1integrations_1_1RWKV_1_1PIPELINE__ARGS" ] + ] ], + [ "transformers", "namespaceformatron_1_1integrations_1_1transformers.html", [ + [ "FormattersLogitsProcessor", "classformatron_1_1integrations_1_1transformers_1_1FormattersLogitsProcessor.html", "classformatron_1_1integrations_1_1transformers_1_1FormattersLogitsProcessor" ] + ] ], + [ "vllm", "namespaceformatron_1_1integrations_1_1vllm.html", [ + [ "FormattersLogitsProcessor", "classformatron_1_1integrations_1_1vllm_1_1FormattersLogitsProcessor.html", "classformatron_1_1integrations_1_1vllm_1_1FormattersLogitsProcessor" ] + ] ] + ] ], + [ "schemas", "namespaceformatron_1_1schemas.html", [ + [ "dict_inference", "namespaceformatron_1_1schemas_1_1dict__inference.html", [ + [ "FieldInfo", "classformatron_1_1schemas_1_1dict__inference_1_1FieldInfo.html", "classformatron_1_1schemas_1_1dict__inference_1_1FieldInfo" ] + ] ], + [ "json_schema", "namespaceformatron_1_1schemas_1_1json__schema.html", [ + [ "FieldInfo", "classformatron_1_1schemas_1_1json__schema_1_1FieldInfo.html", "classformatron_1_1schemas_1_1json__schema_1_1FieldInfo" ] + ] ], + [ "pydantic", "namespaceformatron_1_1schemas_1_1pydantic.html", [ + [ "ClassSchema", "classformatron_1_1schemas_1_1pydantic_1_1ClassSchema.html", "classformatron_1_1schemas_1_1pydantic_1_1ClassSchema" ], + [ "FieldInfo", "classformatron_1_1schemas_1_1pydantic_1_1FieldInfo.html", "classformatron_1_1schemas_1_1pydantic_1_1FieldInfo" ] + ] ], + [ "schema", "namespaceformatron_1_1schemas_1_1schema.html", [ + [ "FieldInfo", "classformatron_1_1schemas_1_1schema_1_1FieldInfo.html", "classformatron_1_1schemas_1_1schema_1_1FieldInfo" ], + [ "Schema", "classformatron_1_1schemas_1_1schema_1_1Schema.html", "classformatron_1_1schemas_1_1schema_1_1Schema" ], + [ "SubstringOf", "classformatron_1_1schemas_1_1schema_1_1SubstringOf.html", null ], + [ "TypeWithMetadata", "classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata.html", "classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata" ] + ] ] + ] ] + ] ] +]; \ No newline at end of file diff --git a/v0.4.9/bc_s.png b/v0.4.9/bc_s.png new file mode 100644 index 0000000..224b29a Binary files /dev/null and b/v0.4.9/bc_s.png differ diff --git a/v0.4.9/bc_sd.png b/v0.4.9/bc_sd.png new file mode 100644 index 0000000..31ca888 Binary files /dev/null and b/v0.4.9/bc_sd.png differ diff --git a/v0.4.9/classes.html b/v0.4.9/classes.html new file mode 100644 index 0000000..ec6d86c --- /dev/null +++ b/v0.4.9/classes.html @@ -0,0 +1,169 @@ + + + + + + + + +Formatron: Class Index + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Class Index
+
+
+
C | E | F | J | L | N | P | R | S | T
+ +
+
+ + + + diff --git a/v0.4.9/classformatron_1_1config_1_1EngineGenerationConfig-members.html b/v0.4.9/classformatron_1_1config_1_1EngineGenerationConfig-members.html new file mode 100644 index 0000000..e149ba4 --- /dev/null +++ b/v0.4.9/classformatron_1_1config_1_1EngineGenerationConfig-members.html @@ -0,0 +1,141 @@ + + + + + + + + +Formatron: Member List + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
formatron.config.EngineGenerationConfig Member List
+
+
+ +

This is the complete list of members for formatron.config.EngineGenerationConfig, including all inherited members.

+ + + +
read_promptformatron.config.EngineGenerationConfigstatic
reset_at_beginningformatron.config.EngineGenerationConfigstatic
+
+ + + + diff --git a/v0.4.9/classformatron_1_1config_1_1EngineGenerationConfig.html b/v0.4.9/classformatron_1_1config_1_1EngineGenerationConfig.html new file mode 100644 index 0000000..924a924 --- /dev/null +++ b/v0.4.9/classformatron_1_1config_1_1EngineGenerationConfig.html @@ -0,0 +1,213 @@ + + + + + + + + +Formatron: formatron.config.EngineGenerationConfig Class Reference + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+ +
formatron.config.EngineGenerationConfig Class Reference
+
+
+ +

Configuration for how an KBNF engine should be used in text generation. + More...

+ + + + + + + + +

+Static Public Attributes

bool read_prompt = False
 Whether to accept the prompt tokens when a generation begins.
 
bool reset_at_beginning = True
 Whether to reset the engine when a new generation begins.
 
+

Detailed Description

+

Configuration for how an KBNF engine should be used in text generation.

+ +

Definition at line 14 of file config.py.

+

Member Data Documentation

+ +

◆ read_prompt

+ +
+
+ + + + + +
+ + + + +
bool formatron.config.EngineGenerationConfig.read_prompt = False
+
+static
+
+ +

Whether to accept the prompt tokens when a generation begins.

+ +

Definition at line 21 of file config.py.

+ +
+
+ +

◆ reset_at_beginning

+ +
+
+ + + + + +
+ + + + +
bool formatron.config.EngineGenerationConfig.reset_at_beginning = True
+
+static
+
+ +

Whether to reset the engine when a new generation begins.

+ +

Definition at line 22 of file config.py.

+ +
+
+
The documentation for this class was generated from the following file: +
+
+ + + + diff --git a/v0.4.9/classformatron_1_1config_1_1EngineGenerationConfig.js b/v0.4.9/classformatron_1_1config_1_1EngineGenerationConfig.js new file mode 100644 index 0000000..c82682e --- /dev/null +++ b/v0.4.9/classformatron_1_1config_1_1EngineGenerationConfig.js @@ -0,0 +1,5 @@ +var classformatron_1_1config_1_1EngineGenerationConfig = +[ + [ "read_prompt", "classformatron_1_1config_1_1EngineGenerationConfig.html#af0b93e2a9f55937e342c649c1f177695", null ], + [ "reset_at_beginning", "classformatron_1_1config_1_1EngineGenerationConfig.html#a95ef45b001b9c45f86bd3699a5675ad4", null ] +]; \ No newline at end of file diff --git a/v0.4.9/classformatron_1_1extractor_1_1ChoiceExtractor-members.html b/v0.4.9/classformatron_1_1extractor_1_1ChoiceExtractor-members.html new file mode 100644 index 0000000..e8a11a1 --- /dev/null +++ b/v0.4.9/classformatron_1_1extractor_1_1ChoiceExtractor-members.html @@ -0,0 +1,143 @@ + + + + + + + + +Formatron: Member List + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
formatron.extractor.ChoiceExtractor Member List
+
+
+ +

This is the complete list of members for formatron.extractor.ChoiceExtractor, including all inherited members.

+ + + + + +
__init__(self, typing.Iterable[Extractor] choices, str capture_name, str nonterminal)formatron.extractor.ChoiceExtractor
_choicesformatron.extractor.ChoiceExtractorprotected
extract(self, str input_str)formatron.extractor.ChoiceExtractor
kbnf_definition(self)formatron.extractor.ChoiceExtractor
+
+ + + + diff --git a/v0.4.9/classformatron_1_1extractor_1_1ChoiceExtractor.html b/v0.4.9/classformatron_1_1extractor_1_1ChoiceExtractor.html new file mode 100644 index 0000000..d9a44c4 --- /dev/null +++ b/v0.4.9/classformatron_1_1extractor_1_1ChoiceExtractor.html @@ -0,0 +1,326 @@ + + + + + + + + +Formatron: formatron.extractor.ChoiceExtractor Class Reference + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+ +
formatron.extractor.ChoiceExtractor Class Reference
+
+
+ +

An extractor that uses multiple extractors to extract data. + More...

+
+Inheritance diagram for formatron.extractor.ChoiceExtractor:
+
+
+ + +formatron.extractor.NonterminalExtractor +formatron.extractor.Extractor + +
+ + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 __init__ (self, typing.Iterable[Extractor] choices, str capture_name, str nonterminal)
 Initialize the choice extractor.
 
typing.Optional[tuple[str, typing.Any]] extract (self, str input_str)
 Extract data from the input string using the first succeeding extractor.
 
- Public Member Functions inherited from formatron.extractor.NonterminalExtractor
str nonterminal (self)
 Get the nonterminal of the extractor.
 
str kbnf_reference (self)
 
- Public Member Functions inherited from formatron.extractor.Extractor
 __str__ (self)
 
typing.Optional[str] capture_name (self)
 Get the name of the capture, or None if the extractor does not capture.
 
+ + + + + + + + + +

+Protected Attributes

 _choices
 
- Protected Attributes inherited from formatron.extractor.NonterminalExtractor
 _nonterminal
 
- Protected Attributes inherited from formatron.extractor.Extractor
 _capture_name
 
+ + + +

Properties

str kbnf_definition (self)
 
+

Detailed Description

+

An extractor that uses multiple extractors to extract data.

+

It stops at the first succeeding extractor.

+ +

Definition at line 194 of file extractor.py.

+

Constructor & Destructor Documentation

+ +

◆ __init__()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
formatron.extractor.ChoiceExtractor.__init__ ( self,
typing.Iterable[Extractor] choices,
str capture_name,
str nonterminal )
+
+ +

Initialize the choice extractor.

+
Parameters
+ + + + +
choicesThe extractors to choose from. The order determines the extractors' priority.
capture_nameThe name of the capture, or None if the extractor does not capture.
nonterminalThe nonterminal representing the extractor.
+
+
+ +

Reimplemented from formatron.extractor.NonterminalExtractor.

+ +

Definition at line 204 of file extractor.py.

+ +
+
+

Member Function Documentation

+ +

◆ extract()

+ +
+
+ + + + + + + + + + + +
typing.Optional[tuple[str, typing.Any]] formatron.extractor.ChoiceExtractor.extract ( self,
str input_str )
+
+ +

Extract data from the input string using the first succeeding extractor.

+
Parameters
+ + +
input_strThe input string.
+
+
+
Returns
The remaining string and the extracted data, or None if all extractors failed.
+ +

Reimplemented from formatron.extractor.Extractor.

+ +

Definition at line 216 of file extractor.py.

+ +
+
+ +

◆ kbnf_definition()

+ +
+
+ + + + + + + +
str formatron.extractor.ChoiceExtractor.kbnf_definition ( self)
+
+ +

Reimplemented from formatron.extractor.Extractor.

+ +

Definition at line 231 of file extractor.py.

+ +
+
+

Member Data Documentation

+ +

◆ _choices

+ +
+
+ + + + + +
+ + + + +
formatron.extractor.ChoiceExtractor._choices
+
+protected
+
+ +

Definition at line 206 of file extractor.py.

+ +
+
+
The documentation for this class was generated from the following file: +
+
+ + + + diff --git a/v0.4.9/classformatron_1_1extractor_1_1ChoiceExtractor.js b/v0.4.9/classformatron_1_1extractor_1_1ChoiceExtractor.js new file mode 100644 index 0000000..d4cba72 --- /dev/null +++ b/v0.4.9/classformatron_1_1extractor_1_1ChoiceExtractor.js @@ -0,0 +1,7 @@ +var classformatron_1_1extractor_1_1ChoiceExtractor = +[ + [ "__init__", "classformatron_1_1extractor_1_1ChoiceExtractor.html#a1a91b31475c7348a3cf9fab97c6d26f0", null ], + [ "extract", "classformatron_1_1extractor_1_1ChoiceExtractor.html#acfd6ee4d6b1ea910dd6f89a4c0fca41f", null ], + [ "kbnf_definition", "classformatron_1_1extractor_1_1ChoiceExtractor.html#a5fe06cd727f3313d5e52a7ea6b81d5c4", null ], + [ "_choices", "classformatron_1_1extractor_1_1ChoiceExtractor.html#a6ea971d4c6915dc2b5ece64cd010a087", null ] +]; \ No newline at end of file diff --git a/v0.4.9/classformatron_1_1extractor_1_1ChoiceExtractor.png b/v0.4.9/classformatron_1_1extractor_1_1ChoiceExtractor.png new file mode 100644 index 0000000..3c2b9a9 Binary files /dev/null and b/v0.4.9/classformatron_1_1extractor_1_1ChoiceExtractor.png differ diff --git a/v0.4.9/classformatron_1_1extractor_1_1Extractor-members.html b/v0.4.9/classformatron_1_1extractor_1_1Extractor-members.html new file mode 100644 index 0000000..1b92b2a --- /dev/null +++ b/v0.4.9/classformatron_1_1extractor_1_1Extractor-members.html @@ -0,0 +1,146 @@ + + + + + + + + +Formatron: Member List + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
formatron.extractor.Extractor Member List
+
+
+ +

This is the complete list of members for formatron.extractor.Extractor, including all inherited members.

+ + + + + + + + +
__init__(self, typing.Optional[str] capture_name=None)formatron.extractor.Extractor
__str__(self)formatron.extractor.Extractor
_capture_nameformatron.extractor.Extractorprotected
capture_name(self)formatron.extractor.Extractor
extract(self, str input_str)formatron.extractor.Extractor
kbnf_definition(self)formatron.extractor.Extractor
kbnf_reference(self)formatron.extractor.Extractor
+
+ + + + diff --git a/v0.4.9/classformatron_1_1extractor_1_1Extractor.html b/v0.4.9/classformatron_1_1extractor_1_1Extractor.html new file mode 100644 index 0000000..13d026c --- /dev/null +++ b/v0.4.9/classformatron_1_1extractor_1_1Extractor.html @@ -0,0 +1,368 @@ + + + + + + + + +Formatron: formatron.extractor.Extractor Class Reference + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+ +
formatron.extractor.Extractor Class Reference
+
+
+ +

An abstract extractor that extracts data from a string and offers its KBNF rules definition. + More...

+
+Inheritance diagram for formatron.extractor.Extractor:
+
+
+ + +formatron.extractor.LiteralExtractor +formatron.extractor.NonterminalExtractor +formatron.extractor.ChoiceExtractor +formatron.extractor.SubstringExtractor +formatron.formats.json.JsonExtractor +formatron.formats.regex.RegexComplementExtractor +formatron.formats.regex.RegexExtractor + +
+ + + + + + + + + + + + + + +

+Public Member Functions

 __init__ (self, typing.Optional[str] capture_name=None)
 Initialize an extractor.
 
typing.Optional[tuple[str, typing.Any]] extract (self, str input_str)
 Extract data from the input string, or None if the extraction failed.
 
str kbnf_reference (self)
 
 __str__ (self)
 
str kbnf_definition (self)
 
+ + + +

+Protected Attributes

 _capture_name
 
+ + + + +

Properties

typing.Optional[str] capture_name (self)
 Get the name of the capture, or None if the extractor does not capture.
 
+

Detailed Description

+

An abstract extractor that extracts data from a string and offers its KBNF rules definition.

+ +

Definition at line 14 of file extractor.py.

+

Constructor & Destructor Documentation

+ +

◆ __init__()

+ +
+
+ + + + + + + + + + + +
formatron.extractor.Extractor.__init__ ( self,
typing.Optional[str] capture_name = None )
+
+ +

Initialize an extractor.

+
Parameters
+ + +
capture_nameThe name of the capture, or None if the extractor does not capture.
+
+
+ +

Reimplemented in formatron.extractor.ChoiceExtractor, formatron.extractor.LiteralExtractor, formatron.extractor.NonterminalExtractor, formatron.extractor.SubstringExtractor, formatron.formats.json.JsonExtractor, formatron.formats.regex.RegexComplementExtractor, and formatron.formats.regex.RegexExtractor.

+ +

Definition at line 21 of file extractor.py.

+ +
+
+

Member Function Documentation

+ +

◆ __str__()

+ +
+
+ + + + + + + +
formatron.extractor.Extractor.__str__ ( self)
+
+ +

Definition at line 69 of file extractor.py.

+ +
+
+ +

◆ capture_name()

+ +
+
+ + + + + + + +
typing.Optional[str] formatron.extractor.Extractor.capture_name ( self)
+
+ +

Get the name of the capture, or None if the extractor does not capture.

+ +

Definition at line 35 of file extractor.py.

+ +
+
+ +

◆ extract()

+ +
+
+ + + + + + + + + + + +
typing.Optional[tuple[str, typing.Any]] formatron.extractor.Extractor.extract ( self,
str input_str )
+
+ +

Extract data from the input string, or None if the extraction failed.

+
Parameters
+ + +
input_strThe input string.
+
+
+
Returns
The remaining string and the extracted data, or None if the extraction failed.
+ +

Reimplemented in formatron.extractor.ChoiceExtractor, formatron.extractor.LiteralExtractor, formatron.extractor.SubstringExtractor, formatron.formats.json.JsonExtractor, formatron.formats.regex.RegexComplementExtractor, and formatron.formats.regex.RegexExtractor.

+ +

Definition at line 48 of file extractor.py.

+ +
+
+ +

◆ kbnf_definition()

+ + + +

◆ kbnf_reference()

+ +
+
+ + + + + + + +
str formatron.extractor.Extractor.kbnf_reference ( self)
+
+ +

Reimplemented in formatron.extractor.LiteralExtractor, and formatron.extractor.NonterminalExtractor.

+ +

Definition at line 67 of file extractor.py.

+ +
+
+

Member Data Documentation

+ +

◆ _capture_name

+ +
+
+ + + + + +
+ + + + +
formatron.extractor.Extractor._capture_name
+
+protected
+
+ +

Definition at line 22 of file extractor.py.

+ +
+
+
The documentation for this class was generated from the following file: +
+
+ + + + diff --git a/v0.4.9/classformatron_1_1extractor_1_1Extractor.js b/v0.4.9/classformatron_1_1extractor_1_1Extractor.js new file mode 100644 index 0000000..4cd6703 --- /dev/null +++ b/v0.4.9/classformatron_1_1extractor_1_1Extractor.js @@ -0,0 +1,10 @@ +var classformatron_1_1extractor_1_1Extractor = +[ + [ "__init__", "classformatron_1_1extractor_1_1Extractor.html#a569fc7895a82f4d4b59866719219d4e0", null ], + [ "__str__", "classformatron_1_1extractor_1_1Extractor.html#afe6a1f745fd56540ccff5fdc5d00f0a5", null ], + [ "capture_name", "classformatron_1_1extractor_1_1Extractor.html#abb72e0428a8b5835d075ebd889703e13", null ], + [ "extract", "classformatron_1_1extractor_1_1Extractor.html#a9efb2a75cf5fc5e0919c235aa1435469", null ], + [ "kbnf_definition", "classformatron_1_1extractor_1_1Extractor.html#ae9abcfb6c5bae5b352de8a97f94be049", null ], + [ "kbnf_reference", "classformatron_1_1extractor_1_1Extractor.html#abf347fc566ceca08b0845a5146347a5e", null ], + [ "_capture_name", "classformatron_1_1extractor_1_1Extractor.html#a3299dc34a7276ab8ab553513048211d3", null ] +]; \ No newline at end of file diff --git a/v0.4.9/classformatron_1_1extractor_1_1Extractor.png b/v0.4.9/classformatron_1_1extractor_1_1Extractor.png new file mode 100644 index 0000000..32c8b2b Binary files /dev/null and b/v0.4.9/classformatron_1_1extractor_1_1Extractor.png differ diff --git a/v0.4.9/classformatron_1_1extractor_1_1LiteralExtractor-members.html b/v0.4.9/classformatron_1_1extractor_1_1LiteralExtractor-members.html new file mode 100644 index 0000000..ff3d72b --- /dev/null +++ b/v0.4.9/classformatron_1_1extractor_1_1LiteralExtractor-members.html @@ -0,0 +1,144 @@ + + + + + + + + +Formatron: Member List + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
formatron.extractor.LiteralExtractor Member List
+
+
+ +

This is the complete list of members for formatron.extractor.LiteralExtractor, including all inherited members.

+ + + + + + +
__init__(self, str literal)formatron.extractor.LiteralExtractor
_literalformatron.extractor.LiteralExtractorprotected
extract(self, str input_str)formatron.extractor.LiteralExtractor
kbnf_definition(self)formatron.extractor.LiteralExtractor
kbnf_reference(self)formatron.extractor.LiteralExtractor
+
+ + + + diff --git a/v0.4.9/classformatron_1_1extractor_1_1LiteralExtractor.html b/v0.4.9/classformatron_1_1extractor_1_1LiteralExtractor.html new file mode 100644 index 0000000..656001d --- /dev/null +++ b/v0.4.9/classformatron_1_1extractor_1_1LiteralExtractor.html @@ -0,0 +1,320 @@ + + + + + + + + +Formatron: formatron.extractor.LiteralExtractor Class Reference + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+ +
formatron.extractor.LiteralExtractor Class Reference
+
+
+ +

An extractor that extracts a literal string. + More...

+
+Inheritance diagram for formatron.extractor.LiteralExtractor:
+
+
+ + +formatron.extractor.Extractor + +
+ + + + + + + + + + + + + + +

+Public Member Functions

 __init__ (self, str literal)
 Initialize the literal extractor.
 
typing.Optional[tuple[str, str]] extract (self, str input_str)
 Extract the literal from the input string, or None if the literal is not found.
 
- Public Member Functions inherited from formatron.extractor.Extractor
 __str__ (self)
 
typing.Optional[str] capture_name (self)
 Get the name of the capture, or None if the extractor does not capture.
 
+ + + + + + +

+Protected Attributes

 _literal
 
- Protected Attributes inherited from formatron.extractor.Extractor
 _capture_name
 
+ + + + + +

Properties

str kbnf_reference (self)
 
str kbnf_definition (self)
 
+

Detailed Description

+

An extractor that extracts a literal string.

+ +

Definition at line 143 of file extractor.py.

+

Constructor & Destructor Documentation

+ +

◆ __init__()

+ +
+
+ + + + + + + + + + + +
formatron.extractor.LiteralExtractor.__init__ ( self,
str literal )
+
+ +

Initialize the literal extractor.

+

It never captures since capturing a literal is redundant.

+
Parameters
+ + +
literalThe literal string to extract.
+
+
+ +

Reimplemented from formatron.extractor.Extractor.

+ +

Definition at line 151 of file extractor.py.

+ +
+
+

Member Function Documentation

+ +

◆ extract()

+ +
+
+ + + + + + + + + + + +
typing.Optional[tuple[str, str]] formatron.extractor.LiteralExtractor.extract ( self,
str input_str )
+
+ +

Extract the literal from the input string, or None if the literal is not found.

+ +

Reimplemented from formatron.extractor.Extractor.

+ +

Definition at line 158 of file extractor.py.

+ +
+
+ +

◆ kbnf_definition()

+ +
+
+ + + + + + + +
str formatron.extractor.LiteralExtractor.kbnf_definition ( self)
+
+ +

Reimplemented from formatron.extractor.Extractor.

+ +

Definition at line 185 of file extractor.py.

+ +
+
+ +

◆ kbnf_reference()

+ +
+
+ + + + + + + +
str formatron.extractor.LiteralExtractor.kbnf_reference ( self)
+
+ +

Reimplemented from formatron.extractor.Extractor.

+ +

Definition at line 172 of file extractor.py.

+ +
+
+

Member Data Documentation

+ +

◆ _literal

+ +
+
+ + + + + +
+ + + + +
formatron.extractor.LiteralExtractor._literal
+
+protected
+
+ +

Definition at line 153 of file extractor.py.

+ +
+
+
The documentation for this class was generated from the following file: +
+
+ + + + diff --git a/v0.4.9/classformatron_1_1extractor_1_1LiteralExtractor.js b/v0.4.9/classformatron_1_1extractor_1_1LiteralExtractor.js new file mode 100644 index 0000000..54b36a8 --- /dev/null +++ b/v0.4.9/classformatron_1_1extractor_1_1LiteralExtractor.js @@ -0,0 +1,8 @@ +var classformatron_1_1extractor_1_1LiteralExtractor = +[ + [ "__init__", "classformatron_1_1extractor_1_1LiteralExtractor.html#ab4da390ad7efaf5a3aab0e0ccb78fab3", null ], + [ "extract", "classformatron_1_1extractor_1_1LiteralExtractor.html#af80f5dc8710b59ced091d9b12afd828c", null ], + [ "kbnf_definition", "classformatron_1_1extractor_1_1LiteralExtractor.html#ada2b4df1008ae73880c5e1d35fca5939", null ], + [ "kbnf_reference", "classformatron_1_1extractor_1_1LiteralExtractor.html#acfc1bf5ad7fc06acef35ad8897ddf273", null ], + [ "_literal", "classformatron_1_1extractor_1_1LiteralExtractor.html#a333e99fa481e15e9d907d35cda8ee728", null ] +]; \ No newline at end of file diff --git a/v0.4.9/classformatron_1_1extractor_1_1LiteralExtractor.png b/v0.4.9/classformatron_1_1extractor_1_1LiteralExtractor.png new file mode 100644 index 0000000..5d5bcb2 Binary files /dev/null and b/v0.4.9/classformatron_1_1extractor_1_1LiteralExtractor.png differ diff --git a/v0.4.9/classformatron_1_1extractor_1_1NonterminalExtractor-members.html b/v0.4.9/classformatron_1_1extractor_1_1NonterminalExtractor-members.html new file mode 100644 index 0000000..026c104 --- /dev/null +++ b/v0.4.9/classformatron_1_1extractor_1_1NonterminalExtractor-members.html @@ -0,0 +1,143 @@ + + + + + + + + +Formatron: Member List + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
formatron.extractor.NonterminalExtractor Member List
+
+
+ +

This is the complete list of members for formatron.extractor.NonterminalExtractor, including all inherited members.

+ + + + + +
__init__(self, str nonterminal, typing.Optional[str] capture_name=None)formatron.extractor.NonterminalExtractor
_nonterminalformatron.extractor.NonterminalExtractorprotected
kbnf_reference(self)formatron.extractor.NonterminalExtractor
nonterminal(self)formatron.extractor.NonterminalExtractor
+
+ + + + diff --git a/v0.4.9/classformatron_1_1extractor_1_1NonterminalExtractor.html b/v0.4.9/classformatron_1_1extractor_1_1NonterminalExtractor.html new file mode 100644 index 0000000..6416dff --- /dev/null +++ b/v0.4.9/classformatron_1_1extractor_1_1NonterminalExtractor.html @@ -0,0 +1,301 @@ + + + + + + + + +Formatron: formatron.extractor.NonterminalExtractor Class Reference + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+ +
formatron.extractor.NonterminalExtractor Class Reference
+
+
+ +

An extractor that extracts data corresponding to a nonterminal. + More...

+
+Inheritance diagram for formatron.extractor.NonterminalExtractor:
+
+
+ + +formatron.extractor.Extractor +formatron.extractor.ChoiceExtractor +formatron.extractor.SubstringExtractor +formatron.formats.json.JsonExtractor +formatron.formats.regex.RegexComplementExtractor +formatron.formats.regex.RegexExtractor + +
+ + + + + + + + + + + + + + + + +

+Public Member Functions

 __init__ (self, str nonterminal, typing.Optional[str] capture_name=None)
 Initialize the nonterminal extractor.
 
- Public Member Functions inherited from formatron.extractor.Extractor
typing.Optional[tuple[str, typing.Any]] extract (self, str input_str)
 Extract data from the input string, or None if the extraction failed.
 
 __str__ (self)
 
str kbnf_definition (self)
 
typing.Optional[str] capture_name (self)
 Get the name of the capture, or None if the extractor does not capture.
 
+ + + + + + +

+Protected Attributes

 _nonterminal
 
- Protected Attributes inherited from formatron.extractor.Extractor
 _capture_name
 
+ + + + + + +

Properties

str nonterminal (self)
 Get the nonterminal of the extractor.
 
str kbnf_reference (self)
 
+

Detailed Description

+

An extractor that extracts data corresponding to a nonterminal.

+ +

Definition at line 98 of file extractor.py.

+

Constructor & Destructor Documentation

+ +

◆ __init__()

+ +
+
+ + + + + + + + + + + + + + + + +
formatron.extractor.NonterminalExtractor.__init__ ( self,
str nonterminal,
typing.Optional[str] capture_name = None )
+
+
+

Member Function Documentation

+ +

◆ kbnf_reference()

+ +
+
+ + + + + + + +
str formatron.extractor.NonterminalExtractor.kbnf_reference ( self)
+
+ +

Reimplemented from formatron.extractor.Extractor.

+ +

Definition at line 134 of file extractor.py.

+ +
+
+ +

◆ nonterminal()

+ +
+
+ + + + + + + +
str formatron.extractor.NonterminalExtractor.nonterminal ( self)
+
+ +

Get the nonterminal of the extractor.

+ +

Definition at line 121 of file extractor.py.

+ +
+
+

Member Data Documentation

+ +

◆ _nonterminal

+ +
+
+ + + + + +
+ + + + +
formatron.extractor.NonterminalExtractor._nonterminal
+
+protected
+
+ +

Definition at line 106 of file extractor.py.

+ +
+
+
The documentation for this class was generated from the following file: +
+
+ + + + diff --git a/v0.4.9/classformatron_1_1extractor_1_1NonterminalExtractor.js b/v0.4.9/classformatron_1_1extractor_1_1NonterminalExtractor.js new file mode 100644 index 0000000..0d8f3ae --- /dev/null +++ b/v0.4.9/classformatron_1_1extractor_1_1NonterminalExtractor.js @@ -0,0 +1,7 @@ +var classformatron_1_1extractor_1_1NonterminalExtractor = +[ + [ "__init__", "classformatron_1_1extractor_1_1NonterminalExtractor.html#a45c14f79c14b539837ebdd26c3b5567b", null ], + [ "kbnf_reference", "classformatron_1_1extractor_1_1NonterminalExtractor.html#a8c8a8f47ad90f6b9e4206ab6a56f302e", null ], + [ "nonterminal", "classformatron_1_1extractor_1_1NonterminalExtractor.html#a1dd1fabcef2e668d00bf6ebb38dd017f", null ], + [ "_nonterminal", "classformatron_1_1extractor_1_1NonterminalExtractor.html#a5c4c968b45e328b8caa4b2795ecc00fe", null ] +]; \ No newline at end of file diff --git a/v0.4.9/classformatron_1_1extractor_1_1NonterminalExtractor.png b/v0.4.9/classformatron_1_1extractor_1_1NonterminalExtractor.png new file mode 100644 index 0000000..af06c2d Binary files /dev/null and b/v0.4.9/classformatron_1_1extractor_1_1NonterminalExtractor.png differ diff --git a/v0.4.9/classformatron_1_1extractor_1_1SubstringExtractor-members.html b/v0.4.9/classformatron_1_1extractor_1_1SubstringExtractor-members.html new file mode 100644 index 0000000..8885d3e --- /dev/null +++ b/v0.4.9/classformatron_1_1extractor_1_1SubstringExtractor-members.html @@ -0,0 +1,145 @@ + + + + + + + + +Formatron: Member List + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
formatron.extractor.SubstringExtractor Member List
+
+
+ +

This is the complete list of members for formatron.extractor.SubstringExtractor, including all inherited members.

+ + + + + + + +
__init__(self, str string, str capture_name, str nonterminal, *, bool extract_empty_substring=False)formatron.extractor.SubstringExtractor
_stringformatron.extractor.SubstringExtractorprotected
_suffix_automatonformatron.extractor.SubstringExtractorprotected
extract(self, str input_str)formatron.extractor.SubstringExtractor
extract_empty_substringformatron.extractor.SubstringExtractor
kbnf_definition(self)formatron.extractor.SubstringExtractor
+
+ + + + diff --git a/v0.4.9/classformatron_1_1extractor_1_1SubstringExtractor.html b/v0.4.9/classformatron_1_1extractor_1_1SubstringExtractor.html new file mode 100644 index 0000000..bbb79ce --- /dev/null +++ b/v0.4.9/classformatron_1_1extractor_1_1SubstringExtractor.html @@ -0,0 +1,378 @@ + + + + + + + + +Formatron: formatron.extractor.SubstringExtractor Class Reference + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+ +
formatron.extractor.SubstringExtractor Class Reference
+
+
+ +

An extractor that extracts a substring of a given string from the input string. + More...

+
+Inheritance diagram for formatron.extractor.SubstringExtractor:
+
+
+ + +formatron.extractor.NonterminalExtractor +formatron.extractor.Extractor + +
+ + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 __init__ (self, str string, str capture_name, str nonterminal, *, bool extract_empty_substring=False)
 Initialize the substring extractor.
 
typing.Optional[tuple[str, str]] extract (self, str input_str)
 Extract the longest substring of a given string from the input string.
 
- Public Member Functions inherited from formatron.extractor.NonterminalExtractor
str nonterminal (self)
 Get the nonterminal of the extractor.
 
str kbnf_reference (self)
 
- Public Member Functions inherited from formatron.extractor.Extractor
 __str__ (self)
 
typing.Optional[str] capture_name (self)
 Get the name of the capture, or None if the extractor does not capture.
 
+ + + +

+Public Attributes

 extract_empty_substring
 
+ + + + + + + + + + + +

+Protected Attributes

 _suffix_automaton
 
 _string
 
- Protected Attributes inherited from formatron.extractor.NonterminalExtractor
 _nonterminal
 
- Protected Attributes inherited from formatron.extractor.Extractor
 _capture_name
 
+ + + +

Properties

str kbnf_definition (self)
 
+

Detailed Description

+

An extractor that extracts a substring of a given string from the input string.

+ +

Definition at line 240 of file extractor.py.

+

Constructor & Destructor Documentation

+ +

◆ __init__()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
formatron.extractor.SubstringExtractor.__init__ ( self,
str string,
str capture_name,
str nonterminal,
* ,
bool extract_empty_substring = False )
+
+ +

Initialize the substring extractor.

+
Parameters
+ + + + + +
stringThe string to extract.
nonterminalThe nonterminal representing the extractor.
capture_nameThe name of the capture, or None if the extractor does not capture.
extract_empty_substringWhether to extract empty substring as a valid substring.
+
+
+ +

Reimplemented from formatron.extractor.NonterminalExtractor.

+ +

Definition at line 250 of file extractor.py.

+ +
+
+

Member Function Documentation

+ +

◆ extract()

+ +
+
+ + + + + + + + + + + +
typing.Optional[tuple[str, str]] formatron.extractor.SubstringExtractor.extract ( self,
str input_str )
+
+ +

Extract the longest substring of a given string from the input string.

+

If extract_empty_substring is True, empty string is always a valid substring, so the returned string could be empty and None will never be returned. Otherwise, empty string is not a valid substring, so the returned string could not be empty and None will be returned if the input string does not contain the given string.

+ +

Reimplemented from formatron.extractor.Extractor.

+ +

Definition at line 262 of file extractor.py.

+ +
+
+ +

◆ kbnf_definition()

+ +
+
+ + + + + + + +
str formatron.extractor.SubstringExtractor.kbnf_definition ( self)
+
+ +

Reimplemented from formatron.extractor.Extractor.

+ +

Definition at line 285 of file extractor.py.

+ +
+
+

Member Data Documentation

+ +

◆ _string

+ +
+
+ + + + + +
+ + + + +
formatron.extractor.SubstringExtractor._string
+
+protected
+
+ +

Definition at line 253 of file extractor.py.

+ +
+
+ +

◆ _suffix_automaton

+ +
+
+ + + + + +
+ + + + +
formatron.extractor.SubstringExtractor._suffix_automaton
+
+protected
+
+ +

Definition at line 252 of file extractor.py.

+ +
+
+ +

◆ extract_empty_substring

+ +
+
+ + + + +
formatron.extractor.SubstringExtractor.extract_empty_substring
+
+ +

Definition at line 254 of file extractor.py.

+ +
+
+
The documentation for this class was generated from the following file: +
+
+ + + + diff --git a/v0.4.9/classformatron_1_1extractor_1_1SubstringExtractor.js b/v0.4.9/classformatron_1_1extractor_1_1SubstringExtractor.js new file mode 100644 index 0000000..a03e0a4 --- /dev/null +++ b/v0.4.9/classformatron_1_1extractor_1_1SubstringExtractor.js @@ -0,0 +1,9 @@ +var classformatron_1_1extractor_1_1SubstringExtractor = +[ + [ "__init__", "classformatron_1_1extractor_1_1SubstringExtractor.html#a843997315c77b9c7c6eb84ba7e02ff83", null ], + [ "extract", "classformatron_1_1extractor_1_1SubstringExtractor.html#a1263c299229be0cd9d310e8d97401cd9", null ], + [ "kbnf_definition", "classformatron_1_1extractor_1_1SubstringExtractor.html#a13801ce1a7da7bf804317ea15f6e172e", null ], + [ "_string", "classformatron_1_1extractor_1_1SubstringExtractor.html#a3781b75c6c8c12f89fd70ea405e11293", null ], + [ "_suffix_automaton", "classformatron_1_1extractor_1_1SubstringExtractor.html#a97cb3468674873adfc85bc17ff1a9a97", null ], + [ "extract_empty_substring", "classformatron_1_1extractor_1_1SubstringExtractor.html#a46d19c58ebefdba4c325f86c1ff17284", null ] +]; \ No newline at end of file diff --git a/v0.4.9/classformatron_1_1extractor_1_1SubstringExtractor.png b/v0.4.9/classformatron_1_1extractor_1_1SubstringExtractor.png new file mode 100644 index 0000000..91adc84 Binary files /dev/null and b/v0.4.9/classformatron_1_1extractor_1_1SubstringExtractor.png differ diff --git a/v0.4.9/classformatron_1_1formats_1_1json_1_1JsonExtractor-members.html b/v0.4.9/classformatron_1_1formats_1_1json_1_1JsonExtractor-members.html new file mode 100644 index 0000000..b817350 --- /dev/null +++ b/v0.4.9/classformatron_1_1formats_1_1json_1_1JsonExtractor-members.html @@ -0,0 +1,144 @@ + + + + + + + + +Formatron: Member List + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
formatron.formats.json.JsonExtractor Member List
+
+
+ +

This is the complete list of members for formatron.formats.json.JsonExtractor, including all inherited members.

+ + + + + + +
__init__(self, str nonterminal, typing.Optional[str] capture_name, schemas.schema.Schema|collections.abc.Sequence schema, typing.Callable[[str], schemas.schema.Schema] to_object)formatron.formats.json.JsonExtractor
_rule_strformatron.formats.json.JsonExtractorprotected
_to_objectformatron.formats.json.JsonExtractorprotected
extract(self, str input_str)formatron.formats.json.JsonExtractor
kbnf_definition(self)formatron.formats.json.JsonExtractor
+
+ + + + diff --git a/v0.4.9/classformatron_1_1formats_1_1json_1_1JsonExtractor.html b/v0.4.9/classformatron_1_1formats_1_1json_1_1JsonExtractor.html new file mode 100644 index 0000000..8eff974 --- /dev/null +++ b/v0.4.9/classformatron_1_1formats_1_1json_1_1JsonExtractor.html @@ -0,0 +1,408 @@ + + + + + + + + +Formatron: formatron.formats.json.JsonExtractor Class Reference + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+ +
formatron.formats.json.JsonExtractor Class Reference
+
+
+ +

An extractor that loads json data to an object from a string. + More...

+
+Inheritance diagram for formatron.formats.json.JsonExtractor:
+
+
+ + +formatron.extractor.NonterminalExtractor +formatron.extractor.Extractor + +
+ + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 __init__ (self, str nonterminal, typing.Optional[str] capture_name, schemas.schema.Schema|collections.abc.Sequence schema, typing.Callable[[str], schemas.schema.Schema] to_object)
 Create a json extractor from a given schema or a list of supported types.
 
typing.Optional[tuple[str, schemas.schema.Schema]] extract (self, str input_str)
 Extract a schema instance from a string.
 
- Public Member Functions inherited from formatron.extractor.NonterminalExtractor
str nonterminal (self)
 Get the nonterminal of the extractor.
 
str kbnf_reference (self)
 
- Public Member Functions inherited from formatron.extractor.Extractor
 __str__ (self)
 
typing.Optional[str] capture_name (self)
 Get the name of the capture, or None if the extractor does not capture.
 
+ + + + + + + + + + + +

+Protected Attributes

 _to_object
 
 _rule_str
 
- Protected Attributes inherited from formatron.extractor.NonterminalExtractor
 _nonterminal
 
- Protected Attributes inherited from formatron.extractor.Extractor
 _capture_name
 
+ + + +

Properties

 kbnf_definition (self)
 
+

Detailed Description

+

An extractor that loads json data to an object from a string.

+ +

Definition at line 426 of file json.py.

+

Constructor & Destructor Documentation

+ +

◆ __init__()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
formatron.formats.json.JsonExtractor.__init__ ( self,
str nonterminal,
typing.Optional[str] capture_name,
schemas.schema.Schema|collections.abc.Sequence schema,
typing.Callable[[str], schemas.schema.Schema] to_object )
+
+ +

Create a json extractor from a given schema or a list of supported types.

+
   Currently, the following data types are supported:
+
- bool
+
- int
+
    +
  • positive int
  • +
  • negative int
  • +
  • nonnegative int
  • +
  • nonpositive int
    - float
    +
  • +
  • positive float
  • +
  • negative float
  • +
  • nonnegative float
  • +
  • nonpositive float
    - str
    +
  • +
  • optionally with min_length, max_length and pattern constraints
      +
    • length is measured in UTF-8 character number after json parsing
    • +
    • Warning: too large difference between min_length and max_length can lead to enormous memory consumption!
    • +
    • pattern is mutually exclusive with min_length and max_length
    • +
    • pattern will be compiled to a regular expression so all caveats of regular expressions apply
    • +
    • pattern currently is automatically anchored at both ends
    • +
    • the generated json could be invalid if the pattern allows invalid content between the json string's quotes.
        +
      • for example, pattern=".*" will allow '"' to appear in the json string which is forbidden by JSON standard.
      • +
      +
    • +
    +
  • +
  • also supports substring_of constraint which constrains the string to be a substring of a given string
      +
    • the generated json could be invalid if the given string contains invalid content when put into the json string's quotes.
        +
      • for example, substring_of="abc\"" will allow '"' to appear in the json string which is forbidden by JSON standard.
        - NoneType
        +
        - typing.Any
        +
      • +
      +
    • +
    +
  • +
+

Subclasses of collections.abc.Mapping[str,T] and typing.Mapping[str,T] where T is a supported type,

    +
  • Subclasses of collections.abc.Sequence[T] and typing.Sequence[T] where T is a supported type.
      +
    • optionally with minItems, maxItems, prefixItems constraints
    • +
    • Warning: too large difference between minItems and maxItems can lead to very slow performance!
    • +
    • Warning: By json schema definition, prefixItems by default allows additional items and missing items in the prefixItems, which may not be the desired behavior and can lead to very slow performance if prefixItems is long!
    • +
    +
  • +
  • tuple[T1,T2,...] where T1,T2,... are supported types. The order, type and number of elements will be preserved.
  • +
  • typing.Literal[x1,x2,...] where x1, x2, ... are instances of int, string, bool or NoneType, or another typing.Literal[y1,y2,...]
  • +
  • typing.Union[T1,T2,...] where T1,T2,... are supported types.
  • +
  • schemas.Schema where all its fields' data types are supported. Recursive schema definitions are supported as well.
      +
    • Warning: while not required field is supported, they can lead to very slow performance and/or enormous memory consumption if there are too many of them!
    • +
    +
  • +
+
Parameters
+ + + + + +
nonterminalThe nonterminal representing the extractor.
capture_nameThe capture name of the extractor, or None if the extractor does not capture.
schemaThe schema.
to_objectA callable to convert the extracted string to a schema instance.
+
+
+ +

Reimplemented from formatron.extractor.NonterminalExtractor.

+ +

Definition at line 483 of file json.py.

+ +
+
+

Member Function Documentation

+ +

◆ extract()

+ +
+
+ + + + + + + + + + + +
typing.Optional[tuple[str, schemas.schema.Schema]] formatron.formats.json.JsonExtractor.extract ( self,
str input_str )
+
+ +

Extract a schema instance from a string.

+
Parameters
+ + +
input_strThe input string to extract from.
+
+
+
Returns
A tuple of the remaining string and the extracted schema instance, or None if extraction failed.
+ +

Reimplemented from formatron.extractor.Extractor.

+ +

Definition at line 497 of file json.py.

+ +
+
+ +

◆ kbnf_definition()

+ +
+
+ + + + + + + +
formatron.formats.json.JsonExtractor.kbnf_definition ( self)
+
+ +

Reimplemented from formatron.extractor.Extractor.

+ +

Definition at line 551 of file json.py.

+ +
+
+

Member Data Documentation

+ +

◆ _rule_str

+ +
+
+ + + + + +
+ + + + +
formatron.formats.json.JsonExtractor._rule_str
+
+protected
+
+ +

Definition at line 487 of file json.py.

+ +
+
+ +

◆ _to_object

+ +
+
+ + + + + +
+ + + + +
formatron.formats.json.JsonExtractor._to_object
+
+protected
+
+ +

Definition at line 486 of file json.py.

+ +
+
+
The documentation for this class was generated from the following file: +
+
+ + + + diff --git a/v0.4.9/classformatron_1_1formats_1_1json_1_1JsonExtractor.js b/v0.4.9/classformatron_1_1formats_1_1json_1_1JsonExtractor.js new file mode 100644 index 0000000..90fc9ea --- /dev/null +++ b/v0.4.9/classformatron_1_1formats_1_1json_1_1JsonExtractor.js @@ -0,0 +1,8 @@ +var classformatron_1_1formats_1_1json_1_1JsonExtractor = +[ + [ "__init__", "classformatron_1_1formats_1_1json_1_1JsonExtractor.html#a7a51edd3cc7c24370c809d91e07771dc", null ], + [ "extract", "classformatron_1_1formats_1_1json_1_1JsonExtractor.html#a6ad701c17988fe32b164135ebd39c783", null ], + [ "kbnf_definition", "classformatron_1_1formats_1_1json_1_1JsonExtractor.html#ace660f78408893ab8fb7facd410a9d60", null ], + [ "_rule_str", "classformatron_1_1formats_1_1json_1_1JsonExtractor.html#aecf88428e414da080f11ed0ab1e13a65", null ], + [ "_to_object", "classformatron_1_1formats_1_1json_1_1JsonExtractor.html#a2e72d806c8dffc0136231b81eb724355", null ] +]; \ No newline at end of file diff --git a/v0.4.9/classformatron_1_1formats_1_1json_1_1JsonExtractor.png b/v0.4.9/classformatron_1_1formats_1_1json_1_1JsonExtractor.png new file mode 100644 index 0000000..66ed8cc Binary files /dev/null and b/v0.4.9/classformatron_1_1formats_1_1json_1_1JsonExtractor.png differ diff --git a/v0.4.9/classformatron_1_1formats_1_1regex_1_1RegexComplementExtractor-members.html b/v0.4.9/classformatron_1_1formats_1_1regex_1_1RegexComplementExtractor-members.html new file mode 100644 index 0000000..b682e3f --- /dev/null +++ b/v0.4.9/classformatron_1_1formats_1_1regex_1_1RegexComplementExtractor-members.html @@ -0,0 +1,143 @@ + + + + + + + + +Formatron: Member List + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
formatron.formats.regex.RegexComplementExtractor Member List
+
+
+ +

This is the complete list of members for formatron.formats.regex.RegexComplementExtractor, including all inherited members.

+ + + + + +
__init__(self, str regex, str capture_name, str nonterminal)formatron.formats.regex.RegexComplementExtractor
_regexformatron.formats.regex.RegexComplementExtractorprotected
extract(self, str input_str)formatron.formats.regex.RegexComplementExtractor
kbnf_definition(self)formatron.formats.regex.RegexComplementExtractor
+
+ + + + diff --git a/v0.4.9/classformatron_1_1formats_1_1regex_1_1RegexComplementExtractor.html b/v0.4.9/classformatron_1_1formats_1_1regex_1_1RegexComplementExtractor.html new file mode 100644 index 0000000..ebfcd94 --- /dev/null +++ b/v0.4.9/classformatron_1_1formats_1_1regex_1_1RegexComplementExtractor.html @@ -0,0 +1,312 @@ + + + + + + + + +Formatron: formatron.formats.regex.RegexComplementExtractor Class Reference + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+ +
formatron.formats.regex.RegexComplementExtractor Class Reference
+
+
+ +

An extractor that extracts data by matching a regex complement. + More...

+
+Inheritance diagram for formatron.formats.regex.RegexComplementExtractor:
+
+
+ + +formatron.extractor.NonterminalExtractor +formatron.extractor.Extractor + +
+ + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 __init__ (self, str regex, str capture_name, str nonterminal)
 Initialize the regex complement extractor.
 
typing.Optional[tuple[str, str]] extract (self, str input_str)
 Extract the data by matching a regex complement.
 
- Public Member Functions inherited from formatron.extractor.NonterminalExtractor
str nonterminal (self)
 Get the nonterminal of the extractor.
 
str kbnf_reference (self)
 
- Public Member Functions inherited from formatron.extractor.Extractor
 __str__ (self)
 
typing.Optional[str] capture_name (self)
 Get the name of the capture, or None if the extractor does not capture.
 
+ + + + + + + + + +

+Protected Attributes

 _regex
 
- Protected Attributes inherited from formatron.extractor.NonterminalExtractor
 _nonterminal
 
- Protected Attributes inherited from formatron.extractor.Extractor
 _capture_name
 
+ + + +

Properties

str kbnf_definition (self)
 
+

Detailed Description

+

An extractor that extracts data by matching a regex complement.

+ +

Definition at line 59 of file regex.py.

+

Constructor & Destructor Documentation

+ +

◆ __init__()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
formatron.formats.regex.RegexComplementExtractor.__init__ ( self,
str regex,
str capture_name,
str nonterminal )
+
+ +

Initialize the regex complement extractor.

+ +

Reimplemented from formatron.extractor.NonterminalExtractor.

+ +

Definition at line 64 of file regex.py.

+ +
+
+

Member Function Documentation

+ +

◆ extract()

+ +
+
+ + + + + + + + + + + +
typing.Optional[tuple[str, str]] formatron.formats.regex.RegexComplementExtractor.extract ( self,
str input_str )
+
+ +

Extract the data by matching a regex complement.

+
   Specifically, the string until the first character in the first match of the regex is extracted if there is a match,
+   or the entire string is extracted if there is no match.
+
+

Reimplemented from formatron.extractor.Extractor.

+ +

Definition at line 74 of file regex.py.

+ +
+
+ +

◆ kbnf_definition()

+ +
+
+ + + + + + + +
str formatron.formats.regex.RegexComplementExtractor.kbnf_definition ( self)
+
+ +

Reimplemented from formatron.extractor.Extractor.

+ +

Definition at line 88 of file regex.py.

+ +
+
+

Member Data Documentation

+ +

◆ _regex

+ +
+
+ + + + + +
+ + + + +
formatron.formats.regex.RegexComplementExtractor._regex
+
+protected
+
+ +

Definition at line 66 of file regex.py.

+ +
+
+
The documentation for this class was generated from the following file: +
+
+ + + + diff --git a/v0.4.9/classformatron_1_1formats_1_1regex_1_1RegexComplementExtractor.js b/v0.4.9/classformatron_1_1formats_1_1regex_1_1RegexComplementExtractor.js new file mode 100644 index 0000000..72ffb47 --- /dev/null +++ b/v0.4.9/classformatron_1_1formats_1_1regex_1_1RegexComplementExtractor.js @@ -0,0 +1,7 @@ +var classformatron_1_1formats_1_1regex_1_1RegexComplementExtractor = +[ + [ "__init__", "classformatron_1_1formats_1_1regex_1_1RegexComplementExtractor.html#a77937657607e5679dbc52d87ad10bb55", null ], + [ "extract", "classformatron_1_1formats_1_1regex_1_1RegexComplementExtractor.html#ac5574731870b0ceb01a19ca773c6417d", null ], + [ "kbnf_definition", "classformatron_1_1formats_1_1regex_1_1RegexComplementExtractor.html#a57759938dc0088caf94ec2d2dcf19495", null ], + [ "_regex", "classformatron_1_1formats_1_1regex_1_1RegexComplementExtractor.html#a92339b2492a3591a412f177ba5c2e2ec", null ] +]; \ No newline at end of file diff --git a/v0.4.9/classformatron_1_1formats_1_1regex_1_1RegexComplementExtractor.png b/v0.4.9/classformatron_1_1formats_1_1regex_1_1RegexComplementExtractor.png new file mode 100644 index 0000000..86d6260 Binary files /dev/null and b/v0.4.9/classformatron_1_1formats_1_1regex_1_1RegexComplementExtractor.png differ diff --git a/v0.4.9/classformatron_1_1formats_1_1regex_1_1RegexExtractor-members.html b/v0.4.9/classformatron_1_1formats_1_1regex_1_1RegexExtractor-members.html new file mode 100644 index 0000000..81bead1 --- /dev/null +++ b/v0.4.9/classformatron_1_1formats_1_1regex_1_1RegexExtractor-members.html @@ -0,0 +1,143 @@ + + + + + + + + +Formatron: Member List + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
formatron.formats.regex.RegexExtractor Member List
+
+
+ +

This is the complete list of members for formatron.formats.regex.RegexExtractor, including all inherited members.

+ + + + + +
__init__(self, str regex, str capture_name, str nonterminal)formatron.formats.regex.RegexExtractor
_regexformatron.formats.regex.RegexExtractorprotected
extract(self, str input_str)formatron.formats.regex.RegexExtractor
kbnf_definition(self)formatron.formats.regex.RegexExtractor
+
+ + + + diff --git a/v0.4.9/classformatron_1_1formats_1_1regex_1_1RegexExtractor.html b/v0.4.9/classformatron_1_1formats_1_1regex_1_1RegexExtractor.html new file mode 100644 index 0000000..63797e2 --- /dev/null +++ b/v0.4.9/classformatron_1_1formats_1_1regex_1_1RegexExtractor.html @@ -0,0 +1,326 @@ + + + + + + + + +Formatron: formatron.formats.regex.RegexExtractor Class Reference + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+ +
formatron.formats.regex.RegexExtractor Class Reference
+
+
+ +

An extractor that extracts a string using a regular expression. + More...

+
+Inheritance diagram for formatron.formats.regex.RegexExtractor:
+
+
+ + +formatron.extractor.NonterminalExtractor +formatron.extractor.Extractor + +
+ + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 __init__ (self, str regex, str capture_name, str nonterminal)
 Initialize the regex extractor.
 
typing.Optional[tuple[str, re.Match|None]] extract (self, str input_str)
 Extract the string using the regular expression.
 
- Public Member Functions inherited from formatron.extractor.NonterminalExtractor
str nonterminal (self)
 Get the nonterminal of the extractor.
 
str kbnf_reference (self)
 
- Public Member Functions inherited from formatron.extractor.Extractor
 __str__ (self)
 
typing.Optional[str] capture_name (self)
 Get the name of the capture, or None if the extractor does not capture.
 
+ + + + + + + + + +

+Protected Attributes

 _regex
 
- Protected Attributes inherited from formatron.extractor.NonterminalExtractor
 _nonterminal
 
- Protected Attributes inherited from formatron.extractor.Extractor
 _capture_name
 
+ + + +

Properties

str kbnf_definition (self)
 
+

Detailed Description

+

An extractor that extracts a string using a regular expression.

+ +

Definition at line 13 of file regex.py.

+

Constructor & Destructor Documentation

+ +

◆ __init__()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
formatron.formats.regex.RegexExtractor.__init__ ( self,
str regex,
str capture_name,
str nonterminal )
+
+ +

Initialize the regex extractor.

+
Parameters
+ + + + +
regexThe regular expression for extraction.
capture_nameThe name of the capture, or None if the extractor does not capture.
nonterminalThe nonterminal representing the extractor.
+
+
+ +

Reimplemented from formatron.extractor.NonterminalExtractor.

+ +

Definition at line 23 of file regex.py.

+ +
+
+

Member Function Documentation

+ +

◆ extract()

+ +
+
+ + + + + + + + + + + +
typing.Optional[tuple[str, re.Match | None]] formatron.formats.regex.RegexExtractor.extract ( self,
str input_str )
+
+ +

Extract the string using the regular expression.

+

Specifically, the first match(if any) of the regex pattern in the input string is returned.

+
Parameters
+ + +
input_strThe input string.
+
+
+
Returns
The remaining string and the extracted re.Match object, or None if the extraction failed.
+ +

Reimplemented from formatron.extractor.Extractor.

+ +

Definition at line 36 of file regex.py.

+ +
+
+ +

◆ kbnf_definition()

+ +
+
+ + + + + + + +
str formatron.formats.regex.RegexExtractor.kbnf_definition ( self)
+
+ +

Reimplemented from formatron.extractor.Extractor.

+ +

Definition at line 50 of file regex.py.

+ +
+
+

Member Data Documentation

+ +

◆ _regex

+ +
+
+ + + + + +
+ + + + +
formatron.formats.regex.RegexExtractor._regex
+
+protected
+
+ +

Definition at line 25 of file regex.py.

+ +
+
+
The documentation for this class was generated from the following file: +
+
+ + + + diff --git a/v0.4.9/classformatron_1_1formats_1_1regex_1_1RegexExtractor.js b/v0.4.9/classformatron_1_1formats_1_1regex_1_1RegexExtractor.js new file mode 100644 index 0000000..e0fcf11 --- /dev/null +++ b/v0.4.9/classformatron_1_1formats_1_1regex_1_1RegexExtractor.js @@ -0,0 +1,7 @@ +var classformatron_1_1formats_1_1regex_1_1RegexExtractor = +[ + [ "__init__", "classformatron_1_1formats_1_1regex_1_1RegexExtractor.html#a6fc2f05d044cce49935c415248de5e5a", null ], + [ "extract", "classformatron_1_1formats_1_1regex_1_1RegexExtractor.html#a73a98b3762aa24d4319e84c1123493c7", null ], + [ "kbnf_definition", "classformatron_1_1formats_1_1regex_1_1RegexExtractor.html#a7b5fa1eb57e55ccf46d7762e1a6d0b9a", null ], + [ "_regex", "classformatron_1_1formats_1_1regex_1_1RegexExtractor.html#a1df60401933eef6cf5a1ff041f11ec46", null ] +]; \ No newline at end of file diff --git a/v0.4.9/classformatron_1_1formats_1_1regex_1_1RegexExtractor.png b/v0.4.9/classformatron_1_1formats_1_1regex_1_1RegexExtractor.png new file mode 100644 index 0000000..7d3c40d Binary files /dev/null and b/v0.4.9/classformatron_1_1formats_1_1regex_1_1RegexExtractor.png differ diff --git a/v0.4.9/classformatron_1_1formatter_1_1Formatter-members.html b/v0.4.9/classformatron_1_1formatter_1_1Formatter-members.html new file mode 100644 index 0000000..868c140 --- /dev/null +++ b/v0.4.9/classformatron_1_1formatter_1_1Formatter-members.html @@ -0,0 +1,158 @@ + + + + + + + + +Formatron: Member List + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
formatron.formatter.Formatter Member List
+
+
+ +

This is the complete list of members for formatron.formatter.Formatter, including all inherited members.

+ + + + + + + + + + + + + + + + + + + + +
__init__(self, list[Extractor] extractors, kbnf.Engine engine, typing.Callable[[list[int]], str] decode_callback, str grammar_str)formatron.formatter.Formatter
__str__(self)formatron.formatter.Formatter
_capturesformatron.formatter.Formatterprotected
_decode_callbackformatron.formatter.Formatterprotected
_engineformatron.formatter.Formatterprotected
_extractorsformatron.formatter.Formatterprotected
_grammar_strformatron.formatter.Formatterprotected
_obtain_accepted_output(self)formatron.formatter.Formatterprotected
_on_completion(self, str generated_output)formatron.formatter.Formatterprotected
_token_id_or_bytesformatron.formatter.Formatterprotected
accept_bytes(self, bytes _bytes)formatron.formatter.Formatter
accept_token(self, int token_id)formatron.formatter.Formatter
captures(self)formatron.formatter.Formatter
compute_allowed_tokens(self)formatron.formatter.Formatter
get_allowed_tokens_since_last_computation(self)formatron.formatter.Formatter
grammar_str(self)formatron.formatter.Formatter
is_completed(self)formatron.formatter.Formatter
mask_logits(self, logits)formatron.formatter.Formatter
reset(self)formatron.formatter.Formatter
+
+ + + + diff --git a/v0.4.9/classformatron_1_1formatter_1_1Formatter.html b/v0.4.9/classformatron_1_1formatter_1_1Formatter.html new file mode 100644 index 0000000..b07b0c7 --- /dev/null +++ b/v0.4.9/classformatron_1_1formatter_1_1Formatter.html @@ -0,0 +1,743 @@ + + + + + + + + +Formatron: formatron.formatter.Formatter Class Reference + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+ +
formatron.formatter.Formatter Class Reference
+
+
+
+Inheritance diagram for formatron.formatter.Formatter:
+
+
+ + +formatron.formatter.FormatterBase + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 __init__ (self, list[Extractor] extractors, kbnf.Engine engine, typing.Callable[[list[int]], str] decode_callback, str grammar_str)
 Initialize the formatter.
 
kbnf.AcceptTokenResult accept_token (self, int token_id)
 Accept a token from the language model.
 
kbnf.AcceptTokenResult accept_bytes (self, bytes _bytes)
 Accept a bytes object from the language model.
 
None compute_allowed_tokens (self)
 Compute the allowed tokens based on the current state.
 
typing.Any mask_logits (self, logits)
 Mask the logits based on the current state.
 
typing.Sequence[int] get_allowed_tokens_since_last_computation (self)
 Get the allowed tokens since the last computation(in other words, the last call to compute_allowed_tokens).
 
bool is_completed (self)
 Check if the generation is completed.
 
None reset (self)
 Reset the formatter to the initial state.
 
 __str__ (self)
 
+ + + + + + +

+Protected Member Functions

str _obtain_accepted_output (self)
 
None _on_completion (self, str generated_output)
 Perform actions when the generation is completed.
 
+ + + + + + + + + + + + + +

+Protected Attributes

 _extractors
 
 _engine
 
 _token_id_or_bytes
 
 _decode_callback
 
 _grammar_str
 
 _captures
 
+ + + + + + + +

Properties

 grammar_str (self)
 Get the KBNF grammar string.
 
dict[str, typing.Any]|None captures (self)
 Get the captures from the generated string.
 
+

Detailed Description

+
+

Definition at line 112 of file formatter.py.

+

Constructor & Destructor Documentation

+ +

◆ __init__()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
formatron.formatter.Formatter.__init__ ( self,
list[Extractor] extractors,
kbnf.Engine engine,
typing.Callable[[list[int]], str] decode_callback,
str grammar_str )
+
+ +

Initialize the formatter.

+
Parameters
+ + + + + +
extractorsThe matchers to extract data from the generated string.
engineThe KBNF engine to enforce the format.
decode_callbackThe callback to decode the token IDs to a string.
grammar_strThe KBNF grammar string.
+
+
+ +

Definition at line 122 of file formatter.py.

+ +
+
+

Member Function Documentation

+ +

◆ __str__()

+ +
+
+ + + + + + + +
formatron.formatter.Formatter.__str__ ( self)
+
+ +

Definition at line 262 of file formatter.py.

+ +
+
+ +

◆ _obtain_accepted_output()

+ +
+
+ + + + + +
+ + + + + + + +
str formatron.formatter.Formatter._obtain_accepted_output ( self)
+
+protected
+
+ +

Definition at line 155 of file formatter.py.

+ +
+
+ +

◆ _on_completion()

+ +
+
+ + + + + +
+ + + + + + + + + + + +
None formatron.formatter.Formatter._on_completion ( self,
str generated_output )
+
+protected
+
+ +

Perform actions when the generation is completed.

+ +

Reimplemented from formatron.formatter.FormatterBase.

+ +

Definition at line 209 of file formatter.py.

+ +
+
+ +

◆ accept_bytes()

+ +
+
+ + + + + + + + + + + +
kbnf.AcceptTokenResult formatron.formatter.Formatter.accept_bytes ( self,
bytes _bytes )
+
+ +

Accept a bytes object from the language model.

+
Parameters
+ + +
_bytesThe bytes object.
+
+
+ +

Reimplemented from formatron.formatter.FormatterBase.

+ +

Definition at line 184 of file formatter.py.

+ +
+
+ +

◆ accept_token()

+ +
+
+ + + + + + + + + + + +
kbnf.AcceptTokenResult formatron.formatter.Formatter.accept_token ( self,
int token_id )
+
+ +

Accept a token from the language model.

+
Parameters
+ + +
token_idThe token ID.
+
+
+
Returns
The result of accepting the token.
+ +

Reimplemented from formatron.formatter.FormatterBase.

+ +

Definition at line 147 of file formatter.py.

+ +
+
+ +

◆ captures()

+ +
+
+ + + + + + + +
dict[str, typing.Any] | None formatron.formatter.Formatter.captures ( self)
+
+ +

Get the captures from the generated string.

+

Note that the captures are only available for one extractor if:

    +
  • The extractor has a capture name.
  • +
  • Formatter.is_completed() returns True.
  • +
  • The extractor successfully extracts the data.
      +
    • This means the extractor identifies the correct string span to extract and whatever post-processing the extractor does on the extracted string is successful.
    • +
    +
  • +
+

Captures are obtained by calling Extractor.extract method on the generated string in the sequence of extractors appended to the formatter. Note that the previous extractors does not 'see' the semantics of the later extractors. For example, consider the following formatter: python @code f = FormatterBuilder() f.append_line(f"{f.regex('.*?', capture_name='a')}{f.regex('.*', capture_name='b')}") f = f.build() @endcode The b extractor will always corresponding to None because the a extractor will always extract the whole string. This behavior is different from what a typical regular expression engine would do!

+ +

Reimplemented from formatron.formatter.FormatterBase.

+ +

Definition at line 252 of file formatter.py.

+ +
+
+ +

◆ compute_allowed_tokens()

+ +
+
+ + + + + + + +
None formatron.formatter.Formatter.compute_allowed_tokens ( self)
+
+ +

Compute the allowed tokens based on the current state.

+ +

Reimplemented from formatron.formatter.FormatterBase.

+ +

Definition at line 192 of file formatter.py.

+ +
+
+ +

◆ get_allowed_tokens_since_last_computation()

+ +
+
+ + + + + + + +
typing.Sequence[int] formatron.formatter.Formatter.get_allowed_tokens_since_last_computation ( self)
+
+ +

Get the allowed tokens since the last computation(in other words, the last call to compute_allowed_tokens).

+
Returns
The allowed tokens.
+ +

Reimplemented from formatron.formatter.FormatterBase.

+ +

Definition at line 198 of file formatter.py.

+ +
+
+ +

◆ grammar_str()

+ +
+
+ + + + + + + +
formatron.formatter.Formatter.grammar_str ( self)
+
+ +

Get the KBNF grammar string.

+ +

Definition at line 142 of file formatter.py.

+ +
+
+ +

◆ is_completed()

+ +
+
+ + + + + + + +
bool formatron.formatter.Formatter.is_completed ( self)
+
+ +

Check if the generation is completed.

+

This means the generation is ended by the engine. If the generation is ended by integration-specific stop conditions like max_new_tokens, the generation is not considered completed by this method.

+ +

Reimplemented from formatron.formatter.FormatterBase.

+ +

Definition at line 206 of file formatter.py.

+ +
+
+ +

◆ mask_logits()

+ +
+
+ + + + + + + + + + + +
typing.Any formatron.formatter.Formatter.mask_logits ( self,
logits )
+
+ +

Mask the logits based on the current state.

+
Parameters
+ + +
logitsThe logits to mask.
+
+
+
Returns
The masked logits.
+ +

Reimplemented from formatron.formatter.FormatterBase.

+ +

Definition at line 195 of file formatter.py.

+ +
+
+ +

◆ reset()

+ +
+
+ + + + + + + +
None formatron.formatter.Formatter.reset ( self)
+
+ +

Reset the formatter to the initial state.

+ +

Reimplemented from formatron.formatter.FormatterBase.

+ +

Definition at line 257 of file formatter.py.

+ +
+
+

Member Data Documentation

+ +

◆ _captures

+ +
+
+ + + + + +
+ + + + +
formatron.formatter.Formatter._captures
+
+protected
+
+ +

Definition at line 129 of file formatter.py.

+ +
+
+ +

◆ _decode_callback

+ +
+
+ + + + + +
+ + + + +
formatron.formatter.Formatter._decode_callback
+
+protected
+
+ +

Definition at line 127 of file formatter.py.

+ +
+
+ +

◆ _engine

+ +
+
+ + + + + +
+ + + + +
formatron.formatter.Formatter._engine
+
+protected
+
+ +

Definition at line 125 of file formatter.py.

+ +
+
+ +

◆ _extractors

+ +
+
+ + + + + +
+ + + + +
formatron.formatter.Formatter._extractors
+
+protected
+
+ +

Definition at line 124 of file formatter.py.

+ +
+
+ +

◆ _grammar_str

+ +
+
+ + + + + +
+ + + + +
formatron.formatter.Formatter._grammar_str
+
+protected
+
+ +

Definition at line 128 of file formatter.py.

+ +
+
+ +

◆ _token_id_or_bytes

+ +
+
+ + + + + +
+ + + + +
formatron.formatter.Formatter._token_id_or_bytes
+
+protected
+
+ +

Definition at line 126 of file formatter.py.

+ +
+
+
The documentation for this class was generated from the following file: +
+
+ + + + diff --git a/v0.4.9/classformatron_1_1formatter_1_1Formatter.js b/v0.4.9/classformatron_1_1formatter_1_1Formatter.js new file mode 100644 index 0000000..34951ff --- /dev/null +++ b/v0.4.9/classformatron_1_1formatter_1_1Formatter.js @@ -0,0 +1,22 @@ +var classformatron_1_1formatter_1_1Formatter = +[ + [ "__init__", "classformatron_1_1formatter_1_1Formatter.html#a369269f53f32be2f1d92663670354515", null ], + [ "__str__", "classformatron_1_1formatter_1_1Formatter.html#a827c993f0ac74abff6276b3af6058e3f", null ], + [ "_obtain_accepted_output", "classformatron_1_1formatter_1_1Formatter.html#ae4be840a942f608c1a0c256dbf68901b", null ], + [ "_on_completion", "classformatron_1_1formatter_1_1Formatter.html#ac6f7e3f96c6318689c5cd0d44a1cdde7", null ], + [ "accept_bytes", "classformatron_1_1formatter_1_1Formatter.html#a178a37715ce463e6e57c530166c7ec6d", null ], + [ "accept_token", "classformatron_1_1formatter_1_1Formatter.html#a839eb7550ee4afbd305b25ddcca5c4dc", null ], + [ "captures", "classformatron_1_1formatter_1_1Formatter.html#af69cc99bea2c85c4ca5af0ecc01c5db1", null ], + [ "compute_allowed_tokens", "classformatron_1_1formatter_1_1Formatter.html#a538f36e08b749716e6dd4c50679e2ee1", null ], + [ "get_allowed_tokens_since_last_computation", "classformatron_1_1formatter_1_1Formatter.html#a5d565301d527fd3a56ca86a98df9afaf", null ], + [ "grammar_str", "classformatron_1_1formatter_1_1Formatter.html#a2519969e1338beb864169289a6f36bb9", null ], + [ "is_completed", "classformatron_1_1formatter_1_1Formatter.html#ac15aeec180daa5c78ad3c9bd93bd2b5b", null ], + [ "mask_logits", "classformatron_1_1formatter_1_1Formatter.html#a1068b4fa2167039fe04519ec4db65278", null ], + [ "reset", "classformatron_1_1formatter_1_1Formatter.html#a10ff1aac8dcd90e1bd983d2f6580a964", null ], + [ "_captures", "classformatron_1_1formatter_1_1Formatter.html#a43964a72280fd307cd74528657beeca3", null ], + [ "_decode_callback", "classformatron_1_1formatter_1_1Formatter.html#a9535e6eb6b8001d6f5fc90ee549ecacb", null ], + [ "_engine", "classformatron_1_1formatter_1_1Formatter.html#a73ef6ac966b418215e6c216a90520860", null ], + [ "_extractors", "classformatron_1_1formatter_1_1Formatter.html#a77fc80d958ed5878393546c1a24d75e5", null ], + [ "_grammar_str", "classformatron_1_1formatter_1_1Formatter.html#aac1bf058d35745650f1838ea64b66ad2", null ], + [ "_token_id_or_bytes", "classformatron_1_1formatter_1_1Formatter.html#adf232d46083546ae3363e4ce007a335b", null ] +]; \ No newline at end of file diff --git a/v0.4.9/classformatron_1_1formatter_1_1Formatter.png b/v0.4.9/classformatron_1_1formatter_1_1Formatter.png new file mode 100644 index 0000000..3c639a8 Binary files /dev/null and b/v0.4.9/classformatron_1_1formatter_1_1Formatter.png differ diff --git a/v0.4.9/classformatron_1_1formatter_1_1FormatterBase-members.html b/v0.4.9/classformatron_1_1formatter_1_1FormatterBase-members.html new file mode 100644 index 0000000..410c0a4 --- /dev/null +++ b/v0.4.9/classformatron_1_1formatter_1_1FormatterBase-members.html @@ -0,0 +1,148 @@ + + + + + + + + +Formatron: Member List + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
formatron.formatter.FormatterBase Member List
+
+
+ +

This is the complete list of members for formatron.formatter.FormatterBase, including all inherited members.

+ + + + + + + + + + +
_on_completion(self, str generated_output)formatron.formatter.FormatterBaseprotected
accept_bytes(self, bytes _bytes)formatron.formatter.FormatterBase
accept_token(self, int token_id)formatron.formatter.FormatterBase
captures(self)formatron.formatter.FormatterBase
compute_allowed_tokens(self)formatron.formatter.FormatterBase
get_allowed_tokens_since_last_computation(self)formatron.formatter.FormatterBase
is_completed(self)formatron.formatter.FormatterBase
mask_logits(self, logits)formatron.formatter.FormatterBase
reset(self)formatron.formatter.FormatterBase
+
+ + + + diff --git a/v0.4.9/classformatron_1_1formatter_1_1FormatterBase.html b/v0.4.9/classformatron_1_1formatter_1_1FormatterBase.html new file mode 100644 index 0000000..168299e --- /dev/null +++ b/v0.4.9/classformatron_1_1formatter_1_1FormatterBase.html @@ -0,0 +1,444 @@ + + + + + + + + +Formatron: formatron.formatter.FormatterBase Class Reference + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+ +
formatron.formatter.FormatterBase Class Reference
+
+
+ +

An abstract Formatter that enforces a format on the string generated by a language model. + More...

+
+Inheritance diagram for formatron.formatter.FormatterBase:
+
+
+ + +formatron.formatter.Formatter + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 accept_token (self, int token_id)
 Accept a token from the language model.
 
None accept_bytes (self, bytes _bytes)
 Accept a bytes object from the language model.
 
None compute_allowed_tokens (self)
 Compute the allowed tokens based on the current state.
 
typing.Any mask_logits (self, logits)
 Mask the logits based on the current state.
 
typing.Sequence[int] get_allowed_tokens_since_last_computation (self)
 Get the allowed tokens since the last computation(in other words, the last call to compute_allowed_tokens).
 
bool is_completed (self)
 Check if the generated string satisfies the format and hence the generation is completed.
 
dict[str, typing.Any|None] captures (self)
 
None reset (self)
 Reset the formatter to the initial state.
 
+ + + + +

+Protected Member Functions

None _on_completion (self, str generated_output)
 Perform actions when the generation is completed.
 
+

Detailed Description

+

An abstract Formatter that enforces a format on the string generated by a language model.

+ +

Definition at line 24 of file formatter.py.

+

Member Function Documentation

+ +

◆ _on_completion()

+ +
+
+ + + + + +
+ + + + + + + + + + + +
None formatron.formatter.FormatterBase._on_completion ( self,
str generated_output )
+
+protected
+
+ +

Perform actions when the generation is completed.

+ +

Reimplemented in formatron.formatter.Formatter.

+ +

Definition at line 80 of file formatter.py.

+ +
+
+ +

◆ accept_bytes()

+ +
+
+ + + + + + + + + + + +
None formatron.formatter.FormatterBase.accept_bytes ( self,
bytes _bytes )
+
+ +

Accept a bytes object from the language model.

+
Parameters
+ + +
_bytesThe bytes object.
+
+
+ +

Reimplemented in formatron.formatter.Formatter.

+ +

Definition at line 42 of file formatter.py.

+ +
+
+ +

◆ accept_token()

+ +
+
+ + + + + + + + + + + +
formatron.formatter.FormatterBase.accept_token ( self,
int token_id )
+
+ +

Accept a token from the language model.

+
Parameters
+ + +
token_idThe token ID.
+
+
+
Returns
The result of accepting the token.
+ +

Reimplemented in formatron.formatter.Formatter.

+ +

Definition at line 34 of file formatter.py.

+ +
+
+ +

◆ captures()

+ +
+
+ + + + + + + +
dict[str, typing.Any|None] formatron.formatter.FormatterBase.captures ( self)
+
+ +

Reimplemented in formatron.formatter.Formatter.

+ +

Definition at line 98 of file formatter.py.

+ +
+
+ +

◆ compute_allowed_tokens()

+ +
+
+ + + + + + + +
None formatron.formatter.FormatterBase.compute_allowed_tokens ( self)
+
+ +

Compute the allowed tokens based on the current state.

+ +

Reimplemented in formatron.formatter.Formatter.

+ +

Definition at line 48 of file formatter.py.

+ +
+
+ +

◆ get_allowed_tokens_since_last_computation()

+ +
+
+ + + + + + + +
typing.Sequence[int] formatron.formatter.FormatterBase.get_allowed_tokens_since_last_computation ( self)
+
+ +

Get the allowed tokens since the last computation(in other words, the last call to compute_allowed_tokens).

+
Returns
The allowed tokens.
+ +

Reimplemented in formatron.formatter.Formatter.

+ +

Definition at line 66 of file formatter.py.

+ +
+
+ +

◆ is_completed()

+ +
+
+ + + + + + + +
bool formatron.formatter.FormatterBase.is_completed ( self)
+
+ +

Check if the generated string satisfies the format and hence the generation is completed.

+ +

Reimplemented in formatron.formatter.Formatter.

+ +

Definition at line 72 of file formatter.py.

+ +
+
+ +

◆ mask_logits()

+ +
+
+ + + + + + + + + + + +
typing.Any formatron.formatter.FormatterBase.mask_logits ( self,
logits )
+
+ +

Mask the logits based on the current state.

+
Parameters
+ + +
logitsThe logits to mask.
+
+
+
Returns
The masked logits.
+ +

Reimplemented in formatron.formatter.Formatter.

+ +

Definition at line 58 of file formatter.py.

+ +
+
+ +

◆ reset()

+ +
+
+ + + + + + + +
None formatron.formatter.FormatterBase.reset ( self)
+
+ +

Reset the formatter to the initial state.

+ +

Reimplemented in formatron.formatter.Formatter.

+ +

Definition at line 104 of file formatter.py.

+ +
+
+
The documentation for this class was generated from the following file: +
+
+ + + + diff --git a/v0.4.9/classformatron_1_1formatter_1_1FormatterBase.js b/v0.4.9/classformatron_1_1formatter_1_1FormatterBase.js new file mode 100644 index 0000000..9eda475 --- /dev/null +++ b/v0.4.9/classformatron_1_1formatter_1_1FormatterBase.js @@ -0,0 +1,12 @@ +var classformatron_1_1formatter_1_1FormatterBase = +[ + [ "_on_completion", "classformatron_1_1formatter_1_1FormatterBase.html#a469880a21192928e82823cc340a22ce2", null ], + [ "accept_bytes", "classformatron_1_1formatter_1_1FormatterBase.html#ac0f91549079380a53228322dd4473cf1", null ], + [ "accept_token", "classformatron_1_1formatter_1_1FormatterBase.html#a87d1513c3f70fdee18d65fae4f71101d", null ], + [ "captures", "classformatron_1_1formatter_1_1FormatterBase.html#ab6682619840e83727264a945953fe964", null ], + [ "compute_allowed_tokens", "classformatron_1_1formatter_1_1FormatterBase.html#a927b160d994d43c4e38807f94ea69069", null ], + [ "get_allowed_tokens_since_last_computation", "classformatron_1_1formatter_1_1FormatterBase.html#ab77855193118e33bf8247c5709a0f485", null ], + [ "is_completed", "classformatron_1_1formatter_1_1FormatterBase.html#ac9af60077533ed0f3c9f42ee3a132899", null ], + [ "mask_logits", "classformatron_1_1formatter_1_1FormatterBase.html#ae8db7e92a900322ae5aa603b5c8f386f", null ], + [ "reset", "classformatron_1_1formatter_1_1FormatterBase.html#a522c78b1404697a99313f9edffa7a2a4", null ] +]; \ No newline at end of file diff --git a/v0.4.9/classformatron_1_1formatter_1_1FormatterBase.png b/v0.4.9/classformatron_1_1formatter_1_1FormatterBase.png new file mode 100644 index 0000000..6ad4c9b Binary files /dev/null and b/v0.4.9/classformatron_1_1formatter_1_1FormatterBase.png differ diff --git a/v0.4.9/classformatron_1_1formatter_1_1FormatterBuilder-members.html b/v0.4.9/classformatron_1_1formatter_1_1FormatterBuilder-members.html new file mode 100644 index 0000000..8e30457 --- /dev/null +++ b/v0.4.9/classformatron_1_1formatter_1_1FormatterBuilder-members.html @@ -0,0 +1,163 @@ + + + + + + + + +Formatron: Member List + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
formatron.formatter.FormatterBuilder Member List
+
+
+ +

This is the complete list of members for formatron.formatter.FormatterBuilder, including all inherited members.

+ + + + + + + + + + + + + + + + + + + + + + + + + +
__init__(self)formatron.formatter.FormatterBuilder
_add_capture_name(self, NonterminalExtractor extractor)formatron.formatter.FormatterBuilderprotected
_add_extractor(self, str extractor_type, typing.Callable[[str], Extractor] create_extractor)formatron.formatter.FormatterBuilderprotected
_assert_capture_name_valid(self, str capture_name)formatron.formatter.FormatterBuilderprotected
_capture_namesformatron.formatter.FormatterBuilderprotected
_counterformatron.formatter.FormatterBuilderprotected
_create_nonterminal(self, str name)formatron.formatter.FormatterBuilderprotected
_extractorsformatron.formatter.FormatterBuilderprotected
_formatter_builder_counterformatron.formatter.FormatterBuilderprotectedstatic
_instance_idformatron.formatter.FormatterBuilderprotected
_main_ruleformatron.formatter.FormatterBuilderprotected
_nonterminal_to_extractorformatron.formatter.FormatterBuilderprotected
_rulesformatron.formatter.FormatterBuilderprotected
append_line(self, str line)formatron.formatter.FormatterBuilder
append_multiline_str(self, str lines)formatron.formatter.FormatterBuilder
append_str(self, str string)formatron.formatter.FormatterBuilder
build(self, kbnf.Vocabulary vocabulary, typing.Callable[[list[int]], str] decode, kbnf.Config engine_config=None)formatron.formatter.FormatterBuilder
choose(self, *Extractor|str extractors, str capture_name=None)formatron.formatter.FormatterBuilder
extractor(self, typing.Callable[[str], Extractor] create_extractor)formatron.formatter.FormatterBuilder
json(self, typing.Type[Schema]|collections.abc.Sequence schema, *, str capture_name=None)formatron.formatter.FormatterBuilder
regex(self, str regex, *, str capture_name=None)formatron.formatter.FormatterBuilder
regex_complement(self, str regex, *, str capture_name=None)formatron.formatter.FormatterBuilder
str(self, *, typing.Union[str, list[str]] stop=None, typing.Optional[str] capture_name=None)formatron.formatter.FormatterBuilder
substr(self, str string, *, str capture_name=None, bool extract_empty_substring=False)formatron.formatter.FormatterBuilder
+
+ + + + diff --git a/v0.4.9/classformatron_1_1formatter_1_1FormatterBuilder.html b/v0.4.9/classformatron_1_1formatter_1_1FormatterBuilder.html new file mode 100644 index 0000000..a21efde --- /dev/null +++ b/v0.4.9/classformatron_1_1formatter_1_1FormatterBuilder.html @@ -0,0 +1,992 @@ + + + + + + + + +Formatron: formatron.formatter.FormatterBuilder Class Reference + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+ +
formatron.formatter.FormatterBuilder Class Reference
+
+
+ +

A builder for creating a Formatter. + More...

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 __init__ (self)
 Initialize the formatter builder.
 
None append_line (self, str line)
 Append a line to the format.
 
None append_multiline_str (self, str lines)
 Appends a multiline string to the format, preserving the first line's leading whitespaces and remove any common leading whitespaces from subsequent lines.
 
None append_str (self, str string)
 Append a string to the format without any post-processing.
 
ChoiceExtractor choose (self, *Extractor|str extractors, str capture_name=None)
 Create a choice extractor.
 
Extractor extractor (self, typing.Callable[[str], Extractor] create_extractor)
 Create a custom extractor.
 
JsonExtractor json (self, typing.Type[Schema]|collections.abc.Sequence schema, *, str capture_name=None)
 Create a JSON extractor.
 
RegexExtractor regex (self, str regex, *, str capture_name=None)
 Create a regex extractor.
 
RegexComplementExtractor regex_complement (self, str regex, *, str capture_name=None)
 Create a regex complement extractor.
 
Extractor str (self, *, typing.Union[str, list[str]] stop=None, typing.Optional[str] capture_name=None)
 Create a string extractor.
 
Extractor substr (self, str string, *, str capture_name=None, bool extract_empty_substring=False)
 Create a substring extractor.
 
Formatter build (self, kbnf.Vocabulary vocabulary, typing.Callable[[list[int]], str] decode, kbnf.Config engine_config=None)
 Build a formatter from the builder.
 
+ + + + + + + + + +

+Protected Member Functions

 _assert_capture_name_valid (self, str capture_name)
 
str _create_nonterminal (self, str name)
 
None _add_capture_name (self, NonterminalExtractor extractor)
 
 _add_extractor (self, str extractor_type, typing.Callable[[str], Extractor] create_extractor)
 
+ + + + + + + + + + + + + + + +

+Protected Attributes

 _counter
 
 _main_rule
 
 _rules
 
 _capture_names
 
 _nonterminal_to_extractor
 
 _extractors
 
 _instance_id
 
+ + + +

+Static Protected Attributes

int _formatter_builder_counter
 
+

Detailed Description

+

A builder for creating a Formatter.

+ +

Definition at line 274 of file formatter.py.

+

Constructor & Destructor Documentation

+ +

◆ __init__()

+ +
+
+ + + + + + + +
formatron.formatter.FormatterBuilder.__init__ ( self)
+
+ +

Initialize the formatter builder.

+ +

Definition at line 283 of file formatter.py.

+ +
+
+

Member Function Documentation

+ +

◆ _add_capture_name()

+ +
+
+ + + + + +
+ + + + + + + + + + + +
None formatron.formatter.FormatterBuilder._add_capture_name ( self,
NonterminalExtractor extractor )
+
+protected
+
+ +

Definition at line 369 of file formatter.py.

+ +
+
+ +

◆ _add_extractor()

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + +
formatron.formatter.FormatterBuilder._add_extractor ( self,
str extractor_type,
typing.Callable[[str], Extractor] create_extractor )
+
+protected
+
+ +

Definition at line 395 of file formatter.py.

+ +
+
+ +

◆ _assert_capture_name_valid()

+ +
+
+ + + + + +
+ + + + + + + + + + + +
formatron.formatter.FormatterBuilder._assert_capture_name_valid ( self,
str capture_name )
+
+protected
+
+ +

Definition at line 294 of file formatter.py.

+ +
+
+ +

◆ _create_nonterminal()

+ +
+
+ + + + + +
+ + + + + + + + + + + +
str formatron.formatter.FormatterBuilder._create_nonterminal ( self,
str name )
+
+protected
+
+ +

Definition at line 364 of file formatter.py.

+ +
+
+ +

◆ append_line()

+ +
+
+ + + + + + + + + + + +
None formatron.formatter.FormatterBuilder.append_line ( self,
str line )
+
+ +

Append a line to the format.

+

Specifically, a newline character is appended to the input.

   Note that if you need a literal `$`, you need to escape it by adding a backslash: `\\$`.
+
+

Definition at line 305 of file formatter.py.

+ +
+
+ +

◆ append_multiline_str()

+ +
+
+ + + + + + + + + + + +
None formatron.formatter.FormatterBuilder.append_multiline_str ( self,
str lines )
+
+ +

Appends a multiline string to the format, preserving the first line's leading whitespaces and remove any common leading whitespaces from subsequent lines.

+

Note that tabs and spaces are both treated as whitespace, but they are not equal: the lines " hello" and "\\thello" are considered to have no common leading whitespace.

+

Entirely blank lines are normalized to a newline character.

+

Note that if you need a literal $, you need to escape it by adding a backslash: \\$.

+ +

Definition at line 319 of file formatter.py.

+ +
+
+ +

◆ append_str()

+ +
+
+ + + + + + + + + + + +
None formatron.formatter.FormatterBuilder.append_str ( self,
str string )
+
+ +

Append a string to the format without any post-processing.

+
   Note that if you need a literal `$`, you need to escape it by adding a backslash: `\\$`.
+
+

Definition at line 328 of file formatter.py.

+ +
+
+ +

◆ build()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
Formatter formatron.formatter.FormatterBuilder.build ( self,
kbnf.Vocabulary vocabulary,
typing.Callable[[list[int]], str] decode,
kbnf.Config engine_config = None )
+
+ +

Build a formatter from the builder.

+

The builder will not be consumed and can be used again.

+
Parameters
+ + + + +
vocabularyThe KBNF engine vocabulary for the formatter.
decodeThe callback to decode the token IDs to a string.
engine_configThe KBNF engine configuration.
+
+
+
Returns
The formatter.
+ +

Definition at line 519 of file formatter.py.

+ +
+
+ +

◆ choose()

+ +
+
+ + + + + + + + + + + + + + + + +
ChoiceExtractor formatron.formatter.FormatterBuilder.choose ( self,
*Extractor | str extractors,
str capture_name = None )
+
+ +

Create a choice extractor.

+
   Check out the ChoiceExtractor docs for more details.
+
Parameters
+ + + +
extractorsThe extractors to choose from.
capture_nameThe capture name of the extractor, or None if the extractor does not capture.
+
+
+
Returns
The choice extractor.
+ +

Definition at line 385 of file formatter.py.

+ +
+
+ +

◆ extractor()

+ +
+
+ + + + + + + + + + + +
Extractor formatron.formatter.FormatterBuilder.extractor ( self,
typing.Callable[[str], Extractor] create_extractor )
+
+ +

Create a custom extractor.

+
Parameters
+ + +
create_extractorcallable with signature (extractor_nonterminal: str)->Extractor that create the extractor. extractor_nonterminal is the auto-generated nonterminal reference for the extractor.
+
+
+ +

Definition at line 411 of file formatter.py.

+ +
+
+ +

◆ json()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
JsonExtractor formatron.formatter.FormatterBuilder.json ( self,
typing.Type[Schema]|collections.abc.Sequence schema,
* ,
str capture_name = None )
+
+ +

Create a JSON extractor.

+

Check out the JsonExtractor docs for more details.

+
Parameters
+ + + +
schemaThe schema for extraction.
capture_nameThe capture name of the extractor, or None if the extractor does not capture.
+
+
+
Returns
The JSON extractor.
+ +

Definition at line 423 of file formatter.py.

+ +
+
+ +

◆ regex()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
RegexExtractor formatron.formatter.FormatterBuilder.regex ( self,
str regex,
* ,
str capture_name = None )
+
+ +

Create a regex extractor.

+
   Check out the RegexExtractor docs for more details.
+
Parameters
+ + + +
regexThe regular expression for extraction.
capture_nameThe capture name of the extractor, or None if the extractor does not capture.
+
+
+
Returns
The regex extractor.
+ +

Definition at line 449 of file formatter.py.

+ +
+
+ +

◆ regex_complement()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
RegexComplementExtractor formatron.formatter.FormatterBuilder.regex_complement ( self,
str regex,
* ,
str capture_name = None )
+
+ +

Create a regex complement extractor.

+

This is roughly equivalent to 'extract a string that does not match the given regex anywhere'.

   Check out the RegexComplementExtractor docs for more details.
+
Parameters
+ + + +
regexThe regular expression for extraction.
capture_nameThe capture name of the extractor, or None if the extractor does not capture.
+
+
+
Returns
The regex complement extractor.
+ +

Definition at line 464 of file formatter.py.

+ +
+
+ +

◆ str()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
Extractor formatron.formatter.FormatterBuilder.str ( self,
* ,
typing.Union[str, list[str]] stop = None,
typing.Optional[str] capture_name = None )
+
+ +

Create a string extractor.

+
   The extractor will extract all text until(inclusive) one of the stop strings is encountered.
+
Parameters
+ + + +
stopThe strings for the extractors to stop at. They will be included in text generation and extraction.
capture_nameThe capture name of the extractor, or None if the extractor does not capture.
+
+
+
Returns
The string extractor.
+ +

Definition at line 479 of file formatter.py.

+ +
+
+ +

◆ substr()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Extractor formatron.formatter.FormatterBuilder.substr ( self,
str string,
* ,
str capture_name = None,
bool extract_empty_substring = False )
+
+ +

Create a substring extractor.

+
   The extractor will extract a substring of the input string.
+
Parameters
+ + + + +
stringThe string to extract.
capture_nameThe capture name of the extractor, or None if the extractor does not capture.
extract_empty_substringWhether to extract an empty substring as a valid substring.
+
+
+
Returns
The substring extractor.
+ +

Definition at line 502 of file formatter.py.

+ +
+
+

Member Data Documentation

+ +

◆ _capture_names

+ +
+
+ + + + + +
+ + + + +
formatron.formatter.FormatterBuilder._capture_names
+
+protected
+
+ +

Definition at line 287 of file formatter.py.

+ +
+
+ +

◆ _counter

+ +
+
+ + + + + +
+ + + + +
formatron.formatter.FormatterBuilder._counter
+
+protected
+
+ +

Definition at line 284 of file formatter.py.

+ +
+
+ +

◆ _extractors

+ +
+
+ + + + + +
+ + + + +
formatron.formatter.FormatterBuilder._extractors
+
+protected
+
+ +

Definition at line 289 of file formatter.py.

+ +
+
+ +

◆ _formatter_builder_counter

+ +
+
+ + + + + +
+ + + + +
int formatron.formatter.FormatterBuilder._formatter_builder_counter
+
+staticprotected
+
+ +

Definition at line 278 of file formatter.py.

+ +
+
+ +

◆ _instance_id

+ +
+
+ + + + + +
+ + + + +
formatron.formatter.FormatterBuilder._instance_id
+
+protected
+
+ +

Definition at line 290 of file formatter.py.

+ +
+
+ +

◆ _main_rule

+ +
+
+ + + + + +
+ + + + +
formatron.formatter.FormatterBuilder._main_rule
+
+protected
+
+ +

Definition at line 285 of file formatter.py.

+ +
+
+ +

◆ _nonterminal_to_extractor

+ +
+
+ + + + + +
+ + + + +
formatron.formatter.FormatterBuilder._nonterminal_to_extractor
+
+protected
+
+ +

Definition at line 288 of file formatter.py.

+ +
+
+ +

◆ _rules

+ +
+
+ + + + + +
+ + + + +
formatron.formatter.FormatterBuilder._rules
+
+protected
+
+ +

Definition at line 286 of file formatter.py.

+ +
+
+
The documentation for this class was generated from the following file: +
+
+ + + + diff --git a/v0.4.9/classformatron_1_1formatter_1_1FormatterBuilder.js b/v0.4.9/classformatron_1_1formatter_1_1FormatterBuilder.js new file mode 100644 index 0000000..00679b5 --- /dev/null +++ b/v0.4.9/classformatron_1_1formatter_1_1FormatterBuilder.js @@ -0,0 +1,27 @@ +var classformatron_1_1formatter_1_1FormatterBuilder = +[ + [ "__init__", "classformatron_1_1formatter_1_1FormatterBuilder.html#abb13104747355cae16e6ad0c3067fac8", null ], + [ "_add_capture_name", "classformatron_1_1formatter_1_1FormatterBuilder.html#a1e97daf55b4149be6aaa5dd747ed6146", null ], + [ "_add_extractor", "classformatron_1_1formatter_1_1FormatterBuilder.html#a6e495e90b9da81108b6627166872bbbb", null ], + [ "_assert_capture_name_valid", "classformatron_1_1formatter_1_1FormatterBuilder.html#ab5ad5186f55d35e3abd2d5c213302a25", null ], + [ "_create_nonterminal", "classformatron_1_1formatter_1_1FormatterBuilder.html#aefe18951a4dc243909a22dd49b62fe21", null ], + [ "append_line", "classformatron_1_1formatter_1_1FormatterBuilder.html#aa57e56f8d74b03eb4559106d189970c3", null ], + [ "append_multiline_str", "classformatron_1_1formatter_1_1FormatterBuilder.html#a0e4da27aacaa16880ed463a9f86edff4", null ], + [ "append_str", "classformatron_1_1formatter_1_1FormatterBuilder.html#a171eca2a241aaf0f5f1fa8c117694337", null ], + [ "build", "classformatron_1_1formatter_1_1FormatterBuilder.html#aae2d235fef43c64305c076edbed41da5", null ], + [ "choose", "classformatron_1_1formatter_1_1FormatterBuilder.html#a5594cefa0b28af7f159f374486e51618", null ], + [ "extractor", "classformatron_1_1formatter_1_1FormatterBuilder.html#a8b6c87737912e390a1411d0b85080947", null ], + [ "json", "classformatron_1_1formatter_1_1FormatterBuilder.html#ad2a182c94ddec53d22aefe64f57d6514", null ], + [ "regex", "classformatron_1_1formatter_1_1FormatterBuilder.html#af34f97f7f62d2a1de4f9e863b1834619", null ], + [ "regex_complement", "classformatron_1_1formatter_1_1FormatterBuilder.html#a60dedc5c21ecd24f6b0435bc0d936838", null ], + [ "str", "classformatron_1_1formatter_1_1FormatterBuilder.html#ad467a40f82a47dff9bb2b95d1300ace0", null ], + [ "substr", "classformatron_1_1formatter_1_1FormatterBuilder.html#ab98ad2c47fcb7be56521d3eadb4e643b", null ], + [ "_capture_names", "classformatron_1_1formatter_1_1FormatterBuilder.html#a68daf6b6bbd2f32843352dc6ea1f4b8f", null ], + [ "_counter", "classformatron_1_1formatter_1_1FormatterBuilder.html#a937af7ea452c8183053dc3e12cd44e1c", null ], + [ "_extractors", "classformatron_1_1formatter_1_1FormatterBuilder.html#a4c10094d828cde5bf73bbd5d3d11e582", null ], + [ "_formatter_builder_counter", "classformatron_1_1formatter_1_1FormatterBuilder.html#aa8758ea6ca6a84da7583b28522e447a9", null ], + [ "_instance_id", "classformatron_1_1formatter_1_1FormatterBuilder.html#a8a5b16f094013fb3926acfadd30c4456", null ], + [ "_main_rule", "classformatron_1_1formatter_1_1FormatterBuilder.html#a3c3ba1934b9207c412202c5ef29b002a", null ], + [ "_nonterminal_to_extractor", "classformatron_1_1formatter_1_1FormatterBuilder.html#a870a5075cfd903c77e5ee58b6c304e03", null ], + [ "_rules", "classformatron_1_1formatter_1_1FormatterBuilder.html#a62c61ad02e40526b73ca460d0cf1d12c", null ] +]; \ No newline at end of file diff --git a/v0.4.9/classformatron_1_1integrations_1_1RWKV_1_1PIPELINE-members.html b/v0.4.9/classformatron_1_1integrations_1_1RWKV_1_1PIPELINE-members.html new file mode 100644 index 0000000..afc19ff --- /dev/null +++ b/v0.4.9/classformatron_1_1integrations_1_1RWKV_1_1PIPELINE-members.html @@ -0,0 +1,142 @@ + + + + + + + + +Formatron: Member List + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
formatron.integrations.RWKV.PIPELINE Member List
+
+
+ +

This is the complete list of members for formatron.integrations.RWKV.PIPELINE, including all inherited members.

+ + + + +
__init__(self, model, WORD_NAME, FormatterBuilder formatter_builder=None)formatron.integrations.RWKV.PIPELINE
formatterformatron.integrations.RWKV.PIPELINE
generate(self, ctx, token_count=100, args=PIPELINE_ARGS(), callback=None, state=None)formatron.integrations.RWKV.PIPELINE
+
+ + + + diff --git a/v0.4.9/classformatron_1_1integrations_1_1RWKV_1_1PIPELINE.html b/v0.4.9/classformatron_1_1integrations_1_1RWKV_1_1PIPELINE.html new file mode 100644 index 0000000..bcb2232 --- /dev/null +++ b/v0.4.9/classformatron_1_1integrations_1_1RWKV_1_1PIPELINE.html @@ -0,0 +1,265 @@ + + + + + + + + +Formatron: formatron.integrations.RWKV.PIPELINE Class Reference + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+ +
formatron.integrations.RWKV.PIPELINE Class Reference
+
+
+ +

A wrapper for the pipeline of RWKV. + More...

+
+Inheritance diagram for formatron.integrations.RWKV.PIPELINE:
+
+
+ +
+ + + + + + +

+Public Member Functions

 __init__ (self, model, WORD_NAME, FormatterBuilder formatter_builder=None)
 
 generate (self, ctx, token_count=100, args=PIPELINE_ARGS(), callback=None, state=None)
 
+ + + +

+Public Attributes

 formatter
 
+

Detailed Description

+

A wrapper for the pipeline of RWKV.

+ +

Definition at line 47 of file RWKV.py.

+

Constructor & Destructor Documentation

+ +

◆ __init__()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
formatron.integrations.RWKV.PIPELINE.__init__ ( self,
model,
WORD_NAME,
FormatterBuilder formatter_builder = None )
+
+ +

Definition at line 49 of file RWKV.py.

+ +
+
+

Member Function Documentation

+ +

◆ generate()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
formatron.integrations.RWKV.PIPELINE.generate ( self,
ctx,
token_count = 100,
args = PIPELINE_ARGS(),
callback = None,
state = None )
+
+ +

Definition at line 58 of file RWKV.py.

+ +
+
+

Member Data Documentation

+ +

◆ formatter

+ +
+
+ + + + +
formatron.integrations.RWKV.PIPELINE.formatter
+
+ +

Definition at line 54 of file RWKV.py.

+ +
+
+
The documentation for this class was generated from the following file: +
+
+ + + + diff --git a/v0.4.9/classformatron_1_1integrations_1_1RWKV_1_1PIPELINE.js b/v0.4.9/classformatron_1_1integrations_1_1RWKV_1_1PIPELINE.js new file mode 100644 index 0000000..5314038 --- /dev/null +++ b/v0.4.9/classformatron_1_1integrations_1_1RWKV_1_1PIPELINE.js @@ -0,0 +1,6 @@ +var classformatron_1_1integrations_1_1RWKV_1_1PIPELINE = +[ + [ "__init__", "classformatron_1_1integrations_1_1RWKV_1_1PIPELINE.html#aa646fb0bf5f3674d1daba91dd0320017", null ], + [ "generate", "classformatron_1_1integrations_1_1RWKV_1_1PIPELINE.html#a96f5091b6a8cc681e698a1a4cecdbd1f", null ], + [ "formatter", "classformatron_1_1integrations_1_1RWKV_1_1PIPELINE.html#a363de79042e852aa9e8388507d29265a", null ] +]; \ No newline at end of file diff --git a/v0.4.9/classformatron_1_1integrations_1_1RWKV_1_1PIPELINE.png b/v0.4.9/classformatron_1_1integrations_1_1RWKV_1_1PIPELINE.png new file mode 100644 index 0000000..864725a Binary files /dev/null and b/v0.4.9/classformatron_1_1integrations_1_1RWKV_1_1PIPELINE.png differ diff --git a/v0.4.9/classformatron_1_1integrations_1_1RWKV_1_1PIPELINE__ARGS-members.html b/v0.4.9/classformatron_1_1integrations_1_1RWKV_1_1PIPELINE__ARGS-members.html new file mode 100644 index 0000000..3d4841a --- /dev/null +++ b/v0.4.9/classformatron_1_1integrations_1_1RWKV_1_1PIPELINE__ARGS-members.html @@ -0,0 +1,141 @@ + + + + + + + + +Formatron: Member List + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
formatron.integrations.RWKV.PIPELINE_ARGS Member List
+
+
+ +

This is the complete list of members for formatron.integrations.RWKV.PIPELINE_ARGS, including all inherited members.

+ + + +
__init__(self, temperature=1.0, top_p=0.2, top_k=0, alpha_frequency=0.2, alpha_presence=0.2, alpha_decay=0.996, token_ban=[], token_stop=[], chunk_len=256, engine_gen_config=EngineGenerationConfig())formatron.integrations.RWKV.PIPELINE_ARGS
engine_gen_configformatron.integrations.RWKV.PIPELINE_ARGS
+
+ + + + diff --git a/v0.4.9/classformatron_1_1integrations_1_1RWKV_1_1PIPELINE__ARGS.html b/v0.4.9/classformatron_1_1integrations_1_1RWKV_1_1PIPELINE__ARGS.html new file mode 100644 index 0000000..d55c109 --- /dev/null +++ b/v0.4.9/classformatron_1_1integrations_1_1RWKV_1_1PIPELINE__ARGS.html @@ -0,0 +1,254 @@ + + + + + + + + +Formatron: formatron.integrations.RWKV.PIPELINE_ARGS Class Reference + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+ +
formatron.integrations.RWKV.PIPELINE_ARGS Class Reference
+
+
+ +

A wrapper for the arguments of the pipeline of RWKV. + More...

+
+Inheritance diagram for formatron.integrations.RWKV.PIPELINE_ARGS:
+
+
+ +
+ + + + +

+Public Member Functions

 __init__ (self, temperature=1.0, top_p=0.2, top_k=0, alpha_frequency=0.2, alpha_presence=0.2, alpha_decay=0.996, token_ban=[], token_stop=[], chunk_len=256, engine_gen_config=EngineGenerationConfig())
 
+ + + +

+Public Attributes

 engine_gen_config
 
+

Detailed Description

+

A wrapper for the arguments of the pipeline of RWKV.

+ +

Definition at line 16 of file RWKV.py.

+

Constructor & Destructor Documentation

+ +

◆ __init__()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
formatron.integrations.RWKV.PIPELINE_ARGS.__init__ ( self,
temperature = 1.0,
top_p = 0.2,
top_k = 0,
alpha_frequency = 0.2,
alpha_presence = 0.2,
alpha_decay = 0.996,
token_ban = [],
token_stop = [],
chunk_len = 256,
engine_gen_config = EngineGenerationConfig() )
+
+ +

Definition at line 18 of file RWKV.py.

+ +
+
+

Member Data Documentation

+ +

◆ engine_gen_config

+ +
+
+ + + + +
formatron.integrations.RWKV.PIPELINE_ARGS.engine_gen_config
+
+ +

Definition at line 31 of file RWKV.py.

+ +
+
+
The documentation for this class was generated from the following file: +
+
+ + + + diff --git a/v0.4.9/classformatron_1_1integrations_1_1RWKV_1_1PIPELINE__ARGS.js b/v0.4.9/classformatron_1_1integrations_1_1RWKV_1_1PIPELINE__ARGS.js new file mode 100644 index 0000000..64a7a9a --- /dev/null +++ b/v0.4.9/classformatron_1_1integrations_1_1RWKV_1_1PIPELINE__ARGS.js @@ -0,0 +1,5 @@ +var classformatron_1_1integrations_1_1RWKV_1_1PIPELINE__ARGS = +[ + [ "__init__", "classformatron_1_1integrations_1_1RWKV_1_1PIPELINE__ARGS.html#a53a892118d9b168024aaa6062f92cd7c", null ], + [ "engine_gen_config", "classformatron_1_1integrations_1_1RWKV_1_1PIPELINE__ARGS.html#a8f7501ec93400a3fbeadfd87a8886860", null ] +]; \ No newline at end of file diff --git a/v0.4.9/classformatron_1_1integrations_1_1RWKV_1_1PIPELINE__ARGS.png b/v0.4.9/classformatron_1_1integrations_1_1RWKV_1_1PIPELINE__ARGS.png new file mode 100644 index 0000000..6e46fb5 Binary files /dev/null and b/v0.4.9/classformatron_1_1integrations_1_1RWKV_1_1PIPELINE__ARGS.png differ diff --git a/v0.4.9/classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter-members.html b/v0.4.9/classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter-members.html new file mode 100644 index 0000000..0c6e2de --- /dev/null +++ b/v0.4.9/classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter-members.html @@ -0,0 +1,156 @@ + + + + + + + + +Formatron: Member List + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
formatron.integrations.exllamav2.FormatterFilter Member List
+
+
+ +

This is the complete list of members for formatron.integrations.exllamav2.FormatterFilter, including all inherited members.

+ + + + + + + + + + + + + + + + + + +
__init__(self, model, tokenizer, FormatterBase formatter, EngineGenerationConfig|None config=None)formatron.integrations.exllamav2.FormatterFilter
_configformatron.integrations.exllamav2.FormatterFilterprotected
_formatterformatron.integrations.exllamav2.FormatterFilterprotected
_pass_tokensformatron.integrations.exllamav2.FormatterFilterprotected
begin(self, str prefix_str)formatron.integrations.exllamav2.FormatterFilter
can_mask_logits(self)formatron.integrations.exllamav2.FormatterFilter
clone(self, c=None)formatron.integrations.exllamav2.FormatterFilter
eos_logitsformatron.integrations.exllamav2.FormatterFilter
feed(self, int token)formatron.integrations.exllamav2.FormatterFilter
formatter_captures(self)formatron.integrations.exllamav2.FormatterFilter
is_completed(self)formatron.integrations.exllamav2.FormatterFilter
mask_logits(self, torch.Tensor logits)formatron.integrations.exllamav2.FormatterFilter
next(self)formatron.integrations.exllamav2.FormatterFilter
next_set(self)formatron.integrations.exllamav2.FormatterFilter
prepare_logit_mask(self)formatron.integrations.exllamav2.FormatterFilter
reset(self)formatron.integrations.exllamav2.FormatterFilter
use_background_worker(self)formatron.integrations.exllamav2.FormatterFilter
+
+ + + + diff --git a/v0.4.9/classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html b/v0.4.9/classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html new file mode 100644 index 0000000..3ede0cf --- /dev/null +++ b/v0.4.9/classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html @@ -0,0 +1,583 @@ + + + + + + + + +Formatron: formatron.integrations.exllamav2.FormatterFilter Class Reference + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+ +
formatron.integrations.exllamav2.FormatterFilter Class Reference
+
+
+ +

ExLlamaV2Filter that uses a formatter to mask logits. + More...

+
+Inheritance diagram for formatron.integrations.exllamav2.FormatterFilter:
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 __init__ (self, model, tokenizer, FormatterBase formatter, EngineGenerationConfig|None config=None)
 
bool is_completed (self)
 Check if the formatter is completed.
 
"FormatterFilter" clone (self, c=None)
 
None begin (self, str prefix_str)
 
None reset (self)
 
 feed (self, int token)
 
typing.Tuple[typing.Set[int], typing.Set[int]] next_set (self)
 
typing.Tuple[typing.Sequence[int], typing.Sequence[int]] next (self)
 
bool use_background_worker (self)
 
bool can_mask_logits (self)
 
 prepare_logit_mask (self)
 
torch.Tensor mask_logits (self, torch.Tensor logits)
 
+ + + +

+Public Attributes

 eos_logits
 
+ + + + + + + +

+Protected Attributes

 _formatter
 
 _config
 
 _pass_tokens
 
+ + + + +

Properties

dict[str, typing.Any] formatter_captures (self)
 Get the captures of the formatter.
 
+

Detailed Description

+

ExLlamaV2Filter that uses a formatter to mask logits.

+ +

Definition at line 59 of file exllamav2.py.

+

Constructor & Destructor Documentation

+ +

◆ __init__()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
formatron.integrations.exllamav2.FormatterFilter.__init__ ( self,
model,
tokenizer,
FormatterBase formatter,
EngineGenerationConfig|None config = None )
+
+ +

Definition at line 61 of file exllamav2.py.

+ +
+
+

Member Function Documentation

+ +

◆ begin()

+ +
+
+ + + + + + + + + + + +
None formatron.integrations.exllamav2.FormatterFilter.begin ( self,
str prefix_str )
+
+ +

Definition at line 89 of file exllamav2.py.

+ +
+
+ +

◆ can_mask_logits()

+ +
+
+ + + + + + + +
bool formatron.integrations.exllamav2.FormatterFilter.can_mask_logits ( self)
+
+ +

Definition at line 129 of file exllamav2.py.

+ +
+
+ +

◆ clone()

+ +
+
+ + + + + + + + + + + +
"FormatterFilter" formatron.integrations.exllamav2.FormatterFilter.clone ( self,
c = None )
+
+ +

Definition at line 77 of file exllamav2.py.

+ +
+
+ +

◆ feed()

+ +
+
+ + + + + + + + + + + +
formatron.integrations.exllamav2.FormatterFilter.feed ( self,
int token )
+
+ +

Definition at line 99 of file exllamav2.py.

+ +
+
+ +

◆ formatter_captures()

+ +
+
+ + + + + + + +
dict[str, typing.Any] formatron.integrations.exllamav2.FormatterFilter.formatter_captures ( self)
+
+ +

Get the captures of the formatter.

+ +

Definition at line 155 of file exllamav2.py.

+ +
+
+ +

◆ is_completed()

+ +
+
+ + + + + + + +
bool formatron.integrations.exllamav2.FormatterFilter.is_completed ( self)
+
+ +

Check if the formatter is completed.

+ +

Definition at line 74 of file exllamav2.py.

+ +
+
+ +

◆ mask_logits()

+ +
+
+ + + + + + + + + + + +
torch.Tensor formatron.integrations.exllamav2.FormatterFilter.mask_logits ( self,
torch.Tensor logits )
+
+ +

Definition at line 136 of file exllamav2.py.

+ +
+
+ +

◆ next()

+ +
+
+ + + + + + + +
typing.Tuple[typing.Sequence[int], typing.Sequence[int]] formatron.integrations.exllamav2.FormatterFilter.next ( self)
+
+ +

Definition at line 115 of file exllamav2.py.

+ +
+
+ +

◆ next_set()

+ +
+
+ + + + + + + +
typing.Tuple[typing.Set[int], typing.Set[int]] formatron.integrations.exllamav2.FormatterFilter.next_set ( self)
+
+ +

Definition at line 106 of file exllamav2.py.

+ +
+
+ +

◆ prepare_logit_mask()

+ +
+
+ + + + + + + +
formatron.integrations.exllamav2.FormatterFilter.prepare_logit_mask ( self)
+
+ +

Definition at line 132 of file exllamav2.py.

+ +
+
+ +

◆ reset()

+ +
+
+ + + + + + + +
None formatron.integrations.exllamav2.FormatterFilter.reset ( self)
+
+ +

Definition at line 96 of file exllamav2.py.

+ +
+
+ +

◆ use_background_worker()

+ +
+
+ + + + + + + +
bool formatron.integrations.exllamav2.FormatterFilter.use_background_worker ( self)
+
+ +

Definition at line 125 of file exllamav2.py.

+ +
+
+

Member Data Documentation

+ +

◆ _config

+ +
+
+ + + + + +
+ + + + +
formatron.integrations.exllamav2.FormatterFilter._config
+
+protected
+
+ +

Definition at line 67 of file exllamav2.py.

+ +
+
+ +

◆ _formatter

+ +
+
+ + + + + +
+ + + + +
formatron.integrations.exllamav2.FormatterFilter._formatter
+
+protected
+
+ +

Definition at line 64 of file exllamav2.py.

+ +
+
+ +

◆ _pass_tokens

+ +
+
+ + + + + +
+ + + + +
formatron.integrations.exllamav2.FormatterFilter._pass_tokens
+
+protected
+
+ +

Definition at line 68 of file exllamav2.py.

+ +
+
+ +

◆ eos_logits

+ +
+
+ + + + +
formatron.integrations.exllamav2.FormatterFilter.eos_logits
+
+ +

Definition at line 69 of file exllamav2.py.

+ +
+
+
The documentation for this class was generated from the following file: +
+
+ + + + diff --git a/v0.4.9/classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.js b/v0.4.9/classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.js new file mode 100644 index 0000000..7a1f033 --- /dev/null +++ b/v0.4.9/classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.js @@ -0,0 +1,20 @@ +var classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter = +[ + [ "__init__", "classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#adc94d2f2ddd06f966dca93079f17df8c", null ], + [ "begin", "classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#a31967e1c243ae325d5bf288c73e6635e", null ], + [ "can_mask_logits", "classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#ad1269fb97cabd3381473bbd15ee59324", null ], + [ "clone", "classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#a6ea0f3a9197afc9dd2b5b808fac2f157", null ], + [ "feed", "classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#a6896753ca9ce0cdb5cf998edd379123e", null ], + [ "formatter_captures", "classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#ac1b4fa75c9e9009bd9990686efe1c2f5", null ], + [ "is_completed", "classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#adadb3652b5250cf08dfe7cc8824e2ec0", null ], + [ "mask_logits", "classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#a7a0e2e459eccf822cf79457a121a3a74", null ], + [ "next", "classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#aaf7f64e93e611f4fc0ca9b7c2196c2f2", null ], + [ "next_set", "classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#ac6f22aff80d80035bdd2118feff9f965", null ], + [ "prepare_logit_mask", "classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#aeb7f169a9c36b793867682069f00e928", null ], + [ "reset", "classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#a984bc61ef20d16e88ffb40aa2f5afcc3", null ], + [ "use_background_worker", "classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#a9aa83a5922cefce88197d2cc3822a0c6", null ], + [ "_config", "classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#ae43a79de8cc0fb018df02e7edab028ee", null ], + [ "_formatter", "classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#a568277b00bef848b3fccbfa7030c435f", null ], + [ "_pass_tokens", "classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#a370eaf641dd803b2759b4e5fc7f74a1c", null ], + [ "eos_logits", "classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#a16819bffd3e4b1bb48e05ac7f696592a", null ] +]; \ No newline at end of file diff --git a/v0.4.9/classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.png b/v0.4.9/classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.png new file mode 100644 index 0000000..82f37a4 Binary files /dev/null and b/v0.4.9/classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.png differ diff --git a/v0.4.9/classformatron_1_1integrations_1_1transformers_1_1FormattersLogitsProcessor-members.html b/v0.4.9/classformatron_1_1integrations_1_1transformers_1_1FormattersLogitsProcessor-members.html new file mode 100644 index 0000000..38a51bd --- /dev/null +++ b/v0.4.9/classformatron_1_1integrations_1_1transformers_1_1FormattersLogitsProcessor-members.html @@ -0,0 +1,148 @@ + + + + + + + + +Formatron: Member List + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
formatron.integrations.transformers.FormattersLogitsProcessor Member List
+
+
+ +

This is the complete list of members for formatron.integrations.transformers.FormattersLogitsProcessor, including all inherited members.

+ + + + + + + + + + +
__call__(self, input_ids, scores)formatron.integrations.transformers.FormattersLogitsProcessor
__init__(self, typing.Sequence[FormatterBase|None] formatters, int eos_token_id, typing.Sequence[EngineGenerationConfig]|None configs=None)formatron.integrations.transformers.FormattersLogitsProcessor
_eos_token_idformatron.integrations.transformers.FormattersLogitsProcessorprotected
_formattersformatron.integrations.transformers.FormattersLogitsProcessorprotected
_last_input_id_lengthformatron.integrations.transformers.FormattersLogitsProcessorprotected
configsformatron.integrations.transformers.FormattersLogitsProcessor
formatters_captures(self)formatron.integrations.transformers.FormattersLogitsProcessor
is_completed(self)formatron.integrations.transformers.FormattersLogitsProcessor
reset(self)formatron.integrations.transformers.FormattersLogitsProcessor
+
+ + + + diff --git a/v0.4.9/classformatron_1_1integrations_1_1transformers_1_1FormattersLogitsProcessor.html b/v0.4.9/classformatron_1_1integrations_1_1transformers_1_1FormattersLogitsProcessor.html new file mode 100644 index 0000000..49b198d --- /dev/null +++ b/v0.4.9/classformatron_1_1integrations_1_1transformers_1_1FormattersLogitsProcessor.html @@ -0,0 +1,405 @@ + + + + + + + + +Formatron: formatron.integrations.transformers.FormattersLogitsProcessor Class Reference + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+ +
formatron.integrations.transformers.FormattersLogitsProcessor Class Reference
+
+
+ +

Logit processor that uses formatters to mask batch logits. + More...

+
+Inheritance diagram for formatron.integrations.transformers.FormattersLogitsProcessor:
+
+
+ +
+ + + + + + + + + + + +

+Public Member Functions

 __init__ (self, typing.Sequence[FormatterBase|None] formatters, int eos_token_id, typing.Sequence[EngineGenerationConfig]|None configs=None)
 
None reset (self)
 
list[bool|None] is_completed (self)
 Check if the formatters are completed.
 
 __call__ (self, input_ids, scores)
 
+ + + +

+Public Attributes

 configs
 
+ + + + + + + +

+Protected Attributes

 _formatters
 
 _eos_token_id
 
 _last_input_id_length
 
+ + + + +

Properties

list[dict[str, typing.Any]|None] formatters_captures (self)
 Get the captures of the formatters.
 
+

Detailed Description

+

Logit processor that uses formatters to mask batch logits.

+ +

Definition at line 74 of file transformers.py.

+

Constructor & Destructor Documentation

+ +

◆ __init__()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
formatron.integrations.transformers.FormattersLogitsProcessor.__init__ ( self,
typing.Sequence[FormatterBase | None] formatters,
int eos_token_id,
typing.Sequence[EngineGenerationConfig] | None configs = None )
+
+ +

Definition at line 76 of file transformers.py.

+ +
+
+

Member Function Documentation

+ +

◆ __call__()

+ +
+
+ + + + + + + + + + + + + + + + +
formatron.integrations.transformers.FormattersLogitsProcessor.__call__ ( self,
input_ids,
scores )
+
+ +

Definition at line 119 of file transformers.py.

+ +
+
+ +

◆ formatters_captures()

+ +
+
+ + + + + + + +
list[dict[str, typing.Any] | None] formatron.integrations.transformers.FormattersLogitsProcessor.formatters_captures ( self)
+
+ +

Get the captures of the formatters.

+

Each element in the list corresponds to the captures of the formatter at the same index. If the formatter is None, the element is None.

+ +

Definition at line 106 of file transformers.py.

+ +
+
+ +

◆ is_completed()

+ +
+
+ + + + + + + +
list[bool | None] formatron.integrations.transformers.FormattersLogitsProcessor.is_completed ( self)
+
+ +

Check if the formatters are completed.

+

Each boolean in the list corresponds to the completion status of the formatter at the same index. If the formatter is None, the element is None.

+ +

Definition at line 116 of file transformers.py.

+ +
+
+ +

◆ reset()

+ +
+
+ + + + + + + +
None formatron.integrations.transformers.FormattersLogitsProcessor.reset ( self)
+
+ +

Definition at line 87 of file transformers.py.

+ +
+
+

Member Data Documentation

+ +

◆ _eos_token_id

+ +
+
+ + + + + +
+ + + + +
formatron.integrations.transformers.FormattersLogitsProcessor._eos_token_id
+
+protected
+
+ +

Definition at line 79 of file transformers.py.

+ +
+
+ +

◆ _formatters

+ +
+
+ + + + + +
+ + + + +
formatron.integrations.transformers.FormattersLogitsProcessor._formatters
+
+protected
+
+ +

Definition at line 78 of file transformers.py.

+ +
+
+ +

◆ _last_input_id_length

+ +
+
+ + + + + +
+ + + + +
formatron.integrations.transformers.FormattersLogitsProcessor._last_input_id_length
+
+protected
+
+ +

Definition at line 80 of file transformers.py.

+ +
+
+ +

◆ configs

+ +
+
+ + + + +
formatron.integrations.transformers.FormattersLogitsProcessor.configs
+
+ +

Definition at line 85 of file transformers.py.

+ +
+
+
The documentation for this class was generated from the following file: +
+
+ + + + diff --git a/v0.4.9/classformatron_1_1integrations_1_1transformers_1_1FormattersLogitsProcessor.js b/v0.4.9/classformatron_1_1integrations_1_1transformers_1_1FormattersLogitsProcessor.js new file mode 100644 index 0000000..a359561 --- /dev/null +++ b/v0.4.9/classformatron_1_1integrations_1_1transformers_1_1FormattersLogitsProcessor.js @@ -0,0 +1,12 @@ +var classformatron_1_1integrations_1_1transformers_1_1FormattersLogitsProcessor = +[ + [ "__init__", "classformatron_1_1integrations_1_1transformers_1_1FormattersLogitsProcessor.html#aa70d2276eeb09fdf53066e4019df79df", null ], + [ "__call__", "classformatron_1_1integrations_1_1transformers_1_1FormattersLogitsProcessor.html#af5ec5643f3c51046cb3b5e73fbb04f2b", null ], + [ "formatters_captures", "classformatron_1_1integrations_1_1transformers_1_1FormattersLogitsProcessor.html#a148e8818c8d198d37e167d7030fa5746", null ], + [ "is_completed", "classformatron_1_1integrations_1_1transformers_1_1FormattersLogitsProcessor.html#a0bf8e8613df954fcad9fb5368d0f7025", null ], + [ "reset", "classformatron_1_1integrations_1_1transformers_1_1FormattersLogitsProcessor.html#a966da36a950eaef6898bcd5ec5841df4", null ], + [ "_eos_token_id", "classformatron_1_1integrations_1_1transformers_1_1FormattersLogitsProcessor.html#a7731ed1ab6807c0de6c29ebfefd6975f", null ], + [ "_formatters", "classformatron_1_1integrations_1_1transformers_1_1FormattersLogitsProcessor.html#a50a0787df5f246965db8481f0700d0b4", null ], + [ "_last_input_id_length", "classformatron_1_1integrations_1_1transformers_1_1FormattersLogitsProcessor.html#a24c02e28fdbae4450af7527f93400fa7", null ], + [ "configs", "classformatron_1_1integrations_1_1transformers_1_1FormattersLogitsProcessor.html#a598fc8c32fb2670796d4ae2186f8a134", null ] +]; \ No newline at end of file diff --git a/v0.4.9/classformatron_1_1integrations_1_1transformers_1_1FormattersLogitsProcessor.png b/v0.4.9/classformatron_1_1integrations_1_1transformers_1_1FormattersLogitsProcessor.png new file mode 100644 index 0000000..b165f6b Binary files /dev/null and b/v0.4.9/classformatron_1_1integrations_1_1transformers_1_1FormattersLogitsProcessor.png differ diff --git a/v0.4.9/classformatron_1_1integrations_1_1vllm_1_1FormattersLogitsProcessor-members.html b/v0.4.9/classformatron_1_1integrations_1_1vllm_1_1FormattersLogitsProcessor-members.html new file mode 100644 index 0000000..711abbd --- /dev/null +++ b/v0.4.9/classformatron_1_1integrations_1_1vllm_1_1FormattersLogitsProcessor-members.html @@ -0,0 +1,151 @@ + + + + + + + + +Formatron: Member List + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
formatron.integrations.vllm.FormattersLogitsProcessor Member List
+
+
+ +

This is the complete list of members for formatron.integrations.vllm.FormattersLogitsProcessor, including all inherited members.

+ + + + + + + + + + + + + +
__call__(self, prompt, generated_tokens, logits)formatron.integrations.vllm.FormattersLogitsProcessor
__init__(self, typing.Sequence[FormatterBase|None] formatters, int eos_token_id, typing.Sequence[EngineGenerationConfig]|None configs=None)formatron.integrations.vllm.FormattersLogitsProcessor
_configsformatron.integrations.vllm.FormattersLogitsProcessorprotected
_debug_counterformatron.integrations.vllm.FormattersLogitsProcessorprotected
_eos_token_idformatron.integrations.vllm.FormattersLogitsProcessorprotected
_formattersformatron.integrations.vllm.FormattersLogitsProcessorprotected
_iterformatron.integrations.vllm.FormattersLogitsProcessorprotected
_last_input_id_lengthformatron.integrations.vllm.FormattersLogitsProcessorprotected
_to_next_batch_step(self)formatron.integrations.vllm.FormattersLogitsProcessorprotected
formatters_captures(self)formatron.integrations.vllm.FormattersLogitsProcessor
is_completed(self)formatron.integrations.vllm.FormattersLogitsProcessor
reset(self)formatron.integrations.vllm.FormattersLogitsProcessor
+
+ + + + diff --git a/v0.4.9/classformatron_1_1integrations_1_1vllm_1_1FormattersLogitsProcessor.html b/v0.4.9/classformatron_1_1integrations_1_1vllm_1_1FormattersLogitsProcessor.html new file mode 100644 index 0000000..3c256bb --- /dev/null +++ b/v0.4.9/classformatron_1_1integrations_1_1vllm_1_1FormattersLogitsProcessor.html @@ -0,0 +1,489 @@ + + + + + + + + +Formatron: formatron.integrations.vllm.FormattersLogitsProcessor Class Reference + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+ +
formatron.integrations.vllm.FormattersLogitsProcessor Class Reference
+
+
+ +

Logit processor that uses formatters to mask batch logits. + More...

+ + + + + + + + + + + +

+Public Member Functions

 __init__ (self, typing.Sequence[FormatterBase|None] formatters, int eos_token_id, typing.Sequence[EngineGenerationConfig]|None configs=None)
 
list[bool|None] is_completed (self)
 Check if the formatters are completed.
 
None reset (self)
 
 __call__ (self, prompt, generated_tokens, logits)
 
+ + + +

+Protected Member Functions

 _to_next_batch_step (self)
 
+ + + + + + + + + + + + + +

+Protected Attributes

 _formatters
 
 _eos_token_id
 
 _last_input_id_length
 
 _configs
 
 _iter
 
 _debug_counter
 
+ + + +

Properties

list[dict[str, typing.Any]|None] formatters_captures (self)
 
+

Detailed Description

+

Logit processor that uses formatters to mask batch logits.

+ +

Definition at line 18 of file vllm.py.

+

Constructor & Destructor Documentation

+ +

◆ __init__()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
formatron.integrations.vllm.FormattersLogitsProcessor.__init__ ( self,
typing.Sequence[FormatterBase | None] formatters,
int eos_token_id,
typing.Sequence[EngineGenerationConfig] | None configs = None )
+
+ +

Definition at line 20 of file vllm.py.

+ +
+
+

Member Function Documentation

+ +

◆ __call__()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
formatron.integrations.vllm.FormattersLogitsProcessor.__call__ ( self,
prompt,
generated_tokens,
logits )
+
+ +

Definition at line 64 of file vllm.py.

+ +
+
+ +

◆ _to_next_batch_step()

+ +
+
+ + + + + +
+ + + + + + + +
formatron.integrations.vllm.FormattersLogitsProcessor._to_next_batch_step ( self)
+
+protected
+
+ +

Definition at line 60 of file vllm.py.

+ +
+
+ +

◆ formatters_captures()

+ +
+
+ + + + + + + +
list[dict[str, typing.Any] | None] formatron.integrations.vllm.FormattersLogitsProcessor.formatters_captures ( self)
+
+ +

Definition at line 41 of file vllm.py.

+ +
+
+ +

◆ is_completed()

+ +
+
+ + + + + + + +
list[bool | None] formatron.integrations.vllm.FormattersLogitsProcessor.is_completed ( self)
+
+ +

Check if the formatters are completed.

+

Each boolean in the list corresponds to the completion status of the formatter at the same index.

+ +

Definition at line 50 of file vllm.py.

+ +
+
+ +

◆ reset()

+ +
+
+ + + + + + + +
None formatron.integrations.vllm.FormattersLogitsProcessor.reset ( self)
+
+ +

Definition at line 53 of file vllm.py.

+ +
+
+

Member Data Documentation

+ +

◆ _configs

+ +
+
+ + + + + +
+ + + + +
formatron.integrations.vllm.FormattersLogitsProcessor._configs
+
+protected
+
+ +

Definition at line 29 of file vllm.py.

+ +
+
+ +

◆ _debug_counter

+ +
+
+ + + + + +
+ + + + +
formatron.integrations.vllm.FormattersLogitsProcessor._debug_counter
+
+protected
+
+ +

Definition at line 31 of file vllm.py.

+ +
+
+ +

◆ _eos_token_id

+ +
+
+ + + + + +
+ + + + +
formatron.integrations.vllm.FormattersLogitsProcessor._eos_token_id
+
+protected
+
+ +

Definition at line 23 of file vllm.py.

+ +
+
+ +

◆ _formatters

+ +
+
+ + + + + +
+ + + + +
formatron.integrations.vllm.FormattersLogitsProcessor._formatters
+
+protected
+
+ +

Definition at line 22 of file vllm.py.

+ +
+
+ +

◆ _iter

+ +
+
+ + + + + +
+ + + + +
formatron.integrations.vllm.FormattersLogitsProcessor._iter
+
+protected
+
+ +

Definition at line 30 of file vllm.py.

+ +
+
+ +

◆ _last_input_id_length

+ +
+
+ + + + + +
+ + + + +
formatron.integrations.vllm.FormattersLogitsProcessor._last_input_id_length
+
+protected
+
+ +

Definition at line 24 of file vllm.py.

+ +
+
+
The documentation for this class was generated from the following file: +
+
+ + + + diff --git a/v0.4.9/classformatron_1_1integrations_1_1vllm_1_1FormattersLogitsProcessor.js b/v0.4.9/classformatron_1_1integrations_1_1vllm_1_1FormattersLogitsProcessor.js new file mode 100644 index 0000000..66f4dc6 --- /dev/null +++ b/v0.4.9/classformatron_1_1integrations_1_1vllm_1_1FormattersLogitsProcessor.js @@ -0,0 +1,15 @@ +var classformatron_1_1integrations_1_1vllm_1_1FormattersLogitsProcessor = +[ + [ "__init__", "classformatron_1_1integrations_1_1vllm_1_1FormattersLogitsProcessor.html#a0ee5e6edc8fc11dfd7406c140c13b7b9", null ], + [ "__call__", "classformatron_1_1integrations_1_1vllm_1_1FormattersLogitsProcessor.html#ad4a81bb45d259bb5408433cdb6cbafdd", null ], + [ "_to_next_batch_step", "classformatron_1_1integrations_1_1vllm_1_1FormattersLogitsProcessor.html#ab87fea11f930a33130cecadd8cdf0cc6", null ], + [ "formatters_captures", "classformatron_1_1integrations_1_1vllm_1_1FormattersLogitsProcessor.html#ae1387d693b21b6c34f7912a3bf7d182d", null ], + [ "is_completed", "classformatron_1_1integrations_1_1vllm_1_1FormattersLogitsProcessor.html#ad6930fba60b378039db9698d811cb82a", null ], + [ "reset", "classformatron_1_1integrations_1_1vllm_1_1FormattersLogitsProcessor.html#a697bbd642308e22804f46729935e101b", null ], + [ "_configs", "classformatron_1_1integrations_1_1vllm_1_1FormattersLogitsProcessor.html#aef140b4278cf9892faa3644bd4c2ca99", null ], + [ "_debug_counter", "classformatron_1_1integrations_1_1vllm_1_1FormattersLogitsProcessor.html#a83ec1613155b800bd9d1b0f012dff371", null ], + [ "_eos_token_id", "classformatron_1_1integrations_1_1vllm_1_1FormattersLogitsProcessor.html#a9c18332e5d1133b7524a8dde402f2677", null ], + [ "_formatters", "classformatron_1_1integrations_1_1vllm_1_1FormattersLogitsProcessor.html#ab9ca25ee76354b711cb5dd892eb5ab0f", null ], + [ "_iter", "classformatron_1_1integrations_1_1vllm_1_1FormattersLogitsProcessor.html#ad7cf01b455ab6847df5c96912a5d2ae9", null ], + [ "_last_input_id_length", "classformatron_1_1integrations_1_1vllm_1_1FormattersLogitsProcessor.html#aa6549c4f4130d1778f69e3e99942a87b", null ] +]; \ No newline at end of file diff --git a/v0.4.9/classformatron_1_1schemas_1_1dict__inference_1_1FieldInfo-members.html b/v0.4.9/classformatron_1_1schemas_1_1dict__inference_1_1FieldInfo-members.html new file mode 100644 index 0000000..6a333ac --- /dev/null +++ b/v0.4.9/classformatron_1_1schemas_1_1dict__inference_1_1FieldInfo-members.html @@ -0,0 +1,143 @@ + + + + + + + + +Formatron: Member List + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
formatron.schemas.dict_inference.FieldInfo Member List
+
+
+ +

This is the complete list of members for formatron.schemas.dict_inference.FieldInfo, including all inherited members.

+ + + + + +
__init__(self, typing.Type annotation)formatron.schemas.dict_inference.FieldInfo
_annotationformatron.schemas.dict_inference.FieldInfoprotected
annotation(self)formatron.schemas.dict_inference.FieldInfo
required(self)formatron.schemas.dict_inference.FieldInfo
+
+ + + + diff --git a/v0.4.9/classformatron_1_1schemas_1_1dict__inference_1_1FieldInfo.html b/v0.4.9/classformatron_1_1schemas_1_1dict__inference_1_1FieldInfo.html new file mode 100644 index 0000000..59d1989 --- /dev/null +++ b/v0.4.9/classformatron_1_1schemas_1_1dict__inference_1_1FieldInfo.html @@ -0,0 +1,281 @@ + + + + + + + + +Formatron: formatron.schemas.dict_inference.FieldInfo Class Reference + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+ +
formatron.schemas.dict_inference.FieldInfo Class Reference
+
+
+
+Inheritance diagram for formatron.schemas.dict_inference.FieldInfo:
+
+
+ + +formatron.schemas.schema.FieldInfo + +
+ + + + + + +

+Public Member Functions

 __init__ (self, typing.Type annotation)
 Initialize the field information.
 
- Public Member Functions inherited from formatron.schemas.schema.FieldInfo
+ + + +

+Protected Attributes

 _annotation
 
+ + + + + + + +

Properties

typing.Type[typing.Any]|None annotation (self)
 Get the type annotation of the field.
 
bool required (self)
 Check if the field is required for the schema.
 
+

Detailed Description

+
+

Definition at line 14 of file dict_inference.py.

+

Constructor & Destructor Documentation

+ +

◆ __init__()

+ +
+
+ + + + + + + + + + + +
formatron.schemas.dict_inference.FieldInfo.__init__ ( self,
typing.Type annotation )
+
+ +

Initialize the field information.

+
Parameters
+ + +
annotationThe type annotation of the field.
+
+
+ +

Definition at line 23 of file dict_inference.py.

+ +
+
+

Member Function Documentation

+ +

◆ annotation()

+ +
+
+ + + + + + + +
typing.Type[typing.Any] | None formatron.schemas.dict_inference.FieldInfo.annotation ( self)
+
+ +

Get the type annotation of the field.

+ +

Reimplemented from formatron.schemas.schema.FieldInfo.

+ +

Definition at line 37 of file dict_inference.py.

+ +
+
+ +

◆ required()

+ +
+
+ + + + + + + +
bool formatron.schemas.dict_inference.FieldInfo.required ( self)
+
+ +

Check if the field is required for the schema.

+ +

Reimplemented from formatron.schemas.schema.FieldInfo.

+ +

Definition at line 53 of file dict_inference.py.

+ +
+
+

Member Data Documentation

+ +

◆ _annotation

+ +
+
+ + + + + +
+ + + + +
formatron.schemas.dict_inference.FieldInfo._annotation
+
+protected
+
+ +

Definition at line 24 of file dict_inference.py.

+ +
+
+
The documentation for this class was generated from the following file: +
+
+ + + + diff --git a/v0.4.9/classformatron_1_1schemas_1_1dict__inference_1_1FieldInfo.js b/v0.4.9/classformatron_1_1schemas_1_1dict__inference_1_1FieldInfo.js new file mode 100644 index 0000000..7016c39 --- /dev/null +++ b/v0.4.9/classformatron_1_1schemas_1_1dict__inference_1_1FieldInfo.js @@ -0,0 +1,7 @@ +var classformatron_1_1schemas_1_1dict__inference_1_1FieldInfo = +[ + [ "__init__", "classformatron_1_1schemas_1_1dict__inference_1_1FieldInfo.html#a0286ba9c9e6509ce23d530409209b5da", null ], + [ "annotation", "classformatron_1_1schemas_1_1dict__inference_1_1FieldInfo.html#a163fde7bbaa2e613b5af3a4a12b9152d", null ], + [ "required", "classformatron_1_1schemas_1_1dict__inference_1_1FieldInfo.html#acd5625095baa17d3cf8f2b9562be0e06", null ], + [ "_annotation", "classformatron_1_1schemas_1_1dict__inference_1_1FieldInfo.html#af85ec1a61b7ef87729757cef077c4df4", null ] +]; \ No newline at end of file diff --git a/v0.4.9/classformatron_1_1schemas_1_1dict__inference_1_1FieldInfo.png b/v0.4.9/classformatron_1_1schemas_1_1dict__inference_1_1FieldInfo.png new file mode 100644 index 0000000..0a6246c Binary files /dev/null and b/v0.4.9/classformatron_1_1schemas_1_1dict__inference_1_1FieldInfo.png differ diff --git a/v0.4.9/classformatron_1_1schemas_1_1json__schema_1_1FieldInfo-members.html b/v0.4.9/classformatron_1_1schemas_1_1json__schema_1_1FieldInfo-members.html new file mode 100644 index 0000000..b742390 --- /dev/null +++ b/v0.4.9/classformatron_1_1schemas_1_1json__schema_1_1FieldInfo-members.html @@ -0,0 +1,144 @@ + + + + + + + + +Formatron: Member List + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
formatron.schemas.json_schema.FieldInfo Member List
+
+
+ +

This is the complete list of members for formatron.schemas.json_schema.FieldInfo, including all inherited members.

+ + + + + + +
__init__(self, typing.Type annotation, bool required)formatron.schemas.json_schema.FieldInfo
_annotationformatron.schemas.json_schema.FieldInfoprotected
_requiredformatron.schemas.json_schema.FieldInfoprotected
annotation(self)formatron.schemas.json_schema.FieldInfo
required(self)formatron.schemas.json_schema.FieldInfo
+
+ + + + diff --git a/v0.4.9/classformatron_1_1schemas_1_1json__schema_1_1FieldInfo.html b/v0.4.9/classformatron_1_1schemas_1_1json__schema_1_1FieldInfo.html new file mode 100644 index 0000000..c2fbaa1 --- /dev/null +++ b/v0.4.9/classformatron_1_1schemas_1_1json__schema_1_1FieldInfo.html @@ -0,0 +1,313 @@ + + + + + + + + +Formatron: formatron.schemas.json_schema.FieldInfo Class Reference + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+ +
formatron.schemas.json_schema.FieldInfo Class Reference
+
+
+
+Inheritance diagram for formatron.schemas.json_schema.FieldInfo:
+
+
+ + +formatron.schemas.schema.FieldInfo + +
+ + + + + + +

+Public Member Functions

 __init__ (self, typing.Type annotation, bool required)
 Initialize the field information.
 
- Public Member Functions inherited from formatron.schemas.schema.FieldInfo
+ + + + + +

+Protected Attributes

 _annotation
 
 _required
 
+ + + + + + + +

Properties

typing.Type[typing.Any]|None annotation (self)
 Get the type annotation of the field.
 
bool required (self)
 Check if the field is required for the schema.
 
+

Detailed Description

+
+

Definition at line 18 of file json_schema.py.

+

Constructor & Destructor Documentation

+ +

◆ __init__()

+ +
+
+ + + + + + + + + + + + + + + + +
formatron.schemas.json_schema.FieldInfo.__init__ ( self,
typing.Type annotation,
bool required )
+
+ +

Initialize the field information.

+
Parameters
+ + + +
annotationThe type annotation of the field.
requiredWhether the field is required for the schema.
+
+
+ +

Definition at line 28 of file json_schema.py.

+ +
+
+

Member Function Documentation

+ +

◆ annotation()

+ +
+
+ + + + + + + +
typing.Type[typing.Any] | None formatron.schemas.json_schema.FieldInfo.annotation ( self)
+
+ +

Get the type annotation of the field.

+ +

Reimplemented from formatron.schemas.schema.FieldInfo.

+ +

Definition at line 43 of file json_schema.py.

+ +
+
+ +

◆ required()

+ +
+
+ + + + + + + +
bool formatron.schemas.json_schema.FieldInfo.required ( self)
+
+ +

Check if the field is required for the schema.

+ +

Reimplemented from formatron.schemas.schema.FieldInfo.

+ +

Definition at line 59 of file json_schema.py.

+ +
+
+

Member Data Documentation

+ +

◆ _annotation

+ +
+
+ + + + + +
+ + + + +
formatron.schemas.json_schema.FieldInfo._annotation
+
+protected
+
+ +

Definition at line 29 of file json_schema.py.

+ +
+
+ +

◆ _required

+ +
+
+ + + + + +
+ + + + +
formatron.schemas.json_schema.FieldInfo._required
+
+protected
+
+ +

Definition at line 30 of file json_schema.py.

+ +
+
+
The documentation for this class was generated from the following file: +
+
+ + + + diff --git a/v0.4.9/classformatron_1_1schemas_1_1json__schema_1_1FieldInfo.js b/v0.4.9/classformatron_1_1schemas_1_1json__schema_1_1FieldInfo.js new file mode 100644 index 0000000..28abc23 --- /dev/null +++ b/v0.4.9/classformatron_1_1schemas_1_1json__schema_1_1FieldInfo.js @@ -0,0 +1,8 @@ +var classformatron_1_1schemas_1_1json__schema_1_1FieldInfo = +[ + [ "__init__", "classformatron_1_1schemas_1_1json__schema_1_1FieldInfo.html#abc61867418b7f30a3545e71c9b28e708", null ], + [ "annotation", "classformatron_1_1schemas_1_1json__schema_1_1FieldInfo.html#a28f43dedc0eaf02cd16423172440208a", null ], + [ "required", "classformatron_1_1schemas_1_1json__schema_1_1FieldInfo.html#af25ae318725070cd198febebe07e5efa", null ], + [ "_annotation", "classformatron_1_1schemas_1_1json__schema_1_1FieldInfo.html#a82c87a6773b72ee766add0dc893482b0", null ], + [ "_required", "classformatron_1_1schemas_1_1json__schema_1_1FieldInfo.html#a8ac1acf32bb578e121ef28a433857726", null ] +]; \ No newline at end of file diff --git a/v0.4.9/classformatron_1_1schemas_1_1json__schema_1_1FieldInfo.png b/v0.4.9/classformatron_1_1schemas_1_1json__schema_1_1FieldInfo.png new file mode 100644 index 0000000..ffe16ee Binary files /dev/null and b/v0.4.9/classformatron_1_1schemas_1_1json__schema_1_1FieldInfo.png differ diff --git a/v0.4.9/classformatron_1_1schemas_1_1pydantic_1_1ClassSchema-members.html b/v0.4.9/classformatron_1_1schemas_1_1pydantic_1_1ClassSchema-members.html new file mode 100644 index 0000000..e0a6355 --- /dev/null +++ b/v0.4.9/classformatron_1_1schemas_1_1pydantic_1_1ClassSchema-members.html @@ -0,0 +1,141 @@ + + + + + + + + +Formatron: Member List + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
formatron.schemas.pydantic.ClassSchema Member List
+
+
+ +

This is the complete list of members for formatron.schemas.pydantic.ClassSchema, including all inherited members.

+ + + +
fields(cls)formatron.schemas.pydantic.ClassSchema
from_json(cls, str _json)formatron.schemas.pydantic.ClassSchema
+
+ + + + diff --git a/v0.4.9/classformatron_1_1schemas_1_1pydantic_1_1ClassSchema.html b/v0.4.9/classformatron_1_1schemas_1_1pydantic_1_1ClassSchema.html new file mode 100644 index 0000000..4fb4317 --- /dev/null +++ b/v0.4.9/classformatron_1_1schemas_1_1pydantic_1_1ClassSchema.html @@ -0,0 +1,222 @@ + + + + + + + + +Formatron: formatron.schemas.pydantic.ClassSchema Class Reference + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+ +
formatron.schemas.pydantic.ClassSchema Class Reference
+
+
+ +

A wrapper for pydantic BaseModel that implements the Schema interface. + More...

+
+Inheritance diagram for formatron.schemas.pydantic.ClassSchema:
+
+
+ + +formatron.schemas.schema.Schema + +
+ + + + + + + + +

Class Methods

typing.Dict[str, typing.Any] fields (cls)
 Get the fields of the schema.
 
"ClassSchema" from_json (cls, str _json)
 Create a ClassSchema from a JSON string.
 
+ + +

+Additional Inherited Members

- Public Member Functions inherited from formatron.schemas.schema.Schema
+

Detailed Description

+

A wrapper for pydantic BaseModel that implements the Schema interface.

+ +

Definition at line 73 of file pydantic.py.

+

Member Function Documentation

+ +

◆ fields()

+ +
+
+ + + + + + + +
typing.Dict[str, typing.Any] formatron.schemas.pydantic.ClassSchema.fields ( cls)
+
+ +

Get the fields of the schema.

+ +

Reimplemented from formatron.schemas.schema.Schema.

+ +

Definition at line 84 of file pydantic.py.

+ +
+
+ +

◆ from_json()

+ +
+
+ + + + + + + + + + + +
"ClassSchema" formatron.schemas.pydantic.ClassSchema.from_json ( cls,
str _json )
+
+ +

Create a ClassSchema from a JSON string.

+ +

Reimplemented from formatron.schemas.schema.Schema.

+ +

Definition at line 103 of file pydantic.py.

+ +
+
+
The documentation for this class was generated from the following file: +
+
+ + + + diff --git a/v0.4.9/classformatron_1_1schemas_1_1pydantic_1_1ClassSchema.js b/v0.4.9/classformatron_1_1schemas_1_1pydantic_1_1ClassSchema.js new file mode 100644 index 0000000..a1fcef5 --- /dev/null +++ b/v0.4.9/classformatron_1_1schemas_1_1pydantic_1_1ClassSchema.js @@ -0,0 +1,5 @@ +var classformatron_1_1schemas_1_1pydantic_1_1ClassSchema = +[ + [ "fields", "classformatron_1_1schemas_1_1pydantic_1_1ClassSchema.html#add30bb5902bbfd8ff4fa17f197994442", null ], + [ "from_json", "classformatron_1_1schemas_1_1pydantic_1_1ClassSchema.html#aec269b72011e216e8f5fefdfa338253a", null ] +]; \ No newline at end of file diff --git a/v0.4.9/classformatron_1_1schemas_1_1pydantic_1_1ClassSchema.png b/v0.4.9/classformatron_1_1schemas_1_1pydantic_1_1ClassSchema.png new file mode 100644 index 0000000..6312323 Binary files /dev/null and b/v0.4.9/classformatron_1_1schemas_1_1pydantic_1_1ClassSchema.png differ diff --git a/v0.4.9/classformatron_1_1schemas_1_1pydantic_1_1FieldInfo-members.html b/v0.4.9/classformatron_1_1schemas_1_1pydantic_1_1FieldInfo-members.html new file mode 100644 index 0000000..703885d --- /dev/null +++ b/v0.4.9/classformatron_1_1schemas_1_1pydantic_1_1FieldInfo-members.html @@ -0,0 +1,146 @@ + + + + + + + + +Formatron: Member List + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
formatron.schemas.pydantic.FieldInfo Member List
+
+
+ +

This is the complete list of members for formatron.schemas.pydantic.FieldInfo, including all inherited members.

+ + + + + + + + +
__init__(self, pydantic.fields.FieldInfo field)formatron.schemas.pydantic.FieldInfo
__repr__(self)formatron.schemas.pydantic.FieldInfo
__str__(self)formatron.schemas.pydantic.FieldInfo
_annotationformatron.schemas.pydantic.FieldInfoprotected
_fieldformatron.schemas.pydantic.FieldInfoprotected
annotation(self)formatron.schemas.pydantic.FieldInfo
required(self)formatron.schemas.pydantic.FieldInfo
+
+ + + + diff --git a/v0.4.9/classformatron_1_1schemas_1_1pydantic_1_1FieldInfo.html b/v0.4.9/classformatron_1_1schemas_1_1pydantic_1_1FieldInfo.html new file mode 100644 index 0000000..12d5823 --- /dev/null +++ b/v0.4.9/classformatron_1_1schemas_1_1pydantic_1_1FieldInfo.html @@ -0,0 +1,347 @@ + + + + + + + + +Formatron: formatron.schemas.pydantic.FieldInfo Class Reference + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+ +
formatron.schemas.pydantic.FieldInfo Class Reference
+
+
+ +

A wrapper for pydantic FieldInfo. + More...

+
+Inheritance diagram for formatron.schemas.pydantic.FieldInfo:
+
+
+ + +formatron.schemas.schema.FieldInfo + +
+ + + + + + + + + + +

+Public Member Functions

 __init__ (self, pydantic.fields.FieldInfo field)
 Initialize the field information.
 
 __repr__ (self)
 
 __str__ (self)
 
- Public Member Functions inherited from formatron.schemas.schema.FieldInfo
+ + + + + +

+Protected Attributes

 _field
 
 _annotation
 
+ + + + + + + +

Properties

typing.Type[typing.Any]|None annotation (self)
 Get the type annotation of the field.
 
bool required (self)
 Check if the field is required for the schema.
 
+

Detailed Description

+

A wrapper for pydantic FieldInfo.

+ +

Definition at line 19 of file pydantic.py.

+

Constructor & Destructor Documentation

+ +

◆ __init__()

+ +
+
+ + + + + + + + + + + +
formatron.schemas.pydantic.FieldInfo.__init__ ( self,
pydantic.fields.FieldInfo field )
+
+ +

Initialize the field information.

+ +

Definition at line 25 of file pydantic.py.

+ +
+
+

Member Function Documentation

+ +

◆ __repr__()

+ +
+
+ + + + + + + +
formatron.schemas.pydantic.FieldInfo.__repr__ ( self)
+
+ +

Definition at line 63 of file pydantic.py.

+ +
+
+ +

◆ __str__()

+ +
+
+ + + + + + + +
formatron.schemas.pydantic.FieldInfo.__str__ ( self)
+
+ +

Definition at line 66 of file pydantic.py.

+ +
+
+ +

◆ annotation()

+ +
+
+ + + + + + + +
typing.Type[typing.Any] | None formatron.schemas.pydantic.FieldInfo.annotation ( self)
+
+ +

Get the type annotation of the field.

+ +

Reimplemented from formatron.schemas.schema.FieldInfo.

+ +

Definition at line 45 of file pydantic.py.

+ +
+
+ +

◆ required()

+ +
+
+ + + + + + + +
bool formatron.schemas.pydantic.FieldInfo.required ( self)
+
+ +

Check if the field is required for the schema.

+ +

Reimplemented from formatron.schemas.schema.FieldInfo.

+ +

Definition at line 58 of file pydantic.py.

+ +
+
+

Member Data Documentation

+ +

◆ _annotation

+ +
+
+ + + + + +
+ + + + +
formatron.schemas.pydantic.FieldInfo._annotation
+
+protected
+
+ +

Definition at line 27 of file pydantic.py.

+ +
+
+ +

◆ _field

+ +
+
+ + + + + +
+ + + + +
formatron.schemas.pydantic.FieldInfo._field
+
+protected
+
+ +

Definition at line 26 of file pydantic.py.

+ +
+
+
The documentation for this class was generated from the following file: +
+
+ + + + diff --git a/v0.4.9/classformatron_1_1schemas_1_1pydantic_1_1FieldInfo.js b/v0.4.9/classformatron_1_1schemas_1_1pydantic_1_1FieldInfo.js new file mode 100644 index 0000000..3af78a1 --- /dev/null +++ b/v0.4.9/classformatron_1_1schemas_1_1pydantic_1_1FieldInfo.js @@ -0,0 +1,10 @@ +var classformatron_1_1schemas_1_1pydantic_1_1FieldInfo = +[ + [ "__init__", "classformatron_1_1schemas_1_1pydantic_1_1FieldInfo.html#a4a5a010c6acef15f8fe2d4318223696b", null ], + [ "__repr__", "classformatron_1_1schemas_1_1pydantic_1_1FieldInfo.html#ad291e8df78d045d3364bc6a17582b416", null ], + [ "__str__", "classformatron_1_1schemas_1_1pydantic_1_1FieldInfo.html#a49ac1734cddfadc1b7721f57775890a6", null ], + [ "annotation", "classformatron_1_1schemas_1_1pydantic_1_1FieldInfo.html#ac9e5af7e4cb356a450e9e48f3af24cfe", null ], + [ "required", "classformatron_1_1schemas_1_1pydantic_1_1FieldInfo.html#aeae1e2e12ad15628c69d896fae9aa477", null ], + [ "_annotation", "classformatron_1_1schemas_1_1pydantic_1_1FieldInfo.html#aab00d20e817e3ea9fc15295a94e8242b", null ], + [ "_field", "classformatron_1_1schemas_1_1pydantic_1_1FieldInfo.html#abb92e2d49fec513432cced795bd853e2", null ] +]; \ No newline at end of file diff --git a/v0.4.9/classformatron_1_1schemas_1_1pydantic_1_1FieldInfo.png b/v0.4.9/classformatron_1_1schemas_1_1pydantic_1_1FieldInfo.png new file mode 100644 index 0000000..529b822 Binary files /dev/null and b/v0.4.9/classformatron_1_1schemas_1_1pydantic_1_1FieldInfo.png differ diff --git a/v0.4.9/classformatron_1_1schemas_1_1schema_1_1FieldInfo-members.html b/v0.4.9/classformatron_1_1schemas_1_1schema_1_1FieldInfo-members.html new file mode 100644 index 0000000..e94d22d --- /dev/null +++ b/v0.4.9/classformatron_1_1schemas_1_1schema_1_1FieldInfo-members.html @@ -0,0 +1,141 @@ + + + + + + + + +Formatron: Member List + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
formatron.schemas.schema.FieldInfo Member List
+
+
+ +

This is the complete list of members for formatron.schemas.schema.FieldInfo, including all inherited members.

+ + + +
annotation(self)formatron.schemas.schema.FieldInfo
required(self)formatron.schemas.schema.FieldInfo
+
+ + + + diff --git a/v0.4.9/classformatron_1_1schemas_1_1schema_1_1FieldInfo.html b/v0.4.9/classformatron_1_1schemas_1_1schema_1_1FieldInfo.html new file mode 100644 index 0000000..3887a44 --- /dev/null +++ b/v0.4.9/classformatron_1_1schemas_1_1schema_1_1FieldInfo.html @@ -0,0 +1,216 @@ + + + + + + + + +Formatron: formatron.schemas.schema.FieldInfo Class Reference + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+ +
formatron.schemas.schema.FieldInfo Class Reference
+
+
+ +

An abstract field info that describes a data field in a schema. + More...

+
+Inheritance diagram for formatron.schemas.schema.FieldInfo:
+
+
+ + +formatron.schemas.dict_inference.FieldInfo +formatron.schemas.json_schema.FieldInfo +formatron.schemas.pydantic.FieldInfo + +
+ + + + + + + + +

Properties

typing.Type[typing.Any]|None annotation (self)
 Get the type annotation of the field.
 
bool required (self)
 Check if the field is required for the schema.
 
+

Detailed Description

+

An abstract field info that describes a data field in a schema.

+ +

Definition at line 13 of file schema.py.

+

Member Function Documentation

+ +

◆ annotation()

+ +
+
+ + + + + + + +
typing.Type[typing.Any] | None formatron.schemas.schema.FieldInfo.annotation ( self)
+
+ +

Get the type annotation of the field.

+ +

Reimplemented in formatron.schemas.dict_inference.FieldInfo, formatron.schemas.json_schema.FieldInfo, and formatron.schemas.pydantic.FieldInfo.

+ +

Definition at line 26 of file schema.py.

+ +
+
+ +

◆ required()

+ +
+
+ + + + + + + +
bool formatron.schemas.schema.FieldInfo.required ( self)
+
+ +

Check if the field is required for the schema.

+ +

Reimplemented in formatron.schemas.dict_inference.FieldInfo, formatron.schemas.json_schema.FieldInfo, and formatron.schemas.pydantic.FieldInfo.

+ +

Definition at line 43 of file schema.py.

+ +
+
+
The documentation for this class was generated from the following file: +
+
+ + + + diff --git a/v0.4.9/classformatron_1_1schemas_1_1schema_1_1FieldInfo.js b/v0.4.9/classformatron_1_1schemas_1_1schema_1_1FieldInfo.js new file mode 100644 index 0000000..4c32fda --- /dev/null +++ b/v0.4.9/classformatron_1_1schemas_1_1schema_1_1FieldInfo.js @@ -0,0 +1,5 @@ +var classformatron_1_1schemas_1_1schema_1_1FieldInfo = +[ + [ "annotation", "classformatron_1_1schemas_1_1schema_1_1FieldInfo.html#a5c7b1d8b8d8d52426e95a3f326cf3e75", null ], + [ "required", "classformatron_1_1schemas_1_1schema_1_1FieldInfo.html#ac0d64035ccdc78e44a4cf6165d56081b", null ] +]; \ No newline at end of file diff --git a/v0.4.9/classformatron_1_1schemas_1_1schema_1_1FieldInfo.png b/v0.4.9/classformatron_1_1schemas_1_1schema_1_1FieldInfo.png new file mode 100644 index 0000000..13d352b Binary files /dev/null and b/v0.4.9/classformatron_1_1schemas_1_1schema_1_1FieldInfo.png differ diff --git a/v0.4.9/classformatron_1_1schemas_1_1schema_1_1Schema-members.html b/v0.4.9/classformatron_1_1schemas_1_1schema_1_1Schema-members.html new file mode 100644 index 0000000..3ae0e62 --- /dev/null +++ b/v0.4.9/classformatron_1_1schemas_1_1schema_1_1Schema-members.html @@ -0,0 +1,141 @@ + + + + + + + + +Formatron: Member List + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
formatron.schemas.schema.Schema Member List
+
+
+ +

This is the complete list of members for formatron.schemas.schema.Schema, including all inherited members.

+ + + +
fields(cls)formatron.schemas.schema.Schema
from_json(cls, str json)formatron.schemas.schema.Schema
+
+ + + + diff --git a/v0.4.9/classformatron_1_1schemas_1_1schema_1_1Schema.html b/v0.4.9/classformatron_1_1schemas_1_1schema_1_1Schema.html new file mode 100644 index 0000000..f0a1faa --- /dev/null +++ b/v0.4.9/classformatron_1_1schemas_1_1schema_1_1Schema.html @@ -0,0 +1,218 @@ + + + + + + + + +Formatron: formatron.schemas.schema.Schema Class Reference + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+ +
formatron.schemas.schema.Schema Class Reference
+
+
+ +

An abstract schema that describes some data. + More...

+
+Inheritance diagram for formatron.schemas.schema.Schema:
+
+
+ + +formatron.schemas.pydantic.ClassSchema + +
+ + + + + + + + +

Class Methods

dict[str, FieldInfofields (cls)
 Get the fields of the schema.
 
"Schema" from_json (cls, str json)
 Create a schema from a JSON string.
 
+

Detailed Description

+

An abstract schema that describes some data.

+ +

Definition at line 91 of file schema.py.

+

Member Function Documentation

+ +

◆ fields()

+ +
+
+ + + + + + + +
dict[str, FieldInfo] formatron.schemas.schema.Schema.fields ( cls)
+
+ +

Get the fields of the schema.

+ +

Reimplemented in formatron.schemas.pydantic.ClassSchema.

+ +

Definition at line 104 of file schema.py.

+ +
+
+ +

◆ from_json()

+ +
+
+ + + + + + + + + + + +
"Schema" formatron.schemas.schema.Schema.from_json ( cls,
str json )
+
+ +

Create a schema from a JSON string.

+ +

Reimplemented in formatron.schemas.pydantic.ClassSchema.

+ +

Definition at line 121 of file schema.py.

+ +
+
+
The documentation for this class was generated from the following file: +
+
+ + + + diff --git a/v0.4.9/classformatron_1_1schemas_1_1schema_1_1Schema.js b/v0.4.9/classformatron_1_1schemas_1_1schema_1_1Schema.js new file mode 100644 index 0000000..624d51a --- /dev/null +++ b/v0.4.9/classformatron_1_1schemas_1_1schema_1_1Schema.js @@ -0,0 +1,5 @@ +var classformatron_1_1schemas_1_1schema_1_1Schema = +[ + [ "fields", "classformatron_1_1schemas_1_1schema_1_1Schema.html#a98d77a5645545d440b91126926d1aeb8", null ], + [ "from_json", "classformatron_1_1schemas_1_1schema_1_1Schema.html#a8c45239aaa45574add14fa72fbdf16dc", null ] +]; \ No newline at end of file diff --git a/v0.4.9/classformatron_1_1schemas_1_1schema_1_1Schema.png b/v0.4.9/classformatron_1_1schemas_1_1schema_1_1Schema.png new file mode 100644 index 0000000..d44c6c6 Binary files /dev/null and b/v0.4.9/classformatron_1_1schemas_1_1schema_1_1Schema.png differ diff --git a/v0.4.9/classformatron_1_1schemas_1_1schema_1_1SubstringOf.html b/v0.4.9/classformatron_1_1schemas_1_1schema_1_1SubstringOf.html new file mode 100644 index 0000000..c695423 --- /dev/null +++ b/v0.4.9/classformatron_1_1schemas_1_1schema_1_1SubstringOf.html @@ -0,0 +1,147 @@ + + + + + + + + +Formatron: formatron.schemas.schema.SubstringOf Class Reference + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
formatron.schemas.schema.SubstringOf Class Reference
+
+
+ +

A metadata class that indicates that the field is a substring of the given string. + More...

+

Detailed Description

+

A metadata class that indicates that the field is a substring of the given string.

+ +

Definition at line 130 of file schema.py.

+

The documentation for this class was generated from the following file: +
+
+ + + + diff --git a/v0.4.9/classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata-members.html b/v0.4.9/classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata-members.html new file mode 100644 index 0000000..f9ae841 --- /dev/null +++ b/v0.4.9/classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata-members.html @@ -0,0 +1,144 @@ + + + + + + + + +Formatron: Member List + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
formatron.schemas.schema.TypeWithMetadata Member List
+
+
+ +

This is the complete list of members for formatron.schemas.schema.TypeWithMetadata, including all inherited members.

+ + + + + + +
__init__(self, typing.Type[typing.Any] type, dict[str, typing.Any]|None metadata)formatron.schemas.schema.TypeWithMetadata
_metadataformatron.schemas.schema.TypeWithMetadataprotected
_typeformatron.schemas.schema.TypeWithMetadataprotected
metadata(self)formatron.schemas.schema.TypeWithMetadata
type(self)formatron.schemas.schema.TypeWithMetadata
+
+ + + + diff --git a/v0.4.9/classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata.html b/v0.4.9/classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata.html new file mode 100644 index 0000000..073a0e7 --- /dev/null +++ b/v0.4.9/classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata.html @@ -0,0 +1,293 @@ + + + + + + + + +Formatron: formatron.schemas.schema.TypeWithMetadata Class Reference + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+ +
formatron.schemas.schema.TypeWithMetadata Class Reference
+
+
+ +

A type with metadata. + More...

+ + + + +

+Public Member Functions

 __init__ (self, typing.Type[typing.Any] type, dict[str, typing.Any]|None metadata)
 
+ + + + + +

+Protected Attributes

 _type
 
 _metadata
 
+ + + + + + + +

Properties

typing.Type[typing.Any] type (self)
 Get the type of the type with metadata.
 
dict[str, typing.Any]|None metadata (self)
 Get the metadata of the type with metadata.
 
+

Detailed Description

+

A type with metadata.

+ +

Definition at line 51 of file schema.py.

+

Constructor & Destructor Documentation

+ +

◆ __init__()

+ +
+
+ + + + + + + + + + + + + + + + +
formatron.schemas.schema.TypeWithMetadata.__init__ ( self,
typing.Type[typing.Any] type,
dict[str, typing.Any]|None metadata )
+
+ +

Definition at line 52 of file schema.py.

+ +
+
+

Member Function Documentation

+ +

◆ metadata()

+ +
+
+ + + + + + + +
dict[str, typing.Any]|None formatron.schemas.schema.TypeWithMetadata.metadata ( self)
+
+ +

Get the metadata of the type with metadata.

+ +

Definition at line 83 of file schema.py.

+ +
+
+ +

◆ type()

+ +
+
+ + + + + + + +
typing.Type[typing.Any] formatron.schemas.schema.TypeWithMetadata.type ( self)
+
+ +

Get the type of the type with metadata.

+ +

Definition at line 67 of file schema.py.

+ +
+
+

Member Data Documentation

+ +

◆ _metadata

+ +
+
+ + + + + +
+ + + + +
formatron.schemas.schema.TypeWithMetadata._metadata
+
+protected
+
+ +

Definition at line 54 of file schema.py.

+ +
+
+ +

◆ _type

+ +
+
+ + + + + +
+ + + + +
formatron.schemas.schema.TypeWithMetadata._type
+
+protected
+
+ +

Definition at line 53 of file schema.py.

+ +
+
+
The documentation for this class was generated from the following file: +
+
+ + + + diff --git a/v0.4.9/classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata.js b/v0.4.9/classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata.js new file mode 100644 index 0000000..856d521 --- /dev/null +++ b/v0.4.9/classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata.js @@ -0,0 +1,8 @@ +var classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata = +[ + [ "__init__", "classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata.html#a0c3cf51ceb503d4d195f5623d57e160b", null ], + [ "metadata", "classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata.html#af8604b758b8af6878a130a4f0f28389b", null ], + [ "type", "classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata.html#ada7a24496aad9979411523441c53a6cf", null ], + [ "_metadata", "classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata.html#a34312895f9d497d5c35cf372f9c498f3", null ], + [ "_type", "classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata.html#a4d1ea7d59f700634eb2545ce3d6cf324", null ] +]; \ No newline at end of file diff --git a/v0.4.9/clipboard.js b/v0.4.9/clipboard.js new file mode 100644 index 0000000..42c1fb0 --- /dev/null +++ b/v0.4.9/clipboard.js @@ -0,0 +1,61 @@ +/** + +The code below is based on the Doxygen Awesome project, see +https://github.com/jothepro/doxygen-awesome-css + +MIT License + +Copyright (c) 2021 - 2022 jothepro + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +*/ + +let clipboard_title = "Copy to clipboard" +let clipboard_icon = `` +let clipboard_successIcon = `` +let clipboard_successDuration = 1000 + +$(function() { + if(navigator.clipboard) { + const fragments = document.getElementsByClassName("fragment") + for(const fragment of fragments) { + const clipboard_div = document.createElement("div") + clipboard_div.classList.add("clipboard") + clipboard_div.innerHTML = clipboard_icon + clipboard_div.title = clipboard_title + $(clipboard_div).click(function() { + const content = this.parentNode.cloneNode(true) + // filter out line number and folded fragments from file listings + content.querySelectorAll(".lineno, .ttc, .foldclosed").forEach((node) => { node.remove() }) + let text = content.textContent + // remove trailing newlines and trailing spaces from empty lines + text = text.replace(/^\s*\n/gm,'\n').replace(/\n*$/,'') + navigator.clipboard.writeText(text); + this.classList.add("success") + this.innerHTML = clipboard_successIcon + window.setTimeout(() => { // switch back to normal icon after timeout + this.classList.remove("success") + this.innerHTML = clipboard_icon + }, clipboard_successDuration); + }) + fragment.insertBefore(clipboard_div, fragment.firstChild) + } + } +}) diff --git a/v0.4.9/closed.png b/v0.4.9/closed.png new file mode 100644 index 0000000..98cc2c9 Binary files /dev/null and b/v0.4.9/closed.png differ diff --git a/v0.4.9/config_8py.html b/v0.4.9/config_8py.html new file mode 100644 index 0000000..90ba5c5 --- /dev/null +++ b/v0.4.9/config_8py.html @@ -0,0 +1,157 @@ + + + + + + + + +Formatron: src/formatron/config.py File Reference + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+ +
config.py File Reference
+
+
+ +

Go to the source code of this file.

+ + + + + +

+Classes

class  formatron.config.EngineGenerationConfig
 Configuration for how an KBNF engine should be used in text generation. More...
 
+ + + + + + +

+Namespaces

namespace  formatron
 
namespace  formatron.config
 Configuration classes for Formatron.
 
+
+
+ + + + diff --git a/v0.4.9/config_8py.js b/v0.4.9/config_8py.js new file mode 100644 index 0000000..c2c2e49 --- /dev/null +++ b/v0.4.9/config_8py.js @@ -0,0 +1,4 @@ +var config_8py = +[ + [ "formatron.config.EngineGenerationConfig", "classformatron_1_1config_1_1EngineGenerationConfig.html", "classformatron_1_1config_1_1EngineGenerationConfig" ] +]; \ No newline at end of file diff --git a/v0.4.9/config_8py_source.html b/v0.4.9/config_8py_source.html new file mode 100644 index 0000000..3ac5f53 --- /dev/null +++ b/v0.4.9/config_8py_source.html @@ -0,0 +1,157 @@ + + + + + + + + +Formatron: src/formatron/config.py Source File + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
config.py
+
+
+Go to the documentation of this file.
1"""
+
2Configuration classes for Formatron.
+
3"""
+
4from dataclasses import dataclass
+
5
+
6
+
7@dataclass
+ +
9 """
+
10 Configuration for how an KBNF engine should be used in text generation.
+
11
+
12 Attributes:
+
13 read_prompt: Whether to accept the prompt tokens when a generation begins.
+
+
14 reset_at_beginning: Whether to reset the engine when a new generation begins.
+
15 """
+
16 read_prompt: bool = False
+
17 reset_at_beginning: bool = True
+
+
Configuration for how an KBNF engine should be used in text generation.
Definition config.py:14
+
+
+ + + + diff --git a/v0.4.9/cookie.js b/v0.4.9/cookie.js new file mode 100644 index 0000000..53ad21d --- /dev/null +++ b/v0.4.9/cookie.js @@ -0,0 +1,58 @@ +/*! + Cookie helper functions + Copyright (c) 2023 Dimitri van Heesch + Released under MIT license. +*/ +let Cookie = { + cookie_namespace: 'doxygen_', + + readSetting(cookie,defVal) { + if (window.chrome) { + const val = localStorage.getItem(this.cookie_namespace+cookie) || + sessionStorage.getItem(this.cookie_namespace+cookie); + if (val) return val; + } else { + let myCookie = this.cookie_namespace+cookie+"="; + if (document.cookie) { + const index = document.cookie.indexOf(myCookie); + if (index != -1) { + const valStart = index + myCookie.length; + let valEnd = document.cookie.indexOf(";", valStart); + if (valEnd == -1) { + valEnd = document.cookie.length; + } + return document.cookie.substring(valStart, valEnd); + } + } + } + return defVal; + }, + + writeSetting(cookie,val,days=10*365) { // default days='forever', 0=session cookie, -1=delete + if (window.chrome) { + if (days==0) { + sessionStorage.setItem(this.cookie_namespace+cookie,val); + } else { + localStorage.setItem(this.cookie_namespace+cookie,val); + } + } else { + let date = new Date(); + date.setTime(date.getTime()+(days*24*60*60*1000)); + const expiration = days!=0 ? "expires="+date.toGMTString()+";" : ""; + document.cookie = this.cookie_namespace + cookie + "=" + + val + "; SameSite=Lax;" + expiration + "path=/"; + } + }, + + eraseSetting(cookie) { + if (window.chrome) { + if (localStorage.getItem(this.cookie_namespace+cookie)) { + localStorage.removeItem(this.cookie_namespace+cookie); + } else if (sessionStorage.getItem(this.cookie_namespace+cookie)) { + sessionStorage.removeItem(this.cookie_namespace+cookie); + } + } else { + this.writeSetting(cookie,'',-1); + } + }, +} diff --git a/v0.4.9/dict__inference_8py.html b/v0.4.9/dict__inference_8py.html new file mode 100644 index 0000000..217535e --- /dev/null +++ b/v0.4.9/dict__inference_8py.html @@ -0,0 +1,168 @@ + + + + + + + + +Formatron: src/formatron/schemas/dict_inference.py File Reference + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+ +
dict_inference.py File Reference
+
+
+ +

Go to the source code of this file.

+ + + + +

+Classes

class  formatron.schemas.dict_inference.FieldInfo
 
+ + + + + + + + + +

+Namespaces

namespace  formatron
 
namespace  formatron.schemas
 This subpackage contains modules that define schemas creation from various sources.
 
namespace  formatron.schemas.dict_inference
 This module contains utilities for inferring schemas from dictionaries.
 
+ + + + + + +

+Functions

Type[Any] formatron.schemas.dict_inference._infer_type (Any value)
 
typing.Type[schemas.schema.Schemaformatron.schemas.dict_inference.infer_mapping (collections.abc.Mapping[str, Any] mapping)
 Recursively infer a schema from a mapping.
 
+
+
+ + + + diff --git a/v0.4.9/dict__inference_8py.js b/v0.4.9/dict__inference_8py.js new file mode 100644 index 0000000..2b5ac44 --- /dev/null +++ b/v0.4.9/dict__inference_8py.js @@ -0,0 +1,6 @@ +var dict__inference_8py = +[ + [ "formatron.schemas.dict_inference.FieldInfo", "classformatron_1_1schemas_1_1dict__inference_1_1FieldInfo.html", "classformatron_1_1schemas_1_1dict__inference_1_1FieldInfo" ], + [ "_infer_type", "dict__inference_8py.html#ad5cac24e76dc097a995f31d3d0ff9efc", null ], + [ "infer_mapping", "dict__inference_8py.html#a850490b4a317260a236333130d36a5d8", null ] +]; \ No newline at end of file diff --git a/v0.4.9/dict__inference_8py_source.html b/v0.4.9/dict__inference_8py_source.html new file mode 100644 index 0000000..82601b7 --- /dev/null +++ b/v0.4.9/dict__inference_8py_source.html @@ -0,0 +1,241 @@ + + + + + + + + +Formatron: src/formatron/schemas/dict_inference.py Source File + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
dict_inference.py
+
+
+Go to the documentation of this file.
1"""
+
2This module contains utilities for inferring schemas from dictionaries.
+
3"""
+
4import collections.abc
+
5import json
+
6from typing import Any, Type
+
7
+
8from pydantic import typing
+
9
+
10from formatron import schemas
+
11
+
12
+ +
+
14 __slots__ = ("_annotation",)
+
15
+
16 def __init__(self, annotation: typing.Type):
+
17 """
+
18 Initialize the field information.
+
19
+
20 Args:
+
21 annotation: The type annotation of the field.
+
22 """
+
+
23 self._annotation = annotation
+ +
25 @property
+
+
26 def annotation(self) -> typing.Type[typing.Any] | None:
+
27 """
+
28 Get the type annotation of the field.
+
29 """
+
30 return self._annotation
+
31
+
32 @property
+
33 def required(self) -> bool:
+
34 """
+
35 Check if the field is required for the schema.
+
36 """
+
+
37 return True
+
38
+
39
+
+
40def _infer_type(value: Any) -> Type[Any]:
+
41 if isinstance(value, collections.abc.Mapping):
+
42 return infer_mapping(value)
+
43 elif isinstance(value, collections.abc.Sequence) and not isinstance(value, str):
+
44 # Handle sequences with possibly heterogeneous elements
+
45 if not value:
+
46 return collections.Sequence[Any]
+
47 element_types = set()
+
48 for element in value:
+
49 element_type = type(element)
+
50 # Check for dictionary
+
51 original = typing.get_origin(element_type)
+
52 if original is None:
+
+
53 original = element_type
+
54 if original is typing.Mapping or isinstance(original, type) and issubclass(original,
+
55 collections.abc.Mapping):
+
+
56 element_types.add(infer_mapping(element))
+
57 else:
+
58 element_types.add(element_type)
+
+
+
59 if len(element_types) == 1:
+
60 return collections.abc.Sequence[next(iter(element_types))]
+
61 union_type = typing.Union[tuple(element_types)]
+
62 return collections.abc.Sequence[union_type]
+
63 else:
+
64 return type(value)
+
65
+
66
+
67def infer_mapping(mapping: collections.abc.Mapping[str, Any]) -> typing.Type[schemas.schema.Schema]:
+
68 """
+
69 Recursively infer a schema from a mapping.
+
70
+
71 Types that are specially handled:
+
72 - collections.abc.Mapping: converted to a schema. Keys are converted to field names and corresponding value types are converted to field types.
+
73 - collections.abc.Sequence with heterogeneous elements: all different element types are included in a union type.
+
74
+
75 Other types are directly inferred from the type of the value with no special handling.
+
76 """
+
77 field_infos = {}
+
78 for key, value in mapping.items():
+
79 assert isinstance(key, str), f"Key must be a string, got {key} of type {type(key)}"
+
80 assert key.isidentifier(), f"Key must be a valid identifier, got {key}"
+
81 inferred_type = _infer_type(value)
+
82 field_infos[key] = FieldInfo(inferred_type)
+
83 _class = type(f"Mapping_{id(mapping)}", (schemas.schema.Schema,), {"fields": lambda: field_infos})
+
84 _class.from_json = classmethod(lambda cls, json_str: json.loads(json_str))
+
85 return _class
+
+ +
__init__(self, typing.Type annotation)
Initialize the field information.
+
typing.Type[typing.Any]|None annotation(self)
Get the type annotation of the field.
+
bool required(self)
Check if the field is required for the schema.
+ +
An abstract field info that describes a data field in a schema.
Definition schema.py:13
+
An abstract schema that describes some data.
Definition schema.py:91
+
typing.Type[schemas.schema.Schema] infer_mapping(collections.abc.Mapping[str, Any] mapping)
Recursively infer a schema from a mapping.
+
Type[Any] _infer_type(Any value)
+
+
+ + + + diff --git a/v0.4.9/dir_07d5411bfb9a2f8bc3eb64bb16ab190f.html b/v0.4.9/dir_07d5411bfb9a2f8bc3eb64bb16ab190f.html new file mode 100644 index 0000000..cdbe201 --- /dev/null +++ b/v0.4.9/dir_07d5411bfb9a2f8bc3eb64bb16ab190f.html @@ -0,0 +1,147 @@ + + + + + + + + +Formatron: src/formatron/formats Directory Reference + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
formats Directory Reference
+
+
+ + + + + + + + +

+Files

 __init__.py
 
 json.py
 
 regex.py
 
+
+
+ + + + diff --git a/v0.4.9/dir_07d5411bfb9a2f8bc3eb64bb16ab190f.js b/v0.4.9/dir_07d5411bfb9a2f8bc3eb64bb16ab190f.js new file mode 100644 index 0000000..a142a1e --- /dev/null +++ b/v0.4.9/dir_07d5411bfb9a2f8bc3eb64bb16ab190f.js @@ -0,0 +1,6 @@ +var dir_07d5411bfb9a2f8bc3eb64bb16ab190f = +[ + [ "__init__.py", "formats_2____init_____8py.html", null ], + [ "json.py", "json_8py.html", "json_8py" ], + [ "regex.py", "regex_8py.html", "regex_8py" ] +]; \ No newline at end of file diff --git a/v0.4.9/dir_2f7731174e12724dc50b600c6c8c5f5c.html b/v0.4.9/dir_2f7731174e12724dc50b600c6c8c5f5c.html new file mode 100644 index 0000000..be63c58 --- /dev/null +++ b/v0.4.9/dir_2f7731174e12724dc50b600c6c8c5f5c.html @@ -0,0 +1,151 @@ + + + + + + + + +Formatron: src/formatron/schemas Directory Reference + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
schemas Directory Reference
+
+
+ + + + + + + + + + + + +

+Files

 __init__.py
 
 dict_inference.py
 
 json_schema.py
 
 pydantic.py
 
 schema.py
 
+
+
+ + + + diff --git a/v0.4.9/dir_2f7731174e12724dc50b600c6c8c5f5c.js b/v0.4.9/dir_2f7731174e12724dc50b600c6c8c5f5c.js new file mode 100644 index 0000000..40051d3 --- /dev/null +++ b/v0.4.9/dir_2f7731174e12724dc50b600c6c8c5f5c.js @@ -0,0 +1,8 @@ +var dir_2f7731174e12724dc50b600c6c8c5f5c = +[ + [ "__init__.py", "schemas_2____init_____8py.html", null ], + [ "dict_inference.py", "dict__inference_8py.html", "dict__inference_8py" ], + [ "json_schema.py", "json__schema_8py.html", "json__schema_8py" ], + [ "pydantic.py", "pydantic_8py.html", "pydantic_8py" ], + [ "schema.py", "schema_8py.html", "schema_8py" ] +]; \ No newline at end of file diff --git a/v0.4.9/dir_68267d1309a1af8e8297ef4c3efbcdba.html b/v0.4.9/dir_68267d1309a1af8e8297ef4c3efbcdba.html new file mode 100644 index 0000000..28678cb --- /dev/null +++ b/v0.4.9/dir_68267d1309a1af8e8297ef4c3efbcdba.html @@ -0,0 +1,143 @@ + + + + + + + + +Formatron: src Directory Reference + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
src Directory Reference
+
+
+ + + + +

+Directories

 formatron
 
+
+
+ + + + diff --git a/v0.4.9/dir_68267d1309a1af8e8297ef4c3efbcdba.js b/v0.4.9/dir_68267d1309a1af8e8297ef4c3efbcdba.js new file mode 100644 index 0000000..5c348a7 --- /dev/null +++ b/v0.4.9/dir_68267d1309a1af8e8297ef4c3efbcdba.js @@ -0,0 +1,4 @@ +var dir_68267d1309a1af8e8297ef4c3efbcdba = +[ + [ "formatron", "dir_fcf8421df2b1fac2914241030b544a7c.html", "dir_fcf8421df2b1fac2914241030b544a7c" ] +]; \ No newline at end of file diff --git a/v0.4.9/dir_86ec2f274a7c7757cb321bd1b4c1dbf4.html b/v0.4.9/dir_86ec2f274a7c7757cb321bd1b4c1dbf4.html new file mode 100644 index 0000000..238ba45 --- /dev/null +++ b/v0.4.9/dir_86ec2f274a7c7757cb321bd1b4c1dbf4.html @@ -0,0 +1,153 @@ + + + + + + + + +Formatron: src/formatron/integrations Directory Reference + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
integrations Directory Reference
+
+
+ + + + + + + + + + + + + + +

+Files

 __init__.py
 
 exllamav2.py
 
 RWKV.py
 
 transformers.py
 
 utils.py
 
 vllm.py
 
+
+
+ + + + diff --git a/v0.4.9/dir_86ec2f274a7c7757cb321bd1b4c1dbf4.js b/v0.4.9/dir_86ec2f274a7c7757cb321bd1b4c1dbf4.js new file mode 100644 index 0000000..08bd66c --- /dev/null +++ b/v0.4.9/dir_86ec2f274a7c7757cb321bd1b4c1dbf4.js @@ -0,0 +1,9 @@ +var dir_86ec2f274a7c7757cb321bd1b4c1dbf4 = +[ + [ "__init__.py", "integrations_2____init_____8py.html", null ], + [ "exllamav2.py", "exllamav2_8py.html", "exllamav2_8py" ], + [ "RWKV.py", "RWKV_8py.html", "RWKV_8py" ], + [ "transformers.py", "transformers_8py.html", "transformers_8py" ], + [ "utils.py", "utils_8py.html", "utils_8py" ], + [ "vllm.py", "vllm_8py.html", "vllm_8py" ] +]; \ No newline at end of file diff --git a/v0.4.9/dir_fcf8421df2b1fac2914241030b544a7c.html b/v0.4.9/dir_fcf8421df2b1fac2914241030b544a7c.html new file mode 100644 index 0000000..29e0efc --- /dev/null +++ b/v0.4.9/dir_fcf8421df2b1fac2914241030b544a7c.html @@ -0,0 +1,158 @@ + + + + + + + + +Formatron: src/formatron Directory Reference + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
formatron Directory Reference
+
+
+ + + + + + + + +

+Directories

 formats
 
 integrations
 
 schemas
 
+ + + + + + + + + +

+Files

 __init__.py
 
 config.py
 
 extractor.py
 
 formatter.py
 
+
+
+ + + + diff --git a/v0.4.9/dir_fcf8421df2b1fac2914241030b544a7c.js b/v0.4.9/dir_fcf8421df2b1fac2914241030b544a7c.js new file mode 100644 index 0000000..455730f --- /dev/null +++ b/v0.4.9/dir_fcf8421df2b1fac2914241030b544a7c.js @@ -0,0 +1,10 @@ +var dir_fcf8421df2b1fac2914241030b544a7c = +[ + [ "formats", "dir_07d5411bfb9a2f8bc3eb64bb16ab190f.html", "dir_07d5411bfb9a2f8bc3eb64bb16ab190f" ], + [ "integrations", "dir_86ec2f274a7c7757cb321bd1b4c1dbf4.html", "dir_86ec2f274a7c7757cb321bd1b4c1dbf4" ], + [ "schemas", "dir_2f7731174e12724dc50b600c6c8c5f5c.html", "dir_2f7731174e12724dc50b600c6c8c5f5c" ], + [ "__init__.py", "____init_____8py.html", null ], + [ "config.py", "config_8py.html", "config_8py" ], + [ "extractor.py", "extractor_8py.html", "extractor_8py" ], + [ "formatter.py", "formatter_8py.html", "formatter_8py" ] +]; \ No newline at end of file diff --git a/v0.4.9/doc.svg b/v0.4.9/doc.svg new file mode 100644 index 0000000..0b928a5 --- /dev/null +++ b/v0.4.9/doc.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + diff --git a/v0.4.9/docd.svg b/v0.4.9/docd.svg new file mode 100644 index 0000000..ac18b27 --- /dev/null +++ b/v0.4.9/docd.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + diff --git a/v0.4.9/doxygen-awesome.css b/v0.4.9/doxygen-awesome.css new file mode 100644 index 0000000..a2715e2 --- /dev/null +++ b/v0.4.9/doxygen-awesome.css @@ -0,0 +1,2677 @@ +/** + +Doxygen Awesome +https://github.com/jothepro/doxygen-awesome-css + +MIT License + +Copyright (c) 2021 - 2023 jothepro + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +*/ + +html { + /* primary theme color. This will affect the entire websites color scheme: links, arrows, labels, ... */ + --primary-color: #1779c4; + --primary-dark-color: #335c80; + --primary-light-color: #70b1e9; + + /* page base colors */ + --page-background-color: #ffffff; + --page-foreground-color: #2f4153; + --page-secondary-foreground-color: #6f7e8e; + + /* color for all separators on the website: hr, borders, ... */ + --separator-color: #dedede; + + /* border radius for all rounded components. Will affect many components, like dropdowns, memitems, codeblocks, ... */ + --border-radius-large: 8px; + --border-radius-small: 4px; + --border-radius-medium: 6px; + + /* default spacings. Most components reference these values for spacing, to provide uniform spacing on the page. */ + --spacing-small: 5px; + --spacing-medium: 10px; + --spacing-large: 16px; + + /* default box shadow used for raising an element above the normal content. Used in dropdowns, search result, ... */ + --box-shadow: 0 2px 8px 0 rgba(0,0,0,.075); + + --odd-color: rgba(0,0,0,.028); + + /* font-families. will affect all text on the website + * font-family: the normal font for text, headlines, menus + * font-family-monospace: used for preformatted text in memtitle, code, fragments + */ + --font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif; + --font-family-monospace: ui-monospace,SFMono-Regular,SF Mono,Menlo,Consolas,Liberation Mono,monospace; + + /* font sizes */ + --page-font-size: 15.6px; + --navigation-font-size: 14.4px; + --toc-font-size: 13.4px; + --code-font-size: 14px; /* affects code, fragment */ + --title-font-size: 22px; + + /* content text properties. These only affect the page content, not the navigation or any other ui elements */ + --content-line-height: 27px; + /* The content is centered and constraint in it's width. To make the content fill the whole page, set the variable to auto.*/ + --content-maxwidth: 1050px; + --table-line-height: 24px; + --toc-sticky-top: var(--spacing-medium); + --toc-width: 200px; + --toc-max-height: calc(100vh - 2 * var(--spacing-medium) - 85px); + + /* colors for various content boxes: @warning, @note, @deprecated @bug */ + --warning-color: #faf3d8; + --warning-color-dark: #f3a600; + --warning-color-darker: #5f4204; + --note-color: #e4f3ff; + --note-color-dark: #1879C4; + --note-color-darker: #274a5c; + --todo-color: #e4dafd; + --todo-color-dark: #5b2bdd; + --todo-color-darker: #2a0d72; + --deprecated-color: #ecf0f3; + --deprecated-color-dark: #5b6269; + --deprecated-color-darker: #43454a; + --bug-color: #f8d1cc; + --bug-color-dark: #b61825; + --bug-color-darker: #75070f; + --invariant-color: #d8f1e3; + --invariant-color-dark: #44b86f; + --invariant-color-darker: #265532; + + /* blockquote colors */ + --blockquote-background: #f8f9fa; + --blockquote-foreground: #636568; + + /* table colors */ + --tablehead-background: #f1f1f1; + --tablehead-foreground: var(--page-foreground-color); + + /* menu-display: block | none + * Visibility of the top navigation on screens >= 768px. On smaller screen the menu is always visible. + * `GENERATE_TREEVIEW` MUST be enabled! + */ + --menu-display: block; + + --menu-focus-foreground: var(--page-background-color); + --menu-focus-background: var(--primary-color); + --menu-selected-background: rgba(0,0,0,.05); + + + --header-background: var(--page-background-color); + --header-foreground: var(--page-foreground-color); + + /* searchbar colors */ + --searchbar-background: var(--side-nav-background); + --searchbar-foreground: var(--page-foreground-color); + + /* searchbar size + * (`searchbar-width` is only applied on screens >= 768px. + * on smaller screens the searchbar will always fill the entire screen width) */ + --searchbar-height: 33px; + --searchbar-width: 210px; + --searchbar-border-radius: var(--searchbar-height); + + /* code block colors */ + --code-background: #f5f5f5; + --code-foreground: var(--page-foreground-color); + + /* fragment colors */ + --fragment-background: #F8F9FA; + --fragment-foreground: #37474F; + --fragment-keyword: #bb6bb2; + --fragment-keywordtype: #8258b3; + --fragment-keywordflow: #d67c3b; + --fragment-token: #438a59; + --fragment-comment: #969696; + --fragment-link: #5383d6; + --fragment-preprocessor: #46aaa5; + --fragment-linenumber-color: #797979; + --fragment-linenumber-background: #f4f4f5; + --fragment-linenumber-border: #e3e5e7; + --fragment-lineheight: 20px; + + /* sidebar navigation (treeview) colors */ + --side-nav-background: #fbfbfb; + --side-nav-foreground: var(--page-foreground-color); + --side-nav-arrow-opacity: 0; + --side-nav-arrow-hover-opacity: 0.9; + + --toc-background: var(--side-nav-background); + --toc-foreground: var(--side-nav-foreground); + + /* height of an item in any tree / collapsible table */ + --tree-item-height: 30px; + + --memname-font-size: var(--code-font-size); + --memtitle-font-size: 18px; + + --webkit-scrollbar-size: 7px; + --webkit-scrollbar-padding: 4px; + --webkit-scrollbar-color: var(--separator-color); + + --animation-duration: .12s +} + +@media screen and (max-width: 767px) { + html { + --page-font-size: 16px; + --navigation-font-size: 16px; + --toc-font-size: 15px; + --code-font-size: 15px; /* affects code, fragment */ + --title-font-size: 22px; + } +} + +@media (prefers-color-scheme: dark) { + html:not(.light-mode) { + color-scheme: dark; + + --primary-color: #1982d2; + --primary-dark-color: #86a9c4; + --primary-light-color: #4779ac; + + --box-shadow: 0 2px 8px 0 rgba(0,0,0,.35); + + --odd-color: rgba(100,100,100,.06); + + --menu-selected-background: rgba(0,0,0,.4); + + --page-background-color: #1C1D1F; + --page-foreground-color: #d2dbde; + --page-secondary-foreground-color: #859399; + --separator-color: #38393b; + --side-nav-background: #252628; + + --code-background: #2a2c2f; + + --tablehead-background: #2a2c2f; + + --blockquote-background: #222325; + --blockquote-foreground: #7e8c92; + + --warning-color: #3b2e04; + --warning-color-dark: #f1b602; + --warning-color-darker: #ceb670; + --note-color: #163750; + --note-color-dark: #1982D2; + --note-color-darker: #dcf0fa; + --todo-color: #2a2536; + --todo-color-dark: #7661b3; + --todo-color-darker: #ae9ed6; + --deprecated-color: #2e323b; + --deprecated-color-dark: #738396; + --deprecated-color-darker: #abb0bd; + --bug-color: #2e1917; + --bug-color-dark: #ad2617; + --bug-color-darker: #f5b1aa; + --invariant-color: #303a35; + --invariant-color-dark: #76ce96; + --invariant-color-darker: #cceed5; + + --fragment-background: #282c34; + --fragment-foreground: #dbe4eb; + --fragment-keyword: #cc99cd; + --fragment-keywordtype: #ab99cd; + --fragment-keywordflow: #e08000; + --fragment-token: #7ec699; + --fragment-comment: #999999; + --fragment-link: #98c0e3; + --fragment-preprocessor: #65cabe; + --fragment-linenumber-color: #cccccc; + --fragment-linenumber-background: #35393c; + --fragment-linenumber-border: #1f1f1f; + } +} + +/* dark mode variables are defined twice, to support both the dark-mode without and with doxygen-awesome-darkmode-toggle.js */ +html.dark-mode { + color-scheme: dark; + + --primary-color: #1982d2; + --primary-dark-color: #86a9c4; + --primary-light-color: #4779ac; + + --box-shadow: 0 2px 8px 0 rgba(0,0,0,.30); + + --odd-color: rgba(100,100,100,.06); + + --menu-selected-background: rgba(0,0,0,.4); + + --page-background-color: #1C1D1F; + --page-foreground-color: #d2dbde; + --page-secondary-foreground-color: #859399; + --separator-color: #38393b; + --side-nav-background: #252628; + + --code-background: #2a2c2f; + + --tablehead-background: #2a2c2f; + + --blockquote-background: #222325; + --blockquote-foreground: #7e8c92; + + --warning-color: #3b2e04; + --warning-color-dark: #f1b602; + --warning-color-darker: #ceb670; + --note-color: #163750; + --note-color-dark: #1982D2; + --note-color-darker: #dcf0fa; + --todo-color: #2a2536; + --todo-color-dark: #7661b3; + --todo-color-darker: #ae9ed6; + --deprecated-color: #2e323b; + --deprecated-color-dark: #738396; + --deprecated-color-darker: #abb0bd; + --bug-color: #2e1917; + --bug-color-dark: #ad2617; + --bug-color-darker: #f5b1aa; + --invariant-color: #303a35; + --invariant-color-dark: #76ce96; + --invariant-color-darker: #cceed5; + + --fragment-background: #282c34; + --fragment-foreground: #dbe4eb; + --fragment-keyword: #cc99cd; + --fragment-keywordtype: #ab99cd; + --fragment-keywordflow: #e08000; + --fragment-token: #7ec699; + --fragment-comment: #999999; + --fragment-link: #98c0e3; + --fragment-preprocessor: #65cabe; + --fragment-linenumber-color: #cccccc; + --fragment-linenumber-background: #35393c; + --fragment-linenumber-border: #1f1f1f; +} + +body { + color: var(--page-foreground-color); + background-color: var(--page-background-color); + font-size: var(--page-font-size); +} + +body, table, div, p, dl, #nav-tree .label, .title, +.sm-dox a, .sm-dox a:hover, .sm-dox a:focus, #projectname, +.SelectItem, #MSearchField, .navpath li.navelem a, +.navpath li.navelem a:hover, p.reference, p.definition, div.toc li, div.toc h3 { + font-family: var(--font-family); +} + +h1, h2, h3, h4, h5 { + margin-top: 1em; + font-weight: 600; + line-height: initial; +} + +p, div, table, dl, p.reference, p.definition { + font-size: var(--page-font-size); +} + +p.reference, p.definition { + color: var(--page-secondary-foreground-color); +} + +a:link, a:visited, a:hover, a:focus, a:active { + color: var(--primary-color) !important; + font-weight: 500; + background: none; +} + +a.anchor { + scroll-margin-top: var(--spacing-large); + display: block; +} + +/* + Title and top navigation + */ + +#top { + background: var(--header-background); + border-bottom: 1px solid var(--separator-color); +} + +@media screen and (min-width: 768px) { + #top { + display: flex; + flex-wrap: wrap; + justify-content: space-between; + align-items: center; + } +} + +#main-nav { + flex-grow: 5; + padding: var(--spacing-small) var(--spacing-medium); +} + +#titlearea { + width: auto; + padding: var(--spacing-medium) var(--spacing-large); + background: none; + color: var(--header-foreground); + border-bottom: none; +} + +@media screen and (max-width: 767px) { + #titlearea { + padding-bottom: var(--spacing-small); + } +} + +#titlearea table tbody tr { + height: auto !important; +} + +#projectname { + font-size: var(--title-font-size); + font-weight: 600; +} + +#projectnumber { + font-family: inherit; + font-size: 60%; +} + +#projectbrief { + font-family: inherit; + font-size: 80%; +} + +#projectlogo { + vertical-align: middle; +} + +#projectlogo img { + max-height: calc(var(--title-font-size) * 2); + margin-right: var(--spacing-small); +} + +.sm-dox, .tabs, .tabs2, .tabs3 { + background: none; + padding: 0; +} + +.tabs, .tabs2, .tabs3 { + border-bottom: 1px solid var(--separator-color); + margin-bottom: -1px; +} + +.main-menu-btn-icon, .main-menu-btn-icon:before, .main-menu-btn-icon:after { + background: var(--page-secondary-foreground-color); +} + +@media screen and (max-width: 767px) { + .sm-dox a span.sub-arrow { + background: var(--code-background); + } + + #main-menu a.has-submenu span.sub-arrow { + color: var(--page-secondary-foreground-color); + border-radius: var(--border-radius-medium); + } + + #main-menu a.has-submenu:hover span.sub-arrow { + color: var(--page-foreground-color); + } +} + +@media screen and (min-width: 768px) { + .sm-dox li, .tablist li { + display: var(--menu-display); + } + + .sm-dox a span.sub-arrow { + border-color: var(--header-foreground) transparent transparent transparent; + } + + .sm-dox a:hover span.sub-arrow { + border-color: var(--menu-focus-foreground) transparent transparent transparent; + } + + .sm-dox ul a span.sub-arrow { + border-color: transparent transparent transparent var(--page-foreground-color); + } + + .sm-dox ul a:hover span.sub-arrow { + border-color: transparent transparent transparent var(--menu-focus-foreground); + } +} + +.sm-dox ul { + background: var(--page-background-color); + box-shadow: var(--box-shadow); + border: 1px solid var(--separator-color); + border-radius: var(--border-radius-medium) !important; + padding: var(--spacing-small); + animation: ease-out 150ms slideInMenu; +} + +@keyframes slideInMenu { + from { + opacity: 0; + transform: translate(0px, -2px); + } + + to { + opacity: 1; + transform: translate(0px, 0px); + } +} + +.sm-dox ul a { + color: var(--page-foreground-color) !important; + background: var(--page-background-color); + font-size: var(--navigation-font-size); +} + +.sm-dox>li>ul:after { + border-bottom-color: var(--page-background-color) !important; +} + +.sm-dox>li>ul:before { + border-bottom-color: var(--separator-color) !important; +} + +.sm-dox ul a:hover, .sm-dox ul a:active, .sm-dox ul a:focus { + font-size: var(--navigation-font-size) !important; + color: var(--menu-focus-foreground) !important; + text-shadow: none; + background-color: var(--menu-focus-background); + border-radius: var(--border-radius-small) !important; +} + +.sm-dox a, .sm-dox a:focus, .tablist li, .tablist li a, .tablist li.current a { + text-shadow: none; + background: transparent; + background-image: none !important; + color: var(--header-foreground) !important; + font-weight: normal; + font-size: var(--navigation-font-size); + border-radius: var(--border-radius-small) !important; +} + +.sm-dox a:focus { + outline: auto; +} + +.sm-dox a:hover, .sm-dox a:active, .tablist li a:hover { + text-shadow: none; + font-weight: normal; + background: var(--menu-focus-background); + color: var(--menu-focus-foreground) !important; + border-radius: var(--border-radius-small) !important; + font-size: var(--navigation-font-size); +} + +.tablist li.current { + border-radius: var(--border-radius-small); + background: var(--menu-selected-background); +} + +.tablist li { + margin: var(--spacing-small) 0 var(--spacing-small) var(--spacing-small); +} + +.tablist a { + padding: 0 var(--spacing-large); +} + + +/* + Search box + */ + +#MSearchBox { + height: var(--searchbar-height); + background: var(--searchbar-background); + border-radius: var(--searchbar-border-radius); + border: 1px solid var(--separator-color); + overflow: hidden; + width: var(--searchbar-width); + position: relative; + box-shadow: none; + display: block; + margin-top: 0; +} + +/* until Doxygen 1.9.4 */ +.left img#MSearchSelect { + left: 0; + user-select: none; + padding-left: 8px; +} + +/* Doxygen 1.9.5 */ +.left span#MSearchSelect { + left: 0; + user-select: none; + margin-left: 8px; + padding: 0; +} + +.left #MSearchSelect[src$=".png"] { + padding-left: 0 +} + +.SelectionMark { + user-select: none; +} + +.tabs .left #MSearchSelect { + padding-left: 0; +} + +.tabs #MSearchBox { + position: absolute; + right: var(--spacing-medium); +} + +@media screen and (max-width: 767px) { + .tabs #MSearchBox { + position: relative; + right: 0; + margin-left: var(--spacing-medium); + margin-top: 0; + } +} + +#MSearchSelectWindow, #MSearchResultsWindow { + z-index: 9999; +} + +#MSearchBox.MSearchBoxActive { + border-color: var(--primary-color); + box-shadow: inset 0 0 0 1px var(--primary-color); +} + +#main-menu > li:last-child { + margin-right: 0; +} + +@media screen and (max-width: 767px) { + #main-menu > li:last-child { + height: 50px; + } +} + +#MSearchField { + font-size: var(--navigation-font-size); + height: calc(var(--searchbar-height) - 2px); + background: transparent; + width: calc(var(--searchbar-width) - 64px); +} + +.MSearchBoxActive #MSearchField { + color: var(--searchbar-foreground); +} + +#MSearchSelect { + top: calc(calc(var(--searchbar-height) / 2) - 11px); +} + +#MSearchBox span.left, #MSearchBox span.right { + background: none; + background-image: none; +} + +#MSearchBox span.right { + padding-top: calc(calc(var(--searchbar-height) / 2) - 12px); + position: absolute; + right: var(--spacing-small); +} + +.tabs #MSearchBox span.right { + top: calc(calc(var(--searchbar-height) / 2) - 12px); +} + +@keyframes slideInSearchResults { + from { + opacity: 0; + transform: translate(0, 15px); + } + + to { + opacity: 1; + transform: translate(0, 20px); + } +} + +#MSearchResultsWindow { + left: auto !important; + right: var(--spacing-medium); + border-radius: var(--border-radius-large); + border: 1px solid var(--separator-color); + transform: translate(0, 20px); + box-shadow: var(--box-shadow); + animation: ease-out 280ms slideInSearchResults; + background: var(--page-background-color); +} + +iframe#MSearchResults { + margin: 4px; +} + +iframe { + color-scheme: normal; +} + +@media (prefers-color-scheme: dark) { + html:not(.light-mode) iframe#MSearchResults { + filter: invert() hue-rotate(180deg); + } +} + +html.dark-mode iframe#MSearchResults { + filter: invert() hue-rotate(180deg); +} + +#MSearchResults .SRPage { + background-color: transparent; +} + +#MSearchResults .SRPage .SREntry { + font-size: 10pt; + padding: var(--spacing-small) var(--spacing-medium); +} + +#MSearchSelectWindow { + border: 1px solid var(--separator-color); + border-radius: var(--border-radius-medium); + box-shadow: var(--box-shadow); + background: var(--page-background-color); + padding-top: var(--spacing-small); + padding-bottom: var(--spacing-small); +} + +#MSearchSelectWindow a.SelectItem { + font-size: var(--navigation-font-size); + line-height: var(--content-line-height); + margin: 0 var(--spacing-small); + border-radius: var(--border-radius-small); + color: var(--page-foreground-color) !important; + font-weight: normal; +} + +#MSearchSelectWindow a.SelectItem:hover { + background: var(--menu-focus-background); + color: var(--menu-focus-foreground) !important; +} + +@media screen and (max-width: 767px) { + #MSearchBox { + margin-top: var(--spacing-medium); + margin-bottom: var(--spacing-medium); + width: calc(100vw - 30px); + } + + #main-menu > li:last-child { + float: none !important; + } + + #MSearchField { + width: calc(100vw - 110px); + } + + @keyframes slideInSearchResultsMobile { + from { + opacity: 0; + transform: translate(0, 15px); + } + + to { + opacity: 1; + transform: translate(0, 20px); + } + } + + #MSearchResultsWindow { + left: var(--spacing-medium) !important; + right: var(--spacing-medium); + overflow: auto; + transform: translate(0, 20px); + animation: ease-out 280ms slideInSearchResultsMobile; + width: auto !important; + } + + /* + * Overwrites for fixing the searchbox on mobile in doxygen 1.9.2 + */ + label.main-menu-btn ~ #searchBoxPos1 { + top: 3px !important; + right: 6px !important; + left: 45px; + display: flex; + } + + label.main-menu-btn ~ #searchBoxPos1 > #MSearchBox { + margin-top: 0; + margin-bottom: 0; + flex-grow: 2; + float: left; + } +} + +/* + Tree view + */ + +#side-nav { + padding: 0 !important; + background: var(--side-nav-background); + min-width: 8px; + max-width: 50vw; +} + +@media screen and (max-width: 767px) { + #side-nav { + display: none; + } + + #doc-content { + margin-left: 0 !important; + } +} + +#nav-tree { + background: transparent; + margin-right: 1px; +} + +#nav-tree .label { + font-size: var(--navigation-font-size); +} + +#nav-tree .item { + height: var(--tree-item-height); + line-height: var(--tree-item-height); +} + +#nav-tree .item > a:focus { + outline: none; +} + +#nav-sync { + bottom: 12px; + right: 12px; + top: auto !important; + user-select: none; +} + +#nav-tree .selected { + text-shadow: none; + background-image: none; + background-color: transparent; + position: relative; +} + +#nav-tree .selected::after { + content: ""; + position: absolute; + top: 1px; + bottom: 1px; + left: 0; + width: 4px; + border-radius: 0 var(--border-radius-small) var(--border-radius-small) 0; + background: var(--primary-color); +} + + +#nav-tree a { + color: var(--side-nav-foreground) !important; + font-weight: normal; +} + +#nav-tree a:focus { + outline-style: auto; +} + +#nav-tree .arrow { + opacity: var(--side-nav-arrow-opacity); + background: none; +} + +.arrow { + color: inherit; + cursor: pointer; + font-size: 45%; + vertical-align: middle; + margin-right: 2px; + font-family: serif; + height: auto; + text-align: right; +} + +#nav-tree div.item:hover .arrow, #nav-tree a:focus .arrow { + opacity: var(--side-nav-arrow-hover-opacity); +} + +#nav-tree .selected a { + color: var(--primary-color) !important; + font-weight: bolder; + font-weight: 600; +} + +.ui-resizable-e { + width: 4px; + background: transparent; + box-shadow: inset -1px 0 0 0 var(--separator-color); +} + +/* + Contents + */ + +div.header { + border-bottom: 1px solid var(--separator-color); + background-color: var(--page-background-color); + background-image: none; +} + +@media screen and (min-width: 1000px) { + #doc-content > div > div.contents, + .PageDoc > div.contents { + display: flex; + flex-direction: row-reverse; + flex-wrap: nowrap; + align-items: flex-start; + } + + div.contents .textblock { + min-width: 200px; + flex-grow: 1; + } +} + +div.contents, div.header .title, div.header .summary { + max-width: var(--content-maxwidth); +} + +div.contents, div.header .title { + line-height: initial; + margin: calc(var(--spacing-medium) + .2em) auto var(--spacing-medium) auto; +} + +div.header .summary { + margin: var(--spacing-medium) auto 0 auto; +} + +div.headertitle { + padding: 0; +} + +div.header .title { + font-weight: 600; + font-size: 225%; + padding: var(--spacing-medium) var(--spacing-large); + word-break: break-word; +} + +div.header .summary { + width: auto; + display: block; + float: none; + padding: 0 var(--spacing-large); +} + +td.memSeparator { + border-color: var(--separator-color); +} + +span.mlabel { + background: var(--primary-color); + border: none; + padding: 4px 9px; + border-radius: 12px; + margin-right: var(--spacing-medium); +} + +span.mlabel:last-of-type { + margin-right: 2px; +} + +div.contents { + padding: 0 var(--spacing-large); +} + +div.contents p, div.contents li { + line-height: var(--content-line-height); +} + +div.contents div.dyncontent { + margin: var(--spacing-medium) 0; +} + +@media (prefers-color-scheme: dark) { + html:not(.light-mode) div.contents div.dyncontent img, + html:not(.light-mode) div.contents center img, + html:not(.light-mode) div.contents > table img, + html:not(.light-mode) div.contents div.dyncontent iframe, + html:not(.light-mode) div.contents center iframe, + html:not(.light-mode) div.contents table iframe, + html:not(.light-mode) div.contents .dotgraph iframe { + filter: brightness(89%) hue-rotate(180deg) invert(); + } +} + +html.dark-mode div.contents div.dyncontent img, +html.dark-mode div.contents center img, +html.dark-mode div.contents > table img, +html.dark-mode div.contents div.dyncontent iframe, +html.dark-mode div.contents center iframe, +html.dark-mode div.contents table iframe, +html.dark-mode div.contents .dotgraph iframe + { + filter: brightness(89%) hue-rotate(180deg) invert(); +} + +h2.groupheader { + border-bottom: 0px; + color: var(--page-foreground-color); + box-shadow: + 100px 0 var(--page-background-color), + -100px 0 var(--page-background-color), + 100px 0.75px var(--separator-color), + -100px 0.75px var(--separator-color), + 500px 0 var(--page-background-color), + -500px 0 var(--page-background-color), + 500px 0.75px var(--separator-color), + -500px 0.75px var(--separator-color), + 900px 0 var(--page-background-color), + -900px 0 var(--page-background-color), + 900px 0.75px var(--separator-color), + -900px 0.75px var(--separator-color), + 1400px 0 var(--page-background-color), + -1400px 0 var(--page-background-color), + 1400px 0.75px var(--separator-color), + -1400px 0.75px var(--separator-color), + 1900px 0 var(--page-background-color), + -1900px 0 var(--page-background-color), + 1900px 0.75px var(--separator-color), + -1900px 0.75px var(--separator-color); +} + +blockquote { + margin: 0 var(--spacing-medium) 0 var(--spacing-medium); + padding: var(--spacing-small) var(--spacing-large); + background: var(--blockquote-background); + color: var(--blockquote-foreground); + border-left: 0; + overflow: visible; + border-radius: var(--border-radius-medium); + overflow: visible; + position: relative; +} + +blockquote::before, blockquote::after { + font-weight: bold; + font-family: serif; + font-size: 360%; + opacity: .15; + position: absolute; +} + +blockquote::before { + content: "“"; + left: -10px; + top: 4px; +} + +blockquote::after { + content: "”"; + right: -8px; + bottom: -25px; +} + +blockquote p { + margin: var(--spacing-small) 0 var(--spacing-medium) 0; +} +.paramname, .paramname em { + font-weight: 600; + color: var(--primary-dark-color); +} + +.paramname > code { + border: 0; +} + +table.params .paramname { + font-weight: 600; + font-family: var(--font-family-monospace); + font-size: var(--code-font-size); + padding-right: var(--spacing-small); + line-height: var(--table-line-height); +} + +h1.glow, h2.glow, h3.glow, h4.glow, h5.glow, h6.glow { + text-shadow: 0 0 15px var(--primary-light-color); +} + +.alphachar a { + color: var(--page-foreground-color); +} + +.dotgraph { + max-width: 100%; + overflow-x: scroll; +} + +.dotgraph .caption { + position: sticky; + left: 0; +} + +/* Wrap Graphviz graphs with the `interactive_dotgraph` class if `INTERACTIVE_SVG = YES` */ +.interactive_dotgraph .dotgraph iframe { + max-width: 100%; +} + +/* + Table of Contents + */ + +div.contents .toc { + max-height: var(--toc-max-height); + min-width: var(--toc-width); + border: 0; + border-left: 1px solid var(--separator-color); + border-radius: 0; + background-color: var(--page-background-color); + box-shadow: none; + position: sticky; + top: var(--toc-sticky-top); + padding: 0 var(--spacing-large); + margin: var(--spacing-small) 0 var(--spacing-large) var(--spacing-large); +} + +div.toc h3 { + color: var(--toc-foreground); + font-size: var(--navigation-font-size); + margin: var(--spacing-large) 0 var(--spacing-medium) 0; +} + +div.toc li { + padding: 0; + background: none; + line-height: var(--toc-font-size); + margin: var(--toc-font-size) 0 0 0; +} + +div.toc li::before { + display: none; +} + +div.toc ul { + margin-top: 0 +} + +div.toc li a { + font-size: var(--toc-font-size); + color: var(--page-foreground-color) !important; + text-decoration: none; +} + +div.toc li a:hover, div.toc li a.active { + color: var(--primary-color) !important; +} + +div.toc li a.aboveActive { + color: var(--page-secondary-foreground-color) !important; +} + + +@media screen and (max-width: 999px) { + div.contents .toc { + max-height: 45vh; + float: none; + width: auto; + margin: 0 0 var(--spacing-medium) 0; + position: relative; + top: 0; + position: relative; + border: 1px solid var(--separator-color); + border-radius: var(--border-radius-medium); + background-color: var(--toc-background); + box-shadow: var(--box-shadow); + } + + div.contents .toc.interactive { + max-height: calc(var(--navigation-font-size) + 2 * var(--spacing-large)); + overflow: hidden; + } + + div.contents .toc > h3 { + -webkit-tap-highlight-color: transparent; + cursor: pointer; + position: sticky; + top: 0; + background-color: var(--toc-background); + margin: 0; + padding: var(--spacing-large) 0; + display: block; + } + + div.contents .toc.interactive > h3::before { + content: ""; + width: 0; + height: 0; + border-left: 4px solid transparent; + border-right: 4px solid transparent; + border-top: 5px solid var(--primary-color); + display: inline-block; + margin-right: var(--spacing-small); + margin-bottom: calc(var(--navigation-font-size) / 4); + transform: rotate(-90deg); + transition: transform var(--animation-duration) ease-out; + } + + div.contents .toc.interactive.open > h3::before { + transform: rotate(0deg); + } + + div.contents .toc.interactive.open { + max-height: 45vh; + overflow: auto; + transition: max-height 0.2s ease-in-out; + } + + div.contents .toc a, div.contents .toc a.active { + color: var(--primary-color) !important; + } + + div.contents .toc a:hover { + text-decoration: underline; + } +} + +/* + Code & Fragments + */ + +code, div.fragment, pre.fragment { + border-radius: var(--border-radius-small); + border: 1px solid var(--separator-color); + overflow: hidden; +} + +code { + display: inline; + background: var(--code-background); + color: var(--code-foreground); + padding: 2px 6px; +} + +div.fragment, pre.fragment { + margin: var(--spacing-medium) 0; + padding: calc(var(--spacing-large) - (var(--spacing-large) / 6)) var(--spacing-large); + background: var(--fragment-background); + color: var(--fragment-foreground); + overflow-x: auto; +} + +@media screen and (max-width: 767px) { + div.fragment, pre.fragment { + border-top-right-radius: 0; + border-bottom-right-radius: 0; + border-right: 0; + } + + .contents > div.fragment, + .textblock > div.fragment, + .textblock > pre.fragment, + .textblock > .tabbed > ul > li > div.fragment, + .textblock > .tabbed > ul > li > pre.fragment, + .contents > .doxygen-awesome-fragment-wrapper > div.fragment, + .textblock > .doxygen-awesome-fragment-wrapper > div.fragment, + .textblock > .doxygen-awesome-fragment-wrapper > pre.fragment, + .textblock > .tabbed > ul > li > .doxygen-awesome-fragment-wrapper > div.fragment, + .textblock > .tabbed > ul > li > .doxygen-awesome-fragment-wrapper > pre.fragment { + margin: var(--spacing-medium) calc(0px - var(--spacing-large)); + border-radius: 0; + border-left: 0; + } + + .textblock li > .fragment, + .textblock li > .doxygen-awesome-fragment-wrapper > .fragment { + margin: var(--spacing-medium) calc(0px - var(--spacing-large)); + } + + .memdoc li > .fragment, + .memdoc li > .doxygen-awesome-fragment-wrapper > .fragment { + margin: var(--spacing-medium) calc(0px - var(--spacing-medium)); + } + + .textblock ul, .memdoc ul { + overflow: initial; + } + + .memdoc > div.fragment, + .memdoc > pre.fragment, + dl dd > div.fragment, + dl dd pre.fragment, + .memdoc > .doxygen-awesome-fragment-wrapper > div.fragment, + .memdoc > .doxygen-awesome-fragment-wrapper > pre.fragment, + dl dd > .doxygen-awesome-fragment-wrapper > div.fragment, + dl dd .doxygen-awesome-fragment-wrapper > pre.fragment { + margin: var(--spacing-medium) calc(0px - var(--spacing-medium)); + border-radius: 0; + border-left: 0; + } +} + +code, code a, pre.fragment, div.fragment, div.fragment .line, div.fragment span, div.fragment .line a, div.fragment .line span { + font-family: var(--font-family-monospace); + font-size: var(--code-font-size) !important; +} + +div.line:after { + margin-right: var(--spacing-medium); +} + +div.fragment .line, pre.fragment { + white-space: pre; + word-wrap: initial; + line-height: var(--fragment-lineheight); +} + +div.fragment span.keyword { + color: var(--fragment-keyword); +} + +div.fragment span.keywordtype { + color: var(--fragment-keywordtype); +} + +div.fragment span.keywordflow { + color: var(--fragment-keywordflow); +} + +div.fragment span.stringliteral { + color: var(--fragment-token) +} + +div.fragment span.comment { + color: var(--fragment-comment); +} + +div.fragment a.code { + color: var(--fragment-link) !important; +} + +div.fragment span.preprocessor { + color: var(--fragment-preprocessor); +} + +div.fragment span.lineno { + display: inline-block; + width: 27px; + border-right: none; + background: var(--fragment-linenumber-background); + color: var(--fragment-linenumber-color); +} + +div.fragment span.lineno a { + background: none; + color: var(--fragment-link) !important; +} + +div.fragment > .line:first-child .lineno { + box-shadow: -999999px 0px 0 999999px var(--fragment-linenumber-background), -999998px 0px 0 999999px var(--fragment-linenumber-border); + background-color: var(--fragment-linenumber-background) !important; +} + +div.line { + border-radius: var(--border-radius-small); +} + +div.line.glow { + background-color: var(--primary-light-color); + box-shadow: none; +} + +/* + dl warning, attention, note, deprecated, bug, ... + */ + +dl.bug dt a, dl.deprecated dt a, dl.todo dt a { + font-weight: bold !important; +} + +dl.warning, dl.attention, dl.note, dl.deprecated, dl.bug, dl.invariant, dl.pre, dl.post, dl.todo, dl.remark { + padding: var(--spacing-medium); + margin: var(--spacing-medium) 0; + color: var(--page-background-color); + overflow: hidden; + margin-left: 0; + border-radius: var(--border-radius-small); +} + +dl.section dd { + margin-bottom: 2px; +} + +dl.warning, dl.attention { + background: var(--warning-color); + border-left: 8px solid var(--warning-color-dark); + color: var(--warning-color-darker); +} + +dl.warning dt, dl.attention dt { + color: var(--warning-color-dark); +} + +dl.note, dl.remark { + background: var(--note-color); + border-left: 8px solid var(--note-color-dark); + color: var(--note-color-darker); +} + +dl.note dt, dl.remark dt { + color: var(--note-color-dark); +} + +dl.todo { + background: var(--todo-color); + border-left: 8px solid var(--todo-color-dark); + color: var(--todo-color-darker); +} + +dl.todo dt a { + color: var(--todo-color-dark) !important; +} + +dl.bug dt a { + color: var(--todo-color-dark) !important; +} + +dl.bug { + background: var(--bug-color); + border-left: 8px solid var(--bug-color-dark); + color: var(--bug-color-darker); +} + +dl.bug dt a { + color: var(--bug-color-dark) !important; +} + +dl.deprecated { + background: var(--deprecated-color); + border-left: 8px solid var(--deprecated-color-dark); + color: var(--deprecated-color-darker); +} + +dl.deprecated dt a { + color: var(--deprecated-color-dark) !important; +} + +dl.section dd, dl.bug dd, dl.deprecated dd, dl.todo dd { + margin-inline-start: 0px; +} + +dl.invariant, dl.pre, dl.post { + background: var(--invariant-color); + border-left: 8px solid var(--invariant-color-dark); + color: var(--invariant-color-darker); +} + +dl.invariant dt, dl.pre dt, dl.post dt { + color: var(--invariant-color-dark); +} + +/* + memitem + */ + +div.memdoc, div.memproto, h2.memtitle { + box-shadow: none; + background-image: none; + border: none; +} + +div.memdoc { + padding: 0 var(--spacing-medium); + background: var(--page-background-color); +} + +h2.memtitle, div.memitem { + border: 1px solid var(--separator-color); + box-shadow: var(--box-shadow); +} + +h2.memtitle { + box-shadow: 0px var(--spacing-medium) 0 -1px var(--fragment-background), var(--box-shadow); +} + +div.memitem { + transition: none; +} + +div.memproto, h2.memtitle { + background: var(--fragment-background); +} + +h2.memtitle { + font-weight: 500; + font-size: var(--memtitle-font-size); + font-family: var(--font-family-monospace); + border-bottom: none; + border-top-left-radius: var(--border-radius-medium); + border-top-right-radius: var(--border-radius-medium); + word-break: break-all; + position: relative; +} + +h2.memtitle:after { + content: ""; + display: block; + background: var(--fragment-background); + height: var(--spacing-medium); + bottom: calc(0px - var(--spacing-medium)); + left: 0; + right: -14px; + position: absolute; + border-top-right-radius: var(--border-radius-medium); +} + +h2.memtitle > span.permalink { + font-size: inherit; +} + +h2.memtitle > span.permalink > a { + text-decoration: none; + padding-left: 3px; + margin-right: -4px; + user-select: none; + display: inline-block; + margin-top: -6px; +} + +h2.memtitle > span.permalink > a:hover { + color: var(--primary-dark-color) !important; +} + +a:target + h2.memtitle, a:target + h2.memtitle + div.memitem { + border-color: var(--primary-light-color); +} + +div.memitem { + border-top-right-radius: var(--border-radius-medium); + border-bottom-right-radius: var(--border-radius-medium); + border-bottom-left-radius: var(--border-radius-medium); + overflow: hidden; + display: block !important; +} + +div.memdoc { + border-radius: 0; +} + +div.memproto { + border-radius: 0 var(--border-radius-small) 0 0; + overflow: auto; + border-bottom: 1px solid var(--separator-color); + padding: var(--spacing-medium); + margin-bottom: -1px; +} + +div.memtitle { + border-top-right-radius: var(--border-radius-medium); + border-top-left-radius: var(--border-radius-medium); +} + +div.memproto table.memname { + font-family: var(--font-family-monospace); + color: var(--page-foreground-color); + font-size: var(--memname-font-size); + text-shadow: none; +} + +div.memproto div.memtemplate { + font-family: var(--font-family-monospace); + color: var(--primary-dark-color); + font-size: var(--memname-font-size); + margin-left: 2px; + text-shadow: none; +} + +table.mlabels, table.mlabels > tbody { + display: block; +} + +td.mlabels-left { + width: auto; +} + +td.mlabels-right { + margin-top: 3px; + position: sticky; + left: 0; +} + +table.mlabels > tbody > tr:first-child { + display: flex; + justify-content: space-between; + flex-wrap: wrap; +} + +.memname, .memitem span.mlabels { + margin: 0 +} + +/* + reflist + */ + +dl.reflist { + box-shadow: var(--box-shadow); + border-radius: var(--border-radius-medium); + border: 1px solid var(--separator-color); + overflow: hidden; + padding: 0; +} + + +dl.reflist dt, dl.reflist dd { + box-shadow: none; + text-shadow: none; + background-image: none; + border: none; + padding: 12px; +} + + +dl.reflist dt { + font-weight: 500; + border-radius: 0; + background: var(--code-background); + border-bottom: 1px solid var(--separator-color); + color: var(--page-foreground-color) +} + + +dl.reflist dd { + background: none; +} + +/* + Table + */ + +.contents table:not(.memberdecls):not(.mlabels):not(.fieldtable):not(.memname), +.contents table:not(.memberdecls):not(.mlabels):not(.fieldtable):not(.memname) tbody { + display: inline-block; + max-width: 100%; +} + +.contents > table:not(.memberdecls):not(.mlabels):not(.fieldtable):not(.memname):not(.classindex) { + margin-left: calc(0px - var(--spacing-large)); + margin-right: calc(0px - var(--spacing-large)); + max-width: calc(100% + 2 * var(--spacing-large)); +} + +table.fieldtable, +table.markdownTable tbody, +table.doxtable tbody { + border: none; + margin: var(--spacing-medium) 0; + box-shadow: 0 0 0 1px var(--separator-color); + border-radius: var(--border-radius-small); +} + +table.markdownTable, table.doxtable, table.fieldtable { + padding: 1px; +} + +table.doxtable caption { + display: block; +} + +table.fieldtable { + border-collapse: collapse; + width: 100%; +} + +th.markdownTableHeadLeft, +th.markdownTableHeadRight, +th.markdownTableHeadCenter, +th.markdownTableHeadNone, +table.doxtable th { + background: var(--tablehead-background); + color: var(--tablehead-foreground); + font-weight: 600; + font-size: var(--page-font-size); +} + +th.markdownTableHeadLeft:first-child, +th.markdownTableHeadRight:first-child, +th.markdownTableHeadCenter:first-child, +th.markdownTableHeadNone:first-child, +table.doxtable tr th:first-child { + border-top-left-radius: var(--border-radius-small); +} + +th.markdownTableHeadLeft:last-child, +th.markdownTableHeadRight:last-child, +th.markdownTableHeadCenter:last-child, +th.markdownTableHeadNone:last-child, +table.doxtable tr th:last-child { + border-top-right-radius: var(--border-radius-small); +} + +table.markdownTable td, +table.markdownTable th, +table.fieldtable td, +table.fieldtable th, +table.doxtable td, +table.doxtable th { + border: 1px solid var(--separator-color); + padding: var(--spacing-small) var(--spacing-medium); +} + +table.markdownTable td:last-child, +table.markdownTable th:last-child, +table.fieldtable td:last-child, +table.fieldtable th:last-child, +table.doxtable td:last-child, +table.doxtable th:last-child { + border-right: none; +} + +table.markdownTable td:first-child, +table.markdownTable th:first-child, +table.fieldtable td:first-child, +table.fieldtable th:first-child, +table.doxtable td:first-child, +table.doxtable th:first-child { + border-left: none; +} + +table.markdownTable tr:first-child td, +table.markdownTable tr:first-child th, +table.fieldtable tr:first-child td, +table.fieldtable tr:first-child th, +table.doxtable tr:first-child td, +table.doxtable tr:first-child th { + border-top: none; +} + +table.markdownTable tr:last-child td, +table.markdownTable tr:last-child th, +table.fieldtable tr:last-child td, +table.fieldtable tr:last-child th, +table.doxtable tr:last-child td, +table.doxtable tr:last-child th { + border-bottom: none; +} + +table.markdownTable tr, table.doxtable tr { + border-bottom: 1px solid var(--separator-color); +} + +table.markdownTable tr:last-child, table.doxtable tr:last-child { + border-bottom: none; +} + +.full_width_table table:not(.memberdecls):not(.mlabels):not(.fieldtable):not(.memname) { + display: block; +} + +.full_width_table table:not(.memberdecls):not(.mlabels):not(.fieldtable):not(.memname) tbody { + display: table; + width: 100%; +} + +table.fieldtable th { + font-size: var(--page-font-size); + font-weight: 600; + background-image: none; + background-color: var(--tablehead-background); + color: var(--tablehead-foreground); +} + +table.fieldtable td.fieldtype, .fieldtable td.fieldname, .fieldtable td.fielddoc, .fieldtable th { + border-bottom: 1px solid var(--separator-color); + border-right: 1px solid var(--separator-color); +} + +table.fieldtable tr:last-child td:first-child { + border-bottom-left-radius: var(--border-radius-small); +} + +table.fieldtable tr:last-child td:last-child { + border-bottom-right-radius: var(--border-radius-small); +} + +.memberdecls td.glow, .fieldtable tr.glow { + background-color: var(--primary-light-color); + box-shadow: none; +} + +table.memberdecls { + display: block; + -webkit-tap-highlight-color: transparent; +} + +table.memberdecls tr[class^='memitem'] { + font-family: var(--font-family-monospace); + font-size: var(--code-font-size); +} + +table.memberdecls tr[class^='memitem'] .memTemplParams { + font-family: var(--font-family-monospace); + font-size: var(--code-font-size); + color: var(--primary-dark-color); + white-space: normal; +} + +table.memberdecls .memItemLeft, +table.memberdecls .memItemRight, +table.memberdecls .memTemplItemLeft, +table.memberdecls .memTemplItemRight, +table.memberdecls .memTemplParams { + transition: none; + padding-top: var(--spacing-small); + padding-bottom: var(--spacing-small); + border-top: 1px solid var(--separator-color); + border-bottom: 1px solid var(--separator-color); + background-color: var(--fragment-background); +} + +table.memberdecls .memTemplItemLeft, +table.memberdecls .memTemplItemRight { + padding-top: 2px; +} + +table.memberdecls .memTemplParams { + border-bottom: 0; + border-left: 1px solid var(--separator-color); + border-right: 1px solid var(--separator-color); + border-radius: var(--border-radius-small) var(--border-radius-small) 0 0; + padding-bottom: var(--spacing-small); +} + +table.memberdecls .memTemplItemLeft { + border-radius: 0 0 0 var(--border-radius-small); + border-left: 1px solid var(--separator-color); + border-top: 0; +} + +table.memberdecls .memTemplItemRight { + border-radius: 0 0 var(--border-radius-small) 0; + border-right: 1px solid var(--separator-color); + padding-left: 0; + border-top: 0; +} + +table.memberdecls .memItemLeft { + border-radius: var(--border-radius-small) 0 0 var(--border-radius-small); + border-left: 1px solid var(--separator-color); + padding-left: var(--spacing-medium); + padding-right: 0; +} + +table.memberdecls .memItemRight { + border-radius: 0 var(--border-radius-small) var(--border-radius-small) 0; + border-right: 1px solid var(--separator-color); + padding-right: var(--spacing-medium); + padding-left: 0; + +} + +table.memberdecls .mdescLeft, table.memberdecls .mdescRight { + background: none; + color: var(--page-foreground-color); + padding: var(--spacing-small) 0; +} + +table.memberdecls .memItemLeft, +table.memberdecls .memTemplItemLeft { + padding-right: var(--spacing-medium); +} + +table.memberdecls .memSeparator { + background: var(--page-background-color); + height: var(--spacing-large); + border: 0; + transition: none; +} + +table.memberdecls .groupheader { + margin-bottom: var(--spacing-large); +} + +table.memberdecls .inherit_header td { + padding: 0 0 var(--spacing-medium) 0; + text-indent: -12px; + color: var(--page-secondary-foreground-color); +} + +table.memberdecls img[src="closed.png"], +table.memberdecls img[src="open.png"], +div.dynheader img[src="open.png"], +div.dynheader img[src="closed.png"] { + width: 0; + height: 0; + border-left: 4px solid transparent; + border-right: 4px solid transparent; + border-top: 5px solid var(--primary-color); + margin-top: 8px; + display: block; + float: left; + margin-left: -10px; + transition: transform var(--animation-duration) ease-out; +} + +table.memberdecls img { + margin-right: 10px; +} + +table.memberdecls img[src="closed.png"], +div.dynheader img[src="closed.png"] { + transform: rotate(-90deg); + +} + +.compoundTemplParams { + font-family: var(--font-family-monospace); + color: var(--primary-dark-color); + font-size: var(--code-font-size); +} + +@media screen and (max-width: 767px) { + + table.memberdecls .memItemLeft, + table.memberdecls .memItemRight, + table.memberdecls .mdescLeft, + table.memberdecls .mdescRight, + table.memberdecls .memTemplItemLeft, + table.memberdecls .memTemplItemRight, + table.memberdecls .memTemplParams { + display: block; + text-align: left; + padding-left: var(--spacing-large); + margin: 0 calc(0px - var(--spacing-large)) 0 calc(0px - var(--spacing-large)); + border-right: none; + border-left: none; + border-radius: 0; + white-space: normal; + } + + table.memberdecls .memItemLeft, + table.memberdecls .mdescLeft, + table.memberdecls .memTemplItemLeft { + border-bottom: 0; + padding-bottom: 0; + } + + table.memberdecls .memTemplItemLeft { + padding-top: 0; + } + + table.memberdecls .mdescLeft { + margin-bottom: calc(0px - var(--page-font-size)); + } + + table.memberdecls .memItemRight, + table.memberdecls .mdescRight, + table.memberdecls .memTemplItemRight { + border-top: 0; + padding-top: 0; + padding-right: var(--spacing-large); + overflow-x: auto; + } + + table.memberdecls tr[class^='memitem']:not(.inherit) { + display: block; + width: calc(100vw - 2 * var(--spacing-large)); + } + + table.memberdecls .mdescRight { + color: var(--page-foreground-color); + } + + table.memberdecls tr.inherit { + visibility: hidden; + } + + table.memberdecls tr[style="display: table-row;"] { + display: block !important; + visibility: visible; + width: calc(100vw - 2 * var(--spacing-large)); + animation: fade .5s; + } + + @keyframes fade { + 0% { + opacity: 0; + max-height: 0; + } + + 100% { + opacity: 1; + max-height: 200px; + } + } +} + + +/* + Horizontal Rule + */ + +hr { + margin-top: var(--spacing-large); + margin-bottom: var(--spacing-large); + height: 1px; + background-color: var(--separator-color); + border: 0; +} + +.contents hr { + box-shadow: 100px 0 var(--separator-color), + -100px 0 var(--separator-color), + 500px 0 var(--separator-color), + -500px 0 var(--separator-color), + 900px 0 var(--separator-color), + -900px 0 var(--separator-color), + 1400px 0 var(--separator-color), + -1400px 0 var(--separator-color), + 1900px 0 var(--separator-color), + -1900px 0 var(--separator-color); +} + +.contents img, .contents .center, .contents center, .contents div.image object { + max-width: 100%; + overflow: auto; +} + +@media screen and (max-width: 767px) { + .contents .dyncontent > .center, .contents > center { + margin-left: calc(0px - var(--spacing-large)); + margin-right: calc(0px - var(--spacing-large)); + max-width: calc(100% + 2 * var(--spacing-large)); + } +} + +/* + Directories + */ +div.directory { + border-top: 1px solid var(--separator-color); + border-bottom: 1px solid var(--separator-color); + width: auto; +} + +table.directory { + font-family: var(--font-family); + font-size: var(--page-font-size); + font-weight: normal; + width: 100%; +} + +table.directory td.entry, table.directory td.desc { + padding: calc(var(--spacing-small) / 2) var(--spacing-small); + line-height: var(--table-line-height); +} + +table.directory tr.even td:last-child { + border-radius: 0 var(--border-radius-small) var(--border-radius-small) 0; +} + +table.directory tr.even td:first-child { + border-radius: var(--border-radius-small) 0 0 var(--border-radius-small); +} + +table.directory tr.even:last-child td:last-child { + border-radius: 0 var(--border-radius-small) 0 0; +} + +table.directory tr.even:last-child td:first-child { + border-radius: var(--border-radius-small) 0 0 0; +} + +table.directory td.desc { + min-width: 250px; +} + +table.directory tr.even { + background-color: var(--odd-color); +} + +table.directory tr.odd { + background-color: transparent; +} + +.icona { + width: auto; + height: auto; + margin: 0 var(--spacing-small); +} + +.icon { + background: var(--primary-color); + border-radius: var(--border-radius-small); + font-size: var(--page-font-size); + padding: calc(var(--page-font-size) / 5); + line-height: var(--page-font-size); + transform: scale(0.8); + height: auto; + width: var(--page-font-size); + user-select: none; +} + +.iconfopen, .icondoc, .iconfclosed { + background-position: center; + margin-bottom: 0; + height: var(--table-line-height); +} + +.icondoc { + filter: saturate(0.2); +} + +@media screen and (max-width: 767px) { + div.directory { + margin-left: calc(0px - var(--spacing-large)); + margin-right: calc(0px - var(--spacing-large)); + } +} + +@media (prefers-color-scheme: dark) { + html:not(.light-mode) .iconfopen, html:not(.light-mode) .iconfclosed { + filter: hue-rotate(180deg) invert(); + } +} + +html.dark-mode .iconfopen, html.dark-mode .iconfclosed { + filter: hue-rotate(180deg) invert(); +} + +/* + Class list + */ + +.classindex dl.odd { + background: var(--odd-color); + border-radius: var(--border-radius-small); +} + +.classindex dl.even { + background-color: transparent; +} + +/* + Class Index Doxygen 1.8 +*/ + +table.classindex { + margin-left: 0; + margin-right: 0; + width: 100%; +} + +table.classindex table div.ah { + background-image: none; + background-color: initial; + border-color: var(--separator-color); + color: var(--page-foreground-color); + box-shadow: var(--box-shadow); + border-radius: var(--border-radius-large); + padding: var(--spacing-small); +} + +div.qindex { + background-color: var(--odd-color); + border-radius: var(--border-radius-small); + border: 1px solid var(--separator-color); + padding: var(--spacing-small) 0; +} + +/* + Footer and nav-path + */ + +#nav-path { + width: 100%; +} + +#nav-path ul { + background-image: none; + background: var(--page-background-color); + border: none; + border-top: 1px solid var(--separator-color); + border-bottom: 1px solid var(--separator-color); + border-bottom: 0; + box-shadow: 0 0.75px 0 var(--separator-color); + font-size: var(--navigation-font-size); +} + +img.footer { + width: 60px; +} + +.navpath li.footer { + color: var(--page-secondary-foreground-color); +} + +address.footer { + color: var(--page-secondary-foreground-color); + margin-bottom: var(--spacing-large); +} + +#nav-path li.navelem { + background-image: none; + display: flex; + align-items: center; +} + +.navpath li.navelem a { + text-shadow: none; + display: inline-block; + color: var(--primary-color) !important; +} + +.navpath li.navelem b { + color: var(--primary-dark-color); + font-weight: 500; +} + +li.navelem { + padding: 0; + margin-left: -8px; +} + +li.navelem:first-child { + margin-left: var(--spacing-large); +} + +li.navelem:first-child:before { + display: none; +} + +#nav-path li.navelem:after { + content: ''; + border: 5px solid var(--page-background-color); + border-bottom-color: transparent; + border-right-color: transparent; + border-top-color: transparent; + transform: translateY(-1px) scaleY(4.2); + z-index: 10; + margin-left: 6px; +} + +#nav-path li.navelem:before { + content: ''; + border: 5px solid var(--separator-color); + border-bottom-color: transparent; + border-right-color: transparent; + border-top-color: transparent; + transform: translateY(-1px) scaleY(3.2); + margin-right: var(--spacing-small); +} + +.navpath li.navelem a:hover { + color: var(--primary-color); +} + +/* + Scrollbars for Webkit +*/ + +#nav-tree::-webkit-scrollbar, +div.fragment::-webkit-scrollbar, +pre.fragment::-webkit-scrollbar, +div.memproto::-webkit-scrollbar, +.contents center::-webkit-scrollbar, +.contents .center::-webkit-scrollbar, +.contents table:not(.memberdecls):not(.mlabels):not(.fieldtable):not(.memname) tbody::-webkit-scrollbar, +div.contents .toc::-webkit-scrollbar, +.contents .dotgraph::-webkit-scrollbar, +.contents .tabs-overview-container::-webkit-scrollbar { + background: transparent; + width: calc(var(--webkit-scrollbar-size) + var(--webkit-scrollbar-padding) + var(--webkit-scrollbar-padding)); + height: calc(var(--webkit-scrollbar-size) + var(--webkit-scrollbar-padding) + var(--webkit-scrollbar-padding)); +} + +#nav-tree::-webkit-scrollbar-thumb, +div.fragment::-webkit-scrollbar-thumb, +pre.fragment::-webkit-scrollbar-thumb, +div.memproto::-webkit-scrollbar-thumb, +.contents center::-webkit-scrollbar-thumb, +.contents .center::-webkit-scrollbar-thumb, +.contents table:not(.memberdecls):not(.mlabels):not(.fieldtable):not(.memname) tbody::-webkit-scrollbar-thumb, +div.contents .toc::-webkit-scrollbar-thumb, +.contents .dotgraph::-webkit-scrollbar-thumb, +.contents .tabs-overview-container::-webkit-scrollbar-thumb { + background-color: transparent; + border: var(--webkit-scrollbar-padding) solid transparent; + border-radius: calc(var(--webkit-scrollbar-padding) + var(--webkit-scrollbar-padding)); + background-clip: padding-box; +} + +#nav-tree:hover::-webkit-scrollbar-thumb, +div.fragment:hover::-webkit-scrollbar-thumb, +pre.fragment:hover::-webkit-scrollbar-thumb, +div.memproto:hover::-webkit-scrollbar-thumb, +.contents center:hover::-webkit-scrollbar-thumb, +.contents .center:hover::-webkit-scrollbar-thumb, +.contents table:not(.memberdecls):not(.mlabels):not(.fieldtable):not(.memname) tbody:hover::-webkit-scrollbar-thumb, +div.contents .toc:hover::-webkit-scrollbar-thumb, +.contents .dotgraph:hover::-webkit-scrollbar-thumb, +.contents .tabs-overview-container:hover::-webkit-scrollbar-thumb { + background-color: var(--webkit-scrollbar-color); +} + +#nav-tree::-webkit-scrollbar-track, +div.fragment::-webkit-scrollbar-track, +pre.fragment::-webkit-scrollbar-track, +div.memproto::-webkit-scrollbar-track, +.contents center::-webkit-scrollbar-track, +.contents .center::-webkit-scrollbar-track, +.contents table:not(.memberdecls):not(.mlabels):not(.fieldtable):not(.memname) tbody::-webkit-scrollbar-track, +div.contents .toc::-webkit-scrollbar-track, +.contents .dotgraph::-webkit-scrollbar-track, +.contents .tabs-overview-container::-webkit-scrollbar-track { + background: transparent; +} + +#nav-tree::-webkit-scrollbar-corner { + background-color: var(--side-nav-background); +} + +#nav-tree, +div.fragment, +pre.fragment, +div.memproto, +.contents center, +.contents .center, +.contents table:not(.memberdecls):not(.mlabels):not(.fieldtable):not(.memname) tbody, +div.contents .toc { + overflow-x: auto; + overflow-x: overlay; +} + +#nav-tree { + overflow-x: auto; + overflow-y: auto; + overflow-y: overlay; +} + +/* + Scrollbars for Firefox +*/ + +#nav-tree, +div.fragment, +pre.fragment, +div.memproto, +.contents center, +.contents .center, +.contents table:not(.memberdecls):not(.mlabels):not(.fieldtable):not(.memname) tbody, +div.contents .toc, +.contents .dotgraph, +.contents .tabs-overview-container { + scrollbar-width: thin; +} + +/* + Optional Dark mode toggle button +*/ + +doxygen-awesome-dark-mode-toggle { + display: inline-block; + margin: 0 0 0 var(--spacing-small); + padding: 0; + width: var(--searchbar-height); + height: var(--searchbar-height); + background: none; + border: none; + border-radius: var(--searchbar-height); + vertical-align: middle; + text-align: center; + line-height: var(--searchbar-height); + font-size: 22px; + display: flex; + align-items: center; + justify-content: center; + user-select: none; + cursor: pointer; +} + +doxygen-awesome-dark-mode-toggle > svg { + transition: transform var(--animation-duration) ease-in-out; +} + +doxygen-awesome-dark-mode-toggle:active > svg { + transform: scale(.5); +} + +doxygen-awesome-dark-mode-toggle:hover { + background-color: rgba(0,0,0,.03); +} + +html.dark-mode doxygen-awesome-dark-mode-toggle:hover { + background-color: rgba(0,0,0,.18); +} + +/* + Optional fragment copy button +*/ +.doxygen-awesome-fragment-wrapper { + position: relative; +} + +doxygen-awesome-fragment-copy-button { + opacity: 0; + background: var(--fragment-background); + width: 28px; + height: 28px; + position: absolute; + right: calc(var(--spacing-large) - (var(--spacing-large) / 2.5)); + top: calc(var(--spacing-large) - (var(--spacing-large) / 2.5)); + border: 1px solid var(--fragment-foreground); + cursor: pointer; + border-radius: var(--border-radius-small); + display: flex; + justify-content: center; + align-items: center; +} + +.doxygen-awesome-fragment-wrapper:hover doxygen-awesome-fragment-copy-button, doxygen-awesome-fragment-copy-button.success { + opacity: .28; +} + +doxygen-awesome-fragment-copy-button:hover, doxygen-awesome-fragment-copy-button.success { + opacity: 1 !important; +} + +doxygen-awesome-fragment-copy-button:active:not([class~=success]) svg { + transform: scale(.91); +} + +doxygen-awesome-fragment-copy-button svg { + fill: var(--fragment-foreground); + width: 18px; + height: 18px; +} + +doxygen-awesome-fragment-copy-button.success svg { + fill: rgb(14, 168, 14); +} + +doxygen-awesome-fragment-copy-button.success { + border-color: rgb(14, 168, 14); +} + +@media screen and (max-width: 767px) { + .textblock > .doxygen-awesome-fragment-wrapper > doxygen-awesome-fragment-copy-button, + .textblock li > .doxygen-awesome-fragment-wrapper > doxygen-awesome-fragment-copy-button, + .memdoc li > .doxygen-awesome-fragment-wrapper > doxygen-awesome-fragment-copy-button, + .memdoc > .doxygen-awesome-fragment-wrapper > doxygen-awesome-fragment-copy-button, + dl dd > .doxygen-awesome-fragment-wrapper > doxygen-awesome-fragment-copy-button { + right: 0; + } +} + +/* + Optional paragraph link button +*/ + +a.anchorlink { + font-size: 90%; + margin-left: var(--spacing-small); + color: var(--page-foreground-color) !important; + text-decoration: none; + opacity: .15; + display: none; + transition: opacity var(--animation-duration) ease-in-out, color var(--animation-duration) ease-in-out; +} + +a.anchorlink svg { + fill: var(--page-foreground-color); +} + +h3 a.anchorlink svg, h4 a.anchorlink svg { + margin-bottom: -3px; + margin-top: -4px; +} + +a.anchorlink:hover { + opacity: .45; +} + +h2:hover a.anchorlink, h1:hover a.anchorlink, h3:hover a.anchorlink, h4:hover a.anchorlink { + display: inline-block; +} + +/* + Optional tab feature +*/ + +.tabbed > ul { + padding-inline-start: 0px; + margin: 0; + padding: var(--spacing-small) 0; +} + +.tabbed > ul > li { + display: none; +} + +.tabbed > ul > li.selected { + display: block; +} + +.tabs-overview-container { + overflow-x: auto; + display: block; + overflow-y: visible; +} + +.tabs-overview { + border-bottom: 1px solid var(--separator-color); + display: flex; + flex-direction: row; +} + +@media screen and (max-width: 767px) { + .tabs-overview-container { + margin: 0 calc(0px - var(--spacing-large)); + } + .tabs-overview { + padding: 0 var(--spacing-large) + } +} + +.tabs-overview button.tab-button { + color: var(--page-foreground-color); + margin: 0; + border: none; + background: transparent; + padding: calc(var(--spacing-large) / 2) 0; + display: inline-block; + font-size: var(--page-font-size); + cursor: pointer; + box-shadow: 0 1px 0 0 var(--separator-color); + position: relative; + + -webkit-tap-highlight-color: transparent; +} + +.tabs-overview button.tab-button .tab-title::before { + display: block; + content: attr(title); + font-weight: 600; + height: 0; + overflow: hidden; + visibility: hidden; +} + +.tabs-overview button.tab-button .tab-title { + float: left; + white-space: nowrap; + font-weight: normal; + padding: calc(var(--spacing-large) / 2) var(--spacing-large); + border-radius: var(--border-radius-medium); + transition: background-color var(--animation-duration) ease-in-out, font-weight var(--animation-duration) ease-in-out; +} + +.tabs-overview button.tab-button:not(:last-child) .tab-title { + box-shadow: 8px 0 0 -7px var(--separator-color); +} + +.tabs-overview button.tab-button:hover .tab-title { + background: var(--separator-color); + box-shadow: none; +} + +.tabs-overview button.tab-button.active .tab-title { + font-weight: 600; +} + +.tabs-overview button.tab-button::after { + content: ''; + display: block; + position: absolute; + left: 0; + bottom: 0; + right: 0; + height: 0; + width: 0%; + margin: 0 auto; + border-radius: var(--border-radius-small) var(--border-radius-small) 0 0; + background-color: var(--primary-color); + transition: width var(--animation-duration) ease-in-out, height var(--animation-duration) ease-in-out; +} + +.tabs-overview button.tab-button.active::after { + width: 100%; + box-sizing: border-box; + height: 3px; +} + + +/* + Navigation Buttons +*/ + +.section_buttons:not(:empty) { + margin-top: calc(var(--spacing-large) * 3); +} + +.section_buttons table.markdownTable { + display: block; + width: 100%; +} + +.section_buttons table.markdownTable tbody { + display: table !important; + width: 100%; + box-shadow: none; + border-spacing: 10px; +} + +.section_buttons table.markdownTable td { + padding: 0; +} + +.section_buttons table.markdownTable th { + display: none; +} + +.section_buttons table.markdownTable tr.markdownTableHead { + border: none; +} + +.section_buttons tr th, .section_buttons tr td { + background: none; + border: none; + padding: var(--spacing-large) 0 var(--spacing-small); +} + +.section_buttons a { + display: inline-block; + border: 1px solid var(--separator-color); + border-radius: var(--border-radius-medium); + color: var(--page-secondary-foreground-color) !important; + text-decoration: none; + transition: color var(--animation-duration) ease-in-out, background-color var(--animation-duration) ease-in-out; +} + +.section_buttons a:hover { + color: var(--page-foreground-color) !important; + background-color: var(--odd-color); +} + +.section_buttons tr td.markdownTableBodyLeft a { + padding: var(--spacing-medium) var(--spacing-large) var(--spacing-medium) calc(var(--spacing-large) / 2); +} + +.section_buttons tr td.markdownTableBodyRight a { + padding: var(--spacing-medium) calc(var(--spacing-large) / 2) var(--spacing-medium) var(--spacing-large); +} + +.section_buttons tr td.markdownTableBodyLeft a::before, +.section_buttons tr td.markdownTableBodyRight a::after { + color: var(--page-secondary-foreground-color) !important; + display: inline-block; + transition: color .08s ease-in-out, transform .09s ease-in-out; +} + +.section_buttons tr td.markdownTableBodyLeft a::before { + content: '〈'; + padding-right: var(--spacing-large); +} + + +.section_buttons tr td.markdownTableBodyRight a::after { + content: '〉'; + padding-left: var(--spacing-large); +} + + +.section_buttons tr td.markdownTableBodyLeft a:hover::before { + color: var(--page-foreground-color) !important; + transform: translateX(-3px); +} + +.section_buttons tr td.markdownTableBodyRight a:hover::after { + color: var(--page-foreground-color) !important; + transform: translateX(3px); +} + +@media screen and (max-width: 450px) { + .section_buttons a { + width: 100%; + box-sizing: border-box; + } + + .section_buttons tr td:nth-of-type(1).markdownTableBodyLeft a { + border-radius: var(--border-radius-medium) 0 0 var(--border-radius-medium); + border-right: none; + } + + .section_buttons tr td:nth-of-type(2).markdownTableBodyRight a { + border-radius: 0 var(--border-radius-medium) var(--border-radius-medium) 0; + } +} diff --git a/v0.4.9/doxygen.css b/v0.4.9/doxygen.css new file mode 100644 index 0000000..7cd7520 --- /dev/null +++ b/v0.4.9/doxygen.css @@ -0,0 +1,1838 @@ +/* The standard CSS for doxygen 1.11.0*/ + +body { + background-color: white; + color: black; +} + +body, table, div, p, dl { + font-weight: 400; + font-size: 14px; + font-family: Roboto,sans-serif; + line-height: 22px; +} + +/* @group Heading Levels */ + +.title { + font-family: Roboto,sans-serif; + line-height: 28px; + font-size: 150%; + font-weight: bold; + margin: 10px 2px; +} + +h1.groupheader { + font-size: 150%; +} + +h2.groupheader { + border-bottom: 1px solid #879ECB; + color: #354C7B; + font-size: 150%; + font-weight: normal; + margin-top: 1.75em; + padding-top: 8px; + padding-bottom: 4px; + width: 100%; +} + +h3.groupheader { + font-size: 100%; +} + +h1, h2, h3, h4, h5, h6 { + -webkit-transition: text-shadow 0.5s linear; + -moz-transition: text-shadow 0.5s linear; + -ms-transition: text-shadow 0.5s linear; + -o-transition: text-shadow 0.5s linear; + transition: text-shadow 0.5s linear; + margin-right: 15px; +} + +h1.glow, h2.glow, h3.glow, h4.glow, h5.glow, h6.glow { + text-shadow: 0 0 15px cyan; +} + +dt { + font-weight: bold; +} + +p.startli, p.startdd { + margin-top: 2px; +} + +th p.starttd, th p.intertd, th p.endtd { + font-size: 100%; + font-weight: 700; +} + +p.starttd { + margin-top: 0px; +} + +p.endli { + margin-bottom: 0px; +} + +p.enddd { + margin-bottom: 4px; +} + +p.endtd { + margin-bottom: 2px; +} + +p.interli { +} + +p.interdd { +} + +p.intertd { +} + +/* @end */ + +caption { + font-weight: bold; +} + +span.legend { + font-size: 70%; + text-align: center; +} + +h3.version { + font-size: 90%; + text-align: center; +} + +div.navtab { + padding-right: 15px; + text-align: right; + line-height: 110%; +} + +div.navtab table { + border-spacing: 0; +} + +td.navtab { + padding-right: 6px; + padding-left: 6px; +} + +td.navtabHL { + background-image: url('tab_a.png'); + background-repeat:repeat-x; + padding-right: 6px; + padding-left: 6px; +} + +td.navtabHL a, td.navtabHL a:visited { + color: white; + text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); +} + +a.navtab { + font-weight: bold; +} + +div.qindex{ + text-align: center; + width: 100%; + line-height: 140%; + font-size: 130%; + color: #A0A0A0; +} + +#main-menu a:focus { + outline: auto; + z-index: 10; + position: relative; +} + +dt.alphachar{ + font-size: 180%; + font-weight: bold; +} + +.alphachar a{ + color: black; +} + +.alphachar a:hover, .alphachar a:visited{ + text-decoration: none; +} + +.classindex dl { + padding: 25px; + column-count:1 +} + +.classindex dd { + display:inline-block; + margin-left: 50px; + width: 90%; + line-height: 1.15em; +} + +.classindex dl.even { + background-color: white; +} + +.classindex dl.odd { + background-color: #F8F9FC; +} + +@media(min-width: 1120px) { + .classindex dl { + column-count:2 + } +} + +@media(min-width: 1320px) { + .classindex dl { + column-count:3 + } +} + + +/* @group Link Styling */ + +a { + color: #3D578C; + font-weight: normal; + text-decoration: none; +} + +.contents a:visited { + color: #4665A2; +} + +a:hover { + text-decoration: none; + background: linear-gradient(to bottom, transparent 0,transparent calc(100% - 1px), currentColor 100%); +} + +a:hover > span.arrow { + text-decoration: none; + background : #F9FAFC; +} + +a.el { + font-weight: bold; +} + +a.elRef { +} + +a.code, a.code:visited, a.line, a.line:visited { + color: #4665A2; +} + +a.codeRef, a.codeRef:visited, a.lineRef, a.lineRef:visited { + color: #4665A2; +} + +a.code.hl_class { /* style for links to class names in code snippets */ } +a.code.hl_struct { /* style for links to struct names in code snippets */ } +a.code.hl_union { /* style for links to union names in code snippets */ } +a.code.hl_interface { /* style for links to interface names in code snippets */ } +a.code.hl_protocol { /* style for links to protocol names in code snippets */ } +a.code.hl_category { /* style for links to category names in code snippets */ } +a.code.hl_exception { /* style for links to exception names in code snippets */ } +a.code.hl_service { /* style for links to service names in code snippets */ } +a.code.hl_singleton { /* style for links to singleton names in code snippets */ } +a.code.hl_concept { /* style for links to concept names in code snippets */ } +a.code.hl_namespace { /* style for links to namespace names in code snippets */ } +a.code.hl_package { /* style for links to package names in code snippets */ } +a.code.hl_define { /* style for links to macro names in code snippets */ } +a.code.hl_function { /* style for links to function names in code snippets */ } +a.code.hl_variable { /* style for links to variable names in code snippets */ } +a.code.hl_typedef { /* style for links to typedef names in code snippets */ } +a.code.hl_enumvalue { /* style for links to enum value names in code snippets */ } +a.code.hl_enumeration { /* style for links to enumeration names in code snippets */ } +a.code.hl_signal { /* style for links to Qt signal names in code snippets */ } +a.code.hl_slot { /* style for links to Qt slot names in code snippets */ } +a.code.hl_friend { /* style for links to friend names in code snippets */ } +a.code.hl_dcop { /* style for links to KDE3 DCOP names in code snippets */ } +a.code.hl_property { /* style for links to property names in code snippets */ } +a.code.hl_event { /* style for links to event names in code snippets */ } +a.code.hl_sequence { /* style for links to sequence names in code snippets */ } +a.code.hl_dictionary { /* style for links to dictionary names in code snippets */ } + +/* @end */ + +dl.el { + margin-left: -1cm; +} + +ul.check { + list-style:none; + text-indent: -16px; + padding-left: 38px; +} +li.unchecked:before { + content: "\2610\A0"; +} +li.checked:before { + content: "\2611\A0"; +} + +ol { + text-indent: 0px; +} + +ul { + text-indent: 0px; + overflow: visible; +} + +ul.multicol { + -moz-column-gap: 1em; + -webkit-column-gap: 1em; + column-gap: 1em; + -moz-column-count: 3; + -webkit-column-count: 3; + column-count: 3; + list-style-type: none; +} + +#side-nav ul { + overflow: visible; /* reset ul rule for scroll bar in GENERATE_TREEVIEW window */ +} + +#main-nav ul { + overflow: visible; /* reset ul rule for the navigation bar drop down lists */ +} + +.fragment { + text-align: left; + direction: ltr; + overflow-x: auto; + overflow-y: hidden; + position: relative; + min-height: 12px; + margin: 10px 0px; + padding: 10px 10px; + border: 1px solid #C4CFE5; + border-radius: 4px; + background-color: #FBFCFD; + color: black; +} + +pre.fragment { + word-wrap: break-word; + font-size: 10pt; + line-height: 125%; + font-family: 'JetBrains Mono',Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace,fixed; +} + +.clipboard { + width: 24px; + height: 24px; + right: 5px; + top: 5px; + opacity: 0; + position: absolute; + display: inline; + overflow: auto; + fill: black; + justify-content: center; + align-items: center; + cursor: pointer; +} + +.clipboard.success { + border: 1px solid black; + border-radius: 4px; +} + +.fragment:hover .clipboard, .clipboard.success { + opacity: .28; +} + +.clipboard:hover, .clipboard.success { + opacity: 1 !important; +} + +.clipboard:active:not([class~=success]) svg { + transform: scale(.91); +} + +.clipboard.success svg { + fill: #2EC82E; +} + +.clipboard.success { + border-color: #2EC82E; +} + +div.line { + font-family: 'JetBrains Mono',Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace,fixed; + font-size: 13px; + min-height: 13px; + line-height: 1.2; + text-wrap: unrestricted; + white-space: -moz-pre-wrap; /* Moz */ + white-space: -pre-wrap; /* Opera 4-6 */ + white-space: -o-pre-wrap; /* Opera 7 */ + white-space: pre-wrap; /* CSS3 */ + word-wrap: break-word; /* IE 5.5+ */ + text-indent: -53px; + padding-left: 53px; + padding-bottom: 0px; + margin: 0px; + -webkit-transition-property: background-color, box-shadow; + -webkit-transition-duration: 0.5s; + -moz-transition-property: background-color, box-shadow; + -moz-transition-duration: 0.5s; + -ms-transition-property: background-color, box-shadow; + -ms-transition-duration: 0.5s; + -o-transition-property: background-color, box-shadow; + -o-transition-duration: 0.5s; + transition-property: background-color, box-shadow; + transition-duration: 0.5s; +} + +div.line:after { + content:"\000A"; + white-space: pre; +} + +div.line.glow { + background-color: cyan; + box-shadow: 0 0 10px cyan; +} + +span.fold { + margin-left: 5px; + margin-right: 1px; + margin-top: 0px; + margin-bottom: 0px; + padding: 0px; + display: inline-block; + width: 12px; + height: 12px; + background-repeat:no-repeat; + background-position:center; +} + +span.lineno { + padding-right: 4px; + margin-right: 9px; + text-align: right; + border-right: 2px solid #00FF00; + color: black; + background-color: #E8E8E8; + white-space: pre; +} +span.lineno a, span.lineno a:visited { + color: #4665A2; + background-color: #D8D8D8; +} + +span.lineno a:hover { + color: #4665A2; + background-color: #C8C8C8; +} + +.lineno { + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +div.classindex ul { + list-style: none; + padding-left: 0; +} + +div.classindex span.ai { + display: inline-block; +} + +div.groupHeader { + margin-left: 16px; + margin-top: 12px; + font-weight: bold; +} + +div.groupText { + margin-left: 16px; + font-style: italic; +} + +body { + color: black; + margin: 0; +} + +div.contents { + margin-top: 10px; + margin-left: 12px; + margin-right: 8px; +} + +p.formulaDsp { + text-align: center; +} + +img.dark-mode-visible { + display: none; +} +img.light-mode-visible { + display: none; +} + +img.formulaInl, img.inline { + vertical-align: middle; +} + +div.center { + text-align: center; + margin-top: 0px; + margin-bottom: 0px; + padding: 0px; +} + +div.center img { + border: 0px; +} + +address.footer { + text-align: right; + padding-right: 12px; +} + +img.footer { + border: 0px; + vertical-align: middle; + width: 104px; +} + +.compoundTemplParams { + color: #4665A2; + font-size: 80%; + line-height: 120%; +} + +/* @group Code Colorization */ + +span.keyword { + color: #008000; +} + +span.keywordtype { + color: #604020; +} + +span.keywordflow { + color: #E08000; +} + +span.comment { + color: #800000; +} + +span.preprocessor { + color: #806020; +} + +span.stringliteral { + color: #002080; +} + +span.charliteral { + color: #008080; +} + +span.xmlcdata { + color: black; +} + +span.vhdldigit { + color: #FF00FF; +} + +span.vhdlchar { + color: #000000; +} + +span.vhdlkeyword { + color: #700070; +} + +span.vhdllogic { + color: #FF0000; +} + +blockquote { + background-color: #F7F8FB; + border-left: 2px solid #9CAFD4; + margin: 0 24px 0 4px; + padding: 0 12px 0 16px; +} + +/* @end */ + +td.tiny { + font-size: 75%; +} + +.dirtab { + padding: 4px; + border-collapse: collapse; + border: 1px solid #2D4068; +} + +th.dirtab { + background-color: #374F7F; + color: #FFFFFF; + font-weight: bold; +} + +hr { + height: 0px; + border: none; + border-top: 1px solid #4A6AAA; +} + +hr.footer { + height: 1px; +} + +/* @group Member Descriptions */ + +table.memberdecls { + border-spacing: 0px; + padding: 0px; +} + +.memberdecls td, .fieldtable tr { + -webkit-transition-property: background-color, box-shadow; + -webkit-transition-duration: 0.5s; + -moz-transition-property: background-color, box-shadow; + -moz-transition-duration: 0.5s; + -ms-transition-property: background-color, box-shadow; + -ms-transition-duration: 0.5s; + -o-transition-property: background-color, box-shadow; + -o-transition-duration: 0.5s; + transition-property: background-color, box-shadow; + transition-duration: 0.5s; +} + +.memberdecls td.glow, .fieldtable tr.glow { + background-color: cyan; + box-shadow: 0 0 15px cyan; +} + +.mdescLeft, .mdescRight, +.memItemLeft, .memItemRight, +.memTemplItemLeft, .memTemplItemRight, .memTemplParams { + background-color: #F9FAFC; + border: none; + margin: 4px; + padding: 1px 0 0 8px; +} + +.mdescLeft, .mdescRight { + padding: 0px 8px 4px 8px; + color: #555; +} + +.memSeparator { + border-bottom: 1px solid #DEE4F0; + line-height: 1px; + margin: 0px; + padding: 0px; +} + +.memItemLeft, .memTemplItemLeft { + white-space: nowrap; +} + +.memItemRight, .memTemplItemRight { + width: 100%; +} + +.memTemplParams { + color: #4665A2; + white-space: nowrap; + font-size: 80%; +} + +/* @end */ + +/* @group Member Details */ + +/* Styles for detailed member documentation */ + +.memtitle { + padding: 8px; + border-top: 1px solid #A8B8D9; + border-left: 1px solid #A8B8D9; + border-right: 1px solid #A8B8D9; + border-top-right-radius: 4px; + border-top-left-radius: 4px; + margin-bottom: -1px; + background-image: url('nav_f.png'); + background-repeat: repeat-x; + background-color: #E2E8F2; + line-height: 1.25; + font-weight: 300; + float:left; +} + +.permalink +{ + font-size: 65%; + display: inline-block; + vertical-align: middle; +} + +.memtemplate { + font-size: 80%; + color: #4665A2; + font-weight: normal; + margin-left: 9px; +} + +.mempage { + width: 100%; +} + +.memitem { + padding: 0; + margin-bottom: 10px; + margin-right: 5px; + -webkit-transition: box-shadow 0.5s linear; + -moz-transition: box-shadow 0.5s linear; + -ms-transition: box-shadow 0.5s linear; + -o-transition: box-shadow 0.5s linear; + transition: box-shadow 0.5s linear; + display: table !important; + width: 100%; +} + +.memitem.glow { + box-shadow: 0 0 15px cyan; +} + +.memname { + font-weight: 400; + margin-left: 6px; +} + +.memname td { + vertical-align: bottom; +} + +.memproto, dl.reflist dt { + border-top: 1px solid #A8B8D9; + border-left: 1px solid #A8B8D9; + border-right: 1px solid #A8B8D9; + padding: 6px 0px 6px 0px; + color: #253555; + font-weight: bold; + text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); + background-color: #DFE5F1; + box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + border-top-right-radius: 4px; +} + +.overload { + font-family: 'JetBrains Mono',Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace,fixed; + font-size: 65%; +} + +.memdoc, dl.reflist dd { + border-bottom: 1px solid #A8B8D9; + border-left: 1px solid #A8B8D9; + border-right: 1px solid #A8B8D9; + padding: 6px 10px 2px 10px; + border-top-width: 0; + background-image:url('nav_g.png'); + background-repeat:repeat-x; + background-color: white; + /* opera specific markup */ + border-bottom-left-radius: 4px; + border-bottom-right-radius: 4px; + box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + /* firefox specific markup */ + -moz-border-radius-bottomleft: 4px; + -moz-border-radius-bottomright: 4px; + -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; + /* webkit specific markup */ + -webkit-border-bottom-left-radius: 4px; + -webkit-border-bottom-right-radius: 4px; + -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); +} + +dl.reflist dt { + padding: 5px; +} + +dl.reflist dd { + margin: 0px 0px 10px 0px; + padding: 5px; +} + +.paramkey { + text-align: right; +} + +.paramtype { + white-space: nowrap; + padding: 0px; + padding-bottom: 1px; +} + +.paramname { + white-space: nowrap; + padding: 0px; + padding-bottom: 1px; + margin-left: 2px; +} + +.paramname em { + color: #602020; + font-style: normal; + margin-right: 1px; +} + +.paramname .paramdefval { + font-family: 'JetBrains Mono',Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace,fixed; +} + +.params, .retval, .exception, .tparams { + margin-left: 0px; + padding-left: 0px; +} + +.params .paramname, .retval .paramname, .tparams .paramname, .exception .paramname { + font-weight: bold; + vertical-align: top; +} + +.params .paramtype, .tparams .paramtype { + font-style: italic; + vertical-align: top; +} + +.params .paramdir, .tparams .paramdir { + font-family: 'JetBrains Mono',Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace,fixed; + vertical-align: top; +} + +table.mlabels { + border-spacing: 0px; +} + +td.mlabels-left { + width: 100%; + padding: 0px; +} + +td.mlabels-right { + vertical-align: bottom; + padding: 0px; + white-space: nowrap; +} + +span.mlabels { + margin-left: 8px; +} + +span.mlabel { + background-color: #728DC1; + border-top:1px solid #5373B4; + border-left:1px solid #5373B4; + border-right:1px solid #C4CFE5; + border-bottom:1px solid #C4CFE5; + text-shadow: none; + color: white; + margin-right: 4px; + padding: 2px 3px; + border-radius: 3px; + font-size: 7pt; + white-space: nowrap; + vertical-align: middle; +} + + + +/* @end */ + +/* these are for tree view inside a (index) page */ + +div.directory { + margin: 10px 0px; + border-top: 1px solid #9CAFD4; + border-bottom: 1px solid #9CAFD4; + width: 100%; +} + +.directory table { + border-collapse:collapse; +} + +.directory td { + margin: 0px; + padding: 0px; + vertical-align: top; +} + +.directory td.entry { + white-space: nowrap; + padding-right: 6px; + padding-top: 3px; +} + +.directory td.entry a { + outline:none; +} + +.directory td.entry a img { + border: none; +} + +.directory td.desc { + width: 100%; + padding-left: 6px; + padding-right: 6px; + padding-top: 3px; + border-left: 1px solid rgba(0,0,0,0.05); +} + +.directory tr.odd { + padding-left: 6px; + background-color: #F8F9FC; +} + +.directory tr.even { + padding-left: 6px; + background-color: white; +} + +.directory img { + vertical-align: -30%; +} + +.directory .levels { + white-space: nowrap; + width: 100%; + text-align: right; + font-size: 9pt; +} + +.directory .levels span { + cursor: pointer; + padding-left: 2px; + padding-right: 2px; + color: #3D578C; +} + +.arrow { + color: #9CAFD4; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + cursor: pointer; + font-size: 80%; + display: inline-block; + width: 16px; + height: 22px; +} + +.icon { + font-family: Arial,Helvetica; + line-height: normal; + font-weight: bold; + font-size: 12px; + height: 14px; + width: 16px; + display: inline-block; + background-color: #728DC1; + color: white; + text-align: center; + border-radius: 4px; + margin-left: 2px; + margin-right: 2px; +} + +.icona { + width: 24px; + height: 22px; + display: inline-block; +} + +.iconfopen { + width: 24px; + height: 18px; + margin-bottom: 4px; + background-image:url('folderopen.svg'); + background-repeat: repeat-y; + vertical-align:top; + display: inline-block; +} + +.iconfclosed { + width: 24px; + height: 18px; + margin-bottom: 4px; + background-image:url('folderclosed.svg'); + background-repeat: repeat-y; + vertical-align:top; + display: inline-block; +} + +.icondoc { + width: 24px; + height: 18px; + margin-bottom: 4px; + background-image:url('doc.svg'); + background-position: 0px -4px; + background-repeat: repeat-y; + vertical-align:top; + display: inline-block; +} + +/* @end */ + +div.dynheader { + margin-top: 8px; + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +address { + font-style: normal; + color: #2A3D61; +} + +table.doxtable caption { + caption-side: top; +} + +table.doxtable { + border-collapse:collapse; + margin-top: 4px; + margin-bottom: 4px; +} + +table.doxtable td, table.doxtable th { + border: 1px solid #2D4068; + padding: 3px 7px 2px; +} + +table.doxtable th { + background-color: #374F7F; + color: #FFFFFF; + font-size: 110%; + padding-bottom: 4px; + padding-top: 5px; +} + +table.fieldtable { + margin-bottom: 10px; + border: 1px solid #A8B8D9; + border-spacing: 0px; + border-radius: 4px; + box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.15); +} + +.fieldtable td, .fieldtable th { + padding: 3px 7px 2px; +} + +.fieldtable td.fieldtype, .fieldtable td.fieldname { + white-space: nowrap; + border-right: 1px solid #A8B8D9; + border-bottom: 1px solid #A8B8D9; + vertical-align: top; +} + +.fieldtable td.fieldname { + padding-top: 3px; +} + +.fieldtable td.fielddoc { + border-bottom: 1px solid #A8B8D9; +} + +.fieldtable td.fielddoc p:first-child { + margin-top: 0px; +} + +.fieldtable td.fielddoc p:last-child { + margin-bottom: 2px; +} + +.fieldtable tr:last-child td { + border-bottom: none; +} + +.fieldtable th { + background-image: url('nav_f.png'); + background-repeat:repeat-x; + background-color: #E2E8F2; + font-size: 90%; + color: #253555; + padding-bottom: 4px; + padding-top: 5px; + text-align:left; + font-weight: 400; + border-top-left-radius: 4px; + border-top-right-radius: 4px; + border-bottom: 1px solid #A8B8D9; +} + + +.tabsearch { + top: 0px; + left: 10px; + height: 36px; + background-image: url('tab_b.png'); + z-index: 101; + overflow: hidden; + font-size: 13px; +} + +.navpath ul +{ + font-size: 11px; + background-image: url('tab_b.png'); + background-repeat:repeat-x; + background-position: 0 -5px; + height:30px; + line-height:30px; + color:#283A5D; + border:solid 1px #C2CDE4; + overflow:hidden; + margin:0px; + padding:0px; +} + +.navpath li +{ + list-style-type:none; + float:left; + padding-left:10px; + padding-right:15px; + background-image:url('bc_s.png'); + background-repeat:no-repeat; + background-position:right; + color: #364D7C; +} + +.navpath li.navelem a +{ + height:32px; + display:block; + outline: none; + color: #283A5D; + font-family: 'Lucida Grande',Geneva,Helvetica,Arial,sans-serif; + text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); + text-decoration: none; +} + +.navpath li.navelem a:hover +{ + color: white; + text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); +} + +.navpath li.footer +{ + list-style-type:none; + float:right; + padding-left:10px; + padding-right:15px; + background-image:none; + background-repeat:no-repeat; + background-position:right; + color: #2A3D61; + font-size: 8pt; +} + + +div.summary +{ + float: right; + font-size: 8pt; + padding-right: 5px; + width: 50%; + text-align: right; +} + +div.summary a +{ + white-space: nowrap; +} + +table.classindex +{ + margin: 10px; + white-space: nowrap; + margin-left: 3%; + margin-right: 3%; + width: 94%; + border: 0; + border-spacing: 0; + padding: 0; +} + +div.ingroups +{ + font-size: 8pt; + width: 50%; + text-align: left; +} + +div.ingroups a +{ + white-space: nowrap; +} + +div.header +{ + background-image: url('nav_h.png'); + background-repeat:repeat-x; + background-color: #F9FAFC; + margin: 0px; + border-bottom: 1px solid #C4CFE5; +} + +div.headertitle +{ + padding: 5px 5px 5px 10px; +} + +.PageDocRTL-title div.headertitle { + text-align: right; + direction: rtl; +} + +dl { + padding: 0 0 0 0; +} + +/* + +dl.section { + margin-left: 0px; + padding-left: 0px; +} + +dl.note { + margin-left: -7px; + padding-left: 3px; + border-left: 4px solid; + border-color: #D0C000; +} + +dl.warning, dl.attention, dl.important { + margin-left: -7px; + padding-left: 3px; + border-left: 4px solid; + border-color: #FF0000; +} + +dl.pre, dl.post, dl.invariant { + margin-left: -7px; + padding-left: 3px; + border-left: 4px solid; + border-color: #00D000; +} + +dl.deprecated { + margin-left: -7px; + padding-left: 3px; + border-left: 4px solid; + border-color: #505050; +} + +dl.todo { + margin-left: -7px; + padding-left: 3px; + border-left: 4px solid; + border-color: #00C0E0; +} + +dl.test { + margin-left: -7px; + padding-left: 3px; + border-left: 4px solid; + border-color: #3030E0; +} + +dl.bug { + margin-left: -7px; + padding-left: 3px; + border-left: 4px solid; + border-color: #C08050; +} + +*/ + +dl.bug dt a, dl.deprecated dt a, dl.todo dt a, dl.test a { + font-weight: bold !important; +} + +dl.warning, dl.attention, dl.important, dl.note, dl.deprecated, dl.bug, +dl.invariant, dl.pre, dl.post, dl.todo, dl.test, dl.remark { + padding: 10px; + margin: 10px 0px; + overflow: hidden; + margin-left: 0; + border-radius: 4px; +} + +dl.section dd { + margin-bottom: 2px; +} + +dl.warning, dl.attention, dl.important { + background: #f8d1cc; + border-left: 8px solid #b61825; + color: #75070f; +} + +dl.warning dt, dl.attention dt, dl.important dt { + color: #b61825; +} + +dl.note, dl.remark { + background: #faf3d8; + border-left: 8px solid #f3a600; + color: #5f4204; +} + +dl.note dt, dl.remark dt { + color: #f3a600; +} + +dl.todo { + background: #e4f3ff; + border-left: 8px solid #1879C4; + color: #274a5c; +} + +dl.todo dt { + color: #1879C4; +} + +dl.test { + background: #e8e8ff; + border-left: 8px solid #3939C4; + color: #1a1a5c; +} + +dl.test dt { + color: #3939C4; +} + +dl.bug dt a { + color: #5b2bdd !important; +} + +dl.bug { + background: #e4dafd; + border-left: 8px solid #5b2bdd; + color: #2a0d72; +} + +dl.bug dt a { + color: #5b2bdd !important; +} + +dl.deprecated { + background: #ecf0f3; + border-left: 8px solid #5b6269; + color: #43454a; +} + +dl.deprecated dt a { + color: #5b6269 !important; +} + +dl.note dd, dl.warning dd, dl.pre dd, dl.post dd, +dl.remark dd, dl.attention dd, dl.important dd, dl.invariant dd, +dl.bug dd, dl.deprecated dd, dl.todo dd, dl.test dd { + margin-inline-start: 0px; +} + +dl.invariant, dl.pre, dl.post { + background: #d8f1e3; + border-left: 8px solid #44b86f; + color: #265532; +} + +dl.invariant dt, dl.pre dt, dl.post dt { + color: #44b86f; +} + + +#projectrow +{ + height: 56px; +} + +#projectlogo +{ + text-align: center; + vertical-align: bottom; + border-collapse: separate; +} + +#projectlogo img +{ + border: 0px none; +} + +#projectalign +{ + vertical-align: middle; + padding-left: 0.5em; +} + +#projectname +{ + font-size: 200%; + font-family: Tahoma,Arial,sans-serif; + margin: 0px; + padding: 2px 0px; +} + +#projectbrief +{ + font-size: 90%; + font-family: Tahoma,Arial,sans-serif; + margin: 0px; + padding: 0px; +} + +#projectnumber +{ + font-size: 50%; + font-family: 50% Tahoma,Arial,sans-serif; + margin: 0px; + padding: 0px; +} + +#titlearea +{ + padding: 0px; + margin: 0px; + width: 100%; + border-bottom: 1px solid #5373B4; + background-color: white; +} + +.image +{ + text-align: center; +} + +.dotgraph +{ + text-align: center; +} + +.mscgraph +{ + text-align: center; +} + +.plantumlgraph +{ + text-align: center; +} + +.diagraph +{ + text-align: center; +} + +.caption +{ + font-weight: bold; +} + +dl.citelist { + margin-bottom:50px; +} + +dl.citelist dt { + color:#334975; + float:left; + font-weight:bold; + margin-right:10px; + padding:5px; + text-align:right; + width:52px; +} + +dl.citelist dd { + margin:2px 0 2px 72px; + padding:5px 0; +} + +div.toc { + padding: 14px 25px; + background-color: #F4F6FA; + border: 1px solid #D8DFEE; + border-radius: 7px 7px 7px 7px; + float: right; + height: auto; + margin: 0 8px 10px 10px; + width: 200px; +} + +div.toc li { + background: url("data:image/svg+xml;utf8,&%238595;") no-repeat scroll 0 5px transparent; + font: 10px/1.2 Verdana,'DejaVu Sans',Geneva,sans-serif; + margin-top: 5px; + padding-left: 10px; + padding-top: 2px; +} + +div.toc h3 { + font: bold 12px/1.2 Verdana,'DejaVu Sans',Geneva,sans-serif; + color: #4665A2; + border-bottom: 0 none; + margin: 0; +} + +div.toc ul { + list-style: none outside none; + border: medium none; + padding: 0px; +} + +div.toc li.level1 { + margin-left: 0px; +} + +div.toc li.level2 { + margin-left: 15px; +} + +div.toc li.level3 { + margin-left: 15px; +} + +div.toc li.level4 { + margin-left: 15px; +} + +span.emoji { + /* font family used at the site: https://unicode.org/emoji/charts/full-emoji-list.html + * font-family: "Noto Color Emoji", "Apple Color Emoji", "Segoe UI Emoji", Times, Symbola, Aegyptus, Code2000, Code2001, Code2002, Musica, serif, LastResort; + */ +} + +span.obfuscator { + display: none; +} + +.inherit_header { + font-weight: bold; + color: gray; + cursor: pointer; + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.inherit_header td { + padding: 6px 0px 2px 5px; +} + +.inherit { + display: none; +} + +tr.heading h2 { + margin-top: 12px; + margin-bottom: 4px; +} + +/* tooltip related style info */ + +.ttc { + position: absolute; + display: none; +} + +#powerTip { + cursor: default; + /*white-space: nowrap;*/ + color: black; + background-color: white; + border: 1px solid gray; + border-radius: 4px 4px 4px 4px; + box-shadow: 1px 1px 7px gray; + display: none; + font-size: smaller; + max-width: 80%; + opacity: 0.9; + padding: 1ex 1em 1em; + position: absolute; + z-index: 2147483647; +} + +#powerTip div.ttdoc { + color: grey; + font-style: italic; +} + +#powerTip div.ttname a { + font-weight: bold; +} + +#powerTip a { + color: #4665A2; +} + +#powerTip div.ttname { + font-weight: bold; +} + +#powerTip div.ttdeci { + color: #006318; +} + +#powerTip div { + margin: 0px; + padding: 0px; + font-size: 12px; + font-family: Roboto,sans-serif; + line-height: 16px; +} + +#powerTip:before, #powerTip:after { + content: ""; + position: absolute; + margin: 0px; +} + +#powerTip.n:after, #powerTip.n:before, +#powerTip.s:after, #powerTip.s:before, +#powerTip.w:after, #powerTip.w:before, +#powerTip.e:after, #powerTip.e:before, +#powerTip.ne:after, #powerTip.ne:before, +#powerTip.se:after, #powerTip.se:before, +#powerTip.nw:after, #powerTip.nw:before, +#powerTip.sw:after, #powerTip.sw:before { + border: solid transparent; + content: " "; + height: 0; + width: 0; + position: absolute; +} + +#powerTip.n:after, #powerTip.s:after, +#powerTip.w:after, #powerTip.e:after, +#powerTip.nw:after, #powerTip.ne:after, +#powerTip.sw:after, #powerTip.se:after { + border-color: rgba(255, 255, 255, 0); +} + +#powerTip.n:before, #powerTip.s:before, +#powerTip.w:before, #powerTip.e:before, +#powerTip.nw:before, #powerTip.ne:before, +#powerTip.sw:before, #powerTip.se:before { + border-color: rgba(128, 128, 128, 0); +} + +#powerTip.n:after, #powerTip.n:before, +#powerTip.ne:after, #powerTip.ne:before, +#powerTip.nw:after, #powerTip.nw:before { + top: 100%; +} + +#powerTip.n:after, #powerTip.ne:after, #powerTip.nw:after { + border-top-color: white; + border-width: 10px; + margin: 0px -10px; +} +#powerTip.n:before, #powerTip.ne:before, #powerTip.nw:before { + border-top-color: gray; + border-width: 11px; + margin: 0px -11px; +} +#powerTip.n:after, #powerTip.n:before { + left: 50%; +} + +#powerTip.nw:after, #powerTip.nw:before { + right: 14px; +} + +#powerTip.ne:after, #powerTip.ne:before { + left: 14px; +} + +#powerTip.s:after, #powerTip.s:before, +#powerTip.se:after, #powerTip.se:before, +#powerTip.sw:after, #powerTip.sw:before { + bottom: 100%; +} + +#powerTip.s:after, #powerTip.se:after, #powerTip.sw:after { + border-bottom-color: white; + border-width: 10px; + margin: 0px -10px; +} + +#powerTip.s:before, #powerTip.se:before, #powerTip.sw:before { + border-bottom-color: gray; + border-width: 11px; + margin: 0px -11px; +} + +#powerTip.s:after, #powerTip.s:before { + left: 50%; +} + +#powerTip.sw:after, #powerTip.sw:before { + right: 14px; +} + +#powerTip.se:after, #powerTip.se:before { + left: 14px; +} + +#powerTip.e:after, #powerTip.e:before { + left: 100%; +} +#powerTip.e:after { + border-left-color: gray; + border-width: 10px; + top: 50%; + margin-top: -10px; +} +#powerTip.e:before { + border-left-color: gray; + border-width: 11px; + top: 50%; + margin-top: -11px; +} + +#powerTip.w:after, #powerTip.w:before { + right: 100%; +} +#powerTip.w:after { + border-right-color: gray; + border-width: 10px; + top: 50%; + margin-top: -10px; +} +#powerTip.w:before { + border-right-color: gray; + border-width: 11px; + top: 50%; + margin-top: -11px; +} + +@media print +{ + #top { display: none; } + #side-nav { display: none; } + #nav-path { display: none; } + body { overflow:visible; } + h1, h2, h3, h4, h5, h6 { page-break-after: avoid; } + .summary { display: none; } + .memitem { page-break-inside: avoid; } + #doc-content + { + margin-left:0 !important; + height:auto !important; + width:auto !important; + overflow:inherit; + display:inline; + } +} + +/* @group Markdown */ + +table.markdownTable { + border-collapse:collapse; + margin-top: 4px; + margin-bottom: 4px; +} + +table.markdownTable td, table.markdownTable th { + border: 1px solid #2D4068; + padding: 3px 7px 2px; +} + +table.markdownTable tr { +} + +th.markdownTableHeadLeft, th.markdownTableHeadRight, th.markdownTableHeadCenter, th.markdownTableHeadNone { + background-color: #374F7F; + color: #FFFFFF; + font-size: 110%; + padding-bottom: 4px; + padding-top: 5px; +} + +th.markdownTableHeadLeft, td.markdownTableBodyLeft { + text-align: left +} + +th.markdownTableHeadRight, td.markdownTableBodyRight { + text-align: right +} + +th.markdownTableHeadCenter, td.markdownTableBodyCenter { + text-align: center +} + +tt, code, kbd, samp +{ + display: inline-block; +} +/* @end */ + +u { + text-decoration: underline; +} + +details>summary { + list-style-type: none; +} + +details > summary::-webkit-details-marker { + display: none; +} + +details>summary::before { + content: "\25ba"; + padding-right:4px; + font-size: 80%; +} + +details[open]>summary::before { + content: "\25bc"; + padding-right:4px; + font-size: 80%; +} + diff --git a/v0.4.9/doxygen.svg b/v0.4.9/doxygen.svg new file mode 100644 index 0000000..79a7635 --- /dev/null +++ b/v0.4.9/doxygen.svg @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/v0.4.9/doxygen_crawl.html b/v0.4.9/doxygen_crawl.html new file mode 100644 index 0000000..539c732 --- /dev/null +++ b/v0.4.9/doxygen_crawl.html @@ -0,0 +1,513 @@ + + + +Validator / crawler helper + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/v0.4.9/dynsections.js b/v0.4.9/dynsections.js new file mode 100644 index 0000000..0c35605 --- /dev/null +++ b/v0.4.9/dynsections.js @@ -0,0 +1,205 @@ +/* + @licstart The following is the entire license notice for the JavaScript code in this file. + + The MIT License (MIT) + + Copyright (C) 1997-2020 by Dimitri van Heesch + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software + and associated documentation files (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, publish, distribute, + sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or + substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING + BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + @licend The above is the entire license notice for the JavaScript code in this file + */ + +function toggleVisibility(linkObj) { + return dynsection.toggleVisibility(linkObj); +} + +let dynsection = { + + // helper function + updateStripes : function() { + $('table.directory tr'). + removeClass('even').filter(':visible:even').addClass('even'); + $('table.directory tr'). + removeClass('odd').filter(':visible:odd').addClass('odd'); + }, + + toggleVisibility : function(linkObj) { + const base = $(linkObj).attr('id'); + const summary = $('#'+base+'-summary'); + const content = $('#'+base+'-content'); + const trigger = $('#'+base+'-trigger'); + const src=$(trigger).attr('src'); + if (content.is(':visible')===true) { + content.hide(); + summary.show(); + $(linkObj).addClass('closed').removeClass('opened'); + $(trigger).attr('src',src.substring(0,src.length-8)+'closed.png'); + } else { + content.show(); + summary.hide(); + $(linkObj).removeClass('closed').addClass('opened'); + $(trigger).attr('src',src.substring(0,src.length-10)+'open.png'); + } + return false; + }, + + toggleLevel : function(level) { + $('table.directory tr').each(function() { + const l = this.id.split('_').length-1; + const i = $('#img'+this.id.substring(3)); + const a = $('#arr'+this.id.substring(3)); + if (l'); + // add vertical lines to other rows + $('span[class=lineno]').not(':eq(0)').append(''); + // add toggle controls to lines with fold divs + $('div[class=foldopen]').each(function() { + // extract specific id to use + const id = $(this).attr('id').replace('foldopen',''); + // extract start and end foldable fragment attributes + const start = $(this).attr('data-start'); + const end = $(this).attr('data-end'); + // replace normal fold span with controls for the first line of a foldable fragment + $(this).find('span[class=fold]:first').replaceWith(''); + // append div for folded (closed) representation + $(this).after(''); + // extract the first line from the "open" section to represent closed content + const line = $(this).children().first().clone(); + // remove any glow that might still be active on the original line + $(line).removeClass('glow'); + if (start) { + // if line already ends with a start marker (e.g. trailing {), remove it + $(line).html($(line).html().replace(new RegExp('\\s*'+start+'\\s*$','g'),'')); + } + // replace minus with plus symbol + $(line).find('span[class=fold]').css('background-image',codefold.plusImg[relPath]); + // append ellipsis + $(line).append(' '+start+''+end); + // insert constructed line into closed div + $('#foldclosed'+id).html(line); + }); + }, +}; +/* @license-end */ +$(function() { + $('.code,.codeRef').each(function() { + $(this).data('powertip',$('#a'+$(this).attr('href').replace(/.*\//,'').replace(/[^a-z_A-Z0-9]/g,'_')).html()); + $.fn.powerTip.smartPlacementLists.s = [ 's', 'n', 'ne', 'se' ]; + $(this).powerTip({ placement: 's', smartPlacement: true, mouseOnToPopup: true }); + }); +}); diff --git a/v0.4.9/exllamav2_8py.html b/v0.4.9/exllamav2_8py.html new file mode 100644 index 0000000..0d3df6c --- /dev/null +++ b/v0.4.9/exllamav2_8py.html @@ -0,0 +1,170 @@ + + + + + + + + +Formatron: src/formatron/integrations/exllamav2.py File Reference + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+ +
exllamav2.py File Reference
+
+
+ +

Go to the source code of this file.

+ + + + + +

+Classes

class  formatron.integrations.exllamav2.FormatterFilter
 ExLlamaV2Filter that uses a formatter to mask logits. More...
 
+ + + + + + + + + +

+Namespaces

namespace  formatron
 
namespace  formatron.integrations
 This subpackage contains integrations with other frameworks and libraries.
 
namespace  formatron.integrations.exllamav2
 This module integrates the ExLlamaV2 library by providing convenience utilities.
 
+ + + + + + + +

+Functions

kbnf.Vocabulary formatron.integrations.exllamav2.create_engine_vocabulary (ExLlamaV2Tokenizer tokenizer, typing.Optional[list[typing.Callable]] vocab_processors=None)
 Create a vocabulary for the KBNF engine.
 
ExLlamaV2Filter formatron.integrations.exllamav2.create_formatter_filter (ExLlamaV2 model, ExLlamaV2Tokenizer tokenizer, FormatterBuilder formatter_builder, EngineGenerationConfig engine_config=None, typing.Optional[list[typing.Callable]] vocab_processors=None)
 Create a formatter filter for the ExLlamaV2 engine.
 
+
+
+ + + + diff --git a/v0.4.9/exllamav2_8py.js b/v0.4.9/exllamav2_8py.js new file mode 100644 index 0000000..cc9e03c --- /dev/null +++ b/v0.4.9/exllamav2_8py.js @@ -0,0 +1,6 @@ +var exllamav2_8py = +[ + [ "formatron.integrations.exllamav2.FormatterFilter", "classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html", "classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter" ], + [ "create_engine_vocabulary", "exllamav2_8py.html#a80db020f2fd854399834ca7581281a34", null ], + [ "create_formatter_filter", "exllamav2_8py.html#a51e71b1e5ca66beba85e26e8cc322206", null ] +]; \ No newline at end of file diff --git a/v0.4.9/exllamav2_8py_source.html b/v0.4.9/exllamav2_8py_source.html new file mode 100644 index 0000000..50dd635 --- /dev/null +++ b/v0.4.9/exllamav2_8py_source.html @@ -0,0 +1,339 @@ + + + + + + + + +Formatron: src/formatron/integrations/exllamav2.py Source File + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
exllamav2.py
+
+
+Go to the documentation of this file.
1"""
+
2This module integrates the ExLlamaV2 library by providing convenience utilities.
+
3"""
+
4import typing
+
5from copy import copy, deepcopy
+
6import kbnf
+
7import torch
+
8from exllamav2 import ExLlamaV2Tokenizer, ExLlamaV2
+
9from exllamav2.generator.base import ExLlamaV2Filter
+
10from formatron.config import EngineGenerationConfig
+
11from formatron.formatter import FormatterBase, FormatterBuilder
+
12from formatron.integrations.utils import get_original_characters
+
13
+
14
+
15__all__ = ["create_engine_vocabulary", "create_formatter_filter", "FormatterFilter"]
+
16def create_engine_vocabulary(tokenizer: ExLlamaV2Tokenizer,
+
17 vocab_processors: typing.Optional[list[typing.Callable]] = None) -> kbnf.Vocabulary:
+
18 """
+
19 Create a vocabulary for the KBNF engine.
+
20 Args:
+
21 tokenizer: The tokenizer.
+
22 vocab_processors: List of callables with signature (token_to_char: typing.Dict[bytes, bytes])->None.
+
23 Callables can be used to "unmangle" encoded characters to original characters. If None, processors will be auto-detected.
+
+
24 """
+
25 assert hasattr(tokenizer.tokenizer_model, "vocab"), (f"tokenizer({tokenizer})"
+
26 f" with tokenizer_model({tokenizer.tokenizer_model})"
+
27 f" does not have vocab attribute!")
+
28 vocab = {tokenizer.tokenizer_model.id_to_piece(
+
29 i): i for i in range(tokenizer.tokenizer_model.vocab_size())}
+
30 new_vocab = get_original_characters(vocab, vocab_processors)
+
31 return kbnf.Vocabulary({k: kbnf.Token(v) for k, v in new_vocab.items()},
+
32 {v: k for k, v in vocab.items()})
+
33
+
34
+
35def create_formatter_filter(model: ExLlamaV2, tokenizer: ExLlamaV2Tokenizer,
+
+
36 formatter_builder: FormatterBuilder,
+
37 engine_config: EngineGenerationConfig = None,
+
38 vocab_processors: typing.Optional[list[typing.Callable]] = None) -> ExLlamaV2Filter:
+
39 """
+
40 Create a formatter filter for the ExLlamaV2 engine.
+
41 Args:
+
42 model: The ExLlamaV2 model.
+
43 tokenizer: The ExLlamaV2 tokenizer.
+
44 formatter_builder: The formatter builder.
+
45 engine_config: The engine generation configuration.
+
+
46 vocab_processors: List of callables with signature (token_to_char: typing.Dict[bytes, bytes])->None.
+
47 Callables can be used to "unmangle" encoded characters to original characters. If None, processors will be auto-detected.
+
48 """
+
49 vocab = create_engine_vocabulary(tokenizer, vocab_processors)
+
50 f = formatter_builder.build(
+
51 vocab, lambda tokens: tokenizer.decode(torch.tensor(tokens)))
+
52 return FormatterFilter(model, tokenizer, f, engine_config)
+
53
+
54
+
55class FormatterFilter(ExLlamaV2Filter):
+
+
56 """
+
57 ExLlamaV2Filter that uses a formatter to mask logits.
+
58 """
+
+ +
60 def __init__(self, model, tokenizer, formatter: FormatterBase,
+
+
61 config: EngineGenerationConfig|None = None):
+
62 super().__init__(model, tokenizer)
+
63 self._formatter = formatter
+
64 if config is None:
+
65 config = EngineGenerationConfig()
+
66 self._config = config
+
67 self._pass_tokens = set()
+
68 self.eos_logits = None
+ +
70 def is_completed(self) -> bool:
+
+
71 """
+
72 Check if the formatter is completed.
+
73 """
+
+ +
75
+
76 def clone(self, c=None) -> "FormatterFilter":
+
+
+
77 if c is None:
+
78 c = FormatterFilter.__new__(FormatterFilter)
+
79 c.model = self.model
+
80 c.tokenizer = self.tokenizer
+
81 c.sequence_str = self.sequence_str
+
82 # formatter does not have mutable public state anyway
+
83 c._formatter = copy(self._formatter)
+
84 c._config = deepcopy(self._config)
+
85 c._pass_tokens = self._pass_tokens
+
86 return c
+
87
+
88 def begin(self, prefix_str: str) -> None:
+
+
+
89 if self._config.reset_at_beginning:
+
90 self._formatter.reset()
+
91 if self._config.read_prompt:
+
92 prompt = prefix_str.encode("utf-8")
+
93 self._formatter.accept_bytes(prompt)
+
94
+
95 def reset(self) -> None:
+
+
+ +
97
+
98 def feed(self, token: int):
+
+
+ +
100 return None
+
101 self._formatter.accept_token(token)
+
102
+
103 # adapted from https://github.com/Dan-wanna-M/formatron/issues/14
+
+
104 # Old version for compatibility
+
105 def next_set(self) -> typing.Tuple[typing.Set[int], typing.Set[int]]:
+
+ +
107 return {self.tokenizer.eos_token_id}, {self.tokenizer.eos_token_id}
+
108 self._formatter.compute_allowed_tokens()
+
109 self._pass_tokens.clear()
+
110 self._pass_tokens.update(self._formatter.get_allowed_tokens_since_last_computation())
+
111 return self._pass_tokens, set()
+
112
+
113 # adapted from https://github.com/Dan-wanna-M/formatron/issues/14
+
+
114 def next(self) -> typing.Tuple[typing.Sequence[int], typing.Sequence[int]]:
+
+
115 # Kludge to maintain compatibility with exllamav2 <= 0.2.0
+
116 if not hasattr(self, "allow_return_type_list"):
+
117 return self.next_set()
+
118 if self._formatter.is_completed():
+
119 return [self.tokenizer.eos_token_id], [self.tokenizer.eos_token_id]
+
120 self._formatter.compute_allowed_tokens()
+
121 return self._formatter.get_allowed_tokens_since_last_computation(), []
+
122
+
123 # adapted from https://github.com/Dan-wanna-M/formatron/issues/14
+
+
124 def use_background_worker(self) -> bool:
+
+
125 return True
+
126
+
127 # Used by ExLlamaV2 > 0.2.3
+
+
128 def can_mask_logits(self) -> bool:
+
+
129 return True
+
130
+
131 def prepare_logit_mask(self):
+
+
+
132 self._formatter.compute_allowed_tokens()
+
133 return True
+
134
+
135 def mask_logits(self, logits: torch.Tensor) -> torch.Tensor:
+
+
+ +
137 if self.eos_logits is None:
+
138 self.eos_logits = torch.full_like(logits, float("-inf"))
+
139 self.eos_logits[self.tokenizer.eos_token_id] = 0
+
140 return self.eos_logits
+
141 return self._formatter.mask_logits(logits)
+
142
+
143 @property
+
+
144 def formatter_captures(self) -> dict[str, typing.Any]:
+
145 """
+
146 Get the captures of the formatter.
+
147 """
+
148 return self._formatter.captures
+
+
Configuration for how an KBNF engine should be used in text generation.
Definition config.py:14
+
ExLlamaV2Filter that uses a formatter to mask logits.
Definition exllamav2.py:59
+ + + + + +
"FormatterFilter" clone(self, c=None)
Definition exllamav2.py:77
+
torch.Tensor mask_logits(self, torch.Tensor logits)
Definition exllamav2.py:136
+ + +
typing.Tuple[typing.Sequence[int], typing.Sequence[int]] next(self)
Definition exllamav2.py:115
+
dict[str, typing.Any] formatter_captures(self)
Get the captures of the formatter.
Definition exllamav2.py:155
+
typing.Tuple[typing.Set[int], typing.Set[int]] next_set(self)
Definition exllamav2.py:106
+ +
bool is_completed(self)
Check if the formatter is completed.
Definition exllamav2.py:74
+
__init__(self, model, tokenizer, FormatterBase formatter, EngineGenerationConfig|None config=None)
Definition exllamav2.py:62
+ + +
Configuration classes for Formatron.
Definition config.py:1
+
This module contains the Formatter class and its related classes.
Definition formatter.py:1
+
ExLlamaV2Filter create_formatter_filter(ExLlamaV2 model, ExLlamaV2Tokenizer tokenizer, FormatterBuilder formatter_builder, EngineGenerationConfig engine_config=None, typing.Optional[list[typing.Callable]] vocab_processors=None)
Create a formatter filter for the ExLlamaV2 engine.
Definition exllamav2.py:49
+
kbnf.Vocabulary create_engine_vocabulary(ExLlamaV2Tokenizer tokenizer, typing.Optional[list[typing.Callable]] vocab_processors=None)
Create a vocabulary for the KBNF engine.
Definition exllamav2.py:25
+ +
+
+ + + + diff --git a/v0.4.9/extractor_8py.html b/v0.4.9/extractor_8py.html new file mode 100644 index 0000000..e10f9e4 --- /dev/null +++ b/v0.4.9/extractor_8py.html @@ -0,0 +1,169 @@ + + + + + + + + +Formatron: src/formatron/extractor.py File Reference + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+ +
extractor.py File Reference
+
+
+ +

Go to the source code of this file.

+ + + + + + + + + + + + + + + + + +

+Classes

class  formatron.extractor.Extractor
 An abstract extractor that extracts data from a string and offers its KBNF rules definition. More...
 
class  formatron.extractor.NonterminalExtractor
 An extractor that extracts data corresponding to a nonterminal. More...
 
class  formatron.extractor.LiteralExtractor
 An extractor that extracts a literal string. More...
 
class  formatron.extractor.ChoiceExtractor
 An extractor that uses multiple extractors to extract data. More...
 
class  formatron.extractor.SubstringExtractor
 An extractor that extracts a substring of a given string from the input string. More...
 
+ + + + + + +

+Namespaces

namespace  formatron
 
namespace  formatron.extractor
 Extractors for extracting data from generated strings.
 
+
+
+ + + + diff --git a/v0.4.9/extractor_8py.js b/v0.4.9/extractor_8py.js new file mode 100644 index 0000000..2419389 --- /dev/null +++ b/v0.4.9/extractor_8py.js @@ -0,0 +1,8 @@ +var extractor_8py = +[ + [ "formatron.extractor.Extractor", "classformatron_1_1extractor_1_1Extractor.html", "classformatron_1_1extractor_1_1Extractor" ], + [ "formatron.extractor.NonterminalExtractor", "classformatron_1_1extractor_1_1NonterminalExtractor.html", "classformatron_1_1extractor_1_1NonterminalExtractor" ], + [ "formatron.extractor.LiteralExtractor", "classformatron_1_1extractor_1_1LiteralExtractor.html", "classformatron_1_1extractor_1_1LiteralExtractor" ], + [ "formatron.extractor.ChoiceExtractor", "classformatron_1_1extractor_1_1ChoiceExtractor.html", "classformatron_1_1extractor_1_1ChoiceExtractor" ], + [ "formatron.extractor.SubstringExtractor", "classformatron_1_1extractor_1_1SubstringExtractor.html", "classformatron_1_1extractor_1_1SubstringExtractor" ] +]; \ No newline at end of file diff --git a/v0.4.9/extractor_8py_source.html b/v0.4.9/extractor_8py_source.html new file mode 100644 index 0000000..13000ee --- /dev/null +++ b/v0.4.9/extractor_8py_source.html @@ -0,0 +1,395 @@ + + + + + + + + +Formatron: src/formatron/extractor.py Source File + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
extractor.py
+
+
+Go to the documentation of this file.
1"""
+
2Extractors for extracting data from generated strings.
+
3"""
+
4import abc
+
5import typing
+
6
+
7from general_sam import GeneralSam
+
8__all__ = ["Extractor", "ChoiceExtractor", "NonterminalExtractor"]
+
9
+
10class Extractor(abc.ABC):
+
11 """
+
12 An abstract extractor that extracts data from a string and offers its KBNF rules definition.
+
13 """
+
+ +
15 def __init__(self, capture_name: typing.Optional[str] = None):
+
16 """
+
17 Initialize an extractor.
+
18 Args:
+
19 capture_name: The name of the capture, or `None` if the extractor does not capture.
+
20 """
+
+
21 self._capture_name = capture_name
+ +
23 @property
+
+
24 def capture_name(self) -> typing.Optional[str]:
+
25 """
+
26 Get the name of the capture, or `None` if the extractor does not capture.
+
27 """
+
28 return self._capture_name
+
29
+
30 @abc.abstractmethod
+
31 def extract(self, input_str: str) -> typing.Optional[tuple[str, typing.Any]]:
+
32 """
+
33 Extract data from the input string, or `None` if the extraction failed.
+
34 Args:
+
+
35 input_str: The input string.
+
36 Returns:
+
37 The remaining string and the extracted data, or `None` if the extraction failed.
+
+
38 """
+
39
+
40 @property
+
41 @abc.abstractmethod
+
42 def kbnf_reference(self) -> str:
+
43 """
+
44 Get the KBNF reference of the extractor in the generated grammar of a Formatter.
+
45 Check Formatter.kbnf_definition for the difference between kbnf_reference and kbnf_definition.
+
46 """
+
47
+
+
48 def __str__(self):
+
49 return f"${{{self.kbnf_reference}}}"
+
+
50
+
51 @property
+
52 @abc.abstractmethod
+
53 def kbnf_definition(self) -> str:
+
54 """
+
55 Get the KBNF definition of the extractor in the generated grammar of a Formatter.
+
56
+
57 The difference between kbnf_reference and kbnf_definition is that kbnf_reference is how the extractor is referenced in other rules,
+
58 while kbnf_definition is the definition of the extractor itself, similar to a C header file. If kbnf_reference does not need extra definition,
+
59 you can just return an empty string.
+
60 """
+
61
+
62
+
63class NonterminalExtractor(Extractor):
+
64 """
+
65 An extractor that extracts data corresponding to a nonterminal.
+
66 """
+
+ +
68 def __init__(self, nonterminal: str, capture_name: typing.Optional[str] = None):
+
+
+
69 """
+
70 Initialize the nonterminal extractor.
+
71 """
+
+
72 super().__init__(capture_name)
+
73 if capture_name is None:
+
74 self._nonterminal = nonterminal
+
75 else:
+
76 self._nonterminal = f"{nonterminal}_{capture_name}"
+
77
+
78 @property
+
79 def nonterminal(self) -> str:
+
80 """
+
81 Get the nonterminal of the extractor.
+
82 """
+
83 return self._nonterminal
+
84
+
85 @property
+
86 def kbnf_reference(self) -> str:
+
87 return self._nonterminal
+
88
+
89
+ +
91 """
+
+
92 An extractor that extracts a literal string.
+
93 """
+
94
+
+
+
95 def __init__(self, literal: str):
+
96 """
+
97 Initialize the literal extractor. It never captures since capturing a literal is redundant.
+
+ +
99 Args:
+
100 literal: The literal string to extract.
+
101 """
+
102 super().__init__(None)
+
+
103 self._literal = literal
+
104
+
105 def extract(self, input_str: str) -> typing.Optional[tuple[str, str]]:
+
106 """
+
107 Extract the literal from the input string, or `None` if the literal is not found.
+
108 """
+
109 pos = input_str.find(self._literal)
+
+
110 if pos == -1:
+
111 return None
+
112 return input_str[pos + len(self._literal):], self._literal
+
113
+
114 @property
+
115 def kbnf_reference(self) -> str:
+
116 return repr(self._literal)
+
117
+
118 @property
+
119 def kbnf_definition(self) -> str:
+
120 return ""
+ +
124 """
+
125 An extractor that uses multiple extractors to extract data. It stops at the first succeeding extractor.
+
126 """
+
127
+
128 def __init__(self, choices: typing.Iterable[Extractor], capture_name: str, nonterminal: str):
+
129 """
+
130 Initialize the choice extractor.
+
131
+
132 Args:
+
133 choices: The extractors to choose from. The order determines the extractors' priority.
+
+
134 capture_name: The name of the capture, or `None` if the extractor does not capture.
+
135 nonterminal: The nonterminal representing the extractor.
+
136 """
+
+
137 super().__init__(nonterminal, capture_name)
+
138 self._choices = choices
+
139
+
+
140 def extract(self, input_str: str) -> typing.Optional[tuple[str, typing.Any]]:
+
141 """
+
142 Extract data from the input string using the first succeeding extractor.
+
+ +
144 Args:
+
145 input_str: The input string.
+
146 Returns:
+
147 The remaining string and the extracted data, or `None` if all extractors failed.
+
148 """
+
149 for choice in self._choices:
+
150 matched = choice.extract(input_str)
+
+
151 if matched:
+
152 return matched
+
153 return None
+
154
+
+
155 @property
+
156 def kbnf_definition(self) -> str:
+
157 return f"{self.nonterminal} ::= {' | '.join([i.kbnf_reference for i in self._choices])};"
+
+ +
159
+ +
161 """
+
162 An extractor that extracts a substring of a given string from the input string.
+
163 """
+
+
164
+
165 def __init__(self, string: str, capture_name: str, nonterminal: str, *, extract_empty_substring: bool = False):
+
166 """
+
167 Initialize the substring extractor.
+
168 Args:
+
169 string: The string to extract.
+
170 nonterminal: The nonterminal representing the extractor.
+
171 capture_name: The name of the capture, or `None` if the extractor does not capture.
+
+
172 extract_empty_substring: Whether to extract empty substring as a valid substring.
+
173 """
+
174 super().__init__(nonterminal, capture_name)
+
+
175 self._suffix_automaton = GeneralSam.from_bytes(string.encode("UTF-8"))
+
176 self._string = string
+
177 self.extract_empty_substring = extract_empty_substring
+
178
+
179 def extract(self, input_str: str) -> typing.Optional[tuple[str, str]]:
+
180 """
+
181 Extract the longest substring of a given string from the input string.
+
182 If extract_empty_substring is True, empty string is always a valid substring, so the returned string could be empty and `None` will never be returned.
+
183 Otherwise, empty string is not a valid substring,
+
184 so the returned string could not be empty and `None` will be returned if the input string does not contain the given string.
+
+
185 """
+
186 current_state = self._suffix_automaton.get_root_state()
+
187 longest_match = 0
+
+
188 for char in input_str:
+
189 current_state.feed_bytes(char.encode('utf-8'))
+
190 if current_state.is_nil():
+
+
191 break
+
192 longest_match += 1
+
193
+
+
194 if longest_match > 0 or self.extract_empty_substring:
+
195 extracted = input_str[:longest_match]
+
196 remaining = input_str[longest_match:]
+
197 return remaining, extracted
+
198 return None
+
199
+
200 @property
+
201 def kbnf_definition(self) -> str:
+
202 return f"{self.nonterminal} ::= #substrs{repr(self._string)};"
+
203
+
+ +
+
+
An extractor that uses multiple extractors to extract data.
Definition extractor.py:194
+ +
An abstract extractor that extracts data from a string and offers its KBNF rules definition.
Definition extractor.py:14
+ +
__init__(self, typing.Optional[str] capture_name=None)
Initialize an extractor.
Definition extractor.py:21
+
typing.Optional[tuple[str, typing.Any]] extract(self, str input_str)
Extract data from the input string, or None if the extraction failed.
Definition extractor.py:48
+
typing.Optional[str] capture_name(self)
Get the name of the capture, or None if the extractor does not capture.
Definition extractor.py:35
+ + + +
An extractor that extracts a literal string.
Definition extractor.py:143
+
__init__(self, str literal)
Initialize the literal extractor.
Definition extractor.py:151
+ +
typing.Optional[tuple[str, str]] extract(self, str input_str)
Extract the literal from the input string, or None if the literal is not found.
Definition extractor.py:158
+
An extractor that extracts data corresponding to a nonterminal.
Definition extractor.py:98
+
__init__(self, str nonterminal, typing.Optional[str] capture_name=None)
Initialize the nonterminal extractor.
Definition extractor.py:103
+ +
An extractor that extracts a substring of a given string from the input string.
Definition extractor.py:240
+
+
+ + + + diff --git a/v0.4.9/files.html b/v0.4.9/files.html new file mode 100644 index 0000000..a2d397b --- /dev/null +++ b/v0.4.9/files.html @@ -0,0 +1,163 @@ + + + + + + + + +Formatron: File List + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
File List
+
+
+
Here is a list of all files with brief descriptions:
+
+
+ + + + diff --git a/v0.4.9/files_dup.js b/v0.4.9/files_dup.js new file mode 100644 index 0000000..c3b39c4 --- /dev/null +++ b/v0.4.9/files_dup.js @@ -0,0 +1,4 @@ +var files_dup = +[ + [ "src", "dir_68267d1309a1af8e8297ef4c3efbcdba.html", "dir_68267d1309a1af8e8297ef4c3efbcdba" ] +]; \ No newline at end of file diff --git a/v0.4.9/folderclosed.svg b/v0.4.9/folderclosed.svg new file mode 100644 index 0000000..b04bed2 --- /dev/null +++ b/v0.4.9/folderclosed.svg @@ -0,0 +1,11 @@ + + + + + + + + + + diff --git a/v0.4.9/folderclosedd.svg b/v0.4.9/folderclosedd.svg new file mode 100644 index 0000000..52f0166 --- /dev/null +++ b/v0.4.9/folderclosedd.svg @@ -0,0 +1,11 @@ + + + + + + + + + + diff --git a/v0.4.9/folderopen.svg b/v0.4.9/folderopen.svg new file mode 100644 index 0000000..f6896dd --- /dev/null +++ b/v0.4.9/folderopen.svg @@ -0,0 +1,17 @@ + + + + + + + + + + diff --git a/v0.4.9/folderopend.svg b/v0.4.9/folderopend.svg new file mode 100644 index 0000000..2d1f06e --- /dev/null +++ b/v0.4.9/folderopend.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + diff --git a/v0.4.9/formats_2____init_____8py.html b/v0.4.9/formats_2____init_____8py.html new file mode 100644 index 0000000..fead201 --- /dev/null +++ b/v0.4.9/formats_2____init_____8py.html @@ -0,0 +1,150 @@ + + + + + + + + +Formatron: src/formatron/formats/__init__.py File Reference + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+ +
__init__.py File Reference
+
+
+ +

Go to the source code of this file.

+ + + + + + + +

+Namespaces

namespace  formatron
 
namespace  formatron.formats
 This subpackage contains modules that operate with concrete formats, like json.
 
+
+
+ + + + diff --git a/v0.4.9/formats_2____init_____8py_source.html b/v0.4.9/formats_2____init_____8py_source.html new file mode 100644 index 0000000..21fcc5a --- /dev/null +++ b/v0.4.9/formats_2____init_____8py_source.html @@ -0,0 +1,140 @@ + + + + + + + + +Formatron: src/formatron/formats/__init__.py Source File + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
__init__.py
+
+
+Go to the documentation of this file.
1"""
+
2This subpackage contains modules that operate with concrete formats, like json.
+
3"""
+
+
+ + + + diff --git a/v0.4.9/formatter_8py.html b/v0.4.9/formatter_8py.html new file mode 100644 index 0000000..2305c71 --- /dev/null +++ b/v0.4.9/formatter_8py.html @@ -0,0 +1,162 @@ + + + + + + + + +Formatron: src/formatron/formatter.py File Reference + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+ +
formatter.py File Reference
+
+
+ +

Go to the source code of this file.

+ + + + + + + + + + +

+Classes

class  formatron.formatter.FormatterBase
 An abstract Formatter that enforces a format on the string generated by a language model. More...
 
class  formatron.formatter.Formatter
 
class  formatron.formatter.FormatterBuilder
 A builder for creating a Formatter. More...
 
+ + + + + + +

+Namespaces

namespace  formatron
 
namespace  formatron.formatter
 This module contains the Formatter class and its related classes.
 
+
+
+ + + + diff --git a/v0.4.9/formatter_8py.js b/v0.4.9/formatter_8py.js new file mode 100644 index 0000000..1f40ddc --- /dev/null +++ b/v0.4.9/formatter_8py.js @@ -0,0 +1,6 @@ +var formatter_8py = +[ + [ "formatron.formatter.FormatterBase", "classformatron_1_1formatter_1_1FormatterBase.html", "classformatron_1_1formatter_1_1FormatterBase" ], + [ "formatron.formatter.Formatter", "classformatron_1_1formatter_1_1Formatter.html", "classformatron_1_1formatter_1_1Formatter" ], + [ "formatron.formatter.FormatterBuilder", "classformatron_1_1formatter_1_1FormatterBuilder.html", "classformatron_1_1formatter_1_1FormatterBuilder" ] +]; \ No newline at end of file diff --git a/v0.4.9/formatter_8py_source.html b/v0.4.9/formatter_8py_source.html new file mode 100644 index 0000000..0b7dca2 --- /dev/null +++ b/v0.4.9/formatter_8py_source.html @@ -0,0 +1,766 @@ + + + + + + + + +Formatron: src/formatron/formatter.py Source File + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
formatter.py
+
+
+Go to the documentation of this file.
1"""
+
2This module contains the Formatter class and its related classes.
+
3"""
+
4import abc
+
5import collections
+
6from json import JSONDecodeError
+
7import json
+
8import re
+
9import textwrap
+
10import typing
+
11from copy import copy
+
12import kbnf
+
13from formatron.formats.json import JsonExtractor
+
14from formatron.schemas.schema import Schema
+
15from formatron.extractor import Extractor, LiteralExtractor, NonterminalExtractor, ChoiceExtractor, SubstringExtractor
+
16from formatron.formats.regex import RegexComplementExtractor, RegexExtractor
+
17
+
18
+
19
+
20class FormatterBase(abc.ABC):
+
21 """
+
22 An abstract Formatter that enforces a format on the string generated by a language model.
+
23 """
+
+ +
25 @abc.abstractmethod
+
26 def accept_token(self, token_id: int):
+
27 """
+
28 Accept a token from the language model.
+
29 Args:
+
30 token_id: The token ID.
+
31 Returns:
+
32 The result of accepting the token.
+
33 """
+
+ +
35 @abc.abstractmethod
+
+
36 def accept_bytes(self, _bytes: bytes)->None:
+
37 """
+
38 Accept a bytes object from the language model.
+
39 Args:
+
40 _bytes: The bytes object.
+
41 """
+
+ +
43 @abc.abstractmethod
+
+
44 def compute_allowed_tokens(self) -> None:
+
45 """
+
46 Compute the allowed tokens based on the current state.
+
47 """
+
+ +
49 @abc.abstractmethod
+
+
50 def mask_logits(self, logits) -> typing.Any:
+
51 """
+
52 Mask the logits based on the current state.
+
53 Args:
+
54 logits: The logits to mask.
+
55 Returns:
+
56 The masked logits.
+
57 """
+
+ +
59 @abc.abstractmethod
+
+
60 def get_allowed_tokens_since_last_computation(self) -> typing.Sequence[int]:
+
61 """
+
62 Get the allowed tokens since the last computation(in other words, the last call to `compute_allowed_tokens`).
+
63 Returns:
+
64 The allowed tokens.
+
65 """
+
+ +
67 @abc.abstractmethod
+
+
68 def is_completed(self) -> bool:
+
69 """
+
70 Check if the generated string satisfies the format and hence the generation is completed.
+
71 """
+
+ +
73 @abc.abstractmethod
+
+
74 def _on_completion(self, generated_output: str) -> None:
+
75 """
+
76 Perform actions when the generation is completed.
+
77 """
+
78
+
79 @property
+
+
80 @abc.abstractmethod
+
81 def captures(self) -> dict[str, typing.Any|None]:
+
+
82 """
+
83 Get the captures from the generated string.
+
84 """
+
85
+
86 @abc.abstractmethod
+
87 def reset(self) -> None:
+
88 """
+
89 Reset the formatter to the initial state.
+
90 """
+
91
+
92
+
93class Formatter(FormatterBase):
+
94 """
+
95 A Formatter that enforces a format on the string generated by a language model. It is designed to compose
+
96 multiple extractors in a sequential, unambiguous, greedy manner. Check out the Formatter.captures property docs for more details.
+
97 If you need more complex extraction logic, you need to implement your own Extractor.
+
+
98 """
+
99
+
+
100 def __init__(self, extractors: list[Extractor], engine: kbnf.Engine,
+
101 decode_callback: typing.Callable[[list[int]], str], grammar_str: str):
+
102 """
+
103 Initialize the formatter.
+
+
104 Args:
+
105 extractors: The matchers to extract data from the generated string.
+
106 engine: The KBNF engine to enforce the format.
+
+
107 decode_callback: The callback to decode the token IDs to a string.
+
108 grammar_str: The KBNF grammar string.
+
109 """
+
110 self._extractors = extractors
+
111 self._engine = engine
+
+
+ +
113 self._decode_callback = decode_callback
+
114 self._grammar_str = grammar_str
+
115 self._captures = {}
+
116
+
117 @property
+
118 def grammar_str(self):
+
119 """
+
120 Get the KBNF grammar string.
+
121 """
+
+
122 return self._grammar_str
+
123
+
124 def accept_token(self, token_id: int)->kbnf.AcceptTokenResult:
+
125 result = self._engine.try_accept_new_token(token_id)
+
126 self._token_id_or_bytes.append(token_id)
+
127 if result == kbnf.AcceptTokenResult.Finished:
+ + +
130 return result
+
+
131
+
132 def _obtain_accepted_output(self)->str:
+
133 buffer = []
+
134 output = ""
+
135 last_type = None
+
136 def decode_buffer(buffer_type: type, buffer_content: list):
+
137 if buffer_type not in (int, bytes):
+
138 try:
+
139 buffer_content = [int(item) for item in buffer_content]
+
140 buffer_type = int
+
141 except ValueError:
+
+
142 assert False, f"Invalid type: {buffer_type}. Unable to convert to int."
+
143 if buffer_type is int:
+
144 return self._decode_callback(buffer_content)
+
+
145 elif buffer_type is bytes:
+
146 return b"".join(buffer_content).decode()
+
+ +
148 for element in self._token_id_or_bytes:
+
149 if last_type is None:
+
150 last_type = type(element)
+
151 elif last_type != type(element):
+
152 output += decode_buffer(last_type, buffer)
+
153 buffer.clear()
+
154 last_type = type(element)
+
+
+
155 buffer.append(element)
+
156
+
157 if buffer:
+
158 output += decode_buffer(last_type, buffer)
+
159 return output
+
160
+
161 def accept_bytes(self, _bytes: bytes)->kbnf.AcceptTokenResult:
+
162 result = self._engine.try_accept_new_bytes(_bytes)
+
163 self._token_id_or_bytes.append(_bytes)
+
164 if result == kbnf.AcceptTokenResult.Finished:
+
165 output = self._obtain_accepted_output()
+ +
167 return result
+
168
+
169 def compute_allowed_tokens(self) -> None:
+
170 self._engine.compute_allowed_token_ids()
+
171
+
172 def mask_logits(self, logits) -> typing.Any:
+
173 return self._engine.mask_logits(logits)
+
174
+
175 def get_allowed_tokens_since_last_computation(self) -> typing.Sequence[int]:
+
176 return self._engine.get_allowed_token_ids_from_last_computation()
+
177
+
178 def is_completed(self) -> bool:
+
179 """
+
180 Check if the generation is completed. This means the generation is ended by the engine.
+
181 If the generation is ended by integration-specific stop conditions like `max_new_tokens`,
+
182 the generation is not considered completed by this method.
+
183 """
+
+
+
184 return self._engine.is_finished()
+
185
+
186 def _on_completion(self, generated_output: str) -> None:
+
187 for matcher in self._extractors:
+
188 result = matcher.extract(generated_output)
+
189 if result is None:
+
190 captured = None
+
191 else:
+
+
+
192 generated_output, captured = matcher.extract(generated_output)
+
193 if matcher.capture_name:
+
194 if matcher.capture_name in self._captures:
+
+
+
195 self._captures[matcher.capture_name] = [
+
196 self._captures[matcher.capture_name]]
+
197 self._captures[matcher.capture_name].append(captured)
+
+
+
198 else:
+
199 self._captures[matcher.capture_name] = captured
+
200
+
+
201 @property
+
202 def captures(self) -> dict[str, typing.Any] | None:
+
203 """
+
204 Get the captures from the generated string. Note that the captures are only available for one extractor if:
+
205 - The extractor has a capture name.
+
+
206 - Formatter.is_completed() returns True.
+
207 - The extractor successfully extracts the data.
+
208 - This means the extractor identifies the correct string span to extract and whatever post-processing the extractor does on the extracted string is successful.
+
+
+ +
210 Captures are obtained by calling `Extractor.extract` method on the generated string in the sequence of extractors appended to the formatter.
+
211 Note that the previous extractors does not 'see' the semantics of the later extractors. For example,
+
212 consider the following formatter:
+
213 ```python
+
214 f = FormatterBuilder()
+
215 f.append_line(f"{f.regex('.*?', capture_name='a')}{f.regex('.*', capture_name='b')}")
+
216 f = f.build()
+
217 ```
+
218 The `b` extractor will always corresponding to `None` because the `a` extractor will always extract the whole string.
+
219 This behavior is different from what a typical regular expression engine would do!
+
220 """
+
221 return self._captures
+
222
+
223 def reset(self) -> None:
+
+
224 self._captures.clear()
+
225 self._engine.reset()
+
226 self._token_id_or_bytes.clear()
+
227
+
228 def __str__(self):
+
229 return (f"Formatter(engine={self._engine}, "
+
230 f"captures={self._captures}, "
+
231 f"extractors={len(self._extractors)}, "
+
232 f"completed={self.is_completed()}, "
+
233 f"token_ids={len(self._token_id_or_bytes)})"
+
234 f"grammar={self._grammar_str})")
+
235
+
236
+
237class FormatterBuilder:
+
238 """
+
239 A builder for creating a Formatter.
+
240 """
+
241 _formatter_builder_counter = 0
+
242
+
243 def __init__(self):
+
244 """
+
245 Initialize the formatter builder.
+
246 """
+
247 self._counter = 0
+
248 self._main_rule = []
+
249 self._rules = []
+
250 self._capture_names = set()
+
251 self._nonterminal_to_extractor = {}
+
+
252 self._extractors = []
+
253 self._instance_id = self.__class__._formatter_builder_counter
+
254 self.__class__._formatter_builder_counter += 1
+
+
255
+
256
+
+
257 def _assert_capture_name_valid(self, capture_name: str):
+
258 assert capture_name.isidentifier(), (f"capture_name {capture_name}"
+
259 f" should only contains alphanumeric characters, "
+
260 f"underscores, and does not start with digits!")
+
261 assert capture_name not in self._capture_names, f"capture_name {capture_name} is duplicated!"
+
+
+ +
263 def append_line(self, line: str) -> None:
+
264 """
+
265 Append a line to the format. Specifically, a newline character is appended to the input.
+
266
+
267 Note that if you need a literal `$`, you need to escape it by adding a backslash: `\\$`.
+
268 """
+
269 self.append_str(line + '\n')
+
270
+
+
+
271 def append_multiline_str(self, lines: str) -> None:
+
272 """
+
273 Appends a multiline string to the format, preserving the first line's leading whitespaces
+
+
274 and remove any common leading whitespaces from subsequent lines.
+
275
+
276 Note that tabs and spaces are both treated as whitespace, but they are not equal:
+
277 the lines " hello" and "\\thello" are considered to have no common leading whitespace.
+ +
279 Entirely blank lines are normalized to a newline character.
+
280
+
281 Note that if you need a literal `$`, you need to escape it by adding a backslash: `\\$`.
+
282 """
+
+
283 first = lines.find('\n')
+
284 self.append_str(lines[:first + 1] + textwrap.dedent(lines[first + 1:]))
+ +
286 def append_str(self, string: str) -> None:
+
287 """
+
288 Append a string to the format without any post-processing.
+ +
290 Note that if you need a literal `$`, you need to escape it by adding a backslash: `\\$`.
+
291 """
+
292 state = "normal"
+
293 last = 0
+
+
+ +
295 def append_literal(end):
+
296 if last < end:
+
297 literal = string[last:end]
+
298 self._main_rule.append(repr(literal))
+
299 self._extractors.append(LiteralExtractor(literal))
+
+
300
+
301 for i, char in enumerate(string):
+
302 if char == "$":
+
303 if state != "escaped":
+
304 state = "dollar"
+
+
305 else:
+
306 state = "normal"
+
307 elif state == "dollar":
+
+
308 if char == "{":
+
309 append_literal(i - 1)
+
310 last = i + 1
+
311 state = "left_bracket"
+
312 else:
+
313 state = "normal"
+
314 elif state == "left_bracket":
+
315 if char == "}":
+
316 state = "normal"
+
317 self._main_rule.append(string[last:i])
+
318 self._extractors.append(
+
+
319 self._nonterminal_to_extractor[string[last:i]])
+
320 last = i + 1
+
321 elif char == "\\":
+
322 state = "escaped"
+
+
323 else:
+
324 state = "normal"
+
325 append_literal(len(string))
+
326
+
327 def _create_nonterminal(self, name: str) -> str:
+
+
328 nonterminal = f"__{name}_{self._counter}_{self._instance_id}"
+
329 self._counter += 1
+
330 return nonterminal
+
331
+
332 def _add_capture_name(self, extractor: NonterminalExtractor) -> None:
+
333 if extractor.capture_name is None:
+
334 return None
+
335 self._assert_capture_name_valid(extractor.capture_name)
+
336 self._capture_names.add(extractor.capture_name)
+
337
+
338 def choose(self, *extractors: Extractor | str, capture_name: str = None) -> ChoiceExtractor:
+
339 """
+
340 Create a choice extractor.
+
341
+
342 Check out the ChoiceExtractor docs for more details.
+
343 Args:
+
344 extractors: The extractors to choose from.
+
345 capture_name: The capture name of the extractor, or `None` if the extractor does not capture.
+
346 Returns:
+
347 The choice extractor.
+
348 """
+
349 new_extractors = []
+
350 for extractor in extractors:
+
351 if isinstance(extractor, str):
+
352 new_extractors.append(LiteralExtractor(extractor))
+
353 else:
+
354 new_extractors.append(extractor)
+
355 return self._add_extractor("choice",
+
356 lambda nonterminal: ChoiceExtractor(new_extractors, capture_name, nonterminal))
+
357
+
358 def _add_extractor(self, extractor_type: str, create_extractor: typing.Callable[[str], Extractor]):
+
359 nonterminal = self._create_nonterminal(extractor_type)
+
360 extractor = create_extractor(nonterminal)
+
361 if isinstance(extractor, NonterminalExtractor):
+
362 self._add_capture_name(extractor)
+
363 nonterminal = extractor.nonterminal
+
+
+
364 self._nonterminal_to_extractor[nonterminal] = extractor
+
365 self._rules.append(extractor.kbnf_definition)
+
366 return extractor
+
367
+
368 def extractor(self, create_extractor: typing.Callable[[str], Extractor]) -> Extractor:
+
+
+
369 """
+
370 Create a custom extractor.
+
371
+
372 Args:
+
373 create_extractor: callable with signature (extractor_nonterminal: str)->Extractor that create the extractor. extractor_nonterminal is the auto-generated nonterminal reference for the extractor.
+
374 """
+
+
375 return self._add_extractor("extractor", create_extractor)
+
376
+
377 def json(self, schema: typing.Type[Schema]|collections.abc.Sequence, *, capture_name: str = None) -> JsonExtractor:
+
378 """
+
379 Create a JSON extractor. Check out the JsonExtractor docs for more details.
+
380
+
381 Args:
+
382 schema: The schema for extraction.
+
383 capture_name: The capture name of the extractor, or `None` if the extractor does not capture.
+
384 Returns:
+
+
385 The JSON extractor.
+
386 """
+
387 def to_json(_json: str):
+
388 if isinstance(schema, type) and issubclass(schema, Schema):
+
389 try:
+
390 return schema.from_json(_json)
+
391 except JSONDecodeError: # make ChoiceExtractor work appropriately
+
392 return None
+
393 else:
+
394 try:
+
+
+
395 return json.loads(_json)
+
396 except JSONDecodeError:
+
397 return None
+
398 return self._add_extractor("json",
+
399 lambda nonterminal: JsonExtractor(nonterminal, capture_name,schema, to_json))
+
400
+
401 def regex(self, regex: str, *, capture_name: str = None) -> RegexExtractor:
+
402 """
+
403 Create a regex extractor.
+
404
+
+
405 Check out the RegexExtractor docs for more details.
+
406
+
407 Args:
+
408 regex: The regular expression for extraction.
+
409 capture_name: The capture name of the extractor, or `None` if the extractor does not capture.
+
410 Returns:
+
+
411 The regex extractor.
+
412 """
+
413 return self._add_extractor("regex",
+
+
414 lambda nonterminal: RegexExtractor(regex, capture_name, nonterminal))
+
415
+
416 def regex_complement(self, regex: str, *, capture_name: str = None) -> RegexComplementExtractor:
+
417 """
+
418 Create a regex complement extractor. This is roughly equivalent to 'extract a string that does not match the given regex anywhere'.
+
419
+
420 Check out the RegexComplementExtractor docs for more details.
+
421
+
422 Args:
+
+
423 regex: The regular expression for extraction.
+
424 capture_name: The capture name of the extractor, or `None` if the extractor does not capture.
+
425 Returns:
+
426 The regex complement extractor.
+
427 """
+
428 return self._add_extractor("regex_complement",
+
429 lambda nonterminal: RegexComplementExtractor(regex, capture_name, nonterminal))
+
430
+
431 def str(self, *, stop: typing.Union[str, list[str]] = None,
+
432 capture_name: typing.Optional[str] = None) -> Extractor:
+
433 """
+
434 Create a string extractor.
+
435
+
436 The extractor will extract all text until(inclusive) one of the stop strings is encountered.
+
437
+
+
438 Args:
+
439 stop: The strings for the extractors to stop at. They will be included in text generation and extraction.
+
440 capture_name: The capture name of the extractor, or `None` if the extractor does not capture.
+
441 Returns:
+
442 The string extractor.
+
443 """
+
444 stop = [stop] if isinstance(stop, str) else stop or []
+
445 if not stop:
+
446 capture_regex = ".*"
+
447 else:
+
448 backslash = '\\'
+
+
449 capture_regex = f".*?(?:{'|'.join([re.escape(i.replace(backslash, backslash * 2)) for i in stop])})"
+
450 return self._add_extractor("str",
+
451 lambda nonterminal: RegexExtractor(capture_regex, capture_name, nonterminal))
+
452
+
+
453 def substr(self, string: str, *, capture_name: str = None, extract_empty_substring: bool = False) -> Extractor:
+
454 """
+
455 Create a substring extractor.
+
456
+
457 The extractor will extract a substring of the input string.
+
458
+
459 Args:
+
460 string: The string to extract.
+
461 capture_name: The capture name of the extractor, or `None` if the extractor does not capture.
+
462 extract_empty_substring: Whether to extract an empty substring as a valid substring.
+
463 Returns:
+
+
464 The substring extractor.
+
465 """
+
466 return self._add_extractor("substr",
+
467 lambda nonterminal: SubstringExtractor(string, capture_name, nonterminal,
+
+
468 extract_empty_substring=extract_empty_substring))
+
469
+
470
+
471
+
472 def build(self, vocabulary: kbnf.Vocabulary,
+
473 decode: typing.Callable[[list[int]], str],
+
474 engine_config: kbnf.Config = None) -> Formatter:
+
475 """
+
476 Build a formatter from the builder. The builder will not be consumed and can be used again.
+
477
+
478 Args:
+
+
479 vocabulary: The KBNF engine vocabulary for the formatter.
+
480 decode: The callback to decode the token IDs to a string.
+
481 engine_config: The KBNF engine configuration.
+
482 Returns:
+
483 The formatter.
+
484 """
+
485 assert len(
+
486 self._main_rule) != 0, "An empty formatter builder cannot build!"
+
487 rules = copy(self._rules)
+
488 rules.append(f"start ::= {' '.join(self._main_rule)};")
+
489 grammar_str = "\n".join(rules)
+
+
490 engine = kbnf.Engine(grammar_str, vocabulary, engine_config)
+
491 extractors = copy(self._extractors)
+
492 f = Formatter(extractors, engine, decode, grammar_str)
+
493 return f
+
+
An extractor that uses multiple extractors to extract data.
Definition extractor.py:194
+
An extractor that extracts a literal string.
Definition extractor.py:143
+
An extractor that extracts a substring of a given string from the input string.
Definition extractor.py:240
+
An extractor that loads json data to an object from a string.
Definition json.py:426
+
An extractor that extracts data by matching a regex complement.
Definition regex.py:59
+
An extractor that extracts a string using a regular expression.
Definition regex.py:13
+
An abstract Formatter that enforces a format on the string generated by a language model.
Definition formatter.py:24
+
None _on_completion(self, str generated_output)
Perform actions when the generation is completed.
Definition formatter.py:80
+
None reset(self)
Reset the formatter to the initial state.
Definition formatter.py:104
+
accept_token(self, int token_id)
Accept a token from the language model.
Definition formatter.py:34
+
None compute_allowed_tokens(self)
Compute the allowed tokens based on the current state.
Definition formatter.py:48
+
dict[str, typing.Any|None] captures(self)
Definition formatter.py:98
+
typing.Sequence[int] get_allowed_tokens_since_last_computation(self)
Get the allowed tokens since the last computation(in other words, the last call to compute_allowed_to...
Definition formatter.py:66
+
None accept_bytes(self, bytes _bytes)
Accept a bytes object from the language model.
Definition formatter.py:42
+
bool is_completed(self)
Check if the generated string satisfies the format and hence the generation is completed.
Definition formatter.py:72
+
typing.Any mask_logits(self, logits)
Mask the logits based on the current state.
Definition formatter.py:58
+
A builder for creating a Formatter.
Definition formatter.py:274
+
None append_str(self, str string)
Append a string to the format without any post-processing.
Definition formatter.py:328
+
None _add_capture_name(self, NonterminalExtractor extractor)
Definition formatter.py:369
+ + +
ChoiceExtractor choose(self, *Extractor|str extractors, str capture_name=None)
Create a choice extractor.
Definition formatter.py:385
+
RegexComplementExtractor regex_complement(self, str regex, *, str capture_name=None)
Create a regex complement extractor.
Definition formatter.py:464
+ + +
_add_extractor(self, str extractor_type, typing.Callable[[str], Extractor] create_extractor)
Definition formatter.py:395
+ + +
Formatter build(self, kbnf.Vocabulary vocabulary, typing.Callable[[list[int]], str] decode, kbnf.Config engine_config=None)
Build a formatter from the builder.
Definition formatter.py:521
+
_assert_capture_name_valid(self, str capture_name)
Definition formatter.py:294
+
Extractor substr(self, str string, *, str capture_name=None, bool extract_empty_substring=False)
Create a substring extractor.
Definition formatter.py:502
+
JsonExtractor json(self, typing.Type[Schema]|collections.abc.Sequence schema, *, str capture_name=None)
Create a JSON extractor.
Definition formatter.py:423
+
Extractor str(self, *, typing.Union[str, list[str]] stop=None, typing.Optional[str] capture_name=None)
Create a string extractor.
Definition formatter.py:480
+
str _create_nonterminal(self, str name)
Definition formatter.py:364
+
RegexExtractor regex(self, str regex, *, str capture_name=None)
Create a regex extractor.
Definition formatter.py:449
+ +
typing.Any mask_logits(self, logits)
Mask the logits based on the current state.
Definition formatter.py:195
+
None reset(self)
Reset the formatter to the initial state.
Definition formatter.py:257
+
kbnf.AcceptTokenResult accept_bytes(self, bytes _bytes)
Accept a bytes object from the language model.
Definition formatter.py:184
+
grammar_str(self)
Get the KBNF grammar string.
Definition formatter.py:142
+
__init__(self, list[Extractor] extractors, kbnf.Engine engine, typing.Callable[[list[int]], str] decode_callback, str grammar_str)
Initialize the formatter.
Definition formatter.py:123
+ +
None compute_allowed_tokens(self)
Compute the allowed tokens based on the current state.
Definition formatter.py:192
+
typing.Sequence[int] get_allowed_tokens_since_last_computation(self)
Get the allowed tokens since the last computation(in other words, the last call to compute_allowed_to...
Definition formatter.py:198
+ + + +
kbnf.AcceptTokenResult accept_token(self, int token_id)
Accept a token from the language model.
Definition formatter.py:147
+ + +
bool is_completed(self)
Check if the generation is completed.
Definition formatter.py:206
+
None _on_completion(self, str generated_output)
Perform actions when the generation is completed.
Definition formatter.py:209
+ + +
dict[str, typing.Any]|None captures(self)
Get the captures from the generated string.
Definition formatter.py:252
+
Extractors for extracting data from generated strings.
Definition extractor.py:1
+
The module defines the JsonExtractor class, which is used to extract data from a string in JSON forma...
Definition json.py:1
+
This module contains the RegexExtractor class, which is used to extract data using a regular expressi...
Definition regex.py:1
+
+
+ + + + diff --git a/v0.4.9/functions.html b/v0.4.9/functions.html new file mode 100644 index 0000000..675742f --- /dev/null +++ b/v0.4.9/functions.html @@ -0,0 +1,297 @@ + + + + + + + + +Formatron: Class Members + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all class members with links to the classes they belong to:
+ +

- _ -

+ + +

- a -

+ + +

- b -

+ + +

- c -

+ + +

- e -

+ + +

- f -

+ + +

- g -

+ + +

- i -

+ + +

- j -

+ + +

- k -

+ + +

- m -

+ + +

- n -

+ + +

- p -

+ + +

- r -

+ + +

- s -

+ + +

- t -

+ + +

- u -

+
+
+ + + + diff --git a/v0.4.9/functions_func.html b/v0.4.9/functions_func.html new file mode 100644 index 0000000..d367df1 --- /dev/null +++ b/v0.4.9/functions_func.html @@ -0,0 +1,254 @@ + + + + + + + + +Formatron: Class Members - Functions + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all functions with links to the classes they belong to:
+ +

- _ -

+ + +

- a -

+ + +

- b -

+ + +

- c -

+ + +

- e -

+ + +

- f -

+ + +

- g -

+ + +

- i -

+ + +

- j -

+ + +

- k -

+ + +

- m -

+ + +

- n -

+ + +

- p -

+ + +

- r -

+ + +

- s -

+ + +

- t -

+ + +

- u -

+
+
+ + + + diff --git a/v0.4.9/functions_vars.html b/v0.4.9/functions_vars.html new file mode 100644 index 0000000..4d85de7 --- /dev/null +++ b/v0.4.9/functions_vars.html @@ -0,0 +1,196 @@ + + + + + + + + +Formatron: Class Members - Variables + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all variables with links to the classes they belong to:
+ +

- _ -

+ + +

- c -

+ + +

- e -

+ + +

- f -

+ + +

- r -

+
+
+ + + + diff --git a/v0.4.9/hierarchy.html b/v0.4.9/hierarchy.html new file mode 100644 index 0000000..b186936 --- /dev/null +++ b/v0.4.9/hierarchy.html @@ -0,0 +1,172 @@ + + + + + + + + +Formatron: Class Hierarchy + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Class Hierarchy
+
+
+
This inheritance list is sorted roughly, but not completely, alphabetically:
+
[detail level 1234]
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 Cabc.ABC
 Cformatron.extractor.ExtractorAn abstract extractor that extracts data from a string and offers its KBNF rules definition
 Cformatron.extractor.LiteralExtractorAn extractor that extracts a literal string
 Cformatron.extractor.NonterminalExtractorAn extractor that extracts data corresponding to a nonterminal
 Cformatron.extractor.ChoiceExtractorAn extractor that uses multiple extractors to extract data
 Cformatron.extractor.SubstringExtractorAn extractor that extracts a substring of a given string from the input string
 Cformatron.formats.json.JsonExtractorAn extractor that loads json data to an object from a string
 Cformatron.formats.regex.RegexComplementExtractorAn extractor that extracts data by matching a regex complement
 Cformatron.formats.regex.RegexExtractorAn extractor that extracts a string using a regular expression
 Cformatron.formatter.FormatterBaseAn abstract Formatter that enforces a format on the string generated by a language model
 Cformatron.formatter.Formatter
 Cformatron.schemas.schema.FieldInfoAn abstract field info that describes a data field in a schema
 Cformatron.schemas.dict_inference.FieldInfo
 Cformatron.schemas.json_schema.FieldInfo
 Cformatron.schemas.pydantic.FieldInfoA wrapper for pydantic FieldInfo
 Cformatron.schemas.schema.SchemaAn abstract schema that describes some data
 Cformatron.schemas.pydantic.ClassSchemaA wrapper for pydantic BaseModel that implements the Schema interface
 Cformatron.config.EngineGenerationConfigConfiguration for how an KBNF engine should be used in text generation
 Cformatron.formatter.FormatterBuilderA builder for creating a Formatter
 Cformatron.integrations.vllm.FormattersLogitsProcessorLogit processor that uses formatters to mask batch logits
 Crwkv.utils.PIPELINE
 Cformatron.integrations.RWKV.PIPELINEA wrapper for the pipeline of RWKV
 Crwkv.utils.PIPELINE_ARGS
 Cformatron.integrations.RWKV.PIPELINE_ARGSA wrapper for the arguments of the pipeline of RWKV
 Cformatron.schemas.schema.SubstringOfA metadata class that indicates that the field is a substring of the given string
 Cformatron.schemas.schema.TypeWithMetadataA type with metadata
 CBaseModel
 Cformatron.schemas.pydantic.ClassSchemaA wrapper for pydantic BaseModel that implements the Schema interface
 CExLlamaV2Filter
 Cformatron.integrations.exllamav2.FormatterFilterExLlamaV2Filter that uses a formatter to mask logits
 CLogitsProcessor
 Cformatron.integrations.transformers.FormattersLogitsProcessorLogit processor that uses formatters to mask batch logits
+
+
+
+ + + + diff --git a/v0.4.9/hierarchy.js b/v0.4.9/hierarchy.js new file mode 100644 index 0000000..f8bdad9 --- /dev/null +++ b/v0.4.9/hierarchy.js @@ -0,0 +1,46 @@ +var hierarchy = +[ + [ "abc.ABC", null, [ + [ "formatron.extractor.Extractor", "classformatron_1_1extractor_1_1Extractor.html", [ + [ "formatron.extractor.LiteralExtractor", "classformatron_1_1extractor_1_1LiteralExtractor.html", null ], + [ "formatron.extractor.NonterminalExtractor", "classformatron_1_1extractor_1_1NonterminalExtractor.html", [ + [ "formatron.extractor.ChoiceExtractor", "classformatron_1_1extractor_1_1ChoiceExtractor.html", null ], + [ "formatron.extractor.SubstringExtractor", "classformatron_1_1extractor_1_1SubstringExtractor.html", null ], + [ "formatron.formats.json.JsonExtractor", "classformatron_1_1formats_1_1json_1_1JsonExtractor.html", null ], + [ "formatron.formats.regex.RegexComplementExtractor", "classformatron_1_1formats_1_1regex_1_1RegexComplementExtractor.html", null ], + [ "formatron.formats.regex.RegexExtractor", "classformatron_1_1formats_1_1regex_1_1RegexExtractor.html", null ] + ] ] + ] ], + [ "formatron.formatter.FormatterBase", "classformatron_1_1formatter_1_1FormatterBase.html", [ + [ "formatron.formatter.Formatter", "classformatron_1_1formatter_1_1Formatter.html", null ] + ] ], + [ "formatron.schemas.schema.FieldInfo", "classformatron_1_1schemas_1_1schema_1_1FieldInfo.html", [ + [ "formatron.schemas.dict_inference.FieldInfo", "classformatron_1_1schemas_1_1dict__inference_1_1FieldInfo.html", null ], + [ "formatron.schemas.json_schema.FieldInfo", "classformatron_1_1schemas_1_1json__schema_1_1FieldInfo.html", null ], + [ "formatron.schemas.pydantic.FieldInfo", "classformatron_1_1schemas_1_1pydantic_1_1FieldInfo.html", null ] + ] ], + [ "formatron.schemas.schema.Schema", "classformatron_1_1schemas_1_1schema_1_1Schema.html", [ + [ "formatron.schemas.pydantic.ClassSchema", "classformatron_1_1schemas_1_1pydantic_1_1ClassSchema.html", null ] + ] ] + ] ], + [ "formatron.config.EngineGenerationConfig", "classformatron_1_1config_1_1EngineGenerationConfig.html", null ], + [ "formatron.formatter.FormatterBuilder", "classformatron_1_1formatter_1_1FormatterBuilder.html", null ], + [ "formatron.integrations.vllm.FormattersLogitsProcessor", "classformatron_1_1integrations_1_1vllm_1_1FormattersLogitsProcessor.html", null ], + [ "rwkv.utils.PIPELINE", null, [ + [ "formatron.integrations.RWKV.PIPELINE", "classformatron_1_1integrations_1_1RWKV_1_1PIPELINE.html", null ] + ] ], + [ "rwkv.utils.PIPELINE_ARGS", null, [ + [ "formatron.integrations.RWKV.PIPELINE_ARGS", "classformatron_1_1integrations_1_1RWKV_1_1PIPELINE__ARGS.html", null ] + ] ], + [ "formatron.schemas.schema.SubstringOf", "classformatron_1_1schemas_1_1schema_1_1SubstringOf.html", null ], + [ "formatron.schemas.schema.TypeWithMetadata", "classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata.html", null ], + [ "BaseModel", null, [ + [ "formatron.schemas.pydantic.ClassSchema", "classformatron_1_1schemas_1_1pydantic_1_1ClassSchema.html", null ] + ] ], + [ "ExLlamaV2Filter", null, [ + [ "formatron.integrations.exllamav2.FormatterFilter", "classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html", null ] + ] ], + [ "LogitsProcessor", null, [ + [ "formatron.integrations.transformers.FormattersLogitsProcessor", "classformatron_1_1integrations_1_1transformers_1_1FormattersLogitsProcessor.html", null ] + ] ] +]; \ No newline at end of file diff --git a/v0.4.9/index.html b/v0.4.9/index.html new file mode 100644 index 0000000..51860ff --- /dev/null +++ b/v0.4.9/index.html @@ -0,0 +1,137 @@ + + + + + + + + +Formatron: Main Page + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Formatron Documentation
+
+
+ +
+
+ + + + diff --git a/v0.4.9/integrations_2____init_____8py.html b/v0.4.9/integrations_2____init_____8py.html new file mode 100644 index 0000000..d230914 --- /dev/null +++ b/v0.4.9/integrations_2____init_____8py.html @@ -0,0 +1,150 @@ + + + + + + + + +Formatron: src/formatron/integrations/__init__.py File Reference + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+ +
__init__.py File Reference
+
+
+ +

Go to the source code of this file.

+ + + + + + + +

+Namespaces

namespace  formatron
 
namespace  formatron.integrations
 This subpackage contains integrations with other frameworks and libraries.
 
+
+
+ + + + diff --git a/v0.4.9/integrations_2____init_____8py_source.html b/v0.4.9/integrations_2____init_____8py_source.html new file mode 100644 index 0000000..94782e7 --- /dev/null +++ b/v0.4.9/integrations_2____init_____8py_source.html @@ -0,0 +1,140 @@ + + + + + + + + +Formatron: src/formatron/integrations/__init__.py Source File + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
__init__.py
+
+
+Go to the documentation of this file.
1"""
+
2This subpackage contains integrations with other frameworks and libraries.
+
3"""
+
+
+ + + + diff --git a/v0.4.9/jquery.js b/v0.4.9/jquery.js new file mode 100644 index 0000000..1dffb65 --- /dev/null +++ b/v0.4.9/jquery.js @@ -0,0 +1,34 @@ +/*! jQuery v3.6.0 | (c) OpenJS Foundation and other contributors | jquery.org/license */ +!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(C,e){"use strict";var t=[],r=Object.getPrototypeOf,s=t.slice,g=t.flat?function(e){return t.flat.call(e)}:function(e){return t.concat.apply([],e)},u=t.push,i=t.indexOf,n={},o=n.toString,v=n.hasOwnProperty,a=v.toString,l=a.call(Object),y={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType&&"function"!=typeof e.item},x=function(e){return null!=e&&e===e.window},E=C.document,c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||E).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e}var f="3.6.0",S=function(e,t){return new S.fn.init(e,t)};function p(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!m(e)&&!x(e)&&("array"===n||0===t||"number"==typeof t&&0+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),X=new RegExp(F),V=new RegExp("^"+I+"$"),G={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+W),PSEUDO:new RegExp("^"+F),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+R+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/HTML$/i,Q=/^(?:input|select|textarea|button)$/i,J=/^h\d$/i,K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\[\\da-fA-F]{1,6}"+M+"?|\\\\([^\\r\\n\\f])","g"),ne=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){T()},ae=be(function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{H.apply(t=O.call(p.childNodes),p.childNodes),t[p.childNodes.length].nodeType}catch(e){H={apply:t.length?function(e,t){L.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function se(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&(T(e),e=e||C,E)){if(11!==p&&(u=Z.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(f&&(a=f.getElementById(i))&&y(e,a)&&a.id===i)return n.push(a),n}else{if(u[2])return H.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&d.getElementsByClassName&&e.getElementsByClassName)return H.apply(n,e.getElementsByClassName(i)),n}if(d.qsa&&!N[t+" "]&&(!v||!v.test(t))&&(1!==p||"object"!==e.nodeName.toLowerCase())){if(c=t,f=e,1===p&&(U.test(t)||z.test(t))){(f=ee.test(t)&&ye(e.parentNode)||e)===e&&d.scope||((s=e.getAttribute("id"))?s=s.replace(re,ie):e.setAttribute("id",s=S)),o=(l=h(t)).length;while(o--)l[o]=(s?"#"+s:":scope")+" "+xe(l[o]);c=l.join(",")}try{return H.apply(n,f.querySelectorAll(c)),n}catch(e){N(t,!0)}finally{s===S&&e.removeAttribute("id")}}}return g(t.replace($,"$1"),e,n,r)}function ue(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function le(e){return e[S]=!0,e}function ce(e){var t=C.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function fe(e,t){var n=e.split("|"),r=n.length;while(r--)b.attrHandle[n[r]]=t}function pe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function de(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function he(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function ge(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&ae(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function ve(a){return le(function(o){return o=+o,le(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function ye(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}for(e in d=se.support={},i=se.isXML=function(e){var t=e&&e.namespaceURI,n=e&&(e.ownerDocument||e).documentElement;return!Y.test(t||n&&n.nodeName||"HTML")},T=se.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:p;return r!=C&&9===r.nodeType&&r.documentElement&&(a=(C=r).documentElement,E=!i(C),p!=C&&(n=C.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",oe,!1):n.attachEvent&&n.attachEvent("onunload",oe)),d.scope=ce(function(e){return a.appendChild(e).appendChild(C.createElement("div")),"undefined"!=typeof e.querySelectorAll&&!e.querySelectorAll(":scope fieldset div").length}),d.attributes=ce(function(e){return e.className="i",!e.getAttribute("className")}),d.getElementsByTagName=ce(function(e){return e.appendChild(C.createComment("")),!e.getElementsByTagName("*").length}),d.getElementsByClassName=K.test(C.getElementsByClassName),d.getById=ce(function(e){return a.appendChild(e).id=S,!C.getElementsByName||!C.getElementsByName(S).length}),d.getById?(b.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(te,ne);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=d.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},b.find.CLASS=d.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&E)return t.getElementsByClassName(e)},s=[],v=[],(d.qsa=K.test(C.querySelectorAll))&&(ce(function(e){var t;a.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&v.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||v.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll("[id~="+S+"-]").length||v.push("~="),(t=C.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||v.push("\\["+M+"*name"+M+"*="+M+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||v.push(":checked"),e.querySelectorAll("a#"+S+"+*").length||v.push(".#.+[+~]"),e.querySelectorAll("\\\f"),v.push("[\\r\\n\\f]")}),ce(function(e){e.innerHTML="";var t=C.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&v.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&v.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&v.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),v.push(",.*:")})),(d.matchesSelector=K.test(c=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&ce(function(e){d.disconnectedMatch=c.call(e,"*"),c.call(e,"[s!='']:x"),s.push("!=",F)}),v=v.length&&new RegExp(v.join("|")),s=s.length&&new RegExp(s.join("|")),t=K.test(a.compareDocumentPosition),y=t||K.test(a.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},j=t?function(e,t){if(e===t)return l=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===n?e==C||e.ownerDocument==p&&y(p,e)?-1:t==C||t.ownerDocument==p&&y(p,t)?1:u?P(u,e)-P(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e==C?-1:t==C?1:i?-1:o?1:u?P(u,e)-P(u,t):0;if(i===o)return pe(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?pe(a[r],s[r]):a[r]==p?-1:s[r]==p?1:0}),C},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if(T(e),d.matchesSelector&&E&&!N[t+" "]&&(!s||!s.test(t))&&(!v||!v.test(t)))try{var n=c.call(e,t);if(n||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){N(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||se.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&se.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return G.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=h(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=m[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&m(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=se.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,n,r){return m(n)?S.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?S.grep(e,function(e){return e===n!==r}):"string"!=typeof n?S.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(S.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||D,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:q.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof S?t[0]:t,S.merge(this,S.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:E,!0)),N.test(r[1])&&S.isPlainObject(t))for(r in t)m(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=E.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==n.ready?n.ready(e):e(S):S.makeArray(e,this)}).prototype=S.fn,D=S(E);var L=/^(?:parents|prev(?:Until|All))/,H={children:!0,contents:!0,next:!0,prev:!0};function O(e,t){while((e=e[t])&&1!==e.nodeType);return e}S.fn.extend({has:function(e){var t=S(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,he=/^$|^module$|\/(?:java|ecma)script/i;ce=E.createDocumentFragment().appendChild(E.createElement("div")),(fe=E.createElement("input")).setAttribute("type","radio"),fe.setAttribute("checked","checked"),fe.setAttribute("name","t"),ce.appendChild(fe),y.checkClone=ce.cloneNode(!0).cloneNode(!0).lastChild.checked,ce.innerHTML="",y.noCloneChecked=!!ce.cloneNode(!0).lastChild.defaultValue,ce.innerHTML="",y.option=!!ce.lastChild;var ge={thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function ve(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?S.merge([e],n):n}function ye(e,t){for(var n=0,r=e.length;n",""]);var me=/<|&#?\w+;/;function xe(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d\s*$/g;function je(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&S(e).children("tbody")[0]||e}function De(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function qe(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Le(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(Y.hasData(e)&&(s=Y.get(e).events))for(i in Y.remove(t,"handle events"),s)for(n=0,r=s[i].length;n").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),E.head.appendChild(r[0])},abort:function(){i&&i()}}});var _t,zt=[],Ut=/(=)\?(?=&|$)|\?\?/;S.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=zt.pop()||S.expando+"_"+wt.guid++;return this[e]=!0,e}}),S.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Ut.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Ut.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=m(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Ut,"$1"+r):!1!==e.jsonp&&(e.url+=(Tt.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||S.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=C[r],C[r]=function(){o=arguments},n.always(function(){void 0===i?S(C).removeProp(r):C[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,zt.push(r)),o&&m(i)&&i(o[0]),o=i=void 0}),"script"}),y.createHTMLDocument=((_t=E.implementation.createHTMLDocument("").body).innerHTML="
",2===_t.childNodes.length),S.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(y.createHTMLDocument?((r=(t=E.implementation.createHTMLDocument("")).createElement("base")).href=E.location.href,t.head.appendChild(r)):t=E),o=!n&&[],(i=N.exec(e))?[t.createElement(i[1])]:(i=xe([e],t,o),o&&o.length&&S(o).remove(),S.merge([],i.childNodes)));var r,i,o},S.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1").append(S.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},S.expr.pseudos.animated=function(t){return S.grep(S.timers,function(e){return t===e.elem}).length},S.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=S.css(e,"position"),c=S(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=S.css(e,"top"),u=S.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),m(t)&&(t=t.call(e,n,S.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):c.css(f)}},S.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){S.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===S.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===S.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=S(e).offset()).top+=S.css(e,"borderTopWidth",!0),i.left+=S.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-S.css(r,"marginTop",!0),left:t.left-i.left-S.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===S.css(e,"position"))e=e.offsetParent;return e||re})}}),S.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;S.fn[t]=function(e){return $(this,function(e,t,n){var r;if(x(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),S.each(["top","left"],function(e,n){S.cssHooks[n]=Fe(y.pixelPosition,function(e,t){if(t)return t=We(e,n),Pe.test(t)?S(e).position()[n]+"px":t})}),S.each({Height:"height",Width:"width"},function(a,s){S.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){S.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return $(this,function(e,t,n){var r;return x(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?S.css(e,t,i):S.style(e,t,n,i)},s,n?e:void 0,n)}})}),S.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){S.fn[t]=function(e){return this.on(t,e)}}),S.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),S.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){S.fn[n]=function(e,t){return 0",options:{classes:{},disabled:!1,create:null},_createWidget:function(t,e){e=y(e||this.defaultElement||this)[0],this.element=y(e),this.uuid=i++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=y(),this.hoverable=y(),this.focusable=y(),this.classesElementLookup={},e!==this&&(y.data(e,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===e&&this.destroy()}}),this.document=y(e.style?e.ownerDocument:e.document||e),this.window=y(this.document[0].defaultView||this.document[0].parentWindow)),this.options=y.widget.extend({},this.options,this._getCreateOptions(),t),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:y.noop,_create:y.noop,_init:y.noop,destroy:function(){var i=this;this._destroy(),y.each(this.classesElementLookup,function(t,e){i._removeClass(e,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:y.noop,widget:function(){return this.element},option:function(t,e){var i,s,n,o=t;if(0===arguments.length)return y.widget.extend({},this.options);if("string"==typeof t)if(o={},t=(i=t.split(".")).shift(),i.length){for(s=o[t]=y.widget.extend({},this.options[t]),n=0;n
"),i=e.children()[0];return y("body").append(e),t=i.offsetWidth,e.css("overflow","scroll"),t===(i=i.offsetWidth)&&(i=e[0].clientWidth),e.remove(),s=t-i},getScrollInfo:function(t){var e=t.isWindow||t.isDocument?"":t.element.css("overflow-x"),i=t.isWindow||t.isDocument?"":t.element.css("overflow-y"),e="scroll"===e||"auto"===e&&t.widthx(D(s),D(n))?o.important="horizontal":o.important="vertical",p.using.call(this,t,o)}),h.offset(y.extend(l,{using:t}))})},y.ui.position={fit:{left:function(t,e){var i=e.within,s=i.isWindow?i.scrollLeft:i.offset.left,n=i.width,o=t.left-e.collisionPosition.marginLeft,h=s-o,a=o+e.collisionWidth-n-s;e.collisionWidth>n?0n?0=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),y.ui.plugin={add:function(t,e,i){var s,n=y.ui[t].prototype;for(s in i)n.plugins[s]=n.plugins[s]||[],n.plugins[s].push([e,i[s]])},call:function(t,e,i,s){var n,o=t.plugins[e];if(o&&(s||t.element[0].parentNode&&11!==t.element[0].parentNode.nodeType))for(n=0;n").css({overflow:"hidden",position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.resizable("instance")),this.elementIsWrapper=!0,t={marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom"),marginLeft:this.originalElement.css("marginLeft")},this.element.css(t),this.originalElement.css("margin",0),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css(t),this._proportionallyResize()),this._setupHandles(),e.autoHide&&y(this.element).on("mouseenter",function(){e.disabled||(i._removeClass("ui-resizable-autohide"),i._handles.show())}).on("mouseleave",function(){e.disabled||i.resizing||(i._addClass("ui-resizable-autohide"),i._handles.hide())}),this._mouseInit()},_destroy:function(){this._mouseDestroy(),this._addedHandles.remove();function t(t){y(t).removeData("resizable").removeData("ui-resizable").off(".resizable")}var e;return this.elementIsWrapper&&(t(this.element),e=this.element,this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")}).insertAfter(e),e.remove()),this.originalElement.css("resize",this.originalResizeStyle),t(this.originalElement),this},_setOption:function(t,e){switch(this._super(t,e),t){case"handles":this._removeHandles(),this._setupHandles();break;case"aspectRatio":this._aspectRatio=!!e}},_setupHandles:function(){var t,e,i,s,n,o=this.options,h=this;if(this.handles=o.handles||(y(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this._handles=y(),this._addedHandles=y(),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),i=this.handles.split(","),this.handles={},e=0;e"),this._addClass(n,"ui-resizable-handle "+s),n.css({zIndex:o.zIndex}),this.handles[t]=".ui-resizable-"+t,this.element.children(this.handles[t]).length||(this.element.append(n),this._addedHandles=this._addedHandles.add(n));this._renderAxis=function(t){var e,i,s;for(e in t=t||this.element,this.handles)this.handles[e].constructor===String?this.handles[e]=this.element.children(this.handles[e]).first().show():(this.handles[e].jquery||this.handles[e].nodeType)&&(this.handles[e]=y(this.handles[e]),this._on(this.handles[e],{mousedown:h._mouseDown})),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)&&(i=y(this.handles[e],this.element),s=/sw|ne|nw|se|n|s/.test(e)?i.outerHeight():i.outerWidth(),i=["padding",/ne|nw|n/.test(e)?"Top":/se|sw|s/.test(e)?"Bottom":/^e$/.test(e)?"Right":"Left"].join(""),t.css(i,s),this._proportionallyResize()),this._handles=this._handles.add(this.handles[e])},this._renderAxis(this.element),this._handles=this._handles.add(this.element.find(".ui-resizable-handle")),this._handles.disableSelection(),this._handles.on("mouseover",function(){h.resizing||(this.className&&(n=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),h.axis=n&&n[1]?n[1]:"se")}),o.autoHide&&(this._handles.hide(),this._addClass("ui-resizable-autohide"))},_removeHandles:function(){this._addedHandles.remove()},_mouseCapture:function(t){var e,i,s=!1;for(e in this.handles)(i=y(this.handles[e])[0])!==t.target&&!y.contains(i,t.target)||(s=!0);return!this.options.disabled&&s},_mouseStart:function(t){var e,i,s=this.options,n=this.element;return this.resizing=!0,this._renderProxy(),e=this._num(this.helper.css("left")),i=this._num(this.helper.css("top")),s.containment&&(e+=y(s.containment).scrollLeft()||0,i+=y(s.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:e,top:i},this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:n.width(),height:n.height()},this.originalSize=this._helper?{width:n.outerWidth(),height:n.outerHeight()}:{width:n.width(),height:n.height()},this.sizeDiff={width:n.outerWidth()-n.width(),height:n.outerHeight()-n.height()},this.originalPosition={left:e,top:i},this.originalMousePosition={left:t.pageX,top:t.pageY},this.aspectRatio="number"==typeof s.aspectRatio?s.aspectRatio:this.originalSize.width/this.originalSize.height||1,s=y(".ui-resizable-"+this.axis).css("cursor"),y("body").css("cursor","auto"===s?this.axis+"-resize":s),this._addClass("ui-resizable-resizing"),this._propagate("start",t),!0},_mouseDrag:function(t){var e=this.originalMousePosition,i=this.axis,s=t.pageX-e.left||0,e=t.pageY-e.top||0,i=this._change[i];return this._updatePrevProperties(),i&&(e=i.apply(this,[t,s,e]),this._updateVirtualBoundaries(t.shiftKey),(this._aspectRatio||t.shiftKey)&&(e=this._updateRatio(e,t)),e=this._respectSize(e,t),this._updateCache(e),this._propagate("resize",t),e=this._applyChanges(),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),y.isEmptyObject(e)||(this._updatePrevProperties(),this._trigger("resize",t,this.ui()),this._applyChanges())),!1},_mouseStop:function(t){this.resizing=!1;var e,i,s,n=this.options,o=this;return this._helper&&(s=(e=(i=this._proportionallyResizeElements).length&&/textarea/i.test(i[0].nodeName))&&this._hasScroll(i[0],"left")?0:o.sizeDiff.height,i=e?0:o.sizeDiff.width,e={width:o.helper.width()-i,height:o.helper.height()-s},i=parseFloat(o.element.css("left"))+(o.position.left-o.originalPosition.left)||null,s=parseFloat(o.element.css("top"))+(o.position.top-o.originalPosition.top)||null,n.animate||this.element.css(y.extend(e,{top:s,left:i})),o.helper.height(o.size.height),o.helper.width(o.size.width),this._helper&&!n.animate&&this._proportionallyResize()),y("body").css("cursor","auto"),this._removeClass("ui-resizable-resizing"),this._propagate("stop",t),this._helper&&this.helper.remove(),!1},_updatePrevProperties:function(){this.prevPosition={top:this.position.top,left:this.position.left},this.prevSize={width:this.size.width,height:this.size.height}},_applyChanges:function(){var t={};return this.position.top!==this.prevPosition.top&&(t.top=this.position.top+"px"),this.position.left!==this.prevPosition.left&&(t.left=this.position.left+"px"),this.size.width!==this.prevSize.width&&(t.width=this.size.width+"px"),this.size.height!==this.prevSize.height&&(t.height=this.size.height+"px"),this.helper.css(t),t},_updateVirtualBoundaries:function(t){var e,i,s=this.options,n={minWidth:this._isNumber(s.minWidth)?s.minWidth:0,maxWidth:this._isNumber(s.maxWidth)?s.maxWidth:1/0,minHeight:this._isNumber(s.minHeight)?s.minHeight:0,maxHeight:this._isNumber(s.maxHeight)?s.maxHeight:1/0};(this._aspectRatio||t)&&(e=n.minHeight*this.aspectRatio,i=n.minWidth/this.aspectRatio,s=n.maxHeight*this.aspectRatio,t=n.maxWidth/this.aspectRatio,e>n.minWidth&&(n.minWidth=e),i>n.minHeight&&(n.minHeight=i),st.width,h=this._isNumber(t.height)&&e.minHeight&&e.minHeight>t.height,a=this.originalPosition.left+this.originalSize.width,r=this.originalPosition.top+this.originalSize.height,l=/sw|nw|w/.test(i),i=/nw|ne|n/.test(i);return o&&(t.width=e.minWidth),h&&(t.height=e.minHeight),s&&(t.width=e.maxWidth),n&&(t.height=e.maxHeight),o&&l&&(t.left=a-e.minWidth),s&&l&&(t.left=a-e.maxWidth),h&&i&&(t.top=r-e.minHeight),n&&i&&(t.top=r-e.maxHeight),t.width||t.height||t.left||!t.top?t.width||t.height||t.top||!t.left||(t.left=null):t.top=null,t},_getPaddingPlusBorderDimensions:function(t){for(var e=0,i=[],s=[t.css("borderTopWidth"),t.css("borderRightWidth"),t.css("borderBottomWidth"),t.css("borderLeftWidth")],n=[t.css("paddingTop"),t.css("paddingRight"),t.css("paddingBottom"),t.css("paddingLeft")];e<4;e++)i[e]=parseFloat(s[e])||0,i[e]+=parseFloat(n[e])||0;return{height:i[0]+i[2],width:i[1]+i[3]}},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var t,e=0,i=this.helper||this.element;e").css({overflow:"hidden"}),this._addClass(this.helper,this._helper),this.helper.css({width:this.element.outerWidth(),height:this.element.outerHeight(),position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++e.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(t,e){return{width:this.originalSize.width+e}},w:function(t,e){var i=this.originalSize;return{left:this.originalPosition.left+e,width:i.width-e}},n:function(t,e,i){var s=this.originalSize;return{top:this.originalPosition.top+i,height:s.height-i}},s:function(t,e,i){return{height:this.originalSize.height+i}},se:function(t,e,i){return y.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[t,e,i]))},sw:function(t,e,i){return y.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[t,e,i]))},ne:function(t,e,i){return y.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[t,e,i]))},nw:function(t,e,i){return y.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[t,e,i]))}},_propagate:function(t,e){y.ui.plugin.call(this,t,[e,this.ui()]),"resize"!==t&&this._trigger(t,e,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),y.ui.plugin.add("resizable","animate",{stop:function(e){var i=y(this).resizable("instance"),t=i.options,s=i._proportionallyResizeElements,n=s.length&&/textarea/i.test(s[0].nodeName),o=n&&i._hasScroll(s[0],"left")?0:i.sizeDiff.height,h=n?0:i.sizeDiff.width,n={width:i.size.width-h,height:i.size.height-o},h=parseFloat(i.element.css("left"))+(i.position.left-i.originalPosition.left)||null,o=parseFloat(i.element.css("top"))+(i.position.top-i.originalPosition.top)||null;i.element.animate(y.extend(n,o&&h?{top:o,left:h}:{}),{duration:t.animateDuration,easing:t.animateEasing,step:function(){var t={width:parseFloat(i.element.css("width")),height:parseFloat(i.element.css("height")),top:parseFloat(i.element.css("top")),left:parseFloat(i.element.css("left"))};s&&s.length&&y(s[0]).css({width:t.width,height:t.height}),i._updateCache(t),i._propagate("resize",e)}})}}),y.ui.plugin.add("resizable","containment",{start:function(){var i,s,n=y(this).resizable("instance"),t=n.options,e=n.element,o=t.containment,h=o instanceof y?o.get(0):/parent/.test(o)?e.parent().get(0):o;h&&(n.containerElement=y(h),/document/.test(o)||o===document?(n.containerOffset={left:0,top:0},n.containerPosition={left:0,top:0},n.parentData={element:y(document),left:0,top:0,width:y(document).width(),height:y(document).height()||document.body.parentNode.scrollHeight}):(i=y(h),s=[],y(["Top","Right","Left","Bottom"]).each(function(t,e){s[t]=n._num(i.css("padding"+e))}),n.containerOffset=i.offset(),n.containerPosition=i.position(),n.containerSize={height:i.innerHeight()-s[3],width:i.innerWidth()-s[1]},t=n.containerOffset,e=n.containerSize.height,o=n.containerSize.width,o=n._hasScroll(h,"left")?h.scrollWidth:o,e=n._hasScroll(h)?h.scrollHeight:e,n.parentData={element:h,left:t.left,top:t.top,width:o,height:e}))},resize:function(t){var e=y(this).resizable("instance"),i=e.options,s=e.containerOffset,n=e.position,o=e._aspectRatio||t.shiftKey,h={top:0,left:0},a=e.containerElement,t=!0;a[0]!==document&&/static/.test(a.css("position"))&&(h=s),n.left<(e._helper?s.left:0)&&(e.size.width=e.size.width+(e._helper?e.position.left-s.left:e.position.left-h.left),o&&(e.size.height=e.size.width/e.aspectRatio,t=!1),e.position.left=i.helper?s.left:0),n.top<(e._helper?s.top:0)&&(e.size.height=e.size.height+(e._helper?e.position.top-s.top:e.position.top),o&&(e.size.width=e.size.height*e.aspectRatio,t=!1),e.position.top=e._helper?s.top:0),i=e.containerElement.get(0)===e.element.parent().get(0),n=/relative|absolute/.test(e.containerElement.css("position")),i&&n?(e.offset.left=e.parentData.left+e.position.left,e.offset.top=e.parentData.top+e.position.top):(e.offset.left=e.element.offset().left,e.offset.top=e.element.offset().top),n=Math.abs(e.sizeDiff.width+(e._helper?e.offset.left-h.left:e.offset.left-s.left)),s=Math.abs(e.sizeDiff.height+(e._helper?e.offset.top-h.top:e.offset.top-s.top)),n+e.size.width>=e.parentData.width&&(e.size.width=e.parentData.width-n,o&&(e.size.height=e.size.width/e.aspectRatio,t=!1)),s+e.size.height>=e.parentData.height&&(e.size.height=e.parentData.height-s,o&&(e.size.width=e.size.height*e.aspectRatio,t=!1)),t||(e.position.left=e.prevPosition.left,e.position.top=e.prevPosition.top,e.size.width=e.prevSize.width,e.size.height=e.prevSize.height)},stop:function(){var t=y(this).resizable("instance"),e=t.options,i=t.containerOffset,s=t.containerPosition,n=t.containerElement,o=y(t.helper),h=o.offset(),a=o.outerWidth()-t.sizeDiff.width,o=o.outerHeight()-t.sizeDiff.height;t._helper&&!e.animate&&/relative/.test(n.css("position"))&&y(this).css({left:h.left-s.left-i.left,width:a,height:o}),t._helper&&!e.animate&&/static/.test(n.css("position"))&&y(this).css({left:h.left-s.left-i.left,width:a,height:o})}}),y.ui.plugin.add("resizable","alsoResize",{start:function(){var t=y(this).resizable("instance").options;y(t.alsoResize).each(function(){var t=y(this);t.data("ui-resizable-alsoresize",{width:parseFloat(t.width()),height:parseFloat(t.height()),left:parseFloat(t.css("left")),top:parseFloat(t.css("top"))})})},resize:function(t,i){var e=y(this).resizable("instance"),s=e.options,n=e.originalSize,o=e.originalPosition,h={height:e.size.height-n.height||0,width:e.size.width-n.width||0,top:e.position.top-o.top||0,left:e.position.left-o.left||0};y(s.alsoResize).each(function(){var t=y(this),s=y(this).data("ui-resizable-alsoresize"),n={},e=t.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];y.each(e,function(t,e){var i=(s[e]||0)+(h[e]||0);i&&0<=i&&(n[e]=i||null)}),t.css(n)})},stop:function(){y(this).removeData("ui-resizable-alsoresize")}}),y.ui.plugin.add("resizable","ghost",{start:function(){var t=y(this).resizable("instance"),e=t.size;t.ghost=t.originalElement.clone(),t.ghost.css({opacity:.25,display:"block",position:"relative",height:e.height,width:e.width,margin:0,left:0,top:0}),t._addClass(t.ghost,"ui-resizable-ghost"),!1!==y.uiBackCompat&&"string"==typeof t.options.ghost&&t.ghost.addClass(this.options.ghost),t.ghost.appendTo(t.helper)},resize:function(){var t=y(this).resizable("instance");t.ghost&&t.ghost.css({position:"relative",height:t.size.height,width:t.size.width})},stop:function(){var t=y(this).resizable("instance");t.ghost&&t.helper&&t.helper.get(0).removeChild(t.ghost.get(0))}}),y.ui.plugin.add("resizable","grid",{resize:function(){var t,e=y(this).resizable("instance"),i=e.options,s=e.size,n=e.originalSize,o=e.originalPosition,h=e.axis,a="number"==typeof i.grid?[i.grid,i.grid]:i.grid,r=a[0]||1,l=a[1]||1,u=Math.round((s.width-n.width)/r)*r,p=Math.round((s.height-n.height)/l)*l,d=n.width+u,c=n.height+p,f=i.maxWidth&&i.maxWidthd,s=i.minHeight&&i.minHeight>c;i.grid=a,m&&(d+=r),s&&(c+=l),f&&(d-=r),g&&(c-=l),/^(se|s|e)$/.test(h)?(e.size.width=d,e.size.height=c):/^(ne)$/.test(h)?(e.size.width=d,e.size.height=c,e.position.top=o.top-p):/^(sw)$/.test(h)?(e.size.width=d,e.size.height=c,e.position.left=o.left-u):((c-l<=0||d-r<=0)&&(t=e._getPaddingPlusBorderDimensions(this)),0=f[g]?0:Math.min(f[g],n));!a&&1-1){targetElements.on(evt+EVENT_NAMESPACE,function elementToggle(event){$.powerTip.toggle(this,event)})}else{targetElements.on(evt+EVENT_NAMESPACE,function elementOpen(event){$.powerTip.show(this,event)})}});$.each(options.closeEvents,function(idx,evt){if($.inArray(evt,options.openEvents)<0){targetElements.on(evt+EVENT_NAMESPACE,function elementClose(event){$.powerTip.hide(this,!isMouseEvent(event))})}});targetElements.on("keydown"+EVENT_NAMESPACE,function elementKeyDown(event){if(event.keyCode===27){$.powerTip.hide(this,true)}})}return targetElements};$.fn.powerTip.defaults={fadeInTime:200,fadeOutTime:100,followMouse:false,popupId:"powerTip",popupClass:null,intentSensitivity:7,intentPollInterval:100,closeDelay:100,placement:"n",smartPlacement:false,offset:10,mouseOnToPopup:false,manual:false,openEvents:["mouseenter","focus"],closeEvents:["mouseleave","blur"]};$.fn.powerTip.smartPlacementLists={n:["n","ne","nw","s"],e:["e","ne","se","w","nw","sw","n","s","e"],s:["s","se","sw","n"],w:["w","nw","sw","e","ne","se","n","s","w"],nw:["nw","w","sw","n","s","se","nw"],ne:["ne","e","se","n","s","sw","ne"],sw:["sw","w","nw","s","n","ne","sw"],se:["se","e","ne","s","n","nw","se"],"nw-alt":["nw-alt","n","ne-alt","sw-alt","s","se-alt","w","e"],"ne-alt":["ne-alt","n","nw-alt","se-alt","s","sw-alt","e","w"],"sw-alt":["sw-alt","s","se-alt","nw-alt","n","ne-alt","w","e"],"se-alt":["se-alt","s","sw-alt","ne-alt","n","nw-alt","e","w"]};$.powerTip={show:function apiShowTip(element,event){if(isMouseEvent(event)){trackMouse(event);session.previousX=event.pageX;session.previousY=event.pageY;$(element).data(DATA_DISPLAYCONTROLLER).show()}else{$(element).first().data(DATA_DISPLAYCONTROLLER).show(true,true)}return element},reposition:function apiResetPosition(element){$(element).first().data(DATA_DISPLAYCONTROLLER).resetPosition();return element},hide:function apiCloseTip(element,immediate){var displayController;immediate=element?immediate:true;if(element){displayController=$(element).first().data(DATA_DISPLAYCONTROLLER)}else if(session.activeHover){displayController=session.activeHover.data(DATA_DISPLAYCONTROLLER)}if(displayController){displayController.hide(immediate)}return element},toggle:function apiToggle(element,event){if(session.activeHover&&session.activeHover.is(element)){$.powerTip.hide(element,!isMouseEvent(event))}else{$.powerTip.show(element,event)}return element}};$.powerTip.showTip=$.powerTip.show;$.powerTip.closeTip=$.powerTip.hide;function CSSCoordinates(){var me=this;me.top="auto";me.left="auto";me.right="auto";me.bottom="auto";me.set=function(property,value){if($.isNumeric(value)){me[property]=Math.round(value)}}}function DisplayController(element,options,tipController){var hoverTimer=null,myCloseDelay=null;function openTooltip(immediate,forceOpen){cancelTimer();if(!element.data(DATA_HASACTIVEHOVER)){if(!immediate){session.tipOpenImminent=true;hoverTimer=setTimeout(function intentDelay(){hoverTimer=null;checkForIntent()},options.intentPollInterval)}else{if(forceOpen){element.data(DATA_FORCEDOPEN,true)}closeAnyDelayed();tipController.showTip(element)}}else{cancelClose()}}function closeTooltip(disableDelay){if(myCloseDelay){myCloseDelay=session.closeDelayTimeout=clearTimeout(myCloseDelay);session.delayInProgress=false}cancelTimer();session.tipOpenImminent=false;if(element.data(DATA_HASACTIVEHOVER)){element.data(DATA_FORCEDOPEN,false);if(!disableDelay){session.delayInProgress=true;session.closeDelayTimeout=setTimeout(function closeDelay(){session.closeDelayTimeout=null;tipController.hideTip(element);session.delayInProgress=false;myCloseDelay=null},options.closeDelay);myCloseDelay=session.closeDelayTimeout}else{tipController.hideTip(element)}}}function checkForIntent(){var xDifference=Math.abs(session.previousX-session.currentX),yDifference=Math.abs(session.previousY-session.currentY),totalDifference=xDifference+yDifference;if(totalDifference",{id:options.popupId});if($body.length===0){$body=$("body")}$body.append(tipElement);session.tooltips=session.tooltips?session.tooltips.add(tipElement):tipElement}if(options.followMouse){if(!tipElement.data(DATA_HASMOUSEMOVE)){$document.on("mousemove"+EVENT_NAMESPACE,positionTipOnCursor);$window.on("scroll"+EVENT_NAMESPACE,positionTipOnCursor);tipElement.data(DATA_HASMOUSEMOVE,true)}}function beginShowTip(element){element.data(DATA_HASACTIVEHOVER,true);tipElement.queue(function queueTipInit(next){showTip(element);next()})}function showTip(element){var tipContent;if(!element.data(DATA_HASACTIVEHOVER)){return}if(session.isTipOpen){if(!session.isClosing){hideTip(session.activeHover)}tipElement.delay(100).queue(function queueTipAgain(next){showTip(element);next()});return}element.trigger("powerTipPreRender");tipContent=getTooltipContent(element);if(tipContent){tipElement.empty().append(tipContent)}else{return}element.trigger("powerTipRender");session.activeHover=element;session.isTipOpen=true;tipElement.data(DATA_MOUSEONTOTIP,options.mouseOnToPopup);tipElement.addClass(options.popupClass);if(!options.followMouse||element.data(DATA_FORCEDOPEN)){positionTipOnElement(element);session.isFixedTipOpen=true}else{positionTipOnCursor()}if(!element.data(DATA_FORCEDOPEN)&&!options.followMouse){$document.on("click"+EVENT_NAMESPACE,function documentClick(event){var target=event.target;if(target!==element[0]){if(options.mouseOnToPopup){if(target!==tipElement[0]&&!$.contains(tipElement[0],target)){$.powerTip.hide()}}else{$.powerTip.hide()}}})}if(options.mouseOnToPopup&&!options.manual){tipElement.on("mouseenter"+EVENT_NAMESPACE,function tipMouseEnter(){if(session.activeHover){session.activeHover.data(DATA_DISPLAYCONTROLLER).cancel()}});tipElement.on("mouseleave"+EVENT_NAMESPACE,function tipMouseLeave(){if(session.activeHover){session.activeHover.data(DATA_DISPLAYCONTROLLER).hide()}})}tipElement.fadeIn(options.fadeInTime,function fadeInCallback(){if(!session.desyncTimeout){session.desyncTimeout=setInterval(closeDesyncedTip,500)}element.trigger("powerTipOpen")})}function hideTip(element){session.isClosing=true;session.isTipOpen=false;session.desyncTimeout=clearInterval(session.desyncTimeout);element.data(DATA_HASACTIVEHOVER,false);element.data(DATA_FORCEDOPEN,false);$document.off("click"+EVENT_NAMESPACE);tipElement.off(EVENT_NAMESPACE);tipElement.fadeOut(options.fadeOutTime,function fadeOutCallback(){var coords=new CSSCoordinates;session.activeHover=null;session.isClosing=false;session.isFixedTipOpen=false;tipElement.removeClass();coords.set("top",session.currentY+options.offset);coords.set("left",session.currentX+options.offset);tipElement.css(coords);element.trigger("powerTipClose")})}function positionTipOnCursor(){var tipWidth,tipHeight,coords,collisions,collisionCount;if(!session.isFixedTipOpen&&(session.isTipOpen||session.tipOpenImminent&&tipElement.data(DATA_HASMOUSEMOVE))){tipWidth=tipElement.outerWidth();tipHeight=tipElement.outerHeight();coords=new CSSCoordinates;coords.set("top",session.currentY+options.offset);coords.set("left",session.currentX+options.offset);collisions=getViewportCollisions(coords,tipWidth,tipHeight);if(collisions!==Collision.none){collisionCount=countFlags(collisions);if(collisionCount===1){if(collisions===Collision.right){coords.set("left",session.scrollLeft+session.windowWidth-tipWidth)}else if(collisions===Collision.bottom){coords.set("top",session.scrollTop+session.windowHeight-tipHeight)}}else{coords.set("left",session.currentX-tipWidth-options.offset);coords.set("top",session.currentY-tipHeight-options.offset)}}tipElement.css(coords)}}function positionTipOnElement(element){var priorityList,finalPlacement;if(options.smartPlacement||options.followMouse&&element.data(DATA_FORCEDOPEN)){priorityList=$.fn.powerTip.smartPlacementLists[options.placement];$.each(priorityList,function(idx,pos){var collisions=getViewportCollisions(placeTooltip(element,pos),tipElement.outerWidth(),tipElement.outerHeight());finalPlacement=pos;return collisions!==Collision.none})}else{placeTooltip(element,options.placement);finalPlacement=options.placement}tipElement.removeClass("w nw sw e ne se n s w se-alt sw-alt ne-alt nw-alt");tipElement.addClass(finalPlacement)}function placeTooltip(element,placement){var iterationCount=0,tipWidth,tipHeight,coords=new CSSCoordinates;coords.set("top",0);coords.set("left",0);tipElement.css(coords);do{tipWidth=tipElement.outerWidth();tipHeight=tipElement.outerHeight();coords=placementCalculator.compute(element,placement,tipWidth,tipHeight,options.offset);tipElement.css(coords)}while(++iterationCount<=5&&(tipWidth!==tipElement.outerWidth()||tipHeight!==tipElement.outerHeight()));return coords}function closeDesyncedTip(){var isDesynced=false,hasDesyncableCloseEvent=$.grep(["mouseleave","mouseout","blur","focusout"],function(eventType){return $.inArray(eventType,options.closeEvents)!==-1}).length>0;if(session.isTipOpen&&!session.isClosing&&!session.delayInProgress&&hasDesyncableCloseEvent){if(session.activeHover.data(DATA_HASACTIVEHOVER)===false||session.activeHover.is(":disabled")){isDesynced=true}else if(!isMouseOver(session.activeHover)&&!session.activeHover.is(":focus")&&!session.activeHover.data(DATA_FORCEDOPEN)){if(tipElement.data(DATA_MOUSEONTOTIP)){if(!isMouseOver(tipElement)){isDesynced=true}}else{isDesynced=true}}if(isDesynced){hideTip(session.activeHover)}}}this.showTip=beginShowTip;this.hideTip=hideTip;this.resetPosition=positionTipOnElement}function isSvgElement(element){return Boolean(window.SVGElement&&element[0]instanceof SVGElement)}function isMouseEvent(event){return Boolean(event&&$.inArray(event.type,MOUSE_EVENTS)>-1&&typeof event.pageX==="number")}function initTracking(){if(!session.mouseTrackingActive){session.mouseTrackingActive=true;getViewportDimensions();$(getViewportDimensions);$document.on("mousemove"+EVENT_NAMESPACE,trackMouse);$window.on("resize"+EVENT_NAMESPACE,trackResize);$window.on("scroll"+EVENT_NAMESPACE,trackScroll)}}function getViewportDimensions(){session.scrollLeft=$window.scrollLeft();session.scrollTop=$window.scrollTop();session.windowWidth=$window.width();session.windowHeight=$window.height()}function trackResize(){session.windowWidth=$window.width();session.windowHeight=$window.height()}function trackScroll(){var x=$window.scrollLeft(),y=$window.scrollTop();if(x!==session.scrollLeft){session.currentX+=x-session.scrollLeft;session.scrollLeft=x}if(y!==session.scrollTop){session.currentY+=y-session.scrollTop;session.scrollTop=y}}function trackMouse(event){session.currentX=event.pageX;session.currentY=event.pageY}function isMouseOver(element){var elementPosition=element.offset(),elementBox=element[0].getBoundingClientRect(),elementWidth=elementBox.right-elementBox.left,elementHeight=elementBox.bottom-elementBox.top;return session.currentX>=elementPosition.left&&session.currentX<=elementPosition.left+elementWidth&&session.currentY>=elementPosition.top&&session.currentY<=elementPosition.top+elementHeight}function getTooltipContent(element){var tipText=element.data(DATA_POWERTIP),tipObject=element.data(DATA_POWERTIPJQ),tipTarget=element.data(DATA_POWERTIPTARGET),targetElement,content;if(tipText){if($.isFunction(tipText)){tipText=tipText.call(element[0])}content=tipText}else if(tipObject){if($.isFunction(tipObject)){tipObject=tipObject.call(element[0])}if(tipObject.length>0){content=tipObject.clone(true,true)}}else if(tipTarget){targetElement=$("#"+tipTarget);if(targetElement.length>0){content=targetElement.html()}}return content}function getViewportCollisions(coords,elementWidth,elementHeight){var viewportTop=session.scrollTop,viewportLeft=session.scrollLeft,viewportBottom=viewportTop+session.windowHeight,viewportRight=viewportLeft+session.windowWidth,collisions=Collision.none;if(coords.topviewportBottom||Math.abs(coords.bottom-session.windowHeight)>viewportBottom){collisions|=Collision.bottom}if(coords.leftviewportRight){collisions|=Collision.left}if(coords.left+elementWidth>viewportRight||coords.right1)){a.preventDefault();var c=a.originalEvent.changedTouches[0],d=document.createEvent("MouseEvents");d.initMouseEvent(b,!0,!0,window,1,c.screenX,c.screenY,c.clientX,c.clientY,!1,!1,!1,!1,0,null),a.target.dispatchEvent(d)}}if(a.support.touch="ontouchend"in document,a.support.touch){var e,b=a.ui.mouse.prototype,c=b._mouseInit,d=b._mouseDestroy;b._touchStart=function(a){var b=this;!e&&b._mouseCapture(a.originalEvent.changedTouches[0])&&(e=!0,b._touchMoved=!1,f(a,"mouseover"),f(a,"mousemove"),f(a,"mousedown"))},b._touchMove=function(a){e&&(this._touchMoved=!0,f(a,"mousemove"))},b._touchEnd=function(a){e&&(f(a,"mouseup"),f(a,"mouseout"),this._touchMoved||f(a,"click"),e=!1)},b._mouseInit=function(){var b=this;b.element.bind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),c.call(b)},b._mouseDestroy=function(){var b=this;b.element.unbind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),d.call(b)}}}(jQuery);/*! SmartMenus jQuery Plugin - v1.1.0 - September 17, 2017 + * http://www.smartmenus.org/ + * Copyright Vasil Dinkov, Vadikom Web Ltd. http://vadikom.com; Licensed MIT */(function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&"object"==typeof module.exports?module.exports=t(require("jquery")):t(jQuery)})(function($){function initMouseDetection(t){var e=".smartmenus_mouse";if(mouseDetectionEnabled||t)mouseDetectionEnabled&&t&&($(document).off(e),mouseDetectionEnabled=!1);else{var i=!0,s=null,o={mousemove:function(t){var e={x:t.pageX,y:t.pageY,timeStamp:(new Date).getTime()};if(s){var o=Math.abs(s.x-e.x),a=Math.abs(s.y-e.y);if((o>0||a>0)&&2>=o&&2>=a&&300>=e.timeStamp-s.timeStamp&&(mouse=!0,i)){var n=$(t.target).closest("a");n.is("a")&&$.each(menuTrees,function(){return $.contains(this.$root[0],n[0])?(this.itemEnter({currentTarget:n[0]}),!1):void 0}),i=!1}}s=e}};o[touchEvents?"touchstart":"pointerover pointermove pointerout MSPointerOver MSPointerMove MSPointerOut"]=function(t){isTouchEvent(t.originalEvent)&&(mouse=!1)},$(document).on(getEventsNS(o,e)),mouseDetectionEnabled=!0}}function isTouchEvent(t){return!/^(4|mouse)$/.test(t.pointerType)}function getEventsNS(t,e){e||(e="");var i={};for(var s in t)i[s.split(" ").join(e+" ")+e]=t[s];return i}var menuTrees=[],mouse=!1,touchEvents="ontouchstart"in window,mouseDetectionEnabled=!1,requestAnimationFrame=window.requestAnimationFrame||function(t){return setTimeout(t,1e3/60)},cancelAnimationFrame=window.cancelAnimationFrame||function(t){clearTimeout(t)},canAnimate=!!$.fn.animate;return $.SmartMenus=function(t,e){this.$root=$(t),this.opts=e,this.rootId="",this.accessIdPrefix="",this.$subArrow=null,this.activatedItems=[],this.visibleSubMenus=[],this.showTimeout=0,this.hideTimeout=0,this.scrollTimeout=0,this.clickActivated=!1,this.focusActivated=!1,this.zIndexInc=0,this.idInc=0,this.$firstLink=null,this.$firstSub=null,this.disabled=!1,this.$disableOverlay=null,this.$touchScrollingSub=null,this.cssTransforms3d="perspective"in t.style||"webkitPerspective"in t.style,this.wasCollapsible=!1,this.init()},$.extend($.SmartMenus,{hideAll:function(){$.each(menuTrees,function(){this.menuHideAll()})},destroy:function(){for(;menuTrees.length;)menuTrees[0].destroy();initMouseDetection(!0)},prototype:{init:function(t){var e=this;if(!t){menuTrees.push(this),this.rootId=((new Date).getTime()+Math.random()+"").replace(/\D/g,""),this.accessIdPrefix="sm-"+this.rootId+"-",this.$root.hasClass("sm-rtl")&&(this.opts.rightToLeftSubMenus=!0);var i=".smartmenus";this.$root.data("smartmenus",this).attr("data-smartmenus-id",this.rootId).dataSM("level",1).on(getEventsNS({"mouseover focusin":$.proxy(this.rootOver,this),"mouseout focusout":$.proxy(this.rootOut,this),keydown:$.proxy(this.rootKeyDown,this)},i)).on(getEventsNS({mouseenter:$.proxy(this.itemEnter,this),mouseleave:$.proxy(this.itemLeave,this),mousedown:$.proxy(this.itemDown,this),focus:$.proxy(this.itemFocus,this),blur:$.proxy(this.itemBlur,this),click:$.proxy(this.itemClick,this)},i),"a"),i+=this.rootId,this.opts.hideOnClick&&$(document).on(getEventsNS({touchstart:$.proxy(this.docTouchStart,this),touchmove:$.proxy(this.docTouchMove,this),touchend:$.proxy(this.docTouchEnd,this),click:$.proxy(this.docClick,this)},i)),$(window).on(getEventsNS({"resize orientationchange":$.proxy(this.winResize,this)},i)),this.opts.subIndicators&&(this.$subArrow=$("").addClass("sub-arrow"),this.opts.subIndicatorsText&&this.$subArrow.html(this.opts.subIndicatorsText)),initMouseDetection()}if(this.$firstSub=this.$root.find("ul").each(function(){e.menuInit($(this))}).eq(0),this.$firstLink=this.$root.find("a").eq(0),this.opts.markCurrentItem){var s=/(index|default)\.[^#\?\/]*/i,o=/#.*/,a=window.location.href.replace(s,""),n=a.replace(o,"");this.$root.find("a").each(function(){var t=this.href.replace(s,""),i=$(this);(t==a||t==n)&&(i.addClass("current"),e.opts.markCurrentTree&&i.parentsUntil("[data-smartmenus-id]","ul").each(function(){$(this).dataSM("parent-a").addClass("current")}))})}this.wasCollapsible=this.isCollapsible()},destroy:function(t){if(!t){var e=".smartmenus";this.$root.removeData("smartmenus").removeAttr("data-smartmenus-id").removeDataSM("level").off(e),e+=this.rootId,$(document).off(e),$(window).off(e),this.opts.subIndicators&&(this.$subArrow=null)}this.menuHideAll();var i=this;this.$root.find("ul").each(function(){var t=$(this);t.dataSM("scroll-arrows")&&t.dataSM("scroll-arrows").remove(),t.dataSM("shown-before")&&((i.opts.subMenusMinWidth||i.opts.subMenusMaxWidth)&&t.css({width:"",minWidth:"",maxWidth:""}).removeClass("sm-nowrap"),t.dataSM("scroll-arrows")&&t.dataSM("scroll-arrows").remove(),t.css({zIndex:"",top:"",left:"",marginLeft:"",marginTop:"",display:""})),0==(t.attr("id")||"").indexOf(i.accessIdPrefix)&&t.removeAttr("id")}).removeDataSM("in-mega").removeDataSM("shown-before").removeDataSM("scroll-arrows").removeDataSM("parent-a").removeDataSM("level").removeDataSM("beforefirstshowfired").removeAttr("role").removeAttr("aria-hidden").removeAttr("aria-labelledby").removeAttr("aria-expanded"),this.$root.find("a.has-submenu").each(function(){var t=$(this);0==t.attr("id").indexOf(i.accessIdPrefix)&&t.removeAttr("id")}).removeClass("has-submenu").removeDataSM("sub").removeAttr("aria-haspopup").removeAttr("aria-controls").removeAttr("aria-expanded").closest("li").removeDataSM("sub"),this.opts.subIndicators&&this.$root.find("span.sub-arrow").remove(),this.opts.markCurrentItem&&this.$root.find("a.current").removeClass("current"),t||(this.$root=null,this.$firstLink=null,this.$firstSub=null,this.$disableOverlay&&(this.$disableOverlay.remove(),this.$disableOverlay=null),menuTrees.splice($.inArray(this,menuTrees),1))},disable:function(t){if(!this.disabled){if(this.menuHideAll(),!t&&!this.opts.isPopup&&this.$root.is(":visible")){var e=this.$root.offset();this.$disableOverlay=$('
').css({position:"absolute",top:e.top,left:e.left,width:this.$root.outerWidth(),height:this.$root.outerHeight(),zIndex:this.getStartZIndex(!0),opacity:0}).appendTo(document.body)}this.disabled=!0}},docClick:function(t){return this.$touchScrollingSub?(this.$touchScrollingSub=null,void 0):((this.visibleSubMenus.length&&!$.contains(this.$root[0],t.target)||$(t.target).closest("a").length)&&this.menuHideAll(),void 0)},docTouchEnd:function(){if(this.lastTouch){if(!(!this.visibleSubMenus.length||void 0!==this.lastTouch.x2&&this.lastTouch.x1!=this.lastTouch.x2||void 0!==this.lastTouch.y2&&this.lastTouch.y1!=this.lastTouch.y2||this.lastTouch.target&&$.contains(this.$root[0],this.lastTouch.target))){this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0);var t=this;this.hideTimeout=setTimeout(function(){t.menuHideAll()},350)}this.lastTouch=null}},docTouchMove:function(t){if(this.lastTouch){var e=t.originalEvent.touches[0];this.lastTouch.x2=e.pageX,this.lastTouch.y2=e.pageY}},docTouchStart:function(t){var e=t.originalEvent.touches[0];this.lastTouch={x1:e.pageX,y1:e.pageY,target:e.target}},enable:function(){this.disabled&&(this.$disableOverlay&&(this.$disableOverlay.remove(),this.$disableOverlay=null),this.disabled=!1)},getClosestMenu:function(t){for(var e=$(t).closest("ul");e.dataSM("in-mega");)e=e.parent().closest("ul");return e[0]||null},getHeight:function(t){return this.getOffset(t,!0)},getOffset:function(t,e){var i;"none"==t.css("display")&&(i={position:t[0].style.position,visibility:t[0].style.visibility},t.css({position:"absolute",visibility:"hidden"}).show());var s=t[0].getBoundingClientRect&&t[0].getBoundingClientRect(),o=s&&(e?s.height||s.bottom-s.top:s.width||s.right-s.left);return o||0===o||(o=e?t[0].offsetHeight:t[0].offsetWidth),i&&t.hide().css(i),o},getStartZIndex:function(t){var e=parseInt(this[t?"$root":"$firstSub"].css("z-index"));return!t&&isNaN(e)&&(e=parseInt(this.$root.css("z-index"))),isNaN(e)?1:e},getTouchPoint:function(t){return t.touches&&t.touches[0]||t.changedTouches&&t.changedTouches[0]||t},getViewport:function(t){var e=t?"Height":"Width",i=document.documentElement["client"+e],s=window["inner"+e];return s&&(i=Math.min(i,s)),i},getViewportHeight:function(){return this.getViewport(!0)},getViewportWidth:function(){return this.getViewport()},getWidth:function(t){return this.getOffset(t)},handleEvents:function(){return!this.disabled&&this.isCSSOn()},handleItemEvents:function(t){return this.handleEvents()&&!this.isLinkInMegaMenu(t)},isCollapsible:function(){return"static"==this.$firstSub.css("position")},isCSSOn:function(){return"inline"!=this.$firstLink.css("display")},isFixed:function(){var t="fixed"==this.$root.css("position");return t||this.$root.parentsUntil("body").each(function(){return"fixed"==$(this).css("position")?(t=!0,!1):void 0}),t},isLinkInMegaMenu:function(t){return $(this.getClosestMenu(t[0])).hasClass("mega-menu")},isTouchMode:function(){return!mouse||this.opts.noMouseOver||this.isCollapsible()},itemActivate:function(t,e){var i=t.closest("ul"),s=i.dataSM("level");if(s>1&&(!this.activatedItems[s-2]||this.activatedItems[s-2][0]!=i.dataSM("parent-a")[0])){var o=this;$(i.parentsUntil("[data-smartmenus-id]","ul").get().reverse()).add(i).each(function(){o.itemActivate($(this).dataSM("parent-a"))})}if((!this.isCollapsible()||e)&&this.menuHideSubMenus(this.activatedItems[s-1]&&this.activatedItems[s-1][0]==t[0]?s:s-1),this.activatedItems[s-1]=t,this.$root.triggerHandler("activate.smapi",t[0])!==!1){var a=t.dataSM("sub");a&&(this.isTouchMode()||!this.opts.showOnClick||this.clickActivated)&&this.menuShow(a)}},itemBlur:function(t){var e=$(t.currentTarget);this.handleItemEvents(e)&&this.$root.triggerHandler("blur.smapi",e[0])},itemClick:function(t){var e=$(t.currentTarget);if(this.handleItemEvents(e)){if(this.$touchScrollingSub&&this.$touchScrollingSub[0]==e.closest("ul")[0])return this.$touchScrollingSub=null,t.stopPropagation(),!1;if(this.$root.triggerHandler("click.smapi",e[0])===!1)return!1;var i=$(t.target).is(".sub-arrow"),s=e.dataSM("sub"),o=s?2==s.dataSM("level"):!1,a=this.isCollapsible(),n=/toggle$/.test(this.opts.collapsibleBehavior),r=/link$/.test(this.opts.collapsibleBehavior),h=/^accordion/.test(this.opts.collapsibleBehavior);if(s&&!s.is(":visible")){if((!r||!a||i)&&(this.opts.showOnClick&&o&&(this.clickActivated=!0),this.itemActivate(e,h),s.is(":visible")))return this.focusActivated=!0,!1}else if(a&&(n||i))return this.itemActivate(e,h),this.menuHide(s),n&&(this.focusActivated=!1),!1;return this.opts.showOnClick&&o||e.hasClass("disabled")||this.$root.triggerHandler("select.smapi",e[0])===!1?!1:void 0}},itemDown:function(t){var e=$(t.currentTarget);this.handleItemEvents(e)&&e.dataSM("mousedown",!0)},itemEnter:function(t){var e=$(t.currentTarget);if(this.handleItemEvents(e)){if(!this.isTouchMode()){this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=0);var i=this;this.showTimeout=setTimeout(function(){i.itemActivate(e)},this.opts.showOnClick&&1==e.closest("ul").dataSM("level")?1:this.opts.showTimeout)}this.$root.triggerHandler("mouseenter.smapi",e[0])}},itemFocus:function(t){var e=$(t.currentTarget);this.handleItemEvents(e)&&(!this.focusActivated||this.isTouchMode()&&e.dataSM("mousedown")||this.activatedItems.length&&this.activatedItems[this.activatedItems.length-1][0]==e[0]||this.itemActivate(e,!0),this.$root.triggerHandler("focus.smapi",e[0]))},itemLeave:function(t){var e=$(t.currentTarget);this.handleItemEvents(e)&&(this.isTouchMode()||(e[0].blur(),this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=0)),e.removeDataSM("mousedown"),this.$root.triggerHandler("mouseleave.smapi",e[0]))},menuHide:function(t){if(this.$root.triggerHandler("beforehide.smapi",t[0])!==!1&&(canAnimate&&t.stop(!0,!0),"none"!=t.css("display"))){var e=function(){t.css("z-index","")};this.isCollapsible()?canAnimate&&this.opts.collapsibleHideFunction?this.opts.collapsibleHideFunction.call(this,t,e):t.hide(this.opts.collapsibleHideDuration,e):canAnimate&&this.opts.hideFunction?this.opts.hideFunction.call(this,t,e):t.hide(this.opts.hideDuration,e),t.dataSM("scroll")&&(this.menuScrollStop(t),t.css({"touch-action":"","-ms-touch-action":"","-webkit-transform":"",transform:""}).off(".smartmenus_scroll").removeDataSM("scroll").dataSM("scroll-arrows").hide()),t.dataSM("parent-a").removeClass("highlighted").attr("aria-expanded","false"),t.attr({"aria-expanded":"false","aria-hidden":"true"});var i=t.dataSM("level");this.activatedItems.splice(i-1,1),this.visibleSubMenus.splice($.inArray(t,this.visibleSubMenus),1),this.$root.triggerHandler("hide.smapi",t[0])}},menuHideAll:function(){this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=0);for(var t=this.opts.isPopup?1:0,e=this.visibleSubMenus.length-1;e>=t;e--)this.menuHide(this.visibleSubMenus[e]);this.opts.isPopup&&(canAnimate&&this.$root.stop(!0,!0),this.$root.is(":visible")&&(canAnimate&&this.opts.hideFunction?this.opts.hideFunction.call(this,this.$root):this.$root.hide(this.opts.hideDuration))),this.activatedItems=[],this.visibleSubMenus=[],this.clickActivated=!1,this.focusActivated=!1,this.zIndexInc=0,this.$root.triggerHandler("hideAll.smapi")},menuHideSubMenus:function(t){for(var e=this.activatedItems.length-1;e>=t;e--){var i=this.activatedItems[e].dataSM("sub");i&&this.menuHide(i)}},menuInit:function(t){if(!t.dataSM("in-mega")){t.hasClass("mega-menu")&&t.find("ul").dataSM("in-mega",!0);for(var e=2,i=t[0];(i=i.parentNode.parentNode)!=this.$root[0];)e++;var s=t.prevAll("a").eq(-1);s.length||(s=t.prevAll().find("a").eq(-1)),s.addClass("has-submenu").dataSM("sub",t),t.dataSM("parent-a",s).dataSM("level",e).parent().dataSM("sub",t);var o=s.attr("id")||this.accessIdPrefix+ ++this.idInc,a=t.attr("id")||this.accessIdPrefix+ ++this.idInc;s.attr({id:o,"aria-haspopup":"true","aria-controls":a,"aria-expanded":"false"}),t.attr({id:a,role:"group","aria-hidden":"true","aria-labelledby":o,"aria-expanded":"false"}),this.opts.subIndicators&&s[this.opts.subIndicatorsPos](this.$subArrow.clone())}},menuPosition:function(t){var e,i,s=t.dataSM("parent-a"),o=s.closest("li"),a=o.parent(),n=t.dataSM("level"),r=this.getWidth(t),h=this.getHeight(t),u=s.offset(),l=u.left,c=u.top,d=this.getWidth(s),m=this.getHeight(s),p=$(window),f=p.scrollLeft(),v=p.scrollTop(),b=this.getViewportWidth(),S=this.getViewportHeight(),g=a.parent().is("[data-sm-horizontal-sub]")||2==n&&!a.hasClass("sm-vertical"),M=this.opts.rightToLeftSubMenus&&!o.is("[data-sm-reverse]")||!this.opts.rightToLeftSubMenus&&o.is("[data-sm-reverse]"),w=2==n?this.opts.mainMenuSubOffsetX:this.opts.subMenusSubOffsetX,T=2==n?this.opts.mainMenuSubOffsetY:this.opts.subMenusSubOffsetY;if(g?(e=M?d-r-w:w,i=this.opts.bottomToTopSubMenus?-h-T:m+T):(e=M?w-r:d-w,i=this.opts.bottomToTopSubMenus?m-T-h:T),this.opts.keepInViewport){var y=l+e,I=c+i;if(M&&f>y?e=g?f-y+e:d-w:!M&&y+r>f+b&&(e=g?f+b-r-y+e:w-r),g||(S>h&&I+h>v+S?i+=v+S-h-I:(h>=S||v>I)&&(i+=v-I)),g&&(I+h>v+S+.49||v>I)||!g&&h>S+.49){var x=this;t.dataSM("scroll-arrows")||t.dataSM("scroll-arrows",$([$('')[0],$('')[0]]).on({mouseenter:function(){t.dataSM("scroll").up=$(this).hasClass("scroll-up"),x.menuScroll(t)},mouseleave:function(e){x.menuScrollStop(t),x.menuScrollOut(t,e)},"mousewheel DOMMouseScroll":function(t){t.preventDefault()}}).insertAfter(t));var A=".smartmenus_scroll";if(t.dataSM("scroll",{y:this.cssTransforms3d?0:i-m,step:1,itemH:m,subH:h,arrowDownH:this.getHeight(t.dataSM("scroll-arrows").eq(1))}).on(getEventsNS({mouseover:function(e){x.menuScrollOver(t,e)},mouseout:function(e){x.menuScrollOut(t,e)},"mousewheel DOMMouseScroll":function(e){x.menuScrollMousewheel(t,e)}},A)).dataSM("scroll-arrows").css({top:"auto",left:"0",marginLeft:e+(parseInt(t.css("border-left-width"))||0),width:r-(parseInt(t.css("border-left-width"))||0)-(parseInt(t.css("border-right-width"))||0),zIndex:t.css("z-index")}).eq(g&&this.opts.bottomToTopSubMenus?0:1).show(),this.isFixed()){var C={};C[touchEvents?"touchstart touchmove touchend":"pointerdown pointermove pointerup MSPointerDown MSPointerMove MSPointerUp"]=function(e){x.menuScrollTouch(t,e)},t.css({"touch-action":"none","-ms-touch-action":"none"}).on(getEventsNS(C,A))}}}t.css({top:"auto",left:"0",marginLeft:e,marginTop:i-m})},menuScroll:function(t,e,i){var s,o=t.dataSM("scroll"),a=t.dataSM("scroll-arrows"),n=o.up?o.upEnd:o.downEnd;if(!e&&o.momentum){if(o.momentum*=.92,s=o.momentum,.5>s)return this.menuScrollStop(t),void 0}else s=i||(e||!this.opts.scrollAccelerate?this.opts.scrollStep:Math.floor(o.step));var r=t.dataSM("level");if(this.activatedItems[r-1]&&this.activatedItems[r-1].dataSM("sub")&&this.activatedItems[r-1].dataSM("sub").is(":visible")&&this.menuHideSubMenus(r-1),o.y=o.up&&o.y>=n||!o.up&&n>=o.y?o.y:Math.abs(n-o.y)>s?o.y+(o.up?s:-s):n,t.css(this.cssTransforms3d?{"-webkit-transform":"translate3d(0, "+o.y+"px, 0)",transform:"translate3d(0, "+o.y+"px, 0)"}:{marginTop:o.y}),mouse&&(o.up&&o.y>o.downEnd||!o.up&&o.y0;t.dataSM("scroll-arrows").eq(i?0:1).is(":visible")&&(t.dataSM("scroll").up=i,this.menuScroll(t,!0))}e.preventDefault()},menuScrollOut:function(t,e){mouse&&(/^scroll-(up|down)/.test((e.relatedTarget||"").className)||(t[0]==e.relatedTarget||$.contains(t[0],e.relatedTarget))&&this.getClosestMenu(e.relatedTarget)==t[0]||t.dataSM("scroll-arrows").css("visibility","hidden"))},menuScrollOver:function(t,e){if(mouse&&!/^scroll-(up|down)/.test(e.target.className)&&this.getClosestMenu(e.target)==t[0]){this.menuScrollRefreshData(t);var i=t.dataSM("scroll"),s=$(window).scrollTop()-t.dataSM("parent-a").offset().top-i.itemH;t.dataSM("scroll-arrows").eq(0).css("margin-top",s).end().eq(1).css("margin-top",s+this.getViewportHeight()-i.arrowDownH).end().css("visibility","visible")}},menuScrollRefreshData:function(t){var e=t.dataSM("scroll"),i=$(window).scrollTop()-t.dataSM("parent-a").offset().top-e.itemH;this.cssTransforms3d&&(i=-(parseFloat(t.css("margin-top"))-i)),$.extend(e,{upEnd:i,downEnd:i+this.getViewportHeight()-e.subH})},menuScrollStop:function(t){return this.scrollTimeout?(cancelAnimationFrame(this.scrollTimeout),this.scrollTimeout=0,t.dataSM("scroll").step=1,!0):void 0},menuScrollTouch:function(t,e){if(e=e.originalEvent,isTouchEvent(e)){var i=this.getTouchPoint(e);if(this.getClosestMenu(i.target)==t[0]){var s=t.dataSM("scroll");if(/(start|down)$/i.test(e.type))this.menuScrollStop(t)?(e.preventDefault(),this.$touchScrollingSub=t):this.$touchScrollingSub=null,this.menuScrollRefreshData(t),$.extend(s,{touchStartY:i.pageY,touchStartTime:e.timeStamp});else if(/move$/i.test(e.type)){var o=void 0!==s.touchY?s.touchY:s.touchStartY;if(void 0!==o&&o!=i.pageY){this.$touchScrollingSub=t;var a=i.pageY>o;void 0!==s.up&&s.up!=a&&$.extend(s,{touchStartY:i.pageY,touchStartTime:e.timeStamp}),$.extend(s,{up:a,touchY:i.pageY}),this.menuScroll(t,!0,Math.abs(i.pageY-o))}e.preventDefault()}else void 0!==s.touchY&&((s.momentum=15*Math.pow(Math.abs(i.pageY-s.touchStartY)/(e.timeStamp-s.touchStartTime),2))&&(this.menuScrollStop(t),this.menuScroll(t),e.preventDefault()),delete s.touchY)}}},menuShow:function(t){if((t.dataSM("beforefirstshowfired")||(t.dataSM("beforefirstshowfired",!0),this.$root.triggerHandler("beforefirstshow.smapi",t[0])!==!1))&&this.$root.triggerHandler("beforeshow.smapi",t[0])!==!1&&(t.dataSM("shown-before",!0),canAnimate&&t.stop(!0,!0),!t.is(":visible"))){var e=t.dataSM("parent-a"),i=this.isCollapsible();if((this.opts.keepHighlighted||i)&&e.addClass("highlighted"),i)t.removeClass("sm-nowrap").css({zIndex:"",width:"auto",minWidth:"",maxWidth:"",top:"",left:"",marginLeft:"",marginTop:""});else{if(t.css("z-index",this.zIndexInc=(this.zIndexInc||this.getStartZIndex())+1),(this.opts.subMenusMinWidth||this.opts.subMenusMaxWidth)&&(t.css({width:"auto",minWidth:"",maxWidth:""}).addClass("sm-nowrap"),this.opts.subMenusMinWidth&&t.css("min-width",this.opts.subMenusMinWidth),this.opts.subMenusMaxWidth)){var s=this.getWidth(t);t.css("max-width",this.opts.subMenusMaxWidth),s>this.getWidth(t)&&t.removeClass("sm-nowrap").css("width",this.opts.subMenusMaxWidth)}this.menuPosition(t)}var o=function(){t.css("overflow","")};i?canAnimate&&this.opts.collapsibleShowFunction?this.opts.collapsibleShowFunction.call(this,t,o):t.show(this.opts.collapsibleShowDuration,o):canAnimate&&this.opts.showFunction?this.opts.showFunction.call(this,t,o):t.show(this.opts.showDuration,o),e.attr("aria-expanded","true"),t.attr({"aria-expanded":"true","aria-hidden":"false"}),this.visibleSubMenus.push(t),this.$root.triggerHandler("show.smapi",t[0])}},popupHide:function(t){this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0);var e=this;this.hideTimeout=setTimeout(function(){e.menuHideAll()},t?1:this.opts.hideTimeout)},popupShow:function(t,e){if(!this.opts.isPopup)return alert('SmartMenus jQuery Error:\n\nIf you want to show this menu via the "popupShow" method, set the isPopup:true option.'),void 0;if(this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0),this.$root.dataSM("shown-before",!0),canAnimate&&this.$root.stop(!0,!0),!this.$root.is(":visible")){this.$root.css({left:t,top:e});var i=this,s=function(){i.$root.css("overflow","")};canAnimate&&this.opts.showFunction?this.opts.showFunction.call(this,this.$root,s):this.$root.show(this.opts.showDuration,s),this.visibleSubMenus[0]=this.$root}},refresh:function(){this.destroy(!0),this.init(!0)},rootKeyDown:function(t){if(this.handleEvents())switch(t.keyCode){case 27:var e=this.activatedItems[0];if(e){this.menuHideAll(),e[0].focus();var i=e.dataSM("sub");i&&this.menuHide(i)}break;case 32:var s=$(t.target);if(s.is("a")&&this.handleItemEvents(s)){var i=s.dataSM("sub");i&&!i.is(":visible")&&(this.itemClick({currentTarget:t.target}),t.preventDefault())}}},rootOut:function(t){if(this.handleEvents()&&!this.isTouchMode()&&t.target!=this.$root[0]&&(this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0),!this.opts.showOnClick||!this.opts.hideOnClick)){var e=this;this.hideTimeout=setTimeout(function(){e.menuHideAll()},this.opts.hideTimeout)}},rootOver:function(t){this.handleEvents()&&!this.isTouchMode()&&t.target!=this.$root[0]&&this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0)},winResize:function(t){if(this.handleEvents()){if(!("onorientationchange"in window)||"orientationchange"==t.type){var e=this.isCollapsible();this.wasCollapsible&&e||(this.activatedItems.length&&this.activatedItems[this.activatedItems.length-1][0].blur(),this.menuHideAll()),this.wasCollapsible=e}}else if(this.$disableOverlay){var i=this.$root.offset();this.$disableOverlay.css({top:i.top,left:i.left,width:this.$root.outerWidth(),height:this.$root.outerHeight()})}}}}),$.fn.dataSM=function(t,e){return e?this.data(t+"_smartmenus",e):this.data(t+"_smartmenus")},$.fn.removeDataSM=function(t){return this.removeData(t+"_smartmenus")},$.fn.smartmenus=function(options){if("string"==typeof options){var args=arguments,method=options;return Array.prototype.shift.call(args),this.each(function(){var t=$(this).data("smartmenus");t&&t[method]&&t[method].apply(t,args)})}return this.each(function(){var dataOpts=$(this).data("sm-options")||null;if(dataOpts)try{dataOpts=eval("("+dataOpts+")")}catch(e){dataOpts=null,alert('ERROR\n\nSmartMenus jQuery init:\nInvalid "data-sm-options" attribute value syntax.')}new $.SmartMenus(this,$.extend({},$.fn.smartmenus.defaults,options,dataOpts))})},$.fn.smartmenus.defaults={isPopup:!1,mainMenuSubOffsetX:0,mainMenuSubOffsetY:0,subMenusSubOffsetX:0,subMenusSubOffsetY:0,subMenusMinWidth:"10em",subMenusMaxWidth:"20em",subIndicators:!0,subIndicatorsPos:"append",subIndicatorsText:"",scrollStep:30,scrollAccelerate:!0,showTimeout:250,hideTimeout:500,showDuration:0,showFunction:null,hideDuration:0,hideFunction:function(t,e){t.fadeOut(200,e)},collapsibleShowDuration:0,collapsibleShowFunction:function(t,e){t.slideDown(200,e)},collapsibleHideDuration:0,collapsibleHideFunction:function(t,e){t.slideUp(200,e)},showOnClick:!1,hideOnClick:!0,noMouseOver:!1,keepInViewport:!0,keepHighlighted:!0,markCurrentItem:!1,markCurrentTree:!0,rightToLeftSubMenus:!1,bottomToTopSubMenus:!1,collapsibleBehavior:"default"},$}); \ No newline at end of file diff --git a/v0.4.9/json_8py.html b/v0.4.9/json_8py.html new file mode 100644 index 0000000..97e7886 --- /dev/null +++ b/v0.4.9/json_8py.html @@ -0,0 +1,182 @@ + + + + + + + + +Formatron: src/formatron/formats/json.py File Reference + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
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|collections.abc.Sequence 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
 
+
+
+ + + + diff --git a/v0.4.9/json_8py.js b/v0.4.9/json_8py.js new file mode 100644 index 0000000..4260416 --- /dev/null +++ b/v0.4.9/json_8py.js @@ -0,0 +1,10 @@ +var json_8py = +[ + [ "formatron.formats.json.JsonExtractor", "classformatron_1_1formats_1_1json_1_1JsonExtractor.html", "classformatron_1_1formats_1_1json_1_1JsonExtractor" ], + [ "_generate_kbnf_grammar", "json_8py.html#af4331f1a7679439503d898b2356d289e", null ], + [ "_register_all_predefined_types", "json_8py.html#a311b750cba3838aee622b9809888f051", null ], + [ "register_generate_nonterminal_def", "json_8py.html#a55ae1cd2ef251d160e872a0c49e7ba7a", null ], + [ "_type_to_nonterminals", "json_8py.html#a003a1dac95634ac70f86d51e768945a4", null ], + [ "GRAMMAR_HEADER", "json_8py.html#ac81c86f8a6384cf3b11c47ddf2049ca7", null ], + [ "SPACE_NONTERMINAL", "json_8py.html#af32c4b136b54f0356b017d6a319bb53d", null ] +]; \ No newline at end of file diff --git a/v0.4.9/json_8py_source.html b/v0.4.9/json_8py_source.html new file mode 100644 index 0000000..ccdd8dd --- /dev/null +++ b/v0.4.9/json_8py_source.html @@ -0,0 +1,693 @@ + + + + + + + + +Formatron: src/formatron/formats/json.py Source File + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
json.py
+
+
+Go to the documentation of this file.
1"""
+
2The module defines the `JsonExtractor` class, which is used to extract data from a string in JSON format.
+
3"""
+
4import collections
+
5import decimal
+
6import types
+
7import typing
+
8
+
9from frozendict import frozendict
+
10
+
11from formatron import extractor, schemas
+
12
+
13__all__ = ["JsonExtractor"]
+
14
+
15SPACE_NONTERMINAL = "[ \t\n\r]*"
+ +
17GRAMMAR_HEADER = rf"""integer ::= #"-?(0|[1-9][0-9]*)";
+
18number ::= #"-?(0|[1-9][0-9]*)(\\.[0-9]+)?([eE][+-]?[0-9]+)?";
+
19string ::= #'"([^\\\\"\u0000-\u001f]|\\\\["\\\\bfnrt/]|\\\\u[0-9A-Fa-f]{{4}})*"';
+
20boolean ::= "true"|"false";
+
21null ::= "null";
+
22array ::= array_begin (json_value (comma json_value)*)? array_end;
+
23object ::= object_begin (string colon json_value (comma string colon json_value)*)? object_end;
+
24json_value ::= number|string|boolean|null|array|object;
+
25comma ::= #"{SPACE_NONTERMINAL},{SPACE_NONTERMINAL}";
+
26colon ::= #"{SPACE_NONTERMINAL}:{SPACE_NONTERMINAL}";
+
27object_begin ::= #"\\{{{SPACE_NONTERMINAL}";
+
28object_end ::= #"{SPACE_NONTERMINAL}\\}}";
+
29array_begin ::= #"\\[{SPACE_NONTERMINAL}";
+
30array_end ::= #"{SPACE_NONTERMINAL}\\]";
+
31"""
+
32_type_to_nonterminals = []
+
33
+
34
+ +
36 generate_nonterminal_def: typing.Callable[
+
37 [typing.Type, str],
+
38 typing.Optional[typing.Tuple[str,
+
39 typing.List[typing.Tuple[typing.Type, str]]]]]) -> None:
+
40 """
+
41 Register a callable to generate nonterminal definition from a type.
+
42 The callable returns (nonterminal_definition, [(sub_type, sub_nonterminal), ...])
+
43 if the type is supported by this callable, otherwise None.
+
44 [(sub_type, sub_nonterminal), ...] are the types and nonterminals used in nonterminal_definition that may need
+
45 to be generated in the grammar too.
+
46
+
47 Args:
+
48 generate_nonterminal_def: A callable to generate nonterminal definition from a type.
+
+
49 """
+
50 _type_to_nonterminals.append(generate_nonterminal_def)
+
51
+
52
+ +
54 def schema(current: typing.Type, nonterminal: str):
+
55 if isinstance(current, type) and not isinstance(current, types.GenericAlias) \
+
56 and issubclass(current, schemas.schema.Schema):
+
+
+
57 line = [f"{nonterminal} ::= ", "object_begin "]
+
58 result = []
+
59 fields = []
+
60 for field, _field_info in current.fields().items():
+
61 field_name = f"{nonterminal}_{field}"
+
62 fields.append(f"'\"{field}\"' colon {field_name}")
+
63 result.append((_field_info, field_name))
+
64 line.append(" comma ".join(fields))
+
65 line.append(" object_end;\n")
+
66 return "".join(line), result
+
67 return None
+
68
+
69 def field_info(current: typing.Type, nonterminal: str):
+
70 if isinstance(current, schemas.schema.FieldInfo):
+
71 annotation = current.annotation
+
72 if current.required:
+
73 return "", [(annotation, nonterminal)]
+
74 new_nonterminal = f"{nonterminal}_required"
+
75 return f"{nonterminal} ::= {new_nonterminal}?;\n", [(annotation, new_nonterminal)]
+
76 return None
+
77
+
78 def string_metadata(current: typing.Type, nonterminal: str):
+
79 min_length = current.metadata.get("min_length")
+
80 max_length = current.metadata.get("max_length")
+
81 pattern = current.metadata.get("pattern")
+
82 substring_of = current.metadata.get("substring_of")
+
83 if pattern:
+
84 assert not (min_length or max_length or substring_of), "pattern is mutually exclusive with min_length, max_length and substring_of"
+
85 if substring_of:
+
86 assert not (min_length or max_length or pattern), "substring_of is mutually exclusive with min_length, max_length and pattern"
+
87 repetition_map = {
+
88 (True, False): f"{{{min_length},}}",
+
89 (False, True): f"{{0,{max_length}}}",
+
90 (True, True): f"{{{min_length},{max_length}}}"
+
91 }
+
92 repetition = repetition_map.get((min_length is not None, max_length is not None))
+
93 if repetition is not None:
+
94 return fr"""{nonterminal} ::= #'"([^\\\\"\u0000-\u001f]|\\\\["\\\\bfnrt/]|\\\\u[0-9A-Fa-f]{{4}}){repetition}"';
+
95""", []
+
96 if pattern is not None:
+
97 pattern = pattern.replace("'", "\\'")
+
98 return f"""{nonterminal} ::= #'"{pattern}"';\n""", []
+
99 if substring_of is not None:
+
100 return f"""{nonterminal} ::= '"' #substrs{repr(substring_of)} '"';\n""", []
+
101
+
102 def number_metadata(current: typing.Type, nonterminal: str):
+
103 gt = current.metadata.get("gt")
+
104 ge = current.metadata.get("ge")
+
105 lt = current.metadata.get("lt")
+
106 le = current.metadata.get("le")
+
107
+
108 prefix_map = {
+
109 (gt, 0): "",
+
110 (ge, 0): "0|",
+
111 (lt, 0): "-",
+
112 (le, 0): "0|-",
+
113 }
+
114
+
115 for (condition, value), prefix in prefix_map.items():
+
116 if condition is not None and condition == value:
+
117 if issubclass(current.type, int):
+
118 return f"""{nonterminal} ::= #'{prefix}[1-9][0-9]*';\n""", []
+
119 elif issubclass(current.type, float):
+
120 return f"""{nonterminal} ::= #'{prefix}[1-9][0-9]*(\\.[0-9]+)?([eE][+-]?[0-9]+)?';\n""", []
+
121
+
122 raise ValueError(f"{current.type.__name__} metadata {current.metadata} is not supported in json_generators!")
+
123
+
124 def sequence_metadata(current: typing.Type, nonterminal: str):
+
125 min_items = current.metadata.get("min_length")
+
126 max_items = current.metadata.get("max_length")
+
127 prefix_items = current.metadata.get("prefix_items")
+
128 additional_items = current.metadata.get("additional_items")
+
129 if max_items is not None and prefix_items is not None and max_items <= len(prefix_items): # truncate prefix items
+
130 prefix_items = prefix_items[:max_items+1]
+
131 if prefix_items:
+
132 if not min_items: # json schema defaults to 0
+
133 min_items = 0
+
134 if not additional_items:
+
135 if min_items > len(prefix_items):
+
136 raise ValueError(f"min_items {min_items} is greater than the number of prefix_items {len(prefix_items)} and additional_items is not allowed")
+
137 max_items = len(prefix_items)
+
138 if min_items is not None or max_items is not None: # prefix items will set min
+
139 new_nonterminal = f"{nonterminal}_item"
+
140 ebnf_rules = []
+
141 if min_items is None:
+
142 min_items = 0
+
143 if min_items == 0 and max_items is None and prefix_items is None: # no special handling needed
+
144 return "", [(current.type, new_nonterminal)]
+
145 prefix_items_nonterminals = [f"{new_nonterminal}_{i}" for i in range(len(prefix_items))] if prefix_items else []
+
146 prefix_items_parts = [] # contains the sequence of nonterminals for prefix items from min_items to len(prefix_items)
+
147 if prefix_items is not None:
+
148 for i in range(max(min_items,1), len(prefix_items)+1):
+
149 prefix_items_parts.append(prefix_items_nonterminals[:i])
+
150 if min_items == 0: # EMPTY_PREFIX_ITEMS_ALLOWED
+
151 ebnf_rules.append(f"{nonterminal} ::= array_begin array_end;")
+
152 if max_items is None: # unbounded
+
153 if not prefix_items:
+
154 min_items_part = ' comma '.join([new_nonterminal] * (min_items - 1))
+
155 ebnf_rules.append(f"{nonterminal} ::= array_begin {min_items_part} comma {new_nonterminal}+ array_end;")
+
156 elif len(prefix_items_parts) >= min_items: # this part assumes prefix items are not empty, so we need the EMPTY_PREFIX_ITEMS_ALLOWED check above
+
157 for prefix_items_part in prefix_items_parts:
+
158 prefix_items_part = ' comma '.join(prefix_items_part)
+
159 ebnf_rules.append(f"{nonterminal} ::= array_begin {prefix_items_part} (comma {new_nonterminal})* array_end;")
+
160 else:
+
161 min_items_part = ' comma '.join([new_nonterminal] * (min_items - len(prefix_items_nonterminals)-1))
+
162 if min_items_part:
+
163 min_items_part = "comma " + min_items_part
+
164 prefix_items_part = ' comma '.join(prefix_items_nonterminals)
+
165 ebnf_rules.append(f"{nonterminal} ::= array_begin {prefix_items_part} {min_items_part} comma {new_nonterminal}+ array_end;")
+
166 elif min_items == 0 and not prefix_items: # TAG: ONLY_MAX_ITEMS
+
167 for i in range(min_items, max_items + 1):
+
168 items = ' comma '.join([new_nonterminal] * i)
+
169 ebnf_rules.append(f"{nonterminal} ::= array_begin {items} array_end;")
+
170 else:
+
171 prefix_items_num = len(prefix_items_nonterminals)
+
172 if prefix_items:
+
173 for prefix_items_part in prefix_items_parts:
+
174 prefix_items_part = ' comma '.join(prefix_items_part)
+
175 ebnf_rules.append(f"{nonterminal} ::= array_begin {prefix_items_part} array_end;")
+
176 min_items_part = ' comma '.join([new_nonterminal] * (min_items - prefix_items_num))
+
177 prefix_items_part = ' comma '.join(prefix_items_nonterminals)
+
178 if min_items_part and prefix_items_part:
+
179 ebnf_rules.append(f"{nonterminal}_min ::= {prefix_items_part} comma {min_items_part};")
+
180 elif min_items_part:
+
181 ebnf_rules.append(f"{nonterminal}_min ::= {min_items_part};")
+
182 elif prefix_items_part:
+
183 ebnf_rules.append(f"{nonterminal}_min ::= {prefix_items_part};")
+
184 # sanity check: if prefix_items_part and min_items_part are both empty, we will in ONLY_MAX_ITEMS branch above
+
185 common = max(min_items, prefix_items_num)
+
186 for i in range(1, max_items + 1 - common):
+
187 items = ' comma '.join([new_nonterminal] * i)
+
188 ebnf_rules.append(f"{nonterminal} ::= array_begin {nonterminal}_min comma {items} array_end;")
+
189 # Handle the item type
+
190 args = typing.get_args(current.type)
+
191 if args:
+
192 item_type = args[0]
+
193 else:
+
194 # If args is empty, default to Any
+
195 item_type = typing.Any
+
196 if prefix_items:
+
197 return "\n".join(ebnf_rules) + "\n", list(zip(prefix_items, prefix_items_nonterminals)) + [(item_type, new_nonterminal)]
+
198 return "\n".join(ebnf_rules) + "\n", [(item_type, new_nonterminal)]
+
199 return None
+
200
+
201 def is_sequence_like(current: typing.Type) -> bool:
+
202 """
+
203 Check if the given type is sequence-like.
+
204
+
205 This function returns True for:
+
206 - typing.Sequence
+
207 - typing.List
+
208 - typing.Tuple
+
209 - Any subclass of collections.abc.Sequence
+
210 - list
+
211 - tuple
+
212
+
213 Args:
+
214 current: The type to check.
+
215
+
216 Returns:
+
217 bool: True if the type is sequence-like, False otherwise.
+
218 """
+
219 original = typing.get_origin(current)
+
220 if original is None:
+
221 original = current
+
222 return (
+
223 original is typing.Sequence or
+
224 original is typing.List or
+
225 original is typing.Tuple or
+
226 (isinstance(original, type) and (issubclass(original, collections.abc.Sequence) or
+
227 issubclass(original, list) or
+
228 issubclass(original, tuple)))
+
229 )
+
230
+
231 def metadata(current: typing.Type, nonterminal: str):
+
232 if isinstance(current, schemas.schema.TypeWithMetadata):
+
233 original = typing.get_origin(current.type)
+
234 if original is None:
+
235 original = current.type
+
236 if not current.metadata:
+
237 return "", [(current.type, nonterminal)]
+
238 if isinstance(current.type, type) and issubclass(current.type, str):
+
239 return string_metadata(current, nonterminal)
+
240 elif isinstance(current.type, type) and issubclass(current.type, (int, float)):
+
241 return number_metadata(current, nonterminal)
+
242 elif is_sequence_like(original):
+
243 return sequence_metadata(current, nonterminal)
+
244 return None
+
245
+
246 def builtin_sequence(current: typing.Type, nonterminal: str):
+
247 original = typing.get_origin(current)
+
248 if original is None:
+
249 original = current
+
250 if is_sequence_like(original):
+
251 new_nonterminal = f"{nonterminal}_value"
+
252 annotation = typing.get_args(current)
+
253 if not annotation:
+
254 annotation = typing.Any
+
255 else:
+
256 annotation = annotation[0]
+
257 return f"{nonterminal} ::= array_begin ({new_nonterminal} (comma {new_nonterminal})*)? array_end;\n", \
+
258 [(annotation, new_nonterminal)]
+
259 return None
+
260
+
261 def builtin_dict(current: typing.Type, nonterminal: str):
+
262 original = typing.get_origin(current)
+
263 if original is None:
+
264 original = current
+
265 if original is typing.Mapping or isinstance(original, type) and issubclass(original,
+
266 collections.abc.Mapping):
+
267 new_nonterminal = f"{nonterminal}_value"
+
268 args = typing.get_args(current)
+
269 if not args:
+
270 value = typing.Any
+
271 else:
+
272 assert issubclass(
+
273 args[0], str), f"{args[0]} is not string!"
+
274 value = args[1]
+
275 return f"{nonterminal} ::=" \
+
276 f" object_begin (string colon {new_nonterminal} (comma string colon {new_nonterminal})*)?" \
+
277 f" object_end;\n", \
+
278 [(value, new_nonterminal)]
+
279 return None
+
280
+
281 def builtin_tuple(current: typing.Type, nonterminal: str):
+
282 if typing.get_origin(current) is tuple or isinstance(current, type) and issubclass(current, tuple):
+
283 args = typing.get_args(current)
+
284 new_nonterminals = []
+
285 result = []
+
286 for i, arg in enumerate(args):
+
287 result.append(arg)
+
288 new_nonterminals.append(f"{nonterminal}_{i}")
+
289 return f"{nonterminal} ::=array_begin {' comma '.join(new_nonterminals)} array_end;\n", \
+
290 zip(result, new_nonterminals)
+
291
+
292 def builtin_union(current: typing.Type, nonterminal: str):
+
293 if typing.get_origin(current) is typing.Union:
+
294 args = typing.get_args(current)
+
295 assert args, f"{current} from {nonterminal} cannot be an empty union!"
+
296 new_nonterminals = []
+
297 result = []
+
298 for i, arg in enumerate(args):
+
299 result.append(arg)
+
300 new_nonterminals.append(f"{nonterminal}_{i}")
+
301 return f"{nonterminal} ::= {' | '.join(new_nonterminals)};\n", zip(result, new_nonterminals)
+
302
+
303 def builtin_literal(current: typing.Type, nonterminal: str):
+
304 if typing.get_origin(current) is typing.Literal:
+
305 args = typing.get_args(current)
+
306 assert args, f"{current} from {nonterminal} cannot be an empty literal!"
+
307 new_items = []
+
308 result = []
+
309 for i, arg in enumerate(args):
+
310 if isinstance(arg, str):
+
311 new_items.append(f'"\\"{repr(arg)[1:-1]}\\""')
+
312 elif isinstance(arg, bool):
+
313 new_items.append(f'"{str(arg).lower()}"')
+
314 elif isinstance(arg, int):
+
315 new_items.append(f'"{str(arg)}"')
+
316 elif isinstance(arg, float):
+
317 new_items.append(f'"{str(arg)}"')
+
318 elif arg is None:
+
319 new_items.append("null")
+
320 elif isinstance(arg, tuple):
+
321 for j,item in enumerate(arg):
+
322 new_nonterminal = f"{nonterminal}_{i}_{j}"
+
323 result.append((typing.Literal[item], new_nonterminal))
+
324 new_item = f"(array_begin {' comma '.join(map(lambda x:x[1], result))} array_end)"
+
325 new_items.append(new_item)
+
326 elif isinstance(arg, frozendict):
+
327 for key, value in arg.items():
+
328 new_nonterminal = f"{nonterminal}_{i}_{key}"
+
329 result.append((typing.Literal[value], new_nonterminal))
+
330 new_item = f"object_begin {' comma '.join(map(lambda x:x[1], result))} object_end"
+
331 new_items.append(new_item)
+
332 else:
+
333 new_nonterminal = f"{nonterminal}_{i}"
+
334 result.append((arg, new_nonterminal))
+
335 new_items.append(new_nonterminal)
+
336 return f"{nonterminal} ::= {' | '.join(new_items)};\n", result
+
337
+
338 def builtin_simple_types(current: typing.Type, nonterminal: str):
+
339 if isinstance(current, type) and issubclass(current, bool):
+
340 return f"{nonterminal} ::= boolean;\n", []
+
341 elif isinstance(current, type) and issubclass(current, int):
+
342 return f"{nonterminal} ::= integer;\n", []
+
343 elif isinstance(current, type) and issubclass(current, float):
+
344 return f"{nonterminal} ::= number;\n", []
+
345 elif isinstance(current, type) and issubclass(current, decimal.Decimal):
+
346 return f"{nonterminal} ::= number;\n", []
+
347 elif isinstance(current, type) and issubclass(current, str):
+
348 return f"{nonterminal} ::= string;\n", []
+
349 elif isinstance(current, type) and issubclass(current, type(None)):
+
350 return f"{nonterminal} ::= null;\n", []
+
351 elif current is typing.Any:
+
352 return f"{nonterminal} ::= json_value;\n", []
+
353 elif isinstance(current, typing.NewType):
+
354 current: typing.NewType
+
355 return "", [(current.__supertype__, nonterminal)]
+
356
+
357 register_generate_nonterminal_def(builtin_simple_types)
+ + + + +
362 register_generate_nonterminal_def(builtin_literal)
+ +
364 register_generate_nonterminal_def(builtin_sequence)
+ +
366
+
367def _generate_kbnf_grammar(schema: schemas.schema.Schema|collections.abc.Sequence, start_nonterminal: str) -> str:
+
368 """
+
369 Generate a KBNF grammar string from a schema for JSON format.
+
370
+
371 Args:
+
372 schema: The schema to generate a grammar for.
+
373 start_nonterminal: The start nonterminal of the grammar. Default is "start".
+
374
+
+
375 Returns:
+
376 The generated KBNF grammar string.
+
377 """
+
378 type_id_to_nonterminal = {
+
379 id(int): "integer",
+
380 id(float): "number",
+
381 id(str): "string",
+
382 id(bool): "boolean",
+
383 id(type(None)): "null",
+
384 id(list): "array",
+
385 id(dict): "object",
+
386 id(typing.Any): "json_value",
+
+ +
388 result = [GRAMMAR_HEADER]
+
389 nonterminals = set()
+
390 stack = [(schema, start_nonterminal)]
+
391 while stack:
+
392 (current, nonterminal) = stack.pop()
+
393 type_id = id(current)
+
394 if type_id in type_id_to_nonterminal:
+
395 line = f"{nonterminal} ::= {type_id_to_nonterminal[type_id]};\n"
+
396 result.append(line)
+
397 continue
+
398 type_id_to_nonterminal[type_id] = nonterminal
+
399 for i in _type_to_nonterminals:
+
400 value = i(current, nonterminal)
+
401 if value is not None:
+
402 line, to_stack = value
+
403 result.append(line)
+
404 stack.extend(to_stack)
+
405 nonterminals.add(nonterminal)
+
406 break
+
407 else:
+
408 raise TypeError(
+
409 f"{current} from {nonterminal} is not supported in json_generators!")
+
410 return "".join(result)
+
411
+
412
+ +
414 """
+
415 An extractor that loads json data to an object from a string.
+
416 """
+
417
+
418 def __init__(self, nonterminal: str, capture_name: typing.Optional[str], schema: schemas.schema.Schema|collections.abc.Sequence,
+
419 to_object: typing.Callable[[str], schemas.schema.Schema]):
+
420 """
+
421 Create a json extractor from a given schema or a list of supported types.
+
422
+
+
423 Currently, the following data types are supported:
+
424
+
425 - bool
+
+
426 - int
+
427 - positive int
+
428 - negative int
+
429 - nonnegative int
+
430 - nonpositive int
+
431 - float
+
432 - positive float
+
433 - negative float
+
434 - nonnegative float
+
435 - nonpositive float
+
436 - str
+
437 - optionally with min_length, max_length and pattern constraints
+
438 - length is measured in UTF-8 character number after json parsing
+
439 - *Warning*: too large difference between min_length and max_length can lead to enormous memory consumption!
+
440 - pattern is mutually exclusive with min_length and max_length
+
441 - pattern will be compiled to a regular expression so all caveats of regular expressions apply
+
442 - pattern currently is automatically anchored at both ends
+
443 - the generated json could be invalid if the pattern allows invalid content between the json string's quotes.
+
444 - for example, `pattern=".*"` will allow '\"' to appear in the json string which is forbidden by JSON standard.
+
445 - also supports substring_of constraint which constrains the string to be a substring of a given string
+
446 - the generated json could be invalid if the given string contains invalid content when put into the json string's quotes.
+
447 - for example, `substring_of="abc\""` will allow '\"' to appear in the json string which is forbidden by JSON standard.
+
448 - NoneType
+
449 - typing.Any
+
450 - Subclasses of collections.abc.Mapping[str,T] and typing.Mapping[str,T] where T is a supported type,
+
451 - Subclasses of collections.abc.Sequence[T] and typing.Sequence[T] where T is a supported type.
+
452 - optionally with `minItems`, `maxItems`, `prefixItems` constraints
+
453 - *Warning*: too large difference between minItems and maxItems can lead to very slow performance!
+
454 - *Warning*: By json schema definition, prefixItems by default allows additional items and missing items in the prefixItems, which may not be the desired behavior and can lead to very slow performance if prefixItems is long!
+
455 - tuple[T1,T2,...] where T1,T2,... are supported types. The order, type and number of elements will be preserved.
+
456 - typing.Literal[x1,x2,...] where x1, x2, ... are instances of int, string, bool or NoneType, or another typing.Literal[y1,y2,...]
+
457 - typing.Union[T1,T2,...] where T1,T2,... are supported types.
+
458 - schemas.Schema where all its fields' data types are supported. Recursive schema definitions are supported as well.
+
459 - *Warning*: while not required field is supported, they can lead to very slow performance and/or enormous memory consumption if there are too many of them!
+
460
+
461 Args:
+
462 nonterminal: The nonterminal representing the extractor.
+
463 capture_name: The capture name of the extractor, or `None` if the extractor does not capture.
+
464 schema: The schema.
+
465 to_object: A callable to convert the extracted string to a schema instance.
+
466 """
+
467 super().__init__(nonterminal, capture_name)
+
468 self._to_object = to_object
+
469 self._rule_str = _generate_kbnf_grammar(schema, self.nonterminal)
+
470 def extract(self, input_str: str) -> typing.Optional[tuple[str, schemas.schema.Schema]]:
+
471 """
+
472 Extract a schema instance from a string.
+
473
+
474 Args:
+
475 input_str: The input string to extract from.
+
476
+
477 Returns:
+
478 A tuple of the remaining string and the extracted schema instance, or `None` if extraction failed.
+
479 """
+
480
+
481 # Ensure the input string starts with '{' or '[' after stripping leading whitespace
+
482 input_str = input_str.lstrip()
+
+
483 if not input_str.startswith(('{', '[')):
+
484 return None
+
485
+
486 # Variables to track the balance of brackets and the position in the string
+
487 bracket_count = 0
+
+
488 position = 0
+
489 in_string = False
+
490 escape_next = False
+
491 start_char = input_str[0]
+
492 end_char = '}' if start_char == '{' else ']'
+
493
+
494 # Iterate over the string to find where the JSON object or array ends
+
495 for char in input_str:
+
496 if not in_string:
+
+
497 if char == start_char:
+
498 bracket_count += 1
+
499 elif char == end_char:
+
500 bracket_count -= 1
+
501 elif char == '"':
+
502 in_string = True
+
503 else:
+
504 if char == '"' and not escape_next:
+
505 in_string = False
+
506 elif char == '\\':
+
507 escape_next = not escape_next
+
508 else:
+
509 escape_next = False
+
510
+
511 # Move to the next character
+
512 position += 1
+
513
+
514 # If brackets are balanced and we're not in a string, stop processing
+
515 if bracket_count == 0 and not in_string:
+
516 break
+
517 else:
+
518 return None
+
519 # The position now points to the character after the last '}', so we slice to position
+
520 json_str = input_str[:position]
+
521 remaining_str = input_str[position:]
+
522 # Return the unparsed remainder of the string and the decoded JSON object
+
523 return remaining_str, self._to_object(json_str)
+
524
+
525 @property
+
526 def kbnf_definition(self):
+
527 return self._rule_str
+
528
+
529
+ +
+
+
An extractor that extracts data corresponding to a nonterminal.
Definition extractor.py:98
+
str nonterminal(self)
Get the nonterminal of the extractor.
Definition extractor.py:121
+
An extractor that loads json data to an object from a string.
Definition json.py:426
+ +
typing.Optional[tuple[str, schemas.schema.Schema]] extract(self, str input_str)
Extract a schema instance from a string.
Definition json.py:497
+
__init__(self, str nonterminal, typing.Optional[str] capture_name, schemas.schema.Schema|collections.abc.Sequence schema, typing.Callable[[str], schemas.schema.Schema] to_object)
Create a json extractor from a given schema or a list of supported types.
Definition json.py:484
+ + +
An abstract field info that describes a data field in a schema.
Definition schema.py:13
+
An abstract schema that describes some data.
Definition schema.py:91
+ +
_register_all_predefined_types()
Definition json.py:57
+
None 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.
Definition json.py:53
+
str _generate_kbnf_grammar(schemas.schema.Schema|collections.abc.Sequence schema, str start_nonterminal)
Generate a KBNF grammar string from a schema for JSON format.
Definition json.py:387
+
+
+ + + + diff --git a/v0.4.9/json__schema_8py.html b/v0.4.9/json__schema_8py.html new file mode 100644 index 0000000..a0ebb6d --- /dev/null +++ b/v0.4.9/json__schema_8py.html @@ -0,0 +1,213 @@ + + + + + + + + +Formatron: src/formatron/schemas/json_schema.py File Reference + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+ +
json_schema.py File Reference
+
+
+ +

Go to the source code of this file.

+ + + + +

+Classes

class  formatron.schemas.json_schema.FieldInfo
 
+ + + + + + + + + +

+Namespaces

namespace  formatron
 
namespace  formatron.schemas
 This subpackage contains modules that define schemas creation from various sources.
 
namespace  formatron.schemas.json_schema
 This module contains utilities for creating schemas from JSON schemas.
 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Functions

schemas.schema.Schema formatron.schemas.json_schema.create_schema (dict[str, typing.Any] schema, registry=Registry())
 Create a Schema object from a JSON schema object.
 
str formatron.schemas.json_schema._resolve_new_url (str uri, str ref)
 Adapted from https://github.com/python-jsonschema/referencing/blob/main/referencing/_core.py#L667.
 
None formatron.schemas.json_schema._validate_json_schema (dict[str, typing.Any] schema)
 
typing.Type formatron.schemas.json_schema._convert_json_schema_to_our_schema (dict[str, typing.Any] schema, dict[int, typing.Type] json_schema_id_to_schema)
 Recursively handle all types needed to fully determine the type of a schema.
 
 formatron.schemas.json_schema._extract_fields_from_object_type (typing.Type object_type)
 
typing.Type formatron.schemas.json_schema._handle_anyOf (dict[str, typing.Any] schema, dict[int, typing.Type] json_schema_id_to_schema)
 
typing.Type[typing.Any|None] formatron.schemas.json_schema._infer_type (dict[str, typing.Any] schema, dict[int, typing.Type] json_schema_id_to_schema)
 Infer more specific types.
 
typing.Any formatron.schemas.json_schema._get_literal (dict[str, typing.Any] schema)
 
typing.Type formatron.schemas.json_schema._handle_literal (typing.Any literal, typing.Type obtained_type, dict[str, typing.Any] schema, dict[int, typing.Type] json_schema_id_to_schema)
 
typing.Type formatron.schemas.json_schema._handle_str_with_metadata (dict[str, typing.Any] schema)
 Handle string type with metadata such as maxLength, minLength, and pattern.
 
typing.Type formatron.schemas.json_schema._handle_numeric_with_metadata (dict[str, typing.Any] schema, typing.Type numeric_type)
 Handle numeric types (int or float) with metadata such as minimum, maximum, exclusiveMinimum, and exclusiveMaximum.
 
typing.Type formatron.schemas.json_schema._create_custom_type (dict[str, typing.Any] schema, dict[int, typing.Type] json_schema_id_to_schema)
 
typing.Type formatron.schemas.json_schema._handle_list_metadata (dict[str, typing.Any] schema, dict[int, typing.Type] json_schema_id_to_schema)
 Handle cases where the obtained type is a list.
 
typing.Type[typing.Any|None] formatron.schemas.json_schema._obtain_type (dict[str, typing.Any] schema, dict[int, typing.Type] json_schema_id_to_schema)
 Directly obtain type information from this schema's type keyword.
 
 formatron.schemas.json_schema._merge_referenced_schema (dict[str, typing.Any] schema, set[int] memo)
 
 formatron.schemas.json_schema._merge_key (dict[str, typing.Any] schema, str ref_key, typing.Any reference_value)
 
 formatron.schemas.json_schema._recursive_resolve_reference (str base_uri, typing.Any schema, Registry registry, set[int] memo)
 
 formatron.schemas.json_schema._resolve_reference (dict[str, typing.Any] schema, str key, typing.Any resolver)
 
+ + + +

+Variables

int formatron.schemas.json_schema._counter
 
+
+
+ + + + diff --git a/v0.4.9/json__schema_8py.js b/v0.4.9/json__schema_8py.js new file mode 100644 index 0000000..58fdfb2 --- /dev/null +++ b/v0.4.9/json__schema_8py.js @@ -0,0 +1,23 @@ +var json__schema_8py = +[ + [ "formatron.schemas.json_schema.FieldInfo", "classformatron_1_1schemas_1_1json__schema_1_1FieldInfo.html", "classformatron_1_1schemas_1_1json__schema_1_1FieldInfo" ], + [ "_convert_json_schema_to_our_schema", "json__schema_8py.html#a5f4856cb7c30aa340432d386836f25be", null ], + [ "_create_custom_type", "json__schema_8py.html#a15dc86b65c90ac8423c8989054f8c9e5", null ], + [ "_extract_fields_from_object_type", "json__schema_8py.html#af20251afc012b955e29c92922fcc83ef", null ], + [ "_get_literal", "json__schema_8py.html#a096ea829025ebd26b9ae165c17cf8976", null ], + [ "_handle_anyOf", "json__schema_8py.html#a6f88bf4e3c48d96b060ccdcbd80b3328", null ], + [ "_handle_list_metadata", "json__schema_8py.html#ac84df1d5caa0ab01d58207e4401be0dc", null ], + [ "_handle_literal", "json__schema_8py.html#a969bd30894a578428528b94b0f82f1ba", null ], + [ "_handle_numeric_with_metadata", "json__schema_8py.html#ad187a02f7616ccbb83c00462996a7fe1", null ], + [ "_handle_str_with_metadata", "json__schema_8py.html#a32e51b70be50d55d3944e6c700bbd1a5", null ], + [ "_infer_type", "json__schema_8py.html#ac742e1e581efccb6cc9742e7a23c25c2", null ], + [ "_merge_key", "json__schema_8py.html#a5fcddd43a5f64374b5b75d4aafeb9135", null ], + [ "_merge_referenced_schema", "json__schema_8py.html#a45c9b97319a58c2013b8e3f10ad78c30", null ], + [ "_obtain_type", "json__schema_8py.html#a544d74edf1fdccbad9e216d9ff028a20", null ], + [ "_recursive_resolve_reference", "json__schema_8py.html#aaba012c79d101be93f4d96588c9f8cc2", null ], + [ "_resolve_new_url", "json__schema_8py.html#a9dc9dc267e5dd7b6581e2367e9238152", null ], + [ "_resolve_reference", "json__schema_8py.html#a24b516494672cc5dbbf7300ea65479b1", null ], + [ "_validate_json_schema", "json__schema_8py.html#a51aa68e29951e6b295844b13177b7d6a", null ], + [ "create_schema", "json__schema_8py.html#ab2aeae10eb93ef3a3ca1c50013c6b380", null ], + [ "_counter", "json__schema_8py.html#a63e9b97210ccf01282f81aa529a86e50", null ] +]; \ No newline at end of file diff --git a/v0.4.9/json__schema_8py_source.html b/v0.4.9/json__schema_8py_source.html new file mode 100644 index 0000000..ce32371 --- /dev/null +++ b/v0.4.9/json__schema_8py_source.html @@ -0,0 +1,590 @@ + + + + + + + + +Formatron: src/formatron/schemas/json_schema.py Source File + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Formatron v0.4.9 + + +
+
Formatron empowers everyone to control the output format of language models with minimal overhead.
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
json_schema.py
+
+
+Go to the documentation of this file.
1"""
+
2This module contains utilities for creating schemas from JSON schemas.
+
3"""
+
4
+
5import collections
+
6import collections.abc
+
7import copy
+
8import json
+
9from urllib.parse import urldefrag, urljoin
+
10import frozendict
+
11import jsonschema.validators
+
12from pydantic import typing
+
13import jsonschema
+
14from formatron import schemas
+
15from referencing import Registry, Resource
+
16
+ +
+
18 __slots__ = ("_annotation",)
+
19
+
20 def __init__(self, annotation: typing.Type, required:bool):
+
21 """
+
22 Initialize the field information.
+
23
+
24 Args:
+
25 annotation: The type annotation of the field.
+
26 required: Whether the field is required for the schema.
+
27 """
+
+
28 self._annotation = annotation
+
29 self._required = required
+ +
31 @property
+
+
32 def annotation(self) -> typing.Type[typing.Any] | None:
+
33 """
+
34 Get the type annotation of the field.
+
35 """
+
36 return self._annotation
+
37
+
38 @property
+
39 def required(self) -> bool:
+
40 """
+
41 Check if the field is required for the schema.
+
42 """
+
+
43 return self._required
+
44
+
45_counter = 0
+
+
46
+
47def create_schema(schema: dict[str, typing.Any], registry=Registry()) -> schemas.schema.Schema:
+
48 """
+
49 Create a Schema object from a JSON schema object.
+
50
+
51 This function takes a JSON schema and converts it into a Schema object that can be used
+
52 for data validation and serialization. Currently, only the following JSON Schema features are supported:
+
53
+
54 - `type` keyword
+
55 - `minLength, maxLength, pattern` keywords for string type
+
56 - `substringOf` keyword for string type
+
57 - `minimum, maximum, exclusiveMinimum, exclusiveMaximum` keywords for number type and integer type
+
58 - `items` keyword
+
+
59 - optionally with `minItems`, `maxItems`, `prefixItems` constraints
+
60 - `properties` keyword
+
61 - Due to implementation limitations, we always assume `additionalProperties` is false.
+
+
62 - Note that `properties` is optional for object type.
+
63 - `enum` and `const` keyword
+
+
64 - This includes advanced enum types such as array and object.
+
65 - Note that if both `enum`(or `const`) and `type` are present, `type` will be ignored.
+
66 - `required` keyword
+
67 - `anyOf` keyword
+
68 - This currently does not support factoring out common parts of the subschemas(like https://json-schema.org/understanding-json-schema/reference/combining#factoringschemas)
+
69 - Schema references ($ref and $dynamicRef)
+
70 - Hence, all types of schema identifications(`$defs`, `$id`, `$anchor`, `$dynamicAnchor`) are supported.
+
71 - This includes recursive schema references.
+
72 - Recursive array references(like \[\[\[\[...\]\]\]\]) are not supported yet.
+
73 - Due to implementation limitations, duplicate constraint keywords in both referrers and referents are not allowed.
+
74 - This bound is expected to be loosened in future versions of Formatron where "easily mergeable" constraint keywords will be merged.
+
75
+
76 Requirements:
+
77 - The input schema must be a valid JSON Schema according to the JSON Schema Draft 2020-12 standard
+
78 - The root schema's type must be exactly "object" or "array" or both
+
79 - The schema must have a valid '$id' and '$schema' fields
+
80 - All references must be resolvable within the given schema and registry
+
81
+
82 Args:
+
83 schema: A dictionary representing a valid JSON schema.
+
84 registry: A Registry object containing additional schema definitions.
+
85 Defaults to an empty Registry.
+
86
+
87 Returns:
+
88 schemas.schema.Schema: A Schema object representing the input JSON schema.
+
89
+
90 Raises:
+
91 jsonschema.exceptions.ValidationError: If the input schema is not a valid JSON Schema.
+
92 ValueError: If there are issues with schema references, constraints or requirements.
+
93 """
+
94 registry = copy.deepcopy(registry)
+
95 schema = copy.deepcopy(schema)
+ +
97 registry = Resource.from_contents(schema) @ registry
+
98 json_schema_id_to_schema = {}
+
99 memo = set()
+
100 _recursive_resolve_reference(schema["$id"], schema, registry, memo)
+
101 memo.clear()
+
102 _merge_referenced_schema(schema,memo)
+
103 result = _convert_json_schema_to_our_schema(schema,json_schema_id_to_schema)
+
104 return result
+
105
+
106def _resolve_new_url(uri: str, ref: str) -> str:
+
107 """
+
108 Adapted from https://github.com/python-jsonschema/referencing/blob/main/referencing/_core.py#L667.
+
109 """
+
110 if not ref.startswith("#"):
+
111 uri, _ = urldefrag(urljoin(uri, ref))
+
112 return uri
+
113
+
114def _validate_json_schema(schema: dict[str, typing.Any]) -> None:
+
+
115 if "type" in schema:
+
116 root_type = schema["type"]
+
117 if isinstance(root_type, str):
+
118 if root_type not in ["object", "array"]:
+
119 raise ValueError("Root schema type must be 'object' or 'array'")
+
120 elif isinstance(root_type, list):
+
121 if not set(root_type).issubset({"object", "array"}):
+
122 raise ValueError("Root schema type must be 'object', 'array', or both")
+
123 else:
+
124 raise ValueError("Invalid 'type' specification in root schema")
+
125 jsonschema.validate(instance=schema, schema=jsonschema.validators.Draft202012Validator.META_SCHEMA)
+
126
+
127def _convert_json_schema_to_our_schema(schema: dict[str, typing.Any], json_schema_id_to_schema: dict[int, typing.Type])->typing.Type:
+
+
128 """
+
129 Recursively handle all types needed to fully determine the type of a schema
+
130 """
+
131 schema_id = id(schema)
+
132 if schema_id in json_schema_id_to_schema: # Circular reference
+
+
133 return json_schema_id_to_schema[schema_id]
+
134 if isinstance(schema, dict):
+
135 _inferred_type = _infer_type(schema, json_schema_id_to_schema)
+
136 if "properties" in schema:
+
137 fields = _extract_fields_from_object_type(json_schema_id_to_schema[schema_id])
+
+
+
138 properties = schema["properties"]
+
139 required = schema.get("required", [])
+
140 for _property in properties:
+
141 fields[_property] = FieldInfo(_convert_json_schema_to_our_schema(properties[_property], json_schema_id_to_schema), required=_property in required)
+
142 return _inferred_type
+
143
+
144def _extract_fields_from_object_type(object_type:typing.Type):
+
145 args = typing.get_args(object_type)
+
146 for arg in args:
+
147 if isinstance(arg, type) and issubclass(arg, schemas.schema.Schema):
+
148 return arg.fields()
+
149 return object_type.fields()
+
150
+
+
151def _handle_anyOf(schema: dict[str, typing.Any], json_schema_id_to_schema: dict[int, typing.Type]) -> typing.Type:
+
152 allowed_keys = {"anyOf", "$id", "$schema"}
+
153 assert set(schema.keys()).issubset(allowed_keys), "Only 'anyOf', '$id', and '$schema' are allowed when 'anyOf' is present"
+
154 new_list = []
+
155 for item in schema["anyOf"]:
+
+
156 new_list.append(_convert_json_schema_to_our_schema(item, json_schema_id_to_schema))
+
157 return typing.Union[tuple(new_list)]
+
158
+
159def _infer_type(schema: dict[str, typing.Any], json_schema_id_to_schema: dict[int, typing.Type]) -> typing.Type[typing.Any | None]:
+
160 """
+
161 Infer more specific types.
+
162 """
+
163 if "anyOf" in schema:
+
164 return _handle_anyOf(schema, json_schema_id_to_schema)
+
165 obtained_type = _obtain_type(schema, json_schema_id_to_schema)
+
166 if obtained_type is None:
+
167 obtained_type = typing.Union[str, float, int, bool, None, list[typing.Any]]
+
168 args = None
+
169 origin = typing.get_origin(obtained_type)
+
170 if origin is typing.Union or origin is typing.Literal or origin is list:
+
171 args = typing.get_args(obtained_type)
+
172 if not args:
+
+
+
173 args = [obtained_type]
+
174 else:
+
175 args = list(args)
+
176 for i, arg in enumerate(args):
+
177 if arg is object:
+
178 args[i] = _create_custom_type(schema, json_schema_id_to_schema)
+
179 elif arg is list:
+
+
+
180 args[i] = _handle_list_metadata(schema, json_schema_id_to_schema)
+
181 elif arg is str:
+
182 args[i] = _handle_str_with_metadata(schema)
+
183 elif arg is int or arg is float:
+
184 args[i] = _handle_numeric_with_metadata(schema, arg)
+
185 if typing.get_origin(obtained_type) is typing.Union:
+
186 obtained_type = typing.Union[tuple(args)]
+
187 elif typing.get_origin(obtained_type) is typing.Literal:
+
+
188 obtained_type = typing.Literal[tuple(args)]
+
189 else:
+
190 obtained_type = args[0]
+
191 json_schema_id_to_schema[id(schema)] = obtained_type
+
192 return obtained_type
+
+ +
194def _get_literal(schema: dict[str, typing.Any]) -> typing.Any:
+
195 if "enum" in schema and "const" in schema:
+
196 raise ValueError("JSON schema cannot contain both 'enum' and 'const' keywords")
+
197 return tuple(schema["enum"]) if "enum" in schema else schema.get("const")
+
198
+
199def _handle_literal(literal: typing.Any, obtained_type: typing.Type, schema: dict[str, typing.Any], json_schema_id_to_schema: dict[int, typing.Type]) -> typing.Type:
+
200 # TODO: validate literal against obtained_type
+
201 if not isinstance(literal, tuple):
+
202 literal = (literal,)
+
203 literal = frozendict.deepfreeze(literal)
+
204 literal_type = typing.Literal[literal]
+
205 return literal_type
+
206
+
207def _handle_str_with_metadata(schema: dict[str, typing.Any]) -> typing.Type:
+
208 """
+
209 Handle string type with metadata such as maxLength, minLength, and pattern.
+
210 """
+
211 metadata = {}
+
212 if "maxLength" in schema:
+
213 metadata["max_length"] = schema["maxLength"]
+
214 if "minLength" in schema:
+
215 metadata["min_length"] = schema["minLength"]
+
216 if "pattern" in schema:
+
217 metadata["pattern"] = schema["pattern"]
+
218 if "substringOf" in schema:
+
219 metadata["substring_of"] = schema["substringOf"]
+
220
+
221 if metadata:
+
222 return schemas.schema.TypeWithMetadata(str, metadata)
+
223 return str
+
224
+
+
+
225def _handle_numeric_with_metadata(schema: dict[str, typing.Any], numeric_type: typing.Type) -> typing.Type:
+
226 """
+
227 Handle numeric types (int or float) with metadata such as minimum, maximum, exclusiveMinimum, and exclusiveMaximum.
+
228 """
+
229 metadata = {}
+
+
+
230 if "minimum" in schema:
+
231 metadata["ge"] = schema["minimum"]
+
232 if "maximum" in schema:
+
233 metadata["le"] = schema["maximum"]
+
234 if "exclusiveMinimum" in schema:
+
235 metadata["gt"] = schema["exclusiveMinimum"]
+
236 if "exclusiveMaximum" in schema:
+
237 metadata["lt"] = schema["exclusiveMaximum"]
+
+
238
+
239 if metadata:
+
240 return schemas.schema.TypeWithMetadata(numeric_type, metadata)
+
241 return numeric_type
+
242
+
+ +
244
+
245def _create_custom_type(schema: dict[str, typing.Any], json_schema_id_to_schema: dict[int, typing.Type]) -> typing.Type:
+
246 global _counter
+
247 fields = {}
+
248 new_type = type(f"__json_schema_{_counter}", (schemas.schema.Schema,), {
+
249 "from_json": classmethod(lambda cls, x: json.loads(x)),
+
250 "fields": classmethod(lambda cls: fields)
+
251 })
+
252 _counter += 1
+
253 json_schema_id_to_schema[id(schema)] = new_type
+
254 return new_type
+
255
+
256def _handle_list_metadata(schema: dict[str, typing.Any], json_schema_id_to_schema: dict[int, typing.Type]) -> typing.Type:
+
257 """
+
+
258 Handle cases where the obtained type is a list
+
259 """
+
260 metadata = {}
+
261 if "minItems" in schema:
+
262 metadata["min_length"] = schema["minItems"]
+
+
263 if "maxItems" in schema:
+
264 metadata["max_length"] = schema["maxItems"]
+
265 if "prefixItems" in schema:
+
266 metadata["prefix_items"] = tuple(_convert_json_schema_to_our_schema(i, json_schema_id_to_schema) for i in schema["prefixItems"])
+
267 item_type = typing.Any
+
268 if "items" in schema:
+
269 if schema["items"] == False:
+
270 metadata["additional_items"] = False
+
271 else:
+
272 item_type = _convert_json_schema_to_our_schema(schema["items"], json_schema_id_to_schema)
+
273 if item_type is None:
+
274 item_type = typing.Any
+
275 if metadata:
+
276 if "additional_items" not in metadata:
+
277 metadata["additional_items"] = True
+
278 return schemas.schema.TypeWithMetadata(list, metadata)
+
279 return list[item_type]
+
+
+ +
281
+
282def _obtain_type(schema: dict[str, typing.Any], json_schema_id_to_schema:dict[int, typing.Type]) -> typing.Type[typing.Any|None]:
+
283 """
+
284 Directly obtain type information from this schema's type keyword.
+
285 """
+
286 if "type" not in schema:
+
287 obtained_type = None
+
288 else:
+
289 json_type = schema["type"]
+
290 if json_type == "string":
+
+
291 obtained_type = str
+
292 elif json_type == "number":
+
293 obtained_type = float
+
294 elif json_type == "integer":
+
295 obtained_type = int
+
+
296 elif json_type == "boolean":
+
297 obtained_type = bool
+
298 elif json_type == "null":
+
299 obtained_type = type(None)
+
300 elif json_type == "array":
+
301 obtained_type = list
+
302 elif json_type == "object":
+
303 if "properties" in schema:
+
304 obtained_type = object
+
305 else:
+
306 obtained_type = dict[str, typing.Any]
+
307 elif isinstance(json_type, collections.abc.Sequence):
+
308 new_list = []
+
309 for item in json_type:
+
310 new_schema = schema.copy()
+
311 new_schema["type"] = item
+
312 new_list.append(_obtain_type(new_schema, json_schema_id_to_schema))
+
313 obtained_type = typing.Union[tuple(new_list)]
+
314 else:
+
315 raise TypeError(f"Unsupported type in json schema: {json_type}")
+
316 literal = _get_literal(schema)
+
317 if literal is not None:
+
318 return _handle_literal(literal, obtained_type, schema, json_schema_id_to_schema)
+
+
319 return obtained_type
+
320
+
321
+
322def _merge_referenced_schema(schema: dict[str, typing.Any], memo: set[int]):
+
323 keys = ["$ref", "$dynamicRef"]
+
+
324 if id(schema) in memo: # Circular reference
+
325 return None
+
326 if isinstance(schema, list):
+
327 memo.add(id(schema))
+
328 for item in schema:
+
329 _merge_referenced_schema(item, memo)
+
330 elif isinstance(schema, dict):
+
331 memo.add(id(schema))
+
332 for key in keys:
+
333 if key in schema:
+
334 _merge_referenced_schema(schema[key], memo) # ensure no unmerged references
+
335 for ref_key, ref_value in schema[key].items():
+
336 _merge_key(schema, ref_key, ref_value)
+
337 del schema[key]
+
338 for key, value in schema.items():
+
339 _merge_referenced_schema(value, memo)
+
340
+
341def _merge_key(schema:dict[str, typing.Any], ref_key:str, reference_value:typing.Any):
+
342 if ref_key not in schema:
+
343 schema[ref_key] = reference_value
+
344 return None
+
345 if schema[ref_key] is reference_value:
+
346 return None
+
347 if isinstance(schema[ref_key], dict) and isinstance(reference_value, dict):
+
348 for new_ref_key, new_ref_value in reference_value.items():
+
349 _merge_key(schema[ref_key], new_ref_key, new_ref_value)
+
350 return None
+
351 if ref_key in ("$id", "$schema"):
+
352 # For $id and $schema, keep the original value
+
353 return None
+
354 if isinstance(schema[ref_key], (str, int, float, bool)) and isinstance(reference_value, (str, int, float, bool)):
+
355 if schema[ref_key] == reference_value:
+
356 return None
+
357 raise ValueError(f"Duplicate keys in schema referenced by {ref_key} in JSON schema: {schema} is not supported")
+
358
+
359
+
360def _recursive_resolve_reference(base_uri: str, schema: typing.Any, registry: Registry, memo: set[int]):
+
+
+
361 if id(schema) in memo:
+
362 return schema
+
363 memo.add(id(schema))
+
364 if isinstance(schema, list):
+
365 new_list = []
+
366 for item in schema:
+
367 new_list.append(_recursive_resolve_reference(base_uri, item, registry, memo))
+
368 schema.clear()
+
369 schema.extend(new_list)
+
370 if isinstance(schema, dict):
+
371 if "$id" in schema:
+
372 base_uri = _resolve_new_url(base_uri, schema["$id"])
+
373 resolver = registry.resolver(base_uri)
+
374 keys = ["$ref", "$dynamicRef"]
+
375 for key in keys:
+
376 if key in schema:
+
377 _resolve_reference(schema, key, resolver)
+
378 for key, value in schema.items():
+
379 _recursive_resolve_reference(base_uri, value, registry, memo)
+
+
+
380 return schema
+
381
+
382def _resolve_reference(schema: dict[str, typing.Any], key: str, resolver: typing.Any):
+
383 resolved = resolver.lookup(schema[key])
+
384 if resolved.contents is schema:
+
385 raise ValueError(f"Circular self reference detected in JSON schema: {schema}")
+
386 schema[key] = resolved.contents
+
+ +
typing.Type[typing.Any]|None annotation(self)
Get the type annotation of the field.
+ + +
__init__(self, typing.Type annotation, bool required)
Initialize the field information.
+
bool required(self)
Check if the field is required for the schema.
+
An abstract field info that describes a data field in a schema.
Definition schema.py:13
+
An abstract schema that describes some data.
Definition schema.py:91
+ +
typing.Any _get_literal(dict[str, typing.Any] schema)
+
typing.Type _create_custom_type(dict[str, typing.Any] schema, dict[int, typing.Type] json_schema_id_to_schema)
+
_resolve_reference(dict[str, typing.Any] schema, str key, typing.Any resolver)
+
typing.Type _handle_str_with_metadata(dict[str, typing.Any] schema)
Handle string type with metadata such as maxLength, minLength, and pattern.
+
_merge_referenced_schema(dict[str, typing.Any] schema, set[int] memo)
+
None _validate_json_schema(dict[str, typing.Any] schema)
+
typing.Type[typing.Any|None] _obtain_type(dict[str, typing.Any] schema, dict[int, typing.Type] json_schema_id_to_schema)
Directly obtain type information from this schema's type keyword.
+
typing.Type _convert_json_schema_to_our_schema(dict[str, typing.Any] schema, dict[int, typing.Type] json_schema_id_to_schema)
Recursively handle all types needed to fully determine the type of a schema.
+
_merge_key(dict[str, typing.Any] schema, str ref_key, typing.Any reference_value)
+
typing.Type _handle_anyOf(dict[str, typing.Any] schema, dict[int, typing.Type] json_schema_id_to_schema)
+
typing.Type _handle_literal(typing.Any literal, typing.Type obtained_type, dict[str, typing.Any] schema, dict[int, typing.Type] json_schema_id_to_schema)
+
str _resolve_new_url(str uri, str ref)
Adapted from https://github.com/python-jsonschema/referencing/blob/main/referencing/_core....
+
_recursive_resolve_reference(str base_uri, typing.Any schema, Registry registry, set[int] memo)
+
schemas.schema.Schema create_schema(dict[str, typing.Any] schema, registry=Registry())
Create a Schema object from a JSON schema object.
+
typing.Type[typing.Any|None] _infer_type(dict[str, typing.Any] schema, dict[int, typing.Type] json_schema_id_to_schema)
Infer more specific types.
+
typing.Type _handle_list_metadata(dict[str, typing.Any] schema, dict[int, typing.Type] json_schema_id_to_schema)
Handle cases where the obtained type is a list.
+
typing.Type _handle_numeric_with_metadata(dict[str, typing.Any] schema, typing.Type numeric_type)
Handle numeric types (int or float) with metadata such as minimum, maximum, exclusiveMinimum,...
+
_extract_fields_from_object_type(typing.Type object_type)
+
+
+ + + + diff --git a/v0.4.9/menu.js b/v0.4.9/menu.js new file mode 100644 index 0000000..0fd1e99 --- /dev/null +++ b/v0.4.9/menu.js @@ -0,0 +1,134 @@ +/* + @licstart The following is the entire license notice for the JavaScript code in this file. + + The MIT License (MIT) + + Copyright (C) 1997-2020 by Dimitri van Heesch + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software + and associated documentation files (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, publish, distribute, + sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or + substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING + BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + @licend The above is the entire license notice for the JavaScript code in this file + */ +function initMenu(relPath,searchEnabled,serverSide,searchPage,search,treeview) { + function makeTree(data,relPath) { + let result=''; + if ('children' in data) { + result+='
    '; + for (let i in data.children) { + let url; + const link = data.children[i].url; + if (link.substring(0,1)=='^') { + url = link.substring(1); + } else { + url = relPath+link; + } + result+='
  • '+ + data.children[i].text+''+ + makeTree(data.children[i],relPath)+'
  • '; + } + result+='
'; + } + return result; + } + let searchBoxHtml; + if (searchEnabled) { + if (serverSide) { + searchBoxHtml='
'+ + '
'+ + '
 '+ + ''+ + '
'+ + '
'+ + '
'+ + '
'; + } else { + searchBoxHtml='
'+ + ''+ + ' '+ + ''+ + ''+ + ''+ + ''+ + ''+ + '
'; + } + } + + $('#main-nav').before('
'+ + ''+ + ''+ + '
'); + $('#main-nav').append(makeTree(menudata,relPath)); + $('#main-nav').children(':first').addClass('sm sm-dox').attr('id','main-menu'); + if (searchBoxHtml) { + $('#main-menu').append('
  • '); + } + const $mainMenuState = $('#main-menu-state'); + let prevWidth = 0; + if ($mainMenuState.length) { + const initResizableIfExists = function() { + if (typeof initResizable==='function') initResizable(treeview); + } + // animate mobile menu + $mainMenuState.change(function() { + const $menu = $('#main-menu'); + let options = { duration: 250, step: initResizableIfExists }; + if (this.checked) { + options['complete'] = () => $menu.css('display', 'block'); + $menu.hide().slideDown(options); + } else { + options['complete'] = () => $menu.css('display', 'none'); + $menu.show().slideUp(options); + } + }); + // set default menu visibility + const resetState = function() { + const $menu = $('#main-menu'); + const newWidth = $(window).outerWidth(); + if (newWidth!=prevWidth) { + if ($(window).outerWidth()<768) { + $mainMenuState.prop('checked',false); $menu.hide(); + $('#searchBoxPos1').html(searchBoxHtml); + $('#searchBoxPos2').hide(); + } else { + $menu.show(); + $('#searchBoxPos1').empty(); + $('#searchBoxPos2').html(searchBoxHtml); + $('#searchBoxPos2').show(); + } + if (typeof searchBox!=='undefined') { + searchBox.CloseResultsWindow(); + } + prevWidth = newWidth; + } + } + $(window).ready(function() { resetState(); initResizableIfExists(); }); + $(window).resize(resetState); + } + $('#main-menu').smartmenus(); +} +/* @license-end */ diff --git a/v0.4.9/menudata.js b/v0.4.9/menudata.js new file mode 100644 index 0000000..452f393 --- /dev/null +++ b/v0.4.9/menudata.js @@ -0,0 +1,96 @@ +/* + @licstart The following is the entire license notice for the JavaScript code in this file. + + The MIT License (MIT) + + Copyright (C) 1997-2020 by Dimitri van Heesch + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software + and associated documentation files (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, publish, distribute, + sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or + substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING + BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + @licend The above is the entire license notice for the JavaScript code in this file +*/ +var menudata={children:[ +{text:"Main Page",url:"index.html"}, +{text:"Packages",url:"namespaces.html",children:[ +{text:"Package List",url:"namespaces.html"}, +{text:"Package Members",url:"namespacemembers.html",children:[ +{text:"All",url:"namespacemembers.html",children:[ +{text:"_",url:"namespacemembers.html#index__5F"}, +{text:"a",url:"namespacemembers.html#index_a"}, +{text:"c",url:"namespacemembers.html#index_c"}, +{text:"g",url:"namespacemembers.html#index_g"}, +{text:"i",url:"namespacemembers.html#index_i"}, +{text:"r",url:"namespacemembers.html#index_r"}, +{text:"s",url:"namespacemembers.html#index_s"}, +{text:"u",url:"namespacemembers.html#index_u"}]}, +{text:"Functions",url:"namespacemembers_func.html",children:[ +{text:"_",url:"namespacemembers_func.html#index__5F"}, +{text:"a",url:"namespacemembers_func.html#index_a"}, +{text:"c",url:"namespacemembers_func.html#index_c"}, +{text:"g",url:"namespacemembers_func.html#index_g"}, +{text:"i",url:"namespacemembers_func.html#index_i"}, +{text:"r",url:"namespacemembers_func.html#index_r"}, +{text:"u",url:"namespacemembers_func.html#index_u"}]}, +{text:"Variables",url:"namespacemembers_vars.html"}]}]}, +{text:"Classes",url:"annotated.html",children:[ +{text:"Class List",url:"annotated.html"}, +{text:"Class Index",url:"classes.html"}, +{text:"Class Hierarchy",url:"hierarchy.html"}, +{text:"Class Members",url:"functions.html",children:[ +{text:"All",url:"functions.html",children:[ +{text:"_",url:"functions.html#index__5F"}, +{text:"a",url:"functions.html#index_a"}, +{text:"b",url:"functions.html#index_b"}, +{text:"c",url:"functions.html#index_c"}, +{text:"e",url:"functions.html#index_e"}, +{text:"f",url:"functions.html#index_f"}, +{text:"g",url:"functions.html#index_g"}, +{text:"i",url:"functions.html#index_i"}, +{text:"j",url:"functions.html#index_j"}, +{text:"k",url:"functions.html#index_k"}, +{text:"m",url:"functions.html#index_m"}, +{text:"n",url:"functions.html#index_n"}, +{text:"p",url:"functions.html#index_p"}, +{text:"r",url:"functions.html#index_r"}, +{text:"s",url:"functions.html#index_s"}, +{text:"t",url:"functions.html#index_t"}, +{text:"u",url:"functions.html#index_u"}]}, +{text:"Functions",url:"functions_func.html",children:[ +{text:"_",url:"functions_func.html#index__5F"}, +{text:"a",url:"functions_func.html#index_a"}, +{text:"b",url:"functions_func.html#index_b"}, +{text:"c",url:"functions_func.html#index_c"}, +{text:"e",url:"functions_func.html#index_e"}, +{text:"f",url:"functions_func.html#index_f"}, +{text:"g",url:"functions_func.html#index_g"}, +{text:"i",url:"functions_func.html#index_i"}, +{text:"j",url:"functions_func.html#index_j"}, +{text:"k",url:"functions_func.html#index_k"}, +{text:"m",url:"functions_func.html#index_m"}, +{text:"n",url:"functions_func.html#index_n"}, +{text:"p",url:"functions_func.html#index_p"}, +{text:"r",url:"functions_func.html#index_r"}, +{text:"s",url:"functions_func.html#index_s"}, +{text:"t",url:"functions_func.html#index_t"}, +{text:"u",url:"functions_func.html#index_u"}]}, +{text:"Variables",url:"functions_vars.html",children:[ +{text:"_",url:"functions_vars.html#index__5F"}, +{text:"c",url:"functions_vars.html#index_c"}, +{text:"e",url:"functions_vars.html#index_e"}, +{text:"f",url:"functions_vars.html#index_f"}, +{text:"r",url:"functions_vars.html#index_r"}]}]}]}, +{text:"Files",url:"files.html",children:[ +{text:"File List",url:"files.html"}]}]} diff --git a/v0.4.9/minus.svg b/v0.4.9/minus.svg new file mode 100644 index 0000000..f70d0c1 --- /dev/null +++ b/v0.4.9/minus.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/v0.4.9/minusd.svg b/v0.4.9/minusd.svg new file mode 100644 index 0000000..5f8e879 --- /dev/null +++ b/v0.4.9/minusd.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/v0.4.9/namespaceformatron.html b/v0.4.9/namespaceformatron.html new file mode 100644 index 0000000..95db88f --- /dev/null +++ b/v0.4.9/namespaceformatron.html @@ -0,0 +1,161 @@ + + + + + + + + +Formatron: formatron Namespace Reference + + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Formatron v0.4.9 + + +
    +
    Formatron empowers everyone to control the output format of language models with minimal overhead.
    +
    +
    + + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    +
    +
    +
    +
    +
    Loading...
    +
    Searching...
    +
    No Matches
    +
    +
    +
    +
    + +
    + +
    formatron Namespace Reference
    +
    +
    + + + + + + + + + + + + + + + + + + + + +

    +Namespaces

    namespace  config
     Configuration classes for Formatron.
     
    namespace  extractor
     Extractors for extracting data from generated strings.
     
    namespace  formats
     This subpackage contains modules that operate with concrete formats, like json.
     
    namespace  formatter
     This module contains the Formatter class and its related classes.
     
    namespace  integrations
     This subpackage contains integrations with other frameworks and libraries.
     
    namespace  schemas
     This subpackage contains modules that define schemas creation from various sources.
     
    +
    +
    + + + + diff --git a/v0.4.9/namespaceformatron.js b/v0.4.9/namespaceformatron.js new file mode 100644 index 0000000..5bb652c --- /dev/null +++ b/v0.4.9/namespaceformatron.js @@ -0,0 +1,9 @@ +var namespaceformatron = +[ + [ "config", "namespaceformatron_1_1config.html", "namespaceformatron_1_1config" ], + [ "extractor", "namespaceformatron_1_1extractor.html", "namespaceformatron_1_1extractor" ], + [ "formats", "namespaceformatron_1_1formats.html", "namespaceformatron_1_1formats" ], + [ "formatter", "namespaceformatron_1_1formatter.html", "namespaceformatron_1_1formatter" ], + [ "integrations", "namespaceformatron_1_1integrations.html", "namespaceformatron_1_1integrations" ], + [ "schemas", "namespaceformatron_1_1schemas.html", "namespaceformatron_1_1schemas" ] +]; \ No newline at end of file diff --git a/v0.4.9/namespaceformatron_1_1config.html b/v0.4.9/namespaceformatron_1_1config.html new file mode 100644 index 0000000..6388fb1 --- /dev/null +++ b/v0.4.9/namespaceformatron_1_1config.html @@ -0,0 +1,151 @@ + + + + + + + + +Formatron: formatron.config Namespace Reference + + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Formatron v0.4.9 + + +
    +
    Formatron empowers everyone to control the output format of language models with minimal overhead.
    +
    +
    + + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    +
    +
    +
    +
    +
    Loading...
    +
    Searching...
    +
    No Matches
    +
    +
    +
    +
    + +
    + +
    formatron.config Namespace Reference
    +
    +
    + +

    Configuration classes for Formatron. +More...

    + + + + + +

    +Classes

    class  EngineGenerationConfig
     Configuration for how an KBNF engine should be used in text generation. More...
     
    +

    Detailed Description

    +

    Configuration classes for Formatron.

    +
    +
    + + + + diff --git a/v0.4.9/namespaceformatron_1_1config.js b/v0.4.9/namespaceformatron_1_1config.js new file mode 100644 index 0000000..a58e7a1 --- /dev/null +++ b/v0.4.9/namespaceformatron_1_1config.js @@ -0,0 +1,4 @@ +var namespaceformatron_1_1config = +[ + [ "EngineGenerationConfig", "classformatron_1_1config_1_1EngineGenerationConfig.html", "classformatron_1_1config_1_1EngineGenerationConfig" ] +]; \ No newline at end of file diff --git a/v0.4.9/namespaceformatron_1_1extractor.html b/v0.4.9/namespaceformatron_1_1extractor.html new file mode 100644 index 0000000..fab9e69 --- /dev/null +++ b/v0.4.9/namespaceformatron_1_1extractor.html @@ -0,0 +1,163 @@ + + + + + + + + +Formatron: formatron.extractor Namespace Reference + + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Formatron v0.4.9 + + +
    +
    Formatron empowers everyone to control the output format of language models with minimal overhead.
    +
    +
    + + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    +
    +
    +
    +
    +
    Loading...
    +
    Searching...
    +
    No Matches
    +
    +
    +
    +
    + +
    + +
    formatron.extractor Namespace Reference
    +
    +
    + +

    Extractors for extracting data from generated strings. +More...

    + + + + + + + + + + + + + + + + + +

    +Classes

    class  ChoiceExtractor
     An extractor that uses multiple extractors to extract data. More...
     
    class  Extractor
     An abstract extractor that extracts data from a string and offers its KBNF rules definition. More...
     
    class  LiteralExtractor
     An extractor that extracts a literal string. More...
     
    class  NonterminalExtractor
     An extractor that extracts data corresponding to a nonterminal. More...
     
    class  SubstringExtractor
     An extractor that extracts a substring of a given string from the input string. More...
     
    +

    Detailed Description

    +

    Extractors for extracting data from generated strings.

    +
    +
    + + + + diff --git a/v0.4.9/namespaceformatron_1_1extractor.js b/v0.4.9/namespaceformatron_1_1extractor.js new file mode 100644 index 0000000..e44dd45 --- /dev/null +++ b/v0.4.9/namespaceformatron_1_1extractor.js @@ -0,0 +1,8 @@ +var namespaceformatron_1_1extractor = +[ + [ "ChoiceExtractor", "classformatron_1_1extractor_1_1ChoiceExtractor.html", "classformatron_1_1extractor_1_1ChoiceExtractor" ], + [ "Extractor", "classformatron_1_1extractor_1_1Extractor.html", "classformatron_1_1extractor_1_1Extractor" ], + [ "LiteralExtractor", "classformatron_1_1extractor_1_1LiteralExtractor.html", "classformatron_1_1extractor_1_1LiteralExtractor" ], + [ "NonterminalExtractor", "classformatron_1_1extractor_1_1NonterminalExtractor.html", "classformatron_1_1extractor_1_1NonterminalExtractor" ], + [ "SubstringExtractor", "classformatron_1_1extractor_1_1SubstringExtractor.html", "classformatron_1_1extractor_1_1SubstringExtractor" ] +]; \ No newline at end of file diff --git a/v0.4.9/namespaceformatron_1_1formats.html b/v0.4.9/namespaceformatron_1_1formats.html new file mode 100644 index 0000000..62af738 --- /dev/null +++ b/v0.4.9/namespaceformatron_1_1formats.html @@ -0,0 +1,154 @@ + + + + + + + + +Formatron: formatron.formats Namespace Reference + + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Formatron v0.4.9 + + +
    +
    Formatron empowers everyone to control the output format of language models with minimal overhead.
    +
    +
    + + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    +
    +
    +
    +
    +
    Loading...
    +
    Searching...
    +
    No Matches
    +
    +
    +
    +
    + +
    + +
    formatron.formats Namespace Reference
    +
    +
    + +

    This subpackage contains modules that operate with concrete formats, like json. +More...

    + + + + + + + + +

    +Namespaces

    namespace  json
     The module defines the JsonExtractor class, which is used to extract data from a string in JSON format.
     
    namespace  regex
     This module contains the RegexExtractor class, which is used to extract data using a regular expression.
     
    +

    Detailed Description

    +

    This subpackage contains modules that operate with concrete formats, like json.

    +
    +
    + + + + diff --git a/v0.4.9/namespaceformatron_1_1formats.js b/v0.4.9/namespaceformatron_1_1formats.js new file mode 100644 index 0000000..97497b1 --- /dev/null +++ b/v0.4.9/namespaceformatron_1_1formats.js @@ -0,0 +1,5 @@ +var namespaceformatron_1_1formats = +[ + [ "json", "namespaceformatron_1_1formats_1_1json.html", "namespaceformatron_1_1formats_1_1json" ], + [ "regex", "namespaceformatron_1_1formats_1_1regex.html", "namespaceformatron_1_1formats_1_1regex" ] +]; \ No newline at end of file diff --git a/v0.4.9/namespaceformatron_1_1formats_1_1json.html b/v0.4.9/namespaceformatron_1_1formats_1_1json.html new file mode 100644 index 0000000..10af8d2 --- /dev/null +++ b/v0.4.9/namespaceformatron_1_1formats_1_1json.html @@ -0,0 +1,345 @@ + + + + + + + + +Formatron: formatron.formats.json Namespace Reference + + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Formatron v0.4.9 + + +
    +
    Formatron empowers everyone to control the output format of language models with minimal overhead.
    +
    +
    + + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    +
    +
    +
    +
    +
    Loading...
    +
    Searching...
    +
    No Matches
    +
    +
    +
    +
    + +
    + +
    formatron.formats.json Namespace Reference
    +
    +
    + +

    The module defines the JsonExtractor class, which is used to extract data from a string in JSON format. +More...

    + + + + + +

    +Classes

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

    +Functions

    None 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.
     
     _register_all_predefined_types ()
     
    str _generate_kbnf_grammar (schemas.schema.Schema|collections.abc.Sequence schema, str start_nonterminal)
     Generate a KBNF grammar string from a schema for JSON format.
     
    + + + + + + + +

    +Variables

    str SPACE_NONTERMINAL = "[ \t\n\r]*"
     
    str GRAMMAR_HEADER
     
    list _type_to_nonterminals
     
    +

    Detailed Description

    +

    The module defines the JsonExtractor class, which is used to extract data from a string in JSON format.

    +

    Function Documentation

    + +

    ◆ _generate_kbnf_grammar()

    + +
    +
    + + + + + +
    + + + + + + + + + + + +
    str formatron.formats.json._generate_kbnf_grammar (schemas.schema.Schema|collections.abc.Sequence schema,
    str start_nonterminal )
    +
    +protected
    +
    + +

    Generate a KBNF grammar string from a schema for JSON format.

    +
    Parameters
    + + + +
    schemaThe schema to generate a grammar for.
    start_nonterminalThe start nonterminal of the grammar. Default is "start".
    +
    +
    +
    Returns
    The generated KBNF grammar string.
    + +

    Definition at line 387 of file json.py.

    + +
    +
    + +

    ◆ _register_all_predefined_types()

    + +
    +
    + + + + + +
    + + + + + + + +
    formatron.formats.json._register_all_predefined_types ()
    +
    +protected
    +
    + +

    Definition at line 57 of file json.py.

    + +
    +
    + +

    ◆ register_generate_nonterminal_def()

    + +
    +
    + + + + + + + +
    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.

    +

    The callable returns (nonterminal_definition, [(sub_type, sub_nonterminal), ...]) if the type is supported by this callable, otherwise None. [(sub_type, sub_nonterminal), ...] are the types and nonterminals used in nonterminal_definition that may need to be generated in the grammar too.

    +
    Parameters
    + + +
    generate_nonterminal_defA callable to generate nonterminal definition from a type.
    +
    +
    + +

    Definition at line 49 of file json.py.

    + +
    +
    +

    Variable Documentation

    + +

    ◆ _type_to_nonterminals

    + +
    +
    + + + + + +
    + + + + +
    list formatron.formats.json._type_to_nonterminals
    +
    +protected
    +
    + +

    Definition at line 36 of file json.py.

    + +
    +
    + +

    ◆ GRAMMAR_HEADER

    + +
    +
    + + + + +
    str formatron.formats.json.GRAMMAR_HEADER
    +
    +Initial value:
    1= rf"""integer ::= #"-?(0|[1-9][0-9]*)";
    +
    2number ::= #"-?(0|[1-9][0-9]*)(\\.[0-9]+)?([eE][+-]?[0-9]+)?";
    +
    3string ::= #'"([^\\\\"\u0000-\u001f]|\\\\["\\\\bfnrt/]|\\\\u[0-9A-Fa-f]{{4}})*"';
    +
    4boolean ::= "true"|"false";
    +
    5null ::= "null";
    +
    6array ::= array_begin (json_value (comma json_value)*)? array_end;
    +
    7object ::= object_begin (string colon json_value (comma string colon json_value)*)? object_end;
    +
    8json_value ::= number|string|boolean|null|array|object;
    +
    9comma ::= #"{SPACE_NONTERMINAL},{SPACE_NONTERMINAL}";
    +
    10colon ::= #"{SPACE_NONTERMINAL}:{SPACE_NONTERMINAL}";
    +
    11object_begin ::= #"\\{{{SPACE_NONTERMINAL}";
    +
    12object_end ::= #"{SPACE_NONTERMINAL}\\}}";
    +
    13array_begin ::= #"\\[{SPACE_NONTERMINAL}";
    +
    14array_end ::= #"{SPACE_NONTERMINAL}\\]";
    +
    15"""
    +
    +

    Definition at line 18 of file json.py.

    + +
    +
    + +

    ◆ SPACE_NONTERMINAL

    + +
    +
    + + + + +
    str formatron.formats.json.SPACE_NONTERMINAL = "[ \t\n\r]*"
    +
    + +

    Definition at line 16 of file json.py.

    + +
    +
    +
    +
    + + + + diff --git a/v0.4.9/namespaceformatron_1_1formats_1_1json.js b/v0.4.9/namespaceformatron_1_1formats_1_1json.js new file mode 100644 index 0000000..6792c83 --- /dev/null +++ b/v0.4.9/namespaceformatron_1_1formats_1_1json.js @@ -0,0 +1,10 @@ +var namespaceformatron_1_1formats_1_1json = +[ + [ "JsonExtractor", "classformatron_1_1formats_1_1json_1_1JsonExtractor.html", "classformatron_1_1formats_1_1json_1_1JsonExtractor" ], + [ "_generate_kbnf_grammar", "namespaceformatron_1_1formats_1_1json.html#af4331f1a7679439503d898b2356d289e", null ], + [ "_register_all_predefined_types", "namespaceformatron_1_1formats_1_1json.html#a311b750cba3838aee622b9809888f051", null ], + [ "register_generate_nonterminal_def", "namespaceformatron_1_1formats_1_1json.html#a55ae1cd2ef251d160e872a0c49e7ba7a", null ], + [ "_type_to_nonterminals", "namespaceformatron_1_1formats_1_1json.html#a003a1dac95634ac70f86d51e768945a4", null ], + [ "GRAMMAR_HEADER", "namespaceformatron_1_1formats_1_1json.html#ac81c86f8a6384cf3b11c47ddf2049ca7", null ], + [ "SPACE_NONTERMINAL", "namespaceformatron_1_1formats_1_1json.html#af32c4b136b54f0356b017d6a319bb53d", null ] +]; \ No newline at end of file diff --git a/v0.4.9/namespaceformatron_1_1formats_1_1regex.html b/v0.4.9/namespaceformatron_1_1formats_1_1regex.html new file mode 100644 index 0000000..8a0016b --- /dev/null +++ b/v0.4.9/namespaceformatron_1_1formats_1_1regex.html @@ -0,0 +1,154 @@ + + + + + + + + +Formatron: formatron.formats.regex Namespace Reference + + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Formatron v0.4.9 + + +
    +
    Formatron empowers everyone to control the output format of language models with minimal overhead.
    +
    +
    + + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    +
    +
    +
    +
    +
    Loading...
    +
    Searching...
    +
    No Matches
    +
    +
    +
    +
    + +
    + +
    formatron.formats.regex Namespace Reference
    +
    +
    + +

    This module contains the RegexExtractor class, which is used to extract data using a regular expression. +More...

    + + + + + + + + +

    +Classes

    class  RegexComplementExtractor
     An extractor that extracts data by matching a regex complement. More...
     
    class  RegexExtractor
     An extractor that extracts a string using a regular expression. More...
     
    +

    Detailed Description

    +

    This module contains the RegexExtractor class, which is used to extract data using a regular expression.

    +
    +
    + + + + diff --git a/v0.4.9/namespaceformatron_1_1formats_1_1regex.js b/v0.4.9/namespaceformatron_1_1formats_1_1regex.js new file mode 100644 index 0000000..650836c --- /dev/null +++ b/v0.4.9/namespaceformatron_1_1formats_1_1regex.js @@ -0,0 +1,5 @@ +var namespaceformatron_1_1formats_1_1regex = +[ + [ "RegexComplementExtractor", "classformatron_1_1formats_1_1regex_1_1RegexComplementExtractor.html", "classformatron_1_1formats_1_1regex_1_1RegexComplementExtractor" ], + [ "RegexExtractor", "classformatron_1_1formats_1_1regex_1_1RegexExtractor.html", "classformatron_1_1formats_1_1regex_1_1RegexExtractor" ] +]; \ No newline at end of file diff --git a/v0.4.9/namespaceformatron_1_1formatter.html b/v0.4.9/namespaceformatron_1_1formatter.html new file mode 100644 index 0000000..d527303 --- /dev/null +++ b/v0.4.9/namespaceformatron_1_1formatter.html @@ -0,0 +1,156 @@ + + + + + + + + +Formatron: formatron.formatter Namespace Reference + + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Formatron v0.4.9 + + +
    +
    Formatron empowers everyone to control the output format of language models with minimal overhead.
    +
    +
    + + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    +
    +
    +
    +
    +
    Loading...
    +
    Searching...
    +
    No Matches
    +
    +
    +
    +
    + +
    + +
    formatron.formatter Namespace Reference
    +
    +
    + +

    This module contains the Formatter class and its related classes. +More...

    + + + + + + + + + + +

    +Classes

    class  Formatter
     
    class  FormatterBase
     An abstract Formatter that enforces a format on the string generated by a language model. More...
     
    class  FormatterBuilder
     A builder for creating a Formatter. More...
     
    +

    Detailed Description

    +

    This module contains the Formatter class and its related classes.

    +
    +
    + + + + diff --git a/v0.4.9/namespaceformatron_1_1formatter.js b/v0.4.9/namespaceformatron_1_1formatter.js new file mode 100644 index 0000000..44fcd78 --- /dev/null +++ b/v0.4.9/namespaceformatron_1_1formatter.js @@ -0,0 +1,6 @@ +var namespaceformatron_1_1formatter = +[ + [ "Formatter", "classformatron_1_1formatter_1_1Formatter.html", "classformatron_1_1formatter_1_1Formatter" ], + [ "FormatterBase", "classformatron_1_1formatter_1_1FormatterBase.html", "classformatron_1_1formatter_1_1FormatterBase" ], + [ "FormatterBuilder", "classformatron_1_1formatter_1_1FormatterBuilder.html", "classformatron_1_1formatter_1_1FormatterBuilder" ] +]; \ No newline at end of file diff --git a/v0.4.9/namespaceformatron_1_1integrations.html b/v0.4.9/namespaceformatron_1_1integrations.html new file mode 100644 index 0000000..7236958 --- /dev/null +++ b/v0.4.9/namespaceformatron_1_1integrations.html @@ -0,0 +1,162 @@ + + + + + + + + +Formatron: formatron.integrations Namespace Reference + + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Formatron v0.4.9 + + +
    +
    Formatron empowers everyone to control the output format of language models with minimal overhead.
    +
    +
    + + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    +
    +
    +
    +
    +
    Loading...
    +
    Searching...
    +
    No Matches
    +
    +
    +
    +
    + +
    + +
    formatron.integrations Namespace Reference
    +
    +
    + +

    This subpackage contains integrations with other frameworks and libraries. +More...

    + + + + + + + + + + + + + + + + +

    +Namespaces

    namespace  exllamav2
     This module integrates the ExLlamaV2 library by providing convenience utilities.
     
    namespace  RWKV
     This module integrates the RWKV library by providing convenience utilities.
     
    namespace  transformers
     This module integrates the transformers library by providing convenience utilities.
     
    namespace  utils
     
    namespace  vllm
     This module integrates the vllm library by providing convenience utilities.
     
    +

    Detailed Description

    +

    This subpackage contains integrations with other frameworks and libraries.

    +
    +
    + + + + diff --git a/v0.4.9/namespaceformatron_1_1integrations.js b/v0.4.9/namespaceformatron_1_1integrations.js new file mode 100644 index 0000000..f24efc7 --- /dev/null +++ b/v0.4.9/namespaceformatron_1_1integrations.js @@ -0,0 +1,16 @@ +var namespaceformatron_1_1integrations = +[ + [ "exllamav2", "namespaceformatron_1_1integrations_1_1exllamav2.html", "namespaceformatron_1_1integrations_1_1exllamav2" ], + [ "RWKV", "namespaceformatron_1_1integrations_1_1RWKV.html", "namespaceformatron_1_1integrations_1_1RWKV" ], + [ "transformers", "namespaceformatron_1_1integrations_1_1transformers.html", "namespaceformatron_1_1integrations_1_1transformers" ], + [ "utils", "namespaceformatron_1_1integrations_1_1utils.html", [ + [ "_huggingface_bytelevel_decoder", "namespaceformatron_1_1integrations_1_1utils.html#a4e53f8f5754530f8fa7d627504c98f6a", null ], + [ "_multiple_replace", "namespaceformatron_1_1integrations_1_1utils.html#a49fe0eaafb8d1f9909e2d2520c2ea657", null ], + [ "autodetect_processors", "namespaceformatron_1_1integrations_1_1utils.html#ae2a9a65fa02be2e0d6d41b24e276cbf4", null ], + [ "get_original_characters", "namespaceformatron_1_1integrations_1_1utils.html#a744e97099675a1aac1c24fd6a1398efd", null ], + [ "update_vocab_0xHH", "namespaceformatron_1_1integrations_1_1utils.html#a27f1dbe46fdc2c2cf911fdb026972045", null ], + [ "update_vocab_dot_G", "namespaceformatron_1_1integrations_1_1utils.html#a5f8874cc6515daae855acc1dbc2b94aa", null ], + [ "update_vocab_sentencepiece", "namespaceformatron_1_1integrations_1_1utils.html#ac064c70217efb9b48e440985aee10918", null ] + ] ], + [ "vllm", "namespaceformatron_1_1integrations_1_1vllm.html", "namespaceformatron_1_1integrations_1_1vllm" ] +]; \ No newline at end of file diff --git a/v0.4.9/namespaceformatron_1_1integrations_1_1RWKV.html b/v0.4.9/namespaceformatron_1_1integrations_1_1RWKV.html new file mode 100644 index 0000000..d29411c --- /dev/null +++ b/v0.4.9/namespaceformatron_1_1integrations_1_1RWKV.html @@ -0,0 +1,187 @@ + + + + + + + + +Formatron: formatron.integrations.RWKV Namespace Reference + + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Formatron v0.4.9 + + +
    +
    Formatron empowers everyone to control the output format of language models with minimal overhead.
    +
    +
    + + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    +
    +
    +
    +
    +
    Loading...
    +
    Searching...
    +
    No Matches
    +
    +
    +
    +
    + +
    + +
    formatron.integrations.RWKV Namespace Reference
    +
    +
    + +

    This module integrates the RWKV library by providing convenience utilities. +More...

    + + + + + + + + +

    +Classes

    class  PIPELINE
     A wrapper for the pipeline of RWKV. More...
     
    class  PIPELINE_ARGS
     A wrapper for the arguments of the pipeline of RWKV. More...
     
    + + + + +

    +Functions

    kbnf.Vocabulary create_engine_vocabulary (str WORD_NAME, tokenizer)
     Create a vocabulary for the KBNF engine.
     
    +

    Detailed Description

    +

    This module integrates the RWKV library by providing convenience utilities.

    +

    Function Documentation

    + +

    ◆ create_engine_vocabulary()

    + +
    +
    + + + + + + + + + + + +
    kbnf.Vocabulary formatron.integrations.RWKV.create_engine_vocabulary (str WORD_NAME,
    tokenizer )
    +
    + +

    Create a vocabulary for the KBNF engine.

    + +

    Definition at line 37 of file RWKV.py.

    + +
    +
    +
    +
    + + + + diff --git a/v0.4.9/namespaceformatron_1_1integrations_1_1RWKV.js b/v0.4.9/namespaceformatron_1_1integrations_1_1RWKV.js new file mode 100644 index 0000000..57923dd --- /dev/null +++ b/v0.4.9/namespaceformatron_1_1integrations_1_1RWKV.js @@ -0,0 +1,6 @@ +var namespaceformatron_1_1integrations_1_1RWKV = +[ + [ "PIPELINE", "classformatron_1_1integrations_1_1RWKV_1_1PIPELINE.html", "classformatron_1_1integrations_1_1RWKV_1_1PIPELINE" ], + [ "PIPELINE_ARGS", "classformatron_1_1integrations_1_1RWKV_1_1PIPELINE__ARGS.html", "classformatron_1_1integrations_1_1RWKV_1_1PIPELINE__ARGS" ], + [ "create_engine_vocabulary", "namespaceformatron_1_1integrations_1_1RWKV.html#a2fc99d20bbcc438cc823a728cbc999ea", null ] +]; \ No newline at end of file diff --git a/v0.4.9/namespaceformatron_1_1integrations_1_1exllamav2.html b/v0.4.9/namespaceformatron_1_1integrations_1_1exllamav2.html new file mode 100644 index 0000000..6e1698b --- /dev/null +++ b/v0.4.9/namespaceformatron_1_1integrations_1_1exllamav2.html @@ -0,0 +1,244 @@ + + + + + + + + +Formatron: formatron.integrations.exllamav2 Namespace Reference + + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Formatron v0.4.9 + + +
    +
    Formatron empowers everyone to control the output format of language models with minimal overhead.
    +
    +
    + + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    +
    +
    +
    +
    +
    Loading...
    +
    Searching...
    +
    No Matches
    +
    +
    +
    +
    + +
    + +
    formatron.integrations.exllamav2 Namespace Reference
    +
    +
    + +

    This module integrates the ExLlamaV2 library by providing convenience utilities. +More...

    + + + + + +

    +Classes

    class  FormatterFilter
     ExLlamaV2Filter that uses a formatter to mask logits. More...
     
    + + + + + + + +

    +Functions

    kbnf.Vocabulary create_engine_vocabulary (ExLlamaV2Tokenizer tokenizer, typing.Optional[list[typing.Callable]] vocab_processors=None)
     Create a vocabulary for the KBNF engine.
     
    ExLlamaV2Filter create_formatter_filter (ExLlamaV2 model, ExLlamaV2Tokenizer tokenizer, FormatterBuilder formatter_builder, EngineGenerationConfig engine_config=None, typing.Optional[list[typing.Callable]] vocab_processors=None)
     Create a formatter filter for the ExLlamaV2 engine.
     
    +

    Detailed Description

    +

    This module integrates the ExLlamaV2 library by providing convenience utilities.

    +

    Function Documentation

    + +

    ◆ create_engine_vocabulary()

    + +
    +
    + + + + + + + + + + + +
    kbnf.Vocabulary formatron.integrations.exllamav2.create_engine_vocabulary (ExLlamaV2Tokenizer tokenizer,
    typing.Optional[list[typing.Callable]] vocab_processors = None )
    +
    + +

    Create a vocabulary for the KBNF engine.

    +
    Parameters
    + + + +
    tokenizerThe tokenizer.
    vocab_processorsList of callables with signature (token_to_char: typing.Dict[bytes, bytes])->None. Callables can be used to "unmangle" encoded characters to original characters. If None, processors will be auto-detected.
    +
    +
    + +

    Definition at line 24 of file exllamav2.py.

    + +
    +
    + +

    ◆ create_formatter_filter()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    ExLlamaV2Filter formatron.integrations.exllamav2.create_formatter_filter (ExLlamaV2 model,
    ExLlamaV2Tokenizer tokenizer,
    FormatterBuilder formatter_builder,
    EngineGenerationConfig engine_config = None,
    typing.Optional[list[typing.Callable]] vocab_processors = None )
    +
    + +

    Create a formatter filter for the ExLlamaV2 engine.

    +
    Parameters
    + + + + + + +
    modelThe ExLlamaV2 model.
    tokenizerThe ExLlamaV2 tokenizer.
    formatter_builderThe formatter builder.
    engine_configThe engine generation configuration.
    vocab_processorsList of callables with signature (token_to_char: typing.Dict[bytes, bytes])->None. Callables can be used to "unmangle" encoded characters to original characters. If None, processors will be auto-detected.
    +
    +
    + +

    Definition at line 46 of file exllamav2.py.

    + +
    +
    +
    +
    + + + + diff --git a/v0.4.9/namespaceformatron_1_1integrations_1_1exllamav2.js b/v0.4.9/namespaceformatron_1_1integrations_1_1exllamav2.js new file mode 100644 index 0000000..27d76e9 --- /dev/null +++ b/v0.4.9/namespaceformatron_1_1integrations_1_1exllamav2.js @@ -0,0 +1,6 @@ +var namespaceformatron_1_1integrations_1_1exllamav2 = +[ + [ "FormatterFilter", "classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html", "classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter" ], + [ "create_engine_vocabulary", "namespaceformatron_1_1integrations_1_1exllamav2.html#a80db020f2fd854399834ca7581281a34", null ], + [ "create_formatter_filter", "namespaceformatron_1_1integrations_1_1exllamav2.html#a51e71b1e5ca66beba85e26e8cc322206", null ] +]; \ No newline at end of file diff --git a/v0.4.9/namespaceformatron_1_1integrations_1_1transformers.html b/v0.4.9/namespaceformatron_1_1integrations_1_1transformers.html new file mode 100644 index 0000000..b37e7c6 --- /dev/null +++ b/v0.4.9/namespaceformatron_1_1integrations_1_1transformers.html @@ -0,0 +1,285 @@ + + + + + + + + +Formatron: formatron.integrations.transformers Namespace Reference + + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Formatron v0.4.9 + + +
    +
    Formatron empowers everyone to control the output format of language models with minimal overhead.
    +
    +
    + + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    +
    +
    +
    +
    +
    Loading...
    +
    Searching...
    +
    No Matches
    +
    +
    +
    +
    + +
    + +
    formatron.integrations.transformers Namespace Reference
    +
    +
    + +

    This module integrates the transformers library by providing convenience utilities. +More...

    + + + + + +

    +Classes

    class  FormattersLogitsProcessor
     Logit processor that uses formatters to mask batch logits. More...
     
    + + + + + + + + + + +

    +Functions

    kbnf.Vocabulary create_engine_vocabulary (PreTrainedTokenizerBase tokenizer, typing.Optional[list[typing.Callable]] vocab_processors=None)
     Create a vocabulary for the KBNF engine.
     
    LogitsProcessor create_formatter_logits_processor (PreTrainedTokenizerBase tokenizer, typing.Sequence[FormatterBuilder|None]|FormatterBuilder formatter_builders, typing.Sequence[EngineGenerationConfig] configs=None, typing.Optional[list[typing.Callable]] vocab_processors=None)
     Create a formatter logits processor.
     
    LogitsProcessorList create_formatter_logits_processor_list (PreTrainedTokenizerBase tokenizer, typing.Sequence[FormatterBuilder|None]|FormatterBuilder formatter_builders, typing.Sequence[EngineGenerationConfig] configs=None, typing.Optional[list[typing.Callable]] vocab_processors=None)
     Create a formatter logits processor list.
     
    +

    Detailed Description

    +

    This module integrates the transformers library by providing convenience utilities.

    +

    Function Documentation

    + +

    ◆ create_engine_vocabulary()

    + +
    +
    + + + + + + + + + + + +
    kbnf.Vocabulary formatron.integrations.transformers.create_engine_vocabulary (PreTrainedTokenizerBase tokenizer,
    typing.Optional[list[typing.Callable]] vocab_processors = None )
    +
    + +

    Create a vocabulary for the KBNF engine.

    +
    Parameters
    + + + +
    tokenizerThe tokenizer.
    vocab_processorsList of callables with signature (token_to_char: typing.Dict[bytes, bytes])->None. Callables can be used to "unmangle" encoded characters to original characters. If None, processors will be auto-detected.
    +
    +
    + +

    Definition at line 24 of file transformers.py.

    + +
    +
    + +

    ◆ create_formatter_logits_processor()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + +
    LogitsProcessor formatron.integrations.transformers.create_formatter_logits_processor (PreTrainedTokenizerBase tokenizer,
    typing.Sequence[FormatterBuilder | None] | FormatterBuilder formatter_builders,
    typing.Sequence[EngineGenerationConfig] configs = None,
    typing.Optional[list[typing.Callable]] vocab_processors = None )
    +
    + +

    Create a formatter logits processor.

    +
    Parameters
    + + + + + +
    tokenizerThe tokenizer.
    formatter_buildersThe formatter builders.
    configsThe engine generation configurations.
    vocab_processorsList of callables with signature (token_to_char: typing.Dict[bytes, bytes])->None. Callables can be used to "unmangle" encoded characters to original characters. If None, processors will be auto-detected.
    +
    +
    + +

    Definition at line 41 of file transformers.py.

    + +
    +
    + +

    ◆ create_formatter_logits_processor_list()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + +
    LogitsProcessorList formatron.integrations.transformers.create_formatter_logits_processor_list (PreTrainedTokenizerBase tokenizer,
    typing.Sequence[FormatterBuilder | None] | FormatterBuilder formatter_builders,
    typing.Sequence[EngineGenerationConfig] configs = None,
    typing.Optional[list[typing.Callable]] vocab_processors = None )
    +
    + +

    Create a formatter logits processor list.

    +
    Parameters
    + + + + + +
    tokenizerThe tokenizer.
    formatter_buildersThe formatter builders.
    configsThe engine generation configurations.
    vocab_processorsList of callables with signature (token_to_char: typing.Dict[bytes, bytes])->None. Callables can be used to "unmangle" encoded characters to original characters. If None, processors will be auto-detected.
    +
    +
    + +

    Definition at line 62 of file transformers.py.

    + +
    +
    +
    +
    + + + + diff --git a/v0.4.9/namespaceformatron_1_1integrations_1_1transformers.js b/v0.4.9/namespaceformatron_1_1integrations_1_1transformers.js new file mode 100644 index 0000000..9d9c330 --- /dev/null +++ b/v0.4.9/namespaceformatron_1_1integrations_1_1transformers.js @@ -0,0 +1,7 @@ +var namespaceformatron_1_1integrations_1_1transformers = +[ + [ "FormattersLogitsProcessor", "classformatron_1_1integrations_1_1transformers_1_1FormattersLogitsProcessor.html", "classformatron_1_1integrations_1_1transformers_1_1FormattersLogitsProcessor" ], + [ "create_engine_vocabulary", "namespaceformatron_1_1integrations_1_1transformers.html#af7d64821b9ef2da7cca0d710cb4e68a7", null ], + [ "create_formatter_logits_processor", "namespaceformatron_1_1integrations_1_1transformers.html#a8a01b497582979cece92538df6463939", null ], + [ "create_formatter_logits_processor_list", "namespaceformatron_1_1integrations_1_1transformers.html#aa521d14eb09f692c5930b52373f00203", null ] +]; \ No newline at end of file diff --git a/v0.4.9/namespaceformatron_1_1integrations_1_1utils.html b/v0.4.9/namespaceformatron_1_1integrations_1_1utils.html new file mode 100644 index 0000000..267afec --- /dev/null +++ b/v0.4.9/namespaceformatron_1_1integrations_1_1utils.html @@ -0,0 +1,345 @@ + + + + + + + + +Formatron: formatron.integrations.utils Namespace Reference + + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Formatron v0.4.9 + + +
    +
    Formatron empowers everyone to control the output format of language models with minimal overhead.
    +
    +
    + + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    +
    +
    +
    +
    +
    Loading...
    +
    Searching...
    +
    No Matches
    +
    +
    +
    +
    + +
    + +
    formatron.integrations.utils Namespace Reference
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + +

    +Functions

    bytes _multiple_replace (typing.Dict[bytes, bytes] replacements, re.Pattern[bytes] regex, bytes text)
     
    typing.Dict[int, bytes] get_original_characters (typing.Dict[str, int] vocab, typing.Optional[list[typing.Callable]] processors=None)
     Get a vocabulary of original characters unmangled to raw UTF-8 bytes by the provided processors.
     
    typing.List[typing.Callable] autodetect_processors (typing.Dict[str, int] vocab)
     Autodetect vocabulary processors.
     
     update_vocab_0xHH (typing.Dict[bytes, bytes] token_to_char)
     Vocabulary processor for <0xHH> tokens (used in llama tokenizers)
     
     update_vocab_sentencepiece (typing.Dict[bytes, bytes] token_to_char)
     Vocabulary processor for ▁ token (used in sentencepiece tokenizers)
     
     update_vocab_dot_G (typing.Dict[bytes, bytes] token_to_char)
     Vocabulary processor for GPT2 style token mangling, like from \n to Ġ(used in huggingface bytelevel preprocessors)
     
     _huggingface_bytelevel_decoder ()
     I hate legacy code.
     
    +

    Function Documentation

    + +

    ◆ _huggingface_bytelevel_decoder()

    + +
    +
    + + + + + +
    + + + + + + + +
    formatron.integrations.utils._huggingface_bytelevel_decoder ()
    +
    +protected
    +
    + +

    I hate legacy code.

    + +

    Definition at line 83 of file utils.py.

    + +
    +
    + +

    ◆ _multiple_replace()

    + +
    +
    + + + + + +
    + + + + + + + + + + + + + + + + +
    bytes formatron.integrations.utils._multiple_replace (typing.Dict[bytes, bytes] replacements,
    re.Pattern[bytes] regex,
    bytes text )
    +
    +protected
    +
    + +

    Definition at line 7 of file utils.py.

    + +
    +
    + +

    ◆ autodetect_processors()

    + +
    +
    + + + + + + + +
    typing.List[typing.Callable] formatron.integrations.utils.autodetect_processors (typing.Dict[str, int] vocab)
    +
    + +

    Autodetect vocabulary processors.

    + +

    Definition at line 41 of file utils.py.

    + +
    +
    + +

    ◆ get_original_characters()

    + +
    +
    + + + + + + + + + + + +
    typing.Dict[int, bytes] formatron.integrations.utils.get_original_characters (typing.Dict[str, int] vocab,
    typing.Optional[list[typing.Callable]] processors = None )
    +
    + +

    Get a vocabulary of original characters unmangled to raw UTF-8 bytes by the provided processors.

    +
    Parameters
    + + + +
    vocabThe mangled vocabulary.
    processorsList of callables with signature (token_to_char: typing.Dict[bytes, bytes])->None. Callables can be used to "unmangle" encoded characters to original characters. If None, processors will be auto-detected.
    +
    +
    + +

    Definition at line 20 of file utils.py.

    + +
    +
    + +

    ◆ update_vocab_0xHH()

    + +
    +
    + + + + + + + +
    formatron.integrations.utils.update_vocab_0xHH (typing.Dict[bytes, bytes] token_to_char)
    +
    + +

    Vocabulary processor for <0xHH> tokens (used in llama tokenizers)

    + +

    Definition at line 58 of file utils.py.

    + +
    +
    + +

    ◆ update_vocab_dot_G()

    + +
    +
    + + + + + + + +
    formatron.integrations.utils.update_vocab_dot_G (typing.Dict[bytes, bytes] token_to_char)
    +
    + +

    Vocabulary processor for GPT2 style token mangling, like from \n to Ġ(used in huggingface bytelevel preprocessors)

    + +

    Definition at line 73 of file utils.py.

    + +
    +
    + +

    ◆ update_vocab_sentencepiece()

    + +
    +
    + + + + + + + +
    formatron.integrations.utils.update_vocab_sentencepiece (typing.Dict[bytes, bytes] token_to_char)
    +
    + +

    Vocabulary processor for ▁ token (used in sentencepiece tokenizers)

    + +

    Definition at line 66 of file utils.py.

    + +
    +
    +
    +
    + + + + diff --git a/v0.4.9/namespaceformatron_1_1integrations_1_1vllm.html b/v0.4.9/namespaceformatron_1_1integrations_1_1vllm.html new file mode 100644 index 0000000..ce6b43d --- /dev/null +++ b/v0.4.9/namespaceformatron_1_1integrations_1_1vllm.html @@ -0,0 +1,238 @@ + + + + + + + + +Formatron: formatron.integrations.vllm Namespace Reference + + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Formatron v0.4.9 + + +
    +
    Formatron empowers everyone to control the output format of language models with minimal overhead.
    +
    +
    + + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    +
    +
    +
    +
    +
    Loading...
    +
    Searching...
    +
    No Matches
    +
    +
    +
    +
    + +
    + +
    formatron.integrations.vllm Namespace Reference
    +
    +
    + +

    This module integrates the vllm library by providing convenience utilities. +More...

    + + + + + +

    +Classes

    class  FormattersLogitsProcessor
     Logit processor that uses formatters to mask batch logits. More...
     
    + + + + + + + +

    +Functions

    kbnf.Vocabulary create_engine_vocabulary (AnyTokenizer tokenizer, typing.Optional[list[typing.Callable]] vocab_processors=None)
     Create a vocabulary for the KBNF engine.
     
    FormattersLogitsProcessor create_formatters_logits_processor (LLM llm, typing.Sequence[FormatterBuilder|None]|FormatterBuilder formatter_builders, typing.Sequence[EngineGenerationConfig] configs=None, typing.Optional[list[typing.Callable]] vocab_processors=None)
     Create a formatter logits processor.
     
    +

    Detailed Description

    +

    This module integrates the vllm library by providing convenience utilities.

    +

    Function Documentation

    + +

    ◆ create_engine_vocabulary()

    + +
    +
    + + + + + + + + + + + +
    kbnf.Vocabulary formatron.integrations.vllm.create_engine_vocabulary (AnyTokenizer tokenizer,
    typing.Optional[list[typing.Callable]] vocab_processors = None )
    +
    + +

    Create a vocabulary for the KBNF engine.

    +
    Parameters
    + + + +
    tokenizerThe tokenizer.
    vocab_processorsList of callables with signature (token_to_char: typing.Dict[bytes, bytes])->None. Callables can be used to "unmangle" encoded characters to original characters. If None, processors will be auto-detected.
    +
    +
    + +

    Definition at line 116 of file vllm.py.

    + +
    +
    + +

    ◆ create_formatters_logits_processor()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + +
    FormattersLogitsProcessor formatron.integrations.vllm.create_formatters_logits_processor (LLM llm,
    typing.Sequence[FormatterBuilder | None] | FormatterBuilder formatter_builders,
    typing.Sequence[EngineGenerationConfig] configs = None,
    typing.Optional[list[typing.Callable]] vocab_processors = None )
    +
    + +

    Create a formatter logits processor.

    +
    Parameters
    + + + + + +
    llmThe LLM.
    formatter_buildersThe formatter builders.
    configsThe engine generation configurations.
    vocab_processorsList of callables with signature (token_to_char: typing.Dict[bytes, bytes])->None. Callables can be used to "unmangle" encoded characters to original characters. If None, processors will be auto-detected.
    +
    +
    + +

    Definition at line 133 of file vllm.py.

    + +
    +
    +
    +
    + + + + diff --git a/v0.4.9/namespaceformatron_1_1integrations_1_1vllm.js b/v0.4.9/namespaceformatron_1_1integrations_1_1vllm.js new file mode 100644 index 0000000..9f4c181 --- /dev/null +++ b/v0.4.9/namespaceformatron_1_1integrations_1_1vllm.js @@ -0,0 +1,6 @@ +var namespaceformatron_1_1integrations_1_1vllm = +[ + [ "FormattersLogitsProcessor", "classformatron_1_1integrations_1_1vllm_1_1FormattersLogitsProcessor.html", "classformatron_1_1integrations_1_1vllm_1_1FormattersLogitsProcessor" ], + [ "create_engine_vocabulary", "namespaceformatron_1_1integrations_1_1vllm.html#a16d6196bbdb008cc80ca59b860ccfc80", null ], + [ "create_formatters_logits_processor", "namespaceformatron_1_1integrations_1_1vllm.html#ae67ec5e8c8a65188f4720a0c921723b6", null ] +]; \ No newline at end of file diff --git a/v0.4.9/namespaceformatron_1_1schemas.html b/v0.4.9/namespaceformatron_1_1schemas.html new file mode 100644 index 0000000..3abf571 --- /dev/null +++ b/v0.4.9/namespaceformatron_1_1schemas.html @@ -0,0 +1,160 @@ + + + + + + + + +Formatron: formatron.schemas Namespace Reference + + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Formatron v0.4.9 + + +
    +
    Formatron empowers everyone to control the output format of language models with minimal overhead.
    +
    +
    + + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    +
    +
    +
    +
    +
    Loading...
    +
    Searching...
    +
    No Matches
    +
    +
    +
    +
    + +
    + +
    formatron.schemas Namespace Reference
    +
    +
    + +

    This subpackage contains modules that define schemas creation from various sources. +More...

    + + + + + + + + + + + + + + +

    +Namespaces

    namespace  dict_inference
     This module contains utilities for inferring schemas from dictionaries.
     
    namespace  json_schema
     This module contains utilities for creating schemas from JSON schemas.
     
    namespace  pydantic
     A module that implements the Schema interface using pydantic.
     
    namespace  schema
     This module contains the Schema abstract class and FieldInfo abstract class.
     
    +

    Detailed Description

    +

    This subpackage contains modules that define schemas creation from various sources.

    +
    +
    + + + + diff --git a/v0.4.9/namespaceformatron_1_1schemas.js b/v0.4.9/namespaceformatron_1_1schemas.js new file mode 100644 index 0000000..61a41c4 --- /dev/null +++ b/v0.4.9/namespaceformatron_1_1schemas.js @@ -0,0 +1,7 @@ +var namespaceformatron_1_1schemas = +[ + [ "dict_inference", "namespaceformatron_1_1schemas_1_1dict__inference.html", "namespaceformatron_1_1schemas_1_1dict__inference" ], + [ "json_schema", "namespaceformatron_1_1schemas_1_1json__schema.html", "namespaceformatron_1_1schemas_1_1json__schema" ], + [ "pydantic", "namespaceformatron_1_1schemas_1_1pydantic.html", "namespaceformatron_1_1schemas_1_1pydantic" ], + [ "schema", "namespaceformatron_1_1schemas_1_1schema.html", "namespaceformatron_1_1schemas_1_1schema" ] +]; \ No newline at end of file diff --git a/v0.4.9/namespaceformatron_1_1schemas_1_1dict__inference.html b/v0.4.9/namespaceformatron_1_1schemas_1_1dict__inference.html new file mode 100644 index 0000000..ea83f14 --- /dev/null +++ b/v0.4.9/namespaceformatron_1_1schemas_1_1dict__inference.html @@ -0,0 +1,213 @@ + + + + + + + + +Formatron: formatron.schemas.dict_inference Namespace Reference + + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Formatron v0.4.9 + + +
    +
    Formatron empowers everyone to control the output format of language models with minimal overhead.
    +
    +
    + + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    +
    +
    +
    +
    +
    Loading...
    +
    Searching...
    +
    No Matches
    +
    +
    +
    +
    + +
    + +
    formatron.schemas.dict_inference Namespace Reference
    +
    +
    + +

    This module contains utilities for inferring schemas from dictionaries. +More...

    + + + + +

    +Classes

    class  FieldInfo
     
    + + + + + + +

    +Functions

    Type[Any] _infer_type (Any value)
     
    typing.Type[schemas.schema.Schemainfer_mapping (collections.abc.Mapping[str, Any] mapping)
     Recursively infer a schema from a mapping.
     
    +

    Detailed Description

    +

    This module contains utilities for inferring schemas from dictionaries.

    +

    Function Documentation

    + +

    ◆ _infer_type()

    + +
    +
    + + + + + +
    + + + + + + + +
    Type[Any] formatron.schemas.dict_inference._infer_type (Any value)
    +
    +protected
    +
    + +

    Definition at line 59 of file dict_inference.py.

    + +
    +
    + +

    ◆ infer_mapping()

    + +
    +
    + + + + + + + +
    typing.Type[schemas.schema.Schema] formatron.schemas.dict_inference.infer_mapping (collections.abc.Mapping[str, Any] mapping)
    +
    + +

    Recursively infer a schema from a mapping.

    +

    Types that are specially handled:

      +
    • collections.abc.Mapping: converted to a schema. Keys are converted to field names and corresponding value types are converted to field types.
    • +
    • collections.abc.Sequence with heterogeneous elements: all different element types are included in a union type.
    • +
    +

    Other types are directly inferred from the type of the value with no special handling.

    + +

    Definition at line 95 of file dict_inference.py.

    + +
    +
    +
    +
    + + + + diff --git a/v0.4.9/namespaceformatron_1_1schemas_1_1dict__inference.js b/v0.4.9/namespaceformatron_1_1schemas_1_1dict__inference.js new file mode 100644 index 0000000..33715b0 --- /dev/null +++ b/v0.4.9/namespaceformatron_1_1schemas_1_1dict__inference.js @@ -0,0 +1,6 @@ +var namespaceformatron_1_1schemas_1_1dict__inference = +[ + [ "FieldInfo", "classformatron_1_1schemas_1_1dict__inference_1_1FieldInfo.html", "classformatron_1_1schemas_1_1dict__inference_1_1FieldInfo" ], + [ "_infer_type", "namespaceformatron_1_1schemas_1_1dict__inference.html#ad5cac24e76dc097a995f31d3d0ff9efc", null ], + [ "infer_mapping", "namespaceformatron_1_1schemas_1_1dict__inference.html#a850490b4a317260a236333130d36a5d8", null ] +]; \ No newline at end of file diff --git a/v0.4.9/namespaceformatron_1_1schemas_1_1json__schema.html b/v0.4.9/namespaceformatron_1_1schemas_1_1json__schema.html new file mode 100644 index 0000000..59f4111 --- /dev/null +++ b/v0.4.9/namespaceformatron_1_1schemas_1_1json__schema.html @@ -0,0 +1,872 @@ + + + + + + + + +Formatron: formatron.schemas.json_schema Namespace Reference + + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Formatron v0.4.9 + + +
    +
    Formatron empowers everyone to control the output format of language models with minimal overhead.
    +
    +
    + + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    +
    +
    +
    +
    +
    Loading...
    +
    Searching...
    +
    No Matches
    +
    +
    +
    +
    + +
    + +
    formatron.schemas.json_schema Namespace Reference
    +
    +
    + +

    This module contains utilities for creating schemas from JSON schemas. +More...

    + + + + +

    +Classes

    class  FieldInfo
     
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    +Functions

    schemas.schema.Schema create_schema (dict[str, typing.Any] schema, registry=Registry())
     Create a Schema object from a JSON schema object.
     
    str _resolve_new_url (str uri, str ref)
     Adapted from https://github.com/python-jsonschema/referencing/blob/main/referencing/_core.py#L667.
     
    None _validate_json_schema (dict[str, typing.Any] schema)
     
    typing.Type _convert_json_schema_to_our_schema (dict[str, typing.Any] schema, dict[int, typing.Type] json_schema_id_to_schema)
     Recursively handle all types needed to fully determine the type of a schema.
     
     _extract_fields_from_object_type (typing.Type object_type)
     
    typing.Type _handle_anyOf (dict[str, typing.Any] schema, dict[int, typing.Type] json_schema_id_to_schema)
     
    typing.Type[typing.Any|None] _infer_type (dict[str, typing.Any] schema, dict[int, typing.Type] json_schema_id_to_schema)
     Infer more specific types.
     
    typing.Any _get_literal (dict[str, typing.Any] schema)
     
    typing.Type _handle_literal (typing.Any literal, typing.Type obtained_type, dict[str, typing.Any] schema, dict[int, typing.Type] json_schema_id_to_schema)
     
    typing.Type _handle_str_with_metadata (dict[str, typing.Any] schema)
     Handle string type with metadata such as maxLength, minLength, and pattern.
     
    typing.Type _handle_numeric_with_metadata (dict[str, typing.Any] schema, typing.Type numeric_type)
     Handle numeric types (int or float) with metadata such as minimum, maximum, exclusiveMinimum, and exclusiveMaximum.
     
    typing.Type _create_custom_type (dict[str, typing.Any] schema, dict[int, typing.Type] json_schema_id_to_schema)
     
    typing.Type _handle_list_metadata (dict[str, typing.Any] schema, dict[int, typing.Type] json_schema_id_to_schema)
     Handle cases where the obtained type is a list.
     
    typing.Type[typing.Any|None] _obtain_type (dict[str, typing.Any] schema, dict[int, typing.Type] json_schema_id_to_schema)
     Directly obtain type information from this schema's type keyword.
     
     _merge_referenced_schema (dict[str, typing.Any] schema, set[int] memo)
     
     _merge_key (dict[str, typing.Any] schema, str ref_key, typing.Any reference_value)
     
     _recursive_resolve_reference (str base_uri, typing.Any schema, Registry registry, set[int] memo)
     
     _resolve_reference (dict[str, typing.Any] schema, str key, typing.Any resolver)
     
    + + + +

    +Variables

    int _counter
     
    +

    Detailed Description

    +

    This module contains utilities for creating schemas from JSON schemas.

    +

    Function Documentation

    + +

    ◆ _convert_json_schema_to_our_schema()

    + +
    +
    + + + + + +
    + + + + + + + + + + + +
    typing.Type formatron.schemas.json_schema._convert_json_schema_to_our_schema (dict[str, typing.Any] schema,
    dict[int, typing.Type] json_schema_id_to_schema )
    +
    +protected
    +
    + +

    Recursively handle all types needed to fully determine the type of a schema.

    + +

    Definition at line 156 of file json_schema.py.

    + +
    +
    + +

    ◆ _create_custom_type()

    + +
    +
    + + + + + +
    + + + + + + + + + + + +
    typing.Type formatron.schemas.json_schema._create_custom_type (dict[str, typing.Any] schema,
    dict[int, typing.Type] json_schema_id_to_schema )
    +
    +protected
    +
    + +

    Definition at line 280 of file json_schema.py.

    + +
    +
    + +

    ◆ _extract_fields_from_object_type()

    + +
    +
    + + + + + +
    + + + + + + + +
    formatron.schemas.json_schema._extract_fields_from_object_type (typing.Type object_type)
    +
    +protected
    +
    + +

    Definition at line 173 of file json_schema.py.

    + +
    +
    + +

    ◆ _get_literal()

    + +
    +
    + + + + + +
    + + + + + + + +
    typing.Any formatron.schemas.json_schema._get_literal (dict[str, typing.Any] schema)
    +
    +protected
    +
    + +

    Definition at line 225 of file json_schema.py.

    + +
    +
    + +

    ◆ _handle_anyOf()

    + +
    +
    + + + + + +
    + + + + + + + + + + + +
    typing.Type formatron.schemas.json_schema._handle_anyOf (dict[str, typing.Any] schema,
    dict[int, typing.Type] json_schema_id_to_schema )
    +
    +protected
    +
    + +

    Definition at line 180 of file json_schema.py.

    + +
    +
    + +

    ◆ _handle_list_metadata()

    + +
    +
    + + + + + +
    + + + + + + + + + + + +
    typing.Type formatron.schemas.json_schema._handle_list_metadata (dict[str, typing.Any] schema,
    dict[int, typing.Type] json_schema_id_to_schema )
    +
    +protected
    +
    + +

    Handle cases where the obtained type is a list.

    + +

    Definition at line 296 of file json_schema.py.

    + +
    +
    + +

    ◆ _handle_literal()

    + +
    +
    + + + + + +
    + + + + + + + + + + + + + + + + + + + + + +
    typing.Type formatron.schemas.json_schema._handle_literal (typing.Any literal,
    typing.Type obtained_type,
    dict[str, typing.Any] schema,
    dict[int, typing.Type] json_schema_id_to_schema )
    +
    +protected
    +
    + +

    Definition at line 230 of file json_schema.py.

    + +
    +
    + +

    ◆ _handle_numeric_with_metadata()

    + +
    +
    + + + + + +
    + + + + + + + + + + + +
    typing.Type formatron.schemas.json_schema._handle_numeric_with_metadata (dict[str, typing.Any] schema,
    typing.Type numeric_type )
    +
    +protected
    +
    + +

    Handle numeric types (int or float) with metadata such as minimum, maximum, exclusiveMinimum, and exclusiveMaximum.

    + +

    Definition at line 263 of file json_schema.py.

    + +
    +
    + +

    ◆ _handle_str_with_metadata()

    + +
    +
    + + + + + +
    + + + + + + + +
    typing.Type formatron.schemas.json_schema._handle_str_with_metadata (dict[str, typing.Any] schema)
    +
    +protected
    +
    + +

    Handle string type with metadata such as maxLength, minLength, and pattern.

    + +

    Definition at line 243 of file json_schema.py.

    + +
    +
    + +

    ◆ _infer_type()

    + +
    +
    + + + + + +
    + + + + + + + + + + + +
    typing.Type[typing.Any | None] formatron.schemas.json_schema._infer_type (dict[str, typing.Any] schema,
    dict[int, typing.Type] json_schema_id_to_schema )
    +
    +protected
    +
    + +

    Infer more specific types.

    + +

    Definition at line 193 of file json_schema.py.

    + +
    +
    + +

    ◆ _merge_key()

    + +
    +
    + + + + + +
    + + + + + + + + + + + + + + + + +
    formatron.schemas.json_schema._merge_key (dict[str, typing.Any] schema,
    str ref_key,
    typing.Any reference_value )
    +
    +protected
    +
    + +

    Definition at line 380 of file json_schema.py.

    + +
    +
    + +

    ◆ _merge_referenced_schema()

    + +
    +
    + + + + + +
    + + + + + + + + + + + +
    formatron.schemas.json_schema._merge_referenced_schema (dict[str, typing.Any] schema,
    set[int] memo )
    +
    +protected
    +
    + +

    Definition at line 361 of file json_schema.py.

    + +
    +
    + +

    ◆ _obtain_type()

    + +
    +
    + + + + + +
    + + + + + + + + + + + +
    typing.Type[typing.Any|None] formatron.schemas.json_schema._obtain_type (dict[str, typing.Any] schema,
    dict[int, typing.Type] json_schema_id_to_schema )
    +
    +protected
    +
    + +

    Directly obtain type information from this schema's type keyword.

    + +

    Definition at line 324 of file json_schema.py.

    + +
    +
    + +

    ◆ _recursive_resolve_reference()

    + +
    +
    + + + + + +
    + + + + + + + + + + + + + + + + + + + + + +
    formatron.schemas.json_schema._recursive_resolve_reference (str base_uri,
    typing.Any schema,
    Registry registry,
    set[int] memo )
    +
    +protected
    +
    + +

    Definition at line 399 of file json_schema.py.

    + +
    +
    + +

    ◆ _resolve_new_url()

    + +
    +
    + + + + + +
    + + + + + + + + + + + +
    str formatron.schemas.json_schema._resolve_new_url (str uri,
    str ref )
    +
    +protected
    +
    +
    + +

    ◆ _resolve_reference()

    + +
    +
    + + + + + +
    + + + + + + + + + + + + + + + + +
    formatron.schemas.json_schema._resolve_reference (dict[str, typing.Any] schema,
    str key,
    typing.Any resolver )
    +
    +protected
    +
    + +

    Definition at line 421 of file json_schema.py.

    + +
    +
    + +

    ◆ _validate_json_schema()

    + +
    +
    + + + + + +
    + + + + + + + +
    None formatron.schemas.json_schema._validate_json_schema (dict[str, typing.Any] schema)
    +
    +protected
    +
    + +

    Definition at line 138 of file json_schema.py.

    + +
    +
    + +

    ◆ create_schema()

    + +
    +
    + + + + + + + + + + + +
    schemas.schema.Schema formatron.schemas.json_schema.create_schema (dict[str, typing.Any] schema,
    registry = Registry() )
    +
    + +

    Create a Schema object from a JSON schema object.

    +

    This function takes a JSON schema and converts it into a Schema object that can be used for data validation and serialization. Currently, only the following JSON Schema features are supported:

    +
      +
    • type keyword
    • +
    • minLength, maxLength, pattern keywords for string type
    • +
    • substringOf keyword for string type
    • +
    • minimum, maximum, exclusiveMinimum, exclusiveMaximum keywords for number type and integer type
    • +
    • items keyword
        +
      • optionally with minItems, maxItems, prefixItems constraints
      • +
      +
    • +
    • properties keyword
        +
      • Due to implementation limitations, we always assume additionalProperties is false.
      • +
      • Note that properties is optional for object type.
      • +
      +
    • +
    • enum and const keyword
        +
      • This includes advanced enum types such as array and object.
      • +
      • Note that if both enum(or const) and type are present, type will be ignored.
      • +
      +
    • +
    • required keyword
    • +
    • anyOf keyword +
    • +
    • Schema references ($ref and $dynamicRef)
        +
      • Hence, all types of schema identifications($defs, $id, $anchor, $dynamicAnchor) are supported.
      • +
      • This includes recursive schema references.
          +
        • Recursive array references(like [[[[...]]]]) are not supported yet.
        • +
        +
      • +
      • Due to implementation limitations, duplicate constraint keywords in both referrers and referents are not allowed.
          +
        • This bound is expected to be loosened in future versions of Formatron where "easily mergeable" constraint keywords will be merged.
        • +
        +
      • +
      +
    • +
    +
    Requirements
      +
    • The input schema must be a valid JSON Schema according to the JSON Schema Draft 2020-12 standard
    • +
    • The root schema's type must be exactly "object" or "array" or both
    • +
    • The schema must have a valid '$id' and '$schema' fields
    • +
    • All references must be resolvable within the given schema and registry
    • +
    +
    +
    Parameters
    + + + +
    schemaA dictionary representing a valid JSON schema.
    registryA Registry object containing additional schema definitions. Defaults to an empty Registry.
    +
    +
    +
    Returns
    +
    +schemas A Schema object representing the input JSON schema.
    +
    Exceptions
    + + + +
    jsonschemaIf the input schema is not a valid JSON Schema.
    ValueErrorIf there are issues with schema references, constraints or requirements.
    +
    +
    + +

    Definition at line 115 of file json_schema.py.

    + +
    +
    +

    Variable Documentation

    + +

    ◆ _counter

    + +
    +
    + + + + + +
    + + + + +
    int formatron.schemas.json_schema._counter
    +
    +protected
    +
    + +

    Definition at line 67 of file json_schema.py.

    + +
    +
    +
    +
    + + + + diff --git a/v0.4.9/namespaceformatron_1_1schemas_1_1json__schema.js b/v0.4.9/namespaceformatron_1_1schemas_1_1json__schema.js new file mode 100644 index 0000000..1a5c904 --- /dev/null +++ b/v0.4.9/namespaceformatron_1_1schemas_1_1json__schema.js @@ -0,0 +1,23 @@ +var namespaceformatron_1_1schemas_1_1json__schema = +[ + [ "FieldInfo", "classformatron_1_1schemas_1_1json__schema_1_1FieldInfo.html", "classformatron_1_1schemas_1_1json__schema_1_1FieldInfo" ], + [ "_convert_json_schema_to_our_schema", "namespaceformatron_1_1schemas_1_1json__schema.html#a5f4856cb7c30aa340432d386836f25be", null ], + [ "_create_custom_type", "namespaceformatron_1_1schemas_1_1json__schema.html#a15dc86b65c90ac8423c8989054f8c9e5", null ], + [ "_extract_fields_from_object_type", "namespaceformatron_1_1schemas_1_1json__schema.html#af20251afc012b955e29c92922fcc83ef", null ], + [ "_get_literal", "namespaceformatron_1_1schemas_1_1json__schema.html#a096ea829025ebd26b9ae165c17cf8976", null ], + [ "_handle_anyOf", "namespaceformatron_1_1schemas_1_1json__schema.html#a6f88bf4e3c48d96b060ccdcbd80b3328", null ], + [ "_handle_list_metadata", "namespaceformatron_1_1schemas_1_1json__schema.html#ac84df1d5caa0ab01d58207e4401be0dc", null ], + [ "_handle_literal", "namespaceformatron_1_1schemas_1_1json__schema.html#a969bd30894a578428528b94b0f82f1ba", null ], + [ "_handle_numeric_with_metadata", "namespaceformatron_1_1schemas_1_1json__schema.html#ad187a02f7616ccbb83c00462996a7fe1", null ], + [ "_handle_str_with_metadata", "namespaceformatron_1_1schemas_1_1json__schema.html#a32e51b70be50d55d3944e6c700bbd1a5", null ], + [ "_infer_type", "namespaceformatron_1_1schemas_1_1json__schema.html#ac742e1e581efccb6cc9742e7a23c25c2", null ], + [ "_merge_key", "namespaceformatron_1_1schemas_1_1json__schema.html#a5fcddd43a5f64374b5b75d4aafeb9135", null ], + [ "_merge_referenced_schema", "namespaceformatron_1_1schemas_1_1json__schema.html#a45c9b97319a58c2013b8e3f10ad78c30", null ], + [ "_obtain_type", "namespaceformatron_1_1schemas_1_1json__schema.html#a544d74edf1fdccbad9e216d9ff028a20", null ], + [ "_recursive_resolve_reference", "namespaceformatron_1_1schemas_1_1json__schema.html#aaba012c79d101be93f4d96588c9f8cc2", null ], + [ "_resolve_new_url", "namespaceformatron_1_1schemas_1_1json__schema.html#a9dc9dc267e5dd7b6581e2367e9238152", null ], + [ "_resolve_reference", "namespaceformatron_1_1schemas_1_1json__schema.html#a24b516494672cc5dbbf7300ea65479b1", null ], + [ "_validate_json_schema", "namespaceformatron_1_1schemas_1_1json__schema.html#a51aa68e29951e6b295844b13177b7d6a", null ], + [ "create_schema", "namespaceformatron_1_1schemas_1_1json__schema.html#ab2aeae10eb93ef3a3ca1c50013c6b380", null ], + [ "_counter", "namespaceformatron_1_1schemas_1_1json__schema.html#a63e9b97210ccf01282f81aa529a86e50", null ] +]; \ No newline at end of file diff --git a/v0.4.9/namespaceformatron_1_1schemas_1_1pydantic.html b/v0.4.9/namespaceformatron_1_1schemas_1_1pydantic.html new file mode 100644 index 0000000..cc205f1 --- /dev/null +++ b/v0.4.9/namespaceformatron_1_1schemas_1_1pydantic.html @@ -0,0 +1,230 @@ + + + + + + + + +Formatron: formatron.schemas.pydantic Namespace Reference + + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Formatron v0.4.9 + + +
    +
    Formatron empowers everyone to control the output format of language models with minimal overhead.
    +
    +
    + + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    +
    +
    +
    +
    +
    Loading...
    +
    Searching...
    +
    No Matches
    +
    +
    +
    +
    + +
    + +
    formatron.schemas.pydantic Namespace Reference
    +
    +
    + +

    A module that implements the Schema interface using pydantic. +More...

    + + + + + + + + +

    +Classes

    class  ClassSchema
     A wrapper for pydantic BaseModel that implements the Schema interface. More...
     
    class  FieldInfo
     A wrapper for pydantic FieldInfo. More...
     
    + + + + +

    +Functions

    CallableT callable_schema (CallableT func, *, ConfigDict config=None, bool validate_return=False)
     A decorator that wraps pydantic's validate_call.
     
    + + + +

    +Variables

     CallableT = typing.TypeVar('CallableT', bound=typing.Callable)
     
    +

    Detailed Description

    +

    A module that implements the Schema interface using pydantic.

    +

    Function Documentation

    + +

    ◆ callable_schema()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + +
    CallableT formatron.schemas.pydantic.callable_schema (CallableT func,
    * ,
    ConfigDict config = None,
    bool validate_return = False )
    +
    + +

    A decorator that wraps pydantic's validate_call.

    +

    The decorated callable also implements the Schema interface.

    +
    Parameters
    + + + + +
    funcThe function to decorate.
    configThe pydantic configuration of validate_call.
    validate_returnWhether to validate the return value.
    +
    +
    +
    Returns
    The decorated callable.
    + +

    Definition at line 123 of file pydantic.py.

    + +
    +
    +

    Variable Documentation

    + +

    ◆ CallableT

    + +
    +
    + + + + +
    formatron.schemas.pydantic.CallableT = typing.TypeVar('CallableT', bound=typing.Callable)
    +
    + +

    Definition at line 109 of file pydantic.py.

    + +
    +
    +
    +
    + + + + diff --git a/v0.4.9/namespaceformatron_1_1schemas_1_1pydantic.js b/v0.4.9/namespaceformatron_1_1schemas_1_1pydantic.js new file mode 100644 index 0000000..35c928e --- /dev/null +++ b/v0.4.9/namespaceformatron_1_1schemas_1_1pydantic.js @@ -0,0 +1,7 @@ +var namespaceformatron_1_1schemas_1_1pydantic = +[ + [ "ClassSchema", "classformatron_1_1schemas_1_1pydantic_1_1ClassSchema.html", "classformatron_1_1schemas_1_1pydantic_1_1ClassSchema" ], + [ "FieldInfo", "classformatron_1_1schemas_1_1pydantic_1_1FieldInfo.html", "classformatron_1_1schemas_1_1pydantic_1_1FieldInfo" ], + [ "callable_schema", "namespaceformatron_1_1schemas_1_1pydantic.html#a0b1aeb9a63626b0e782bc4b9e1ce18cf", null ], + [ "CallableT", "namespaceformatron_1_1schemas_1_1pydantic.html#acf48165db355935623fdcd27fafe2b27", null ] +]; \ No newline at end of file diff --git a/v0.4.9/namespaceformatron_1_1schemas_1_1schema.html b/v0.4.9/namespaceformatron_1_1schemas_1_1schema.html new file mode 100644 index 0000000..198920e --- /dev/null +++ b/v0.4.9/namespaceformatron_1_1schemas_1_1schema.html @@ -0,0 +1,160 @@ + + + + + + + + +Formatron: formatron.schemas.schema Namespace Reference + + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Formatron v0.4.9 + + +
    +
    Formatron empowers everyone to control the output format of language models with minimal overhead.
    +
    +
    + + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    +
    +
    +
    +
    +
    Loading...
    +
    Searching...
    +
    No Matches
    +
    +
    +
    +
    + +
    + +
    formatron.schemas.schema Namespace Reference
    +
    +
    + +

    This module contains the Schema abstract class and FieldInfo abstract class. +More...

    + + + + + + + + + + + + + + +

    +Classes

    class  FieldInfo
     An abstract field info that describes a data field in a schema. More...
     
    class  Schema
     An abstract schema that describes some data. More...
     
    class  SubstringOf
     A metadata class that indicates that the field is a substring of the given string. More...
     
    class  TypeWithMetadata
     A type with metadata. More...
     
    +

    Detailed Description

    +

    This module contains the Schema abstract class and FieldInfo abstract class.

    +
    +
    + + + + diff --git a/v0.4.9/namespaceformatron_1_1schemas_1_1schema.js b/v0.4.9/namespaceformatron_1_1schemas_1_1schema.js new file mode 100644 index 0000000..d07aa1e --- /dev/null +++ b/v0.4.9/namespaceformatron_1_1schemas_1_1schema.js @@ -0,0 +1,7 @@ +var namespaceformatron_1_1schemas_1_1schema = +[ + [ "FieldInfo", "classformatron_1_1schemas_1_1schema_1_1FieldInfo.html", "classformatron_1_1schemas_1_1schema_1_1FieldInfo" ], + [ "Schema", "classformatron_1_1schemas_1_1schema_1_1Schema.html", "classformatron_1_1schemas_1_1schema_1_1Schema" ], + [ "SubstringOf", "classformatron_1_1schemas_1_1schema_1_1SubstringOf.html", null ], + [ "TypeWithMetadata", "classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata.html", "classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata" ] +]; \ No newline at end of file diff --git a/v0.4.9/namespacemembers.html b/v0.4.9/namespacemembers.html new file mode 100644 index 0000000..89a8a57 --- /dev/null +++ b/v0.4.9/namespacemembers.html @@ -0,0 +1,205 @@ + + + + + + + + +Formatron: Package Members + + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Formatron v0.4.9 + + +
    +
    Formatron empowers everyone to control the output format of language models with minimal overhead.
    +
    +
    + + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    +
    +
    +
    +
    +
    Loading...
    +
    Searching...
    +
    No Matches
    +
    +
    +
    +
    + +
    +
    Here is a list of all namespace members with links to the namespace documentation for each member:
    + +

    - _ -

    + + +

    - a -

    + + +

    - c -

    + + +

    - g -

    + + +

    - i -

    + + +

    - r -

    + + +

    - s -

    + + +

    - u -

    +
    +
    + + + + diff --git a/v0.4.9/namespacemembers_func.html b/v0.4.9/namespacemembers_func.html new file mode 100644 index 0000000..e562d47 --- /dev/null +++ b/v0.4.9/namespacemembers_func.html @@ -0,0 +1,196 @@ + + + + + + + + +Formatron: Package Members + + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Formatron v0.4.9 + + +
    +
    Formatron empowers everyone to control the output format of language models with minimal overhead.
    +
    +
    + + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    +
    +
    +
    +
    +
    Loading...
    +
    Searching...
    +
    No Matches
    +
    +
    +
    +
    + +
    +
    Here is a list of all namespace functions with links to the namespace documentation for each function:
    + +

    - _ -

    + + +

    - a -

    + + +

    - c -

    + + +

    - g -

    + + +

    - i -

    + + +

    - r -

    + + +

    - u -

    +
    +
    + + + + diff --git a/v0.4.9/namespacemembers_vars.html b/v0.4.9/namespacemembers_vars.html new file mode 100644 index 0000000..5a00ba9 --- /dev/null +++ b/v0.4.9/namespacemembers_vars.html @@ -0,0 +1,140 @@ + + + + + + + + +Formatron: Package Members + + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Formatron v0.4.9 + + +
    +
    Formatron empowers everyone to control the output format of language models with minimal overhead.
    +
    +
    + + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    +
    +
    +
    +
    +
    Loading...
    +
    Searching...
    +
    No Matches
    +
    +
    +
    +
    + +
    +
    Here is a list of all namespace variables with links to the namespace documentation for each variable:
    +
    +
    + + + + diff --git a/v0.4.9/namespaces.html b/v0.4.9/namespaces.html new file mode 100644 index 0000000..07dfa62 --- /dev/null +++ b/v0.4.9/namespaces.html @@ -0,0 +1,183 @@ + + + + + + + + +Formatron: Package List + + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Formatron v0.4.9 + + +
    +
    Formatron empowers everyone to control the output format of language models with minimal overhead.
    +
    +
    + + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    +
    +
    +
    +
    +
    Loading...
    +
    Searching...
    +
    No Matches
    +
    +
    +
    +
    + +
    +
    Package List
    +
    +
    +
    Here are the packages with brief descriptions (if available):
    +
    [detail level 1234]
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
     Nformatron
     NconfigConfiguration classes for Formatron
     CEngineGenerationConfigConfiguration for how an KBNF engine should be used in text generation
     NextractorExtractors for extracting data from generated strings
     CChoiceExtractorAn extractor that uses multiple extractors to extract data
     CExtractorAn abstract extractor that extracts data from a string and offers its KBNF rules definition
     CLiteralExtractorAn extractor that extracts a literal string
     CNonterminalExtractorAn extractor that extracts data corresponding to a nonterminal
     CSubstringExtractorAn extractor that extracts a substring of a given string from the input string
     NformatsThis subpackage contains modules that operate with concrete formats, like json
     NjsonThe module defines the JsonExtractor class, which is used to extract data from a string in JSON format
     CJsonExtractorAn extractor that loads json data to an object from a string
     NregexThis module contains the RegexExtractor class, which is used to extract data using a regular expression
     CRegexComplementExtractorAn extractor that extracts data by matching a regex complement
     CRegexExtractorAn extractor that extracts a string using a regular expression
     NformatterThis module contains the Formatter class and its related classes
     CFormatter
     CFormatterBaseAn abstract Formatter that enforces a format on the string generated by a language model
     CFormatterBuilderA builder for creating a Formatter
     NintegrationsThis subpackage contains integrations with other frameworks and libraries
     Nexllamav2This module integrates the ExLlamaV2 library by providing convenience utilities
     CFormatterFilterExLlamaV2Filter that uses a formatter to mask logits
     NRWKVThis module integrates the RWKV library by providing convenience utilities
     CPIPELINEA wrapper for the pipeline of RWKV
     CPIPELINE_ARGSA wrapper for the arguments of the pipeline of RWKV
     NtransformersThis module integrates the transformers library by providing convenience utilities
     CFormattersLogitsProcessorLogit processor that uses formatters to mask batch logits
     Nutils
     NvllmThis module integrates the vllm library by providing convenience utilities
     CFormattersLogitsProcessorLogit processor that uses formatters to mask batch logits
     NschemasThis subpackage contains modules that define schemas creation from various sources
     Ndict_inferenceThis module contains utilities for inferring schemas from dictionaries
     CFieldInfo
     Njson_schemaThis module contains utilities for creating schemas from JSON schemas
     CFieldInfo
     NpydanticA module that implements the Schema interface using pydantic
     CClassSchemaA wrapper for pydantic BaseModel that implements the Schema interface
     CFieldInfoA wrapper for pydantic FieldInfo
     NschemaThis module contains the Schema abstract class and FieldInfo abstract class
     CFieldInfoAn abstract field info that describes a data field in a schema
     CSchemaAn abstract schema that describes some data
     CSubstringOfA metadata class that indicates that the field is a substring of the given string
     CTypeWithMetadataA type with metadata
    +
    +
    +
    + + + + diff --git a/v0.4.9/namespaces_dup.js b/v0.4.9/namespaces_dup.js new file mode 100644 index 0000000..ed829f9 --- /dev/null +++ b/v0.4.9/namespaces_dup.js @@ -0,0 +1,4 @@ +var namespaces_dup = +[ + [ "formatron", "namespaceformatron.html", "namespaceformatron" ] +]; \ No newline at end of file diff --git a/v0.4.9/nav_f.png b/v0.4.9/nav_f.png new file mode 100644 index 0000000..72a58a5 Binary files /dev/null and b/v0.4.9/nav_f.png differ diff --git a/v0.4.9/nav_fd.png b/v0.4.9/nav_fd.png new file mode 100644 index 0000000..032fbdd Binary files /dev/null and b/v0.4.9/nav_fd.png differ diff --git a/v0.4.9/nav_g.png b/v0.4.9/nav_g.png new file mode 100644 index 0000000..2093a23 Binary files /dev/null and b/v0.4.9/nav_g.png differ diff --git a/v0.4.9/nav_h.png b/v0.4.9/nav_h.png new file mode 100644 index 0000000..33389b1 Binary files /dev/null and b/v0.4.9/nav_h.png differ diff --git a/v0.4.9/nav_hd.png b/v0.4.9/nav_hd.png new file mode 100644 index 0000000..de80f18 Binary files /dev/null and b/v0.4.9/nav_hd.png differ diff --git a/v0.4.9/navtree.css b/v0.4.9/navtree.css new file mode 100644 index 0000000..6b1e5e4 --- /dev/null +++ b/v0.4.9/navtree.css @@ -0,0 +1,149 @@ +#nav-tree .children_ul { + margin:0; + padding:4px; +} + +#nav-tree ul { + list-style:none outside none; + margin:0px; + padding:0px; +} + +#nav-tree li { + white-space:nowrap; + margin:0px; + padding:0px; +} + +#nav-tree .plus { + margin:0px; +} + +#nav-tree .selected { + background-image: url('tab_a.png'); + background-repeat:repeat-x; + color: white; + text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); +} + +#nav-tree .selected .arrow { + color: #9CAFD4; + text-shadow: none; +} + +#nav-tree img { + margin:0px; + padding:0px; + border:0px; + vertical-align: middle; +} + +#nav-tree a { + text-decoration:none; + padding:0px; + margin:0px; +} + +#nav-tree .label { + margin:0px; + padding:0px; + font: 12px 'Lucida Grande',Geneva,Helvetica,Arial,sans-serif; +} + +#nav-tree .label a { + padding:2px; +} + +#nav-tree .selected a { + text-decoration:none; + color:white; +} + +#nav-tree .children_ul { + margin:0px; + padding:0px; +} + +#nav-tree .item { + margin:0px; + padding:0px; +} + +#nav-tree { + padding: 0px 0px; + font-size:14px; + overflow:auto; +} + +#doc-content { + overflow:auto; + display:block; + padding:0px; + margin:0px; + -webkit-overflow-scrolling : touch; /* iOS 5+ */ +} + +#side-nav { + padding:0 6px 0 0; + margin: 0px; + display:block; + position: absolute; + left: 0px; + width: $width; + overflow : hidden; +} + +.ui-resizable .ui-resizable-handle { + display:block; +} + +.ui-resizable-e { + background-image:url('splitbar.png'); + background-size:100%; + background-repeat:repeat-y; + background-attachment: scroll; + cursor:ew-resize; + height:100%; + right:0; + top:0; + width:6px; +} + +.ui-resizable-handle { + display:none; + font-size:0.1px; + position:absolute; + z-index:1; +} + +#nav-tree-contents { + margin: 6px 0px 0px 0px; +} + +#nav-tree { + background-repeat:repeat-x; + background-color: #F9FAFC; + -webkit-overflow-scrolling : touch; /* iOS 5+ */ +} + +#nav-sync { + position:absolute; + top:5px; + right:24px; + z-index:0; +} + +#nav-sync img { + opacity:0.3; +} + +#nav-sync img:hover { + opacity:0.9; +} + +@media print +{ + #nav-tree { display: none; } + div.ui-resizable-handle { display: none; position: relative; } +} + diff --git a/v0.4.9/navtree.js b/v0.4.9/navtree.js new file mode 100644 index 0000000..9027ce6 --- /dev/null +++ b/v0.4.9/navtree.js @@ -0,0 +1,483 @@ +/* + @licstart The following is the entire license notice for the JavaScript code in this file. + + The MIT License (MIT) + + Copyright (C) 1997-2020 by Dimitri van Heesch + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software + and associated documentation files (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, publish, distribute, + sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or + substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING + BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + @licend The above is the entire license notice for the JavaScript code in this file + */ + +function initNavTree(toroot,relpath) { + let navTreeSubIndices = []; + const ARROW_DOWN = '▼'; + const ARROW_RIGHT = '►'; + const NAVPATH_COOKIE_NAME = ''+'navpath'; + + const getData = function(varName) { + const i = varName.lastIndexOf('/'); + const n = i>=0 ? varName.substring(i+1) : varName; + return eval(n.replace(/-/g,'_')); + } + + const stripPath = function(uri) { + return uri.substring(uri.lastIndexOf('/')+1); + } + + const stripPath2 = function(uri) { + const i = uri.lastIndexOf('/'); + const s = uri.substring(i+1); + const m = uri.substring(0,i+1).match(/\/d\w\/d\w\w\/$/); + return m ? uri.substring(i-6) : s; + } + + const hashValue = function() { + return $(location).attr('hash').substring(1).replace(/[^\w-]/g,''); + } + + const hashUrl = function() { + return '#'+hashValue(); + } + + const pathName = function() { + return $(location).attr('pathname').replace(/[^-A-Za-z0-9+&@#/%?=~_|!:,.;()]/g, ''); + } + + const storeLink = function(link) { + if (!$("#nav-sync").hasClass('sync')) { + Cookie.writeSetting(NAVPATH_COOKIE_NAME,link,0); + } + } + + const deleteLink = function() { + Cookie.eraseSetting(NAVPATH_COOKIE_NAME); + } + + const cachedLink = function() { + return Cookie.readSetting(NAVPATH_COOKIE_NAME,''); + } + + const getScript = function(scriptName,func) { + const head = document.getElementsByTagName("head")[0]; + const script = document.createElement('script'); + script.id = scriptName; + script.type = 'text/javascript'; + script.onload = func; + script.src = scriptName+'.js'; + head.appendChild(script); + } + + const createIndent = function(o,domNode,node) { + let level=-1; + let n = node; + while (n.parentNode) { level++; n=n.parentNode; } + if (node.childrenData) { + const imgNode = document.createElement("span"); + imgNode.className = 'arrow'; + imgNode.style.paddingLeft=(16*level).toString()+'px'; + imgNode.innerHTML=ARROW_RIGHT; + node.plus_img = imgNode; + node.expandToggle = document.createElement("a"); + node.expandToggle.href = "javascript:void(0)"; + node.expandToggle.onclick = function() { + if (node.expanded) { + $(node.getChildrenUL()).slideUp("fast"); + node.plus_img.innerHTML=ARROW_RIGHT; + node.expanded = false; + } else { + expandNode(o, node, false, true); + } + } + node.expandToggle.appendChild(imgNode); + domNode.appendChild(node.expandToggle); + } else { + let span = document.createElement("span"); + span.className = 'arrow'; + span.style.width = 16*(level+1)+'px'; + span.innerHTML = ' '; + domNode.appendChild(span); + } + } + + let animationInProgress = false; + + const gotoAnchor = function(anchor,aname) { + let pos, docContent = $('#doc-content'); + let ancParent = $(anchor.parent()); + if (ancParent.hasClass('memItemLeft') || ancParent.hasClass('memtitle') || + ancParent.hasClass('fieldname') || ancParent.hasClass('fieldtype') || + ancParent.is(':header')) { + pos = ancParent.position().top; + } else if (anchor.position()) { + pos = anchor.position().top; + } + if (pos) { + const dcOffset = docContent.offset().top; + const dcHeight = docContent.height(); + const dcScrHeight = docContent[0].scrollHeight + const dcScrTop = docContent.scrollTop(); + let dist = Math.abs(Math.min(pos-dcOffset,dcScrHeight-dcHeight-dcScrTop)); + animationInProgress = true; + docContent.animate({ + scrollTop: pos + dcScrTop - dcOffset + },Math.max(50,Math.min(500,dist)),function() { + animationInProgress=false; + if (anchor.parent().attr('class')=='memItemLeft') { + let rows = $('.memberdecls tr[class$="'+hashValue()+'"]'); + glowEffect(rows.children(),300); // member without details + } else if (anchor.parent().attr('class')=='fieldname') { + glowEffect(anchor.parent().parent(),1000); // enum value + } else if (anchor.parent().attr('class')=='fieldtype') { + glowEffect(anchor.parent().parent(),1000); // struct field + } else if (anchor.parent().is(":header")) { + glowEffect(anchor.parent(),1000); // section header + } else { + glowEffect(anchor.next(),1000); // normal member + } + }); + } + } + + const newNode = function(o, po, text, link, childrenData, lastNode) { + const node = { + children : [], + childrenData : childrenData, + depth : po.depth + 1, + relpath : po.relpath, + isLast : lastNode, + li : document.createElement("li"), + parentNode : po, + itemDiv : document.createElement("div"), + labelSpan : document.createElement("span"), + label : document.createTextNode(text), + expanded : false, + childrenUL : null, + getChildrenUL : function() { + if (!this.childrenUL) { + this.childrenUL = document.createElement("ul"); + this.childrenUL.className = "children_ul"; + this.childrenUL.style.display = "none"; + this.li.appendChild(node.childrenUL); + } + return node.childrenUL; + }, + }; + + node.itemDiv.className = "item"; + node.labelSpan.className = "label"; + createIndent(o,node.itemDiv,node); + node.itemDiv.appendChild(node.labelSpan); + node.li.appendChild(node.itemDiv); + + const a = document.createElement("a"); + node.labelSpan.appendChild(a); + po.getChildrenUL().appendChild(node.li); + a.appendChild(node.label); + if (link) { + let url; + if (link.substring(0,1)=='^') { + url = link.substring(1); + link = url; + } else { + url = node.relpath+link; + } + a.className = stripPath(link.replace('#',':')); + if (link.indexOf('#')!=-1) { + const aname = '#'+link.split('#')[1]; + const srcPage = stripPath(pathName()); + const targetPage = stripPath(link.split('#')[0]); + a.href = srcPage!=targetPage ? url : aname; + a.onclick = function() { + storeLink(link); + aPPar = $(a).parent().parent(); + if (!aPPar.hasClass('selected')) { + $('.item').removeClass('selected'); + $('.item').removeAttr('id'); + aPPar.addClass('selected'); + aPPar.attr('id','selected'); + } + const anchor = $(aname); + gotoAnchor(anchor,aname); + }; + } else { + a.href = url; + a.onclick = () => storeLink(link); + } + } else if (childrenData != null) { + a.className = "nolink"; + a.href = "javascript:void(0)"; + a.onclick = node.expandToggle.onclick; + } + return node; + } + + const showRoot = function() { + const headerHeight = $("#top").height(); + const footerHeight = $("#nav-path").height(); + const windowHeight = $(window).height() - headerHeight - footerHeight; + (function() { // retry until we can scroll to the selected item + try { + const navtree=$('#nav-tree'); + navtree.scrollTo('#selected',100,{offset:-windowHeight/2}); + } catch (err) { + setTimeout(arguments.callee, 0); + } + })(); + } + + const expandNode = function(o, node, imm, setFocus) { + if (node.childrenData && !node.expanded) { + if (typeof(node.childrenData)==='string') { + const varName = node.childrenData; + getScript(node.relpath+varName,function() { + node.childrenData = getData(varName); + expandNode(o, node, imm, setFocus); + }); + } else { + if (!node.childrenVisited) { + getNode(o, node); + } + $(node.getChildrenUL()).slideDown("fast"); + node.plus_img.innerHTML = ARROW_DOWN; + node.expanded = true; + if (setFocus) { + $(node.expandToggle).focus(); + } + } + } + } + + const glowEffect = function(n,duration) { + n.addClass('glow').delay(duration).queue(function(next) { + $(this).removeClass('glow');next(); + }); + } + + const highlightAnchor = function() { + const aname = hashUrl(); + const anchor = $(aname); + gotoAnchor(anchor,aname); + } + + const selectAndHighlight = function(hash,n) { + let a; + if (hash) { + const link=stripPath(pathName())+':'+hash.substring(1); + a=$('.item a[class$="'+link+'"]'); + } + if (a && a.length) { + a.parent().parent().addClass('selected'); + a.parent().parent().attr('id','selected'); + highlightAnchor(); + } else if (n) { + $(n.itemDiv).addClass('selected'); + $(n.itemDiv).attr('id','selected'); + } + let topOffset=5; + if ($('#nav-tree-contents .item:first').hasClass('selected')) { + topOffset+=25; + } + $('#nav-sync').css('top',topOffset+'px'); + showRoot(); + } + + const showNode = function(o, node, index, hash) { + if (node && node.childrenData) { + if (typeof(node.childrenData)==='string') { + const varName = node.childrenData; + getScript(node.relpath+varName,function() { + node.childrenData = getData(varName); + showNode(o,node,index,hash); + }); + } else { + if (!node.childrenVisited) { + getNode(o, node); + } + $(node.getChildrenUL()).css({'display':'block'}); + node.plus_img.innerHTML = ARROW_DOWN; + node.expanded = true; + const n = node.children[o.breadcrumbs[index]]; + if (index+11 ? '#'+parts[1].replace(/[^\w-]/g,'') : ''; + } + if (hash.match(/^#l\d+$/)) { + const anchor=$('a[name='+hash.substring(1)+']'); + glowEffect(anchor.parent(),1000); // line number + hash=''; // strip line number anchors + } + const url=root+hash; + let i=-1; + while (NAVTREEINDEX[i+1]<=url) i++; + if (i==-1) { i=0; root=NAVTREE[0][1]; } // fallback: show index + if (navTreeSubIndices[i]) { + gotoNode(o,i,root,hash,relpath) + } else { + getScript(relpath+'navtreeindex'+i,function() { + navTreeSubIndices[i] = eval('NAVTREEINDEX'+i); + if (navTreeSubIndices[i]) { + gotoNode(o,i,root,hash,relpath); + } + }); + } + } + + const showSyncOff = function(n,relpath) { + n.html(''); + } + + const showSyncOn = function(n,relpath) { + n.html(''); + } + + const o = { + toroot : toroot, + node : { + childrenData : NAVTREE, + children : [], + childrenUL : document.createElement("ul"), + getChildrenUL : function() { return this.childrenUL }, + li : document.getElementById("nav-tree-contents"), + depth : 0, + relpath : relpath, + expanded : false, + isLast : true, + plus_img : document.createElement("span"), + }, + }; + o.node.li.appendChild(o.node.childrenUL); + o.node.plus_img.className = 'arrow'; + o.node.plus_img.innerHTML = ARROW_RIGHT; + + const navSync = $('#nav-sync'); + if (cachedLink()) { + showSyncOff(navSync,relpath); + navSync.removeClass('sync'); + } else { + showSyncOn(navSync,relpath); + } + + navSync.click(() => { + const navSync = $('#nav-sync'); + if (navSync.hasClass('sync')) { + navSync.removeClass('sync'); + showSyncOff(navSync,relpath); + storeLink(stripPath2(pathName())+hashUrl()); + } else { + navSync.addClass('sync'); + showSyncOn(navSync,relpath); + deleteLink(); + } + }); + + navTo(o,toroot,hashUrl(),relpath); + showRoot(); + + $(window).bind('hashchange', () => { + if (!animationInProgress) { + if (window.location.hash && window.location.hash.length>1) { + let a; + if ($(location).attr('hash')) { + const clslink=stripPath(pathName())+':'+hashValue(); + a=$('.item a[class$="'+clslink.replace(/ + + + + + + + + diff --git a/v0.4.9/plusd.svg b/v0.4.9/plusd.svg new file mode 100644 index 0000000..0c65bfe --- /dev/null +++ b/v0.4.9/plusd.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/v0.4.9/pydantic_8py.html b/v0.4.9/pydantic_8py.html new file mode 100644 index 0000000..46ae104 --- /dev/null +++ b/v0.4.9/pydantic_8py.html @@ -0,0 +1,176 @@ + + + + + + + + +Formatron: src/formatron/schemas/pydantic.py File Reference + + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Formatron v0.4.9 + + +
    +
    Formatron empowers everyone to control the output format of language models with minimal overhead.
    +
    +
    + + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    +
    +
    +
    +
    +
    Loading...
    +
    Searching...
    +
    No Matches
    +
    +
    +
    +
    + +
    + +
    pydantic.py File Reference
    +
    +
    + +

    Go to the source code of this file.

    + + + + + + + + +

    +Classes

    class  formatron.schemas.pydantic.FieldInfo
     A wrapper for pydantic FieldInfo. More...
     
    class  formatron.schemas.pydantic.ClassSchema
     A wrapper for pydantic BaseModel that implements the Schema interface. More...
     
    + + + + + + + + + +

    +Namespaces

    namespace  formatron
     
    namespace  formatron.schemas
     This subpackage contains modules that define schemas creation from various sources.
     
    namespace  formatron.schemas.pydantic
     A module that implements the Schema interface using pydantic.
     
    + + + + +

    +Functions

    CallableT formatron.schemas.pydantic.callable_schema (CallableT func, *, ConfigDict config=None, bool validate_return=False)
     A decorator that wraps pydantic's validate_call.
     
    + + + +

    +Variables

     formatron.schemas.pydantic.CallableT = typing.TypeVar('CallableT', bound=typing.Callable)
     
    +
    +
    + + + + diff --git a/v0.4.9/pydantic_8py.js b/v0.4.9/pydantic_8py.js new file mode 100644 index 0000000..2191dc2 --- /dev/null +++ b/v0.4.9/pydantic_8py.js @@ -0,0 +1,7 @@ +var pydantic_8py = +[ + [ "formatron.schemas.pydantic.FieldInfo", "classformatron_1_1schemas_1_1pydantic_1_1FieldInfo.html", "classformatron_1_1schemas_1_1pydantic_1_1FieldInfo" ], + [ "formatron.schemas.pydantic.ClassSchema", "classformatron_1_1schemas_1_1pydantic_1_1ClassSchema.html", "classformatron_1_1schemas_1_1pydantic_1_1ClassSchema" ], + [ "callable_schema", "pydantic_8py.html#a0b1aeb9a63626b0e782bc4b9e1ce18cf", null ], + [ "CallableT", "pydantic_8py.html#acf48165db355935623fdcd27fafe2b27", null ] +]; \ No newline at end of file diff --git a/v0.4.9/pydantic_8py_source.html b/v0.4.9/pydantic_8py_source.html new file mode 100644 index 0000000..96e1b4a --- /dev/null +++ b/v0.4.9/pydantic_8py_source.html @@ -0,0 +1,314 @@ + + + + + + + + +Formatron: src/formatron/schemas/pydantic.py Source File + + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Formatron v0.4.9 + + +
    +
    Formatron empowers everyone to control the output format of language models with minimal overhead.
    +
    +
    + + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    +
    +
    +
    +
    +
    Loading...
    +
    Searching...
    +
    No Matches
    +
    +
    +
    +
    + +
    +
    pydantic.py
    +
    +
    +Go to the documentation of this file.
    1"""
    +
    2A module that implements the Schema interface using pydantic.
    +
    3"""
    +
    4import inspect
    +
    5import json
    +
    6import typing
    +
    7
    +
    8import pydantic.fields
    +
    9from pydantic import BaseModel, validate_call, ConfigDict, Field
    +
    10
    +
    11import formatron.schemas.schema as schema
    +
    12from formatron.schemas.schema import Schema, TypeWithMetadata
    +
    13
    +
    14
    + +
    16 """
    +
    17 A wrapper for pydantic FieldInfo.
    +
    18 """
    +
    +
    19 __slots__ = ("_field",)
    +
    20
    +
    21 def __init__(self, field: pydantic.fields.FieldInfo):
    +
    22 """
    +
    23 Initialize the field information.
    +
    24 """
    +
    +
    25 self._field = field
    +
    26 self._annotation = field.annotation
    +
    27 if field.metadata:
    +
    28 metadata = {}
    +
    29 for constraint in ["min_length", "max_length", "pattern", "gt", "ge", "lt", "le", "substring_of"]:
    +
    30 value = next((getattr(m, constraint) for m in self._field.metadata if hasattr(m, constraint)), None)
    +
    31 if value is not None:
    +
    32 metadata[constraint] = value
    +
    33 if metadata:
    +
    34 self._annotation = TypeWithMetadata(self._annotation, metadata)
    +
    35
    +
    36 @property
    +
    +
    37 def annotation(self) -> typing.Type[typing.Any] | None:
    +
    38 return self._annotation
    +
    39
    +
    40 @property
    +
    41 def required(self) -> bool:
    +
    42 return self._field.is_required()
    +
    43
    +
    44 def __repr__(self):
    +
    +
    45 return repr(self._field)
    +
    46
    +
    47 def __str__(self):
    +
    +
    48 return str(self._field)
    +
    49
    +
    50
    +
    51class ClassSchema(BaseModel, Schema):
    +
    52 """
    +
    53 A wrapper for pydantic BaseModel that implements the Schema interface.
    +
    54 """
    +
    55 __cached_fields__ = None
    +
    56
    +
    57 @classmethod
    +
    +
    58 def fields(cls) -> typing.Dict[str, typing.Any]:
    +
    59 if cls.__cached_fields__ is not None:
    +
    60 return cls.__cached_fields__
    +
    +
    61 cls.__cached_fields__ = {k: FieldInfo(v) for k, v in cls.model_fields.items()}
    +
    62 return cls.__cached_fields__
    +
    + +
    64 @classmethod
    +
    65 def from_json(cls, _json: str) -> "ClassSchema":
    +
    +
    +
    66 """
    +
    67 Create a ClassSchema from a JSON string.
    +
    68 """
    +
    69 return cls.model_validate_json(_json)
    +
    +
    +
    70
    +
    71
    +
    72CallableT = typing.TypeVar('CallableT', bound=typing.Callable)
    +
    + +
    74
    +
    75def callable_schema(func: CallableT, /, *, config: ConfigDict = None, validate_return: bool = False) -> CallableT:
    +
    76 """
    +
    77 A decorator that wraps pydantic's validate_call. The decorated callable also implements the Schema interface.
    +
    78
    +
    79 Args:
    +
    80 func: The function to decorate.
    +
    81 config: The pydantic configuration of validate_call.
    +
    82 validate_return: Whether to validate the return value.
    +
    83
    +
    +
    84 Returns:
    +
    85 The decorated callable.
    +
    86 """
    +
    87 pydantic_wrapper = validate_call(config=config, validate_return=validate_return)(func)
    +
    88 signature = inspect.signature(func, eval_str=True)
    +
    89 fields = {}
    +
    +
    90 for k, p in signature.parameters.items():
    +
    91 default = None
    +
    92 if p.default is not inspect.Signature.empty:
    +
    93 default = p.default
    +
    94 actual_type = p.annotation
    +
    95 metadata = []
    +
    96 if isinstance(p.default, pydantic.fields.FieldInfo):
    +
    97 fields[k] = p.default
    +
    98 if typing.get_origin(p.annotation) is typing.Annotated:
    +
    99 actual_type, *meta = typing.get_args(p.annotation)
    +
    100 fieldinfo = None
    +
    101 for i in meta:
    +
    102 if isinstance(i, pydantic.fields.FieldInfo):
    +
    +
    103 fieldinfo = i
    +
    104 else:
    +
    105 metadata.append(i)
    +
    +
    106 if fieldinfo is not None:
    +
    107 fields[k] = fieldinfo
    +
    108 if k in fields:
    +
    +
    109 fields[k].default = default
    +
    110 fields[k].annotation = actual_type
    +
    111 fields[k].metadata.extend(metadata)
    +
    112 continue
    +
    113 if default is not None:
    +
    114 fields[k] = Field(default)
    +
    115 else:
    +
    116 fields[k] = Field()
    +
    117 fields[k].annotation = actual_type
    +
    118 fields[k].metadata.extend(metadata)
    +
    119 for k in fields:
    +
    120 fields[k] = FieldInfo(fields[k])
    +
    121
    +
    122 def from_json(cls, json_str):
    +
    +
    123 json_data = json.loads(json_str)
    +
    124 positional_only = []
    +
    125 others = {}
    +
    126 for k, p in signature.parameters.items():
    +
    127 if p.kind == p.POSITIONAL_ONLY:
    +
    128 positional_only.append(json_data[k])
    +
    129 else:
    +
    130 others[k] = json_data[k]
    +
    131 return cls(*positional_only, **others)
    +
    132
    +
    133 _class = type(
    +
    134 f'{func.__qualname__}_PydanticSchema_{id(func)}',
    +
    135 (Schema,),
    +
    136 {
    +
    137 "_func": pydantic_wrapper,
    +
    138 '__new__': lambda cls, *args, **kwargs: pydantic_wrapper(*args, **kwargs),
    +
    139 '__call__': lambda *args, **kwargs: pydantic_wrapper(*args, **kwargs) # make duck typer happy
    +
    140 }
    +
    141 )
    +
    142 _class.from_json = classmethod(from_json)
    +
    143 _class.fields = classmethod(lambda cls: fields)
    +
    144 return _class
    +
    +
    A wrapper for pydantic BaseModel that implements the Schema interface.
    Definition pydantic.py:73
    +
    A wrapper for pydantic FieldInfo.
    Definition pydantic.py:19
    + +
    __init__(self, pydantic.fields.FieldInfo field)
    Initialize the field information.
    Definition pydantic.py:25
    + + +
    typing.Type[typing.Any]|None annotation(self)
    Get the type annotation of the field.
    Definition pydantic.py:45
    + +
    bool required(self)
    Check if the field is required for the schema.
    Definition pydantic.py:58
    +
    An abstract field info that describes a data field in a schema.
    Definition schema.py:13
    +
    An abstract schema that describes some data.
    Definition schema.py:91
    + +
    CallableT callable_schema(CallableT func, *, ConfigDict config=None, bool validate_return=False)
    A decorator that wraps pydantic's validate_call.
    Definition pydantic.py:123
    +
    +
    + + + + diff --git a/v0.4.9/regex_8py.html b/v0.4.9/regex_8py.html new file mode 100644 index 0000000..cc44ea7 --- /dev/null +++ b/v0.4.9/regex_8py.html @@ -0,0 +1,163 @@ + + + + + + + + +Formatron: src/formatron/formats/regex.py File Reference + + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Formatron v0.4.9 + + +
    +
    Formatron empowers everyone to control the output format of language models with minimal overhead.
    +
    +
    + + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    +
    +
    +
    +
    +
    Loading...
    +
    Searching...
    +
    No Matches
    +
    +
    +
    +
    + +
    + +
    regex.py File Reference
    +
    +
    + +

    Go to the source code of this file.

    + + + + + + + + +

    +Classes

    class  formatron.formats.regex.RegexExtractor
     An extractor that extracts a string using a regular expression. More...
     
    class  formatron.formats.regex.RegexComplementExtractor
     An extractor that extracts data by matching a regex complement. More...
     
    + + + + + + + + + +

    +Namespaces

    namespace  formatron
     
    namespace  formatron.formats
     This subpackage contains modules that operate with concrete formats, like json.
     
    namespace  formatron.formats.regex
     This module contains the RegexExtractor class, which is used to extract data using a regular expression.
     
    +
    +
    + + + + diff --git a/v0.4.9/regex_8py.js b/v0.4.9/regex_8py.js new file mode 100644 index 0000000..efbdfbc --- /dev/null +++ b/v0.4.9/regex_8py.js @@ -0,0 +1,5 @@ +var regex_8py = +[ + [ "formatron.formats.regex.RegexExtractor", "classformatron_1_1formats_1_1regex_1_1RegexExtractor.html", "classformatron_1_1formats_1_1regex_1_1RegexExtractor" ], + [ "formatron.formats.regex.RegexComplementExtractor", "classformatron_1_1formats_1_1regex_1_1RegexComplementExtractor.html", "classformatron_1_1formats_1_1regex_1_1RegexComplementExtractor" ] +]; \ No newline at end of file diff --git a/v0.4.9/regex_8py_source.html b/v0.4.9/regex_8py_source.html new file mode 100644 index 0000000..e96f74b --- /dev/null +++ b/v0.4.9/regex_8py_source.html @@ -0,0 +1,231 @@ + + + + + + + + +Formatron: src/formatron/formats/regex.py Source File + + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Formatron v0.4.9 + + +
    +
    Formatron empowers everyone to control the output format of language models with minimal overhead.
    +
    +
    + + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    +
    +
    +
    +
    +
    Loading...
    +
    Searching...
    +
    No Matches
    +
    +
    +
    +
    + +
    +
    regex.py
    +
    +
    +Go to the documentation of this file.
    1"""
    +
    2This module contains the RegexExtractor class, which is used to extract data using a regular expression.
    +
    3"""
    +
    4import re
    +
    5import typing
    +
    6from formatron.extractor import NonterminalExtractor
    +
    7
    +
    8
    + +
    10 """
    +
    11 An extractor that extracts a string using a regular expression.
    +
    12 """
    +
    + +
    14 def __init__(self, regex: str, capture_name: str, nonterminal: str):
    +
    15 """
    +
    16 Initialize the regex extractor.
    +
    17
    +
    18 Args:
    +
    19 regex: The regular expression for extraction.
    +
    20 capture_name: The name of the capture, or `None` if the extractor does not capture.
    +
    21 nonterminal: The nonterminal representing the extractor.
    +
    22 """
    +
    +
    23 super().__init__(nonterminal, capture_name)
    +
    24 self._regex = re.compile(regex)
    + +
    26 def extract(self, input_str: str) -> typing.Optional[tuple[str, re.Match | None]]:
    +
    +
    27 """
    +
    28 Extract the string using the regular expression.
    +
    29 Specifically, the first match(if any) of the regex pattern in the input string is returned.
    +
    30
    +
    31 Args:
    +
    32 input_str: The input string.
    +
    33 Returns:
    +
    34 The remaining string and the extracted `re.Match` object, or `None` if the extraction failed.
    +
    35 """
    +
    +
    36 matched = self._regex.match(input_str)
    +
    37 if not matched:
    +
    38 return None
    +
    39 return input_str[matched.span()[1]:], matched
    +
    40
    +
    41 @property
    +
    +
    42 def kbnf_definition(self) -> str:
    +
    43 return f"{self.nonterminal} ::= #{repr(self._regex.pattern)};"
    +
    44
    +
    45
    + +
    47 """
    +
    48 An extractor that extracts data by matching a regex complement.
    +
    49 """
    +
    + +
    51 def __init__(self, regex: str, capture_name: str, nonterminal: str):
    +
    52 """
    +
    +
    53 Initialize the regex complement extractor.
    +
    54 """
    +
    55 super().__init__(nonterminal, capture_name)
    +
    +
    56 self._regex = re.compile(regex)
    +
    57
    +
    58 def extract(self, input_str: str) -> typing.Optional[tuple[str, str]]:
    +
    +
    59 """
    +
    60 Extract the data by matching a regex complement.
    +
    61
    +
    62 Specifically, the string until the first character in the first match of the regex is extracted if there is a match,
    +
    63 or the entire string is extracted if there is no match.
    +
    +
    64 """
    +
    65 matched = self._regex.search(input_str)
    +
    66 if not matched:
    +
    67 return "", input_str
    +
    +
    68 return input_str[matched.span()[0]:], input_str[:matched.span()[0]]
    +
    69
    +
    70 @property
    +
    71 def kbnf_definition(self) -> str:
    +
    72 return f"{self.nonterminal} ::= #ex{repr(self._regex.pattern)};"
    +
    +
    An extractor that extracts data corresponding to a nonterminal.
    Definition extractor.py:98
    +
    An extractor that extracts data by matching a regex complement.
    Definition regex.py:59
    + + +
    An extractor that extracts a string using a regular expression.
    Definition regex.py:13
    + +
    __init__(self, str regex, str capture_name, str nonterminal)
    Initialize the regex extractor.
    Definition regex.py:23
    +
    typing.Optional[tuple[str, re.Match|None]] extract(self, str input_str)
    Extract the string using the regular expression.
    Definition regex.py:36
    + +
    Extractors for extracting data from generated strings.
    Definition extractor.py:1
    +
    +
    + + + + diff --git a/v0.4.9/resize.js b/v0.4.9/resize.js new file mode 100644 index 0000000..7d8cdc7 --- /dev/null +++ b/v0.4.9/resize.js @@ -0,0 +1,145 @@ +/* + @licstart The following is the entire license notice for the JavaScript code in this file. + + The MIT License (MIT) + + Copyright (C) 1997-2020 by Dimitri van Heesch + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software + and associated documentation files (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, publish, distribute, + sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or + substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING + BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + @licend The above is the entire license notice for the JavaScript code in this file + */ + +function initResizable(treeview) { + let sidenav,navtree,content,header,footer,barWidth=6; + const RESIZE_COOKIE_NAME = ''+'width'; + + function resizeWidth() { + const sidenavWidth = $(sidenav).outerWidth(); + content.css({marginLeft:parseInt(sidenavWidth)+"px"}); + if (typeof page_layout!=='undefined' && page_layout==1) { + footer.css({marginLeft:parseInt(sidenavWidth)+"px"}); + } + Cookie.writeSetting(RESIZE_COOKIE_NAME,sidenavWidth-barWidth); + } + + function restoreWidth(navWidth) { + content.css({marginLeft:parseInt(navWidth)+barWidth+"px"}); + if (typeof page_layout!=='undefined' && page_layout==1) { + footer.css({marginLeft:parseInt(navWidth)+barWidth+"px"}); + } + sidenav.css({width:navWidth + "px"}); + } + + function resizeHeight(treeview) { + const headerHeight = header.outerHeight(); + const windowHeight = $(window).height(); + let contentHeight; + if (treeview) + { + const footerHeight = footer.outerHeight(); + let navtreeHeight,sideNavHeight; + if (typeof page_layout==='undefined' || page_layout==0) { /* DISABLE_INDEX=NO */ + contentHeight = windowHeight - headerHeight - footerHeight; + navtreeHeight = contentHeight; + sideNavHeight = contentHeight; + } else if (page_layout==1) { /* DISABLE_INDEX=YES */ + contentHeight = windowHeight - footerHeight; + navtreeHeight = windowHeight - headerHeight; + sideNavHeight = windowHeight; + } + navtree.css({height:navtreeHeight + "px"}); + sidenav.css({height:sideNavHeight + "px"}); + } + else + { + contentHeight = windowHeight - headerHeight; + } + content.css({height:contentHeight + "px"}); + if (location.hash.slice(1)) { + (document.getElementById(location.hash.slice(1))||document.body).scrollIntoView(); + } + } + + function collapseExpand() { + let newWidth; + if (sidenav.width()>0) { + newWidth=0; + } else { + const width = Cookie.readSetting(RESIZE_COOKIE_NAME,250); + newWidth = (width>250 && width<$(window).width()) ? width : 250; + } + restoreWidth(newWidth); + const sidenavWidth = $(sidenav).outerWidth(); + Cookie.writeSetting(RESIZE_COOKIE_NAME,sidenavWidth-barWidth); + } + + header = $("#top"); + content = $("#doc-content"); + footer = $("#nav-path"); + sidenav = $("#side-nav"); + if (!treeview) { +// title = $("#titlearea"); +// titleH = $(title).height(); +// let animating = false; +// content.on("scroll", function() { +// slideOpts = { duration: 200, +// step: function() { +// contentHeight = $(window).height() - header.outerHeight(); +// content.css({ height : contentHeight + "px" }); +// }, +// done: function() { animating=false; } +// }; +// if (content.scrollTop()>titleH && title.css('display')!='none' && !animating) { +// title.slideUp(slideOpts); +// animating=true; +// } else if (content.scrollTop()<=titleH && title.css('display')=='none' && !animating) { +// title.slideDown(slideOpts); +// animating=true; +// } +// }); + } else { + navtree = $("#nav-tree"); + $(".side-nav-resizable").resizable({resize: function(e, ui) { resizeWidth(); } }); + $(sidenav).resizable({ minWidth: 0 }); + } + $(window).resize(function() { resizeHeight(treeview); }); + if (treeview) + { + const device = navigator.userAgent.toLowerCase(); + const touch_device = device.match(/(iphone|ipod|ipad|android)/); + if (touch_device) { /* wider split bar for touch only devices */ + $(sidenav).css({ paddingRight:'20px' }); + $('.ui-resizable-e').css({ width:'20px' }); + $('#nav-sync').css({ right:'34px' }); + barWidth=20; + } + const width = Cookie.readSetting(RESIZE_COOKIE_NAME,250); + if (width) { restoreWidth(width); } else { resizeWidth(); } + } + resizeHeight(treeview); + const url = location.href; + const i=url.indexOf("#"); + if (i>=0) window.location.hash=url.substr(i); + const _preventDefault = function(evt) { evt.preventDefault(); }; + if (treeview) + { + $("#splitbar").bind("dragstart", _preventDefault).bind("selectstart", _preventDefault); + $(".ui-resizable-handle").dblclick(collapseExpand); + } + $(window).on('load',resizeHeight); +} +/* @license-end */ diff --git a/v0.4.9/schema_8py.html b/v0.4.9/schema_8py.html new file mode 100644 index 0000000..dbe5c91 --- /dev/null +++ b/v0.4.9/schema_8py.html @@ -0,0 +1,169 @@ + + + + + + + + +Formatron: src/formatron/schemas/schema.py File Reference + + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Formatron v0.4.9 + + +
    +
    Formatron empowers everyone to control the output format of language models with minimal overhead.
    +
    +
    + + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    +
    +
    +
    +
    +
    Loading...
    +
    Searching...
    +
    No Matches
    +
    +
    +
    +
    + +
    + +
    schema.py File Reference
    +
    +
    + +

    Go to the source code of this file.

    + + + + + + + + + + + + + + +

    +Classes

    class  formatron.schemas.schema.FieldInfo
     An abstract field info that describes a data field in a schema. More...
     
    class  formatron.schemas.schema.TypeWithMetadata
     A type with metadata. More...
     
    class  formatron.schemas.schema.Schema
     An abstract schema that describes some data. More...
     
    class  formatron.schemas.schema.SubstringOf
     A metadata class that indicates that the field is a substring of the given string. More...
     
    + + + + + + + + + +

    +Namespaces

    namespace  formatron
     
    namespace  formatron.schemas
     This subpackage contains modules that define schemas creation from various sources.
     
    namespace  formatron.schemas.schema
     This module contains the Schema abstract class and FieldInfo abstract class.
     
    +
    +
    + + + + diff --git a/v0.4.9/schema_8py.js b/v0.4.9/schema_8py.js new file mode 100644 index 0000000..c1303d1 --- /dev/null +++ b/v0.4.9/schema_8py.js @@ -0,0 +1,7 @@ +var schema_8py = +[ + [ "formatron.schemas.schema.FieldInfo", "classformatron_1_1schemas_1_1schema_1_1FieldInfo.html", "classformatron_1_1schemas_1_1schema_1_1FieldInfo" ], + [ "formatron.schemas.schema.TypeWithMetadata", "classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata.html", "classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata" ], + [ "formatron.schemas.schema.Schema", "classformatron_1_1schemas_1_1schema_1_1Schema.html", "classformatron_1_1schemas_1_1schema_1_1Schema" ], + [ "formatron.schemas.schema.SubstringOf", "classformatron_1_1schemas_1_1schema_1_1SubstringOf.html", null ] +]; \ No newline at end of file diff --git a/v0.4.9/schema_8py_source.html b/v0.4.9/schema_8py_source.html new file mode 100644 index 0000000..2247b54 --- /dev/null +++ b/v0.4.9/schema_8py_source.html @@ -0,0 +1,230 @@ + + + + + + + + +Formatron: src/formatron/schemas/schema.py Source File + + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Formatron v0.4.9 + + +
    +
    Formatron empowers everyone to control the output format of language models with minimal overhead.
    +
    +
    + + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    +
    +
    +
    +
    +
    Loading...
    +
    Searching...
    +
    No Matches
    +
    +
    +
    +
    + +
    +
    schema.py
    +
    +
    +Go to the documentation of this file.
    1"""
    +
    2This module contains the Schema abstract class and FieldInfo abstract class.
    +
    3"""
    +
    4import abc
    +
    5from dataclasses import dataclass
    +
    6import typing
    +
    7
    +
    8
    +
    9class FieldInfo(abc.ABC):
    +
    10 """
    +
    11 An abstract field info that describes a data field in a schema.
    +
    12 """
    +
    +
    13 @property
    +
    14 @abc.abstractmethod
    +
    15 def annotation(self) -> typing.Type[typing.Any] | None:
    +
    16 """
    +
    17 Get the type annotation of the field.
    +
    18 """
    +
    19 pass
    +
    20
    +
    21 @property
    +
    22 @abc.abstractmethod
    +
    23 def required(self) -> bool:
    +
    24 """
    +
    25 Check if the field is required for the schema.
    +
    +
    26 """
    +
    27 pass
    +
    28
    +
    +
    29class TypeWithMetadata:
    +
    30 """
    +
    31 A type with metadata.
    +
    32 """
    +
    33 def __init__(self, type: typing.Type[typing.Any], metadata: dict[str, typing.Any]|None):
    +
    34 self._type = type
    +
    35 self._metadata = metadata
    +
    36
    +
    37 @property
    +
    38 def type(self) -> typing.Type[typing.Any]:
    +
    39 """
    +
    40 Get the type of the type with metadata.
    +
    41 """
    +
    42 return self._type
    +
    + +
    44 @property
    +
    45 def metadata(self) -> dict[str, typing.Any]|None:
    +
    +
    46 """
    +
    47 Get the metadata of the type with metadata.
    +
    +
    48 """
    +
    49 return self._metadata
    +
    50
    +
    +
    51class Schema(abc.ABC):
    +
    +
    52 """
    +
    53 An abstract schema that describes some data.
    +
    54 """
    +
    55 @classmethod
    +
    +
    56 @abc.abstractmethod
    +
    57 def fields(cls) -> dict[str, FieldInfo]:
    +
    58 """
    +
    59 Get the fields of the schema.
    +
    60 """
    +
    61 pass
    +
    62
    +
    63 @classmethod
    +
    64 @abc.abstractmethod
    +
    65 def from_json(cls, json: str) -> "Schema":
    +
    66 """
    +
    +
    67 Create a schema from a JSON string.
    +
    68 """
    +
    69 pass
    +
    +
    70
    +
    71@dataclass
    +
    72class SubstringOf:
    +
    73 """
    +
    74 A metadata class that indicates that the field is a substring of the given string.
    +
    75 """
    +
    76 substring_of: str
    +
    +
    An abstract field info that describes a data field in a schema.
    Definition schema.py:13
    +
    typing.Type[typing.Any]|None annotation(self)
    Get the type annotation of the field.
    Definition schema.py:26
    +
    bool required(self)
    Check if the field is required for the schema.
    Definition schema.py:43
    +
    An abstract schema that describes some data.
    Definition schema.py:91
    +
    A metadata class that indicates that the field is a substring of the given string.
    Definition schema.py:130
    +
    +
    + + + + diff --git a/v0.4.9/schemas_2____init_____8py.html b/v0.4.9/schemas_2____init_____8py.html new file mode 100644 index 0000000..d2357f0 --- /dev/null +++ b/v0.4.9/schemas_2____init_____8py.html @@ -0,0 +1,150 @@ + + + + + + + + +Formatron: src/formatron/schemas/__init__.py File Reference + + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Formatron v0.4.9 + + +
    +
    Formatron empowers everyone to control the output format of language models with minimal overhead.
    +
    +
    + + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    +
    +
    +
    +
    +
    Loading...
    +
    Searching...
    +
    No Matches
    +
    +
    +
    +
    + +
    + +
    __init__.py File Reference
    +
    +
    + +

    Go to the source code of this file.

    + + + + + + + +

    +Namespaces

    namespace  formatron
     
    namespace  formatron.schemas
     This subpackage contains modules that define schemas creation from various sources.
     
    +
    +
    + + + + diff --git a/v0.4.9/schemas_2____init_____8py_source.html b/v0.4.9/schemas_2____init_____8py_source.html new file mode 100644 index 0000000..f77d17a --- /dev/null +++ b/v0.4.9/schemas_2____init_____8py_source.html @@ -0,0 +1,145 @@ + + + + + + + + +Formatron: src/formatron/schemas/__init__.py Source File + + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Formatron v0.4.9 + + +
    +
    Formatron empowers everyone to control the output format of language models with minimal overhead.
    +
    +
    + + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    +
    +
    +
    +
    +
    Loading...
    +
    Searching...
    +
    No Matches
    +
    +
    +
    +
    + +
    +
    __init__.py
    +
    +
    +Go to the documentation of this file.
    1"""
    +
    2This subpackage contains modules that define schemas creation from various sources.
    +
    3"""
    +
    4# the following imports are needed as python subpackage imports seem to have some issues
    +
    5from . import schema
    +
    6from . import pydantic
    +
    7from . import dict_inference
    +
    8from . import json_schema
    +
    +
    + + + + diff --git a/v0.4.9/search/all_0.js b/v0.4.9/search/all_0.js new file mode 100644 index 0000000..83a4c22 --- /dev/null +++ b/v0.4.9/search/all_0.js @@ -0,0 +1,73 @@ +var searchData= +[ + ['_5f_5fcall_5f_5f_0',['__call__',['../classformatron_1_1integrations_1_1transformers_1_1FormattersLogitsProcessor.html#af5ec5643f3c51046cb3b5e73fbb04f2b',1,'formatron.integrations.transformers.FormattersLogitsProcessor.__call__()'],['../classformatron_1_1integrations_1_1vllm_1_1FormattersLogitsProcessor.html#ad4a81bb45d259bb5408433cdb6cbafdd',1,'formatron.integrations.vllm.FormattersLogitsProcessor.__call__()']]], + ['_5f_5finit_5f_5f_1',['__init__',['../classformatron_1_1extractor_1_1Extractor.html#a569fc7895a82f4d4b59866719219d4e0',1,'formatron.extractor.Extractor.__init__()'],['../classformatron_1_1extractor_1_1NonterminalExtractor.html#a45c14f79c14b539837ebdd26c3b5567b',1,'formatron.extractor.NonterminalExtractor.__init__()'],['../classformatron_1_1extractor_1_1LiteralExtractor.html#ab4da390ad7efaf5a3aab0e0ccb78fab3',1,'formatron.extractor.LiteralExtractor.__init__()'],['../classformatron_1_1extractor_1_1ChoiceExtractor.html#a1a91b31475c7348a3cf9fab97c6d26f0',1,'formatron.extractor.ChoiceExtractor.__init__()'],['../classformatron_1_1extractor_1_1SubstringExtractor.html#a843997315c77b9c7c6eb84ba7e02ff83',1,'formatron.extractor.SubstringExtractor.__init__()'],['../classformatron_1_1formats_1_1json_1_1JsonExtractor.html#a7a51edd3cc7c24370c809d91e07771dc',1,'formatron.formats.json.JsonExtractor.__init__()'],['../classformatron_1_1formats_1_1regex_1_1RegexExtractor.html#a6fc2f05d044cce49935c415248de5e5a',1,'formatron.formats.regex.RegexExtractor.__init__()'],['../classformatron_1_1formats_1_1regex_1_1RegexComplementExtractor.html#a77937657607e5679dbc52d87ad10bb55',1,'formatron.formats.regex.RegexComplementExtractor.__init__()'],['../classformatron_1_1formatter_1_1Formatter.html#a369269f53f32be2f1d92663670354515',1,'formatron.formatter.Formatter.__init__()'],['../classformatron_1_1formatter_1_1FormatterBuilder.html#abb13104747355cae16e6ad0c3067fac8',1,'formatron.formatter.FormatterBuilder.__init__()'],['../classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#adc94d2f2ddd06f966dca93079f17df8c',1,'formatron.integrations.exllamav2.FormatterFilter.__init__()'],['../classformatron_1_1integrations_1_1RWKV_1_1PIPELINE__ARGS.html#a53a892118d9b168024aaa6062f92cd7c',1,'formatron.integrations.RWKV.PIPELINE_ARGS.__init__()'],['../classformatron_1_1integrations_1_1RWKV_1_1PIPELINE.html#aa646fb0bf5f3674d1daba91dd0320017',1,'formatron.integrations.RWKV.PIPELINE.__init__()'],['../classformatron_1_1integrations_1_1transformers_1_1FormattersLogitsProcessor.html#aa70d2276eeb09fdf53066e4019df79df',1,'formatron.integrations.transformers.FormattersLogitsProcessor.__init__()'],['../classformatron_1_1integrations_1_1vllm_1_1FormattersLogitsProcessor.html#a0ee5e6edc8fc11dfd7406c140c13b7b9',1,'formatron.integrations.vllm.FormattersLogitsProcessor.__init__()'],['../classformatron_1_1schemas_1_1dict__inference_1_1FieldInfo.html#a0286ba9c9e6509ce23d530409209b5da',1,'formatron.schemas.dict_inference.FieldInfo.__init__()'],['../classformatron_1_1schemas_1_1json__schema_1_1FieldInfo.html#abc61867418b7f30a3545e71c9b28e708',1,'formatron.schemas.json_schema.FieldInfo.__init__()'],['../classformatron_1_1schemas_1_1pydantic_1_1FieldInfo.html#a4a5a010c6acef15f8fe2d4318223696b',1,'formatron.schemas.pydantic.FieldInfo.__init__()'],['../classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata.html#a0c3cf51ceb503d4d195f5623d57e160b',1,'formatron.schemas.schema.TypeWithMetadata.__init__()']]], + ['_5f_5finit_5f_5f_2epy_2',['__init__.py',['../____init_____8py.html',1,'(Global Namespace)'],['../formats_2____init_____8py.html',1,'(Global Namespace)'],['../integrations_2____init_____8py.html',1,'(Global Namespace)'],['../schemas_2____init_____8py.html',1,'(Global Namespace)']]], + ['_5f_5frepr_5f_5f_3',['__repr__',['../classformatron_1_1schemas_1_1pydantic_1_1FieldInfo.html#ad291e8df78d045d3364bc6a17582b416',1,'formatron::schemas::pydantic::FieldInfo']]], + ['_5f_5fstr_5f_5f_4',['__str__',['../classformatron_1_1extractor_1_1Extractor.html#afe6a1f745fd56540ccff5fdc5d00f0a5',1,'formatron.extractor.Extractor.__str__()'],['../classformatron_1_1formatter_1_1Formatter.html#a827c993f0ac74abff6276b3af6058e3f',1,'formatron.formatter.Formatter.__str__()'],['../classformatron_1_1schemas_1_1pydantic_1_1FieldInfo.html#a49ac1734cddfadc1b7721f57775890a6',1,'formatron.schemas.pydantic.FieldInfo.__str__()']]], + ['_5fadd_5fcapture_5fname_5',['_add_capture_name',['../classformatron_1_1formatter_1_1FormatterBuilder.html#a1e97daf55b4149be6aaa5dd747ed6146',1,'formatron::formatter::FormatterBuilder']]], + ['_5fadd_5fextractor_6',['_add_extractor',['../classformatron_1_1formatter_1_1FormatterBuilder.html#a6e495e90b9da81108b6627166872bbbb',1,'formatron::formatter::FormatterBuilder']]], + ['_5fannotation_7',['_annotation',['../classformatron_1_1schemas_1_1dict__inference_1_1FieldInfo.html#af85ec1a61b7ef87729757cef077c4df4',1,'formatron.schemas.dict_inference.FieldInfo._annotation'],['../classformatron_1_1schemas_1_1json__schema_1_1FieldInfo.html#a82c87a6773b72ee766add0dc893482b0',1,'formatron.schemas.json_schema.FieldInfo._annotation'],['../classformatron_1_1schemas_1_1pydantic_1_1FieldInfo.html#aab00d20e817e3ea9fc15295a94e8242b',1,'formatron.schemas.pydantic.FieldInfo._annotation']]], + ['_5fassert_5fcapture_5fname_5fvalid_8',['_assert_capture_name_valid',['../classformatron_1_1formatter_1_1FormatterBuilder.html#ab5ad5186f55d35e3abd2d5c213302a25',1,'formatron::formatter::FormatterBuilder']]], + ['_5fcapture_5fname_9',['_capture_name',['../classformatron_1_1extractor_1_1Extractor.html#a3299dc34a7276ab8ab553513048211d3',1,'formatron::extractor::Extractor']]], + ['_5fcapture_5fnames_10',['_capture_names',['../classformatron_1_1formatter_1_1FormatterBuilder.html#a68daf6b6bbd2f32843352dc6ea1f4b8f',1,'formatron::formatter::FormatterBuilder']]], + ['_5fcaptures_11',['_captures',['../classformatron_1_1formatter_1_1Formatter.html#a43964a72280fd307cd74528657beeca3',1,'formatron::formatter::Formatter']]], + ['_5fchoices_12',['_choices',['../classformatron_1_1extractor_1_1ChoiceExtractor.html#a6ea971d4c6915dc2b5ece64cd010a087',1,'formatron::extractor::ChoiceExtractor']]], + ['_5fconfig_13',['_config',['../classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#ae43a79de8cc0fb018df02e7edab028ee',1,'formatron::integrations::exllamav2::FormatterFilter']]], + ['_5fconfigs_14',['_configs',['../classformatron_1_1integrations_1_1vllm_1_1FormattersLogitsProcessor.html#aef140b4278cf9892faa3644bd4c2ca99',1,'formatron::integrations::vllm::FormattersLogitsProcessor']]], + ['_5fconvert_5fjson_5fschema_5fto_5four_5fschema_15',['_convert_json_schema_to_our_schema',['../namespaceformatron_1_1schemas_1_1json__schema.html#a5f4856cb7c30aa340432d386836f25be',1,'formatron::schemas::json_schema']]], + ['_5fcounter_16',['_counter',['../classformatron_1_1formatter_1_1FormatterBuilder.html#a937af7ea452c8183053dc3e12cd44e1c',1,'formatron.formatter.FormatterBuilder._counter'],['../namespaceformatron_1_1schemas_1_1json__schema.html#a63e9b97210ccf01282f81aa529a86e50',1,'formatron.schemas.json_schema._counter']]], + ['_5fcreate_5fcustom_5ftype_17',['_create_custom_type',['../namespaceformatron_1_1schemas_1_1json__schema.html#a15dc86b65c90ac8423c8989054f8c9e5',1,'formatron::schemas::json_schema']]], + ['_5fcreate_5fnonterminal_18',['_create_nonterminal',['../classformatron_1_1formatter_1_1FormatterBuilder.html#aefe18951a4dc243909a22dd49b62fe21',1,'formatron::formatter::FormatterBuilder']]], + ['_5fdebug_5fcounter_19',['_debug_counter',['../classformatron_1_1integrations_1_1vllm_1_1FormattersLogitsProcessor.html#a83ec1613155b800bd9d1b0f012dff371',1,'formatron::integrations::vllm::FormattersLogitsProcessor']]], + ['_5fdecode_5fcallback_20',['_decode_callback',['../classformatron_1_1formatter_1_1Formatter.html#a9535e6eb6b8001d6f5fc90ee549ecacb',1,'formatron::formatter::Formatter']]], + ['_5fengine_21',['_engine',['../classformatron_1_1formatter_1_1Formatter.html#a73ef6ac966b418215e6c216a90520860',1,'formatron::formatter::Formatter']]], + ['_5feos_5ftoken_5fid_22',['_eos_token_id',['../classformatron_1_1integrations_1_1transformers_1_1FormattersLogitsProcessor.html#a7731ed1ab6807c0de6c29ebfefd6975f',1,'formatron.integrations.transformers.FormattersLogitsProcessor._eos_token_id'],['../classformatron_1_1integrations_1_1vllm_1_1FormattersLogitsProcessor.html#a9c18332e5d1133b7524a8dde402f2677',1,'formatron.integrations.vllm.FormattersLogitsProcessor._eos_token_id']]], + ['_5fextract_5ffields_5ffrom_5fobject_5ftype_23',['_extract_fields_from_object_type',['../namespaceformatron_1_1schemas_1_1json__schema.html#af20251afc012b955e29c92922fcc83ef',1,'formatron::schemas::json_schema']]], + ['_5fextractors_24',['_extractors',['../classformatron_1_1formatter_1_1Formatter.html#a77fc80d958ed5878393546c1a24d75e5',1,'formatron.formatter.Formatter._extractors'],['../classformatron_1_1formatter_1_1FormatterBuilder.html#a4c10094d828cde5bf73bbd5d3d11e582',1,'formatron.formatter.FormatterBuilder._extractors']]], + ['_5ffield_25',['_field',['../classformatron_1_1schemas_1_1pydantic_1_1FieldInfo.html#abb92e2d49fec513432cced795bd853e2',1,'formatron::schemas::pydantic::FieldInfo']]], + ['_5fformatter_26',['_formatter',['../classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#a568277b00bef848b3fccbfa7030c435f',1,'formatron::integrations::exllamav2::FormatterFilter']]], + ['_5fformatter_5fbuilder_5fcounter_27',['_formatter_builder_counter',['../classformatron_1_1formatter_1_1FormatterBuilder.html#aa8758ea6ca6a84da7583b28522e447a9',1,'formatron::formatter::FormatterBuilder']]], + ['_5fformatters_28',['_formatters',['../classformatron_1_1integrations_1_1transformers_1_1FormattersLogitsProcessor.html#a50a0787df5f246965db8481f0700d0b4',1,'formatron.integrations.transformers.FormattersLogitsProcessor._formatters'],['../classformatron_1_1integrations_1_1vllm_1_1FormattersLogitsProcessor.html#ab9ca25ee76354b711cb5dd892eb5ab0f',1,'formatron.integrations.vllm.FormattersLogitsProcessor._formatters']]], + ['_5fgenerate_5fkbnf_5fgrammar_29',['_generate_kbnf_grammar',['../namespaceformatron_1_1formats_1_1json.html#af4331f1a7679439503d898b2356d289e',1,'formatron::formats::json']]], + ['_5fget_5fliteral_30',['_get_literal',['../namespaceformatron_1_1schemas_1_1json__schema.html#a096ea829025ebd26b9ae165c17cf8976',1,'formatron::schemas::json_schema']]], + ['_5fgrammar_5fstr_31',['_grammar_str',['../classformatron_1_1formatter_1_1Formatter.html#aac1bf058d35745650f1838ea64b66ad2',1,'formatron::formatter::Formatter']]], + ['_5fhandle_5fanyof_32',['_handle_anyOf',['../namespaceformatron_1_1schemas_1_1json__schema.html#a6f88bf4e3c48d96b060ccdcbd80b3328',1,'formatron::schemas::json_schema']]], + ['_5fhandle_5flist_5fmetadata_33',['_handle_list_metadata',['../namespaceformatron_1_1schemas_1_1json__schema.html#ac84df1d5caa0ab01d58207e4401be0dc',1,'formatron::schemas::json_schema']]], + ['_5fhandle_5fliteral_34',['_handle_literal',['../namespaceformatron_1_1schemas_1_1json__schema.html#a969bd30894a578428528b94b0f82f1ba',1,'formatron::schemas::json_schema']]], + ['_5fhandle_5fnumeric_5fwith_5fmetadata_35',['_handle_numeric_with_metadata',['../namespaceformatron_1_1schemas_1_1json__schema.html#ad187a02f7616ccbb83c00462996a7fe1',1,'formatron::schemas::json_schema']]], + ['_5fhandle_5fstr_5fwith_5fmetadata_36',['_handle_str_with_metadata',['../namespaceformatron_1_1schemas_1_1json__schema.html#a32e51b70be50d55d3944e6c700bbd1a5',1,'formatron::schemas::json_schema']]], + ['_5fhuggingface_5fbytelevel_5fdecoder_37',['_huggingface_bytelevel_decoder',['../namespaceformatron_1_1integrations_1_1utils.html#a4e53f8f5754530f8fa7d627504c98f6a',1,'formatron::integrations::utils']]], + ['_5finfer_5ftype_38',['_infer_type',['../namespaceformatron_1_1schemas_1_1dict__inference.html#ad5cac24e76dc097a995f31d3d0ff9efc',1,'formatron.schemas.dict_inference._infer_type()'],['../namespaceformatron_1_1schemas_1_1json__schema.html#ac742e1e581efccb6cc9742e7a23c25c2',1,'formatron.schemas.json_schema._infer_type()']]], + ['_5finstance_5fid_39',['_instance_id',['../classformatron_1_1formatter_1_1FormatterBuilder.html#a8a5b16f094013fb3926acfadd30c4456',1,'formatron::formatter::FormatterBuilder']]], + ['_5fiter_40',['_iter',['../classformatron_1_1integrations_1_1vllm_1_1FormattersLogitsProcessor.html#ad7cf01b455ab6847df5c96912a5d2ae9',1,'formatron::integrations::vllm::FormattersLogitsProcessor']]], + ['_5flast_5finput_5fid_5flength_41',['_last_input_id_length',['../classformatron_1_1integrations_1_1transformers_1_1FormattersLogitsProcessor.html#a24c02e28fdbae4450af7527f93400fa7',1,'formatron.integrations.transformers.FormattersLogitsProcessor._last_input_id_length'],['../classformatron_1_1integrations_1_1vllm_1_1FormattersLogitsProcessor.html#aa6549c4f4130d1778f69e3e99942a87b',1,'formatron.integrations.vllm.FormattersLogitsProcessor._last_input_id_length']]], + ['_5fliteral_42',['_literal',['../classformatron_1_1extractor_1_1LiteralExtractor.html#a333e99fa481e15e9d907d35cda8ee728',1,'formatron::extractor::LiteralExtractor']]], + ['_5fmain_5frule_43',['_main_rule',['../classformatron_1_1formatter_1_1FormatterBuilder.html#a3c3ba1934b9207c412202c5ef29b002a',1,'formatron::formatter::FormatterBuilder']]], + ['_5fmerge_5fkey_44',['_merge_key',['../namespaceformatron_1_1schemas_1_1json__schema.html#a5fcddd43a5f64374b5b75d4aafeb9135',1,'formatron::schemas::json_schema']]], + ['_5fmerge_5freferenced_5fschema_45',['_merge_referenced_schema',['../namespaceformatron_1_1schemas_1_1json__schema.html#a45c9b97319a58c2013b8e3f10ad78c30',1,'formatron::schemas::json_schema']]], + ['_5fmetadata_46',['_metadata',['../classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata.html#a34312895f9d497d5c35cf372f9c498f3',1,'formatron::schemas::schema::TypeWithMetadata']]], + ['_5fmultiple_5freplace_47',['_multiple_replace',['../namespaceformatron_1_1integrations_1_1utils.html#a49fe0eaafb8d1f9909e2d2520c2ea657',1,'formatron::integrations::utils']]], + ['_5fnonterminal_48',['_nonterminal',['../classformatron_1_1extractor_1_1NonterminalExtractor.html#a5c4c968b45e328b8caa4b2795ecc00fe',1,'formatron::extractor::NonterminalExtractor']]], + ['_5fnonterminal_5fto_5fextractor_49',['_nonterminal_to_extractor',['../classformatron_1_1formatter_1_1FormatterBuilder.html#a870a5075cfd903c77e5ee58b6c304e03',1,'formatron::formatter::FormatterBuilder']]], + ['_5fobtain_5faccepted_5foutput_50',['_obtain_accepted_output',['../classformatron_1_1formatter_1_1Formatter.html#ae4be840a942f608c1a0c256dbf68901b',1,'formatron::formatter::Formatter']]], + ['_5fobtain_5ftype_51',['_obtain_type',['../namespaceformatron_1_1schemas_1_1json__schema.html#a544d74edf1fdccbad9e216d9ff028a20',1,'formatron::schemas::json_schema']]], + ['_5fon_5fcompletion_52',['_on_completion',['../classformatron_1_1formatter_1_1FormatterBase.html#a469880a21192928e82823cc340a22ce2',1,'formatron.formatter.FormatterBase._on_completion()'],['../classformatron_1_1formatter_1_1Formatter.html#ac6f7e3f96c6318689c5cd0d44a1cdde7',1,'formatron.formatter.Formatter._on_completion()']]], + ['_5fpass_5ftokens_53',['_pass_tokens',['../classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#a370eaf641dd803b2759b4e5fc7f74a1c',1,'formatron::integrations::exllamav2::FormatterFilter']]], + ['_5frecursive_5fresolve_5freference_54',['_recursive_resolve_reference',['../namespaceformatron_1_1schemas_1_1json__schema.html#aaba012c79d101be93f4d96588c9f8cc2',1,'formatron::schemas::json_schema']]], + ['_5fregex_55',['_regex',['../classformatron_1_1formats_1_1regex_1_1RegexExtractor.html#a1df60401933eef6cf5a1ff041f11ec46',1,'formatron.formats.regex.RegexExtractor._regex'],['../classformatron_1_1formats_1_1regex_1_1RegexComplementExtractor.html#a92339b2492a3591a412f177ba5c2e2ec',1,'formatron.formats.regex.RegexComplementExtractor._regex']]], + ['_5fregister_5fall_5fpredefined_5ftypes_56',['_register_all_predefined_types',['../namespaceformatron_1_1formats_1_1json.html#a311b750cba3838aee622b9809888f051',1,'formatron::formats::json']]], + ['_5frequired_57',['_required',['../classformatron_1_1schemas_1_1json__schema_1_1FieldInfo.html#a8ac1acf32bb578e121ef28a433857726',1,'formatron::schemas::json_schema::FieldInfo']]], + ['_5fresolve_5fnew_5furl_58',['_resolve_new_url',['../namespaceformatron_1_1schemas_1_1json__schema.html#a9dc9dc267e5dd7b6581e2367e9238152',1,'formatron::schemas::json_schema']]], + ['_5fresolve_5freference_59',['_resolve_reference',['../namespaceformatron_1_1schemas_1_1json__schema.html#a24b516494672cc5dbbf7300ea65479b1',1,'formatron::schemas::json_schema']]], + ['_5frule_5fstr_60',['_rule_str',['../classformatron_1_1formats_1_1json_1_1JsonExtractor.html#aecf88428e414da080f11ed0ab1e13a65',1,'formatron::formats::json::JsonExtractor']]], + ['_5frules_61',['_rules',['../classformatron_1_1formatter_1_1FormatterBuilder.html#a62c61ad02e40526b73ca460d0cf1d12c',1,'formatron::formatter::FormatterBuilder']]], + ['_5fstring_62',['_string',['../classformatron_1_1extractor_1_1SubstringExtractor.html#a3781b75c6c8c12f89fd70ea405e11293',1,'formatron::extractor::SubstringExtractor']]], + ['_5fsuffix_5fautomaton_63',['_suffix_automaton',['../classformatron_1_1extractor_1_1SubstringExtractor.html#a97cb3468674873adfc85bc17ff1a9a97',1,'formatron::extractor::SubstringExtractor']]], + ['_5fto_5fnext_5fbatch_5fstep_64',['_to_next_batch_step',['../classformatron_1_1integrations_1_1vllm_1_1FormattersLogitsProcessor.html#ab87fea11f930a33130cecadd8cdf0cc6',1,'formatron::integrations::vllm::FormattersLogitsProcessor']]], + ['_5fto_5fobject_65',['_to_object',['../classformatron_1_1formats_1_1json_1_1JsonExtractor.html#a2e72d806c8dffc0136231b81eb724355',1,'formatron::formats::json::JsonExtractor']]], + ['_5ftoken_5fid_5for_5fbytes_66',['_token_id_or_bytes',['../classformatron_1_1formatter_1_1Formatter.html#adf232d46083546ae3363e4ce007a335b',1,'formatron::formatter::Formatter']]], + ['_5ftype_67',['_type',['../classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata.html#a4d1ea7d59f700634eb2545ce3d6cf324',1,'formatron::schemas::schema::TypeWithMetadata']]], + ['_5ftype_5fto_5fnonterminals_68',['_type_to_nonterminals',['../namespaceformatron_1_1formats_1_1json.html#a003a1dac95634ac70f86d51e768945a4',1,'formatron::formats::json']]], + ['_5fvalidate_5fjson_5fschema_69',['_validate_json_schema',['../namespaceformatron_1_1schemas_1_1json__schema.html#a51aa68e29951e6b295844b13177b7d6a',1,'formatron::schemas::json_schema']]] +]; diff --git a/v0.4.9/search/all_1.js b/v0.4.9/search/all_1.js new file mode 100644 index 0000000..7344930 --- /dev/null +++ b/v0.4.9/search/all_1.js @@ -0,0 +1,10 @@ +var searchData= +[ + ['accept_5fbytes_0',['accept_bytes',['../classformatron_1_1formatter_1_1FormatterBase.html#ac0f91549079380a53228322dd4473cf1',1,'formatron.formatter.FormatterBase.accept_bytes()'],['../classformatron_1_1formatter_1_1Formatter.html#a178a37715ce463e6e57c530166c7ec6d',1,'formatron.formatter.Formatter.accept_bytes()']]], + ['accept_5ftoken_1',['accept_token',['../classformatron_1_1formatter_1_1FormatterBase.html#a87d1513c3f70fdee18d65fae4f71101d',1,'formatron.formatter.FormatterBase.accept_token()'],['../classformatron_1_1formatter_1_1Formatter.html#a839eb7550ee4afbd305b25ddcca5c4dc',1,'formatron.formatter.Formatter.accept_token()']]], + ['annotation_2',['annotation',['../classformatron_1_1schemas_1_1dict__inference_1_1FieldInfo.html#a163fde7bbaa2e613b5af3a4a12b9152d',1,'formatron.schemas.dict_inference.FieldInfo.annotation()'],['../classformatron_1_1schemas_1_1json__schema_1_1FieldInfo.html#a28f43dedc0eaf02cd16423172440208a',1,'formatron.schemas.json_schema.FieldInfo.annotation()'],['../classformatron_1_1schemas_1_1pydantic_1_1FieldInfo.html#ac9e5af7e4cb356a450e9e48f3af24cfe',1,'formatron.schemas.pydantic.FieldInfo.annotation()'],['../classformatron_1_1schemas_1_1schema_1_1FieldInfo.html#a5c7b1d8b8d8d52426e95a3f326cf3e75',1,'formatron.schemas.schema.FieldInfo.annotation()']]], + ['append_5fline_3',['append_line',['../classformatron_1_1formatter_1_1FormatterBuilder.html#aa57e56f8d74b03eb4559106d189970c3',1,'formatron::formatter::FormatterBuilder']]], + ['append_5fmultiline_5fstr_4',['append_multiline_str',['../classformatron_1_1formatter_1_1FormatterBuilder.html#a0e4da27aacaa16880ed463a9f86edff4',1,'formatron::formatter::FormatterBuilder']]], + ['append_5fstr_5',['append_str',['../classformatron_1_1formatter_1_1FormatterBuilder.html#a171eca2a241aaf0f5f1fa8c117694337',1,'formatron::formatter::FormatterBuilder']]], + ['autodetect_5fprocessors_6',['autodetect_processors',['../namespaceformatron_1_1integrations_1_1utils.html#ae2a9a65fa02be2e0d6d41b24e276cbf4',1,'formatron::integrations::utils']]] +]; diff --git a/v0.4.9/search/all_10.js b/v0.4.9/search/all_10.js new file mode 100644 index 0000000..9ffc95a --- /dev/null +++ b/v0.4.9/search/all_10.js @@ -0,0 +1,10 @@ +var searchData= +[ + ['schema_0',['Schema',['../classformatron_1_1schemas_1_1schema_1_1Schema.html',1,'formatron::schemas::schema']]], + ['schema_2epy_1',['schema.py',['../schema_8py.html',1,'']]], + ['space_5fnonterminal_2',['SPACE_NONTERMINAL',['../namespaceformatron_1_1formats_1_1json.html#af32c4b136b54f0356b017d6a319bb53d',1,'formatron::formats::json']]], + ['str_3',['str',['../classformatron_1_1formatter_1_1FormatterBuilder.html#ad467a40f82a47dff9bb2b95d1300ace0',1,'formatron::formatter::FormatterBuilder']]], + ['substr_4',['substr',['../classformatron_1_1formatter_1_1FormatterBuilder.html#ab98ad2c47fcb7be56521d3eadb4e643b',1,'formatron::formatter::FormatterBuilder']]], + ['substringextractor_5',['SubstringExtractor',['../classformatron_1_1extractor_1_1SubstringExtractor.html',1,'formatron::extractor']]], + ['substringof_6',['SubstringOf',['../classformatron_1_1schemas_1_1schema_1_1SubstringOf.html',1,'formatron::schemas::schema']]] +]; diff --git a/v0.4.9/search/all_11.js b/v0.4.9/search/all_11.js new file mode 100644 index 0000000..335d858 --- /dev/null +++ b/v0.4.9/search/all_11.js @@ -0,0 +1,6 @@ +var searchData= +[ + ['transformers_2epy_0',['transformers.py',['../transformers_8py.html',1,'']]], + ['type_1',['type',['../classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata.html#ada7a24496aad9979411523441c53a6cf',1,'formatron::schemas::schema::TypeWithMetadata']]], + ['typewithmetadata_2',['TypeWithMetadata',['../classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata.html',1,'formatron::schemas::schema']]] +]; diff --git a/v0.4.9/search/all_12.js b/v0.4.9/search/all_12.js new file mode 100644 index 0000000..6b612d7 --- /dev/null +++ b/v0.4.9/search/all_12.js @@ -0,0 +1,8 @@ +var searchData= +[ + ['update_5fvocab_5f0xhh_0',['update_vocab_0xHH',['../namespaceformatron_1_1integrations_1_1utils.html#a27f1dbe46fdc2c2cf911fdb026972045',1,'formatron::integrations::utils']]], + ['update_5fvocab_5fdot_5fg_1',['update_vocab_dot_G',['../namespaceformatron_1_1integrations_1_1utils.html#a5f8874cc6515daae855acc1dbc2b94aa',1,'formatron::integrations::utils']]], + ['update_5fvocab_5fsentencepiece_2',['update_vocab_sentencepiece',['../namespaceformatron_1_1integrations_1_1utils.html#ac064c70217efb9b48e440985aee10918',1,'formatron::integrations::utils']]], + ['use_5fbackground_5fworker_3',['use_background_worker',['../classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#a9aa83a5922cefce88197d2cc3822a0c6',1,'formatron::integrations::exllamav2::FormatterFilter']]], + ['utils_2epy_4',['utils.py',['../utils_8py.html',1,'']]] +]; diff --git a/v0.4.9/search/all_13.js b/v0.4.9/search/all_13.js new file mode 100644 index 0000000..e856257 --- /dev/null +++ b/v0.4.9/search/all_13.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['vllm_2epy_0',['vllm.py',['../vllm_8py.html',1,'']]] +]; diff --git a/v0.4.9/search/all_2.js b/v0.4.9/search/all_2.js new file mode 100644 index 0000000..5172e30 --- /dev/null +++ b/v0.4.9/search/all_2.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['begin_0',['begin',['../classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#a31967e1c243ae325d5bf288c73e6635e',1,'formatron::integrations::exllamav2::FormatterFilter']]], + ['build_1',['build',['../classformatron_1_1formatter_1_1FormatterBuilder.html#aae2d235fef43c64305c076edbed41da5',1,'formatron::formatter::FormatterBuilder']]] +]; diff --git a/v0.4.9/search/all_3.js b/v0.4.9/search/all_3.js new file mode 100644 index 0000000..f404081 --- /dev/null +++ b/v0.4.9/search/all_3.js @@ -0,0 +1,21 @@ +var searchData= +[ + ['callable_5fschema_0',['callable_schema',['../namespaceformatron_1_1schemas_1_1pydantic.html#a0b1aeb9a63626b0e782bc4b9e1ce18cf',1,'formatron::schemas::pydantic']]], + ['callablet_1',['CallableT',['../namespaceformatron_1_1schemas_1_1pydantic.html#acf48165db355935623fdcd27fafe2b27',1,'formatron::schemas::pydantic']]], + ['can_5fmask_5flogits_2',['can_mask_logits',['../classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#ad1269fb97cabd3381473bbd15ee59324',1,'formatron::integrations::exllamav2::FormatterFilter']]], + ['capture_5fname_3',['capture_name',['../classformatron_1_1extractor_1_1Extractor.html#abb72e0428a8b5835d075ebd889703e13',1,'formatron::extractor::Extractor']]], + ['captures_4',['captures',['../classformatron_1_1formatter_1_1FormatterBase.html#ab6682619840e83727264a945953fe964',1,'formatron.formatter.FormatterBase.captures()'],['../classformatron_1_1formatter_1_1Formatter.html#af69cc99bea2c85c4ca5af0ecc01c5db1',1,'formatron.formatter.Formatter.captures()']]], + ['choiceextractor_5',['ChoiceExtractor',['../classformatron_1_1extractor_1_1ChoiceExtractor.html',1,'formatron::extractor']]], + ['choose_6',['choose',['../classformatron_1_1formatter_1_1FormatterBuilder.html#a5594cefa0b28af7f159f374486e51618',1,'formatron::formatter::FormatterBuilder']]], + ['classschema_7',['ClassSchema',['../classformatron_1_1schemas_1_1pydantic_1_1ClassSchema.html',1,'formatron::schemas::pydantic']]], + ['clone_8',['clone',['../classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#a6ea0f3a9197afc9dd2b5b808fac2f157',1,'formatron::integrations::exllamav2::FormatterFilter']]], + ['compute_5fallowed_5ftokens_9',['compute_allowed_tokens',['../classformatron_1_1formatter_1_1FormatterBase.html#a927b160d994d43c4e38807f94ea69069',1,'formatron.formatter.FormatterBase.compute_allowed_tokens()'],['../classformatron_1_1formatter_1_1Formatter.html#a538f36e08b749716e6dd4c50679e2ee1',1,'formatron.formatter.Formatter.compute_allowed_tokens()']]], + ['config_2epy_10',['config.py',['../config_8py.html',1,'']]], + ['configs_11',['configs',['../classformatron_1_1integrations_1_1transformers_1_1FormattersLogitsProcessor.html#a598fc8c32fb2670796d4ae2186f8a134',1,'formatron::integrations::transformers::FormattersLogitsProcessor']]], + ['create_5fengine_5fvocabulary_12',['create_engine_vocabulary',['../namespaceformatron_1_1integrations_1_1exllamav2.html#a80db020f2fd854399834ca7581281a34',1,'formatron.integrations.exllamav2.create_engine_vocabulary()'],['../namespaceformatron_1_1integrations_1_1RWKV.html#a2fc99d20bbcc438cc823a728cbc999ea',1,'formatron.integrations.RWKV.create_engine_vocabulary()'],['../namespaceformatron_1_1integrations_1_1transformers.html#af7d64821b9ef2da7cca0d710cb4e68a7',1,'formatron.integrations.transformers.create_engine_vocabulary()'],['../namespaceformatron_1_1integrations_1_1vllm.html#a16d6196bbdb008cc80ca59b860ccfc80',1,'formatron.integrations.vllm.create_engine_vocabulary()']]], + ['create_5fformatter_5ffilter_13',['create_formatter_filter',['../namespaceformatron_1_1integrations_1_1exllamav2.html#a51e71b1e5ca66beba85e26e8cc322206',1,'formatron::integrations::exllamav2']]], + ['create_5fformatter_5flogits_5fprocessor_14',['create_formatter_logits_processor',['../namespaceformatron_1_1integrations_1_1transformers.html#a8a01b497582979cece92538df6463939',1,'formatron::integrations::transformers']]], + ['create_5fformatter_5flogits_5fprocessor_5flist_15',['create_formatter_logits_processor_list',['../namespaceformatron_1_1integrations_1_1transformers.html#aa521d14eb09f692c5930b52373f00203',1,'formatron::integrations::transformers']]], + ['create_5fformatters_5flogits_5fprocessor_16',['create_formatters_logits_processor',['../namespaceformatron_1_1integrations_1_1vllm.html#ae67ec5e8c8a65188f4720a0c921723b6',1,'formatron::integrations::vllm']]], + ['create_5fschema_17',['create_schema',['../namespaceformatron_1_1schemas_1_1json__schema.html#ab2aeae10eb93ef3a3ca1c50013c6b380',1,'formatron::schemas::json_schema']]] +]; diff --git a/v0.4.9/search/all_4.js b/v0.4.9/search/all_4.js new file mode 100644 index 0000000..f11245c --- /dev/null +++ b/v0.4.9/search/all_4.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['dict_5finference_2epy_0',['dict_inference.py',['../dict__inference_8py.html',1,'']]] +]; diff --git a/v0.4.9/search/all_5.js b/v0.4.9/search/all_5.js new file mode 100644 index 0000000..64ee35f --- /dev/null +++ b/v0.4.9/search/all_5.js @@ -0,0 +1,12 @@ +var searchData= +[ + ['engine_5fgen_5fconfig_0',['engine_gen_config',['../classformatron_1_1integrations_1_1RWKV_1_1PIPELINE__ARGS.html#a8f7501ec93400a3fbeadfd87a8886860',1,'formatron::integrations::RWKV::PIPELINE_ARGS']]], + ['enginegenerationconfig_1',['EngineGenerationConfig',['../classformatron_1_1config_1_1EngineGenerationConfig.html',1,'formatron::config']]], + ['eos_5flogits_2',['eos_logits',['../classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#a16819bffd3e4b1bb48e05ac7f696592a',1,'formatron::integrations::exllamav2::FormatterFilter']]], + ['exllamav2_2epy_3',['exllamav2.py',['../exllamav2_8py.html',1,'']]], + ['extract_4',['extract',['../classformatron_1_1extractor_1_1Extractor.html#a9efb2a75cf5fc5e0919c235aa1435469',1,'formatron.extractor.Extractor.extract()'],['../classformatron_1_1extractor_1_1LiteralExtractor.html#af80f5dc8710b59ced091d9b12afd828c',1,'formatron.extractor.LiteralExtractor.extract()'],['../classformatron_1_1extractor_1_1ChoiceExtractor.html#acfd6ee4d6b1ea910dd6f89a4c0fca41f',1,'formatron.extractor.ChoiceExtractor.extract()'],['../classformatron_1_1extractor_1_1SubstringExtractor.html#a1263c299229be0cd9d310e8d97401cd9',1,'formatron.extractor.SubstringExtractor.extract()'],['../classformatron_1_1formats_1_1json_1_1JsonExtractor.html#a6ad701c17988fe32b164135ebd39c783',1,'formatron.formats.json.JsonExtractor.extract()'],['../classformatron_1_1formats_1_1regex_1_1RegexExtractor.html#a73a98b3762aa24d4319e84c1123493c7',1,'formatron.formats.regex.RegexExtractor.extract()'],['../classformatron_1_1formats_1_1regex_1_1RegexComplementExtractor.html#ac5574731870b0ceb01a19ca773c6417d',1,'formatron.formats.regex.RegexComplementExtractor.extract()']]], + ['extract_5fempty_5fsubstring_5',['extract_empty_substring',['../classformatron_1_1extractor_1_1SubstringExtractor.html#a46d19c58ebefdba4c325f86c1ff17284',1,'formatron::extractor::SubstringExtractor']]], + ['extractor_6',['Extractor',['../classformatron_1_1extractor_1_1Extractor.html',1,'formatron::extractor']]], + ['extractor_7',['extractor',['../classformatron_1_1formatter_1_1FormatterBuilder.html#a8b6c87737912e390a1411d0b85080947',1,'formatron::formatter::FormatterBuilder']]], + ['extractor_2epy_8',['extractor.py',['../extractor_8py.html',1,'']]] +]; diff --git a/v0.4.9/search/all_6.js b/v0.4.9/search/all_6.js new file mode 100644 index 0000000..c0f7d90 --- /dev/null +++ b/v0.4.9/search/all_6.js @@ -0,0 +1,34 @@ +var searchData= +[ + ['feed_0',['feed',['../classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#a6896753ca9ce0cdb5cf998edd379123e',1,'formatron::integrations::exllamav2::FormatterFilter']]], + ['fieldinfo_1',['FieldInfo',['../classformatron_1_1schemas_1_1dict__inference_1_1FieldInfo.html',1,'formatron.schemas.dict_inference.FieldInfo'],['../classformatron_1_1schemas_1_1json__schema_1_1FieldInfo.html',1,'formatron.schemas.json_schema.FieldInfo'],['../classformatron_1_1schemas_1_1pydantic_1_1FieldInfo.html',1,'formatron.schemas.pydantic.FieldInfo'],['../classformatron_1_1schemas_1_1schema_1_1FieldInfo.html',1,'formatron.schemas.schema.FieldInfo']]], + ['fields_2',['fields',['../classformatron_1_1schemas_1_1pydantic_1_1ClassSchema.html#add30bb5902bbfd8ff4fa17f197994442',1,'formatron.schemas.pydantic.ClassSchema.fields()'],['../classformatron_1_1schemas_1_1schema_1_1Schema.html#a98d77a5645545d440b91126926d1aeb8',1,'formatron.schemas.schema.Schema.fields()']]], + ['formatron_3',['formatron',['../namespaceformatron.html',1,'']]], + ['formatron_3a_3aconfig_4',['config',['../namespaceformatron_1_1config.html',1,'formatron']]], + ['formatron_3a_3aextractor_5',['extractor',['../namespaceformatron_1_1extractor.html',1,'formatron']]], + ['formatron_3a_3aformats_6',['formats',['../namespaceformatron_1_1formats.html',1,'formatron']]], + ['formatron_3a_3aformats_3a_3ajson_7',['json',['../namespaceformatron_1_1formats_1_1json.html',1,'formatron::formats']]], + ['formatron_3a_3aformats_3a_3aregex_8',['regex',['../namespaceformatron_1_1formats_1_1regex.html',1,'formatron::formats']]], + ['formatron_3a_3aformatter_9',['formatter',['../namespaceformatron_1_1formatter.html',1,'formatron']]], + ['formatron_3a_3aintegrations_10',['integrations',['../namespaceformatron_1_1integrations.html',1,'formatron']]], + ['formatron_3a_3aintegrations_3a_3aexllamav2_11',['exllamav2',['../namespaceformatron_1_1integrations_1_1exllamav2.html',1,'formatron::integrations']]], + ['formatron_3a_3aintegrations_3a_3arwkv_12',['RWKV',['../namespaceformatron_1_1integrations_1_1RWKV.html',1,'formatron::integrations']]], + ['formatron_3a_3aintegrations_3a_3atransformers_13',['transformers',['../namespaceformatron_1_1integrations_1_1transformers.html',1,'formatron::integrations']]], + ['formatron_3a_3aintegrations_3a_3autils_14',['utils',['../namespaceformatron_1_1integrations_1_1utils.html',1,'formatron::integrations']]], + ['formatron_3a_3aintegrations_3a_3avllm_15',['vllm',['../namespaceformatron_1_1integrations_1_1vllm.html',1,'formatron::integrations']]], + ['formatron_3a_3aschemas_16',['schemas',['../namespaceformatron_1_1schemas.html',1,'formatron']]], + ['formatron_3a_3aschemas_3a_3adict_5finference_17',['dict_inference',['../namespaceformatron_1_1schemas_1_1dict__inference.html',1,'formatron::schemas']]], + ['formatron_3a_3aschemas_3a_3ajson_5fschema_18',['json_schema',['../namespaceformatron_1_1schemas_1_1json__schema.html',1,'formatron::schemas']]], + ['formatron_3a_3aschemas_3a_3apydantic_19',['pydantic',['../namespaceformatron_1_1schemas_1_1pydantic.html',1,'formatron::schemas']]], + ['formatron_3a_3aschemas_3a_3aschema_20',['schema',['../namespaceformatron_1_1schemas_1_1schema.html',1,'formatron::schemas']]], + ['formatter_21',['Formatter',['../classformatron_1_1formatter_1_1Formatter.html',1,'formatron::formatter']]], + ['formatter_22',['formatter',['../classformatron_1_1integrations_1_1RWKV_1_1PIPELINE.html#a363de79042e852aa9e8388507d29265a',1,'formatron::integrations::RWKV::PIPELINE']]], + ['formatter_2epy_23',['formatter.py',['../formatter_8py.html',1,'']]], + ['formatter_5fcaptures_24',['formatter_captures',['../classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#ac1b4fa75c9e9009bd9990686efe1c2f5',1,'formatron::integrations::exllamav2::FormatterFilter']]], + ['formatterbase_25',['FormatterBase',['../classformatron_1_1formatter_1_1FormatterBase.html',1,'formatron::formatter']]], + ['formatterbuilder_26',['FormatterBuilder',['../classformatron_1_1formatter_1_1FormatterBuilder.html',1,'formatron::formatter']]], + ['formatterfilter_27',['FormatterFilter',['../classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html',1,'formatron::integrations::exllamav2']]], + ['formatters_5fcaptures_28',['formatters_captures',['../classformatron_1_1integrations_1_1transformers_1_1FormattersLogitsProcessor.html#a148e8818c8d198d37e167d7030fa5746',1,'formatron.integrations.transformers.FormattersLogitsProcessor.formatters_captures()'],['../classformatron_1_1integrations_1_1vllm_1_1FormattersLogitsProcessor.html#ae1387d693b21b6c34f7912a3bf7d182d',1,'formatron.integrations.vllm.FormattersLogitsProcessor.formatters_captures()']]], + ['formatterslogitsprocessor_29',['FormattersLogitsProcessor',['../classformatron_1_1integrations_1_1transformers_1_1FormattersLogitsProcessor.html',1,'formatron.integrations.transformers.FormattersLogitsProcessor'],['../classformatron_1_1integrations_1_1vllm_1_1FormattersLogitsProcessor.html',1,'formatron.integrations.vllm.FormattersLogitsProcessor']]], + ['from_5fjson_30',['from_json',['../classformatron_1_1schemas_1_1pydantic_1_1ClassSchema.html#aec269b72011e216e8f5fefdfa338253a',1,'formatron.schemas.pydantic.ClassSchema.from_json()'],['../classformatron_1_1schemas_1_1schema_1_1Schema.html#a8c45239aaa45574add14fa72fbdf16dc',1,'formatron.schemas.schema.Schema.from_json()']]] +]; diff --git a/v0.4.9/search/all_7.js b/v0.4.9/search/all_7.js new file mode 100644 index 0000000..50330c3 --- /dev/null +++ b/v0.4.9/search/all_7.js @@ -0,0 +1,8 @@ +var searchData= +[ + ['generate_0',['generate',['../classformatron_1_1integrations_1_1RWKV_1_1PIPELINE.html#a96f5091b6a8cc681e698a1a4cecdbd1f',1,'formatron::integrations::RWKV::PIPELINE']]], + ['get_5fallowed_5ftokens_5fsince_5flast_5fcomputation_1',['get_allowed_tokens_since_last_computation',['../classformatron_1_1formatter_1_1FormatterBase.html#ab77855193118e33bf8247c5709a0f485',1,'formatron.formatter.FormatterBase.get_allowed_tokens_since_last_computation()'],['../classformatron_1_1formatter_1_1Formatter.html#a5d565301d527fd3a56ca86a98df9afaf',1,'formatron.formatter.Formatter.get_allowed_tokens_since_last_computation()']]], + ['get_5foriginal_5fcharacters_2',['get_original_characters',['../namespaceformatron_1_1integrations_1_1utils.html#a744e97099675a1aac1c24fd6a1398efd',1,'formatron::integrations::utils']]], + ['grammar_5fheader_3',['GRAMMAR_HEADER',['../namespaceformatron_1_1formats_1_1json.html#ac81c86f8a6384cf3b11c47ddf2049ca7',1,'formatron::formats::json']]], + ['grammar_5fstr_4',['grammar_str',['../classformatron_1_1formatter_1_1Formatter.html#a2519969e1338beb864169289a6f36bb9',1,'formatron::formatter::Formatter']]] +]; diff --git a/v0.4.9/search/all_8.js b/v0.4.9/search/all_8.js new file mode 100644 index 0000000..b5de68c --- /dev/null +++ b/v0.4.9/search/all_8.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['infer_5fmapping_0',['infer_mapping',['../namespaceformatron_1_1schemas_1_1dict__inference.html#a850490b4a317260a236333130d36a5d8',1,'formatron::schemas::dict_inference']]], + ['is_5fcompleted_1',['is_completed',['../classformatron_1_1formatter_1_1FormatterBase.html#ac9af60077533ed0f3c9f42ee3a132899',1,'formatron.formatter.FormatterBase.is_completed()'],['../classformatron_1_1formatter_1_1Formatter.html#ac15aeec180daa5c78ad3c9bd93bd2b5b',1,'formatron.formatter.Formatter.is_completed()'],['../classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#adadb3652b5250cf08dfe7cc8824e2ec0',1,'formatron.integrations.exllamav2.FormatterFilter.is_completed()'],['../classformatron_1_1integrations_1_1transformers_1_1FormattersLogitsProcessor.html#a0bf8e8613df954fcad9fb5368d0f7025',1,'formatron.integrations.transformers.FormattersLogitsProcessor.is_completed()'],['../classformatron_1_1integrations_1_1vllm_1_1FormattersLogitsProcessor.html#ad6930fba60b378039db9698d811cb82a',1,'formatron.integrations.vllm.FormattersLogitsProcessor.is_completed()']]] +]; diff --git a/v0.4.9/search/all_9.js b/v0.4.9/search/all_9.js new file mode 100644 index 0000000..4dc6489 --- /dev/null +++ b/v0.4.9/search/all_9.js @@ -0,0 +1,7 @@ +var searchData= +[ + ['json_0',['json',['../classformatron_1_1formatter_1_1FormatterBuilder.html#ad2a182c94ddec53d22aefe64f57d6514',1,'formatron::formatter::FormatterBuilder']]], + ['json_2epy_1',['json.py',['../json_8py.html',1,'']]], + ['json_5fschema_2epy_2',['json_schema.py',['../json__schema_8py.html',1,'']]], + ['jsonextractor_3',['JsonExtractor',['../classformatron_1_1formats_1_1json_1_1JsonExtractor.html',1,'formatron::formats::json']]] +]; diff --git a/v0.4.9/search/all_a.js b/v0.4.9/search/all_a.js new file mode 100644 index 0000000..1ec9b7a --- /dev/null +++ b/v0.4.9/search/all_a.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['kbnf_5fdefinition_0',['kbnf_definition',['../classformatron_1_1extractor_1_1Extractor.html#ae9abcfb6c5bae5b352de8a97f94be049',1,'formatron.extractor.Extractor.kbnf_definition()'],['../classformatron_1_1extractor_1_1LiteralExtractor.html#ada2b4df1008ae73880c5e1d35fca5939',1,'formatron.extractor.LiteralExtractor.kbnf_definition()'],['../classformatron_1_1extractor_1_1ChoiceExtractor.html#a5fe06cd727f3313d5e52a7ea6b81d5c4',1,'formatron.extractor.ChoiceExtractor.kbnf_definition()'],['../classformatron_1_1extractor_1_1SubstringExtractor.html#a13801ce1a7da7bf804317ea15f6e172e',1,'formatron.extractor.SubstringExtractor.kbnf_definition()'],['../classformatron_1_1formats_1_1json_1_1JsonExtractor.html#ace660f78408893ab8fb7facd410a9d60',1,'formatron.formats.json.JsonExtractor.kbnf_definition()'],['../classformatron_1_1formats_1_1regex_1_1RegexExtractor.html#a7b5fa1eb57e55ccf46d7762e1a6d0b9a',1,'formatron.formats.regex.RegexExtractor.kbnf_definition()'],['../classformatron_1_1formats_1_1regex_1_1RegexComplementExtractor.html#a57759938dc0088caf94ec2d2dcf19495',1,'formatron.formats.regex.RegexComplementExtractor.kbnf_definition()']]], + ['kbnf_5freference_1',['kbnf_reference',['../classformatron_1_1extractor_1_1Extractor.html#abf347fc566ceca08b0845a5146347a5e',1,'formatron.extractor.Extractor.kbnf_reference()'],['../classformatron_1_1extractor_1_1NonterminalExtractor.html#a8c8a8f47ad90f6b9e4206ab6a56f302e',1,'formatron.extractor.NonterminalExtractor.kbnf_reference()'],['../classformatron_1_1extractor_1_1LiteralExtractor.html#acfc1bf5ad7fc06acef35ad8897ddf273',1,'formatron.extractor.LiteralExtractor.kbnf_reference()']]] +]; diff --git a/v0.4.9/search/all_b.js b/v0.4.9/search/all_b.js new file mode 100644 index 0000000..bca9021 --- /dev/null +++ b/v0.4.9/search/all_b.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['literalextractor_0',['LiteralExtractor',['../classformatron_1_1extractor_1_1LiteralExtractor.html',1,'formatron::extractor']]] +]; diff --git a/v0.4.9/search/all_c.js b/v0.4.9/search/all_c.js new file mode 100644 index 0000000..374eaab --- /dev/null +++ b/v0.4.9/search/all_c.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['mask_5flogits_0',['mask_logits',['../classformatron_1_1formatter_1_1FormatterBase.html#ae8db7e92a900322ae5aa603b5c8f386f',1,'formatron.formatter.FormatterBase.mask_logits()'],['../classformatron_1_1formatter_1_1Formatter.html#a1068b4fa2167039fe04519ec4db65278',1,'formatron.formatter.Formatter.mask_logits()'],['../classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#a7a0e2e459eccf822cf79457a121a3a74',1,'formatron.integrations.exllamav2.FormatterFilter.mask_logits()']]], + ['metadata_1',['metadata',['../classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata.html#af8604b758b8af6878a130a4f0f28389b',1,'formatron::schemas::schema::TypeWithMetadata']]] +]; diff --git a/v0.4.9/search/all_d.js b/v0.4.9/search/all_d.js new file mode 100644 index 0000000..eb8ae0e --- /dev/null +++ b/v0.4.9/search/all_d.js @@ -0,0 +1,7 @@ +var searchData= +[ + ['next_0',['next',['../classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#aaf7f64e93e611f4fc0ca9b7c2196c2f2',1,'formatron::integrations::exllamav2::FormatterFilter']]], + ['next_5fset_1',['next_set',['../classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#ac6f22aff80d80035bdd2118feff9f965',1,'formatron::integrations::exllamav2::FormatterFilter']]], + ['nonterminal_2',['nonterminal',['../classformatron_1_1extractor_1_1NonterminalExtractor.html#a1dd1fabcef2e668d00bf6ebb38dd017f',1,'formatron::extractor::NonterminalExtractor']]], + ['nonterminalextractor_3',['NonterminalExtractor',['../classformatron_1_1extractor_1_1NonterminalExtractor.html',1,'formatron::extractor']]] +]; diff --git a/v0.4.9/search/all_e.js b/v0.4.9/search/all_e.js new file mode 100644 index 0000000..bd1f155 --- /dev/null +++ b/v0.4.9/search/all_e.js @@ -0,0 +1,7 @@ +var searchData= +[ + ['pipeline_0',['PIPELINE',['../classformatron_1_1integrations_1_1RWKV_1_1PIPELINE.html',1,'formatron::integrations::RWKV']]], + ['pipeline_5fargs_1',['PIPELINE_ARGS',['../classformatron_1_1integrations_1_1RWKV_1_1PIPELINE__ARGS.html',1,'formatron::integrations::RWKV']]], + ['prepare_5flogit_5fmask_2',['prepare_logit_mask',['../classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#aeb7f169a9c36b793867682069f00e928',1,'formatron::integrations::exllamav2::FormatterFilter']]], + ['pydantic_2epy_3',['pydantic.py',['../pydantic_8py.html',1,'']]] +]; diff --git a/v0.4.9/search/all_f.js b/v0.4.9/search/all_f.js new file mode 100644 index 0000000..245a555 --- /dev/null +++ b/v0.4.9/search/all_f.js @@ -0,0 +1,14 @@ +var searchData= +[ + ['read_5fprompt_0',['read_prompt',['../classformatron_1_1config_1_1EngineGenerationConfig.html#af0b93e2a9f55937e342c649c1f177695',1,'formatron::config::EngineGenerationConfig']]], + ['regex_1',['regex',['../classformatron_1_1formatter_1_1FormatterBuilder.html#af34f97f7f62d2a1de4f9e863b1834619',1,'formatron::formatter::FormatterBuilder']]], + ['regex_2epy_2',['regex.py',['../regex_8py.html',1,'']]], + ['regex_5fcomplement_3',['regex_complement',['../classformatron_1_1formatter_1_1FormatterBuilder.html#a60dedc5c21ecd24f6b0435bc0d936838',1,'formatron::formatter::FormatterBuilder']]], + ['regexcomplementextractor_4',['RegexComplementExtractor',['../classformatron_1_1formats_1_1regex_1_1RegexComplementExtractor.html',1,'formatron::formats::regex']]], + ['regexextractor_5',['RegexExtractor',['../classformatron_1_1formats_1_1regex_1_1RegexExtractor.html',1,'formatron::formats::regex']]], + ['register_5fgenerate_5fnonterminal_5fdef_6',['register_generate_nonterminal_def',['../namespaceformatron_1_1formats_1_1json.html#a55ae1cd2ef251d160e872a0c49e7ba7a',1,'formatron::formats::json']]], + ['required_7',['required',['../classformatron_1_1schemas_1_1dict__inference_1_1FieldInfo.html#acd5625095baa17d3cf8f2b9562be0e06',1,'formatron.schemas.dict_inference.FieldInfo.required()'],['../classformatron_1_1schemas_1_1json__schema_1_1FieldInfo.html#af25ae318725070cd198febebe07e5efa',1,'formatron.schemas.json_schema.FieldInfo.required()'],['../classformatron_1_1schemas_1_1pydantic_1_1FieldInfo.html#aeae1e2e12ad15628c69d896fae9aa477',1,'formatron.schemas.pydantic.FieldInfo.required()'],['../classformatron_1_1schemas_1_1schema_1_1FieldInfo.html#ac0d64035ccdc78e44a4cf6165d56081b',1,'formatron.schemas.schema.FieldInfo.required()']]], + ['reset_8',['reset',['../classformatron_1_1formatter_1_1FormatterBase.html#a522c78b1404697a99313f9edffa7a2a4',1,'formatron.formatter.FormatterBase.reset()'],['../classformatron_1_1formatter_1_1Formatter.html#a10ff1aac8dcd90e1bd983d2f6580a964',1,'formatron.formatter.Formatter.reset()'],['../classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#a984bc61ef20d16e88ffb40aa2f5afcc3',1,'formatron.integrations.exllamav2.FormatterFilter.reset()'],['../classformatron_1_1integrations_1_1transformers_1_1FormattersLogitsProcessor.html#a966da36a950eaef6898bcd5ec5841df4',1,'formatron.integrations.transformers.FormattersLogitsProcessor.reset()'],['../classformatron_1_1integrations_1_1vllm_1_1FormattersLogitsProcessor.html#a697bbd642308e22804f46729935e101b',1,'formatron.integrations.vllm.FormattersLogitsProcessor.reset()']]], + ['reset_5fat_5fbeginning_9',['reset_at_beginning',['../classformatron_1_1config_1_1EngineGenerationConfig.html#a95ef45b001b9c45f86bd3699a5675ad4',1,'formatron::config::EngineGenerationConfig']]], + ['rwkv_2epy_10',['RWKV.py',['../RWKV_8py.html',1,'']]] +]; diff --git a/v0.4.9/search/classes_0.js b/v0.4.9/search/classes_0.js new file mode 100644 index 0000000..2ffa86e --- /dev/null +++ b/v0.4.9/search/classes_0.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['choiceextractor_0',['ChoiceExtractor',['../classformatron_1_1extractor_1_1ChoiceExtractor.html',1,'formatron::extractor']]], + ['classschema_1',['ClassSchema',['../classformatron_1_1schemas_1_1pydantic_1_1ClassSchema.html',1,'formatron::schemas::pydantic']]] +]; diff --git a/v0.4.9/search/classes_1.js b/v0.4.9/search/classes_1.js new file mode 100644 index 0000000..4a62e99 --- /dev/null +++ b/v0.4.9/search/classes_1.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['enginegenerationconfig_0',['EngineGenerationConfig',['../classformatron_1_1config_1_1EngineGenerationConfig.html',1,'formatron::config']]], + ['extractor_1',['Extractor',['../classformatron_1_1extractor_1_1Extractor.html',1,'formatron::extractor']]] +]; diff --git a/v0.4.9/search/classes_2.js b/v0.4.9/search/classes_2.js new file mode 100644 index 0000000..c57f639 --- /dev/null +++ b/v0.4.9/search/classes_2.js @@ -0,0 +1,9 @@ +var searchData= +[ + ['fieldinfo_0',['FieldInfo',['../classformatron_1_1schemas_1_1dict__inference_1_1FieldInfo.html',1,'formatron.schemas.dict_inference.FieldInfo'],['../classformatron_1_1schemas_1_1json__schema_1_1FieldInfo.html',1,'formatron.schemas.json_schema.FieldInfo'],['../classformatron_1_1schemas_1_1pydantic_1_1FieldInfo.html',1,'formatron.schemas.pydantic.FieldInfo'],['../classformatron_1_1schemas_1_1schema_1_1FieldInfo.html',1,'formatron.schemas.schema.FieldInfo']]], + ['formatter_1',['Formatter',['../classformatron_1_1formatter_1_1Formatter.html',1,'formatron::formatter']]], + ['formatterbase_2',['FormatterBase',['../classformatron_1_1formatter_1_1FormatterBase.html',1,'formatron::formatter']]], + ['formatterbuilder_3',['FormatterBuilder',['../classformatron_1_1formatter_1_1FormatterBuilder.html',1,'formatron::formatter']]], + ['formatterfilter_4',['FormatterFilter',['../classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html',1,'formatron::integrations::exllamav2']]], + ['formatterslogitsprocessor_5',['FormattersLogitsProcessor',['../classformatron_1_1integrations_1_1transformers_1_1FormattersLogitsProcessor.html',1,'formatron.integrations.transformers.FormattersLogitsProcessor'],['../classformatron_1_1integrations_1_1vllm_1_1FormattersLogitsProcessor.html',1,'formatron.integrations.vllm.FormattersLogitsProcessor']]] +]; diff --git a/v0.4.9/search/classes_3.js b/v0.4.9/search/classes_3.js new file mode 100644 index 0000000..4bb886c --- /dev/null +++ b/v0.4.9/search/classes_3.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['jsonextractor_0',['JsonExtractor',['../classformatron_1_1formats_1_1json_1_1JsonExtractor.html',1,'formatron::formats::json']]] +]; diff --git a/v0.4.9/search/classes_4.js b/v0.4.9/search/classes_4.js new file mode 100644 index 0000000..bca9021 --- /dev/null +++ b/v0.4.9/search/classes_4.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['literalextractor_0',['LiteralExtractor',['../classformatron_1_1extractor_1_1LiteralExtractor.html',1,'formatron::extractor']]] +]; diff --git a/v0.4.9/search/classes_5.js b/v0.4.9/search/classes_5.js new file mode 100644 index 0000000..a73f06d --- /dev/null +++ b/v0.4.9/search/classes_5.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['nonterminalextractor_0',['NonterminalExtractor',['../classformatron_1_1extractor_1_1NonterminalExtractor.html',1,'formatron::extractor']]] +]; diff --git a/v0.4.9/search/classes_6.js b/v0.4.9/search/classes_6.js new file mode 100644 index 0000000..d591778 --- /dev/null +++ b/v0.4.9/search/classes_6.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['pipeline_0',['PIPELINE',['../classformatron_1_1integrations_1_1RWKV_1_1PIPELINE.html',1,'formatron::integrations::RWKV']]], + ['pipeline_5fargs_1',['PIPELINE_ARGS',['../classformatron_1_1integrations_1_1RWKV_1_1PIPELINE__ARGS.html',1,'formatron::integrations::RWKV']]] +]; diff --git a/v0.4.9/search/classes_7.js b/v0.4.9/search/classes_7.js new file mode 100644 index 0000000..29a42b8 --- /dev/null +++ b/v0.4.9/search/classes_7.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['regexcomplementextractor_0',['RegexComplementExtractor',['../classformatron_1_1formats_1_1regex_1_1RegexComplementExtractor.html',1,'formatron::formats::regex']]], + ['regexextractor_1',['RegexExtractor',['../classformatron_1_1formats_1_1regex_1_1RegexExtractor.html',1,'formatron::formats::regex']]] +]; diff --git a/v0.4.9/search/classes_8.js b/v0.4.9/search/classes_8.js new file mode 100644 index 0000000..1a93957 --- /dev/null +++ b/v0.4.9/search/classes_8.js @@ -0,0 +1,6 @@ +var searchData= +[ + ['schema_0',['Schema',['../classformatron_1_1schemas_1_1schema_1_1Schema.html',1,'formatron::schemas::schema']]], + ['substringextractor_1',['SubstringExtractor',['../classformatron_1_1extractor_1_1SubstringExtractor.html',1,'formatron::extractor']]], + ['substringof_2',['SubstringOf',['../classformatron_1_1schemas_1_1schema_1_1SubstringOf.html',1,'formatron::schemas::schema']]] +]; diff --git a/v0.4.9/search/classes_9.js b/v0.4.9/search/classes_9.js new file mode 100644 index 0000000..99ffacc --- /dev/null +++ b/v0.4.9/search/classes_9.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['typewithmetadata_0',['TypeWithMetadata',['../classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata.html',1,'formatron::schemas::schema']]] +]; diff --git a/v0.4.9/search/close.svg b/v0.4.9/search/close.svg new file mode 100644 index 0000000..337d6cc --- /dev/null +++ b/v0.4.9/search/close.svg @@ -0,0 +1,18 @@ + + + + + + diff --git a/v0.4.9/search/files_0.js b/v0.4.9/search/files_0.js new file mode 100644 index 0000000..76a0c97 --- /dev/null +++ b/v0.4.9/search/files_0.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['_5f_5finit_5f_5f_2epy_0',['__init__.py',['../____init_____8py.html',1,'(Global Namespace)'],['../formats_2____init_____8py.html',1,'(Global Namespace)'],['../integrations_2____init_____8py.html',1,'(Global Namespace)'],['../schemas_2____init_____8py.html',1,'(Global Namespace)']]] +]; diff --git a/v0.4.9/search/files_1.js b/v0.4.9/search/files_1.js new file mode 100644 index 0000000..539cf2c --- /dev/null +++ b/v0.4.9/search/files_1.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['config_2epy_0',['config.py',['../config_8py.html',1,'']]] +]; diff --git a/v0.4.9/search/files_2.js b/v0.4.9/search/files_2.js new file mode 100644 index 0000000..f11245c --- /dev/null +++ b/v0.4.9/search/files_2.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['dict_5finference_2epy_0',['dict_inference.py',['../dict__inference_8py.html',1,'']]] +]; diff --git a/v0.4.9/search/files_3.js b/v0.4.9/search/files_3.js new file mode 100644 index 0000000..2e6195b --- /dev/null +++ b/v0.4.9/search/files_3.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['exllamav2_2epy_0',['exllamav2.py',['../exllamav2_8py.html',1,'']]], + ['extractor_2epy_1',['extractor.py',['../extractor_8py.html',1,'']]] +]; diff --git a/v0.4.9/search/files_4.js b/v0.4.9/search/files_4.js new file mode 100644 index 0000000..0104fbd --- /dev/null +++ b/v0.4.9/search/files_4.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['formatter_2epy_0',['formatter.py',['../formatter_8py.html',1,'']]] +]; diff --git a/v0.4.9/search/files_5.js b/v0.4.9/search/files_5.js new file mode 100644 index 0000000..f1b091f --- /dev/null +++ b/v0.4.9/search/files_5.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['json_2epy_0',['json.py',['../json_8py.html',1,'']]], + ['json_5fschema_2epy_1',['json_schema.py',['../json__schema_8py.html',1,'']]] +]; diff --git a/v0.4.9/search/files_6.js b/v0.4.9/search/files_6.js new file mode 100644 index 0000000..50eb1a1 --- /dev/null +++ b/v0.4.9/search/files_6.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['pydantic_2epy_0',['pydantic.py',['../pydantic_8py.html',1,'']]] +]; diff --git a/v0.4.9/search/files_7.js b/v0.4.9/search/files_7.js new file mode 100644 index 0000000..14f2508 --- /dev/null +++ b/v0.4.9/search/files_7.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['regex_2epy_0',['regex.py',['../regex_8py.html',1,'']]], + ['rwkv_2epy_1',['RWKV.py',['../RWKV_8py.html',1,'']]] +]; diff --git a/v0.4.9/search/files_8.js b/v0.4.9/search/files_8.js new file mode 100644 index 0000000..330ec96 --- /dev/null +++ b/v0.4.9/search/files_8.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['schema_2epy_0',['schema.py',['../schema_8py.html',1,'']]] +]; diff --git a/v0.4.9/search/files_9.js b/v0.4.9/search/files_9.js new file mode 100644 index 0000000..ce03ed4 --- /dev/null +++ b/v0.4.9/search/files_9.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['transformers_2epy_0',['transformers.py',['../transformers_8py.html',1,'']]] +]; diff --git a/v0.4.9/search/files_a.js b/v0.4.9/search/files_a.js new file mode 100644 index 0000000..5abac92 --- /dev/null +++ b/v0.4.9/search/files_a.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['utils_2epy_0',['utils.py',['../utils_8py.html',1,'']]] +]; diff --git a/v0.4.9/search/files_b.js b/v0.4.9/search/files_b.js new file mode 100644 index 0000000..e856257 --- /dev/null +++ b/v0.4.9/search/files_b.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['vllm_2epy_0',['vllm.py',['../vllm_8py.html',1,'']]] +]; diff --git a/v0.4.9/search/functions_0.js b/v0.4.9/search/functions_0.js new file mode 100644 index 0000000..e429991 --- /dev/null +++ b/v0.4.9/search/functions_0.js @@ -0,0 +1,35 @@ +var searchData= +[ + ['_5f_5fcall_5f_5f_0',['__call__',['../classformatron_1_1integrations_1_1transformers_1_1FormattersLogitsProcessor.html#af5ec5643f3c51046cb3b5e73fbb04f2b',1,'formatron.integrations.transformers.FormattersLogitsProcessor.__call__()'],['../classformatron_1_1integrations_1_1vllm_1_1FormattersLogitsProcessor.html#ad4a81bb45d259bb5408433cdb6cbafdd',1,'formatron.integrations.vllm.FormattersLogitsProcessor.__call__()']]], + ['_5f_5finit_5f_5f_1',['__init__',['../classformatron_1_1extractor_1_1Extractor.html#a569fc7895a82f4d4b59866719219d4e0',1,'formatron.extractor.Extractor.__init__()'],['../classformatron_1_1extractor_1_1NonterminalExtractor.html#a45c14f79c14b539837ebdd26c3b5567b',1,'formatron.extractor.NonterminalExtractor.__init__()'],['../classformatron_1_1extractor_1_1LiteralExtractor.html#ab4da390ad7efaf5a3aab0e0ccb78fab3',1,'formatron.extractor.LiteralExtractor.__init__()'],['../classformatron_1_1extractor_1_1ChoiceExtractor.html#a1a91b31475c7348a3cf9fab97c6d26f0',1,'formatron.extractor.ChoiceExtractor.__init__()'],['../classformatron_1_1extractor_1_1SubstringExtractor.html#a843997315c77b9c7c6eb84ba7e02ff83',1,'formatron.extractor.SubstringExtractor.__init__()'],['../classformatron_1_1formats_1_1json_1_1JsonExtractor.html#a7a51edd3cc7c24370c809d91e07771dc',1,'formatron.formats.json.JsonExtractor.__init__()'],['../classformatron_1_1formats_1_1regex_1_1RegexExtractor.html#a6fc2f05d044cce49935c415248de5e5a',1,'formatron.formats.regex.RegexExtractor.__init__()'],['../classformatron_1_1formats_1_1regex_1_1RegexComplementExtractor.html#a77937657607e5679dbc52d87ad10bb55',1,'formatron.formats.regex.RegexComplementExtractor.__init__()'],['../classformatron_1_1formatter_1_1Formatter.html#a369269f53f32be2f1d92663670354515',1,'formatron.formatter.Formatter.__init__()'],['../classformatron_1_1formatter_1_1FormatterBuilder.html#abb13104747355cae16e6ad0c3067fac8',1,'formatron.formatter.FormatterBuilder.__init__()'],['../classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#adc94d2f2ddd06f966dca93079f17df8c',1,'formatron.integrations.exllamav2.FormatterFilter.__init__()'],['../classformatron_1_1integrations_1_1RWKV_1_1PIPELINE__ARGS.html#a53a892118d9b168024aaa6062f92cd7c',1,'formatron.integrations.RWKV.PIPELINE_ARGS.__init__()'],['../classformatron_1_1integrations_1_1RWKV_1_1PIPELINE.html#aa646fb0bf5f3674d1daba91dd0320017',1,'formatron.integrations.RWKV.PIPELINE.__init__()'],['../classformatron_1_1integrations_1_1transformers_1_1FormattersLogitsProcessor.html#aa70d2276eeb09fdf53066e4019df79df',1,'formatron.integrations.transformers.FormattersLogitsProcessor.__init__()'],['../classformatron_1_1integrations_1_1vllm_1_1FormattersLogitsProcessor.html#a0ee5e6edc8fc11dfd7406c140c13b7b9',1,'formatron.integrations.vllm.FormattersLogitsProcessor.__init__()'],['../classformatron_1_1schemas_1_1dict__inference_1_1FieldInfo.html#a0286ba9c9e6509ce23d530409209b5da',1,'formatron.schemas.dict_inference.FieldInfo.__init__()'],['../classformatron_1_1schemas_1_1json__schema_1_1FieldInfo.html#abc61867418b7f30a3545e71c9b28e708',1,'formatron.schemas.json_schema.FieldInfo.__init__()'],['../classformatron_1_1schemas_1_1pydantic_1_1FieldInfo.html#a4a5a010c6acef15f8fe2d4318223696b',1,'formatron.schemas.pydantic.FieldInfo.__init__()'],['../classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata.html#a0c3cf51ceb503d4d195f5623d57e160b',1,'formatron.schemas.schema.TypeWithMetadata.__init__()']]], + ['_5f_5frepr_5f_5f_2',['__repr__',['../classformatron_1_1schemas_1_1pydantic_1_1FieldInfo.html#ad291e8df78d045d3364bc6a17582b416',1,'formatron::schemas::pydantic::FieldInfo']]], + ['_5f_5fstr_5f_5f_3',['__str__',['../classformatron_1_1extractor_1_1Extractor.html#afe6a1f745fd56540ccff5fdc5d00f0a5',1,'formatron.extractor.Extractor.__str__()'],['../classformatron_1_1formatter_1_1Formatter.html#a827c993f0ac74abff6276b3af6058e3f',1,'formatron.formatter.Formatter.__str__()'],['../classformatron_1_1schemas_1_1pydantic_1_1FieldInfo.html#a49ac1734cddfadc1b7721f57775890a6',1,'formatron.schemas.pydantic.FieldInfo.__str__()']]], + ['_5fadd_5fcapture_5fname_4',['_add_capture_name',['../classformatron_1_1formatter_1_1FormatterBuilder.html#a1e97daf55b4149be6aaa5dd747ed6146',1,'formatron::formatter::FormatterBuilder']]], + ['_5fadd_5fextractor_5',['_add_extractor',['../classformatron_1_1formatter_1_1FormatterBuilder.html#a6e495e90b9da81108b6627166872bbbb',1,'formatron::formatter::FormatterBuilder']]], + ['_5fassert_5fcapture_5fname_5fvalid_6',['_assert_capture_name_valid',['../classformatron_1_1formatter_1_1FormatterBuilder.html#ab5ad5186f55d35e3abd2d5c213302a25',1,'formatron::formatter::FormatterBuilder']]], + ['_5fconvert_5fjson_5fschema_5fto_5four_5fschema_7',['_convert_json_schema_to_our_schema',['../namespaceformatron_1_1schemas_1_1json__schema.html#a5f4856cb7c30aa340432d386836f25be',1,'formatron::schemas::json_schema']]], + ['_5fcreate_5fcustom_5ftype_8',['_create_custom_type',['../namespaceformatron_1_1schemas_1_1json__schema.html#a15dc86b65c90ac8423c8989054f8c9e5',1,'formatron::schemas::json_schema']]], + ['_5fcreate_5fnonterminal_9',['_create_nonterminal',['../classformatron_1_1formatter_1_1FormatterBuilder.html#aefe18951a4dc243909a22dd49b62fe21',1,'formatron::formatter::FormatterBuilder']]], + ['_5fextract_5ffields_5ffrom_5fobject_5ftype_10',['_extract_fields_from_object_type',['../namespaceformatron_1_1schemas_1_1json__schema.html#af20251afc012b955e29c92922fcc83ef',1,'formatron::schemas::json_schema']]], + ['_5fgenerate_5fkbnf_5fgrammar_11',['_generate_kbnf_grammar',['../namespaceformatron_1_1formats_1_1json.html#af4331f1a7679439503d898b2356d289e',1,'formatron::formats::json']]], + ['_5fget_5fliteral_12',['_get_literal',['../namespaceformatron_1_1schemas_1_1json__schema.html#a096ea829025ebd26b9ae165c17cf8976',1,'formatron::schemas::json_schema']]], + ['_5fhandle_5fanyof_13',['_handle_anyOf',['../namespaceformatron_1_1schemas_1_1json__schema.html#a6f88bf4e3c48d96b060ccdcbd80b3328',1,'formatron::schemas::json_schema']]], + ['_5fhandle_5flist_5fmetadata_14',['_handle_list_metadata',['../namespaceformatron_1_1schemas_1_1json__schema.html#ac84df1d5caa0ab01d58207e4401be0dc',1,'formatron::schemas::json_schema']]], + ['_5fhandle_5fliteral_15',['_handle_literal',['../namespaceformatron_1_1schemas_1_1json__schema.html#a969bd30894a578428528b94b0f82f1ba',1,'formatron::schemas::json_schema']]], + ['_5fhandle_5fnumeric_5fwith_5fmetadata_16',['_handle_numeric_with_metadata',['../namespaceformatron_1_1schemas_1_1json__schema.html#ad187a02f7616ccbb83c00462996a7fe1',1,'formatron::schemas::json_schema']]], + ['_5fhandle_5fstr_5fwith_5fmetadata_17',['_handle_str_with_metadata',['../namespaceformatron_1_1schemas_1_1json__schema.html#a32e51b70be50d55d3944e6c700bbd1a5',1,'formatron::schemas::json_schema']]], + ['_5fhuggingface_5fbytelevel_5fdecoder_18',['_huggingface_bytelevel_decoder',['../namespaceformatron_1_1integrations_1_1utils.html#a4e53f8f5754530f8fa7d627504c98f6a',1,'formatron::integrations::utils']]], + ['_5finfer_5ftype_19',['_infer_type',['../namespaceformatron_1_1schemas_1_1dict__inference.html#ad5cac24e76dc097a995f31d3d0ff9efc',1,'formatron.schemas.dict_inference._infer_type()'],['../namespaceformatron_1_1schemas_1_1json__schema.html#ac742e1e581efccb6cc9742e7a23c25c2',1,'formatron.schemas.json_schema._infer_type(dict[str, typing.Any] schema, dict[int, typing.Type] json_schema_id_to_schema)']]], + ['_5fmerge_5fkey_20',['_merge_key',['../namespaceformatron_1_1schemas_1_1json__schema.html#a5fcddd43a5f64374b5b75d4aafeb9135',1,'formatron::schemas::json_schema']]], + ['_5fmerge_5freferenced_5fschema_21',['_merge_referenced_schema',['../namespaceformatron_1_1schemas_1_1json__schema.html#a45c9b97319a58c2013b8e3f10ad78c30',1,'formatron::schemas::json_schema']]], + ['_5fmultiple_5freplace_22',['_multiple_replace',['../namespaceformatron_1_1integrations_1_1utils.html#a49fe0eaafb8d1f9909e2d2520c2ea657',1,'formatron::integrations::utils']]], + ['_5fobtain_5faccepted_5foutput_23',['_obtain_accepted_output',['../classformatron_1_1formatter_1_1Formatter.html#ae4be840a942f608c1a0c256dbf68901b',1,'formatron::formatter::Formatter']]], + ['_5fobtain_5ftype_24',['_obtain_type',['../namespaceformatron_1_1schemas_1_1json__schema.html#a544d74edf1fdccbad9e216d9ff028a20',1,'formatron::schemas::json_schema']]], + ['_5fon_5fcompletion_25',['_on_completion',['../classformatron_1_1formatter_1_1FormatterBase.html#a469880a21192928e82823cc340a22ce2',1,'formatron.formatter.FormatterBase._on_completion()'],['../classformatron_1_1formatter_1_1Formatter.html#ac6f7e3f96c6318689c5cd0d44a1cdde7',1,'formatron.formatter.Formatter._on_completion()']]], + ['_5frecursive_5fresolve_5freference_26',['_recursive_resolve_reference',['../namespaceformatron_1_1schemas_1_1json__schema.html#aaba012c79d101be93f4d96588c9f8cc2',1,'formatron::schemas::json_schema']]], + ['_5fregister_5fall_5fpredefined_5ftypes_27',['_register_all_predefined_types',['../namespaceformatron_1_1formats_1_1json.html#a311b750cba3838aee622b9809888f051',1,'formatron::formats::json']]], + ['_5fresolve_5fnew_5furl_28',['_resolve_new_url',['../namespaceformatron_1_1schemas_1_1json__schema.html#a9dc9dc267e5dd7b6581e2367e9238152',1,'formatron::schemas::json_schema']]], + ['_5fresolve_5freference_29',['_resolve_reference',['../namespaceformatron_1_1schemas_1_1json__schema.html#a24b516494672cc5dbbf7300ea65479b1',1,'formatron::schemas::json_schema']]], + ['_5fto_5fnext_5fbatch_5fstep_30',['_to_next_batch_step',['../classformatron_1_1integrations_1_1vllm_1_1FormattersLogitsProcessor.html#ab87fea11f930a33130cecadd8cdf0cc6',1,'formatron::integrations::vllm::FormattersLogitsProcessor']]], + ['_5fvalidate_5fjson_5fschema_31',['_validate_json_schema',['../namespaceformatron_1_1schemas_1_1json__schema.html#a51aa68e29951e6b295844b13177b7d6a',1,'formatron::schemas::json_schema']]] +]; diff --git a/v0.4.9/search/functions_1.js b/v0.4.9/search/functions_1.js new file mode 100644 index 0000000..7344930 --- /dev/null +++ b/v0.4.9/search/functions_1.js @@ -0,0 +1,10 @@ +var searchData= +[ + ['accept_5fbytes_0',['accept_bytes',['../classformatron_1_1formatter_1_1FormatterBase.html#ac0f91549079380a53228322dd4473cf1',1,'formatron.formatter.FormatterBase.accept_bytes()'],['../classformatron_1_1formatter_1_1Formatter.html#a178a37715ce463e6e57c530166c7ec6d',1,'formatron.formatter.Formatter.accept_bytes()']]], + ['accept_5ftoken_1',['accept_token',['../classformatron_1_1formatter_1_1FormatterBase.html#a87d1513c3f70fdee18d65fae4f71101d',1,'formatron.formatter.FormatterBase.accept_token()'],['../classformatron_1_1formatter_1_1Formatter.html#a839eb7550ee4afbd305b25ddcca5c4dc',1,'formatron.formatter.Formatter.accept_token()']]], + ['annotation_2',['annotation',['../classformatron_1_1schemas_1_1dict__inference_1_1FieldInfo.html#a163fde7bbaa2e613b5af3a4a12b9152d',1,'formatron.schemas.dict_inference.FieldInfo.annotation()'],['../classformatron_1_1schemas_1_1json__schema_1_1FieldInfo.html#a28f43dedc0eaf02cd16423172440208a',1,'formatron.schemas.json_schema.FieldInfo.annotation()'],['../classformatron_1_1schemas_1_1pydantic_1_1FieldInfo.html#ac9e5af7e4cb356a450e9e48f3af24cfe',1,'formatron.schemas.pydantic.FieldInfo.annotation()'],['../classformatron_1_1schemas_1_1schema_1_1FieldInfo.html#a5c7b1d8b8d8d52426e95a3f326cf3e75',1,'formatron.schemas.schema.FieldInfo.annotation()']]], + ['append_5fline_3',['append_line',['../classformatron_1_1formatter_1_1FormatterBuilder.html#aa57e56f8d74b03eb4559106d189970c3',1,'formatron::formatter::FormatterBuilder']]], + ['append_5fmultiline_5fstr_4',['append_multiline_str',['../classformatron_1_1formatter_1_1FormatterBuilder.html#a0e4da27aacaa16880ed463a9f86edff4',1,'formatron::formatter::FormatterBuilder']]], + ['append_5fstr_5',['append_str',['../classformatron_1_1formatter_1_1FormatterBuilder.html#a171eca2a241aaf0f5f1fa8c117694337',1,'formatron::formatter::FormatterBuilder']]], + ['autodetect_5fprocessors_6',['autodetect_processors',['../namespaceformatron_1_1integrations_1_1utils.html#ae2a9a65fa02be2e0d6d41b24e276cbf4',1,'formatron::integrations::utils']]] +]; diff --git a/v0.4.9/search/functions_10.js b/v0.4.9/search/functions_10.js new file mode 100644 index 0000000..9d1f702 --- /dev/null +++ b/v0.4.9/search/functions_10.js @@ -0,0 +1,7 @@ +var searchData= +[ + ['update_5fvocab_5f0xhh_0',['update_vocab_0xHH',['../namespaceformatron_1_1integrations_1_1utils.html#a27f1dbe46fdc2c2cf911fdb026972045',1,'formatron::integrations::utils']]], + ['update_5fvocab_5fdot_5fg_1',['update_vocab_dot_G',['../namespaceformatron_1_1integrations_1_1utils.html#a5f8874cc6515daae855acc1dbc2b94aa',1,'formatron::integrations::utils']]], + ['update_5fvocab_5fsentencepiece_2',['update_vocab_sentencepiece',['../namespaceformatron_1_1integrations_1_1utils.html#ac064c70217efb9b48e440985aee10918',1,'formatron::integrations::utils']]], + ['use_5fbackground_5fworker_3',['use_background_worker',['../classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#a9aa83a5922cefce88197d2cc3822a0c6',1,'formatron::integrations::exllamav2::FormatterFilter']]] +]; diff --git a/v0.4.9/search/functions_2.js b/v0.4.9/search/functions_2.js new file mode 100644 index 0000000..5172e30 --- /dev/null +++ b/v0.4.9/search/functions_2.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['begin_0',['begin',['../classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#a31967e1c243ae325d5bf288c73e6635e',1,'formatron::integrations::exllamav2::FormatterFilter']]], + ['build_1',['build',['../classformatron_1_1formatter_1_1FormatterBuilder.html#aae2d235fef43c64305c076edbed41da5',1,'formatron::formatter::FormatterBuilder']]] +]; diff --git a/v0.4.9/search/functions_3.js b/v0.4.9/search/functions_3.js new file mode 100644 index 0000000..7691df5 --- /dev/null +++ b/v0.4.9/search/functions_3.js @@ -0,0 +1,16 @@ +var searchData= +[ + ['callable_5fschema_0',['callable_schema',['../namespaceformatron_1_1schemas_1_1pydantic.html#a0b1aeb9a63626b0e782bc4b9e1ce18cf',1,'formatron::schemas::pydantic']]], + ['can_5fmask_5flogits_1',['can_mask_logits',['../classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#ad1269fb97cabd3381473bbd15ee59324',1,'formatron::integrations::exllamav2::FormatterFilter']]], + ['capture_5fname_2',['capture_name',['../classformatron_1_1extractor_1_1Extractor.html#abb72e0428a8b5835d075ebd889703e13',1,'formatron::extractor::Extractor']]], + ['captures_3',['captures',['../classformatron_1_1formatter_1_1FormatterBase.html#ab6682619840e83727264a945953fe964',1,'formatron.formatter.FormatterBase.captures()'],['../classformatron_1_1formatter_1_1Formatter.html#af69cc99bea2c85c4ca5af0ecc01c5db1',1,'formatron.formatter.Formatter.captures()']]], + ['choose_4',['choose',['../classformatron_1_1formatter_1_1FormatterBuilder.html#a5594cefa0b28af7f159f374486e51618',1,'formatron::formatter::FormatterBuilder']]], + ['clone_5',['clone',['../classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#a6ea0f3a9197afc9dd2b5b808fac2f157',1,'formatron::integrations::exllamav2::FormatterFilter']]], + ['compute_5fallowed_5ftokens_6',['compute_allowed_tokens',['../classformatron_1_1formatter_1_1FormatterBase.html#a927b160d994d43c4e38807f94ea69069',1,'formatron.formatter.FormatterBase.compute_allowed_tokens()'],['../classformatron_1_1formatter_1_1Formatter.html#a538f36e08b749716e6dd4c50679e2ee1',1,'formatron.formatter.Formatter.compute_allowed_tokens()']]], + ['create_5fengine_5fvocabulary_7',['create_engine_vocabulary',['../namespaceformatron_1_1integrations_1_1exllamav2.html#a80db020f2fd854399834ca7581281a34',1,'formatron.integrations.exllamav2.create_engine_vocabulary()'],['../namespaceformatron_1_1integrations_1_1RWKV.html#a2fc99d20bbcc438cc823a728cbc999ea',1,'formatron.integrations.RWKV.create_engine_vocabulary()'],['../namespaceformatron_1_1integrations_1_1transformers.html#af7d64821b9ef2da7cca0d710cb4e68a7',1,'formatron.integrations.transformers.create_engine_vocabulary()'],['../namespaceformatron_1_1integrations_1_1vllm.html#a16d6196bbdb008cc80ca59b860ccfc80',1,'formatron.integrations.vllm.create_engine_vocabulary()']]], + ['create_5fformatter_5ffilter_8',['create_formatter_filter',['../namespaceformatron_1_1integrations_1_1exllamav2.html#a51e71b1e5ca66beba85e26e8cc322206',1,'formatron::integrations::exllamav2']]], + ['create_5fformatter_5flogits_5fprocessor_9',['create_formatter_logits_processor',['../namespaceformatron_1_1integrations_1_1transformers.html#a8a01b497582979cece92538df6463939',1,'formatron::integrations::transformers']]], + ['create_5fformatter_5flogits_5fprocessor_5flist_10',['create_formatter_logits_processor_list',['../namespaceformatron_1_1integrations_1_1transformers.html#aa521d14eb09f692c5930b52373f00203',1,'formatron::integrations::transformers']]], + ['create_5fformatters_5flogits_5fprocessor_11',['create_formatters_logits_processor',['../namespaceformatron_1_1integrations_1_1vllm.html#ae67ec5e8c8a65188f4720a0c921723b6',1,'formatron::integrations::vllm']]], + ['create_5fschema_12',['create_schema',['../namespaceformatron_1_1schemas_1_1json__schema.html#ab2aeae10eb93ef3a3ca1c50013c6b380',1,'formatron::schemas::json_schema']]] +]; diff --git a/v0.4.9/search/functions_4.js b/v0.4.9/search/functions_4.js new file mode 100644 index 0000000..e217324 --- /dev/null +++ b/v0.4.9/search/functions_4.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['extract_0',['extract',['../classformatron_1_1extractor_1_1Extractor.html#a9efb2a75cf5fc5e0919c235aa1435469',1,'formatron.extractor.Extractor.extract()'],['../classformatron_1_1extractor_1_1LiteralExtractor.html#af80f5dc8710b59ced091d9b12afd828c',1,'formatron.extractor.LiteralExtractor.extract()'],['../classformatron_1_1extractor_1_1ChoiceExtractor.html#acfd6ee4d6b1ea910dd6f89a4c0fca41f',1,'formatron.extractor.ChoiceExtractor.extract()'],['../classformatron_1_1extractor_1_1SubstringExtractor.html#a1263c299229be0cd9d310e8d97401cd9',1,'formatron.extractor.SubstringExtractor.extract()'],['../classformatron_1_1formats_1_1json_1_1JsonExtractor.html#a6ad701c17988fe32b164135ebd39c783',1,'formatron.formats.json.JsonExtractor.extract()'],['../classformatron_1_1formats_1_1regex_1_1RegexExtractor.html#a73a98b3762aa24d4319e84c1123493c7',1,'formatron.formats.regex.RegexExtractor.extract()'],['../classformatron_1_1formats_1_1regex_1_1RegexComplementExtractor.html#ac5574731870b0ceb01a19ca773c6417d',1,'formatron.formats.regex.RegexComplementExtractor.extract()']]], + ['extractor_1',['extractor',['../classformatron_1_1formatter_1_1FormatterBuilder.html#a8b6c87737912e390a1411d0b85080947',1,'formatron::formatter::FormatterBuilder']]] +]; diff --git a/v0.4.9/search/functions_5.js b/v0.4.9/search/functions_5.js new file mode 100644 index 0000000..310a66e --- /dev/null +++ b/v0.4.9/search/functions_5.js @@ -0,0 +1,8 @@ +var searchData= +[ + ['feed_0',['feed',['../classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#a6896753ca9ce0cdb5cf998edd379123e',1,'formatron::integrations::exllamav2::FormatterFilter']]], + ['fields_1',['fields',['../classformatron_1_1schemas_1_1pydantic_1_1ClassSchema.html#add30bb5902bbfd8ff4fa17f197994442',1,'formatron.schemas.pydantic.ClassSchema.fields()'],['../classformatron_1_1schemas_1_1schema_1_1Schema.html#a98d77a5645545d440b91126926d1aeb8',1,'formatron.schemas.schema.Schema.fields()']]], + ['formatter_5fcaptures_2',['formatter_captures',['../classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#ac1b4fa75c9e9009bd9990686efe1c2f5',1,'formatron::integrations::exllamav2::FormatterFilter']]], + ['formatters_5fcaptures_3',['formatters_captures',['../classformatron_1_1integrations_1_1transformers_1_1FormattersLogitsProcessor.html#a148e8818c8d198d37e167d7030fa5746',1,'formatron.integrations.transformers.FormattersLogitsProcessor.formatters_captures()'],['../classformatron_1_1integrations_1_1vllm_1_1FormattersLogitsProcessor.html#ae1387d693b21b6c34f7912a3bf7d182d',1,'formatron.integrations.vllm.FormattersLogitsProcessor.formatters_captures()']]], + ['from_5fjson_4',['from_json',['../classformatron_1_1schemas_1_1pydantic_1_1ClassSchema.html#aec269b72011e216e8f5fefdfa338253a',1,'formatron.schemas.pydantic.ClassSchema.from_json()'],['../classformatron_1_1schemas_1_1schema_1_1Schema.html#a8c45239aaa45574add14fa72fbdf16dc',1,'formatron.schemas.schema.Schema.from_json()']]] +]; diff --git a/v0.4.9/search/functions_6.js b/v0.4.9/search/functions_6.js new file mode 100644 index 0000000..d0b74b7 --- /dev/null +++ b/v0.4.9/search/functions_6.js @@ -0,0 +1,7 @@ +var searchData= +[ + ['generate_0',['generate',['../classformatron_1_1integrations_1_1RWKV_1_1PIPELINE.html#a96f5091b6a8cc681e698a1a4cecdbd1f',1,'formatron::integrations::RWKV::PIPELINE']]], + ['get_5fallowed_5ftokens_5fsince_5flast_5fcomputation_1',['get_allowed_tokens_since_last_computation',['../classformatron_1_1formatter_1_1FormatterBase.html#ab77855193118e33bf8247c5709a0f485',1,'formatron.formatter.FormatterBase.get_allowed_tokens_since_last_computation()'],['../classformatron_1_1formatter_1_1Formatter.html#a5d565301d527fd3a56ca86a98df9afaf',1,'formatron.formatter.Formatter.get_allowed_tokens_since_last_computation()']]], + ['get_5foriginal_5fcharacters_2',['get_original_characters',['../namespaceformatron_1_1integrations_1_1utils.html#a744e97099675a1aac1c24fd6a1398efd',1,'formatron::integrations::utils']]], + ['grammar_5fstr_3',['grammar_str',['../classformatron_1_1formatter_1_1Formatter.html#a2519969e1338beb864169289a6f36bb9',1,'formatron::formatter::Formatter']]] +]; diff --git a/v0.4.9/search/functions_7.js b/v0.4.9/search/functions_7.js new file mode 100644 index 0000000..b5de68c --- /dev/null +++ b/v0.4.9/search/functions_7.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['infer_5fmapping_0',['infer_mapping',['../namespaceformatron_1_1schemas_1_1dict__inference.html#a850490b4a317260a236333130d36a5d8',1,'formatron::schemas::dict_inference']]], + ['is_5fcompleted_1',['is_completed',['../classformatron_1_1formatter_1_1FormatterBase.html#ac9af60077533ed0f3c9f42ee3a132899',1,'formatron.formatter.FormatterBase.is_completed()'],['../classformatron_1_1formatter_1_1Formatter.html#ac15aeec180daa5c78ad3c9bd93bd2b5b',1,'formatron.formatter.Formatter.is_completed()'],['../classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#adadb3652b5250cf08dfe7cc8824e2ec0',1,'formatron.integrations.exllamav2.FormatterFilter.is_completed()'],['../classformatron_1_1integrations_1_1transformers_1_1FormattersLogitsProcessor.html#a0bf8e8613df954fcad9fb5368d0f7025',1,'formatron.integrations.transformers.FormattersLogitsProcessor.is_completed()'],['../classformatron_1_1integrations_1_1vllm_1_1FormattersLogitsProcessor.html#ad6930fba60b378039db9698d811cb82a',1,'formatron.integrations.vllm.FormattersLogitsProcessor.is_completed()']]] +]; diff --git a/v0.4.9/search/functions_8.js b/v0.4.9/search/functions_8.js new file mode 100644 index 0000000..ca21cb9 --- /dev/null +++ b/v0.4.9/search/functions_8.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['json_0',['json',['../classformatron_1_1formatter_1_1FormatterBuilder.html#ad2a182c94ddec53d22aefe64f57d6514',1,'formatron::formatter::FormatterBuilder']]] +]; diff --git a/v0.4.9/search/functions_9.js b/v0.4.9/search/functions_9.js new file mode 100644 index 0000000..1ec9b7a --- /dev/null +++ b/v0.4.9/search/functions_9.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['kbnf_5fdefinition_0',['kbnf_definition',['../classformatron_1_1extractor_1_1Extractor.html#ae9abcfb6c5bae5b352de8a97f94be049',1,'formatron.extractor.Extractor.kbnf_definition()'],['../classformatron_1_1extractor_1_1LiteralExtractor.html#ada2b4df1008ae73880c5e1d35fca5939',1,'formatron.extractor.LiteralExtractor.kbnf_definition()'],['../classformatron_1_1extractor_1_1ChoiceExtractor.html#a5fe06cd727f3313d5e52a7ea6b81d5c4',1,'formatron.extractor.ChoiceExtractor.kbnf_definition()'],['../classformatron_1_1extractor_1_1SubstringExtractor.html#a13801ce1a7da7bf804317ea15f6e172e',1,'formatron.extractor.SubstringExtractor.kbnf_definition()'],['../classformatron_1_1formats_1_1json_1_1JsonExtractor.html#ace660f78408893ab8fb7facd410a9d60',1,'formatron.formats.json.JsonExtractor.kbnf_definition()'],['../classformatron_1_1formats_1_1regex_1_1RegexExtractor.html#a7b5fa1eb57e55ccf46d7762e1a6d0b9a',1,'formatron.formats.regex.RegexExtractor.kbnf_definition()'],['../classformatron_1_1formats_1_1regex_1_1RegexComplementExtractor.html#a57759938dc0088caf94ec2d2dcf19495',1,'formatron.formats.regex.RegexComplementExtractor.kbnf_definition()']]], + ['kbnf_5freference_1',['kbnf_reference',['../classformatron_1_1extractor_1_1Extractor.html#abf347fc566ceca08b0845a5146347a5e',1,'formatron.extractor.Extractor.kbnf_reference()'],['../classformatron_1_1extractor_1_1NonterminalExtractor.html#a8c8a8f47ad90f6b9e4206ab6a56f302e',1,'formatron.extractor.NonterminalExtractor.kbnf_reference()'],['../classformatron_1_1extractor_1_1LiteralExtractor.html#acfc1bf5ad7fc06acef35ad8897ddf273',1,'formatron.extractor.LiteralExtractor.kbnf_reference()']]] +]; diff --git a/v0.4.9/search/functions_a.js b/v0.4.9/search/functions_a.js new file mode 100644 index 0000000..374eaab --- /dev/null +++ b/v0.4.9/search/functions_a.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['mask_5flogits_0',['mask_logits',['../classformatron_1_1formatter_1_1FormatterBase.html#ae8db7e92a900322ae5aa603b5c8f386f',1,'formatron.formatter.FormatterBase.mask_logits()'],['../classformatron_1_1formatter_1_1Formatter.html#a1068b4fa2167039fe04519ec4db65278',1,'formatron.formatter.Formatter.mask_logits()'],['../classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#a7a0e2e459eccf822cf79457a121a3a74',1,'formatron.integrations.exllamav2.FormatterFilter.mask_logits()']]], + ['metadata_1',['metadata',['../classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata.html#af8604b758b8af6878a130a4f0f28389b',1,'formatron::schemas::schema::TypeWithMetadata']]] +]; diff --git a/v0.4.9/search/functions_b.js b/v0.4.9/search/functions_b.js new file mode 100644 index 0000000..98ccf6c --- /dev/null +++ b/v0.4.9/search/functions_b.js @@ -0,0 +1,6 @@ +var searchData= +[ + ['next_0',['next',['../classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#aaf7f64e93e611f4fc0ca9b7c2196c2f2',1,'formatron::integrations::exllamav2::FormatterFilter']]], + ['next_5fset_1',['next_set',['../classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#ac6f22aff80d80035bdd2118feff9f965',1,'formatron::integrations::exllamav2::FormatterFilter']]], + ['nonterminal_2',['nonterminal',['../classformatron_1_1extractor_1_1NonterminalExtractor.html#a1dd1fabcef2e668d00bf6ebb38dd017f',1,'formatron::extractor::NonterminalExtractor']]] +]; diff --git a/v0.4.9/search/functions_c.js b/v0.4.9/search/functions_c.js new file mode 100644 index 0000000..24df5d1 --- /dev/null +++ b/v0.4.9/search/functions_c.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['prepare_5flogit_5fmask_0',['prepare_logit_mask',['../classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#aeb7f169a9c36b793867682069f00e928',1,'formatron::integrations::exllamav2::FormatterFilter']]] +]; diff --git a/v0.4.9/search/functions_d.js b/v0.4.9/search/functions_d.js new file mode 100644 index 0000000..46e617a --- /dev/null +++ b/v0.4.9/search/functions_d.js @@ -0,0 +1,8 @@ +var searchData= +[ + ['regex_0',['regex',['../classformatron_1_1formatter_1_1FormatterBuilder.html#af34f97f7f62d2a1de4f9e863b1834619',1,'formatron::formatter::FormatterBuilder']]], + ['regex_5fcomplement_1',['regex_complement',['../classformatron_1_1formatter_1_1FormatterBuilder.html#a60dedc5c21ecd24f6b0435bc0d936838',1,'formatron::formatter::FormatterBuilder']]], + ['register_5fgenerate_5fnonterminal_5fdef_2',['register_generate_nonterminal_def',['../namespaceformatron_1_1formats_1_1json.html#a55ae1cd2ef251d160e872a0c49e7ba7a',1,'formatron::formats::json']]], + ['required_3',['required',['../classformatron_1_1schemas_1_1dict__inference_1_1FieldInfo.html#acd5625095baa17d3cf8f2b9562be0e06',1,'formatron.schemas.dict_inference.FieldInfo.required()'],['../classformatron_1_1schemas_1_1json__schema_1_1FieldInfo.html#af25ae318725070cd198febebe07e5efa',1,'formatron.schemas.json_schema.FieldInfo.required()'],['../classformatron_1_1schemas_1_1pydantic_1_1FieldInfo.html#aeae1e2e12ad15628c69d896fae9aa477',1,'formatron.schemas.pydantic.FieldInfo.required()'],['../classformatron_1_1schemas_1_1schema_1_1FieldInfo.html#ac0d64035ccdc78e44a4cf6165d56081b',1,'formatron.schemas.schema.FieldInfo.required()']]], + ['reset_4',['reset',['../classformatron_1_1formatter_1_1FormatterBase.html#a522c78b1404697a99313f9edffa7a2a4',1,'formatron.formatter.FormatterBase.reset()'],['../classformatron_1_1formatter_1_1Formatter.html#a10ff1aac8dcd90e1bd983d2f6580a964',1,'formatron.formatter.Formatter.reset()'],['../classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#a984bc61ef20d16e88ffb40aa2f5afcc3',1,'formatron.integrations.exllamav2.FormatterFilter.reset()'],['../classformatron_1_1integrations_1_1transformers_1_1FormattersLogitsProcessor.html#a966da36a950eaef6898bcd5ec5841df4',1,'formatron.integrations.transformers.FormattersLogitsProcessor.reset()'],['../classformatron_1_1integrations_1_1vllm_1_1FormattersLogitsProcessor.html#a697bbd642308e22804f46729935e101b',1,'formatron.integrations.vllm.FormattersLogitsProcessor.reset()']]] +]; diff --git a/v0.4.9/search/functions_e.js b/v0.4.9/search/functions_e.js new file mode 100644 index 0000000..965b933 --- /dev/null +++ b/v0.4.9/search/functions_e.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['str_0',['str',['../classformatron_1_1formatter_1_1FormatterBuilder.html#ad467a40f82a47dff9bb2b95d1300ace0',1,'formatron::formatter::FormatterBuilder']]], + ['substr_1',['substr',['../classformatron_1_1formatter_1_1FormatterBuilder.html#ab98ad2c47fcb7be56521d3eadb4e643b',1,'formatron::formatter::FormatterBuilder']]] +]; diff --git a/v0.4.9/search/functions_f.js b/v0.4.9/search/functions_f.js new file mode 100644 index 0000000..f44c4e1 --- /dev/null +++ b/v0.4.9/search/functions_f.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['type_0',['type',['../classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata.html#ada7a24496aad9979411523441c53a6cf',1,'formatron::schemas::schema::TypeWithMetadata']]] +]; diff --git a/v0.4.9/search/mag.svg b/v0.4.9/search/mag.svg new file mode 100644 index 0000000..ffb6cf0 --- /dev/null +++ b/v0.4.9/search/mag.svg @@ -0,0 +1,24 @@ + + + + + + + diff --git a/v0.4.9/search/mag_d.svg b/v0.4.9/search/mag_d.svg new file mode 100644 index 0000000..4122773 --- /dev/null +++ b/v0.4.9/search/mag_d.svg @@ -0,0 +1,24 @@ + + + + + + + diff --git a/v0.4.9/search/mag_sel.svg b/v0.4.9/search/mag_sel.svg new file mode 100644 index 0000000..553dba8 --- /dev/null +++ b/v0.4.9/search/mag_sel.svg @@ -0,0 +1,31 @@ + + + + + + + + + diff --git a/v0.4.9/search/mag_seld.svg b/v0.4.9/search/mag_seld.svg new file mode 100644 index 0000000..c906f84 --- /dev/null +++ b/v0.4.9/search/mag_seld.svg @@ -0,0 +1,31 @@ + + + + + + + + + diff --git a/v0.4.9/search/namespaces_0.js b/v0.4.9/search/namespaces_0.js new file mode 100644 index 0000000..f77f2d2 --- /dev/null +++ b/v0.4.9/search/namespaces_0.js @@ -0,0 +1,21 @@ +var searchData= +[ + ['formatron_0',['formatron',['../namespaceformatron.html',1,'']]], + ['formatron_3a_3aconfig_1',['config',['../namespaceformatron_1_1config.html',1,'formatron']]], + ['formatron_3a_3aextractor_2',['extractor',['../namespaceformatron_1_1extractor.html',1,'formatron']]], + ['formatron_3a_3aformats_3',['formats',['../namespaceformatron_1_1formats.html',1,'formatron']]], + ['formatron_3a_3aformats_3a_3ajson_4',['json',['../namespaceformatron_1_1formats_1_1json.html',1,'formatron::formats']]], + ['formatron_3a_3aformats_3a_3aregex_5',['regex',['../namespaceformatron_1_1formats_1_1regex.html',1,'formatron::formats']]], + ['formatron_3a_3aformatter_6',['formatter',['../namespaceformatron_1_1formatter.html',1,'formatron']]], + ['formatron_3a_3aintegrations_7',['integrations',['../namespaceformatron_1_1integrations.html',1,'formatron']]], + ['formatron_3a_3aintegrations_3a_3aexllamav2_8',['exllamav2',['../namespaceformatron_1_1integrations_1_1exllamav2.html',1,'formatron::integrations']]], + ['formatron_3a_3aintegrations_3a_3arwkv_9',['RWKV',['../namespaceformatron_1_1integrations_1_1RWKV.html',1,'formatron::integrations']]], + ['formatron_3a_3aintegrations_3a_3atransformers_10',['transformers',['../namespaceformatron_1_1integrations_1_1transformers.html',1,'formatron::integrations']]], + ['formatron_3a_3aintegrations_3a_3autils_11',['utils',['../namespaceformatron_1_1integrations_1_1utils.html',1,'formatron::integrations']]], + ['formatron_3a_3aintegrations_3a_3avllm_12',['vllm',['../namespaceformatron_1_1integrations_1_1vllm.html',1,'formatron::integrations']]], + ['formatron_3a_3aschemas_13',['schemas',['../namespaceformatron_1_1schemas.html',1,'formatron']]], + ['formatron_3a_3aschemas_3a_3adict_5finference_14',['dict_inference',['../namespaceformatron_1_1schemas_1_1dict__inference.html',1,'formatron::schemas']]], + ['formatron_3a_3aschemas_3a_3ajson_5fschema_15',['json_schema',['../namespaceformatron_1_1schemas_1_1json__schema.html',1,'formatron::schemas']]], + ['formatron_3a_3aschemas_3a_3apydantic_16',['pydantic',['../namespaceformatron_1_1schemas_1_1pydantic.html',1,'formatron::schemas']]], + ['formatron_3a_3aschemas_3a_3aschema_17',['schema',['../namespaceformatron_1_1schemas_1_1schema.html',1,'formatron::schemas']]] +]; diff --git a/v0.4.9/search/search.css b/v0.4.9/search/search.css new file mode 100644 index 0000000..d7b0f90 --- /dev/null +++ b/v0.4.9/search/search.css @@ -0,0 +1,291 @@ +/*---------------- Search Box positioning */ + +#main-menu > li:last-child { + /* This
  • object is the parent of the search bar */ + display: flex; + justify-content: center; + align-items: center; + height: 36px; + margin-right: 1em; +} + +/*---------------- Search box styling */ + +.SRPage * { + font-weight: normal; + line-height: normal; +} + +dark-mode-toggle { + margin-left: 5px; + display: flex; + float: right; +} + +#MSearchBox { + display: inline-block; + white-space : nowrap; + background: white; + border-radius: 0.65em; + box-shadow: inset 0.5px 0.5px 3px 0px #555; + z-index: 102; +} + +#MSearchBox .left { + display: inline-block; + vertical-align: middle; + height: 1.4em; +} + +#MSearchSelect { + display: inline-block; + vertical-align: middle; + width: 20px; + height: 19px; + background-image: url('mag_sel.svg'); + margin: 0 0 0 0.3em; + padding: 0; +} + +#MSearchSelectExt { + display: inline-block; + vertical-align: middle; + width: 10px; + height: 19px; + background-image: url('mag.svg'); + margin: 0 0 0 0.5em; + padding: 0; +} + + +#MSearchField { + display: inline-block; + vertical-align: middle; + width: 7.5em; + height: 19px; + margin: 0 0.15em; + padding: 0; + line-height: 1em; + border:none; + color: #909090; + outline: none; + font-family: Arial,Verdana,sans-serif; + -webkit-border-radius: 0px; + border-radius: 0px; + background: none; +} + +@media(hover: none) { + /* to avoid zooming on iOS */ + #MSearchField { + font-size: 16px; + } +} + +#MSearchBox .right { + display: inline-block; + vertical-align: middle; + width: 1.4em; + height: 1.4em; +} + +#MSearchClose { + display: none; + font-size: inherit; + background : none; + border: none; + margin: 0; + padding: 0; + outline: none; + +} + +#MSearchCloseImg { + padding: 0.3em; + margin: 0; +} + +.MSearchBoxActive #MSearchField { + color: black; +} + + + +/*---------------- Search filter selection */ + +#MSearchSelectWindow { + display: none; + position: absolute; + left: 0; top: 0; + border: 1px solid #90A5CE; + background-color: #F9FAFC; + z-index: 10001; + padding-top: 4px; + padding-bottom: 4px; + -moz-border-radius: 4px; + -webkit-border-top-left-radius: 4px; + -webkit-border-top-right-radius: 4px; + -webkit-border-bottom-left-radius: 4px; + -webkit-border-bottom-right-radius: 4px; + -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); +} + +.SelectItem { + font: 8pt Arial,Verdana,sans-serif; + padding-left: 2px; + padding-right: 12px; + border: 0px; +} + +span.SelectionMark { + margin-right: 4px; + font-family: 'JetBrains Mono',Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace,fixed; + outline-style: none; + text-decoration: none; +} + +a.SelectItem { + display: block; + outline-style: none; + color: black; + text-decoration: none; + padding-left: 6px; + padding-right: 12px; +} + +a.SelectItem:focus, +a.SelectItem:active { + color: black; + outline-style: none; + text-decoration: none; +} + +a.SelectItem:hover { + color: white; + background-color: #3D578C; + outline-style: none; + text-decoration: none; + cursor: pointer; + display: block; +} + +/*---------------- Search results window */ + +iframe#MSearchResults { + /*width: 60ex;*/ + height: 15em; +} + +#MSearchResultsWindow { + display: none; + position: absolute; + left: 0; top: 0; + border: 1px solid black; + background-color: #EEF1F7; + z-index:10000; + width: 300px; + height: 400px; + overflow: auto; +} + +/* ----------------------------------- */ + + +#SRIndex { + clear:both; +} + +.SREntry { + font-size: 10pt; + padding-left: 1ex; +} + +.SRPage .SREntry { + font-size: 8pt; + padding: 1px 5px; +} + +div.SRPage { + margin: 5px 2px; + background-color: #EEF1F7; +} + +.SRChildren { + padding-left: 3ex; padding-bottom: .5em +} + +.SRPage .SRChildren { + display: none; +} + +.SRSymbol { + font-weight: bold; + color: #425E97; + font-family: Arial,Verdana,sans-serif; + text-decoration: none; + outline: none; +} + +a.SRScope { + display: block; + color: #425E97; + font-family: Arial,Verdana,sans-serif; + font-size: 8pt; + text-decoration: none; + outline: none; +} + +a.SRSymbol:focus, a.SRSymbol:active, +a.SRScope:focus, a.SRScope:active { + text-decoration: underline; +} + +span.SRScope { + padding-left: 4px; + font-family: Arial,Verdana,sans-serif; +} + +.SRPage .SRStatus { + padding: 2px 5px; + font-size: 8pt; + font-style: italic; + font-family: Arial,Verdana,sans-serif; +} + +.SRResult { + display: none; +} + +div.searchresults { + margin-left: 10px; + margin-right: 10px; +} + +/*---------------- External search page results */ + +.pages b { + color: white; + padding: 5px 5px 3px 5px; + background-image: url("../tab_a.png"); + background-repeat: repeat-x; + text-shadow: 0 1px 1px #000000; +} + +.pages { + line-height: 17px; + margin-left: 4px; + text-decoration: none; +} + +.hl { + font-weight: bold; +} + +#searchresults { + margin-bottom: 20px; +} + +.searchpages { + margin-top: 10px; +} + diff --git a/v0.4.9/search/search.js b/v0.4.9/search/search.js new file mode 100644 index 0000000..666af01 --- /dev/null +++ b/v0.4.9/search/search.js @@ -0,0 +1,694 @@ +/* + @licstart The following is the entire license notice for the JavaScript code in this file. + + The MIT License (MIT) + + Copyright (C) 1997-2020 by Dimitri van Heesch + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software + and associated documentation files (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, publish, distribute, + sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or + substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING + BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + @licend The above is the entire license notice for the JavaScript code in this file + */ +const SEARCH_COOKIE_NAME = ''+'search_grp'; + +const searchResults = new SearchResults(); + +/* A class handling everything associated with the search panel. + + Parameters: + name - The name of the global variable that will be + storing this instance. Is needed to be able to set timeouts. + resultPath - path to use for external files +*/ +function SearchBox(name, resultsPath, extension) { + if (!name || !resultsPath) { alert("Missing parameters to SearchBox."); } + if (!extension || extension == "") { extension = ".html"; } + + function getXPos(item) { + let x = 0; + if (item.offsetWidth) { + while (item && item!=document.body) { + x += item.offsetLeft; + item = item.offsetParent; + } + } + return x; + } + + function getYPos(item) { + let y = 0; + if (item.offsetWidth) { + while (item && item!=document.body) { + y += item.offsetTop; + item = item.offsetParent; + } + } + return y; + } + + // ---------- Instance variables + this.name = name; + this.resultsPath = resultsPath; + this.keyTimeout = 0; + this.keyTimeoutLength = 500; + this.closeSelectionTimeout = 300; + this.lastSearchValue = ""; + this.lastResultsPage = ""; + this.hideTimeout = 0; + this.searchIndex = 0; + this.searchActive = false; + this.extension = extension; + + // ----------- DOM Elements + + this.DOMSearchField = () => document.getElementById("MSearchField"); + this.DOMSearchSelect = () => document.getElementById("MSearchSelect"); + this.DOMSearchSelectWindow = () => document.getElementById("MSearchSelectWindow"); + this.DOMPopupSearchResults = () => document.getElementById("MSearchResults"); + this.DOMPopupSearchResultsWindow = () => document.getElementById("MSearchResultsWindow"); + this.DOMSearchClose = () => document.getElementById("MSearchClose"); + this.DOMSearchBox = () => document.getElementById("MSearchBox"); + + // ------------ Event Handlers + + // Called when focus is added or removed from the search field. + this.OnSearchFieldFocus = function(isActive) { + this.Activate(isActive); + } + + this.OnSearchSelectShow = function() { + const searchSelectWindow = this.DOMSearchSelectWindow(); + const searchField = this.DOMSearchSelect(); + + const left = getXPos(searchField); + const top = getYPos(searchField) + searchField.offsetHeight; + + // show search selection popup + searchSelectWindow.style.display='block'; + searchSelectWindow.style.left = left + 'px'; + searchSelectWindow.style.top = top + 'px'; + + // stop selection hide timer + if (this.hideTimeout) { + clearTimeout(this.hideTimeout); + this.hideTimeout=0; + } + return false; // to avoid "image drag" default event + } + + this.OnSearchSelectHide = function() { + this.hideTimeout = setTimeout(this.CloseSelectionWindow.bind(this), + this.closeSelectionTimeout); + } + + // Called when the content of the search field is changed. + this.OnSearchFieldChange = function(evt) { + if (this.keyTimeout) { // kill running timer + clearTimeout(this.keyTimeout); + this.keyTimeout = 0; + } + + const e = evt ? evt : window.event; // for IE + if (e.keyCode==40 || e.keyCode==13) { + if (e.shiftKey==1) { + this.OnSearchSelectShow(); + const win=this.DOMSearchSelectWindow(); + for (let i=0;i do a search + this.Search(); + } + } + + this.OnSearchSelectKey = function(evt) { + const e = (evt) ? evt : window.event; // for IE + if (e.keyCode==40 && this.searchIndex0) { // Up + this.searchIndex--; + this.OnSelectItem(this.searchIndex); + } else if (e.keyCode==13 || e.keyCode==27) { + e.stopPropagation(); + this.OnSelectItem(this.searchIndex); + this.CloseSelectionWindow(); + this.DOMSearchField().focus(); + } + return false; + } + + // --------- Actions + + // Closes the results window. + this.CloseResultsWindow = function() { + this.DOMPopupSearchResultsWindow().style.display = 'none'; + this.DOMSearchClose().style.display = 'none'; + this.Activate(false); + } + + this.CloseSelectionWindow = function() { + this.DOMSearchSelectWindow().style.display = 'none'; + } + + // Performs a search. + this.Search = function() { + this.keyTimeout = 0; + + // strip leading whitespace + const searchValue = this.DOMSearchField().value.replace(/^ +/, ""); + + const code = searchValue.toLowerCase().charCodeAt(0); + let idxChar = searchValue.substr(0, 1).toLowerCase(); + if ( 0xD800 <= code && code <= 0xDBFF && searchValue > 1) { // surrogate pair + idxChar = searchValue.substr(0, 2); + } + + let jsFile; + let idx = indexSectionsWithContent[this.searchIndex].indexOf(idxChar); + if (idx!=-1) { + const hexCode=idx.toString(16); + jsFile = this.resultsPath + indexSectionNames[this.searchIndex] + '_' + hexCode + '.js'; + } + + const loadJS = function(url, impl, loc) { + const scriptTag = document.createElement('script'); + scriptTag.src = url; + scriptTag.onload = impl; + scriptTag.onreadystatechange = impl; + loc.appendChild(scriptTag); + } + + const domPopupSearchResultsWindow = this.DOMPopupSearchResultsWindow(); + const domSearchBox = this.DOMSearchBox(); + const domPopupSearchResults = this.DOMPopupSearchResults(); + const domSearchClose = this.DOMSearchClose(); + const resultsPath = this.resultsPath; + + const handleResults = function() { + document.getElementById("Loading").style.display="none"; + if (typeof searchData !== 'undefined') { + createResults(resultsPath); + document.getElementById("NoMatches").style.display="none"; + } + + if (idx!=-1) { + searchResults.Search(searchValue); + } else { // no file with search results => force empty search results + searchResults.Search('===='); + } + + if (domPopupSearchResultsWindow.style.display!='block') { + domSearchClose.style.display = 'inline-block'; + let left = getXPos(domSearchBox) + 150; + let top = getYPos(domSearchBox) + 20; + domPopupSearchResultsWindow.style.display = 'block'; + left -= domPopupSearchResults.offsetWidth; + const maxWidth = document.body.clientWidth; + const maxHeight = document.body.clientHeight; + let width = 300; + if (left<10) left=10; + if (width+left+8>maxWidth) width=maxWidth-left-8; + let height = 400; + if (height+top+8>maxHeight) height=maxHeight-top-8; + domPopupSearchResultsWindow.style.top = top + 'px'; + domPopupSearchResultsWindow.style.left = left + 'px'; + domPopupSearchResultsWindow.style.width = width + 'px'; + domPopupSearchResultsWindow.style.height = height + 'px'; + } + } + + if (jsFile) { + loadJS(jsFile, handleResults, this.DOMPopupSearchResultsWindow()); + } else { + handleResults(); + } + + this.lastSearchValue = searchValue; + } + + // -------- Activation Functions + + // Activates or deactivates the search panel, resetting things to + // their default values if necessary. + this.Activate = function(isActive) { + if (isActive || // open it + this.DOMPopupSearchResultsWindow().style.display == 'block' + ) { + this.DOMSearchBox().className = 'MSearchBoxActive'; + this.searchActive = true; + } else if (!isActive) { // directly remove the panel + this.DOMSearchBox().className = 'MSearchBoxInactive'; + this.searchActive = false; + this.lastSearchValue = '' + this.lastResultsPage = ''; + this.DOMSearchField().value = ''; + } + } +} + +// ----------------------------------------------------------------------- + +// The class that handles everything on the search results page. +function SearchResults() { + + function convertToId(search) { + let result = ''; + for (let i=0;i. + this.lastMatchCount = 0; + this.lastKey = 0; + this.repeatOn = false; + + // Toggles the visibility of the passed element ID. + this.FindChildElement = function(id) { + const parentElement = document.getElementById(id); + let element = parentElement.firstChild; + + while (element && element!=parentElement) { + if (element.nodeName.toLowerCase() == 'div' && element.className == 'SRChildren') { + return element; + } + + if (element.nodeName.toLowerCase() == 'div' && element.hasChildNodes()) { + element = element.firstChild; + } else if (element.nextSibling) { + element = element.nextSibling; + } else { + do { + element = element.parentNode; + } + while (element && element!=parentElement && !element.nextSibling); + + if (element && element!=parentElement) { + element = element.nextSibling; + } + } + } + } + + this.Toggle = function(id) { + const element = this.FindChildElement(id); + if (element) { + if (element.style.display == 'block') { + element.style.display = 'none'; + } else { + element.style.display = 'block'; + } + } + } + + // Searches for the passed string. If there is no parameter, + // it takes it from the URL query. + // + // Always returns true, since other documents may try to call it + // and that may or may not be possible. + this.Search = function(search) { + if (!search) { // get search word from URL + search = window.location.search; + search = search.substring(1); // Remove the leading '?' + search = unescape(search); + } + + search = search.replace(/^ +/, ""); // strip leading spaces + search = search.replace(/ +$/, ""); // strip trailing spaces + search = search.toLowerCase(); + search = convertToId(search); + + const resultRows = document.getElementsByTagName("div"); + let matches = 0; + + let i = 0; + while (i < resultRows.length) { + const row = resultRows.item(i); + if (row.className == "SRResult") { + let rowMatchName = row.id.toLowerCase(); + rowMatchName = rowMatchName.replace(/^sr\d*_/, ''); // strip 'sr123_' + + if (search.length<=rowMatchName.length && + rowMatchName.substr(0, search.length)==search) { + row.style.display = 'block'; + matches++; + } else { + row.style.display = 'none'; + } + } + i++; + } + document.getElementById("Searching").style.display='none'; + if (matches == 0) { // no results + document.getElementById("NoMatches").style.display='block'; + } else { // at least one result + document.getElementById("NoMatches").style.display='none'; + } + this.lastMatchCount = matches; + return true; + } + + // return the first item with index index or higher that is visible + this.NavNext = function(index) { + let focusItem; + for (;;) { + const focusName = 'Item'+index; + focusItem = document.getElementById(focusName); + if (focusItem && focusItem.parentNode.parentNode.style.display=='block') { + break; + } else if (!focusItem) { // last element + break; + } + focusItem=null; + index++; + } + return focusItem; + } + + this.NavPrev = function(index) { + let focusItem; + for (;;) { + const focusName = 'Item'+index; + focusItem = document.getElementById(focusName); + if (focusItem && focusItem.parentNode.parentNode.style.display=='block') { + break; + } else if (!focusItem) { // last element + break; + } + focusItem=null; + index--; + } + return focusItem; + } + + this.ProcessKeys = function(e) { + if (e.type == "keydown") { + this.repeatOn = false; + this.lastKey = e.keyCode; + } else if (e.type == "keypress") { + if (!this.repeatOn) { + if (this.lastKey) this.repeatOn = true; + return false; // ignore first keypress after keydown + } + } else if (e.type == "keyup") { + this.lastKey = 0; + this.repeatOn = false; + } + return this.lastKey!=0; + } + + this.Nav = function(evt,itemIndex) { + const e = (evt) ? evt : window.event; // for IE + if (e.keyCode==13) return true; + if (!this.ProcessKeys(e)) return false; + + if (this.lastKey==38) { // Up + const newIndex = itemIndex-1; + let focusItem = this.NavPrev(newIndex); + if (focusItem) { + let child = this.FindChildElement(focusItem.parentNode.parentNode.id); + if (child && child.style.display == 'block') { // children visible + let n=0; + let tmpElem; + for (;;) { // search for last child + tmpElem = document.getElementById('Item'+newIndex+'_c'+n); + if (tmpElem) { + focusItem = tmpElem; + } else { // found it! + break; + } + n++; + } + } + } + if (focusItem) { + focusItem.focus(); + } else { // return focus to search field + document.getElementById("MSearchField").focus(); + } + } else if (this.lastKey==40) { // Down + const newIndex = itemIndex+1; + let focusItem; + const item = document.getElementById('Item'+itemIndex); + const elem = this.FindChildElement(item.parentNode.parentNode.id); + if (elem && elem.style.display == 'block') { // children visible + focusItem = document.getElementById('Item'+itemIndex+'_c0'); + } + if (!focusItem) focusItem = this.NavNext(newIndex); + if (focusItem) focusItem.focus(); + } else if (this.lastKey==39) { // Right + const item = document.getElementById('Item'+itemIndex); + const elem = this.FindChildElement(item.parentNode.parentNode.id); + if (elem) elem.style.display = 'block'; + } else if (this.lastKey==37) { // Left + const item = document.getElementById('Item'+itemIndex); + const elem = this.FindChildElement(item.parentNode.parentNode.id); + if (elem) elem.style.display = 'none'; + } else if (this.lastKey==27) { // Escape + e.stopPropagation(); + searchBox.CloseResultsWindow(); + document.getElementById("MSearchField").focus(); + } else if (this.lastKey==13) { // Enter + return true; + } + return false; + } + + this.NavChild = function(evt,itemIndex,childIndex) { + const e = (evt) ? evt : window.event; // for IE + if (e.keyCode==13) return true; + if (!this.ProcessKeys(e)) return false; + + if (this.lastKey==38) { // Up + if (childIndex>0) { + const newIndex = childIndex-1; + document.getElementById('Item'+itemIndex+'_c'+newIndex).focus(); + } else { // already at first child, jump to parent + document.getElementById('Item'+itemIndex).focus(); + } + } else if (this.lastKey==40) { // Down + const newIndex = childIndex+1; + let elem = document.getElementById('Item'+itemIndex+'_c'+newIndex); + if (!elem) { // last child, jump to parent next parent + elem = this.NavNext(itemIndex+1); + } + if (elem) { + elem.focus(); + } + } else if (this.lastKey==27) { // Escape + e.stopPropagation(); + searchBox.CloseResultsWindow(); + document.getElementById("MSearchField").focus(); + } else if (this.lastKey==13) { // Enter + return true; + } + return false; + } +} + +function createResults(resultsPath) { + + function setKeyActions(elem,action) { + elem.setAttribute('onkeydown',action); + elem.setAttribute('onkeypress',action); + elem.setAttribute('onkeyup',action); + } + + function setClassAttr(elem,attr) { + elem.setAttribute('class',attr); + elem.setAttribute('className',attr); + } + + const results = document.getElementById("SRResults"); + results.innerHTML = ''; + searchData.forEach((elem,index) => { + const id = elem[0]; + const srResult = document.createElement('div'); + srResult.setAttribute('id','SR_'+id); + setClassAttr(srResult,'SRResult'); + const srEntry = document.createElement('div'); + setClassAttr(srEntry,'SREntry'); + const srLink = document.createElement('a'); + srLink.setAttribute('id','Item'+index); + setKeyActions(srLink,'return searchResults.Nav(event,'+index+')'); + setClassAttr(srLink,'SRSymbol'); + srLink.innerHTML = elem[1][0]; + srEntry.appendChild(srLink); + if (elem[1].length==2) { // single result + srLink.setAttribute('href',resultsPath+elem[1][1][0]); + srLink.setAttribute('onclick','searchBox.CloseResultsWindow()'); + if (elem[1][1][1]) { + srLink.setAttribute('target','_parent'); + } else { + srLink.setAttribute('target','_blank'); + } + const srScope = document.createElement('span'); + setClassAttr(srScope,'SRScope'); + srScope.innerHTML = elem[1][1][2]; + srEntry.appendChild(srScope); + } else { // multiple results + srLink.setAttribute('href','javascript:searchResults.Toggle("SR_'+id+'")'); + const srChildren = document.createElement('div'); + setClassAttr(srChildren,'SRChildren'); + for (let c=0; cli>h1,.sm>li>h2,.sm>li>h3,.sm>li>h4,.sm>li>h5,.sm>li>h6{margin:0;padding:0}.sm ul{display:none}.sm li,.sm a{position:relative}.sm a{display:block}.sm a.disabled{cursor:not-allowed}.sm:after{content:"\00a0";display:block;height:0;font:0/0 serif;clear:both;visibility:hidden;overflow:hidden}.sm,.sm *,.sm *:before,.sm *:after{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.main-menu-btn{position:relative;display:inline-block;width:36px;height:36px;text-indent:36px;margin-left:8px;white-space:nowrap;overflow:hidden;cursor:pointer;-webkit-tap-highlight-color:rgba(0,0,0,0)}.main-menu-btn-icon,.main-menu-btn-icon:before,.main-menu-btn-icon:after{position:absolute;top:50%;left:2px;height:2px;width:24px;background:#364D7C;-webkit-transition:all .25s;transition:all .25s}.main-menu-btn-icon:before{content:'';top:-7px;left:0}.main-menu-btn-icon:after{content:'';top:7px;left:0}#main-menu-state:checked ~ .main-menu-btn .main-menu-btn-icon{height:0}#main-menu-state:checked ~ .main-menu-btn .main-menu-btn-icon:before{top:0;-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}#main-menu-state:checked ~ .main-menu-btn .main-menu-btn-icon:after{top:0;-webkit-transform:rotate(45deg);transform:rotate(45deg)}#main-menu-state{position:absolute;width:1px;height:1px;margin:-1px;border:0;padding:0;overflow:hidden;clip:rect(1px,1px,1px,1px)}#main-menu-state:not(:checked) ~ #main-menu{display:none}#main-menu-state:checked ~ #main-menu{display:block}@media(min-width:768px){.main-menu-btn{position:absolute;top:-99999px}#main-menu-state:not(:checked) ~ #main-menu{display:block}}.sm-dox{background-image:url('tab_b.png')}.sm-dox a,.sm-dox a:focus,.sm-dox a:hover,.sm-dox a:active{padding:0 12px;padding-right:43px;font-family:'Lucida Grande',Geneva,Helvetica,Arial,sans-serif;font-size:13px;font-weight:bold;line-height:36px;text-decoration:none;text-shadow:0px 1px 1px rgba(255, 255, 255, 0.9);color:#283A5D;outline:0}.sm-dox a:hover{background-image:url('tab_a.png');background-repeat:repeat-x;color:white;text-shadow:0px 1px 1px rgba(0, 0, 0, 1.0)}.sm-dox a.current{color:#d23600}.sm-dox a.disabled{color:#bbb}.sm-dox a span.sub-arrow{position:absolute;top:50%;margin-top:-14px;left:auto;right:3px;width:28px;height:28px;overflow:hidden;font:bold 12px/28px monospace !important;text-align:center;text-shadow:none;background:rgba(255, 255, 255, 0.5);-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px}.sm-dox a span.sub-arrow:before{display:block;content:'+'}.sm-dox a.highlighted span.sub-arrow:before{display:block;content:'-'}.sm-dox>li:first-child>a,.sm-dox>li:first-child>:not(ul) a{-moz-border-radius:5px 5px 0 0;-webkit-border-radius:5px;border-radius:5px 5px 0 0}.sm-dox>li:last-child>a,.sm-dox>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul{-moz-border-radius:0 0 5px 5px;-webkit-border-radius:0;border-radius:0 0 5px 5px}.sm-dox>li:last-child>a.highlighted,.sm-dox>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a.highlighted{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0}.sm-dox ul{background:white}.sm-dox ul a,.sm-dox ul a:focus,.sm-dox ul a:hover,.sm-dox ul a:active{font-size:12px;border-left:8px solid transparent;line-height:36px;text-shadow:none;background-color:white;background-image:none}.sm-dox ul a:hover{background-image:url('tab_a.png');background-repeat:repeat-x;color:white;text-shadow:0 1px 1px black}.sm-dox ul ul a,.sm-dox ul ul a:hover,.sm-dox ul ul a:focus,.sm-dox ul ul a:active{border-left:16px solid transparent}.sm-dox ul ul ul a,.sm-dox ul ul ul a:hover,.sm-dox ul ul ul a:focus,.sm-dox ul ul ul a:active{border-left:24px solid transparent}.sm-dox ul ul ul ul a,.sm-dox ul ul ul ul a:hover,.sm-dox ul ul ul ul a:focus,.sm-dox ul ul ul ul a:active{border-left:32px solid transparent}.sm-dox ul ul ul ul ul a,.sm-dox ul ul ul ul ul a:hover,.sm-dox ul ul ul ul ul a:focus,.sm-dox ul ul ul ul ul a:active{border-left:40px solid transparent}@media(min-width:768px){.sm-dox ul{position:absolute;width:12em}.sm-dox li{float:left}.sm-dox.sm-rtl li{float:right}.sm-dox ul li,.sm-dox.sm-rtl ul li,.sm-dox.sm-vertical li{float:none}.sm-dox a{white-space:nowrap}.sm-dox ul a,.sm-dox.sm-vertical a{white-space:normal}.sm-dox .sm-nowrap>li>a,.sm-dox .sm-nowrap>li>:not(ul) a{white-space:nowrap}.sm-dox{padding:0 10px;background-image:url('tab_b.png');line-height:36px}.sm-dox a span.sub-arrow{top:50%;margin-top:-2px;right:12px;width:0;height:0;border-width:4px;border-style:solid dashed dashed dashed;border-color:#283A5D transparent transparent transparent;background:transparent;-moz-border-radius:0;-webkit-border-radius:0;border-radius:0}.sm-dox a,.sm-dox a:focus,.sm-dox a:active,.sm-dox a:hover,.sm-dox a.highlighted{padding:0 12px;background-image:url('tab_s.png');background-repeat:no-repeat;background-position:right;-moz-border-radius:0 !important;-webkit-border-radius:0;border-radius:0 !important}.sm-dox a:hover{background-image:url('tab_a.png');background-repeat:repeat-x;color:white;text-shadow:0px 1px 1px rgba(0, 0, 0, 1.0)}.sm-dox a:hover span.sub-arrow{border-color:white transparent transparent transparent}.sm-dox a.has-submenu{padding-right:24px}.sm-dox li{border-top:0}.sm-dox>li>ul:before,.sm-dox>li>ul:after{content:'';position:absolute;top:-18px;left:30px;width:0;height:0;overflow:hidden;border-width:9px;border-style:dashed dashed solid dashed;border-color:transparent transparent #bbb transparent}.sm-dox>li>ul:after{top:-16px;left:31px;border-width:8px;border-color:transparent transparent white transparent}.sm-dox ul{border:1px solid #bbb;padding:5px 0;background:white;-moz-border-radius:5px !important;-webkit-border-radius:5px;border-radius:5px !important;-moz-box-shadow:0 5px 9px rgba(0,0,0,0.2);-webkit-box-shadow:0 5px 9px rgba(0,0,0,0.2);box-shadow:0 5px 9px rgba(0,0,0,0.2)}.sm-dox ul a span.sub-arrow{right:8px;top:50%;margin-top:-5px;border-width:5px;border-color:transparent transparent transparent #555555;border-style:dashed dashed dashed solid}.sm-dox ul a,.sm-dox ul a:hover,.sm-dox ul a:focus,.sm-dox ul a:active,.sm-dox ul a.highlighted{color:#555555;background-image:none;border:0 !important}.sm-dox ul a:hover{background-image:url('tab_a.png');background-repeat:repeat-x;color:white;text-shadow:0px 1px 1px rgba(0, 0, 0, 1.0)}.sm-dox ul a:hover span.sub-arrow{border-color:transparent transparent transparent white}.sm-dox span.scroll-up,.sm-dox span.scroll-down{position:absolute;display:none;visibility:hidden;overflow:hidden;background:white;height:36px}.sm-dox span.scroll-up:hover,.sm-dox span.scroll-down:hover{background:#eee}.sm-dox span.scroll-up:hover span.scroll-up-arrow,.sm-dox span.scroll-up:hover span.scroll-down-arrow{border-color:transparent transparent #d23600 transparent}.sm-dox span.scroll-down:hover span.scroll-down-arrow{border-color:#d23600 transparent transparent transparent}.sm-dox span.scroll-up-arrow,.sm-dox span.scroll-down-arrow{position:absolute;top:0;left:50%;margin-left:-6px;width:0;height:0;overflow:hidden;border-width:6px;border-style:dashed dashed solid dashed;border-color:transparent transparent #555555 transparent}.sm-dox span.scroll-down-arrow{top:8px;border-style:solid dashed dashed dashed;border-color:#555555 transparent transparent transparent}.sm-dox.sm-rtl a.has-submenu{padding-right:12px;padding-left:24px}.sm-dox.sm-rtl a span.sub-arrow{right:auto;left:12px}.sm-dox.sm-rtl.sm-vertical a.has-submenu{padding:10px 20px}.sm-dox.sm-rtl.sm-vertical a span.sub-arrow{right:auto;left:8px;border-style:dashed solid dashed dashed;border-color:transparent #555 transparent transparent}.sm-dox.sm-rtl>li>ul:before{left:auto;right:30px}.sm-dox.sm-rtl>li>ul:after{left:auto;right:31px}.sm-dox.sm-rtl ul a.has-submenu{padding:10px 20px !important}.sm-dox.sm-rtl ul a span.sub-arrow{right:auto;left:8px;border-style:dashed solid dashed dashed;border-color:transparent #555 transparent transparent}.sm-dox.sm-vertical{padding:10px 0;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px}.sm-dox.sm-vertical a{padding:10px 20px}.sm-dox.sm-vertical a:hover,.sm-dox.sm-vertical a:focus,.sm-dox.sm-vertical a:active,.sm-dox.sm-vertical a.highlighted{background:#fff}.sm-dox.sm-vertical a.disabled{background-image:url('tab_b.png')}.sm-dox.sm-vertical a span.sub-arrow{right:8px;top:50%;margin-top:-5px;border-width:5px;border-style:dashed dashed dashed solid;border-color:transparent transparent transparent #555}.sm-dox.sm-vertical>li>ul:before,.sm-dox.sm-vertical>li>ul:after{display:none}.sm-dox.sm-vertical ul a{padding:10px 20px}.sm-dox.sm-vertical ul a:hover,.sm-dox.sm-vertical ul a:focus,.sm-dox.sm-vertical ul a:active,.sm-dox.sm-vertical ul a.highlighted{background:#eee}.sm-dox.sm-vertical ul a.disabled{background:white}} \ No newline at end of file diff --git a/v0.4.9/transformers_8py.html b/v0.4.9/transformers_8py.html new file mode 100644 index 0000000..79f54bd --- /dev/null +++ b/v0.4.9/transformers_8py.html @@ -0,0 +1,173 @@ + + + + + + + + +Formatron: src/formatron/integrations/transformers.py File Reference + + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Formatron v0.4.9 + + +
    +
    Formatron empowers everyone to control the output format of language models with minimal overhead.
    +
    +
    + + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    +
    +
    +
    +
    +
    Loading...
    +
    Searching...
    +
    No Matches
    +
    +
    +
    +
    + +
    + +
    transformers.py File Reference
    +
    +
    + +

    Go to the source code of this file.

    + + + + + +

    +Classes

    class  formatron.integrations.transformers.FormattersLogitsProcessor
     Logit processor that uses formatters to mask batch logits. More...
     
    + + + + + + + + + +

    +Namespaces

    namespace  formatron
     
    namespace  formatron.integrations
     This subpackage contains integrations with other frameworks and libraries.
     
    namespace  formatron.integrations.transformers
     This module integrates the transformers library by providing convenience utilities.
     
    + + + + + + + + + + +

    +Functions

    kbnf.Vocabulary formatron.integrations.transformers.create_engine_vocabulary (PreTrainedTokenizerBase tokenizer, typing.Optional[list[typing.Callable]] vocab_processors=None)
     Create a vocabulary for the KBNF engine.
     
    LogitsProcessor formatron.integrations.transformers.create_formatter_logits_processor (PreTrainedTokenizerBase tokenizer, typing.Sequence[FormatterBuilder|None]|FormatterBuilder formatter_builders, typing.Sequence[EngineGenerationConfig] configs=None, typing.Optional[list[typing.Callable]] vocab_processors=None)
     Create a formatter logits processor.
     
    LogitsProcessorList formatron.integrations.transformers.create_formatter_logits_processor_list (PreTrainedTokenizerBase tokenizer, typing.Sequence[FormatterBuilder|None]|FormatterBuilder formatter_builders, typing.Sequence[EngineGenerationConfig] configs=None, typing.Optional[list[typing.Callable]] vocab_processors=None)
     Create a formatter logits processor list.
     
    +
    +
    + + + + diff --git a/v0.4.9/transformers_8py.js b/v0.4.9/transformers_8py.js new file mode 100644 index 0000000..b6dc59a --- /dev/null +++ b/v0.4.9/transformers_8py.js @@ -0,0 +1,7 @@ +var transformers_8py = +[ + [ "formatron.integrations.transformers.FormattersLogitsProcessor", "classformatron_1_1integrations_1_1transformers_1_1FormattersLogitsProcessor.html", "classformatron_1_1integrations_1_1transformers_1_1FormattersLogitsProcessor" ], + [ "create_engine_vocabulary", "transformers_8py.html#af7d64821b9ef2da7cca0d710cb4e68a7", null ], + [ "create_formatter_logits_processor", "transformers_8py.html#a8a01b497582979cece92538df6463939", null ], + [ "create_formatter_logits_processor_list", "transformers_8py.html#aa521d14eb09f692c5930b52373f00203", null ] +]; \ No newline at end of file diff --git a/v0.4.9/transformers_8py_source.html b/v0.4.9/transformers_8py_source.html new file mode 100644 index 0000000..aee72f5 --- /dev/null +++ b/v0.4.9/transformers_8py_source.html @@ -0,0 +1,310 @@ + + + + + + + + +Formatron: src/formatron/integrations/transformers.py Source File + + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Formatron v0.4.9 + + +
    +
    Formatron empowers everyone to control the output format of language models with minimal overhead.
    +
    +
    + + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    +
    +
    +
    +
    +
    Loading...
    +
    Searching...
    +
    No Matches
    +
    +
    +
    +
    + +
    +
    transformers.py
    +
    +
    +Go to the documentation of this file.
    1"""
    +
    2This module integrates the transformers library by providing convenience utilities.
    +
    3"""
    +
    4import collections
    +
    5import typing
    +
    6
    +
    7import kbnf
    +
    8from transformers import LogitsProcessor, PreTrainedTokenizerBase, LogitsProcessorList
    +
    9
    +
    10from formatron.config import EngineGenerationConfig
    +
    11from formatron.formatter import FormatterBuilder, FormatterBase
    +
    12from formatron.integrations.utils import get_original_characters
    +
    13
    +
    14__all__ = ["create_engine_vocabulary", "create_formatter_logits_processor", "create_formatter_logits_processor_list", "FormattersLogitsProcessor"]
    +
    15
    +
    16def create_engine_vocabulary(tokenizer: PreTrainedTokenizerBase,
    +
    17 vocab_processors: typing.Optional[list[typing.Callable]] = None) -> kbnf.Vocabulary:
    +
    18 """
    +
    19 Create a vocabulary for the KBNF engine.
    +
    20 Args:
    +
    21 tokenizer: The tokenizer.
    +
    22 vocab_processors: List of callables with signature (token_to_char: typing.Dict[bytes, bytes])->None.
    +
    23 Callables can be used to "unmangle" encoded characters to original characters. If None, processors will be auto-detected.
    +
    +
    24 """
    +
    25 vocab = tokenizer.get_vocab()
    +
    26 new_vocab = get_original_characters(vocab, vocab_processors)
    +
    27 return kbnf.Vocabulary({k: kbnf.Token(v) for k, v in new_vocab.items()},
    +
    28 {v: k for k, v in vocab.items()})
    +
    29
    +
    30
    +
    31def create_formatter_logits_processor(tokenizer: PreTrainedTokenizerBase,
    +
    +
    32 formatter_builders: typing.Sequence[FormatterBuilder | None] | FormatterBuilder,
    +
    33 configs: typing.Sequence[EngineGenerationConfig] = None,
    +
    34 vocab_processors: typing.Optional[list[typing.Callable]] = None) -> LogitsProcessor:
    +
    35 """
    +
    36 Create a formatter logits processor.
    +
    37 Args:
    +
    38 tokenizer: The tokenizer.
    +
    39 formatter_builders: The formatter builders.
    +
    40 configs: The engine generation configurations.
    +
    +
    41 vocab_processors: List of callables with signature (token_to_char: typing.Dict[bytes, bytes])->None.
    +
    42 Callables can be used to "unmangle" encoded characters to original characters. If None, processors will be auto-detected.
    +
    43 """
    +
    44 vocab = create_engine_vocabulary(tokenizer, vocab_processors)
    +
    45 if not isinstance(formatter_builders, collections.abc.Sequence):
    +
    46 formatter_builders = [formatter_builders]
    +
    47 formatters = [i.build(vocab, lambda tokens: tokenizer.decode(tokens)) if i is not None else None
    +
    48 for i in formatter_builders]
    +
    49 return FormattersLogitsProcessor(formatters, tokenizer.eos_token_id, configs)
    +
    50
    +
    51
    +
    52def create_formatter_logits_processor_list(tokenizer: PreTrainedTokenizerBase,
    +
    +
    53 formatter_builders: typing.Sequence[FormatterBuilder | None] | FormatterBuilder,
    +
    54 configs: typing.Sequence[EngineGenerationConfig] = None,
    +
    55 vocab_processors: typing.Optional[list[typing.Callable]] = None) \
    +
    56 -> LogitsProcessorList:
    +
    57 """
    +
    58 Create a formatter logits processor list.
    +
    59 Args:
    +
    60 tokenizer: The tokenizer.
    +
    61 formatter_builders: The formatter builders.
    +
    +
    62 configs: The engine generation configurations.
    +
    63 vocab_processors: List of callables with signature (token_to_char: typing.Dict[bytes, bytes])->None.
    +
    64 Callables can be used to "unmangle" encoded characters to original characters. If None, processors will be auto-detected.
    +
    65 """
    +
    66 return LogitsProcessorList([create_formatter_logits_processor(tokenizer,
    +
    67 formatter_builders, configs, vocab_processors)])
    +
    68
    +
    69
    +
    70class FormattersLogitsProcessor(LogitsProcessor):
    +
    +
    71 """
    +
    72 Logit processor that uses formatters to mask batch logits.
    +
    73 """
    +
    + +
    75 def __init__(self, formatters: typing.Sequence[FormatterBase | None], eos_token_id: int,
    +
    +
    76 configs: typing.Sequence[EngineGenerationConfig] | None = None):
    +
    77 self._formatters = formatters
    +
    78 self._eos_token_id = eos_token_id
    + +
    80 if configs is None:
    +
    81 configs = [EngineGenerationConfig() for _ in formatters]
    +
    82 assert len(configs) == len(formatters), \
    +
    83 f"Number of formatters({len(formatters)}) must match number of configs({len(configs)})"
    +
    84 self.configs = configs
    + +
    86 def reset(self) -> None:
    +
    +
    + +
    88 for f in self._formatters:
    +
    89 if f is not None:
    +
    90 f.reset()
    +
    91
    +
    92 @property
    +
    +
    93 def formatters_captures(self) -> list[dict[str, typing.Any] | None]:
    +
    94 """
    +
    95 Get the captures of the formatters. Each element in the list corresponds to the
    +
    96 captures of the formatter at the same index. If the formatter is None, the element
    +
    97 is None.
    +
    98 """
    +
    99 return [f.captures if f is not None else None for f in self._formatters]
    +
    100
    +
    101 def is_completed(self) -> list[bool | None]:
    +
    102 """
    +
    103 Check if the formatters are completed. Each boolean in the list corresponds to the
    +
    104 completion status of the formatter at the same index. If the formatter is None,
    +
    105 the element is None.
    +
    +
    106 """
    +
    107 return [f.is_completed() if f is not None else None for f in self._formatters]
    +
    108
    +
    +
    109 def __call__(self, input_ids, scores):
    +
    110 assert input_ids.shape[0] == len(self._formatters), (f"Number of formatters({len(self._formatters)})"
    +
    111 f" must match batch size({input_ids.shape[0]})")
    +
    112 if self._last_input_id_length is None: # First iteration
    +
    113 self._last_input_id_length = input_ids.shape[1]
    +
    114 for formatter, config, prompt in zip(self._formatters, self.configs, input_ids):
    +
    115 if formatter is None:
    +
    +
    116 continue
    +
    117 if config.reset_at_beginning:
    +
    118 formatter.reset()
    +
    +
    +
    119 if config.read_prompt:
    +
    120 for token in prompt:
    +
    121 formatter.accept_token(token)
    +
    122 else:
    +
    123 assert input_ids.shape[1] == self._last_input_id_length + 1, ("One iteration in generation loop"
    +
    124 " must add exactly one token.")
    +
    125 self._last_input_id_length += 1
    +
    126 for formatter, input_id in zip(self._formatters, input_ids[:, -1]):
    +
    127 if formatter is not None and not formatter.is_completed():
    +
    128 formatter.accept_token(input_id)
    +
    129 for i, formatter in enumerate(self._formatters):
    +
    130 if formatter is None:
    +
    131 continue
    +
    132 if formatter.is_completed():
    +
    133 scores[i, :] = float("-inf")
    +
    134 scores[i, self._eos_token_id] = 0.0
    +
    135 continue
    +
    136 formatter.compute_allowed_tokens()
    +
    137 scores[i, :] = formatter.mask_logits(scores[i, :])
    +
    138 return scores
    +
    +
    +
    Configuration for how an KBNF engine should be used in text generation.
    Definition config.py:14
    +
    Logit processor that uses formatters to mask batch logits.
    +
    list[bool|None] is_completed(self)
    Check if the formatters are completed.
    +
    list[dict[str, typing.Any]|None] formatters_captures(self)
    Get the captures of the formatters.
    + + + + + +
    __init__(self, typing.Sequence[FormatterBase|None] formatters, int eos_token_id, typing.Sequence[EngineGenerationConfig]|None configs=None)
    + +
    Configuration classes for Formatron.
    Definition config.py:1
    +
    This module contains the Formatter class and its related classes.
    Definition formatter.py:1
    +
    LogitsProcessor create_formatter_logits_processor(PreTrainedTokenizerBase tokenizer, typing.Sequence[FormatterBuilder|None]|FormatterBuilder formatter_builders, typing.Sequence[EngineGenerationConfig] configs=None, typing.Optional[list[typing.Callable]] vocab_processors=None)
    Create a formatter logits processor.
    +
    LogitsProcessorList create_formatter_logits_processor_list(PreTrainedTokenizerBase tokenizer, typing.Sequence[FormatterBuilder|None]|FormatterBuilder formatter_builders, typing.Sequence[EngineGenerationConfig] configs=None, typing.Optional[list[typing.Callable]] vocab_processors=None)
    Create a formatter logits processor list.
    +
    kbnf.Vocabulary create_engine_vocabulary(PreTrainedTokenizerBase tokenizer, typing.Optional[list[typing.Callable]] vocab_processors=None)
    Create a vocabulary for the KBNF engine.
    + +
    +
    + + + + diff --git a/v0.4.9/utils_8py.html b/v0.4.9/utils_8py.html new file mode 100644 index 0000000..3ee3031 --- /dev/null +++ b/v0.4.9/utils_8py.html @@ -0,0 +1,176 @@ + + + + + + + + +Formatron: src/formatron/integrations/utils.py File Reference + + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Formatron v0.4.9 + + +
    +
    Formatron empowers everyone to control the output format of language models with minimal overhead.
    +
    +
    + + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    +
    +
    +
    +
    +
    Loading...
    +
    Searching...
    +
    No Matches
    +
    +
    +
    +
    + +
    + +
    utils.py File Reference
    +
    +
    + +

    Go to the source code of this file.

    + + + + + + + + + +

    +Namespaces

    namespace  formatron
     
    namespace  formatron.integrations
     This subpackage contains integrations with other frameworks and libraries.
     
    namespace  formatron.integrations.utils
     
    + + + + + + + + + + + + + + + + + + + + + +

    +Functions

    bytes formatron.integrations.utils._multiple_replace (typing.Dict[bytes, bytes] replacements, re.Pattern[bytes] regex, bytes text)
     
    typing.Dict[int, bytes] formatron.integrations.utils.get_original_characters (typing.Dict[str, int] vocab, typing.Optional[list[typing.Callable]] processors=None)
     Get a vocabulary of original characters unmangled to raw UTF-8 bytes by the provided processors.
     
    typing.List[typing.Callable] formatron.integrations.utils.autodetect_processors (typing.Dict[str, int] vocab)
     Autodetect vocabulary processors.
     
     formatron.integrations.utils.update_vocab_0xHH (typing.Dict[bytes, bytes] token_to_char)
     Vocabulary processor for <0xHH> tokens (used in llama tokenizers)
     
     formatron.integrations.utils.update_vocab_sentencepiece (typing.Dict[bytes, bytes] token_to_char)
     Vocabulary processor for ▁ token (used in sentencepiece tokenizers)
     
     formatron.integrations.utils.update_vocab_dot_G (typing.Dict[bytes, bytes] token_to_char)
     Vocabulary processor for GPT2 style token mangling, like from \n to Ġ(used in huggingface bytelevel preprocessors)
     
     formatron.integrations.utils._huggingface_bytelevel_decoder ()
     I hate legacy code.
     
    +
    +
    + + + + diff --git a/v0.4.9/utils_8py.js b/v0.4.9/utils_8py.js new file mode 100644 index 0000000..4698e3c --- /dev/null +++ b/v0.4.9/utils_8py.js @@ -0,0 +1,10 @@ +var utils_8py = +[ + [ "_huggingface_bytelevel_decoder", "utils_8py.html#a4e53f8f5754530f8fa7d627504c98f6a", null ], + [ "_multiple_replace", "utils_8py.html#a49fe0eaafb8d1f9909e2d2520c2ea657", null ], + [ "autodetect_processors", "utils_8py.html#ae2a9a65fa02be2e0d6d41b24e276cbf4", null ], + [ "get_original_characters", "utils_8py.html#a744e97099675a1aac1c24fd6a1398efd", null ], + [ "update_vocab_0xHH", "utils_8py.html#a27f1dbe46fdc2c2cf911fdb026972045", null ], + [ "update_vocab_dot_G", "utils_8py.html#a5f8874cc6515daae855acc1dbc2b94aa", null ], + [ "update_vocab_sentencepiece", "utils_8py.html#ac064c70217efb9b48e440985aee10918", null ] +]; \ No newline at end of file diff --git a/v0.4.9/utils_8py_source.html b/v0.4.9/utils_8py_source.html new file mode 100644 index 0000000..c5237fc --- /dev/null +++ b/v0.4.9/utils_8py_source.html @@ -0,0 +1,251 @@ + + + + + + + + +Formatron: src/formatron/integrations/utils.py Source File + + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Formatron v0.4.9 + + +
    +
    Formatron empowers everyone to control the output format of language models with minimal overhead.
    +
    +
    + + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    +
    +
    +
    +
    +
    Loading...
    +
    Searching...
    +
    No Matches
    +
    +
    +
    +
    + +
    +
    utils.py
    +
    +
    +Go to the documentation of this file.
    1import re
    +
    2import typing
    +
    3from functools import lru_cache
    +
    4
    +
    5__all__ = ["get_original_characters", "update_vocab_0xHH", "update_vocab_sentencepiece", "update_vocab_dot_G"]
    +
    6
    +
    +
    7def _multiple_replace(replacements: typing.Dict[bytes, bytes], regex: re.Pattern[bytes], text: bytes) -> bytes:
    +
    8 # For each match, look-up corresponding value in dictionary
    +
    9 return regex.sub(lambda mo: replacements[mo.group()], text)
    +
    10
    +
    11
    +
    +
    12def get_original_characters(vocab: typing.Dict[str, int],
    +
    13 processors: typing.Optional[list[typing.Callable]] = None) -> typing.Dict[int, bytes]:
    +
    14 """
    +
    15 Get a vocabulary of original characters unmangled to raw UTF-8 bytes by the provided processors.
    +
    16
    +
    17 Args:
    +
    18 vocab: The mangled vocabulary.
    +
    19 processors: List of callables with signature (token_to_char: typing.Dict[bytes, bytes])->None.
    +
    +
    20 Callables can be used to "unmangle" encoded characters to original characters. If None, processors will be auto-detected.
    +
    21 """
    +
    22 old_char_to_new_char = {}
    +
    23 assert len(set(vocab.values())) == len(vocab), "Vocabulary contains duplicate token IDs!"
    +
    24 if processors is None:
    +
    25 processors = autodetect_processors(vocab)
    +
    26 for update_vocab in processors:
    +
    27 update_vocab(old_char_to_new_char)
    +
    28 # Create a regular expression from the dictionary keys with longest keys first to avoid conflicts
    +
    29 regex = re.compile(b"(%s)" % b"|".join(sorted(list(map(re.escape, old_char_to_new_char.keys())), key=lambda x: len(x), reverse=True)))
    +
    30 new_vocab = {}
    +
    31 for k in vocab:
    +
    32 token_id = vocab[k]
    +
    33 new_k = _multiple_replace(old_char_to_new_char, regex, k.encode("UTF-8"))
    +
    34 new_vocab[token_id] = new_k
    +
    35 return new_vocab
    +
    36
    +
    37
    +
    +
    38def autodetect_processors(vocab: typing.Dict[str, int]) -> typing.List[typing.Callable]:
    +
    39 """
    +
    40 Autodetect vocabulary processors.
    +
    +
    41 """
    +
    42 result = []
    +
    43 llama_present = any(i.find('<0xF0>') != -1 for i in vocab.keys())
    +
    44 underscore_present = (len([1 for i in vocab.keys() if i.find('\u2581') != -1]) / len(vocab)) > 0.2
    +
    45 g_present = (len([1 for i in vocab.keys() if i.find('\u0120') != -1]) / len(vocab)) > 0.2
    +
    46 if llama_present:
    +
    47 result.append(update_vocab_0xHH)
    +
    48 if underscore_present:
    +
    49 result.append(update_vocab_sentencepiece)
    +
    50 elif g_present:
    +
    51 result.append(update_vocab_dot_G)
    +
    52 return result
    +
    53
    +
    54
    +
    +
    55def update_vocab_0xHH(token_to_char: typing.Dict[bytes, bytes]):
    +
    56 """
    +
    57 Vocabulary processor for <0xHH> tokens (used in llama tokenizers)
    +
    +
    58 """
    +
    59 for j in range(256):
    +
    60 token_to_char[("<0x" + f"{j:02x}".upper() + ">").encode("UTF-8")] = bytes([j])
    +
    61
    +
    62
    +
    +
    63def update_vocab_sentencepiece(token_to_char: typing.Dict[bytes, bytes]):
    +
    64 """
    +
    65 Vocabulary processor for ▁ token (used in sentencepiece tokenizers)
    +
    +
    66 """
    +
    67 token_to_char["\u2581".encode("UTF-8")] = b" "
    +
    68
    +
    69
    +
    +
    70def update_vocab_dot_G(token_to_char: typing.Dict[bytes, bytes]):
    +
    71 """
    +
    72 Vocabulary processor for GPT2 style token mangling, like from \\n to Ġ(used in huggingface bytelevel preprocessors)
    +
    +
    73 """
    +
    74 token_to_char.update(_huggingface_bytelevel_decoder())
    +
    75
    +
    76
    +
    77@lru_cache()
    +
    + +
    79 """
    +
    80 I hate legacy code.
    +
    81 """
    +
    82 bs = list(range(ord("!"), ord("~")+1))+list(range(ord("¡"), ord("¬")+1))+list(range(ord("®"), ord("ÿ")+1))
    +
    +
    83 cs = bs[:]
    +
    84 n = 0
    +
    85 for b in range(2**8):
    +
    86 if b not in bs:
    +
    87 bs.append(b)
    +
    88 cs.append(2**8+n)
    +
    89 n += 1
    +
    90 cs = [chr(n).encode("UTF-8") for n in cs]
    +
    91 for i in range(len(bs)):
    +
    92 bs[i] = bytes([bs[i]])
    +
    93 return dict(zip(cs, bs))
    +
    +
    update_vocab_0xHH(typing.Dict[bytes, bytes] token_to_char)
    Vocabulary processor for <0xHH> tokens (used in llama tokenizers)
    Definition utils.py:58
    +
    bytes _multiple_replace(typing.Dict[bytes, bytes] replacements, re.Pattern[bytes] regex, bytes text)
    Definition utils.py:7
    +
    _huggingface_bytelevel_decoder()
    I hate legacy code.
    Definition utils.py:83
    +
    update_vocab_dot_G(typing.Dict[bytes, bytes] token_to_char)
    Vocabulary processor for GPT2 style token mangling, like from \n to Ġ(used in huggingface bytelevel p...
    Definition utils.py:73
    +
    typing.Dict[int, bytes] get_original_characters(typing.Dict[str, int] vocab, typing.Optional[list[typing.Callable]] processors=None)
    Get a vocabulary of original characters unmangled to raw UTF-8 bytes by the provided processors.
    Definition utils.py:21
    +
    update_vocab_sentencepiece(typing.Dict[bytes, bytes] token_to_char)
    Vocabulary processor for ▁ token (used in sentencepiece tokenizers)
    Definition utils.py:66
    +
    typing.List[typing.Callable] autodetect_processors(typing.Dict[str, int] vocab)
    Autodetect vocabulary processors.
    Definition utils.py:41
    +
    +
    + + + + diff --git a/v0.4.9/vllm_8py.html b/v0.4.9/vllm_8py.html new file mode 100644 index 0000000..3c3e12f --- /dev/null +++ b/v0.4.9/vllm_8py.html @@ -0,0 +1,170 @@ + + + + + + + + +Formatron: src/formatron/integrations/vllm.py File Reference + + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Formatron v0.4.9 + + +
    +
    Formatron empowers everyone to control the output format of language models with minimal overhead.
    +
    +
    + + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    +
    +
    +
    +
    +
    Loading...
    +
    Searching...
    +
    No Matches
    +
    +
    +
    +
    + +
    + +
    vllm.py File Reference
    +
    +
    + +

    Go to the source code of this file.

    + + + + + +

    +Classes

    class  formatron.integrations.vllm.FormattersLogitsProcessor
     Logit processor that uses formatters to mask batch logits. More...
     
    + + + + + + + + + +

    +Namespaces

    namespace  formatron
     
    namespace  formatron.integrations
     This subpackage contains integrations with other frameworks and libraries.
     
    namespace  formatron.integrations.vllm
     This module integrates the vllm library by providing convenience utilities.
     
    + + + + + + + +

    +Functions

    kbnf.Vocabulary formatron.integrations.vllm.create_engine_vocabulary (AnyTokenizer tokenizer, typing.Optional[list[typing.Callable]] vocab_processors=None)
     Create a vocabulary for the KBNF engine.
     
    FormattersLogitsProcessor formatron.integrations.vllm.create_formatters_logits_processor (LLM llm, typing.Sequence[FormatterBuilder|None]|FormatterBuilder formatter_builders, typing.Sequence[EngineGenerationConfig] configs=None, typing.Optional[list[typing.Callable]] vocab_processors=None)
     Create a formatter logits processor.
     
    +
    +
    + + + + diff --git a/v0.4.9/vllm_8py.js b/v0.4.9/vllm_8py.js new file mode 100644 index 0000000..5fc6336 --- /dev/null +++ b/v0.4.9/vllm_8py.js @@ -0,0 +1,6 @@ +var vllm_8py = +[ + [ "formatron.integrations.vllm.FormattersLogitsProcessor", "classformatron_1_1integrations_1_1vllm_1_1FormattersLogitsProcessor.html", "classformatron_1_1integrations_1_1vllm_1_1FormattersLogitsProcessor" ], + [ "create_engine_vocabulary", "vllm_8py.html#a16d6196bbdb008cc80ca59b860ccfc80", null ], + [ "create_formatters_logits_processor", "vllm_8py.html#ae67ec5e8c8a65188f4720a0c921723b6", null ] +]; \ No newline at end of file diff --git a/v0.4.9/vllm_8py_source.html b/v0.4.9/vllm_8py_source.html new file mode 100644 index 0000000..7186688 --- /dev/null +++ b/v0.4.9/vllm_8py_source.html @@ -0,0 +1,308 @@ + + + + + + + + +Formatron: src/formatron/integrations/vllm.py Source File + + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Formatron v0.4.9 + + +
    +
    Formatron empowers everyone to control the output format of language models with minimal overhead.
    +
    +
    + + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    +
    +
    +
    +
    +
    Loading...
    +
    Searching...
    +
    No Matches
    +
    +
    +
    +
    + +
    +
    vllm.py
    +
    +
    +Go to the documentation of this file.
    1"""
    +
    2This module integrates the vllm library by providing convenience utilities.
    +
    3"""
    +
    4import collections.abc
    +
    5import typing
    +
    6import kbnf
    +
    7from vllm import LLM
    +
    8from formatron.config import EngineGenerationConfig
    +
    9from formatron.formatter import FormatterBase, FormatterBuilder
    +
    10from formatron.integrations.utils import get_original_characters
    +
    11from vllm.transformers_utils.tokenizer import AnyTokenizer
    +
    12
    +
    13
    + +
    15 """
    +
    16 Logit processor that uses formatters to mask batch logits.
    +
    17 """
    +
    + +
    19 def __init__(self, formatters: typing.Sequence[FormatterBase | None], eos_token_id: int,
    +
    +
    20 configs: typing.Sequence[EngineGenerationConfig] | None = None):
    +
    21 self._formatters = formatters
    +
    22 self._eos_token_id = eos_token_id
    + +
    24 if configs is None:
    +
    25 configs = [EngineGenerationConfig() for _ in formatters]
    +
    26 assert len(configs) == len(formatters), \
    +
    27 f"Number of formatters({len(formatters)}) must match number of configs({len(configs)})"
    +
    28 self._configs = configs
    +
    29 self._iter = zip(self._formatters, self._configs)
    + + +
    32 @property
    +
    +
    33 def formatters_captures(self) -> list[dict[str, typing.Any] | None]:
    +
    34 return [f.captures if f is not None else None for f in self._formatters]
    +
    35
    +
    36 def is_completed(self) -> list[bool | None]:
    +
    37 """
    +
    38 Check if the formatters are completed. Each boolean in the list corresponds to the
    +
    39 completion status of the formatter at the same index.
    +
    40 """
    +
    +
    41 return [f.is_completed() if f is not None else None for f in self._formatters]
    +
    42
    +
    43 def reset(self) -> None:
    +
    +
    44 for f in self._formatters:
    +
    45 if f is not None:
    +
    46 f.reset()
    + + +
    49
    +
    + +
    51 self._iter = zip(self._formatters, self._configs)
    +
    52 self._debug_counter = 0
    +
    +
    + +
    54 def __call__(self, prompt, generated_tokens, logits):
    +
    55 result = next(self._iter, None)
    +
    56 if result is None and len(generated_tokens) == self._last_input_id_length:
    +
    57 # We exhausted all formatters but still have sequences to process in this batch
    +
    58 raise ValueError(f"Batch size {self._debug_counter} "
    +
    59 f"is greater than number of formatters({len(self._formatters)})!")
    +
    +
    +
    60 if len(generated_tokens) == 0: # First iteration
    +
    61 self._debug_counter += 1
    +
    62 formatter, config = result
    +
    63 if formatter is None:
    +
    +
    +
    64 return logits
    +
    65 if config.reset_at_beginning and formatter.is_completed():
    +
    66 formatter.reset()
    +
    67 if config.read_prompt:
    +
    68 for token in prompt:
    +
    69 formatter.accept_token(token)
    +
    70 elif len(generated_tokens) == self._last_input_id_length + 1: # to next batch step
    +
    71 assert result is None, (f"Batch size {self._debug_counter} "
    +
    72 f"is less than number of formatters({len(self._formatters)})!")
    + +
    74 result = next(self._iter)
    +
    75 self._last_input_id_length += 1
    +
    76 formatter, _ = result
    +
    77 if formatter is None:
    +
    78 return logits
    +
    79 while formatter.is_completed():
    +
    80 if generated_tokens[-1] == self._eos_token_id:
    +
    81 return logits
    +
    82 formatter, _ = next(self._iter)
    +
    83 if formatter is None:
    +
    84 return logits
    +
    85 if len(generated_tokens) != 0: # accept new token
    +
    86 input_id = generated_tokens[-1]
    +
    87 if not formatter.is_completed():
    +
    88 formatter.accept_token(input_id)
    +
    89
    +
    90 if formatter.is_completed():
    +
    91 logits[:] = float("-inf")
    +
    92 logits[self._eos_token_id] = 1000
    +
    93 return logits
    +
    94 formatter.compute_allowed_tokens()
    +
    95 logits = formatter.mask_logits(logits)
    +
    96 return logits
    +
    97
    +
    98
    +
    99def create_engine_vocabulary(tokenizer: AnyTokenizer,
    +
    100 vocab_processors: typing.Optional[list[typing.Callable]] = None) -> kbnf.Vocabulary:
    +
    101 """
    +
    102 Create a vocabulary for the KBNF engine.
    +
    103 Args:
    +
    104 tokenizer: The tokenizer.
    +
    105 vocab_processors: List of callables with signature (token_to_char: typing.Dict[bytes, bytes])->None.
    +
    106 Callables can be used to "unmangle" encoded characters to original characters. If None, processors will be auto-detected.
    +
    107 """
    +
    108 vocab = tokenizer.get_vocab()
    +
    +
    +
    109 new_vocab = get_original_characters(vocab, vocab_processors)
    +
    110 return kbnf.Vocabulary({k: kbnf.Token(v) for k, v in new_vocab.items()}, {
    +
    111 v: k for k, v in vocab.items()})
    +
    112
    +
    113
    + +
    115 formatter_builders: typing.Sequence[FormatterBuilder | None] | FormatterBuilder,
    +
    +
    116 configs: typing.Sequence[EngineGenerationConfig] = None,
    +
    117 vocab_processors: typing.Optional[list[typing.Callable]] = None) \
    +
    118 -> FormattersLogitsProcessor:
    +
    119 """
    +
    120 Create a formatter logits processor.
    +
    121 Args:
    +
    122 llm: The LLM.
    +
    123 formatter_builders: The formatter builders.
    +
    +
    124 configs: The engine generation configurations.
    +
    125 vocab_processors: List of callables with signature (token_to_char: typing.Dict[bytes, bytes])->None.
    +
    126 Callables can be used to "unmangle" encoded characters to original characters. If None, processors will be auto-detected.
    +
    127 """
    +
    128 tokenizer = llm.get_tokenizer()
    +
    129 vocab = create_engine_vocabulary(tokenizer, vocab_processors)
    +
    130 if not isinstance(formatter_builders, collections.abc.Sequence):
    +
    131 formatter_builders = [formatter_builders]
    +
    132 formatters = [i.build(vocab, lambda tokens: tokenizer.decode(tokens)) if i is not None else None
    +
    +
    133 for i in formatter_builders]
    +
    134 return FormattersLogitsProcessor(formatters, tokenizer.eos_token_id, configs)
    +
    +
    Configuration for how an KBNF engine should be used in text generation.
    Definition config.py:14
    +
    Logit processor that uses formatters to mask batch logits.
    Definition vllm.py:18
    +
    __init__(self, typing.Sequence[FormatterBase|None] formatters, int eos_token_id, typing.Sequence[EngineGenerationConfig]|None configs=None)
    Definition vllm.py:21
    + + + + + + +
    __call__(self, prompt, generated_tokens, logits)
    Definition vllm.py:64
    +
    list[bool|None] is_completed(self)
    Check if the formatters are completed.
    Definition vllm.py:50
    + +
    list[dict[str, typing.Any]|None] formatters_captures(self)
    Definition vllm.py:41
    + +
    Configuration classes for Formatron.
    Definition config.py:1
    +
    This module contains the Formatter class and its related classes.
    Definition formatter.py:1
    + +
    kbnf.Vocabulary create_engine_vocabulary(AnyTokenizer tokenizer, typing.Optional[list[typing.Callable]] vocab_processors=None)
    Create a vocabulary for the KBNF engine.
    Definition vllm.py:117
    +
    FormattersLogitsProcessor create_formatters_logits_processor(LLM llm, typing.Sequence[FormatterBuilder|None]|FormatterBuilder formatter_builders, typing.Sequence[EngineGenerationConfig] configs=None, typing.Optional[list[typing.Callable]] vocab_processors=None)
    Create a formatter logits processor.
    Definition vllm.py:137
    +
    +
    + + + +