Skip to content

Commit 778a639

Browse files
README: chunks and markdown
1 parent 8d8b5da commit 778a639

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

‎README.md‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,18 @@ pending = [r.job_id for r in res.results if r.outcome == "processing"]
8181
res = tf.transcripts.batch(ids, mode="captions") # captions only, no audio fallback
8282
```
8383

84+
## Chunks and Markdown for RAG (2.5.0+)
85+
86+
```python
87+
t = tf.transcripts.video("https://www.youtube.com/watch?v=aircAruvnKk", chunks=True, markdown=True)
88+
89+
for c in t.chunks: # embedding-sized pieces, split between caption lines
90+
print(c.index, c.start, c.end, c.tokens, c.url) # url opens the video at c.start
91+
print(t.markdown) # title, channel, length, then timestamped paragraphs
92+
```
93+
94+
`chunks=True` uses 500-token pieces with a 50-token overlap; pass `{"max_tokens": 800, "overlap_tokens": 80}` to change them (100 to 2000, overlap 0 to 200). Both options are free, work on `batch()` too, and an audio-transcription job delivers them when it finishes. For LangChain and LlamaIndex, use `langchain-transcriptfetch` and `llama-index-readers-transcriptfetch`, which are built on these.
95+
8496
## Monitors (2.4.0+)
8597

8698
Watch a YouTube channel or a TikTok/Instagram profile for new videos. Creation

0 commit comments

Comments
 (0)