String#
As LLMs are language models, working with text is inevitable. Langworks provides various utilities
to ease this interaction. They may be accessed through the langworks.util.string
module.
- langworks.util.string.clean_multiline(string: str)#
Removes unwanted newlines and indentations from Python multiline string blocks (triple quote strings).
By default this function removes only indentations automatically. Newlines that need to be removed need to be marked as such by inserting
\\
before the end of the line:clean_multiline( """ This is a wrapping \\ line """ ) == "This is a wrapping line"
Parameters#
- string
String to clean.