Skip to content

Commit

Permalink
Use outlines-core to translate JSON Schemas into regexes
Browse files Browse the repository at this point in the history
  • Loading branch information
rlouf committed Dec 9, 2024
1 parent e4f96fb commit 9aca8c7
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 543 deletions.
7 changes: 2 additions & 5 deletions benchmarks/bench_json_schema.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from outlines_core.fsm.json_schema import build_regex_from_schema

from outlines.caching import cache_disabled
from outlines.fsm.guide import RegexGuide
from outlines.fsm.json_schema import build_regex_from_schema

from .common import setup_tokenizer # noqa: E402

Expand Down Expand Up @@ -70,10 +71,6 @@ def setup(self, schema_name):
self.tokenizer = setup_tokenizer()
self.schema = schemas[schema_name]

@cache_disabled()
def time_json_schema_to_regex(self, schema_name):
build_regex_from_schema(self.schema)

@cache_disabled()
def time_json_schema_to_fsm(self, schema_name):
regex = build_regex_from_schema(self.schema)
Expand Down
Loading

0 comments on commit 9aca8c7

Please sign in to comment.