Example
The following agent will generate an answer and save it in a file.cookbook/tools/file_tools.py
Toolkit Params
| Parameter | Type | Default | Description |
|---|---|---|---|
base_dir | Path | None | Specifies the base directory path for file operations |
enable_save_file | bool | True | Enables functionality to save files |
enable_delete_file | bool | False | Enables functionality to delete files |
enable_read_file | bool | True | Enables functionality to read files |
enable_read_file_chunks | bool | True | Enables functionality to read files in chunks |
enable_replace_file_chunk | bool | True | Enables functionality to update files in chunks |
enable_list_files | bool | True | Enables functionality to list files in directories |
enable_search_files | bool | True | Enables functionality to search for files |
all | bool | False | Enables all functionality when set to True |
expose_base_directory | bool | False | Adds ‘base_directory’ to the tool responses if set to True |
max_file_length | int | 10000000 | Maximum file length to read in bytes. Reading will fail if the file is larger. |
max_file_lines | int | 100000 | Maximum number of lines to read from a file. Reading will fail if the file has more lines. |
line_separator | str | "\n" | The separator to use when interacting with chunks. |
Toolkit Functions
| Name | Description |
|---|---|
save_file | Saves the contents to a file called file_name and returns the file name if successful. |
read_file | Reads the contents of the file file_name and returns the contents if successful. |
read_file_chunks | Reads the contents of the file file_name in chunks and returns the contents if successful. |
replace_file_chunk | Partial replace of the contents of the file file_name |
delete_file | Deletes the file file_name if successful. |
list_files | Returns a list of files in the base directory |