fabricatio_actions.actions.fs

A module for file system utilities.

Classes

ReadText

Read text from a file.

DumpText

Dump text to a file.

SmartReadText

Read text from a file using LLM.

SmartDumpText

Dump text to a file using LLM.

Module Contents

class fabricatio_actions.actions.fs.ReadText(/, **data: Any)

Bases: fabricatio_core.models.action.Action, fabricatio_actions.models.generic.FromMapping

Read text from a file.

ctx_override: ClassVar[bool] = True

Whether to override the instance attr by the context variable.

output_key: str = 'read_text'

The key used to store this action’s output in the context dictionary.

read_path: str | pathlib.Path | None = None

Path to the file to read.

classmethod from_mapping(mapping: Mapping[str, str | pathlib.Path], **kwargs: Any) List[Self]

Create a list of ReadText actions from a mapping of output_key to read_path.

class fabricatio_actions.actions.fs.DumpText(/, **data: Any)

Bases: fabricatio_core.models.action.Action, fabricatio_actions.models.generic.FromMapping

Dump text to a file.

ctx_override: ClassVar[bool] = True

Whether to override the instance attr by the context variable.

dump_path: str | pathlib.Path | None = None

Path to the file to dump.

text_key: str = 'text'

Key of the text to dump.

classmethod from_mapping(mapping: Mapping[str, str | pathlib.Path], **kwargs: Any) List[Self]

Create a list of DumpText actions from a mapping of output_key to dump_path.

class fabricatio_actions.actions.fs.SmartReadText(/, **data: Any)

Bases: ReadText, fabricatio_core.capabilities.usages.UseLLM

Read text from a file using LLM.

class fabricatio_actions.actions.fs.SmartDumpText(/, **data: Any)

Bases: DumpText, fabricatio_core.capabilities.usages.UseLLM

Dump text to a file using LLM.