-
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbase_node.py
More file actions
33 lines (24 loc) · 926 Bytes
/
base_node.py
File metadata and controls
33 lines (24 loc) · 926 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
"""
OVERTLI STUDIO LLM Suite - Base Node
Shared validation helpers for OVERTLI nodes.
"""
from __future__ import annotations
from .exceptions import OvertliInputError
class GZBaseNode:
"""Common validation helpers for node inputs."""
@staticmethod
def require_prompt(prompt: str, input_name: str = "prompt") -> str:
"""Return normalized prompt text or raise if empty."""
value = (prompt or "").strip()
if not value:
raise OvertliInputError("Prompt cannot be empty", input_name=input_name)
return value
@staticmethod
def clamp_timeout(timeout_seconds: int, minimum: int = 1, maximum: int = 1200) -> int:
"""Clamp timeout to a safe range for external calls."""
if timeout_seconds < minimum:
return minimum
if timeout_seconds > maximum:
return maximum
return timeout_seconds
__all__ = ["GZBaseNode"]