baobab-turn 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of baobab-turn might be problematic. Click here for more details.
- baobab_turn-0.1.0/.github/workflows/ci.yml +59 -0
- baobab_turn-0.1.0/.gitignore +26 -0
- baobab_turn-0.1.0/CLAUDE.md +63 -0
- baobab_turn-0.1.0/LICENSE +21 -0
- baobab_turn-0.1.0/PKG-INFO +548 -0
- baobab_turn-0.1.0/README.md +482 -0
- baobab_turn-0.1.0/baobab_turn/__init__.py +45 -0
- baobab_turn-0.1.0/baobab_turn/adapters/__init__.py +0 -0
- baobab_turn-0.1.0/baobab_turn/adapters/chat.py +248 -0
- baobab_turn-0.1.0/baobab_turn/adapters/livekit.py +608 -0
- baobab_turn-0.1.0/baobab_turn/core/__init__.py +0 -0
- baobab_turn-0.1.0/baobab_turn/core/codeswitch.py +165 -0
- baobab_turn-0.1.0/baobab_turn/core/config.py +103 -0
- baobab_turn-0.1.0/baobab_turn/core/guard.py +212 -0
- baobab_turn-0.1.0/baobab_turn/core/markers.py +150 -0
- baobab_turn-0.1.0/baobab_turn/core/pacing.py +110 -0
- baobab_turn-0.1.0/baobab_turn/core/tail.py +111 -0
- baobab_turn-0.1.0/baobab_turn/core/types.py +149 -0
- baobab_turn-0.1.0/baobab_turn/packs/en-NG.yaml +76 -0
- baobab_turn-0.1.0/baobab_turn/packs/pcm.yaml +134 -0
- baobab_turn-0.1.0/baobab_turn/packs/registry.py +172 -0
- baobab_turn-0.1.0/baobab_turn/prosody.py +183 -0
- baobab_turn-0.1.0/baobab_turn/py.typed +0 -0
- baobab_turn-0.1.0/baobab_turn/version.py +1 -0
- baobab_turn-0.1.0/bench/__init__.py +0 -0
- baobab_turn-0.1.0/bench/corpora.py +123 -0
- baobab_turn-0.1.0/bench/metrics.py +203 -0
- baobab_turn-0.1.0/bench/report.py +104 -0
- baobab_turn-0.1.0/bench/runner.py +307 -0
- baobab_turn-0.1.0/docs/FINDINGS.md +313 -0
- baobab_turn-0.1.0/docs/SPEC.md +717 -0
- baobab_turn-0.1.0/examples/chat_demo.py +104 -0
- baobab_turn-0.1.0/examples/check_phrases.py +175 -0
- baobab_turn-0.1.0/examples/minimal_agent.py +94 -0
- baobab_turn-0.1.0/examples/phrases.txt +55 -0
- baobab_turn-0.1.0/examples/try_it.py +133 -0
- baobab_turn-0.1.0/onyenwe_thesis.pdf +0 -0
- baobab_turn-0.1.0/onyenwe_thesis.txt +5538 -0
- baobab_turn-0.1.0/pyproject.toml +94 -0
- baobab_turn-0.1.0/scripts/check.py +126 -0
- baobab_turn-0.1.0/tests/golden/metrics.json +19 -0
- baobab_turn-0.1.0/tests/test_bench_runner.py +219 -0
- baobab_turn-0.1.0/tests/test_chat_adapter.py +222 -0
- baobab_turn-0.1.0/tests/test_core_purity.py +69 -0
- baobab_turn-0.1.0/tests/test_failopen.py +293 -0
- baobab_turn-0.1.0/tests/test_guard.py +339 -0
- baobab_turn-0.1.0/tests/test_livekit_adapter.py +791 -0
- baobab_turn-0.1.0/tests/test_livekit_contract.py +150 -0
- baobab_turn-0.1.0/tests/test_markers.py +193 -0
- baobab_turn-0.1.0/tests/test_metrics.py +132 -0
- baobab_turn-0.1.0/tests/test_pacing_codeswitch.py +214 -0
- baobab_turn-0.1.0/tests/test_prosody.py +233 -0
- baobab_turn-0.1.0/tests/test_tail.py +132 -0
- baobab_turn-0.1.0/tools/mine_markers.py +387 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
name: ci
|
|
2
|
+
|
|
3
|
+
# Manual only.
|
|
4
|
+
#
|
|
5
|
+
# Hosted runners are not part of this project's workflow, and a workflow that
|
|
6
|
+
# fires on every push would leave a permanent red cross on a public
|
|
7
|
+
# repository for reasons that have nothing to do with the code. The gate is
|
|
8
|
+
# `python scripts/check.py`, which runs the same lint, tests, purity check
|
|
9
|
+
# and wheel verification locally and for free.
|
|
10
|
+
#
|
|
11
|
+
# This is kept, and kept correct, so it can be triggered by hand or switched
|
|
12
|
+
# back to automatic by restoring the push and pull_request triggers.
|
|
13
|
+
on:
|
|
14
|
+
workflow_dispatch:
|
|
15
|
+
|
|
16
|
+
# Actions defaults to a broadly-scoped token. Nothing here writes to the
|
|
17
|
+
# repository, so drop it to read-only.
|
|
18
|
+
permissions:
|
|
19
|
+
contents: read
|
|
20
|
+
|
|
21
|
+
jobs:
|
|
22
|
+
test:
|
|
23
|
+
runs-on: ubuntu-latest
|
|
24
|
+
strategy:
|
|
25
|
+
fail-fast: false
|
|
26
|
+
matrix:
|
|
27
|
+
# SPEC 10 mandates 3.10-3.12. 3.13 is confirmed supported by
|
|
28
|
+
# livekit-agents 1.8.0 and is the maintainer's local version, so it is
|
|
29
|
+
# required rather than allow-failure. See docs/FINDINGS.md D11.
|
|
30
|
+
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
|
31
|
+
steps:
|
|
32
|
+
- uses: actions/checkout@v4
|
|
33
|
+
- uses: actions/setup-python@v5
|
|
34
|
+
with:
|
|
35
|
+
python-version: ${{ matrix.python-version }}
|
|
36
|
+
cache: pip
|
|
37
|
+
cache-dependency-path: pyproject.toml
|
|
38
|
+
- run: python -m pip install --upgrade pip
|
|
39
|
+
- run: pip install -e ".[dev]"
|
|
40
|
+
- name: Lint
|
|
41
|
+
run: ruff check .
|
|
42
|
+
- name: Tests
|
|
43
|
+
run: pytest
|
|
44
|
+
|
|
45
|
+
core-purity:
|
|
46
|
+
# The architectural boundary from SPEC 3.1, as its own required job so a
|
|
47
|
+
# violation is visible in the checks list and not buried in test output.
|
|
48
|
+
runs-on: ubuntu-latest
|
|
49
|
+
steps:
|
|
50
|
+
- uses: actions/checkout@v4
|
|
51
|
+
- uses: actions/setup-python@v5
|
|
52
|
+
with:
|
|
53
|
+
python-version: "3.12"
|
|
54
|
+
cache: pip
|
|
55
|
+
cache-dependency-path: pyproject.toml
|
|
56
|
+
# The purity check imports nothing beyond the standard library, so it
|
|
57
|
+
# does not need the framework extras that dominate install time.
|
|
58
|
+
- run: pip install -e . pytest
|
|
59
|
+
- run: pytest tests/test_core_purity.py -v
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
__pycache__/
|
|
2
|
+
*.py[cod]
|
|
3
|
+
*.egg-info/
|
|
4
|
+
build/
|
|
5
|
+
dist/
|
|
6
|
+
.venv/
|
|
7
|
+
venv/
|
|
8
|
+
.pytest_cache/
|
|
9
|
+
.coverage
|
|
10
|
+
htmlcov/
|
|
11
|
+
.ruff_cache/
|
|
12
|
+
.mypy_cache/
|
|
13
|
+
.env
|
|
14
|
+
.DS_Store
|
|
15
|
+
|
|
16
|
+
# NEVER commit raw caller audio (SPEC §8.4). Manifests and metrics only.
|
|
17
|
+
bench/datasets/audio/
|
|
18
|
+
*.wav
|
|
19
|
+
*.mp3
|
|
20
|
+
*.flac
|
|
21
|
+
*.ogg
|
|
22
|
+
*.m4a
|
|
23
|
+
|
|
24
|
+
# Benchmark run artifacts
|
|
25
|
+
bench/out/
|
|
26
|
+
*.jsonl
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# baobab-turn — working notes for Claude
|
|
2
|
+
|
|
3
|
+
## What this is
|
|
4
|
+
|
|
5
|
+
A turn-detection guard layer for African speech in voice agents. Pure-Python
|
|
6
|
+
core, thin framework adapters, YAML language packs.
|
|
7
|
+
|
|
8
|
+
## Read these first
|
|
9
|
+
|
|
10
|
+
- `docs/SPEC.md` — the full engineering specification. Authoritative on intent.
|
|
11
|
+
- `docs/FINDINGS.md` — verified SDK constraints and corrections to the spec.
|
|
12
|
+
|
|
13
|
+
## Hard rules
|
|
14
|
+
|
|
15
|
+
1. **`baobab_turn/core/` imports no framework. Ever.** Enforced by
|
|
16
|
+
`tests/test_core_purity.py`, which `scripts/check.py` runs as its own step.
|
|
17
|
+
If a framework type is needed in core, the adapter translates it instead.
|
|
18
|
+
2. **Fail open.** If the guard raises, the inner detector's decision passes
|
|
19
|
+
through untouched. The agent must never break because our layer broke.
|
|
20
|
+
3. **Never write marker lists for a language.** Generating discourse markers
|
|
21
|
+
with an LLM is machine translation with extra steps, which the spec
|
|
22
|
+
forbids. Build the schema and the validator; a speaker supplies the
|
|
23
|
+
content. This applies to subagents too.
|
|
24
|
+
4. **Never commit raw caller audio.** Manifests and metrics only.
|
|
25
|
+
5. **Every number lives in `core/config.py`.** Nothing hardcoded elsewhere,
|
|
26
|
+
because the benchmark ablates every flag.
|
|
27
|
+
6. **`reasons` is not optional.** Every guard decision records which rules
|
|
28
|
+
fired, or the system cannot be tuned or debugged.
|
|
29
|
+
7. **No estimated numbers in the README.** An empty benchmark table is honest.
|
|
30
|
+
|
|
31
|
+
## LiveKit API churn
|
|
32
|
+
|
|
33
|
+
The LiveKit Agents API changes frequently and this spec's code samples are
|
|
34
|
+
marked `[VERIFY]` for that reason. Check the SDK source before depending on
|
|
35
|
+
any signature. Docs lag source; source wins.
|
|
36
|
+
|
|
37
|
+
## Checks
|
|
38
|
+
|
|
39
|
+
**`python scripts/check.py` is the gate.** Run it before pushing; if it
|
|
40
|
+
passes, the branch is good. It runs lint, the test suite, the core purity
|
|
41
|
+
check, and -- importantly -- builds the wheel and installs it into a
|
|
42
|
+
throwaway environment to confirm the language packs actually ship.
|
|
43
|
+
|
|
44
|
+
That last step exists because the package was unbuildable for weeks and
|
|
45
|
+
nothing noticed: every install was `pip install -e .`, and editable installs
|
|
46
|
+
skip wheel packaging entirely.
|
|
47
|
+
|
|
48
|
+
Hosted CI is **not** part of this workflow. `.github/workflows/ci.yml` is kept
|
|
49
|
+
correct but set to `workflow_dispatch` only, so it never fires on a push.
|
|
50
|
+
Do not add automatic triggers, and do not treat a missing green tick as a
|
|
51
|
+
problem to solve.
|
|
52
|
+
|
|
53
|
+
## Environment
|
|
54
|
+
|
|
55
|
+
- Local Python is 3.13.7. `livekit-agents` 1.8.0 supports 3.10-3.14.
|
|
56
|
+
- `uv` is not installed.
|
|
57
|
+
- The LiveKit docs MCP server (`https://docs.livekit.io/mcp/`) that SPEC §0
|
|
58
|
+
asks for is **not configured**. Set it up before deep SDK work.
|
|
59
|
+
|
|
60
|
+
## Build order
|
|
61
|
+
|
|
62
|
+
Milestones in SPEC §9. Do not start a milestone before the previous one is
|
|
63
|
+
real. M2 is gated on the open questions in `docs/FINDINGS.md`.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 baobab-turn contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|