Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
change
sglang
Commits
8fb7459e
Commit
8fb7459e
authored
Feb 03, 2024
by
Lianmin Zheng
Browse files
update json decoding docs
parent
bb3a3b66
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
1 deletion
+2
-1
README.md
README.md
+2
-1
No files found.
README.md
View file @
8fb7459e
...
...
@@ -194,6 +194,7 @@ def regular_expression_gen(s):
```
### JSON Decoding
Use
`regex`
to specify a JSON schema with a regular expression.
```
python
character_regex
=
(
...
...
@@ -219,7 +220,7 @@ def character_gen(s, name):
s
+=
sgl
.
gen
(
"json_output"
,
max_tokens
=
256
,
regex
=
character_regex
)
```
See also
[
json_decode.py
](
examples/usage/json_decode.py
)
.
See also
[
json_decode.py
](
examples/usage/json_decode.py
)
for an additional example on specifying formats with Pydantic models
.
### Batching
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment