modelscope / agentscope

Start building LLM-empowered multi-agent applications in an easier way.
https://doc.agentscope.io/
Apache License 2.0
4.81k stars 294 forks source link

Fix default value setting for save_dir parameter in agentscope.init #393

Closed TangJiakai closed 1 month ago

TangJiakai commented 1 month ago

name: Pull Request about: Create a pull request

Description

In the current implementation, when the user does not specify the save_dir parameter in the external configuration, the agentscope.init method still requires the user to import _DEFAULT_SAVE_DIR to fulfill the default value setting. This is inconvenient, especially when users want to flexibly set the save_dir through configuration files.

Checklist

Please check the following items before code is ready to be reviewed.

TangJiakai commented 1 month ago

Modify the agentscope.init method to make the default value setting of the save_dir parameter more flexible. If the user does not specify save_dir in the external configuration, _DEFAULT_SAVE_DIR will be automatically used as the default value. This change eliminates the need for users to manually import _DEFAULT_SAVE_DIR, e.g., We have to import _DEFAULT_SAVE_DIR to meet the requirements

agentscope.init(
    project=self.config["project_name"],
    save_code=False,
    save_api_invoke=False,
    model_configs=self.config["model_configs_path"]
    ),
    use_monitor=False,
    save_dir=(
        self.config["save_dir"] or _DEFAULT_SAVE_DIR
    ),
)

We have to import _DEFAULT_SAVE_DIR to meet the requirements

DavdGao commented 1 month ago

I'm confused about the statement

when the user does not specify the save_dir parameter in the external configuration, the agentscope.init method still requires the user to import _DEFAULT_SAVE_DIR to fulfill the default value setting.

Why does agentscope.init requires the user to import _DEFAULT_SAVE_DIR? To use the default directory, just leave the parameter save_dir for empty?