Skip to content

Commit

Permalink
Bump outlines-core to v0.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
yvan-sraka committed Feb 11, 2025
1 parent 69418da commit 2c875b2
Show file tree
Hide file tree
Showing 10 changed files with 768 additions and 31 deletions.
3 changes: 2 additions & 1 deletion benchmarks/bench_json_schema.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from outlines_core.fsm.json_schema import build_regex_from_schema
from outlines_core import Guide as CoreGuide, Index, Vocabulary
from outlines_core.json_schema import build_regex_from_schema

from outlines.caching import cache_disabled
from outlines.fsm.guide import RegexGuide
Expand Down
5 changes: 2 additions & 3 deletions docs/cookbook/chain_of_thought.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,9 @@ json_schema = Reasoning.model_json_schema()
We could generate a response using the json schema but for a change we will use the regex:

```python
from outlines.fsm.json_schema import convert_json_schema_to_str
from outlines_core.fsm.json_schema import build_regex_from_schema
from outlines_core.json_schema import build_regex_from_schema

schema_str = convert_json_schema_to_str(json_schema=json_schema)
schema_str = convert_json_schema_to_str(json_schema=json_schema) # FIXME: update that usage example...
regex_str = build_regex_from_schema(schema_str)
```

Expand Down
5 changes: 2 additions & 3 deletions docs/cookbook/react_agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,10 @@ class Decision(BaseModel):
We could generate a response using the json schema but we will use the regex and check that everything is working as expected:

```python
from outlines.fsm.json_schema import convert_json_schema_to_str
from outlines_core.fsm.json_schema import build_regex_from_schema
from outlines_core.json_schema import build_regex_from_schema

json_schema = Decision.model_json_schema()
schema_str = convert_json_schema_to_str(json_schema=json_schema)
schema_str = convert_json_schema_to_str(json_schema=json_schema) # FIXME: update that usage example...
regex_str = build_regex_from_schema(schema_str)
print(regex_str)
# '\\{[ ]?"Decision"[ ]?:[ ]?(\\{[ ]?"Scratchpad"[ ]?:[ ]?"([^"\\\\\\x00-\\x1F\\x7F-\\x9F]|\\\\["\\\\])*"[ ]?,[ ]?"Thought"[ ]?:[ ]?"([^"\\\\\\x00-\\x1F\\x7F-\\x9F]|\\\\["\\\\])*"[ ]?,[ ]?"Action"[ ]?:[ ]?("wikipedia"|"calculate")[ ]?,[ ]?"Action_Input"[ ]?:[ ]?"([^"\\\\\\x00-\\x1F\\x7F-\\x9F]|\\\\["\\\\])*"[ ]?\\}|\\{[ ]?"Scratchpad"[ ]?:[ ]?"([^"\\\\\\x00-\\x1F\\x7F-\\x9F]|\\\\["\\\\])*"[ ]?,[ ]?"Final_Answer"[ ]?:[ ]?"([^"\\\\\\x00-\\x1F\\x7F-\\x9F]|\\\\["\\\\])*"[ ]?\\})[ ]?\\}'
Expand Down
Loading

0 comments on commit 2c875b2

Please sign in to comment.