Skip to content

Commit

Permalink
[HOTFIX] Fix the bug in distribution mode where model configurations …
Browse files Browse the repository at this point in the history
…are missing (#428)
  • Loading branch information
pan-x-c authored Aug 29, 2024
1 parent aa356d2 commit ff9e9a8
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/agentscope/manager/_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""A manager for AgentScope."""
import os
from typing import Union, Any
from copy import deepcopy

from loguru import logger

Expand Down Expand Up @@ -166,7 +167,7 @@ def state_dict(self) -> dict:
serialized_data["studio"] = _studio_client.state_dict()
serialized_data["monitor"] = self.monitor.state_dict()

return serialized_data
return deepcopy(serialized_data)

def load_dict(self, data: dict) -> None:
"""Load the runtime information from a dictionary"""
Expand Down
11 changes: 11 additions & 0 deletions tests/custom/test_model_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[
{
"config_name": "qwen",
"model_type": "dashscope_chat",
"model_name": "qwen-max",
"api_key": "xxx",
"generate_args": {
"temperature": 0.5
}
}
]
17 changes: 17 additions & 0 deletions tests/rpc_agent_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,13 @@ def setUp(self) -> None:
agentscope.init(
project="test",
name="rpc_agent",
model_configs=os.path.abspath(
os.path.join(
os.path.abspath(os.path.dirname(__file__)),
"custom",
"test_model_config.json",
),
),
save_dir="./.unittest_runs",
save_log=True,
)
Expand Down Expand Up @@ -677,6 +684,16 @@ def test_agent_server_management_funcs(self) -> None:
self.assertEqual(remote_content, local_content)
agent_lists = client.get_agent_list()
self.assertEqual(len(agent_lists), 2)
# test existing model config
DialogAgent(
name="dialogue",
sys_prompt="You are a helful assistant.",
model_config_name="qwen",
to_dist={
"host": "localhost",
"port": launcher.port,
},
)
# model not exists error
self.assertRaises(
Exception,
Expand Down

0 comments on commit ff9e9a8

Please sign in to comment.