Preprocessors¶
bells_o.preprocessors ¶
Initialize submodule.
PreProcessing ¶
Bases: ABC
Abstract PreProcessing class that needs to be concretised.
Source code in src/bells_o/preprocessors/preprocessing.py
process
abstractmethod
¶
Preprocess a given string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
string
|
str
|
Text string to preprocess. |
required |
*args
|
Any
|
Any other arguments that concrete classes need. |
()
|
**kwargs
|
Any
|
Any other keyword arguments that concrete classes need. |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Preprocessed string. |
Source code in src/bells_o/preprocessors/preprocessing.py
RoleWrapper ¶
Bases: PreProcessing
Implement the wrapper to acommodate message dictionaries.
Maps from string to message dictionary.
Source code in src/bells_o/preprocessors/role_wrapper.py
process ¶
Wrap a string to conform to the dictionary list template necessary for IT models on HF.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
string
|
str
|
Text string to preprocess. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
list |
list[dict[str, str]]
|
Wrapped string. |
Source code in src/bells_o/preprocessors/role_wrapper.py
TemplateWrapper ¶
Bases: PreProcessing
Implement a preprocessor that wraps a prompt in a template.
It is essentially a PreProcessing-wrapper class for formatting of this nature: "foo {prompt} foo".format(prompt=sample_prompt).
Make sure to have the {prompt} label in your template string.
```
Source code in src/bells_o/preprocessors/template_wrapper.py
process ¶
Wrap fill in the {prompt} label for a template in .
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
string
|
str
|
Text string to fill into template. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
list |
str
|
Filled in template string. |