agentscope.service.file.common module

Common operators for file and directory.

agentscope.service.file.common.create_file(file_path: str, content: str = '') ServiceResponse[源代码]

Create a file and write content to it.

参数:
  • file_path (str) – The path where the file will be created.

  • content (str) – Content to write into the file.

返回:

Where the boolean indicates success, and the str contains an error message if any, including the error type.

返回类型:

ServiceResponse

agentscope.service.file.common.delete_file(file_path: str) ServiceResponse[源代码]

Delete a file specified by the file path.

参数:

file_path (str) – The path of the file to be deleted.

返回:

Where the boolean indicates success, and the str contains an error message if any, including the error type.

返回类型:

ServiceResponse

agentscope.service.file.common.move_file(source_path: str, destination_path: str) ServiceResponse[源代码]

Move a file from a source path to a destination path.

参数:
  • source_path (str) – The current path of the file.

  • destination_path (str) – The new path for the file.

返回:

Where the boolean indicates success, and the str contains an error message if any, including the error type.

返回类型:

ServiceResponse

agentscope.service.file.common.create_directory(directory_path: str) ServiceResponse[源代码]

Create a directory at the specified path.

参数:

directory_path (str) – The path where the directory will be created.

返回:

where the boolean indicates success, and the str contains an error message if any, including the error type.

返回类型:

ServiceResponse

agentscope.service.file.common.delete_directory(directory_path: str) ServiceResponse[源代码]

Delete a directory and all of its contents.

参数:

directory_path (str) – The path of the directory to be deleted.

返回:

Where the boolean indicates success, and the str contains an error message if any, including the error type.

返回类型:

ServiceResponse

agentscope.service.file.common.move_directory(source_path: str, destination_path: str) ServiceResponse[源代码]

Move a directory from a source path to a destination path.

参数:
  • source_path (str) – The current path of the directory.

  • destination_path (str) – The new path for the directory.

返回:

Where the boolean indicates success, and the str contains an error message if any, including the error type.

返回类型:

ServiceResponse

agentscope.service.file.common.list_directory_content(directory_path: str) ServiceResponse[源代码]

List the contents of a directory. i.e. ls -a

参数:

directory_path (str) – The path of the directory to show.

返回:

The results contain a list of direcotry contents, or an error message if any, including the error type.

返回类型:

ServiceResponse

agentscope.service.file.common.get_current_directory() ServiceResponse[源代码]

Get the current working directory path.

返回:

The current working directory path, or an error message if any, including the error type.

返回类型:

ServiceResponse