Download src/utils/ids.py from danishk84/NovaGuide: direct link, hf CLI and curl.
- Browser
- Download file 598 Bytes
-
https://huggingface.co/spaces/danishk84/NovaGuide/resolve/main/src/utils/ids.py
- Command line
-
hf download hf://spaces/danishk84/NovaGuide/src/utils/ids.py
-
curl -L -o ids.py https://huggingface.co/spaces/danishk84/NovaGuide/resolve/main/src/utils/ids.py
598 Bytes
| """Identifier helpers for sessions, interactions, and analytics events.""" | |
| from uuid import uuid4 | |
| def generate_event_id(prefix: str) -> str: | |
| """Generate a UUID4 identifier with a readable, normalised prefix.""" | |
| clean_prefix = prefix.strip().rstrip("_") or "evt" | |
| return f"{clean_prefix}_{uuid4()}" | |
| def generate_session_id() -> str: | |
| """Generate a session identifier prefixed with ``sess_``.""" | |
| return generate_event_id("sess") | |
| def generate_interaction_id() -> str: | |
| """Generate an interaction identifier prefixed with ``int_``.""" | |
| return generate_event_id("int") | |