Skip to content

Conversation

@manikyarathore
Copy link

Users could specify incorrect file formats for input/output paths without receiving validation errors. For example, using --output-path /tmp/artbox/speech.md (text format) instead of speech.mp3 (audio format) for text to speech conversion would complete without error, causing downstream operations to fail.

Solution
= Implemented file format validation for Artbox CLI operations:

New Files:
= validators.py - Validator module with validate_io_paths() function

Changes:
= Validates input/output file extensions based on operation type:
text-to-speech (tts): requires audio output (.mp3, .wav, .ogg, .flac, .m4a, .aac)
speech-to-text (stt): requires audio input and text output (.txt, .md, .srt, .vtt, .json)
Infers operation type from file extensions if not explicitly provided
Raises clear, user-friendly error messages with supported format lists
Exits with code 2 on validation failure
Modified Files:

Benefits

  1. Catches format errors early, saving user time
  2. Clear error messages guide users to correct formats
  3. Prevents cascading failures in multi-step operations
  4. Works with both explicit and inferred operation types

Test: text to speech with invalid .md output (should fail)

python src/artbox/validators.py --operation text-to-speech --output-path out.md

Test: speech to text with valid formats (should pass)

python src/artbox/validators.py --operation speech-to-text --input-path audio.mp3 --output-path transcript.txt

@xmnlab
Copy link
Member

xmnlab commented Nov 12, 2025

hi @manikyarathore ! this is not the correct place to raise a PR to artbox.
instead take a look at the artbox repo here: https://github.com/osl-incubator/artbox

@xmnlab xmnlab closed this Nov 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants