-
Notifications
You must be signed in to change notification settings - Fork 352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support callable model in agentbase #53
Conversation
…model # Conflicts: # docs/sphinx_doc/source/tutorial/203-model.md
…model # Conflicts: # README.md # README_ZH.md # src/agentscope/agents/dialog_agent.py # src/agentscope/agents/dict_dialog_agent.py # src/agentscope/agents/text_to_image_agent.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Shall we have an example of passing a model to initialize an agent?
- See inline comments
@@ -48,7 +49,8 @@ def __init__( | |||
sys_prompt (`Optional[str]`): | |||
The system prompt of the agent, which can be passed by args | |||
or hard-coded in the agent. | |||
model_config_name (`str`, defaults to None): | |||
config_name_or_model (`[str, Callable[..., Any]`, defaults to | |||
None): | |||
The name of the model config, which is used to load model from |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"name of the model config to load model from configuration, or a callable instance of model for inference"? Same for DialogAgent and other agents
"use_memory": true | ||
} | ||
} | ||
``` | ||
|
||
在这个配置中,Player1被指定为一个DictDialogAgent。参数包括一个系统提示(sys_prompt),它可以指导agent的行为;一个模型配置名(model_config_name),它决定了模型配置的名称;以及一个标志(use_memory),指示agent是否应该记住过去的互动。 | ||
在这个配置中,Player1被指定为一个DictDialogAgent。参数包括一个系统提示(sys_prompt),它可以指导agent | ||
的行为;一个模型配置名(config_name_or_model),它决定了模型配置的名称;以及一个标志(use_memory),指示agent是否应该记住过去的互动。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
“或一个可直接调用的模型推理函数”
Description
Background
Since more and more model wrappers are added into AgentScope, maybe it's not a good idea to list "how to set model configs" for all wrappers in our README.md and tutorial.
Therefore, we should support to pass callable model into agent, enabling developers to skip setting model config, and just choose the model wrappers under
agentscope.models
.By this way, we only need to add new wrapper class, together with its docstring, rather than updating README.md and tutorial for each time.
Note
This is an important change. Maybe we will move away from using model config, please check if it's appropriate.
Checklist
Please check the following items before code is ready to be reviewed.