Skip to content

Conversation

@mshsheikh
Copy link
Contributor

Problem:
The script allows empty or whitespace-only input from the user, which results in unnecessary agent executions and invalid translations.

Changes:

  • Added input validation to check if the user input is empty or whitespace-only.
  • If invalid, raises ValueError with a clear message: "Input message cannot be empty."
  • Prevents downstream agent execution when input is invalid.
msg = input("Hi! Enter a message, and we'll translate it to Spanish.\n\n")
if not msg.strip():
    raise ValueError("Input message cannot be empty.")

Benefits:

  • Ensures only valid, non-empty input triggers agent workflows.
  • Improves user experience by failing early with a descriptive error.
  • Avoids unnecessary API calls or agent runs for invalid inputs.

…ample

Problem:
The script allows empty or whitespace-only input from the user, which results in unnecessary agent executions and invalid translations.

Changes:
- Added input validation to check if the user input is empty or whitespace-only.
- If invalid, raises `ValueError` with a clear message: `"Input message cannot be empty."`
- Prevents downstream agent execution when input is invalid.

```python
msg = input("Hi! Enter a message, and we'll translate it to Spanish.\n\n")
if not msg.strip():
    raise ValueError("Input message cannot be empty.")
```

Benefits:
- Ensures only valid, non-empty input triggers agent workflows.
- Improves user experience by failing early with a descriptive error.
- Avoids unnecessary API calls or agent runs for invalid inputs.
@seratch seratch added the documentation Improvements or additions to documentation label Jul 14, 2025
@seratch
Copy link
Member

seratch commented Jul 14, 2025

This may be a good change, but skipping the empty input and waiting for the user's meaningful input might be even more useful.

@mshsheikh mshsheikh closed this Jul 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants