Ensure Dir • AI Agent SDK
ensure_dir: Ensure a directory exists, creating it if necessary.
ensure_dir
Function
</div>
This function is defined in the paths module.
Ensure a directory exists, creating it if necessary.
Signature
def ensure_dir(path: Union[str, Path]) -> PathParameters
ParamField
Union[str, Path]Directory path to ensure exists
Returns
ResponseField
PathPath object for the directory
Usage
>>> from praisonaiagents.paths import ensure_dir, get_sessions_dir
>>> sessions = ensure_dir(get_sessions_dir())Uses
Pathpath.mkdir
Source
View on GitHubpraisonaiagents/paths.py at line 535