Generate spoken audio
generate_field_audioGenerate the spoken audio of a part of the activity and save it into its texts. Call it ONLY when the user asked for audio in their own words: generating spends the text to speech quota of the user, so never add audio on your own initiative, not even to finish an activity you have just written. Say which part they named and nothing more: "elements" are the kinds of text they named, from "media_targets.audio" of the activity state ("the questions" is question, never question and choice; "the answers" is choice; "everything" is every element listed there), and "answers" narrows the choices to the correct or the incorrect ones. With "selection": "all_of_elements" every text of those elements gets its audio and you send no texts; when they named items by their place (question 2, the odd ones, the first five), add those positions in "positions". Only for a rule about the texts themselves (the capitals, the longest ones, one text they quoted), use "listed_texts" and send exactly those texts in "items". A text that already has audio keeps it unless existing is "replace"; one with a video or a youtube link is always left untouched. The result lists in "generated" every text that got its audio, with the element and the item it belongs to.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| items | No | Only with "selection": "listed_texts": one entry per text the user named. | |
| answers | Yes | For the choices of a question: "correct" or "incorrect" when the user named only those, otherwise "all". | |
| elements | Yes | The kinds of text the user named, from media_targets.audio: only those. | |
| existing | Yes | What happens to a text that already has audio. "keep": it is left untouched; the value for every request to ADD audio. "replace": its audio is generated again and the old one is discarded, and texts without audio are left as they are; ONLY when the user asked to change, redo or regenerate the audio of those very texts (for example after rewriting them, or to hear them in another language). | |
| language | Yes | Voice language: "activity" to use the language of the activity, or an ISO 639-1 code (es, en, fr...) when the user asks for another one. | |
| positions | Yes | With "all_of_elements": the "position" of the items the user named by their place; empty for every item. | |
| selection | Yes | "all_of_elements": every text of the elements. "listed_texts": only the texts in "items". | |
| activity_id | Yes | Id of the activity. |