Make save/load state for agent async (#4195)

This commit is contained in:
Jack Gerrits
2024-11-15 10:38:01 -05:00
committed by GitHub
parent 88229513e5
commit 2b565713d0
8 changed files with 22 additions and 22 deletions

View File

@@ -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"]