agentscope.utils.common module
Common utils.
- agentscope.utils.common.timer(seconds: int | float | None = None) Generator [源代码]
A context manager that limits the execution time of a code block to a given number of seconds. The implementation of this contextmanager are borrowed from https://github.com/openai/human-eval/blob/master/human_eval/execution.py
备注
This function only works in Unix and MainThread, since signal.setitimer is only available in Unix.
- agentscope.utils.common.create_tempdir() Generator [源代码]
A context manager that creates a temporary directory and changes the current working directory to it. The implementation of this contextmanager are borrowed from https://github.com/openai/human-eval/blob/master/human_eval/execution.py