Spaces:
Running
Running
zach
commited on
Commit
·
982a304
1
Parent(s):
140521a
Improve error messages raised in validate_prompt_length util
Browse files- src/utils.py +4 -4
src/utils.py
CHANGED
@@ -107,15 +107,15 @@ def validate_prompt_length(prompt: str, max_length: int, min_length: int) -> Non
|
|
107 |
# Check if prompt is too short
|
108 |
if prompt_length < min_length:
|
109 |
raise ValueError(
|
110 |
-
f'
|
111 |
-
f'
|
112 |
)
|
113 |
|
114 |
# Check if prompt exceeds max length
|
115 |
if prompt_length > max_length:
|
116 |
raise ValueError(
|
117 |
-
f'
|
118 |
-
f'
|
119 |
)
|
120 |
|
121 |
logger.debug(f'Prompt length validation passed for prompt: {truncate_text(stripped_prompt)}')
|
|
|
107 |
# Check if prompt is too short
|
108 |
if prompt_length < min_length:
|
109 |
raise ValueError(
|
110 |
+
f'Your prompt is too short. Please enter at least {min_length} characters. '
|
111 |
+
f'(Current length: {prompt_length})'
|
112 |
)
|
113 |
|
114 |
# Check if prompt exceeds max length
|
115 |
if prompt_length > max_length:
|
116 |
raise ValueError(
|
117 |
+
f'Your prompt is too long. Please limit it to {max_length} characters. '
|
118 |
+
f'(Current length: {prompt_length})'
|
119 |
)
|
120 |
|
121 |
logger.debug(f'Prompt length validation passed for prompt: {truncate_text(stripped_prompt)}')
|