Commit 9587832
committed
Sessions: semantic session_search over shared embedding backend
Phase 2: route the session VectorIndex through internal/embedding so
session_search gains real semantic matching when an HTTP embeddings
backend (Ollama/OpenAI/etc.) is configured, instead of being hardwired to
go-vector RandomProjections.
- VectorIndex.emb is now embedding.TextEmbedder, selected by an
embedding.Config. Default (nil) stays RandomProjections — unchanged
for existing users.
- Add a vectors_meta.json fingerprint file next to vectors.gob. On init
the persisted vectors are only reused when the embedder fingerprint
(provider/model/dims) matches; switching backends forces a one-time
rebuild in the new space. A missing meta (legacy layout) also rebuilds,
since the old raw-text RP vectors live in a different space than the
shared featurized embedder.
- Rebuild batch-embeds the whole corpus via EmbedAll (one HTTP call) and
adopts the episode index's 30s failure cool-down so a down backend is
not hammered on every search or session save.
- Resilience: Add never fails a session save and Search never surfaces an
error when the backend is unavailable — both degrade silently to the
keyword fallback in session_search_tool.go (left untouched).
Wiring: Store.InitVectorIndex takes an *embedding.Config; the continue and
telegram entry points pass memory's embedding config so a single endpoint
powers both subsystems (a dedicated sessions block lands in Phase 4).
Tests mirror memory's: HTTP semantic match (kitten→feline), fingerprint
invalidation forcing a rebuild, and the rebuild backoff under a down backend.1 parent 9d60500 commit 9587832
5 files changed
Lines changed: 390 additions & 95 deletions
File tree
- cmd/odek
- internal/session
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1640 | 1640 | | |
1641 | 1641 | | |
1642 | 1642 | | |
1643 | | - | |
1644 | | - | |
1645 | 1643 | | |
1646 | 1644 | | |
1647 | 1645 | | |
| |||
1659 | 1657 | | |
1660 | 1658 | | |
1661 | 1659 | | |
| 1660 | + | |
| 1661 | + | |
| 1662 | + | |
| 1663 | + | |
1662 | 1664 | | |
1663 | 1665 | | |
1664 | 1666 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
146 | | - | |
147 | | - | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
148 | 149 | | |
149 | 150 | | |
150 | 151 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
74 | 75 | | |
75 | 76 | | |
76 | 77 | | |
77 | | - | |
| 78 | + | |
| 79 | + | |
78 | 80 | | |
79 | | - | |
80 | | - | |
| 81 | + | |
| 82 | + | |
81 | 83 | | |
82 | 84 | | |
83 | 85 | | |
84 | 86 | | |
85 | | - | |
| 87 | + | |
86 | 88 | | |
87 | 89 | | |
88 | 90 | | |
| |||
0 commit comments