Skip to content

Commit

Permalink
Update user interface.
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoLjl committed Nov 22, 2024
1 parent 3017085 commit a5d98a6
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 19 deletions.
8 changes: 8 additions & 0 deletions autogen/agentchat/contrib/captainagent.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ def __init__(
code_execution_config: Optional[Union[Dict, Literal[False]]] = False,
nested_config: Optional[Dict] = None,
agent_config_save_path: Optional[str] = None,
agent_lib: Optional[str] = None,
tool_lib: Optional[str] = None,
description: Optional[str] = DEFAULT_DESCRIPTION,
**kwargs,
):
Expand Down Expand Up @@ -177,6 +179,12 @@ def __init__(
nested_config = self._update_config(self.DEFAULT_NESTED_CONFIG, nested_config)
if nested_config["group_chat_llm_config"] is None:
nested_config["group_chat_llm_config"] = llm_config.copy()
if agent_lib:
nested_config["autobuild_build_config"]["library_path_or_json"] = agent_lib
if tool_lib:
if "autobuild_tool_config" not in nested_config:
nested_config["autobuild_tool_config"] = {}
nested_config["autobuild_tool_config"]["tool_root"] = tool_lib

self.assistant = ConversableAgent(name="CaptainAgent", system_message=system_message, llm_config=llm_config)
self.assistant.update_tool_signature(self.AUTOBUILD_TOOL, is_remove=False)
Expand Down
5 changes: 4 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@
elif current_os == "Linux":
retrieve_chat_pgvector.extend(["psycopg>=3.1.18"])

autobuild = ["chromadb", "sentence-transformers", "huggingface-hub", "pysqlite3"]

extra_require = {
"test": [
"ipykernel",
Expand All @@ -86,7 +88,8 @@
"retrievechat-mongodb": [*retrieve_chat, "pymongo>=4.0.0"],
"retrievechat-qdrant": [*retrieve_chat, "qdrant_client", "fastembed>=0.3.1"],
"graph_rag_falkor_db": graph_rag_falkor_db,
"autobuild": ["chromadb", "sentence-transformers", "huggingface-hub", "pysqlite3"],
"autobuild": autobuild,
"captainagent": autobuild,
"teachable": ["chromadb"],
"lmm": ["replicate", "pillow"],
"graph": ["networkx", "matplotlib"],
Expand Down
17 changes: 4 additions & 13 deletions website/blog/2024-11-15-CaptainAgent/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -61,27 +61,18 @@ To use agents from an agent library, you just need to specify a `library_path` s
from autogen.agentchat.contrib.captain_agent import CaptainAgent
from autogen import UserProxyAgent

general_llm_config = {
llm_config = {
"temperature": 0,
"config_list": autogen.config_list_from_json("OAI_CONFIG_LIST", filter_dict={"model": ["gpt-4-1106-preview"]}),
}

nested_mode_config = {
# this is used to configure the building process
"autobuild_build_config": {
"library_path": "captainagent_expert_library.json"
},
# this is used to configure tool library
"autobuild_tool_config": {
"tool_root": "default", # this will use the tool library we provide
}
}

## build agents
captain_agent = CaptainAgent(
name="captain_agent",
llm_config=general_llm_config,
llm_config=llm_config,
nested_mode_config=nested_mode_config,
agent_lib="captainagent_expert_library.json",
tool_lib="default",
code_execution_config={"use_docker": False, "work_dir": "groupchat"},
)
user_proxy = UserProxyAgent(
Expand Down
10 changes: 5 additions & 5 deletions website/docs/topics/captainagent/configurations.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Details of all the available configurations
# Configurations in `nested_config`
Captain Agent requires `nested_config` for configuration. Below is an example, we will break it down and provide a detailed explanation.

```
Expand All @@ -25,7 +25,7 @@ nested_config = {


## `autobuild_init_config`
This section is used to configure the initial setup of autobuild.
This section is used to configure the initial setup of autobuild. `autobuild_init_config` takes in arguments from `AgentBuilder.__init__()`. Check the full list of arguments [here](https://github.com/ag2ai/ag2/blob/main/autogen/agentchat/contrib/agent_builder.py#L181).

### `config_file_or_env`
Configures the path to API key config. Defaults to `OAI_CONFIG_LIST`.
Expand All @@ -36,11 +36,11 @@ Configures the backbone of agent builder. The builder is used for agent selectio
### `agent_model`
Configures the backbone of agents in the group chat. Defaults to `gpt-4o-mini`.

### `kwargs`
### Other `kwargs`
`autobuild_init_config` takes in arguments from `AgentBuilder.__init__()`. Check the full list of arguments [here](https://github.com/ag2ai/ag2/blob/main/autogen/agentchat/contrib/agent_builder.py#L181).

## `autobuild_build_config`
This section is used to configure the building process of autobuild.
This section is used to configure the building process of autobuild. `autobuild_build_config` takes in arguments for `AgentBuilder.build()`. Check the full list of arguments [here](https://github.com/ag2ai/ag2/blob/main/autogen/agentchat/contrib/agent_builder.py#L365).

### `default_llm_config`
Configures the default parameters for the builder during the autobuild process. Defaults to `{"temperature": 1, "top_p": 0.95, "max_tokens": 2048}`. `config_list` is **not* needed here.
Expand All @@ -67,7 +67,7 @@ Specifies the root directory of the tool library. When set to `'default'`, it wi
Configures the retriever model used for fetching relevant tools from the library. Defaults to `all-mpnet-base-v2`. The value is valid as long as it is found by [SentenceTransformers library](https://huggingface.co/sentence-transformers).

## `group_chat_config`
This section is used to configure the group chat settings.
This section is used to configure the group chat settings. `group_chat_config` also takes in arguments for initializing `autogen.GroupChat`. Refer to all the configurables [here](https://ag2ai.github.io/ag2/docs/reference/agentchat/groupchat).

### `max_round`
Specifies the maximum number of rounds in a group chat session. Defaults to `10`.
Expand Down

0 comments on commit a5d98a6

Please sign in to comment.