xinfer-ai 0.13.6 → 0.13.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -2
- package/docs/guided_decoding.md +21 -9
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -449,9 +449,14 @@ xinfer --m unsloth/Qwen3-30B-A3B-Instruct-2507-GGUF \
|
|
|
449
449
|
|
|
450
450
|
---
|
|
451
451
|
|
|
452
|
-
## 🔌 Structured Outputs
|
|
452
|
+
## 🔌 Structured Outputs & Guided Decoding
|
|
453
453
|
|
|
454
|
-
Constraint-based generation via llguidance —
|
|
454
|
+
Constraint-based generation via llguidance — JSON Schema, regex, Lark grammars, choice lists.
|
|
455
|
+
|
|
456
|
+
```bash
|
|
457
|
+
# Enable structured outputs and tool grammar
|
|
458
|
+
xinfer --m Qwen/Qwen3.6-27B-FP8 --ui-server --enable-tool-grammar
|
|
459
|
+
```
|
|
455
460
|
|
|
456
461
|
[Structured outputs documentation →](docs/guided_decoding.md)
|
|
457
462
|
|
package/docs/guided_decoding.md
CHANGED
|
@@ -8,13 +8,23 @@ It focuses on:
|
|
|
8
8
|
- how reasoning effort is applied
|
|
9
9
|
- practical usage and validation commands
|
|
10
10
|
|
|
11
|
+
## JSON Schema Reference
|
|
12
|
+
|
|
13
|
+
For detailed JSON Schema constraint documentation with curl examples, see [`llguidance-json-schema.md`](llguidance-json-schema.md).
|
|
14
|
+
|
|
15
|
+
This covers:
|
|
16
|
+
- Schema type definitions (string, integer, number, boolean, object, array)
|
|
17
|
+
- All supported API endpoints (OpenAI-compatible and Claude server)
|
|
18
|
+
- Complete curl examples for each permutation
|
|
19
|
+
- Schema sanitization behavior
|
|
20
|
+
|
|
11
21
|
## Current Model
|
|
12
22
|
|
|
13
23
|
Guided decoding is request-scoped.
|
|
14
24
|
|
|
15
25
|
The core engine does not invent grammars on its own. A request either:
|
|
16
26
|
- supplies a constraint grammar
|
|
17
|
-
- gets
|
|
27
|
+
- gets a composed grammar containing both
|
|
18
28
|
- or runs unconstrained when neither exists
|
|
19
29
|
|
|
20
30
|
The final grammar is stored in `SamplingParams.grammar` and consumed by the runner.
|
|
@@ -44,7 +54,7 @@ The server composes:
|
|
|
44
54
|
|
|
45
55
|
The result is a single `TopLevelGrammar` assigned to `SamplingParams.grammar`.
|
|
46
56
|
|
|
47
|
-
If no
|
|
57
|
+
If no constraint grammar and no tool grammar exist, `params.grammar` stays `None`.
|
|
48
58
|
|
|
49
59
|
### 3. Sampling in runner
|
|
50
60
|
|
|
@@ -84,14 +94,17 @@ Legacy fields
|
|
|
84
94
|
- `constraint`
|
|
85
95
|
- `constraint_type = regex | lark | json_schema | json`
|
|
86
96
|
|
|
87
|
-
If a request provides none of the above, guided decoding is not enabled.
|
|
97
|
+
If a request provides none of the above, guided decoding is not enabled unless tool grammar synthesis adds one.
|
|
98
|
+
|
|
99
|
+
The grammar composition logic is in `src/utils/guidance_grammar.rs`. The `GrammarRequestDispatcher` and `GrammarComposer` handle the composition of constraint grammars with reasoning grammars.
|
|
88
100
|
|
|
89
101
|
### Claude server
|
|
90
102
|
|
|
103
|
+
Claude reuses the same tool-grammar builder path.
|
|
104
|
+
|
|
91
105
|
Current state:
|
|
92
106
|
- Claude does not expose the same client-supplied grammar request surface as the OpenAI endpoint
|
|
93
107
|
- Claude reasoning is still driven by explicit thinking behavior, not by `reasoning_effort` grammar composition
|
|
94
|
-
- Claude requests therefore do not currently enable guided decoding
|
|
95
108
|
|
|
96
109
|
## Reasoning Effort
|
|
97
110
|
|
|
@@ -99,7 +112,7 @@ Reasoning effort is separate from ordinary structured outputs.
|
|
|
99
112
|
|
|
100
113
|
### Current state
|
|
101
114
|
|
|
102
|
-
The OpenAI path maps `reasoning_effort` into grammar composition
|
|
115
|
+
The OpenAI path maps `reasoning_effort` into grammar composition.
|
|
103
116
|
|
|
104
117
|
Accepted values come from `ReasoningEffort::from_str`:
|
|
105
118
|
- `none`
|
|
@@ -115,7 +128,7 @@ Non-Python builds also support:
|
|
|
115
128
|
- `custom:<template>`
|
|
116
129
|
|
|
117
130
|
Relevant code:
|
|
118
|
-
- `src/utils/
|
|
131
|
+
- `src/utils/guidance_grammar.rs`
|
|
119
132
|
- `src/server/server.rs`
|
|
120
133
|
- `src/utils/guidance.rs`
|
|
121
134
|
|
|
@@ -124,7 +137,6 @@ Relevant code:
|
|
|
124
137
|
Reasoning effort:
|
|
125
138
|
- does not enable chat-template thinking by itself
|
|
126
139
|
- only affects grammar composition
|
|
127
|
-
- is ignored when no request constraint grammar is present
|
|
128
140
|
- only works when reasoning start/end tokens are available
|
|
129
141
|
|
|
130
142
|
If the tokenizer does not expose reasoning markers, the system logs a warning and falls back to the base grammar.
|
|
@@ -160,7 +172,7 @@ xinfer --m Qwen/Qwen3.5-35B-A3B-FP8/ --ui-server --d 0
|
|
|
160
172
|
| Enforce text pattern | `structured_outputs` or `constraint` | `regex` |
|
|
161
173
|
| Enforce full object schema | `structured_outputs` or `response_format` | `json` / `json_schema` |
|
|
162
174
|
| Enforce custom grammar | `structured_outputs` or `constraint` | `grammar` / `lark` |
|
|
163
|
-
| Constrain
|
|
175
|
+
| Constrain tool call payload | `structured_outputs` or automatic tool grammar | `structural_tag` / tool grammar |
|
|
164
176
|
| Add a reasoning prefix | `reasoning_effort` | `low`, `medium`, `high`, etc. |
|
|
165
177
|
|
|
166
178
|
### 1. Constrain the answer to a fixed set
|
|
@@ -470,5 +482,5 @@ Check:
|
|
|
470
482
|
|
|
471
483
|
- Guided decoding is only active when `SamplingParams.grammar` is present.
|
|
472
484
|
- OpenAI currently has the richest client-facing grammar surface.
|
|
473
|
-
- Claude
|
|
485
|
+
- Claude currently reuses tool grammar, but not the same direct constraint request API.
|
|
474
486
|
- No request-level grammar means no guided decoding.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xinfer-ai",
|
|
3
|
-
"version": "0.13.
|
|
4
|
-
"assetVersion": "0.13.
|
|
3
|
+
"version": "0.13.7",
|
|
4
|
+
"assetVersion": "0.13.7",
|
|
5
5
|
"description": "xInfer — a high-performance LLM inference engine in Rust with CUDA/Metal acceleration",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://github.com/guoqingbao/xinfer#readme",
|