Skip to content
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

Closed
wants to merge 7 commits into from

Conversation

DavdGao
Copy link
Collaborator

@DavdGao DavdGao commented Mar 8, 2024

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.

  • Code has passed all tests
  • Docstrings have been added/updated in Google Style
  • Documentation has been updated
  • Code is ready for review

@DavdGao DavdGao added enhancement New feature or request ready for review labels Mar 14, 2024
DavdGao added 3 commits March 19, 2024 21:30
…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
Copy link
Collaborator

@ZiTao-Li ZiTao-Li left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Shall we have an example of passing a model to initialize an agent?
  2. 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
Copy link
Collaborator

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是否应该记住过去的互动。
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

“或一个可直接调用的模型推理函数”

@DavdGao DavdGao closed this Apr 8, 2024
myh-0521 pushed a commit to myh-0521/agentscope that referenced this pull request Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants