teich 0.2.0__tar.gz → 0.2.2__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.
- {teich-0.2.0 → teich-0.2.2}/.gitignore +26 -25
- {teich-0.2.0 → teich-0.2.2}/PKG-INFO +21 -1
- {teich-0.2.0 → teich-0.2.2}/README.md +233 -213
- {teich-0.2.0 → teich-0.2.2}/docs/generation.md +230 -197
- {teich-0.2.0 → teich-0.2.2}/docs/prepare-data.md +73 -0
- {teich-0.2.0 → teich-0.2.2}/gemma-template.jinja +536 -536
- {teich-0.2.0 → teich-0.2.2}/gemma4_example.py +109 -109
- {teich-0.2.0 → teich-0.2.2}/pyproject.toml +77 -77
- {teich-0.2.0 → teich-0.2.2}/src/teich/__init__.py +37 -37
- {teich-0.2.0 → teich-0.2.2}/src/teich/anonymize.py +405 -410
- {teich-0.2.0 → teich-0.2.2}/src/teich/cli.py +73 -15
- {teich-0.2.0 → teich-0.2.2}/src/teich/extract.py +431 -439
- {teich-0.2.0 → teich-0.2.2}/src/teich/formatter.py +2303 -2303
- {teich-0.2.0 → teich-0.2.2}/tests/test_cli.py +56 -0
- {teich-0.2.0 → teich-0.2.2}/tests/test_extract_anonymize_cli.py +803 -616
- {teich-0.2.0 → teich-0.2.2}/tests/test_formatter.py +3433 -3433
- {teich-0.2.0 → teich-0.2.2}/uv.lock +1 -1
- {teich-0.2.0 → teich-0.2.2}/.github/workflows/test.yml +0 -0
- {teich-0.2.0 → teich-0.2.2}/DOCS.md +0 -0
- {teich-0.2.0 → teich-0.2.2}/LICENSE +0 -0
- {teich-0.2.0 → teich-0.2.2}/ROADMAP.md +0 -0
- {teich-0.2.0 → teich-0.2.2}/config.example.yaml +0 -0
- {teich-0.2.0 → teich-0.2.2}/docker/codex-runtime.Dockerfile +0 -0
- {teich-0.2.0 → teich-0.2.2}/docs/data-format.md +0 -0
- {teich-0.2.0 → teich-0.2.2}/docs/index.md +0 -0
- {teich-0.2.0 → teich-0.2.2}/docs/pipeline.md +0 -0
- {teich-0.2.0 → teich-0.2.2}/docs/python-api.md +0 -0
- {teich-0.2.0 → teich-0.2.2}/docs/studio.md +0 -0
- {teich-0.2.0 → teich-0.2.2}/docs/training.md +0 -0
- {teich-0.2.0 → teich-0.2.2}/src/teich/__main__.py +0 -0
- {teich-0.2.0 → teich-0.2.2}/src/teich/audit.py +0 -0
- {teich-0.2.0 → teich-0.2.2}/src/teich/config.py +0 -0
- {teich-0.2.0 → teich-0.2.2}/src/teich/converter.py +0 -0
- {teich-0.2.0 → teich-0.2.2}/src/teich/loader.py +0 -0
- {teich-0.2.0 → teich-0.2.2}/src/teich/prepare.py +0 -0
- {teich-0.2.0 → teich-0.2.2}/src/teich/runner.py +0 -0
- {teich-0.2.0 → teich-0.2.2}/src/teich/studio/__init__.py +0 -0
- {teich-0.2.0 → teich-0.2.2}/src/teich/studio/events.py +0 -0
- {teich-0.2.0 → teich-0.2.2}/src/teich/studio/generation.py +0 -0
- {teich-0.2.0 → teich-0.2.2}/src/teich/studio/interactive.py +0 -0
- {teich-0.2.0 → teich-0.2.2}/src/teich/studio/project.py +0 -0
- {teich-0.2.0 → teich-0.2.2}/src/teich/studio/server.py +0 -0
- {teich-0.2.0 → teich-0.2.2}/src/teich/studio/static/app.js +0 -0
- {teich-0.2.0 → teich-0.2.2}/src/teich/studio/static/index.html +0 -0
- {teich-0.2.0 → teich-0.2.2}/src/teich/studio/static/style.css +0 -0
- {teich-0.2.0 → teich-0.2.2}/src/teich/studio/static/teich.svg +0 -0
- {teich-0.2.0 → teich-0.2.2}/src/teich/studio/static/vendor/xterm-addon-fit.js +0 -0
- {teich-0.2.0 → teich-0.2.2}/src/teich/studio/static/vendor/xterm.css +0 -0
- {teich-0.2.0 → teich-0.2.2}/src/teich/studio/static/vendor/xterm.js +0 -0
- {teich-0.2.0 → teich-0.2.2}/src/teich/tool_schema.py +0 -0
- {teich-0.2.0 → teich-0.2.2}/src/teich/trace_readme.py +0 -0
- {teich-0.2.0 → teich-0.2.2}/teich_example.py +0 -0
- {teich-0.2.0 → teich-0.2.2}/tests/conftest.py +0 -0
- {teich-0.2.0 → teich-0.2.2}/tests/test_audit.py +0 -0
- {teich-0.2.0 → teich-0.2.2}/tests/test_config.py +0 -0
- {teich-0.2.0 → teich-0.2.2}/tests/test_converter.py +0 -0
- {teich-0.2.0 → teich-0.2.2}/tests/test_integration.py +0 -0
- {teich-0.2.0 → teich-0.2.2}/tests/test_loader.py +0 -0
- {teich-0.2.0 → teich-0.2.2}/tests/test_prepare.py +0 -0
- {teich-0.2.0 → teich-0.2.2}/tests/test_runner.py +0 -0
- {teich-0.2.0 → teich-0.2.2}/tests/test_studio.py +0 -0
- {teich-0.2.0 → teich-0.2.2}/tests/test_tokenizer_smoke.py +0 -0
- {teich-0.2.0 → teich-0.2.2}/tests/test_tool_schema.py +0 -0
- {teich-0.2.0 → teich-0.2.2}/tests/test_trace_readme.py +0 -0
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
__pycache__/
|
|
2
|
-
*.py[cod]
|
|
3
|
-
*.pyo
|
|
4
|
-
*.pyd
|
|
5
|
-
*.so
|
|
6
|
-
.venv/
|
|
7
|
-
venv/
|
|
8
|
-
.pytest_cache/
|
|
9
|
-
.benchmarks/
|
|
10
|
-
.deepeval/
|
|
11
|
-
.kilo/
|
|
12
|
-
.mypy_cache/
|
|
13
|
-
.ruff_cache/
|
|
14
|
-
dist/
|
|
15
|
-
output/
|
|
16
|
-
sandbox/
|
|
17
|
-
test_run/
|
|
18
|
-
outputs/
|
|
19
|
-
qwen_lora/
|
|
20
|
-
traces-test/
|
|
21
|
-
|
|
22
|
-
*.env
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
1
|
+
__pycache__/
|
|
2
|
+
*.py[cod]
|
|
3
|
+
*.pyo
|
|
4
|
+
*.pyd
|
|
5
|
+
*.so
|
|
6
|
+
.venv/
|
|
7
|
+
venv/
|
|
8
|
+
.pytest_cache/
|
|
9
|
+
.benchmarks/
|
|
10
|
+
.deepeval/
|
|
11
|
+
.kilo/
|
|
12
|
+
.mypy_cache/
|
|
13
|
+
.ruff_cache/
|
|
14
|
+
dist/
|
|
15
|
+
output/
|
|
16
|
+
sandbox/
|
|
17
|
+
test_run/
|
|
18
|
+
outputs/
|
|
19
|
+
qwen_lora/
|
|
20
|
+
traces-test/
|
|
21
|
+
projects/
|
|
22
|
+
*.env
|
|
23
|
+
*.env.*
|
|
24
|
+
.DS_Store
|
|
25
|
+
Thumbs.db
|
|
26
|
+
unsloth_compiled_cache/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: teich
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: Turn coding agent traces into auditable supervised fine-tuning data
|
|
5
5
|
License: Apache-2.0
|
|
6
6
|
License-File: LICENSE
|
|
@@ -147,6 +147,23 @@ teich extract claude --model fable-5
|
|
|
147
147
|
|
|
148
148
|
`extract` supports `claude`, `codex`, `pi`, and `hermes`. It writes anonymized traces to `data/` by default, with JSONL files directly in that folder so the generated Hugging Face dataset metadata can match `*.jsonl`. It generates a dataset `README.md`, and then asks whether to upload the folder to Hugging Face. Use `--out` / `--output` to choose another folder.
|
|
149
149
|
|
|
150
|
+
If the agent store is somewhere other than the default home-directory location, pass it explicitly. `--sessions-dir` accepts either the agent root, such as `.claude`, `.codex`, `.pi`, or `.hermes`, or the native store under it, such as `.claude/projects`, `.codex/sessions`, or `.hermes/state.db`:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
teich extract claude --sessions-dir /path/to/.claude --out data
|
|
154
|
+
teich extract codex --sessions-dir /path/to/.codex/sessions --out data
|
|
155
|
+
teich extract pi --sessions-dir /path/to/.pi --out data
|
|
156
|
+
teich extract hermes --sessions-dir /path/to/.hermes/state.db --out data
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Extraction anonymizes staged traces by default. To keep the raw extracted data unchanged, pass `--no-anon` or `--no-anonymize` and review the output carefully before sharing or uploading it.
|
|
160
|
+
|
|
161
|
+
To convert raw or extracted traces into normalized Teich JSONL rows that can be consumed without Teich at training time:
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
teich convert data --out teich-training.jsonl
|
|
165
|
+
```
|
|
166
|
+
|
|
150
167
|
## What Teich Supports
|
|
151
168
|
|
|
152
169
|
| Use case | Start here |
|
|
@@ -193,6 +210,9 @@ teich generate -c config.yaml --resume
|
|
|
193
210
|
# Extract, anonymize, and stage local Claude Code traces
|
|
194
211
|
teich extract claude --model fable-5 --out data
|
|
195
212
|
|
|
213
|
+
# Convert staged raw traces to normalized Teich JSONL
|
|
214
|
+
teich convert data --out teich-training.jsonl
|
|
215
|
+
|
|
196
216
|
# Launch the local browser UI
|
|
197
217
|
teich studio
|
|
198
218
|
|
|
@@ -1,229 +1,249 @@
|
|
|
1
|
-
<div align="center">
|
|
2
|
-
<img src="assets/teich.svg" alt="Teich logo" width="132">
|
|
3
|
-
<h1>Teich</h1>
|
|
4
|
-
<p><strong>Agent data infrastructure for generation, normalization, formatting, response masking, and training audits.</strong></p>
|
|
5
|
-
<p>
|
|
6
|
-
<a href="https://pepy.tech/projects/teich"><img alt="PyPI Downloads" src="https://img.shields.io/pepy/dt/teich?label=downloads&color=green"></a>
|
|
7
|
-
<a href="https://pypi.org/project/teich/"><img alt="PyPI" src="https://img.shields.io/pypi/v/teich?label=pypi&color=black"></a>
|
|
8
|
-
<a href="https://pypi.org/project/teich/"><img alt="Python versions" src="https://img.shields.io/badge/python-%3E%3D3.10-green"></a>
|
|
9
|
-
<a href="LICENSE"><img alt="License" src="https://img.shields.io/pypi/l/teich?color=black"></a>
|
|
10
|
-
</p>
|
|
11
|
-
</div>
|
|
12
|
-
|
|
13
|
-
Teich turns raw agent sessions, chat datasets, local JSONL, Hugging Face datasets, and in-memory `datasets.Dataset` objects into auditable SFT data.
|
|
14
|
-
|
|
15
|
-
It handles the parts that usually break training runs:
|
|
16
|
-
|
|
17
|
-
- normalizing traces into OpenAI-style `messages` and `tools`
|
|
18
|
-
- preserving tool schemas, reasoning, metadata, and provenance
|
|
19
|
-
- rendering through your target tokenizer's chat template
|
|
20
|
-
- recording typed supervision spans before tokenization
|
|
21
|
-
- applying response-only labels after TRL / Unsloth trainer tokenization
|
|
22
|
-
- reporting dropped, oversized, trimmed, malformed, and fully masked rows
|
|
23
|
-
|
|
24
|
-
Use it as a trace generator, a dataset loader, a chat-template renderer, a masking layer, or the whole pipeline.
|
|
25
|
-
|
|
26
|
-
## Install
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
pip install teich
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
Or run it without installing:
|
|
33
|
-
|
|
34
|
-
```bash
|
|
35
|
-
uvx teich --help
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
Agent trace generation needs Docker and an API key for the configured provider. Preparing an existing local or Hugging Face dataset does not need Docker.
|
|
39
|
-
|
|
40
|
-
Prefer a browser workflow?
|
|
41
|
-
|
|
42
|
-
```bash
|
|
43
|
-
teich studio
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
See [Teich Studio](docs/studio.md).
|
|
47
|
-
|
|
48
|
-
## Quickstart: Prepare Existing Data
|
|
49
|
-
|
|
50
|
-
If your dataset already has `messages`, Teich can usually prepare it directly.
|
|
51
|
-
|
|
52
|
-
```python
|
|
53
|
-
from teich import prepare_data
|
|
54
|
-
|
|
55
|
-
train_dataset = prepare_data(
|
|
56
|
-
"TeichAI/Claude-Opus-4.6-Reasoning-887x",
|
|
57
|
-
tokenizer,
|
|
58
|
-
max_length=32768,
|
|
59
|
-
oversized_policy="trim_followups",
|
|
60
|
-
tokenize=True,
|
|
61
|
-
chat_template_kwargs={"enable_thinking": True, "preserve_thinking": True},
|
|
62
|
-
)
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
Then create your trainer and call `mask_data()`:
|
|
66
|
-
|
|
67
|
-
```python
|
|
68
|
-
from teich import mask_data
|
|
69
|
-
|
|
70
|
-
trainer = mask_data(
|
|
71
|
-
trainer,
|
|
72
|
-
tokenizer=tokenizer,
|
|
73
|
-
train_on_reasoning=True,
|
|
74
|
-
train_on_final_answers=True,
|
|
75
|
-
train_on_tools=True,
|
|
76
|
-
)
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
More detail: [Preparing Data](docs/prepare-data.md) and [Training](docs/training.md).
|
|
80
|
-
|
|
81
|
-
## Quickstart: Generate New Traces
|
|
82
|
-
|
|
83
|
-
```bash
|
|
84
|
-
teich init my-project
|
|
85
|
-
cd my-project
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
Add prompts to `prompts.jsonl`:
|
|
89
|
-
|
|
90
|
-
```jsonl
|
|
91
|
-
{"prompt":"Build a simple todo list app in React"}
|
|
92
|
-
{"github_repo":"armand0e/perplexica-mcp","prompt":"Add a small usability improvement and update the tests"}
|
|
93
|
-
{"prompt":"Draft a compact project plan","follow_up_prompts":["Revise it for a solo developer","Add a risk checklist"]}
|
|
94
|
-
```
|
|
1
|
+
<div align="center">
|
|
2
|
+
<img src="assets/teich.svg" alt="Teich logo" width="132">
|
|
3
|
+
<h1>Teich</h1>
|
|
4
|
+
<p><strong>Agent data infrastructure for generation, normalization, formatting, response masking, and training audits.</strong></p>
|
|
5
|
+
<p>
|
|
6
|
+
<a href="https://pepy.tech/projects/teich"><img alt="PyPI Downloads" src="https://img.shields.io/pepy/dt/teich?label=downloads&color=green"></a>
|
|
7
|
+
<a href="https://pypi.org/project/teich/"><img alt="PyPI" src="https://img.shields.io/pypi/v/teich?label=pypi&color=black"></a>
|
|
8
|
+
<a href="https://pypi.org/project/teich/"><img alt="Python versions" src="https://img.shields.io/badge/python-%3E%3D3.10-green"></a>
|
|
9
|
+
<a href="LICENSE"><img alt="License" src="https://img.shields.io/pypi/l/teich?color=black"></a>
|
|
10
|
+
</p>
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
Teich turns raw agent sessions, chat datasets, local JSONL, Hugging Face datasets, and in-memory `datasets.Dataset` objects into auditable SFT data.
|
|
14
|
+
|
|
15
|
+
It handles the parts that usually break training runs:
|
|
16
|
+
|
|
17
|
+
- normalizing traces into OpenAI-style `messages` and `tools`
|
|
18
|
+
- preserving tool schemas, reasoning, metadata, and provenance
|
|
19
|
+
- rendering through your target tokenizer's chat template
|
|
20
|
+
- recording typed supervision spans before tokenization
|
|
21
|
+
- applying response-only labels after TRL / Unsloth trainer tokenization
|
|
22
|
+
- reporting dropped, oversized, trimmed, malformed, and fully masked rows
|
|
23
|
+
|
|
24
|
+
Use it as a trace generator, a dataset loader, a chat-template renderer, a masking layer, or the whole pipeline.
|
|
25
|
+
|
|
26
|
+
## Install
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pip install teich
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Or run it without installing:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
uvx teich --help
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Agent trace generation needs Docker and an API key for the configured provider. Preparing an existing local or Hugging Face dataset does not need Docker.
|
|
39
|
+
|
|
40
|
+
Prefer a browser workflow?
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
teich studio
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
See [Teich Studio](docs/studio.md).
|
|
47
|
+
|
|
48
|
+
## Quickstart: Prepare Existing Data
|
|
49
|
+
|
|
50
|
+
If your dataset already has `messages`, Teich can usually prepare it directly.
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
from teich import prepare_data
|
|
54
|
+
|
|
55
|
+
train_dataset = prepare_data(
|
|
56
|
+
"TeichAI/Claude-Opus-4.6-Reasoning-887x",
|
|
57
|
+
tokenizer,
|
|
58
|
+
max_length=32768,
|
|
59
|
+
oversized_policy="trim_followups",
|
|
60
|
+
tokenize=True,
|
|
61
|
+
chat_template_kwargs={"enable_thinking": True, "preserve_thinking": True},
|
|
62
|
+
)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Then create your trainer and call `mask_data()`:
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
from teich import mask_data
|
|
69
|
+
|
|
70
|
+
trainer = mask_data(
|
|
71
|
+
trainer,
|
|
72
|
+
tokenizer=tokenizer,
|
|
73
|
+
train_on_reasoning=True,
|
|
74
|
+
train_on_final_answers=True,
|
|
75
|
+
train_on_tools=True,
|
|
76
|
+
)
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
More detail: [Preparing Data](docs/prepare-data.md) and [Training](docs/training.md).
|
|
80
|
+
|
|
81
|
+
## Quickstart: Generate New Traces
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
teich init my-project
|
|
85
|
+
cd my-project
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Add prompts to `prompts.jsonl`:
|
|
89
|
+
|
|
90
|
+
```jsonl
|
|
91
|
+
{"prompt":"Build a simple todo list app in React"}
|
|
92
|
+
{"github_repo":"armand0e/perplexica-mcp","prompt":"Add a small usability improvement and update the tests"}
|
|
93
|
+
{"prompt":"Draft a compact project plan","follow_up_prompts":["Revise it for a solo developer","Add a risk checklist"]}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Set your provider key and run:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
export OPENAI_API_KEY=sk-...
|
|
100
|
+
teich generate -c config.yaml
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Teich writes raw traces, converted training rows, sandbox snapshots, and a dataset card under `output/`. Use `--resume` to skip prompts that already completed.
|
|
104
|
+
|
|
105
|
+
More detail: [Generation](docs/generation.md).
|
|
106
|
+
|
|
107
|
+
## Quickstart: Extract Local Sessions
|
|
108
|
+
|
|
109
|
+
If you already have local agent sessions, Teich can stage them as an anonymized dataset in one command:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
teich extract claude --model fable-5
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
`extract` supports `claude`, `codex`, `pi`, and `hermes`. It writes anonymized traces to `data/` by default, with JSONL files directly in that folder so the generated Hugging Face dataset metadata can match `*.jsonl`. It generates a dataset `README.md`, and then asks whether to upload the folder to Hugging Face. Use `--out` / `--output` to choose another folder.
|
|
95
116
|
|
|
96
|
-
|
|
117
|
+
If the agent store is somewhere other than the default home-directory location, pass it explicitly. `--sessions-dir` accepts either the agent root, such as `.claude`, `.codex`, `.pi`, or `.hermes`, or the native store under it, such as `.claude/projects`, `.codex/sessions`, or `.hermes/state.db`:
|
|
97
118
|
|
|
98
119
|
```bash
|
|
99
|
-
|
|
100
|
-
teich
|
|
120
|
+
teich extract claude --sessions-dir /path/to/.claude --out data
|
|
121
|
+
teich extract codex --sessions-dir /path/to/.codex/sessions --out data
|
|
122
|
+
teich extract pi --sessions-dir /path/to/.pi --out data
|
|
123
|
+
teich extract hermes --sessions-dir /path/to/.hermes/state.db --out data
|
|
101
124
|
```
|
|
102
125
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
More detail: [Generation](docs/generation.md).
|
|
106
|
-
|
|
107
|
-
## Quickstart: Extract Local Sessions
|
|
126
|
+
Extraction anonymizes staged traces by default. To keep the raw extracted data unchanged, pass `--no-anon` or `--no-anonymize` and review the output carefully before sharing or uploading it.
|
|
108
127
|
|
|
109
|
-
|
|
128
|
+
To convert raw or extracted traces into normalized Teich JSONL rows that can be consumed without Teich at training time:
|
|
110
129
|
|
|
111
130
|
```bash
|
|
112
|
-
teich
|
|
131
|
+
teich convert data --out teich-training.jsonl
|
|
113
132
|
```
|
|
114
133
|
|
|
115
|
-
`extract` supports `claude`, `codex`, `pi`, and `hermes`. It writes anonymized traces to `data/` by default, with JSONL files directly in that folder so the generated Hugging Face dataset metadata can match `*.jsonl`. It generates a dataset `README.md`, and then asks whether to upload the folder to Hugging Face. Use `--out` / `--output` to choose another folder.
|
|
116
|
-
|
|
117
134
|
## What Teich Supports
|
|
118
|
-
|
|
119
|
-
| Use case | Start here |
|
|
120
|
-
| --- | --- |
|
|
121
|
-
| Configure and steer runs in a browser | [Teich Studio](docs/studio.md) |
|
|
122
|
-
| Generate Codex, Pi, Claude Code, Hermes, or chat data | [Generation](docs/generation.md) |
|
|
123
|
-
| Load local files, folders, Hugging Face datasets, or `datasets.Dataset` objects | [Preparing Data](docs/prepare-data.md) |
|
|
124
|
-
| Train with TRL / Unsloth while keeping response-only labels correct | [Training](docs/training.md) |
|
|
125
|
-
| Understand `messages`, `tools`, metadata, and native trace behavior | [Data Format](docs/data-format.md) |
|
|
126
|
-
| Use `prepare_data`, `mask_data`, `load_traces`, and validation helpers | [Python API](docs/python-api.md) |
|
|
127
|
-
| See the full generation, preparation, and masking pipeline | [Pipeline Flow](docs/pipeline.md) |
|
|
128
|
-
|
|
129
|
-
## Why Teich
|
|
130
|
-
|
|
131
|
-
Most SFT pipelines flatten agent data too early. That loses tool schemas, tool results, reasoning boundaries, provenance, and the exact assistant spans you meant to train on.
|
|
132
|
-
|
|
133
|
-
Teich keeps the data structured until the last practical moment:
|
|
134
|
-
|
|
135
|
-
```text
|
|
136
|
-
prompts / traces / JSONL / HF datasets / Dataset objects
|
|
137
|
-
-> load_traces() or prepare_data()
|
|
138
|
-
-> normalized messages + tools
|
|
139
|
-
-> tokenizer chat template rendering
|
|
140
|
-
-> trainer-friendly text + Teich supervision spans
|
|
141
|
-
-> SFTTrainer tokenization
|
|
142
|
-
-> mask_data()
|
|
143
|
-
-> audited input_ids + labels
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
This makes multi-turn, tool-call, reasoning, and mixed-source datasets trainable without relying on brittle single-span masking.
|
|
147
|
-
|
|
148
|
-
## Common Commands
|
|
149
|
-
|
|
150
|
-
```bash
|
|
151
|
-
# Create a generation project
|
|
152
|
-
teich init my-project
|
|
153
|
-
|
|
154
|
-
# Generate data from config.yaml
|
|
155
|
-
teich generate -c config.yaml
|
|
156
|
-
|
|
157
|
-
# Resume an interrupted batch
|
|
158
|
-
teich generate -c config.yaml --resume
|
|
159
|
-
|
|
135
|
+
|
|
136
|
+
| Use case | Start here |
|
|
137
|
+
| --- | --- |
|
|
138
|
+
| Configure and steer runs in a browser | [Teich Studio](docs/studio.md) |
|
|
139
|
+
| Generate Codex, Pi, Claude Code, Hermes, or chat data | [Generation](docs/generation.md) |
|
|
140
|
+
| Load local files, folders, Hugging Face datasets, or `datasets.Dataset` objects | [Preparing Data](docs/prepare-data.md) |
|
|
141
|
+
| Train with TRL / Unsloth while keeping response-only labels correct | [Training](docs/training.md) |
|
|
142
|
+
| Understand `messages`, `tools`, metadata, and native trace behavior | [Data Format](docs/data-format.md) |
|
|
143
|
+
| Use `prepare_data`, `mask_data`, `load_traces`, and validation helpers | [Python API](docs/python-api.md) |
|
|
144
|
+
| See the full generation, preparation, and masking pipeline | [Pipeline Flow](docs/pipeline.md) |
|
|
145
|
+
|
|
146
|
+
## Why Teich
|
|
147
|
+
|
|
148
|
+
Most SFT pipelines flatten agent data too early. That loses tool schemas, tool results, reasoning boundaries, provenance, and the exact assistant spans you meant to train on.
|
|
149
|
+
|
|
150
|
+
Teich keeps the data structured until the last practical moment:
|
|
151
|
+
|
|
152
|
+
```text
|
|
153
|
+
prompts / traces / JSONL / HF datasets / Dataset objects
|
|
154
|
+
-> load_traces() or prepare_data()
|
|
155
|
+
-> normalized messages + tools
|
|
156
|
+
-> tokenizer chat template rendering
|
|
157
|
+
-> trainer-friendly text + Teich supervision spans
|
|
158
|
+
-> SFTTrainer tokenization
|
|
159
|
+
-> mask_data()
|
|
160
|
+
-> audited input_ids + labels
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
This makes multi-turn, tool-call, reasoning, and mixed-source datasets trainable without relying on brittle single-span masking.
|
|
164
|
+
|
|
165
|
+
## Common Commands
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
# Create a generation project
|
|
169
|
+
teich init my-project
|
|
170
|
+
|
|
171
|
+
# Generate data from config.yaml
|
|
172
|
+
teich generate -c config.yaml
|
|
173
|
+
|
|
174
|
+
# Resume an interrupted batch
|
|
175
|
+
teich generate -c config.yaml --resume
|
|
176
|
+
|
|
160
177
|
# Extract, anonymize, and stage local Claude Code traces
|
|
161
178
|
teich extract claude --model fable-5 --out data
|
|
162
179
|
|
|
180
|
+
# Convert staged raw traces to normalized Teich JSONL
|
|
181
|
+
teich convert data --out teich-training.jsonl
|
|
182
|
+
|
|
163
183
|
# Launch the local browser UI
|
|
164
184
|
teich studio
|
|
165
|
-
|
|
166
|
-
# Use a local OpenAI-compatible endpoint
|
|
167
|
-
TEICH_PROVIDER=LMstudio \
|
|
168
|
-
TEICH_MODEL=gemma-4 \
|
|
169
|
-
TEICH_BASE_URL=http://localhost:1234/v1 \
|
|
170
|
-
TEICH_API_KEY=llm \
|
|
171
|
-
teich generate -c config.yaml
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
## Minimal Config
|
|
175
|
-
|
|
176
|
-
```yaml
|
|
177
|
-
agent:
|
|
178
|
-
provider: codex # codex, pi, claude-code, hermes, or chat
|
|
179
|
-
|
|
180
|
-
model:
|
|
181
|
-
model: codex-mini-latest
|
|
182
|
-
approval_policy: never
|
|
183
|
-
sandbox: danger-full-access
|
|
184
|
-
|
|
185
|
-
prompts_file: prompts.jsonl
|
|
186
|
-
|
|
187
|
-
output:
|
|
188
|
-
traces_dir: ./output
|
|
189
|
-
sandbox_dir: ./sandbox
|
|
190
|
-
failures_dir: ./failures
|
|
191
|
-
|
|
192
|
-
publish:
|
|
193
|
-
repo_id: username/my-dataset
|
|
194
|
-
private: false
|
|
195
|
-
```
|
|
196
|
-
|
|
197
|
-
`agent.provider: chat` writes structured chat rows directly and does not require Docker. Agent providers preserve raw or native traces as source-of-truth artifacts.
|
|
198
|
-
|
|
199
|
-
## Python Entry Points
|
|
200
|
-
|
|
201
|
-
```python
|
|
202
|
-
from teich import (
|
|
203
|
-
prepare_data,
|
|
204
|
-
mask_data,
|
|
205
|
-
load_traces,
|
|
206
|
-
detect_trace_type,
|
|
207
|
-
validate_tool_calls,
|
|
208
|
-
row_fits_context,
|
|
209
|
-
trace_is_complete,
|
|
210
|
-
preview_sft_example,
|
|
211
|
-
)
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
See [Python API](docs/python-api.md) for the full public surface.
|
|
215
|
-
|
|
216
|
-
## Status
|
|
217
|
-
|
|
218
|
-
Teich is alpha. The core trace, preparation, masking, and audit workflow is usable, but APIs may evolve as more agent formats and training flows are added.
|
|
219
|
-
|
|
220
|
-
## Development
|
|
221
|
-
|
|
222
|
-
```bash
|
|
223
|
-
uv pip install -e ".[dev]"
|
|
224
|
-
uv run pytest --ignore=tests/test_integration.py -q
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
## License
|
|
228
|
-
|
|
229
|
-
Apache-2.0
|
|
185
|
+
|
|
186
|
+
# Use a local OpenAI-compatible endpoint
|
|
187
|
+
TEICH_PROVIDER=LMstudio \
|
|
188
|
+
TEICH_MODEL=gemma-4 \
|
|
189
|
+
TEICH_BASE_URL=http://localhost:1234/v1 \
|
|
190
|
+
TEICH_API_KEY=llm \
|
|
191
|
+
teich generate -c config.yaml
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
## Minimal Config
|
|
195
|
+
|
|
196
|
+
```yaml
|
|
197
|
+
agent:
|
|
198
|
+
provider: codex # codex, pi, claude-code, hermes, or chat
|
|
199
|
+
|
|
200
|
+
model:
|
|
201
|
+
model: codex-mini-latest
|
|
202
|
+
approval_policy: never
|
|
203
|
+
sandbox: danger-full-access
|
|
204
|
+
|
|
205
|
+
prompts_file: prompts.jsonl
|
|
206
|
+
|
|
207
|
+
output:
|
|
208
|
+
traces_dir: ./output
|
|
209
|
+
sandbox_dir: ./sandbox
|
|
210
|
+
failures_dir: ./failures
|
|
211
|
+
|
|
212
|
+
publish:
|
|
213
|
+
repo_id: username/my-dataset
|
|
214
|
+
private: false
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
`agent.provider: chat` writes structured chat rows directly and does not require Docker. Agent providers preserve raw or native traces as source-of-truth artifacts.
|
|
218
|
+
|
|
219
|
+
## Python Entry Points
|
|
220
|
+
|
|
221
|
+
```python
|
|
222
|
+
from teich import (
|
|
223
|
+
prepare_data,
|
|
224
|
+
mask_data,
|
|
225
|
+
load_traces,
|
|
226
|
+
detect_trace_type,
|
|
227
|
+
validate_tool_calls,
|
|
228
|
+
row_fits_context,
|
|
229
|
+
trace_is_complete,
|
|
230
|
+
preview_sft_example,
|
|
231
|
+
)
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
See [Python API](docs/python-api.md) for the full public surface.
|
|
235
|
+
|
|
236
|
+
## Status
|
|
237
|
+
|
|
238
|
+
Teich is alpha. The core trace, preparation, masking, and audit workflow is usable, but APIs may evolve as more agent formats and training flows are added.
|
|
239
|
+
|
|
240
|
+
## Development
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
uv pip install -e ".[dev]"
|
|
244
|
+
uv run pytest --ignore=tests/test_integration.py -q
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
## License
|
|
248
|
+
|
|
249
|
+
Apache-2.0
|