From 9a0e5de74c2c7c3edc75fe27693a45eea25bd732 Mon Sep 17 00:00:00 2001 From: Dan-wanna-M Date: Thu, 10 Oct 2024 03:03:36 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20Dan-wann?= =?UTF-8?q?a-M/formatron@75f7636ed8fb24f2fea35c13d0a77df2b58b1abc=20?= =?UTF-8?q?=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dev/annotated.html | 1 + dev/annotated_dup.js | 3 +- dev/classes.html | 5 +- ...n_1_1formats_1_1json_1_1JsonExtractor.html | 29 +- ...1_1schemas_1_1pydantic_1_1ClassSchema.html | 6 +- ...emas_1_1pydantic_1_1FieldInfo-members.html | 7 +- ...n_1_1schemas_1_1pydantic_1_1FieldInfo.html | 34 +- ...ron_1_1schemas_1_1pydantic_1_1FieldInfo.js | 1 + ...matron_1_1schemas_1_1schema_1_1Schema.html | 6 +- ...1_1schema_1_1TypeWithMetadata-members.html | 141 +++++ ...schemas_1_1schema_1_1TypeWithMetadata.html | 280 +++++++++ ..._1schemas_1_1schema_1_1TypeWithMetadata.js | 8 + dev/dict__inference_8py_source.html | 2 +- dev/doxygen_crawl.html | 11 + dev/formatter_8py_source.html | 2 +- dev/functions.html | 12 +- dev/functions_func.html | 8 +- dev/functions_vars.html | 4 +- dev/hierarchy.html | 13 +- dev/hierarchy.js | 1 + dev/json_8py_source.html | 591 ++++++++++-------- dev/json__schema_8py_source.html | 2 +- dev/menudata.js | 2 + ...namespaceformatron_1_1formats_1_1json.html | 2 +- ...spaceformatron_1_1schemas_1_1pydantic.html | 4 +- ...mespaceformatron_1_1schemas_1_1schema.html | 2 + ...namespaceformatron_1_1schemas_1_1schema.js | 3 +- dev/namespaces.html | 1 + dev/navtreedata.js | 3 +- dev/navtreeindex1.js | 32 +- dev/navtreeindex2.js | 15 + dev/pydantic_8py_source.html | 263 ++++---- dev/schema_8py.html | 2 + dev/schema_8py.js | 1 + dev/schema_8py_source.html | 54 +- dev/search/all_0.js | 52 +- dev/search/all_12.js | 4 +- dev/search/all_d.js | 3 +- dev/search/classes_9.js | 4 + dev/search/functions_0.js | 2 +- dev/search/functions_10.js | 2 +- dev/search/functions_11.js | 4 + dev/search/functions_b.js | 3 +- dev/search/searchdata.js | 4 +- dev/search/variables_0.js | 28 +- 45 files changed, 1132 insertions(+), 525 deletions(-) create mode 100644 dev/classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata-members.html create mode 100644 dev/classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata.html create mode 100644 dev/classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata.js create mode 100644 dev/navtreeindex2.js create mode 100644 dev/search/classes_9.js create mode 100644 dev/search/functions_11.js diff --git a/dev/annotated.html b/dev/annotated.html index c13bbf22..dae0f08e 100644 --- a/dev/annotated.html +++ b/dev/annotated.html @@ -162,6 +162,7 @@  NschemaThis module contains the Schema abstract class and FieldInfo abstract class  CFieldInfo  CSchemaAn abstract schema that describes some data + CTypeWithMetadata diff --git a/dev/annotated_dup.js b/dev/annotated_dup.js index 3f167701..218fb15d 100644 --- a/dev/annotated_dup.js +++ b/dev/annotated_dup.js @@ -52,7 +52,8 @@ var annotated_dup = ] ], [ "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" ] + [ "Schema", "classformatron_1_1schemas_1_1schema_1_1Schema.html", "classformatron_1_1schemas_1_1schema_1_1Schema" ], + [ "TypeWithMetadata", "classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata.html", "classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata" ] ] ] ] ] ] ] diff --git a/dev/classes.html b/dev/classes.html index 96df1a83..007b547f 100644 --- a/dev/classes.html +++ b/dev/classes.html @@ -121,7 +121,7 @@
Class Index
-
C | E | F | J | L | N | P | R | S
+
C | E | F | J | L | N | P | R | S | T
diff --git a/dev/classformatron_1_1formats_1_1json_1_1JsonExtractor.html b/dev/classformatron_1_1formats_1_1json_1_1JsonExtractor.html index 6abf73ad..0714a3ce 100644 --- a/dev/classformatron_1_1formats_1_1json_1_1JsonExtractor.html +++ b/dev/classformatron_1_1formats_1_1json_1_1JsonExtractor.html @@ -180,7 +180,7 @@

Detailed Description

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

-

Definition at line 252 of file json.py.

+

Definition at line 282 of file json.py.

Constructor & Destructor Documentation

◆ __init__()

@@ -221,11 +221,20 @@

