File tree Expand file tree Collapse file tree 4 files changed +43
-44
lines changed
Expand file tree Collapse file tree 4 files changed +43
-44
lines changed Original file line number Diff line number Diff line change 33from typing import Callable , Dict
44
55from outlines_core import Guide , Index , Vocabulary
6- # TODO: change this once the import issue is fixed in outlines_core
7- from outlines_core import outlines_core
6+ from outlines_core .json_schema import build_regex_from_schema
87
98from outlines .backends .base import BaseBackend
109from outlines .models import SteerableModel
@@ -248,7 +247,7 @@ def get_json_schema_logits_processor(
248247 The logits processor to use to constrain the generation.
249248
250249 """
251- regex = outlines_core . json_schema . build_regex_from_schema (json_schema )
250+ regex = build_regex_from_schema (json_schema )
252251 return self .get_regex_logits_processor (regex )
253252
254253 def get_regex_logits_processor (self , regex : str ):
Original file line number Diff line number Diff line change 2929)
3030import jsonschema
3131from genson import SchemaBuilder
32- # TODO: change this once the import issue is fixed in outlines_core
33- from outlines_core import outlines_core
3432from pydantic import (
3533 BaseModel ,
3634 GetCoreSchemaHandler ,
3937)
4038from pydantic .json_schema import JsonSchemaValue
4139from pydantic_core import core_schema as cs
40+ from outlines_core .json_schema import build_regex_from_schema
4241
4342import outlines .types as types
4443from outlines import grammars
@@ -916,7 +915,7 @@ def to_regex(term: Term) -> str:
916915 elif isinstance (term , Regex ):
917916 return f"({ term .pattern } )"
918917 elif isinstance (term , JsonSchema ):
919- regex_str = outlines_core . json_schema . build_regex_from_schema (term .schema , term .whitespace_pattern )
918+ regex_str = build_regex_from_schema (term .schema , term .whitespace_pattern )
920919 return f"({ regex_str } )"
921920 elif isinstance (term , Choice ):
922921 regexes = [to_regex (python_types_to_terms (item )) for item in term .items ]
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ dependencies = [
3131 " jsonschema" ,
3232 " pillow" ,
3333 " typing_extensions" ,
34- " outlines_core==0.2.11 " ,
34+ " outlines_core==0.2.14 " ,
3535 " genson" ,
3636 " jsonpath_ng" ,
3737]
You can’t perform that action at this time.
0 commit comments