modifiers
¶
ApplStr
¶
ApplStr(
sep: Optional[str] = None,
indexing: Union[Indexing, Optional[str]] = None,
indent: Optional[Union[str, int]] = None,
new_indent: Optional[Union[str, int]] = None,
is_inline: Optional[bool] = None,
role: Optional[MessageRole] = None,
_ctx: Optional[PromptContext] = None,
)
Bases: Compositor
A compositor that represents a string in the prompt.
Attributes:
-
_sep–The class default separator string is an empty string.
-
_new_indent–The class default new indentation string is an empty string.
-
_is_inline–The class default inline flag is True.
Examples:
Parameters:
-
sep(Optional[str], default:None) –The separator string. Defaults to use the class default.
-
indexing(Union[Indexing, Optional[str]], default:None) –The indexing mode. Defaults to use the class default.
-
indent(Optional[Union[str, int]], default:None) –The indentation string. Defaults to use the class default.
-
new_indent(Optional[Union[str, int]], default:None) –The new indentation string. Defaults to use the class default.
-
is_inline(Optional[bool], default:None) –Flag indicating if the modifier is inline. Defaults to use the class default.
-
role(Optional[MessageRole], default:None) –The role of the modifier. Defaults to use the class default.
-
_ctx(Optional[PromptContext], default:None) –The prompt context filled automatically by the APPL function.
Source code in src/appl/core/modifiers.py
Compositor
¶
Compositor(
sep: Optional[str] = None,
indexing: Union[Indexing, Optional[str]] = None,
indent: Optional[Union[str, int]] = None,
new_indent: Optional[Union[str, int]] = None,
is_inline: Optional[bool] = None,
role: Optional[MessageRole] = None,
_ctx: Optional[PromptContext] = None,
)
Bases: PrinterModifier
The contextual compositor of the prompts.
This class represents a contextual compositor that modifies the behavior of the printer. It provides various options for customizing the output format of the prompts within this context manager.
Attributes:
-
_sep(Optional[str]) –The class default separator string is None, indicating inherit from the parent.
-
_indexing(Indexing) –The class default indexing mode is empty indexing.
-
_inc_indent(str) –The class default indentation string is empty string.
-
_new_indent(Optional[str]) –The class default new indentation string is None, indicating not overwrite the indent.
-
_is_inline(bool) –The class default inline flag is False.
-
_new_role(Optional[MessageRole]) –The class default role of the modifier is None, indicating not overwrite the role.
Parameters:
-
sep(Optional[str], default:None) –The separator string. Defaults to use the class default.
-
indexing(Union[Indexing, Optional[str]], default:None) –The indexing mode. Defaults to use the class default.
-
indent(Optional[Union[str, int]], default:None) –The indentation string. Defaults to use the class default.
-
new_indent(Optional[Union[str, int]], default:None) –The new indentation string. Defaults to use the class default.
-
is_inline(Optional[bool], default:None) –Flag indicating if the modifier is inline. Defaults to use the class default.
-
role(Optional[MessageRole], default:None) –The role of the modifier. Defaults to use the class default.
-
_ctx(Optional[PromptContext], default:None) –The prompt context filled automatically by the APPL function.
Source code in src/appl/core/modifiers.py
PrinterModifier
¶
PrinterModifier(_ctx: Optional[PromptContext] = None)
Bases: AbstractContextManager
The contextual compositor of the prompt printer.
Controls the behavior of the prompt printer within the context manager. Should only be used within the APPL function.
Parameters:
-
_ctx(Optional[PromptContext], default:None) –The prompt context filled automatically by the APPL function.