langchain_community.agent_toolkits.file_management.toolkit.FileManagementToolkit¶
class langchain_community.agent_toolkits.file_management.toolkit.FileManagementToolkit[source]¶
Bases: BaseToolkit
Toolkit for interacting with local files.
Security Notice: This toolkit provides methods to interact with local files.If providing this toolkit to an agent on an LLM, ensure you scope
the agent’s permissions to only include the necessary permissions
to perform the desired operations.
By default the agent will have access to all files within
the root dir and will be able to Copy, Delete, Move, Read, Write
and List files in that directory.
Consider the following:
- Limit access to particular directories using root_dir.
- Use filesystem permissions to restrict access and permissions to only
the files and directories required by the agent.
Limit the tools available to the agent to only the file operations
necessary for the agent’s intended use.
Sandbox the agent by running it in a container.
See https://python.langchain.com/docs/security for more information.
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¶
If specified, all file operations are made relative to root_dir.
param selected_tools: Optional[List[str]] = None¶
If provided, only provide the selected tools. Defaults to all.
classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model¶
Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data.
Default values are respected, but no other validation is performed.
Behaves as if Config.extra = ‘allow’ was set since it adds all passed values