Embed¶
transcript_indexer.embed
¶
Embedding pipeline.
Wraps PydanticAI's Embedder to chunk conversation turns and persist
vectors into chunk_embeddings. Embeddings are cached by chunks.text_hash
so re-syncing a conversation with unchanged content reuses existing vectors.
The vec0 chunk_embeddings table is keyed by chunks.id (passed as rowid).
build_embedder(cfg)
¶
Construct an Embedder from EmbeddingConfig.
Source code in src/transcript_indexer/embed.py
embed_conversation(conn, cfg, conversation_id, *, embedder=None, report=None, on_progress=None)
¶
Chunk and embed a single conversation.
Assumes chunks rows for this conversation have already been cleared
(sync's delete-and-reinsert handles this naturally on new/changed
conversations).
on_progress fires with these events for UI feedback:
- ("conversation_start", conversation_id)
- ("chunks_planned", n_chunks)
- ("cached", n) after each cache-hit copy
- ("embedded", n) after each batch is persisted
- ("conversation_done", conversation_id)
Source code in src/transcript_indexer/embed.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | |
embed_conversations(conn, cfg, conversation_ids, *, embedder=None, on_progress=None)
¶
Embed many conversations sharing a single Embedder instance.