Simple types
Sibila can constrain model generation to output simple python types. This is helpful for situations where you want to extract a specific data type.
To get a response from the model in a certain type, you can use the extract() method:
Example
Instructions to help the model#
You may need to provide more extra information to the model, so that it understands what you want. This is done with the inst argument - inst is a shorter name for instructions:
Example
Supported types#
The following simple types are supported:
- bool
- int
- float
- str
- datetime
About datetime type
A special note about extracting to datetime: the datetime type is expecting an ISO 8601 formatted string. Because some models are less capable than others at correctly formatting dates/times, it helps to mention in the instructions that you want the output in "ISO 8601" format.
Lists#
You can extract lists of any of the supported types (simple types, enum, dataclass, Pydantic).
Example
As in all extractions, you may need to set the instructions text to specify what you want from the model. Just as an example of the power of instructions, let's add instructions asking for country output: it will still output a list, but with a single element - 'Italy':