1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
[]
= "llmtask"
= "0.1.0"
= "2024"
= "https://github.com/findit-ai/llmtask"
= "https://github.com/findit-ai/llmtask"
= "https://docs.rs/llmtask"
= "1.95"
= "Engine-agnostic Task abstraction for LLM structured-output: Task trait + Grammar (JSON Schema, Lark, Regex) + ImageAnalysis"
= "MIT OR Apache-2.0"
= ["llm", "vlm", "structured-output", "json-schema", "constrained-decoding"]
= ["api-bindings", "text-processing", "data-structures"]
[]
# `std` (full std-lib + dep std features) and `json` (the
# JSON Schema variant + JsonParseError) are both default-on
# because the canonical use case is "produce structured JSON
# output via a constrained-decoding engine". A consumer that
# wants Lark/Regex only — or a no_std + alloc build — drops
# them via `default-features = false`.
= ["std", "json"]
# `alloc` brings in the `smol_str` dep (the SmolStr type used by
# `Grammar::Lark` and `ImageAnalysis` fields). Every public type
# in this crate needs at least `alloc`; the bare-no_std build
# (no features) only re-exports nothing reachable from
# `pub use ...` and exists for upstream-`#![no_std]` parity.
= ["dep:smol_str"]
# `std` is a strict superset of `alloc` — turning it on enables
# the `std` features of dep crates (so `regex` gets unicode-perl,
# `thiserror` gets its full machinery, etc.). Also bumps optional
# `serde?/std` and `serde_json?/std` so std builds use the
# std-aware variants of those deps when they're enabled by other
# features (json pulls serde + serde_json; the user can also
# enable serde alone).
= [
"alloc",
"thiserror/default",
"regex?/default",
"regex-syntax?/default",
"smol_str/default",
"serde?/std",
"serde_json?/std",
]
# Public Serialize/Deserialize derives on `ImageAnalysis`. Opt-in
# (NOT pulled by `json`). Implies `alloc` because the derive
# target lives behind the alloc gate, and pulls `serde/alloc`
# because SmolStr's serde impl needs serde's alloc-mode visitor
# traits (visit_string / visit_byte_buf) — without them, E0407.
= ["dep:serde", "serde/alloc", "alloc", "smol_str?/serde"]
# JSON Schema support: the `Grammar::JsonSchema(Value)` variant,
# the `JsonParseError` convenience type, and the JSON-related
# constructors / accessors on `Grammar` (`json_schema`,
# `as_json_schema`, `is_json_schema`). Implies `alloc` because
# `serde_json::Value` requires alloc.
#
# Codex round 5 finding: this used to imply the public `serde`
# feature too, which forced default builds (`std + json`) to turn
# on Serialize/Deserialize for `ImageAnalysis` despite the README
# saying serde is opt-in. Decoupled — serde_json still pulls
# serde transitively as a dep (the serde crate is in the tree),
# but `cfg(feature = "serde")` stays off unless the user opts
# in explicitly. ImageAnalysis derives only fire under
# `--features serde`.
= ["dep:serde_json", "alloc"]
# `Grammar::regex` (validating constructor) and `Grammar::as_regex` /
# `Grammar::as_regex_pattern` accessors. Pulls in the `regex` crate.
# Implies `alloc` because the variant lives behind feature-gated
# code that the lib only exposes when at least `alloc` is on.
#
# `regex-syntax` is a direct dep here (already a transitive dep of
# `regex`) so `Grammar::is_regex_full_match` can build a syntax-
# preserving anchored validator via HIR `Hir::concat([Look::Start,
# parsed_hir, Look::End])`. The HIR path avoids both the round-11
# verbose-mode comment bug (raw string interpolation broke
# `(?x)…# comment`) and the round-12 leftmost-first bug (Rust
# `regex` returned the shorter `a` match for `a|ab` on `ab`).
= ["dep:regex", "dep:regex-syntax", "alloc"]
[]
# Every dep declared with `default-features = false` so the lib
# doesn't silently link std under `--no-default-features
# --features alloc,…` consumers. The crate's own `std` feature
# is the only thing that turns each dep's `std`/`default` features
# back on (see [features] above).
= { = "1", = false, = ["derive"], = true }
= { = "1", = false, = ["alloc"], = true }
= { = "0.3", = false, = true }
= { = "2", = false }
= { = "1", = false, = true }
= { = "0.8", = false, = true }
[]
= true
[]
= "warn"
= "warn"
= { = "warn", = ['cfg(docsrs)', 'cfg(tarpaulin)'] }