langchain.tools.file_management.utils.BaseFileToolMixin¶

class langchain.tools.file_management.utils.BaseFileToolMixin(*, root_dir: Optional[str] = None)[source]¶

Bases: BaseModel

Mixin for file system tools.

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

param root_dir: Optional[str] = None¶

The final path will be chosen relative to root_dir if specified.

get_relative_path(file_path: str) Path[source]¶

Get the relative path, returning an error if unsupported.