Repository navigation
Add ai/stt, ai/tts and ai/redact commands - #31
Merged
Merged
Conversation
- ai/stt (aliases ai-stt, stt): transcribe audio and video files. -f sets the transcript format (txt, srt, vtt, json); the API default is txt. - ai/tts (aliases ai-tts, tts): speak --text or UTF-8 text files, never both. -f sets the audio format (mp3, wav, flac, ogg). - ai/redact (aliases ai-redact, redact, pdf/redact, pdf-redact): remove personal data from PDF, TXT and MD files. - The operations API lists nothing for ai/stt and ai/tts when filtered by output_format, which is an option of these operations. The options used to cast parameter values are now looked up without the format filter for them, so --translate=true or --max_line_length=42 still get their types.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The API has three new AI operations: speech to text (
ai/stt), text to speech (ai/tts) and redacting personal data (ai/redact). The CLI had no commands for them, though the API docs already show CLI examples likecloudconvert ai/stt -f srt interview.mp3. This PR adds the commands, so those examples work as written.ai-stt,stt):-fpicks txt, srt, vtt or json. If-fis not set, the API default (txt) is used.ai-tts,tts): speaks either--textor text files, never both, as the API requires.--textis declared as a string, so--text=123is not sent as a number.ai-redact,redact,pdf/redact,pdf-redact): handles PDF, TXT and MD files.All other options (voice, language, preset, entities…) work as dynamic options, like in the other commands.
One fix in
job.ts: forai/sttandai/tts,output_formatis an option, not a format of the operation. Looking up/operations?filter[operation]=ai/stt&filter[output_format]=srtreturns nothing, so with-fset the CLI found no options to cast values by.--translate=truewould have gone out as a string. For these two operations, the options are now looked up without the format filter. The new tests fail without this change.README covers the three commands.
npm run typecheck,npm test(62 tests) andnpm run buildpass. I did not run real jobs against the API.