outlines_core
Backend class for Outlines Core.
OutlinesCoreBackend
Bases: BaseBackend
Backend for Outlines Core.
Source code in outlines/backends/outlines_core.py
__init__(model)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
SteerableModel
|
The Outlines model of the user. |
required |
get_cfg_logits_processor(grammar)
Create a logits processor from a context-free grammar.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
grammar
|
str
|
The context-free grammar to create a logits processor from. For Outlines Core, the grammar must use the Lark format. |
required |
Returns:
Type | Description |
---|---|
LogitsProcessor
|
The logits processor to use to constrain the generation. |
Source code in outlines/backends/outlines_core.py
get_fsm_logits_processor(fsm)
Create a logits processor from an interegular FSM.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fsm
|
FSM
|
The interegular FSM to create a logits processor from. |
required |
Returns:
Type | Description |
---|---|
LogitsProcessor
|
The logits processor to use to constrain the generation. |
Source code in outlines/backends/outlines_core.py
get_json_schema_logits_processor(json_schema)
Create a logits processor from a JSON schema.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
json_schema
|
str
|
The JSON schema to create a logits processor from. |
required |
Returns:
Type | Description |
---|---|
LogitsProcessor
|
The logits processor to use to constrain the generation. |
Source code in outlines/backends/outlines_core.py
get_regex_logits_processor(regex)
Create a logits processor from a regex.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
regex
|
str
|
The regex to create a logits processor from. |
required |
Returns:
Type | Description |
---|---|
LogitsProcessor
|
The logits processor to use to constrain the generation. |