mirror of
https://github.com/microsoft/autogen.git
synced 2026-04-20 03:02:16 -04:00
Make save/load state for agent async (#4195)
This commit is contained in:
@@ -250,12 +250,12 @@ class ChatCompletionAgent(RoutedAgent):
|
||||
result_as_str = f"Error: {str(e)}"
|
||||
return (result_as_str, call_id)
|
||||
|
||||
def save_state(self) -> Mapping[str, Any]:
|
||||
async def save_state(self) -> Mapping[str, Any]:
|
||||
return {
|
||||
"memory": self._model_context.save_state(),
|
||||
"system_messages": self._system_messages,
|
||||
}
|
||||
|
||||
def load_state(self, state: Mapping[str, Any]) -> None:
|
||||
async def load_state(self, state: Mapping[str, Any]) -> None:
|
||||
self._model_context.load_state(state["memory"])
|
||||
self._system_messages = state["system_messages"]
|
||||
|
||||
Reference in New Issue
Block a user