- bool
- int
- float
-
- string
-
- NoneType
-
- typing.Any
+
- str
    -
  • Subclasses of collections.abc.Mapping[str,T] and typing.Mapping[str,T] where T is a supported type,
  • +
  • with min_length, max_length and pattern constraints
      +
    • length is measured in UTF-8 character number
    • +
    • 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
      - 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.
  • 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,...]
  • @@ -243,7 +252,7 @@

    formatron.extractor.NonterminalExtractor.

    -

    Definition at line 279 of file json.py.

    +

    Definition at line 317 of file json.py.

    @@ -278,7 +287,7 @@

    formatron.extractor.Extractor.

    -

    Definition at line 293 of file json.py.

    +

    Definition at line 331 of file json.py.

    @@ -299,7 +308,7 @@

    formatron.extractor.Extractor.

    -

    Definition at line 347 of file json.py.

    +

    Definition at line 385 of file json.py.

    @@ -324,7 +333,7 @@

    -

    Definition at line 283 of file json.py.

    +

    Definition at line 321 of file json.py.

    @@ -348,7 +357,7 @@

    -

    Definition at line 282 of file json.py.

    +

    Definition at line 320 of file json.py.

    diff --git a/dev/classformatron_1_1schemas_1_1pydantic_1_1ClassSchema.html b/dev/classformatron_1_1schemas_1_1pydantic_1_1ClassSchema.html index 2e41d909..9eb0910a 100644 --- a/dev/classformatron_1_1schemas_1_1pydantic_1_1ClassSchema.html +++ b/dev/classformatron_1_1schemas_1_1pydantic_1_1ClassSchema.html @@ -151,7 +151,7 @@

    Detailed Description

    A wrapper for pydantic BaseModel that implements the Schema interface.

    -

    Definition at line 63 of file pydantic.py.

    +

    Definition at line 72 of file pydantic.py.

    Member Function Documentation

    ◆ fields()

    @@ -172,7 +172,7 @@

    formatron.schemas.schema.Schema.

    -

    Definition at line 74 of file pydantic.py.

    +

    Definition at line 83 of file pydantic.py.

    @@ -199,7 +199,7 @@

    formatron.schemas.schema.Schema.

    -

    Definition at line 93 of file pydantic.py.

    +

    Definition at line 102 of file pydantic.py.

    diff --git a/dev/classformatron_1_1schemas_1_1pydantic_1_1FieldInfo-members.html b/dev/classformatron_1_1schemas_1_1pydantic_1_1FieldInfo-members.html index 5f49aeb3..44fa43e7 100644 --- a/dev/classformatron_1_1schemas_1_1pydantic_1_1FieldInfo-members.html +++ b/dev/classformatron_1_1schemas_1_1pydantic_1_1FieldInfo-members.html @@ -127,9 +127,10 @@ __init__(self, pydantic.fields.FieldInfo field)formatron.schemas.pydantic.FieldInfo __repr__(self)formatron.schemas.pydantic.FieldInfo __str__(self)formatron.schemas.pydantic.FieldInfo - _fieldformatron.schemas.pydantic.FieldInfoprotected - annotation(self)formatron.schemas.pydantic.FieldInfo - required(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/dev/classformatron_1_1schemas_1_1pydantic_1_1FieldInfo.html b/dev/classformatron_1_1schemas_1_1pydantic_1_1FieldInfo.html index f8029aa3..e9ca1225 100644 --- a/dev/classformatron_1_1schemas_1_1pydantic_1_1FieldInfo.html +++ b/dev/classformatron_1_1schemas_1_1pydantic_1_1FieldInfo.html @@ -143,6 +143,8 @@ Protected Attributes

     _field   + _annotation +  @@ -196,7 +198,7 @@

    -

    Definition at line 53 of file pydantic.py.

    +

    Definition at line 62 of file pydantic.py.

    @@ -215,7 +217,7 @@

    -

    Definition at line 56 of file pydantic.py.

    +

    Definition at line 65 of file pydantic.py.

    @@ -234,7 +236,7 @@

    -

    Definition at line 35 of file pydantic.py.

    +

    Definition at line 44 of file pydantic.py.

    @@ -253,11 +255,35 @@

    -

    Definition at line 48 of file pydantic.py.

    +

    Definition at line 57 of file pydantic.py.

    Member Data Documentation

    + +

    ◆ _annotation

    + +
    +
    +

    Properties

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

    Definition at line 26 of file pydantic.py.

    + +
    +

    ◆ _field

    diff --git a/dev/classformatron_1_1schemas_1_1pydantic_1_1FieldInfo.js b/dev/classformatron_1_1schemas_1_1pydantic_1_1FieldInfo.js index bab0fda2..3af78a1b 100644 --- a/dev/classformatron_1_1schemas_1_1pydantic_1_1FieldInfo.js +++ b/dev/classformatron_1_1schemas_1_1pydantic_1_1FieldInfo.js @@ -5,5 +5,6 @@ var classformatron_1_1schemas_1_1pydantic_1_1FieldInfo = [ "__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/dev/classformatron_1_1schemas_1_1schema_1_1Schema.html b/dev/classformatron_1_1schemas_1_1schema_1_1Schema.html index f0a67bcd..dbcd78f6 100644 --- a/dev/classformatron_1_1schemas_1_1schema_1_1Schema.html +++ b/dev/classformatron_1_1schemas_1_1schema_1_1Schema.html @@ -147,7 +147,7 @@

    Detailed Description

    An abstract schema that describes some data.

    -

    Definition at line 48 of file schema.py.

    +

    Definition at line 78 of file schema.py.

    Member Function Documentation

    ◆ fields()

    @@ -168,7 +168,7 @@

    formatron.schemas.pydantic.ClassSchema.

    -

    Definition at line 61 of file schema.py.

    +

    Definition at line 91 of file schema.py.

    @@ -195,7 +195,7 @@

    formatron.schemas.pydantic.ClassSchema.

    -

    Definition at line 78 of file schema.py.

    +

    Definition at line 108 of file schema.py.

    diff --git a/dev/classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata-members.html b/dev/classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata-members.html new file mode 100644 index 00000000..3357dfe1 --- /dev/null +++ b/dev/classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata-members.html @@ -0,0 +1,141 @@ + + + + + + + + +Formatron: Member List + + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Formatron dev + + +
    +
    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/dev/classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata.html b/dev/classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata.html new file mode 100644 index 00000000..b79127c7 --- /dev/null +++ b/dev/classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata.html @@ -0,0 +1,280 @@ + + + + + + + + +Formatron: formatron.schemas.schema.TypeWithMetadata Class Reference + + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Formatron dev + + +
    +
    Formatron empowers everyone to control the output format of language models with minimal overhead.
    +
    +
    + + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    +
    +
    +
    +
    +
    Loading...
    +
    Searching...
    +
    No Matches
    +
    +
    +
    +
    + +
    + +
    formatron.schemas.schema.TypeWithMetadata Class Reference
    +
    +
    + + + + +

    +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)
     
    dict[str, typing.Any]|None metadata (self)
     
    +

    Detailed Description

    +
    +

    Definition at line 44 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 45 of file schema.py.

    + +
    +
    +

    Member Function Documentation

    + +

    ◆ metadata()

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

    Definition at line 70 of file schema.py.

    + +
    +
    + +

    ◆ type()

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

    Definition at line 57 of file schema.py.

    + +
    +
    +

    Member Data Documentation

    + +

    ◆ _metadata

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

    Definition at line 47 of file schema.py.

    + +
    +
    + +

    ◆ _type

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

    Definition at line 46 of file schema.py.

    + +
    +
    +
    The documentation for this class was generated from the following file: +
    +
    + + + + diff --git a/dev/classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata.js b/dev/classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata.js new file mode 100644 index 00000000..856d521e --- /dev/null +++ b/dev/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/dev/dict__inference_8py_source.html b/dev/dict__inference_8py_source.html index 8bb1d490..a41d2586 100644 --- a/dev/dict__inference_8py_source.html +++ b/dev/dict__inference_8py_source.html @@ -222,7 +222,7 @@
    bool required(self)
    Check if the field is required for the schema.
    -
    An abstract schema that describes some data.
    Definition schema.py:48
    +
    An abstract schema that describes some data.
    Definition schema.py:78
    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/dev/doxygen_crawl.html b/dev/doxygen_crawl.html index 7678fc7d..8974f3c3 100644 --- a/dev/doxygen_crawl.html +++ b/dev/doxygen_crawl.html @@ -106,6 +106,8 @@ + + @@ -152,6 +154,8 @@ + + @@ -349,6 +353,7 @@ + @@ -359,6 +364,12 @@ + + + + + + diff --git a/dev/formatter_8py_source.html b/dev/formatter_8py_source.html index 209e837b..130ecf15 100644 --- a/dev/formatter_8py_source.html +++ b/dev/formatter_8py_source.html @@ -677,7 +677,7 @@
    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:252
    +
    An extractor that loads json data to an object from a string.
    Definition json.py:282
    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
    diff --git a/dev/functions.html b/dev/functions.html index 275efd4a..db0cb1f7 100644 --- a/dev/functions.html +++ b/dev/functions.html @@ -122,12 +122,12 @@

    - _ -

    • __call__() : formatron.integrations.transformers.FormattersLogitsProcessor, formatron.integrations.vllm.FormattersLogitsProcessor
    • -
    • __init__() : formatron.extractor.ChoiceExtractor, formatron.extractor.Extractor, formatron.extractor.LiteralExtractor, formatron.extractor.NonterminalExtractor, formatron.extractor.SubstringExtractor, formatron.formats.json.JsonExtractor, formatron.formats.regex.RegexExtractor, formatron.formatter.Formatter, formatron.formatter.FormatterBuilder, formatron.integrations.exllamav2.FormatterFilter, formatron.integrations.RWKV.PIPELINE, formatron.integrations.RWKV.PIPELINE_ARGS, formatron.integrations.transformers.FormattersLogitsProcessor, formatron.integrations.vllm.FormattersLogitsProcessor, formatron.schemas.dict_inference.FieldInfo, formatron.schemas.json_schema.FieldInfo, formatron.schemas.pydantic.FieldInfo
    • +
    • __init__() : formatron.extractor.ChoiceExtractor, formatron.extractor.Extractor, formatron.extractor.LiteralExtractor, formatron.extractor.NonterminalExtractor, formatron.extractor.SubstringExtractor, formatron.formats.json.JsonExtractor, formatron.formats.regex.RegexExtractor, formatron.formatter.Formatter, formatron.formatter.FormatterBuilder, formatron.integrations.exllamav2.FormatterFilter, formatron.integrations.RWKV.PIPELINE, formatron.integrations.RWKV.PIPELINE_ARGS, formatron.integrations.transformers.FormattersLogitsProcessor, formatron.integrations.vllm.FormattersLogitsProcessor, formatron.schemas.dict_inference.FieldInfo, formatron.schemas.json_schema.FieldInfo, formatron.schemas.pydantic.FieldInfo, formatron.schemas.schema.TypeWithMetadata
    • __repr__() : formatron.schemas.pydantic.FieldInfo
    • __str__() : formatron.extractor.Extractor, formatron.formatter.Formatter, formatron.schemas.pydantic.FieldInfo
    • _add_capture_name() : formatron.formatter.FormatterBuilder
    • _add_extractor() : formatron.formatter.FormatterBuilder
    • -
    • _annotation : formatron.schemas.dict_inference.FieldInfo, formatron.schemas.json_schema.FieldInfo
    • +
    • _annotation : formatron.schemas.dict_inference.FieldInfo, formatron.schemas.json_schema.FieldInfo, formatron.schemas.pydantic.FieldInfo
    • _assert_capture_name_valid() : formatron.formatter.FormatterBuilder
    • _capture_name : formatron.extractor.Extractor
    • _capture_names : formatron.formatter.FormatterBuilder
    • @@ -152,6 +152,7 @@

      - _ -

      • _last_input_id_length : formatron.integrations.transformers.FormattersLogitsProcessor, formatron.integrations.vllm.FormattersLogitsProcessor
      • _literal : formatron.extractor.LiteralExtractor
      • _main_rule : formatron.formatter.FormatterBuilder
      • +
      • _metadata : formatron.schemas.schema.TypeWithMetadata
      • _nonterminal : formatron.extractor.NonterminalExtractor
      • _nonterminal_to_extractor : formatron.formatter.FormatterBuilder
      • _obtain_accepted_output() : formatron.formatter.Formatter
      • @@ -166,6 +167,7 @@

        - _ -

        @@ -240,6 +242,7 @@

        - k -

          - m -

          @@ -270,6 +273,11 @@

          - s -

          +

          - t -

          + +

          - u -

          diff --git a/dev/functions_func.html b/dev/functions_func.html index ddf67a05..b3854914 100644 --- a/dev/functions_func.html +++ b/dev/functions_func.html @@ -122,7 +122,7 @@

          - _ -

          • __call__() : formatron.integrations.transformers.FormattersLogitsProcessor, formatron.integrations.vllm.FormattersLogitsProcessor
          • -
          • __init__() : formatron.extractor.ChoiceExtractor, formatron.extractor.Extractor, formatron.extractor.LiteralExtractor, formatron.extractor.NonterminalExtractor, formatron.extractor.SubstringExtractor, formatron.formats.json.JsonExtractor, formatron.formats.regex.RegexExtractor, formatron.formatter.Formatter, formatron.formatter.FormatterBuilder, formatron.integrations.exllamav2.FormatterFilter, formatron.integrations.RWKV.PIPELINE, formatron.integrations.RWKV.PIPELINE_ARGS, formatron.integrations.transformers.FormattersLogitsProcessor, formatron.integrations.vllm.FormattersLogitsProcessor, formatron.schemas.dict_inference.FieldInfo, formatron.schemas.json_schema.FieldInfo, formatron.schemas.pydantic.FieldInfo
          • +
          • __init__() : formatron.extractor.ChoiceExtractor, formatron.extractor.Extractor, formatron.extractor.LiteralExtractor, formatron.extractor.NonterminalExtractor, formatron.extractor.SubstringExtractor, formatron.formats.json.JsonExtractor, formatron.formats.regex.RegexExtractor, formatron.formatter.Formatter, formatron.formatter.FormatterBuilder, formatron.integrations.exllamav2.FormatterFilter, formatron.integrations.RWKV.PIPELINE, formatron.integrations.RWKV.PIPELINE_ARGS, formatron.integrations.transformers.FormattersLogitsProcessor, formatron.integrations.vllm.FormattersLogitsProcessor, formatron.schemas.dict_inference.FieldInfo, formatron.schemas.json_schema.FieldInfo, formatron.schemas.pydantic.FieldInfo, formatron.schemas.schema.TypeWithMetadata
          • __repr__() : formatron.schemas.pydantic.FieldInfo
          • __str__() : formatron.extractor.Extractor, formatron.formatter.Formatter, formatron.schemas.pydantic.FieldInfo
          • _add_capture_name() : formatron.formatter.FormatterBuilder
          • @@ -201,6 +201,7 @@

            - k -

              - m -

              @@ -229,6 +230,11 @@

              - s -

              +

              - t -

              + +

              - u -

              diff --git a/dev/functions_vars.html b/dev/functions_vars.html index e02c3552..841bc73e 100644 --- a/dev/functions_vars.html +++ b/dev/functions_vars.html @@ -121,7 +121,7 @@
              Here is a list of all variables with links to the classes they belong to:

              - _ -

                -
              • _annotation : formatron.schemas.dict_inference.FieldInfo, formatron.schemas.json_schema.FieldInfo
              • +
              • _annotation : formatron.schemas.dict_inference.FieldInfo, formatron.schemas.json_schema.FieldInfo, formatron.schemas.pydantic.FieldInfo
              • _capture_name : formatron.extractor.Extractor
              • _capture_names : formatron.formatter.FormatterBuilder
              • _captures : formatron.formatter.Formatter
              • @@ -144,6 +144,7 @@

                - _ -

                • _last_input_id_length : formatron.integrations.transformers.FormattersLogitsProcessor, formatron.integrations.vllm.FormattersLogitsProcessor
                • _literal : formatron.extractor.LiteralExtractor
                • _main_rule : formatron.formatter.FormatterBuilder
                • +
                • _metadata : formatron.schemas.schema.TypeWithMetadata
                • _nonterminal : formatron.extractor.NonterminalExtractor
                • _nonterminal_to_extractor : formatron.formatter.FormatterBuilder
                • _pass_tokens : formatron.integrations.exllamav2.FormatterFilter
                • @@ -155,6 +156,7 @@

                  - _ -

                  diff --git a/dev/hierarchy.html b/dev/hierarchy.html index 8fa1b537..66c65d6a 100644 --- a/dev/hierarchy.html +++ b/dev/hierarchy.html @@ -146,12 +146,13 @@  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 - 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 + Cformatron.schemas.schema.TypeWithMetadata + 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/dev/hierarchy.js b/dev/hierarchy.js index 7f375e2e..2303f2de 100644 --- a/dev/hierarchy.js +++ b/dev/hierarchy.js @@ -31,6 +31,7 @@ var hierarchy = [ "rwkv.utils.PIPELINE_ARGS", null, [ [ "formatron.integrations.RWKV.PIPELINE_ARGS", "classformatron_1_1integrations_1_1RWKV_1_1PIPELINE__ARGS.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 ] ] ], diff --git a/dev/json_8py_source.html b/dev/json_8py_source.html index e7e8bfdc..e624cde4 100644 --- a/dev/json_8py_source.html +++ b/dev/json_8py_source.html @@ -194,294 +194,331 @@
                  68
                  69 def field_info(current: typing.Type, nonterminal: str):
                  70 if isinstance(current, schemas.schema.FieldInfo):
                  -
                  71 if current.required:
                  -
                  72 return "", [(current.annotation, nonterminal)]
                  -
                  73 new_nonterminal = f"{nonterminal}_required"
                  -
                  74 return f"{nonterminal} ::= {new_nonterminal}?;\n", [(current.annotation, new_nonterminal)]
                  -
                  75 return None
                  -
                  76
                  -
                  77 def builtin_list(current: typing.Type, nonterminal: str):
                  -
                  78 original = typing.get_origin(current)
                  -
                  79 if original is None:
                  -
                  80 original = current
                  -
                  81 if original is typing.Sequence or isinstance(original, type) \
                  -
                  82 and issubclass(original, collections.abc.Sequence):
                  -
                  83 new_nonterminal = f"{nonterminal}_value"
                  -
                  84 annotation = typing.get_args(current)
                  -
                  85 if not annotation:
                  -
                  86 annotation = typing.Any
                  -
                  87 else:
                  -
                  88 annotation = annotation[0]
                  -
                  89 return f"{nonterminal} ::= array_begin ({new_nonterminal} (comma {new_nonterminal})*)? array_end;\n", \
                  -
                  90 [(annotation, new_nonterminal)]
                  -
                  91 return None
                  -
                  92
                  -
                  93 def builtin_dict(current: typing.Type, nonterminal: str):
                  -
                  94 original = typing.get_origin(current)
                  -
                  95 if original is None:
                  -
                  96 original = current
                  -
                  97 if original is typing.Mapping or isinstance(original, type) and issubclass(original,
                  -
                  98 collections.abc.Mapping):
                  -
                  99 new_nonterminal = f"{nonterminal}_value"
                  -
                  100 args = typing.get_args(current)
                  -
                  101 if not args:
                  -
                  102 value = typing.Any
                  -
                  103 else:
                  -
                  104 assert issubclass(
                  -
                  105 args[0], str), f"{args[0]} is not string!"
                  -
                  106 value = args[1]
                  -
                  107 return f"{nonterminal} ::=" \
                  -
                  108 f" object_begin (string colon {new_nonterminal} (comma string colon {new_nonterminal})*)?" \
                  -
                  109 f" object_end;\n", \
                  -
                  110 [(value, new_nonterminal)]
                  -
                  111 return None
                  -
                  112
                  -
                  113 def builtin_tuple(current: typing.Type, nonterminal: str):
                  -
                  114 if typing.get_origin(current) is tuple or isinstance(current, type) and issubclass(current, tuple):
                  -
                  115 args = typing.get_args(current)
                  -
                  116 new_nonterminals = []
                  -
                  117 result = []
                  -
                  118 for i, arg in enumerate(args):
                  -
                  119 result.append(arg)
                  -
                  120 new_nonterminals.append(f"{nonterminal}_{i}")
                  -
                  121 return f"{nonterminal} ::=array_begin {' comma '.join(new_nonterminals)} array_end;\n", \
                  -
                  122 zip(result, new_nonterminals)
                  -
                  123
                  -
                  124 def builtin_union(current: typing.Type, nonterminal: str):
                  -
                  125 if typing.get_origin(current) is typing.Union:
                  -
                  126 args = typing.get_args(current)
                  -
                  127 assert args, f"{current} from {nonterminal} cannot be an empty union!"
                  -
                  128 new_nonterminals = []
                  -
                  129 result = []
                  -
                  130 for i, arg in enumerate(args):
                  -
                  131 result.append(arg)
                  -
                  132 new_nonterminals.append(f"{nonterminal}_{i}")
                  -
                  133 return f"{nonterminal} ::= {' | '.join(new_nonterminals)};\n", zip(result, new_nonterminals)
                  -
                  134
                  -
                  135 def builtin_literal(current: typing.Type, nonterminal: str):
                  -
                  136 if typing.get_origin(current) is typing.Literal:
                  -
                  137 args = typing.get_args(current)
                  -
                  138 assert args, f"{current} from {nonterminal} cannot be an empty literal!"
                  -
                  139 new_items = []
                  -
                  140 result = []
                  -
                  141 for i, arg in enumerate(args):
                  -
                  142 if isinstance(arg, str):
                  -
                  143 new_items.append(f'"\\"{repr(arg)[1:-1]}\\""')
                  -
                  144 elif isinstance(arg, bool):
                  -
                  145 new_items.append(f'"{str(arg).lower()}"')
                  -
                  146 elif isinstance(arg, int):
                  -
                  147 new_items.append(f'"{str(arg)}"')
                  -
                  148 elif isinstance(arg, float):
                  -
                  149 new_items.append(f'"{str(arg)}"')
                  -
                  150 elif arg is None:
                  -
                  151 new_items.append("null")
                  -
                  152 elif isinstance(arg, tuple):
                  -
                  153 for j,item in enumerate(arg):
                  -
                  154 new_nonterminal = f"{nonterminal}_{i}_{j}"
                  -
                  155 result.append((typing.Literal[item], new_nonterminal))
                  -
                  156 new_item = f"(array_begin {' comma '.join(map(lambda x:x[1], result))} array_end)"
                  -
                  157 new_items.append(new_item)
                  -
                  158 elif isinstance(arg, frozendict):
                  -
                  159 for key, value in arg.items():
                  -
                  160 new_nonterminal = f"{nonterminal}_{i}_{key}"
                  -
                  161 result.append((typing.Literal[value], new_nonterminal))
                  -
                  162 new_item = f"object_begin {' comma '.join(map(lambda x:x[1], result))} object_end"
                  -
                  163 new_items.append(new_item)
                  -
                  164 else:
                  -
                  165 new_nonterminal = f"{nonterminal}_{i}"
                  -
                  166 result.append((arg, new_nonterminal))
                  -
                  167 new_items.append(new_nonterminal)
                  -
                  168 return f"{nonterminal} ::= {' | '.join(new_items)};\n", result
                  -
                  169
                  -
                  170 def builtin_simple_types(current: typing.Type, nonterminal: str):
                  -
                  171 if isinstance(current, type) and issubclass(current, bool):
                  -
                  172 return f"{nonterminal} ::= boolean;\n", []
                  -
                  173 elif isinstance(current, type) and issubclass(current, int):
                  -
                  174 return f"{nonterminal} ::= integer;\n", []
                  -
                  175 elif isinstance(current, type) and issubclass(current, float):
                  -
                  176 return f"{nonterminal} ::= number;\n", []
                  -
                  177 elif isinstance(current, type) and issubclass(current, decimal.Decimal):
                  -
                  178 return f"{nonterminal} ::= number;\n", []
                  -
                  179 elif isinstance(current, type) and issubclass(current, str):
                  -
                  180 return f"{nonterminal} ::= string;\n", []
                  -
                  181 elif isinstance(current, type) and issubclass(current, type(None)):
                  -
                  182 return f"{nonterminal} ::= null;\n", []
                  -
                  183 elif current is typing.Any:
                  -
                  184 return f"{nonterminal} ::= json_value;\n", []
                  -
                  185 elif isinstance(current, typing.NewType):
                  -
                  186 current: typing.NewType
                  -
                  187 return "", [(current.__supertype__, nonterminal)]
                  -
                  188
                  -
                  189 register_generate_nonterminal_def(builtin_simple_types)
                  - - - -
                  193 register_generate_nonterminal_def(builtin_literal)
                  - - - -
                  197
                  -
                  198def _generate_kbnf_grammar(schema: schemas.schema.Schema|collections.abc.Sequence, start_nonterminal: str) -> str:
                  -
                  199 """
                  -
                  200 Generate a KBNF grammar string from a schema for JSON format.
                  -
                  201
                  +
                  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 if pattern:
                  +
                  83 assert not (min_length or max_length), "pattern is mutually exclusive with min_length and max_length"
                  +
                  84 repetition = None
                  +
                  85 if min_length is not None and max_length is None:
                  +
                  86 repetition = f"{{{min_length},}}"
                  +
                  87 elif min_length is None and max_length is not None:
                  +
                  88 repetition = f"{{0,{max_length}}}"
                  +
                  89 elif min_length is not None and max_length is not None:
                  +
                  90 repetition = f"{{{min_length},{max_length}}}"
                  +
                  91 if repetition is not None:
                  +
                  92 return fr"""{nonterminal} ::= #'"([^\\\\"\u0000-\u001f]|\\\\["\\\\bfnrt/]|\\\\u[0-9A-Fa-f]{{4}}){repetition}"';
                  +
                  93""", []
                  +
                  94 if pattern is not None:
                  +
                  95 pattern = pattern.replace("'", "\\'")
                  +
                  96 return f"""{nonterminal} ::= #'"{pattern}"';\n""", []
                  +
                  97
                  +
                  98 def metadata(current: typing.Type, nonterminal: str):
                  +
                  99 if isinstance(current, schemas.schema.TypeWithMetadata):
                  +
                  100 if not current.metadata:
                  +
                  101 return "", [(current.type, nonterminal)]
                  +
                  102 if isinstance(current.type, type) and issubclass(current.type, str):
                  +
                  103 return string_metadata(current, nonterminal)
                  +
                  104 return None
                  +
                  105
                  +
                  106 def builtin_list(current: typing.Type, nonterminal: str):
                  +
                  107 original = typing.get_origin(current)
                  +
                  108 if original is None:
                  +
                  109 original = current
                  +
                  110 if original is typing.Sequence or isinstance(original, type) \
                  +
                  111 and issubclass(original, collections.abc.Sequence):
                  +
                  112 new_nonterminal = f"{nonterminal}_value"
                  +
                  113 annotation = typing.get_args(current)
                  +
                  114 if not annotation:
                  +
                  115 annotation = typing.Any
                  +
                  116 else:
                  +
                  117 annotation = annotation[0]
                  +
                  118 return f"{nonterminal} ::= array_begin ({new_nonterminal} (comma {new_nonterminal})*)? array_end;\n", \
                  +
                  119 [(annotation, new_nonterminal)]
                  +
                  120 return None
                  +
                  121
                  +
                  122 def builtin_dict(current: typing.Type, nonterminal: str):
                  +
                  123 original = typing.get_origin(current)
                  +
                  124 if original is None:
                  +
                  125 original = current
                  +
                  126 if original is typing.Mapping or isinstance(original, type) and issubclass(original,
                  +
                  127 collections.abc.Mapping):
                  +
                  128 new_nonterminal = f"{nonterminal}_value"
                  +
                  129 args = typing.get_args(current)
                  +
                  130 if not args:
                  +
                  131 value = typing.Any
                  +
                  132 else:
                  +
                  133 assert issubclass(
                  +
                  134 args[0], str), f"{args[0]} is not string!"
                  +
                  135 value = args[1]
                  +
                  136 return f"{nonterminal} ::=" \
                  +
                  137 f" object_begin (string colon {new_nonterminal} (comma string colon {new_nonterminal})*)?" \
                  +
                  138 f" object_end;\n", \
                  +
                  139 [(value, new_nonterminal)]
                  +
                  140 return None
                  +
                  141
                  +
                  142 def builtin_tuple(current: typing.Type, nonterminal: str):
                  +
                  143 if typing.get_origin(current) is tuple or isinstance(current, type) and issubclass(current, tuple):
                  +
                  144 args = typing.get_args(current)
                  +
                  145 new_nonterminals = []
                  +
                  146 result = []
                  +
                  147 for i, arg in enumerate(args):
                  +
                  148 result.append(arg)
                  +
                  149 new_nonterminals.append(f"{nonterminal}_{i}")
                  +
                  150 return f"{nonterminal} ::=array_begin {' comma '.join(new_nonterminals)} array_end;\n", \
                  +
                  151 zip(result, new_nonterminals)
                  +
                  152
                  +
                  153 def builtin_union(current: typing.Type, nonterminal: str):
                  +
                  154 if typing.get_origin(current) is typing.Union:
                  +
                  155 args = typing.get_args(current)
                  +
                  156 assert args, f"{current} from {nonterminal} cannot be an empty union!"
                  +
                  157 new_nonterminals = []
                  +
                  158 result = []
                  +
                  159 for i, arg in enumerate(args):
                  +
                  160 result.append(arg)
                  +
                  161 new_nonterminals.append(f"{nonterminal}_{i}")
                  +
                  162 return f"{nonterminal} ::= {' | '.join(new_nonterminals)};\n", zip(result, new_nonterminals)
                  +
                  163
                  +
                  164 def builtin_literal(current: typing.Type, nonterminal: str):
                  +
                  165 if typing.get_origin(current) is typing.Literal:
                  +
                  166 args = typing.get_args(current)
                  +
                  167 assert args, f"{current} from {nonterminal} cannot be an empty literal!"
                  +
                  168 new_items = []
                  +
                  169 result = []
                  +
                  170 for i, arg in enumerate(args):
                  +
                  171 if isinstance(arg, str):
                  +
                  172 new_items.append(f'"\\"{repr(arg)[1:-1]}\\""')
                  +
                  173 elif isinstance(arg, bool):
                  +
                  174 new_items.append(f'"{str(arg).lower()}"')
                  +
                  175 elif isinstance(arg, int):
                  +
                  176 new_items.append(f'"{str(arg)}"')
                  +
                  177 elif isinstance(arg, float):
                  +
                  178 new_items.append(f'"{str(arg)}"')
                  +
                  179 elif arg is None:
                  +
                  180 new_items.append("null")
                  +
                  181 elif isinstance(arg, tuple):
                  +
                  182 for j,item in enumerate(arg):
                  +
                  183 new_nonterminal = f"{nonterminal}_{i}_{j}"
                  +
                  184 result.append((typing.Literal[item], new_nonterminal))
                  +
                  185 new_item = f"(array_begin {' comma '.join(map(lambda x:x[1], result))} array_end)"
                  +
                  186 new_items.append(new_item)
                  +
                  187 elif isinstance(arg, frozendict):
                  +
                  188 for key, value in arg.items():
                  +
                  189 new_nonterminal = f"{nonterminal}_{i}_{key}"
                  +
                  190 result.append((typing.Literal[value], new_nonterminal))
                  +
                  191 new_item = f"object_begin {' comma '.join(map(lambda x:x[1], result))} object_end"
                  +
                  192 new_items.append(new_item)
                  +
                  193 else:
                  +
                  194 new_nonterminal = f"{nonterminal}_{i}"
                  +
                  195 result.append((arg, new_nonterminal))
                  +
                  196 new_items.append(new_nonterminal)
                  +
                  197 return f"{nonterminal} ::= {' | '.join(new_items)};\n", result
                  +
                  198
                  +
                  199 def builtin_simple_types(current: typing.Type, nonterminal: str):
                  +
                  200 if isinstance(current, type) and issubclass(current, bool):
                  +
                  201 return f"{nonterminal} ::= boolean;\n", []
                  +
                  202 elif isinstance(current, type) and issubclass(current, int):
                  +
                  203 return f"{nonterminal} ::= integer;\n", []
                  +
                  204 elif isinstance(current, type) and issubclass(current, float):
                  +
                  205 return f"{nonterminal} ::= number;\n", []
                  +
                  206 elif isinstance(current, type) and issubclass(current, decimal.Decimal):
                  +
                  207 return f"{nonterminal} ::= number;\n", []
                  +
                  208 elif isinstance(current, type) and issubclass(current, str):
                  +
                  209 return f"{nonterminal} ::= string;\n", []
                  +
                  210 elif isinstance(current, type) and issubclass(current, type(None)):
                  +
                  211 return f"{nonterminal} ::= null;\n", []
                  +
                  212 elif current is typing.Any:
                  +
                  213 return f"{nonterminal} ::= json_value;\n", []
                  +
                  214 elif isinstance(current, typing.NewType):
                  +
                  215 current: typing.NewType
                  +
                  216 return "", [(current.__supertype__, nonterminal)]
                  +
                  217
                  +
                  218 register_generate_nonterminal_def(builtin_simple_types)
                  + + + + +
                  223 register_generate_nonterminal_def(builtin_literal)
                  + + + +
                  227
                  +
                  228def _generate_kbnf_grammar(schema: schemas.schema.Schema|collections.abc.Sequence, start_nonterminal: str) -> str:
                  +
                  229 """
                  +
                  230 Generate a KBNF grammar string from a schema for JSON format.
                  +
                  231
                  -
                  202 Args:
                  -
                  203 schema: The schema to generate a grammar for.
                  -
                  204 start_nonterminal: The start nonterminal of the grammar. Default is "start".
                  -
                  205
                  -
                  206 Returns:
                  -
                  207 The generated KBNF grammar string.
                  -
                  208 """
                  -
                  209 type_id_to_nonterminal = {
                  -
                  210 id(int): "integer",
                  -
                  211 id(float): "number",
                  -
                  212 id(str): "string",
                  -
                  213 id(bool): "boolean",
                  -
                  -
                  214 id(type(None)): "null",
                  -
                  215 id(list): "array",
                  -
                  216 id(dict): "object",
                  -
                  217 }
                  -
                  218 result = [GRAMMAR_HEADER]
                  -
                  219 nonterminals = set()
                  -
                  220 stack = [(schema, start_nonterminal)]
                  -
                  221 while stack:
                  -
                  222 (current, nonterminal) = stack.pop()
                  -
                  223 type_id = id(current)
                  -
                  224 if type_id in type_id_to_nonterminal:
                  -
                  225 line = f"{nonterminal} ::= {type_id_to_nonterminal[type_id]};\n"
                  -
                  226 result.append(line)
                  -
                  227 continue
                  -
                  228 type_id_to_nonterminal[type_id] = nonterminal
                  -
                  229 for i in _type_to_nonterminals:
                  -
                  230 value = i(current, nonterminal)
                  -
                  231 if value is not None:
                  -
                  232 line, to_stack = value
                  -
                  233 result.append(line)
                  -
                  234 stack.extend(to_stack)
                  -
                  235 nonterminals.add(nonterminal)
                  -
                  236 break
                  -
                  237 else:
                  -
                  238 raise TypeError(
                  -
                  239 f"{current} from {nonterminal} is not supported in json_generators!")
                  -
                  240 return "".join(result)
                  -
                  241
                  -
                  242
                  - -
                  244 """
                  -
                  245 An extractor that loads json data to an object from a string.
                  -
                  246 """
                  -
                  247
                  -
                  248 def __init__(self, nonterminal: str, capture_name: typing.Optional[str], schema: schemas.schema.Schema|collections.abc.Sequence,
                  +
                  232 Args:
                  +
                  233 schema: The schema to generate a grammar for.
                  +
                  234 start_nonterminal: The start nonterminal of the grammar. Default is "start".
                  +
                  235
                  +
                  236 Returns:
                  +
                  237 The generated KBNF grammar string.
                  +
                  238 """
                  +
                  239 type_id_to_nonterminal = {
                  +
                  240 id(int): "integer",
                  +
                  241 id(float): "number",
                  +
                  242 id(str): "string",
                  +
                  243 id(bool): "boolean",
                  +
                  +
                  244 id(type(None)): "null",
                  +
                  245 id(list): "array",
                  +
                  246 id(dict): "object",
                  +
                  247 }
                  +
                  248 result = [GRAMMAR_HEADER]
                  +
                  249 nonterminals = set()
                  +
                  250 stack = [(schema, start_nonterminal)]
                  +
                  251 while stack:
                  +
                  252 (current, nonterminal) = stack.pop()
                  +
                  253 type_id = id(current)
                  +
                  254 if type_id in type_id_to_nonterminal:
                  +
                  255 line = f"{nonterminal} ::= {type_id_to_nonterminal[type_id]};\n"
                  +
                  256 result.append(line)
                  +
                  257 continue
                  +
                  258 type_id_to_nonterminal[type_id] = nonterminal
                  +
                  259 for i in _type_to_nonterminals:
                  +
                  260 value = i(current, nonterminal)
                  +
                  261 if value is not None:
                  +
                  262 line, to_stack = value
                  +
                  263 result.append(line)
                  +
                  264 stack.extend(to_stack)
                  +
                  265 nonterminals.add(nonterminal)
                  +
                  266 break
                  +
                  267 else:
                  +
                  268 raise TypeError(
                  +
                  269 f"{current} from {nonterminal} is not supported in json_generators!")
                  +
                  270 return "".join(result)
                  +
                  271
                  +
                  272
                  + +
                  274 """
                  +
                  275 An extractor that loads json data to an object from a string.
                  +
                  276 """
                  +
                  277
                  +
                  278 def __init__(self, nonterminal: str, capture_name: typing.Optional[str], schema: schemas.schema.Schema|collections.abc.Sequence,
                  -
                  249 to_object: typing.Callable[[str], schemas.schema.Schema]):
                  -
                  250 """
                  -
                  251 Create a json extractor from a given schema or a list of supported types.
                  -
                  - -
                  253 Currently, the following data types are supported:
                  -
                  254
                  -
                  255 - bool
                  -
                  256 - int
                  -
                  257 - float
                  -
                  258 - string
                  -
                  259 - NoneType
                  -
                  260 - typing.Any
                  -
                  261 - Subclasses of collections.abc.Mapping[str,T] and typing.Mapping[str,T] where T is a supported type,
                  -
                  262 - Subclasses of collections.abc.Sequence[T] and typing.Sequence[T] where T is a supported type.
                  -
                  263 - tuple[T1,T2,...] where T1,T2,... are supported types. The order, type and number of elements will be preserved.
                  -
                  264 - typing.Literal[x1,x2,...] where x1, x2, ... are instances of int, string, bool or NoneType, or another typing.Literal[y1,y2,...]
                  -
                  265 - typing.Union[T1,T2,...] where T1,T2,... are supported types.
                  -
                  266 - schemas.Schema where all its fields' data types are supported. Recursive schema definitions are supported as well.
                  -
                  267
                  -
                  268 Args:
                  -
                  269 nonterminal: The nonterminal representing the extractor.
                  -
                  270 capture_name: The capture name of the extractor, or `None` if the extractor does not capture.
                  -
                  271 to_object: A callable to convert the extracted string to a schema instance.
                  -
                  272 """
                  -
                  273 super().__init__(nonterminal, capture_name)
                  -
                  274 self._to_object = to_object
                  -
                  275 self._rule_str = _generate_kbnf_grammar(schema, self.nonterminal)
                  -
                  276 def extract(self, input_str: str) -> typing.Optional[tuple[str, schemas.schema.Schema]]:
                  -
                  277 """
                  -
                  278 Extract a schema instance from a string.
                  -
                  - -
                  280 Args:
                  -
                  281 input_str: The input string to extract from.
                  - -
                  283 Returns:
                  +
                  279 to_object: typing.Callable[[str], schemas.schema.Schema]):
                  +
                  280 """
                  +
                  281 Create a json extractor from a given schema or a list of supported types.
                  +
                  + +
                  283 Currently, the following data types are supported:
                  +
                  284
                  +
                  285 - bool
                  +
                  286 - int
                  +
                  287 - float
                  +
                  288 - str
                  +
                  289 - with min_length, max_length and pattern constraints
                  +
                  290 - length is measured in UTF-8 character number
                  +
                  291 - *Warning*: too large difference between min_length and max_length can lead to enormous memory consumption!
                  +
                  292 - pattern is mutually exclusive with min_length and max_length
                  +
                  293 - pattern will be compiled to a regular expression so all caveats of regular expressions apply
                  +
                  294 - pattern currently is automatically anchored at both ends
                  +
                  295 - NoneType
                  +
                  296 - typing.Any
                  +
                  297 - Subclasses of collections.abc.Mapping[str,T] and typing.Mapping[str,T] where T is a supported type,
                  +
                  298 - Subclasses of collections.abc.Sequence[T] and typing.Sequence[T] where T is a supported type.
                  +
                  299 - tuple[T1,T2,...] where T1,T2,... are supported types. The order, type and number of elements will be preserved.
                  +
                  300 - typing.Literal[x1,x2,...] where x1, x2, ... are instances of int, string, bool or NoneType, or another typing.Literal[y1,y2,...]
                  +
                  301 - typing.Union[T1,T2,...] where T1,T2,... are supported types.
                  +
                  302 - schemas.Schema where all its fields' data types are supported. Recursive schema definitions are supported as well.
                  +
                  303
                  +
                  304 Args:
                  +
                  305 nonterminal: The nonterminal representing the extractor.
                  +
                  306 capture_name: The capture name of the extractor, or `None` if the extractor does not capture.
                  +
                  307 to_object: A callable to convert the extracted string to a schema instance.
                  +
                  308 """
                  +
                  309 super().__init__(nonterminal, capture_name)
                  +
                  310 self._to_object = to_object
                  +
                  311 self._rule_str = _generate_kbnf_grammar(schema, self.nonterminal)
                  +
                  312 def extract(self, input_str: str) -> typing.Optional[tuple[str, schemas.schema.Schema]]:
                  +
                  313 """
                  +
                  314 Extract a schema instance from a string.
                  +
                  315
                  +
                  316 Args:
                  +
                  +
                  317 input_str: The input string to extract from.
                  +
                  318
                  +
                  319 Returns:
                  +
                  320 A tuple of the remaining string and the extracted schema instance, or `None` if extraction failed.
                  +
                  321 """
                  -
                  284 A tuple of the remaining string and the extracted schema instance, or `None` if extraction failed.
                  -
                  285 """
                  -
                  286
                  -
                  287 # Ensure the input string starts with '{' or '[' after stripping leading whitespace
                  -
                  288 input_str = input_str.lstrip()
                  -
                  289 if not input_str.startswith(('{', '[')):
                  -
                  290 return None
                  -
                  291
                  -
                  292 # Variables to track the balance of brackets and the position in the string
                  -
                  -
                  293 bracket_count = 0
                  -
                  294 position = 0
                  -
                  295 in_string = False
                  -
                  296 escape_next = False
                  -
                  297 start_char = input_str[0]
                  -
                  298 end_char = '}' if start_char == '{' else ']'
                  -
                  299
                  -
                  300 # Iterate over the string to find where the JSON object or array ends
                  -
                  301 for char in input_str:
                  -
                  302 if not in_string:
                  -
                  303 if char == start_char:
                  -
                  304 bracket_count += 1
                  -
                  305 elif char == end_char:
                  -
                  306 bracket_count -= 1
                  -
                  307 elif char == '"':
                  -
                  308 in_string = True
                  -
                  309 else:
                  -
                  310 if char == '"' and not escape_next:
                  -
                  311 in_string = False
                  -
                  312 elif char == '\\':
                  -
                  313 escape_next = not escape_next
                  -
                  314 else:
                  -
                  315 escape_next = False
                  -
                  316
                  -
                  317 # Move to the next character
                  -
                  318 position += 1
                  -
                  319
                  -
                  320 # If brackets are balanced and we're not in a string, stop processing
                  -
                  321 if bracket_count == 0 and not in_string:
                  -
                  322 break
                  -
                  323 else:
                  -
                  324 return None
                  -
                  325 # The position now points to the character after the last '}', so we slice to position
                  -
                  326 json_str = input_str[:position]
                  -
                  327 remaining_str = input_str[position:]
                  -
                  328 # Return the unparsed remainder of the string and the decoded JSON object
                  -
                  329 return remaining_str, self._to_object(json_str)
                  -
                  330
                  -
                  331 @property
                  -
                  332 def kbnf_definition(self):
                  -
                  333 return self._rule_str
                  -
                  334
                  +
                  322
                  +
                  323 # Ensure the input string starts with '{' or '[' after stripping leading whitespace
                  +
                  324 input_str = input_str.lstrip()
                  +
                  325 if not input_str.startswith(('{', '[')):
                  +
                  326 return None
                  +
                  327
                  +
                  328 # Variables to track the balance of brackets and the position in the string
                  +
                  329 bracket_count = 0
                  +
                  330 position = 0
                  +
                  +
                  331 in_string = False
                  +
                  332 escape_next = False
                  +
                  333 start_char = input_str[0]
                  +
                  334 end_char = '}' if start_char == '{' else ']'
                  335
                  - +
                  336 # Iterate over the string to find where the JSON object or array ends
                  +
                  337 for char in input_str:
                  +
                  338 if not in_string:
                  +
                  339 if char == start_char:
                  +
                  340 bracket_count += 1
                  +
                  341 elif char == end_char:
                  +
                  342 bracket_count -= 1
                  +
                  343 elif char == '"':
                  +
                  344 in_string = True
                  +
                  345 else:
                  +
                  346 if char == '"' and not escape_next:
                  +
                  347 in_string = False
                  +
                  348 elif char == '\\':
                  +
                  349 escape_next = not escape_next
                  +
                  350 else:
                  +
                  351 escape_next = False
                  +
                  352
                  +
                  353 # Move to the next character
                  +
                  354 position += 1
                  +
                  355
                  +
                  356 # If brackets are balanced and we're not in a string, stop processing
                  +
                  357 if bracket_count == 0 and not in_string:
                  +
                  358 break
                  +
                  359 else:
                  +
                  360 return None
                  +
                  361 # The position now points to the character after the last '}', so we slice to position
                  +
                  362 json_str = input_str[:position]
                  +
                  363 remaining_str = input_str[position:]
                  +
                  364 # Return the unparsed remainder of the string and the decoded JSON object
                  +
                  365 return remaining_str, self._to_object(json_str)
                  +
                  366
                  +
                  367 @property
                  +
                  368 def kbnf_definition(self):
                  +
                  369 return self._rule_str
                  +
                  370
                  +
                  371
                  +
                  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:252
                  - -
                  typing.Optional[tuple[str, schemas.schema.Schema]] extract(self, str input_str)
                  Extract a schema instance from a string.
                  Definition json.py:293
                  -
                  __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:280
                  - - +
                  An extractor that loads json data to an object from a string.
                  Definition json.py:282
                  + +
                  typing.Optional[tuple[str, schemas.schema.Schema]] extract(self, str input_str)
                  Extract a schema instance from a string.
                  Definition json.py:331
                  +
                  __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:318
                  + + -
                  An abstract schema that describes some data.
                  Definition schema.py:48
                  +
                  An abstract schema that describes some data.
                  Definition schema.py:78
                  +
                  _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:214
                  +
                  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:244
                  diff --git a/dev/json__schema_8py_source.html b/dev/json__schema_8py_source.html index 1f33805e..566c2365 100644 --- a/dev/json__schema_8py_source.html +++ b/dev/json__schema_8py_source.html @@ -465,7 +465,7 @@
                  __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 schema that describes some data.
                  Definition schema.py:48
                  +
                  An abstract schema that describes some data.
                  Definition schema.py:78
                  typing.Any _get_literal(dict[str, typing.Any] schema)
                  _resolve_reference(dict[str, typing.Any] schema, str key, typing.Any resolver)
                  typing.Type _create_custom_type(typing.Type|None obtained_type, dict[str, typing.Any] schema, dict[int, typing.Type] json_schema_id_to_schema)
                  diff --git a/dev/menudata.js b/dev/menudata.js index 6a417862..f8444aad 100644 --- a/dev/menudata.js +++ b/dev/menudata.js @@ -65,6 +65,7 @@ var menudata={children:[ {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"}, @@ -82,6 +83,7 @@ var menudata={children:[ {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"}, diff --git a/dev/namespaceformatron_1_1formats_1_1json.html b/dev/namespaceformatron_1_1formats_1_1json.html index 38450d28..9858974d 100644 --- a/dev/namespaceformatron_1_1formats_1_1json.html +++ b/dev/namespaceformatron_1_1formats_1_1json.html @@ -195,7 +195,7 @@

                  Returns
                  The generated KBNF grammar string.
                  -

                  Definition at line 214 of file json.py.

                  +

                  Definition at line 244 of file json.py.

                  diff --git a/dev/namespaceformatron_1_1schemas_1_1pydantic.html b/dev/namespaceformatron_1_1schemas_1_1pydantic.html index 6a6f9200..2c909bb4 100644 --- a/dev/namespaceformatron_1_1schemas_1_1pydantic.html +++ b/dev/namespaceformatron_1_1schemas_1_1pydantic.html @@ -193,7 +193,7 @@

                  Returns
                  The decorated callable.
                  -

                  Definition at line 113 of file pydantic.py.

                  +

                  Definition at line 122 of file pydantic.py.

                  @@ -210,7 +210,7 @@

                  -

                  Definition at line 99 of file pydantic.py.

                  +

                  Definition at line 108 of file pydantic.py.

                  diff --git a/dev/namespaceformatron_1_1schemas_1_1schema.html b/dev/namespaceformatron_1_1schemas_1_1schema.html index c614fc2b..78ba2977 100644 --- a/dev/namespaceformatron_1_1schemas_1_1schema.html +++ b/dev/namespaceformatron_1_1schemas_1_1schema.html @@ -134,6 +134,8 @@ class  Schema  An abstract schema that describes some data. More...
                    +class  TypeWithMetadata

                  Detailed Description

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

                  diff --git a/dev/namespaceformatron_1_1schemas_1_1schema.js b/dev/namespaceformatron_1_1schemas_1_1schema.js index 6bebbf05..d4863766 100644 --- a/dev/namespaceformatron_1_1schemas_1_1schema.js +++ b/dev/namespaceformatron_1_1schemas_1_1schema.js @@ -1,5 +1,6 @@ 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" ] + [ "Schema", "classformatron_1_1schemas_1_1schema_1_1Schema.html", "classformatron_1_1schemas_1_1schema_1_1Schema" ], + [ "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/dev/namespaces.html b/dev/namespaces.html index 5ecaea18..c22b71bc 100644 --- a/dev/namespaces.html +++ b/dev/namespaces.html @@ -163,6 +163,7 @@  NschemaThis module contains the Schema abstract class and FieldInfo abstract class  CFieldInfo  CSchemaAn abstract schema that describes some data + CTypeWithMetadata
                  diff --git a/dev/navtreedata.js b/dev/navtreedata.js index ae19f29c..5a0f1895 100644 --- a/dev/navtreedata.js +++ b/dev/navtreedata.js @@ -52,7 +52,8 @@ var NAVTREE = var NAVTREEINDEX = [ "RWKV_8py.html", -"classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#ac6f22aff80d80035bdd2118feff9f965" +"classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#ac6f22aff80d80035bdd2118feff9f965", +"schema_8py_source.html" ]; var SYNCONMSG = 'click to disable panel synchronisation'; diff --git a/dev/navtreeindex1.js b/dev/navtreeindex1.js index 124a9cf4..29cd8166 100644 --- a/dev/navtreeindex1.js +++ b/dev/navtreeindex1.js @@ -92,8 +92,10 @@ var NAVTREEINDEX1 = "classformatron_1_1schemas_1_1pydantic_1_1FieldInfo.html#a49ac1734cddfadc1b7721f57775890a6":[1,0,0,5,2,1,2], "classformatron_1_1schemas_1_1pydantic_1_1FieldInfo.html#a4a5a010c6acef15f8fe2d4318223696b":[0,0,0,5,2,1,0], "classformatron_1_1schemas_1_1pydantic_1_1FieldInfo.html#a4a5a010c6acef15f8fe2d4318223696b":[1,0,0,5,2,1,0], -"classformatron_1_1schemas_1_1pydantic_1_1FieldInfo.html#abb92e2d49fec513432cced795bd853e2":[0,0,0,5,2,1,5], -"classformatron_1_1schemas_1_1pydantic_1_1FieldInfo.html#abb92e2d49fec513432cced795bd853e2":[1,0,0,5,2,1,5], +"classformatron_1_1schemas_1_1pydantic_1_1FieldInfo.html#aab00d20e817e3ea9fc15295a94e8242b":[0,0,0,5,2,1,5], +"classformatron_1_1schemas_1_1pydantic_1_1FieldInfo.html#aab00d20e817e3ea9fc15295a94e8242b":[1,0,0,5,2,1,5], +"classformatron_1_1schemas_1_1pydantic_1_1FieldInfo.html#abb92e2d49fec513432cced795bd853e2":[0,0,0,5,2,1,6], +"classformatron_1_1schemas_1_1pydantic_1_1FieldInfo.html#abb92e2d49fec513432cced795bd853e2":[1,0,0,5,2,1,6], "classformatron_1_1schemas_1_1pydantic_1_1FieldInfo.html#ac9e5af7e4cb356a450e9e48f3af24cfe":[0,0,0,5,2,1,3], "classformatron_1_1schemas_1_1pydantic_1_1FieldInfo.html#ac9e5af7e4cb356a450e9e48f3af24cfe":[1,0,0,5,2,1,3], "classformatron_1_1schemas_1_1pydantic_1_1FieldInfo.html#ad291e8df78d045d3364bc6a17582b416":[0,0,0,5,2,1,1], @@ -112,6 +114,18 @@ var NAVTREEINDEX1 = "classformatron_1_1schemas_1_1schema_1_1Schema.html#a8c45239aaa45574add14fa72fbdf16dc":[1,0,0,5,3,1,1], "classformatron_1_1schemas_1_1schema_1_1Schema.html#a98d77a5645545d440b91126926d1aeb8":[0,0,0,5,3,1,0], "classformatron_1_1schemas_1_1schema_1_1Schema.html#a98d77a5645545d440b91126926d1aeb8":[1,0,0,5,3,1,0], +"classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata.html":[0,0,0,5,3,2], +"classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata.html":[1,0,0,5,3,2], +"classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata.html#a0c3cf51ceb503d4d195f5623d57e160b":[0,0,0,5,3,2,0], +"classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata.html#a0c3cf51ceb503d4d195f5623d57e160b":[1,0,0,5,3,2,0], +"classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata.html#a34312895f9d497d5c35cf372f9c498f3":[0,0,0,5,3,2,3], +"classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata.html#a34312895f9d497d5c35cf372f9c498f3":[1,0,0,5,3,2,3], +"classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata.html#a4d1ea7d59f700634eb2545ce3d6cf324":[0,0,0,5,3,2,4], +"classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata.html#a4d1ea7d59f700634eb2545ce3d6cf324":[1,0,0,5,3,2,4], +"classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata.html#ada7a24496aad9979411523441c53a6cf":[0,0,0,5,3,2,2], +"classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata.html#ada7a24496aad9979411523441c53a6cf":[1,0,0,5,3,2,2], +"classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata.html#af8604b758b8af6878a130a4f0f28389b":[0,0,0,5,3,2,1], +"classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata.html#af8604b758b8af6878a130a4f0f28389b":[1,0,0,5,3,2,1], "config_8py.html":[2,0,0,0,4], "config_8py_source.html":[2,0,0,0,4], "dict__inference_8py.html":[2,0,0,0,2,1], @@ -235,17 +249,5 @@ var NAVTREEINDEX1 = "pydantic_8py_source.html":[2,0,0,0,2,3], "regex_8py.html":[2,0,0,0,0,2], "regex_8py_source.html":[2,0,0,0,0,2], -"schema_8py.html":[2,0,0,0,2,4], -"schema_8py_source.html":[2,0,0,0,2,4], -"schemas_2____init_____8py.html":[2,0,0,0,2,0], -"schemas_2____init_____8py_source.html":[2,0,0,0,2,0], -"transformers_8py.html":[2,0,0,0,1,4], -"transformers_8py.html#a1e2bb52e2c35fb3592fbc9fcff06f41a":[2,0,0,0,1,4,1], -"transformers_8py.html#a4036de8ad72188b3558f8e5a0fd289f4":[2,0,0,0,1,4,3], -"transformers_8py.html#af8d1673116b56d3651e2e79934356a01":[2,0,0,0,1,4,2], -"transformers_8py_source.html":[2,0,0,0,1,4], -"vllm_8py.html":[2,0,0,0,1,5], -"vllm_8py.html#a995ec0f6519cf5b67bcc52d411653a26":[2,0,0,0,1,5,2], -"vllm_8py.html#acec47a067c2396265f1d7a941b0a7ab3":[2,0,0,0,1,5,1], -"vllm_8py_source.html":[2,0,0,0,1,5] +"schema_8py.html":[2,0,0,0,2,4] }; diff --git a/dev/navtreeindex2.js b/dev/navtreeindex2.js new file mode 100644 index 00000000..03cfa0a8 --- /dev/null +++ b/dev/navtreeindex2.js @@ -0,0 +1,15 @@ +var NAVTREEINDEX2 = +{ +"schema_8py_source.html":[2,0,0,0,2,4], +"schemas_2____init_____8py.html":[2,0,0,0,2,0], +"schemas_2____init_____8py_source.html":[2,0,0,0,2,0], +"transformers_8py.html":[2,0,0,0,1,4], +"transformers_8py.html#a1e2bb52e2c35fb3592fbc9fcff06f41a":[2,0,0,0,1,4,1], +"transformers_8py.html#a4036de8ad72188b3558f8e5a0fd289f4":[2,0,0,0,1,4,3], +"transformers_8py.html#af8d1673116b56d3651e2e79934356a01":[2,0,0,0,1,4,2], +"transformers_8py_source.html":[2,0,0,0,1,4], +"vllm_8py.html":[2,0,0,0,1,5], +"vllm_8py.html#a995ec0f6519cf5b67bcc52d411653a26":[2,0,0,0,1,5,2], +"vllm_8py.html#acec47a067c2396265f1d7a941b0a7ab3":[2,0,0,0,1,5,1], +"vllm_8py_source.html":[2,0,0,0,1,5] +}; diff --git a/dev/pydantic_8py_source.html b/dev/pydantic_8py_source.html index 7804bb3a..a595264b 100644 --- a/dev/pydantic_8py_source.html +++ b/dev/pydantic_8py_source.html @@ -131,7 +131,7 @@
                  8import pydantic.fields
                  9from pydantic import BaseModel, validate_call, ConfigDict, Field
                  10
                  -
                  11from formatron.schemas.schema import FieldInfo, Schema
                  +
                  11from formatron.schemas.schema import FieldInfo, Schema, TypeWithMetadata
                  12
                  13
                  14class FieldInfo(FieldInfo):
                  @@ -147,144 +147,155 @@
                  23 """
                  24 self._field = field
                  - -
                  26 @property
                  +
                  25 self._annotation = field.annotation
                  +
                  26 if field.metadata:
                  +
                  27 metadata = {}
                  +
                  28 for constraint in ["min_length", "max_length", "pattern"]:
                  +
                  29 value = next((getattr(m, constraint) for m in self._field.metadata if hasattr(m, constraint)), None)
                  +
                  30 if value is not None:
                  +
                  31 metadata[constraint] = value
                  +
                  32 if metadata:
                  +
                  33 self._annotation = TypeWithMetadata(self._annotation, metadata)
                  +
                  34
                  +
                  35 @property
                  -
                  27 def annotation(self) -> typing.Type[typing.Any] | None:
                  -
                  28 return self._field.annotation
                  -
                  29
                  -
                  30 @property
                  -
                  31 def required(self) -> bool:
                  -
                  32 return self._field.is_required()
                  -
                  33
                  -
                  34 def __repr__(self):
                  -
                  -
                  35 return repr(self._field)
                  -
                  36
                  -
                  37 def __str__(self):
                  +
                  36 def annotation(self) -> typing.Type[typing.Any] | None:
                  +
                  37 return self._annotation
                  +
                  38
                  +
                  39 @property
                  +
                  40 def required(self) -> bool:
                  +
                  41 return self._field.is_required()
                  +
                  42
                  +
                  43 def __repr__(self):
                  +
                  +
                  44 return repr(self._field)
                  +
                  45
                  +
                  46 def __str__(self):
                  -
                  38 return str(self._field)
                  -
                  39
                  -
                  40
                  -
                  41class ClassSchema(BaseModel, Schema):
                  -
                  42 """
                  -
                  43 A wrapper for pydantic BaseModel that implements the Schema interface.
                  -
                  44 """
                  -
                  45 __cached_fields__ = None
                  -
                  46
                  -
                  47 @classmethod
                  -
                  -
                  48 def fields(cls) -> typing.Dict[str, typing.Any]:
                  -
                  49 if cls.__cached_fields__ is not None:
                  -
                  50 return cls.__cached_fields__
                  +
                  47 return str(self._field)
                  +
                  48
                  +
                  49
                  +
                  50class ClassSchema(BaseModel, Schema):
                  +
                  51 """
                  +
                  52 A wrapper for pydantic BaseModel that implements the Schema interface.
                  +
                  53 """
                  +
                  54 __cached_fields__ = None
                  +
                  55
                  +
                  56 @classmethod
                  +
                  +
                  57 def fields(cls) -> typing.Dict[str, typing.Any]:
                  +
                  58 if cls.__cached_fields__ is not None:
                  +
                  59 return cls.__cached_fields__
                  -
                  51 cls.__cached_fields__ = {k: FieldInfo(v) for k, v in cls.model_fields.items()}
                  -
                  52 return cls.__cached_fields__
                  -
                  - -
                  54 @classmethod
                  -
                  55 def from_json(cls, _json: str) -> "ClassSchema":
                  +
                  60 cls.__cached_fields__ = {k: FieldInfo(v) for k, v in cls.model_fields.items()}
                  +
                  61 return cls.__cached_fields__
                  +
                  + +
                  63 @classmethod
                  +
                  64 def from_json(cls, _json: str) -> "ClassSchema":
                  -
                  -
                  56 """
                  -
                  57 Create a ClassSchema from a JSON string.
                  -
                  58 """
                  -
                  59 return cls.model_validate_json(_json)
                  +
                  +
                  65 """
                  +
                  66 Create a ClassSchema from a JSON string.
                  +
                  67 """
                  +
                  68 return cls.model_validate_json(_json)
                  -
                  60
                  -
                  61
                  -
                  62CallableT = typing.TypeVar('CallableT', bound=typing.Callable)
                  -
                  - -
                  64
                  -
                  65def callable_schema(func: CallableT, /, *, config: ConfigDict = None, validate_return: bool = False) -> CallableT:
                  -
                  66 """
                  -
                  67 A decorator that wraps pydantic's validate_call. The decorated callable also implements the Schema interface.
                  -
                  68
                  -
                  69 Args:
                  -
                  70 func: The function to decorate.
                  -
                  71 config: The pydantic configuration of validate_call.
                  -
                  72 validate_return: Whether to validate the return value.
                  -
                  73
                  -
                  -
                  74 Returns:
                  -
                  75 The decorated callable.
                  -
                  76 """
                  -
                  77 pydantic_wrapper = validate_call(config=config, validate_return=validate_return)(func)
                  -
                  78 signature = inspect.signature(func, eval_str=True)
                  -
                  79 fields = {}
                  +
                  69
                  +
                  70
                  +
                  71CallableT = typing.TypeVar('CallableT', bound=typing.Callable)
                  +
                  + +
                  73
                  +
                  74def callable_schema(func: CallableT, /, *, config: ConfigDict = None, validate_return: bool = False) -> CallableT:
                  +
                  75 """
                  +
                  76 A decorator that wraps pydantic's validate_call. The decorated callable also implements the Schema interface.
                  +
                  77
                  +
                  78 Args:
                  +
                  79 func: The function to decorate.
                  +
                  80 config: The pydantic configuration of validate_call.
                  +
                  81 validate_return: Whether to validate the return value.
                  +
                  82
                  +
                  +
                  83 Returns:
                  +
                  84 The decorated callable.
                  +
                  85 """
                  +
                  86 pydantic_wrapper = validate_call(config=config, validate_return=validate_return)(func)
                  +
                  87 signature = inspect.signature(func, eval_str=True)
                  +
                  88 fields = {}
                  -
                  80 for k, p in signature.parameters.items():
                  -
                  81 default = None
                  -
                  82 if p.default is not inspect.Signature.empty:
                  -
                  83 default = p.default
                  -
                  84 actual_type = p.annotation
                  -
                  85 metadata = []
                  -
                  86 if isinstance(p.default, pydantic.fields.FieldInfo):
                  -
                  87 fields[k] = p.default
                  -
                  88 if typing.get_origin(p.annotation) is typing.Annotated:
                  -
                  89 actual_type, *meta = typing.get_args(p.annotation)
                  -
                  90 fieldinfo = None
                  -
                  91 for i in meta:
                  -
                  92 if isinstance(i, pydantic.fields.FieldInfo):
                  -
                  -
                  93 fieldinfo = i
                  -
                  94 else:
                  -
                  95 metadata.append(i)
                  +
                  89 for k, p in signature.parameters.items():
                  +
                  90 default = None
                  +
                  91 if p.default is not inspect.Signature.empty:
                  +
                  92 default = p.default
                  +
                  93 actual_type = p.annotation
                  +
                  94 metadata = []
                  +
                  95 if isinstance(p.default, pydantic.fields.FieldInfo):
                  +
                  96 fields[k] = p.default
                  +
                  97 if typing.get_origin(p.annotation) is typing.Annotated:
                  +
                  98 actual_type, *meta = typing.get_args(p.annotation)
                  +
                  99 fieldinfo = None
                  +
                  100 for i in meta:
                  +
                  101 if isinstance(i, pydantic.fields.FieldInfo):
                  +
                  +
                  102 fieldinfo = i
                  +
                  103 else:
                  +
                  104 metadata.append(i)
                  -
                  96 if fieldinfo is not None:
                  -
                  97 fields[k] = fieldinfo
                  -
                  98 if k in fields:
                  +
                  105 if fieldinfo is not None:
                  +
                  106 fields[k] = fieldinfo
                  +
                  107 if k in fields:
                  -
                  99 fields[k].default = default
                  -
                  100 fields[k].annotation = actual_type
                  -
                  101 fields[k].metadata.extend(metadata)
                  -
                  102 continue
                  -
                  103 if default is not None:
                  -
                  104 fields[k] = Field(default)
                  -
                  105 else:
                  -
                  106 fields[k] = Field()
                  -
                  107 fields[k].annotation = actual_type
                  -
                  108 fields[k].metadata.extend(metadata)
                  -
                  109 for k in fields:
                  -
                  110 fields[k] = FieldInfo(fields[k])
                  -
                  111
                  -
                  112 def from_json(cls, json_str):
                  -
                  -
                  113 json_data = json.loads(json_str)
                  -
                  114 positional_only = []
                  -
                  115 others = {}
                  -
                  116 for k, p in signature.parameters.items():
                  -
                  117 if p.kind == p.POSITIONAL_ONLY:
                  -
                  118 positional_only.append(json_data[k])
                  -
                  119 else:
                  -
                  120 others[k] = json_data[k]
                  -
                  121 return cls(*positional_only, **others)
                  -
                  122
                  -
                  123 _class = type(
                  -
                  124 f'{func.__qualname__}_PydanticSchema_{id(func)}',
                  -
                  125 (Schema,),
                  -
                  126 {
                  -
                  127 "_func": pydantic_wrapper,
                  -
                  128 '__new__': lambda cls, *args, **kwargs: pydantic_wrapper(*args, **kwargs),
                  -
                  129 '__call__': lambda *args, **kwargs: pydantic_wrapper(*args, **kwargs) # make duck typer happy
                  -
                  130 }
                  -
                  131 )
                  -
                  132 _class.from_json = classmethod(from_json)
                  -
                  133 _class.fields = classmethod(lambda cls: fields)
                  -
                  134 return _class
                  +
                  108 fields[k].default = default
                  +
                  109 fields[k].annotation = actual_type
                  +
                  110 fields[k].metadata.extend(metadata)
                  +
                  111 continue
                  +
                  112 if default is not None:
                  +
                  113 fields[k] = Field(default)
                  +
                  114 else:
                  +
                  115 fields[k] = Field()
                  +
                  116 fields[k].annotation = actual_type
                  +
                  117 fields[k].metadata.extend(metadata)
                  +
                  118 for k in fields:
                  +
                  119 fields[k] = FieldInfo(fields[k])
                  +
                  120
                  +
                  121 def from_json(cls, json_str):
                  +
                  +
                  122 json_data = json.loads(json_str)
                  +
                  123 positional_only = []
                  +
                  124 others = {}
                  +
                  125 for k, p in signature.parameters.items():
                  +
                  126 if p.kind == p.POSITIONAL_ONLY:
                  +
                  127 positional_only.append(json_data[k])
                  +
                  128 else:
                  +
                  129 others[k] = json_data[k]
                  +
                  130 return cls(*positional_only, **others)
                  +
                  131
                  +
                  132 _class = type(
                  +
                  133 f'{func.__qualname__}_PydanticSchema_{id(func)}',
                  +
                  134 (Schema,),
                  +
                  135 {
                  +
                  136 "_func": pydantic_wrapper,
                  +
                  137 '__new__': lambda cls, *args, **kwargs: pydantic_wrapper(*args, **kwargs),
                  +
                  138 '__call__': lambda *args, **kwargs: pydantic_wrapper(*args, **kwargs) # make duck typer happy
                  +
                  139 }
                  +
                  140 )
                  +
                  141 _class.from_json = classmethod(from_json)
                  +
                  142 _class.fields = classmethod(lambda cls: fields)
                  +
                  143 return _class
                  -
                  A wrapper for pydantic BaseModel that implements the Schema interface.
                  Definition pydantic.py:63
                  +
                  A wrapper for pydantic BaseModel that implements the Schema interface.
                  Definition pydantic.py:72
                  A wrapper for pydantic FieldInfo.
                  Definition pydantic.py:18
                  - +
                  __init__(self, pydantic.fields.FieldInfo field)
                  Initialize the field information.
                  Definition pydantic.py:24
                  + -
                  typing.Type[typing.Any]|None annotation(self)
                  Definition pydantic.py:35
                  - - -
                  An abstract schema that describes some data.
                  Definition schema.py:48
                  -
                  CallableT callable_schema(CallableT func, *, ConfigDict config=None, bool validate_return=False)
                  A decorator that wraps pydantic's validate_call.
                  Definition pydantic.py:113
                  +
                  typing.Type[typing.Any]|None annotation(self)
                  Definition pydantic.py:44
                  + + +
                  An abstract schema that describes some data.
                  Definition schema.py:78
                  + +
                  CallableT callable_schema(CallableT func, *, ConfigDict config=None, bool validate_return=False)
                  A decorator that wraps pydantic's validate_call.
                  Definition pydantic.py:122
                  diff --git a/dev/schema_8py.html b/dev/schema_8py.html index 4f852a60..2d1d1d7b 100644 --- a/dev/schema_8py.html +++ b/dev/schema_8py.html @@ -131,6 +131,8 @@ Classes

                  class  formatron.schemas.schema.FieldInfo   +class  formatron.schemas.schema.TypeWithMetadata +  class  formatron.schemas.schema.Schema  An abstract schema that describes some data. More...
                    diff --git a/dev/schema_8py.js b/dev/schema_8py.js index bd0da2b4..be07dcc7 100644 --- a/dev/schema_8py.js +++ b/dev/schema_8py.js @@ -1,5 +1,6 @@ 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" ] ]; \ No newline at end of file diff --git a/dev/schema_8py_source.html b/dev/schema_8py_source.html index 952747b8..36cb8536 100644 --- a/dev/schema_8py_source.html +++ b/dev/schema_8py_source.html @@ -148,28 +148,44 @@
                  23 pass
                  24
                  -
                  25
                  -
                  26class Schema(abc.ABC):
                  -
                  27 """
                  -
                  28 An abstract schema that describes some data.
                  -
                  29 """
                  -
                  30 @classmethod
                  -
                  31 @abc.abstractmethod
                  -
                  32 def fields(cls) -> dict[str, FieldInfo]:
                  -
                  33 """
                  -
                  34 Get the fields of the schema.
                  -
                  35 """
                  -
                  36 pass
                  +
                  25class TypeWithMetadata:
                  +
                  26 def __init__(self, type: typing.Type[typing.Any], metadata: dict[str, typing.Any]|None):
                  +
                  27 self._type = type
                  +
                  28 self._metadata = metadata
                  +
                  29
                  +
                  30 @property
                  +
                  31 def type(self) -> typing.Type[typing.Any]:
                  +
                  32 return self._type
                  +
                  33
                  +
                  34 @property
                  +
                  35 def metadata(self) -> dict[str, typing.Any]|None:
                  +
                  36 return self._metadata
                  37
                  -
                  38 @classmethod
                  +
                  38class Schema(abc.ABC):
                  -
                  39 @abc.abstractmethod
                  -
                  40 def from_json(cls, json: str) -> "Schema":
                  -
                  41 """
                  +
                  39 """
                  +
                  40 An abstract schema that describes some data.
                  +
                  41 """
                  -
                  42 Create a schema from a JSON string.
                  -
                  43 """
                  -
                  44 pass
                  +
                  42 @classmethod
                  +
                  43 @abc.abstractmethod
                  + +
                  +
                  44 def fields(cls) -> dict[str, FieldInfo]:
                  +
                  +
                  45 """
                  +
                  46 Get the fields of the schema.
                  +
                  47 """
                  +
                  48 pass
                  +
                  +
                  49
                  +
                  50 @classmethod
                  +
                  51 @abc.abstractmethod
                  +
                  52 def from_json(cls, json: str) -> "Schema":
                  +
                  53 """
                  +
                  54 Create a schema from a JSON string.
                  +
                  55 """
                  +
                  56 pass
                  typing.Type[typing.Any]|None annotation(self)
                  Get the type annotation of the field.
                  Definition schema.py:22
                  diff --git a/dev/search/all_0.js b/dev/search/all_0.js index 771b843f..f348535b 100644 --- a/dev/search/all_0.js +++ b/dev/search/all_0.js @@ -1,13 +1,13 @@ 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_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__()']]], + ['_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_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']]], + ['_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']]], ['_5fautodetect_5fprocessors_9',['_autodetect_processors',['../namespaceformatron_1_1integrations_1_1__utils.html#a76ded8fc3ee5ad369ec55b595ae74153',1,'formatron::integrations::_utils']]], ['_5fcapture_5fname_10',['_capture_name',['../classformatron_1_1extractor_1_1Extractor.html#a3299dc34a7276ab8ab553513048211d3',1,'formatron::extractor::Extractor']]], @@ -43,27 +43,29 @@ var searchData= ['_5fmain_5frule_40',['_main_rule',['../classformatron_1_1formatter_1_1FormatterBuilder.html#a3c3ba1934b9207c412202c5ef29b002a',1,'formatron::formatter::FormatterBuilder']]], ['_5fmerge_5fkey_41',['_merge_key',['../namespaceformatron_1_1schemas_1_1json__schema.html#a5fcddd43a5f64374b5b75d4aafeb9135',1,'formatron::schemas::json_schema']]], ['_5fmerge_5freferenced_5fschema_42',['_merge_referenced_schema',['../namespaceformatron_1_1schemas_1_1json__schema.html#a45c9b97319a58c2013b8e3f10ad78c30',1,'formatron::schemas::json_schema']]], - ['_5fmultiple_5freplace_43',['_multiple_replace',['../namespaceformatron_1_1integrations_1_1__utils.html#abf64c53a323448aedc1361d01515226a',1,'formatron::integrations::_utils']]], - ['_5fnonterminal_44',['_nonterminal',['../classformatron_1_1extractor_1_1NonterminalExtractor.html#a5c4c968b45e328b8caa4b2795ecc00fe',1,'formatron::extractor::NonterminalExtractor']]], - ['_5fnonterminal_5fto_5fextractor_45',['_nonterminal_to_extractor',['../classformatron_1_1formatter_1_1FormatterBuilder.html#a870a5075cfd903c77e5ee58b6c304e03',1,'formatron::formatter::FormatterBuilder']]], - ['_5fobtain_5faccepted_5foutput_46',['_obtain_accepted_output',['../classformatron_1_1formatter_1_1Formatter.html#ae4be840a942f608c1a0c256dbf68901b',1,'formatron::formatter::Formatter']]], - ['_5fobtain_5ftype_47',['_obtain_type',['../namespaceformatron_1_1schemas_1_1json__schema.html#a544d74edf1fdccbad9e216d9ff028a20',1,'formatron::schemas::json_schema']]], - ['_5fon_5fcompletion_48',['_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_49',['_pass_tokens',['../classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#a370eaf641dd803b2759b4e5fc7f74a1c',1,'formatron::integrations::exllamav2::FormatterFilter']]], - ['_5frecursive_5fresolve_5freference_50',['_recursive_resolve_reference',['../namespaceformatron_1_1schemas_1_1json__schema.html#aaba012c79d101be93f4d96588c9f8cc2',1,'formatron::schemas::json_schema']]], - ['_5fregex_51',['_regex',['../classformatron_1_1formats_1_1regex_1_1RegexExtractor.html#a1df60401933eef6cf5a1ff041f11ec46',1,'formatron::formats::regex::RegexExtractor']]], - ['_5fregister_5fall_5fpredefined_5ftypes_52',['_register_all_predefined_types',['../namespaceformatron_1_1formats_1_1json.html#a311b750cba3838aee622b9809888f051',1,'formatron::formats::json']]], - ['_5frequired_53',['_required',['../classformatron_1_1schemas_1_1json__schema_1_1FieldInfo.html#a8ac1acf32bb578e121ef28a433857726',1,'formatron::schemas::json_schema::FieldInfo']]], - ['_5fresolve_5fnew_5furl_54',['_resolve_new_url',['../namespaceformatron_1_1schemas_1_1json__schema.html#a9dc9dc267e5dd7b6581e2367e9238152',1,'formatron::schemas::json_schema']]], - ['_5fresolve_5freference_55',['_resolve_reference',['../namespaceformatron_1_1schemas_1_1json__schema.html#a24b516494672cc5dbbf7300ea65479b1',1,'formatron::schemas::json_schema']]], - ['_5frule_5fstr_56',['_rule_str',['../classformatron_1_1formats_1_1json_1_1JsonExtractor.html#aecf88428e414da080f11ed0ab1e13a65',1,'formatron::formats::json::JsonExtractor']]], - ['_5frules_57',['_rules',['../classformatron_1_1formatter_1_1FormatterBuilder.html#a62c61ad02e40526b73ca460d0cf1d12c',1,'formatron::formatter::FormatterBuilder']]], - ['_5fstring_58',['_string',['../classformatron_1_1extractor_1_1SubstringExtractor.html#a3781b75c6c8c12f89fd70ea405e11293',1,'formatron::extractor::SubstringExtractor']]], - ['_5fsuffix_5fautomaton_59',['_suffix_automaton',['../classformatron_1_1extractor_1_1SubstringExtractor.html#a97cb3468674873adfc85bc17ff1a9a97',1,'formatron::extractor::SubstringExtractor']]], - ['_5fto_5fnext_5fbatch_5fstep_60',['_to_next_batch_step',['../classformatron_1_1integrations_1_1vllm_1_1FormattersLogitsProcessor.html#ab87fea11f930a33130cecadd8cdf0cc6',1,'formatron::integrations::vllm::FormattersLogitsProcessor']]], - ['_5fto_5fobject_61',['_to_object',['../classformatron_1_1formats_1_1json_1_1JsonExtractor.html#a2e72d806c8dffc0136231b81eb724355',1,'formatron::formats::json::JsonExtractor']]], - ['_5ftoken_5fid_5for_5fbytes_62',['_token_id_or_bytes',['../classformatron_1_1formatter_1_1Formatter.html#adf232d46083546ae3363e4ce007a335b',1,'formatron::formatter::Formatter']]], - ['_5ftype_5fto_5fnonterminals_63',['_type_to_nonterminals',['../namespaceformatron_1_1formats_1_1json.html#a003a1dac95634ac70f86d51e768945a4',1,'formatron::formats::json']]], - ['_5futils_2epy_64',['_utils.py',['../__utils_8py.html',1,'']]], - ['_5fvalidate_5fjson_5fschema_65',['_validate_json_schema',['../namespaceformatron_1_1schemas_1_1json__schema.html#a51aa68e29951e6b295844b13177b7d6a',1,'formatron::schemas::json_schema']]] + ['_5fmetadata_43',['_metadata',['../classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata.html#a34312895f9d497d5c35cf372f9c498f3',1,'formatron::schemas::schema::TypeWithMetadata']]], + ['_5fmultiple_5freplace_44',['_multiple_replace',['../namespaceformatron_1_1integrations_1_1__utils.html#abf64c53a323448aedc1361d01515226a',1,'formatron::integrations::_utils']]], + ['_5fnonterminal_45',['_nonterminal',['../classformatron_1_1extractor_1_1NonterminalExtractor.html#a5c4c968b45e328b8caa4b2795ecc00fe',1,'formatron::extractor::NonterminalExtractor']]], + ['_5fnonterminal_5fto_5fextractor_46',['_nonterminal_to_extractor',['../classformatron_1_1formatter_1_1FormatterBuilder.html#a870a5075cfd903c77e5ee58b6c304e03',1,'formatron::formatter::FormatterBuilder']]], + ['_5fobtain_5faccepted_5foutput_47',['_obtain_accepted_output',['../classformatron_1_1formatter_1_1Formatter.html#ae4be840a942f608c1a0c256dbf68901b',1,'formatron::formatter::Formatter']]], + ['_5fobtain_5ftype_48',['_obtain_type',['../namespaceformatron_1_1schemas_1_1json__schema.html#a544d74edf1fdccbad9e216d9ff028a20',1,'formatron::schemas::json_schema']]], + ['_5fon_5fcompletion_49',['_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_50',['_pass_tokens',['../classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#a370eaf641dd803b2759b4e5fc7f74a1c',1,'formatron::integrations::exllamav2::FormatterFilter']]], + ['_5frecursive_5fresolve_5freference_51',['_recursive_resolve_reference',['../namespaceformatron_1_1schemas_1_1json__schema.html#aaba012c79d101be93f4d96588c9f8cc2',1,'formatron::schemas::json_schema']]], + ['_5fregex_52',['_regex',['../classformatron_1_1formats_1_1regex_1_1RegexExtractor.html#a1df60401933eef6cf5a1ff041f11ec46',1,'formatron::formats::regex::RegexExtractor']]], + ['_5fregister_5fall_5fpredefined_5ftypes_53',['_register_all_predefined_types',['../namespaceformatron_1_1formats_1_1json.html#a311b750cba3838aee622b9809888f051',1,'formatron::formats::json']]], + ['_5frequired_54',['_required',['../classformatron_1_1schemas_1_1json__schema_1_1FieldInfo.html#a8ac1acf32bb578e121ef28a433857726',1,'formatron::schemas::json_schema::FieldInfo']]], + ['_5fresolve_5fnew_5furl_55',['_resolve_new_url',['../namespaceformatron_1_1schemas_1_1json__schema.html#a9dc9dc267e5dd7b6581e2367e9238152',1,'formatron::schemas::json_schema']]], + ['_5fresolve_5freference_56',['_resolve_reference',['../namespaceformatron_1_1schemas_1_1json__schema.html#a24b516494672cc5dbbf7300ea65479b1',1,'formatron::schemas::json_schema']]], + ['_5frule_5fstr_57',['_rule_str',['../classformatron_1_1formats_1_1json_1_1JsonExtractor.html#aecf88428e414da080f11ed0ab1e13a65',1,'formatron::formats::json::JsonExtractor']]], + ['_5frules_58',['_rules',['../classformatron_1_1formatter_1_1FormatterBuilder.html#a62c61ad02e40526b73ca460d0cf1d12c',1,'formatron::formatter::FormatterBuilder']]], + ['_5fstring_59',['_string',['../classformatron_1_1extractor_1_1SubstringExtractor.html#a3781b75c6c8c12f89fd70ea405e11293',1,'formatron::extractor::SubstringExtractor']]], + ['_5fsuffix_5fautomaton_60',['_suffix_automaton',['../classformatron_1_1extractor_1_1SubstringExtractor.html#a97cb3468674873adfc85bc17ff1a9a97',1,'formatron::extractor::SubstringExtractor']]], + ['_5fto_5fnext_5fbatch_5fstep_61',['_to_next_batch_step',['../classformatron_1_1integrations_1_1vllm_1_1FormattersLogitsProcessor.html#ab87fea11f930a33130cecadd8cdf0cc6',1,'formatron::integrations::vllm::FormattersLogitsProcessor']]], + ['_5fto_5fobject_62',['_to_object',['../classformatron_1_1formats_1_1json_1_1JsonExtractor.html#a2e72d806c8dffc0136231b81eb724355',1,'formatron::formats::json::JsonExtractor']]], + ['_5ftoken_5fid_5for_5fbytes_63',['_token_id_or_bytes',['../classformatron_1_1formatter_1_1Formatter.html#adf232d46083546ae3363e4ce007a335b',1,'formatron::formatter::Formatter']]], + ['_5ftype_64',['_type',['../classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata.html#a4d1ea7d59f700634eb2545ce3d6cf324',1,'formatron::schemas::schema::TypeWithMetadata']]], + ['_5ftype_5fto_5fnonterminals_65',['_type_to_nonterminals',['../namespaceformatron_1_1formats_1_1json.html#a003a1dac95634ac70f86d51e768945a4',1,'formatron::formats::json']]], + ['_5futils_2epy_66',['_utils.py',['../__utils_8py.html',1,'']]], + ['_5fvalidate_5fjson_5fschema_67',['_validate_json_schema',['../namespaceformatron_1_1schemas_1_1json__schema.html#a51aa68e29951e6b295844b13177b7d6a',1,'formatron::schemas::json_schema']]] ]; diff --git a/dev/search/all_12.js b/dev/search/all_12.js index ce03ed47..335d8580 100644 --- a/dev/search/all_12.js +++ b/dev/search/all_12.js @@ -1,4 +1,6 @@ var searchData= [ - ['transformers_2epy_0',['transformers.py',['../transformers_8py.html',1,'']]] + ['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/dev/search/all_d.js b/dev/search/all_d.js index 032f5ef9..374eaabe 100644 --- a/dev/search/all_d.js +++ b/dev/search/all_d.js @@ -1,4 +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()']]] + ['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/dev/search/classes_9.js b/dev/search/classes_9.js new file mode 100644 index 00000000..99ffaccb --- /dev/null +++ b/dev/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/dev/search/functions_0.js b/dev/search/functions_0.js index 941562ea..49e0eb7d 100644 --- a/dev/search/functions_0.js +++ b/dev/search/functions_0.js @@ -1,7 +1,7 @@ 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_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__(self, pydantic.fields.FieldInfo field)']]], + ['_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_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']]], diff --git a/dev/search/functions_10.js b/dev/search/functions_10.js index 073ecfa7..f44c4e1e 100644 --- a/dev/search/functions_10.js +++ b/dev/search/functions_10.js @@ -1,4 +1,4 @@ var searchData= [ - ['use_5fbackground_5fworker_0',['use_background_worker',['../classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#a9aa83a5922cefce88197d2cc3822a0c6',1,'formatron::integrations::exllamav2::FormatterFilter']]] + ['type_0',['type',['../classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata.html#ada7a24496aad9979411523441c53a6cf',1,'formatron::schemas::schema::TypeWithMetadata']]] ]; diff --git a/dev/search/functions_11.js b/dev/search/functions_11.js new file mode 100644 index 00000000..073ecfa7 --- /dev/null +++ b/dev/search/functions_11.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['use_5fbackground_5fworker_0',['use_background_worker',['../classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#a9aa83a5922cefce88197d2cc3822a0c6',1,'formatron::integrations::exllamav2::FormatterFilter']]] +]; diff --git a/dev/search/functions_b.js b/dev/search/functions_b.js index 032f5ef9..374eaabe 100644 --- a/dev/search/functions_b.js +++ b/dev/search/functions_b.js @@ -1,4 +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()']]] + ['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/dev/search/searchdata.js b/dev/search/searchdata.js index 49ba374e..2e446c64 100644 --- a/dev/search/searchdata.js +++ b/dev/search/searchdata.js @@ -1,10 +1,10 @@ var indexSectionsWithContent = { 0: "_abcdefghijklmnprstuv", - 1: "cefjlnprs", + 1: "cefjlnprst", 2: "f", 3: "_cdefjprstv", - 4: "_abcefghijkmnprsu", + 4: "_abcefghijkmnprstu", 5: "_cefgprs" }; diff --git a/dev/search/variables_0.js b/dev/search/variables_0.js index 62144f2e..09b11ea9 100644 --- a/dev/search/variables_0.js +++ b/dev/search/variables_0.js @@ -1,6 +1,6 @@ var searchData= [ - ['_5fannotation_0',['_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']]], + ['_5fannotation_0',['_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']]], ['_5fcapture_5fname_1',['_capture_name',['../classformatron_1_1extractor_1_1Extractor.html#a3299dc34a7276ab8ab553513048211d3',1,'formatron::extractor::Extractor']]], ['_5fcapture_5fnames_2',['_capture_names',['../classformatron_1_1formatter_1_1FormatterBuilder.html#a68daf6b6bbd2f32843352dc6ea1f4b8f',1,'formatron::formatter::FormatterBuilder']]], ['_5fcaptures_3',['_captures',['../classformatron_1_1formatter_1_1Formatter.html#a43964a72280fd307cd74528657beeca3',1,'formatron::formatter::Formatter']]], @@ -23,16 +23,18 @@ var searchData= ['_5flast_5finput_5fid_5flength_20',['_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_21',['_literal',['../classformatron_1_1extractor_1_1LiteralExtractor.html#a333e99fa481e15e9d907d35cda8ee728',1,'formatron::extractor::LiteralExtractor']]], ['_5fmain_5frule_22',['_main_rule',['../classformatron_1_1formatter_1_1FormatterBuilder.html#a3c3ba1934b9207c412202c5ef29b002a',1,'formatron::formatter::FormatterBuilder']]], - ['_5fnonterminal_23',['_nonterminal',['../classformatron_1_1extractor_1_1NonterminalExtractor.html#a5c4c968b45e328b8caa4b2795ecc00fe',1,'formatron::extractor::NonterminalExtractor']]], - ['_5fnonterminal_5fto_5fextractor_24',['_nonterminal_to_extractor',['../classformatron_1_1formatter_1_1FormatterBuilder.html#a870a5075cfd903c77e5ee58b6c304e03',1,'formatron::formatter::FormatterBuilder']]], - ['_5fpass_5ftokens_25',['_pass_tokens',['../classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#a370eaf641dd803b2759b4e5fc7f74a1c',1,'formatron::integrations::exllamav2::FormatterFilter']]], - ['_5fregex_26',['_regex',['../classformatron_1_1formats_1_1regex_1_1RegexExtractor.html#a1df60401933eef6cf5a1ff041f11ec46',1,'formatron::formats::regex::RegexExtractor']]], - ['_5frequired_27',['_required',['../classformatron_1_1schemas_1_1json__schema_1_1FieldInfo.html#a8ac1acf32bb578e121ef28a433857726',1,'formatron::schemas::json_schema::FieldInfo']]], - ['_5frule_5fstr_28',['_rule_str',['../classformatron_1_1formats_1_1json_1_1JsonExtractor.html#aecf88428e414da080f11ed0ab1e13a65',1,'formatron::formats::json::JsonExtractor']]], - ['_5frules_29',['_rules',['../classformatron_1_1formatter_1_1FormatterBuilder.html#a62c61ad02e40526b73ca460d0cf1d12c',1,'formatron::formatter::FormatterBuilder']]], - ['_5fstring_30',['_string',['../classformatron_1_1extractor_1_1SubstringExtractor.html#a3781b75c6c8c12f89fd70ea405e11293',1,'formatron::extractor::SubstringExtractor']]], - ['_5fsuffix_5fautomaton_31',['_suffix_automaton',['../classformatron_1_1extractor_1_1SubstringExtractor.html#a97cb3468674873adfc85bc17ff1a9a97',1,'formatron::extractor::SubstringExtractor']]], - ['_5fto_5fobject_32',['_to_object',['../classformatron_1_1formats_1_1json_1_1JsonExtractor.html#a2e72d806c8dffc0136231b81eb724355',1,'formatron::formats::json::JsonExtractor']]], - ['_5ftoken_5fid_5for_5fbytes_33',['_token_id_or_bytes',['../classformatron_1_1formatter_1_1Formatter.html#adf232d46083546ae3363e4ce007a335b',1,'formatron::formatter::Formatter']]], - ['_5ftype_5fto_5fnonterminals_34',['_type_to_nonterminals',['../namespaceformatron_1_1formats_1_1json.html#a003a1dac95634ac70f86d51e768945a4',1,'formatron::formats::json']]] + ['_5fmetadata_23',['_metadata',['../classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata.html#a34312895f9d497d5c35cf372f9c498f3',1,'formatron::schemas::schema::TypeWithMetadata']]], + ['_5fnonterminal_24',['_nonterminal',['../classformatron_1_1extractor_1_1NonterminalExtractor.html#a5c4c968b45e328b8caa4b2795ecc00fe',1,'formatron::extractor::NonterminalExtractor']]], + ['_5fnonterminal_5fto_5fextractor_25',['_nonterminal_to_extractor',['../classformatron_1_1formatter_1_1FormatterBuilder.html#a870a5075cfd903c77e5ee58b6c304e03',1,'formatron::formatter::FormatterBuilder']]], + ['_5fpass_5ftokens_26',['_pass_tokens',['../classformatron_1_1integrations_1_1exllamav2_1_1FormatterFilter.html#a370eaf641dd803b2759b4e5fc7f74a1c',1,'formatron::integrations::exllamav2::FormatterFilter']]], + ['_5fregex_27',['_regex',['../classformatron_1_1formats_1_1regex_1_1RegexExtractor.html#a1df60401933eef6cf5a1ff041f11ec46',1,'formatron::formats::regex::RegexExtractor']]], + ['_5frequired_28',['_required',['../classformatron_1_1schemas_1_1json__schema_1_1FieldInfo.html#a8ac1acf32bb578e121ef28a433857726',1,'formatron::schemas::json_schema::FieldInfo']]], + ['_5frule_5fstr_29',['_rule_str',['../classformatron_1_1formats_1_1json_1_1JsonExtractor.html#aecf88428e414da080f11ed0ab1e13a65',1,'formatron::formats::json::JsonExtractor']]], + ['_5frules_30',['_rules',['../classformatron_1_1formatter_1_1FormatterBuilder.html#a62c61ad02e40526b73ca460d0cf1d12c',1,'formatron::formatter::FormatterBuilder']]], + ['_5fstring_31',['_string',['../classformatron_1_1extractor_1_1SubstringExtractor.html#a3781b75c6c8c12f89fd70ea405e11293',1,'formatron::extractor::SubstringExtractor']]], + ['_5fsuffix_5fautomaton_32',['_suffix_automaton',['../classformatron_1_1extractor_1_1SubstringExtractor.html#a97cb3468674873adfc85bc17ff1a9a97',1,'formatron::extractor::SubstringExtractor']]], + ['_5fto_5fobject_33',['_to_object',['../classformatron_1_1formats_1_1json_1_1JsonExtractor.html#a2e72d806c8dffc0136231b81eb724355',1,'formatron::formats::json::JsonExtractor']]], + ['_5ftoken_5fid_5for_5fbytes_34',['_token_id_or_bytes',['../classformatron_1_1formatter_1_1Formatter.html#adf232d46083546ae3363e4ce007a335b',1,'formatron::formatter::Formatter']]], + ['_5ftype_35',['_type',['../classformatron_1_1schemas_1_1schema_1_1TypeWithMetadata.html#a4d1ea7d59f700634eb2545ce3d6cf324',1,'formatron::schemas::schema::TypeWithMetadata']]], + ['_5ftype_5fto_5fnonterminals_36',['_type_to_nonterminals',['../namespaceformatron_1_1formats_1_1json.html#a003a1dac95634ac70f86d51e768945a4',1,'formatron::formats::json']]] ];