Example
The following agent will generate an answer and save it in a file.cookbook/14_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_chunk | bool | True | Enables functionality to read files in line ranges |
enable_replace_file_chunk | bool | True | Enables functionality to update files in line ranges |
enable_list_files | bool | True | Enables functionality to list files in directories |
enable_search_files | bool | True | Enables functionality to search for files by glob pattern |
enable_search_content | bool | True | Enables functionality to search inside file contents |
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 fails if the file is larger. |
max_file_lines | int | 100000 | Maximum number of lines to read from a file. Reading fails if the file has more lines. |
line_separator | str | "\n" | The separator to use when interacting with file 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_chunk | Reads selected lines from file_name (start_line to end_line). |
replace_file_chunk | Replaces a selected line range in file_name. |
delete_file | Deletes the file file_name if successful. |
list_files | Returns a list of files in the base directory |
search_files | Searches for files by glob pattern (for example **/*.py). |
search_content | Searches text file contents and returns matching files with snippets. |
Developer Resources
- View Tools