From 8fb7459e08ecb94e045a78e2ba8ee08c27ab34c7 Mon Sep 17 00:00:00 2001 From: Lianmin Zheng Date: Sat, 3 Feb 2024 17:42:01 -0800 Subject: [PATCH] update json decoding docs --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6dcb0bb03..cdc5cf920 100644 --- a/README.md +++ b/README.md @@ -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