agentscope.session

The session module in agentscope.

class SessionBase[源代码]

基类:object

The base class for session in agentscope.

__init__(session_id)[源代码]

Initialize the session base class

参数:

session_id (str)

返回类型:

None

session_id: str

The session id

abstract async save_session_state(**state_modules_mapping)[源代码]

Save the session state

参数:

state_modules_mapping (StateModule)

返回类型:

None

abstract async load_session_state(*args, **kwargs)[源代码]

Load the session state

参数:
  • args (Any)

  • kwargs (Any)

返回类型:

None

class JSONSession[源代码]

基类:SessionBase

The JSON session class.

__init__(session_id, save_dir)[源代码]

Initialize the JSON session class.

参数:
  • session_id (str) -- The session id.

  • save_dir (str) -- The directory to save the session state.

返回类型:

None

property save_path: str

The path to save the session state.

async save_session_state(**state_modules_mapping)[源代码]

Load the state dictionary from a JSON file.

参数:

**state_modules_mapping (dict[str, StateModule]) -- A dictionary mapping of state module names to their instances.

返回类型:

None

async load_session_state(**state_modules_mapping)[源代码]

Get the state dictionary to be saved to a JSON file.

参数:

state_modules_mapping (list[StateModule]) -- The list of state modules to be loaded.

返回类型:

None