create_chapter_from_marks
Creates a localized chapter variant from sentence marks via TTS, translation, and alignment pipeline. Returns chapter ID on success or failure details with retry hint.
Instructions
Create one chapter variant (single language+level) via cwbe's
/chapters/from-marks pipeline: cwtts → Gemini sentence translate →
awesome-align → ingest. Polls the resulting Job until terminal. To build
all 9 language variants of the same chapter, call this once per source
language — one chapter at a time, no concurrent runs (see Concurrency
Cap in CLAUDE.md).
Returns JSON with status ("COMPLETED" | "FAILED" | "CANCELLED" |
"TIMEOUT"), job_id, message, and — on success — chapter_id. On
failure the message includes sourceAudioBlobName=... scraped from
cwbe logs; pass that back to retry without regenerating audio.
If a chapter with the same (publication, language, level, title) already exists, cwbe returns that chapter's UUID immediately — safe to retry.
Args:
publication_id: Publication UUID on cwbe.
title: Localized chapter title (e.g. "0005 - Les plans").
language: Source language code (EN | FR | ES | DE | IT | PT | ZH | JA | KO).
level: Difficulty (B1 | B2).
marks: Pre-split sentence list in the source language. No blanks.
source_audio_blob_name: Optional retry hint — skip phase 0 (TTS) by
reusing a cached audio bundle from a previous failed run. Scrape
from cwbe logs after a failure.
tokens_per_mark: Pre-segmented source tokens, one list per mark
(parallel to marks). Required for CJK source — obtain via
the segment tool (one batched /segment call), then feed the
same tokens to the cjk-glosser agent. Passing them here
makes cwbe trust the caller's tokenisation and skip its internal
cwseg call, eliminating agent-vs-cwseg split mismatches.
Optional for EU source.
token_glosses: Per-token gloss overrides. Required and non-empty
for CJK-source chapters — cwbe rejects with HTTP 400 if any
(non-punctuation source token, Asian target) cell is missing.
Each entry is a dict with keys token, sourceLanguage,
targetLanguage, gloss — e.g. [{"token": "你好",
"sourceLanguage": "ZH", "targetLanguage": "JA", "gloss": "こんにちは"}].
Use gloss: "" for explicit ML Kit fallback. Entries are
request-scoped and never written to any cache.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| publication_id | Yes | ||
| title | Yes | ||
| language | Yes | ||
| level | Yes | ||
| marks | Yes | ||
| source_audio_blob_name | No | ||
| tokens_per_mark | No | ||
| token_glosses | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |