You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(w43): revise Day 5 plan — drop MMR (not in @langchain/core), add gap analysis
- Drop W43.5d (maxMarginalRelevanceSearch): not on VectorStore prototype
- Replace with similaritySearch + similaritySearchWithScore default tests
- Add post-Day-4 gap analysis (101 tests delivered, dist/ not yet built)
- Document actual available default methods from @langchain/core@0.3.x
- Note tsup output path uncertainty for build verification
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1.`pkg/langchain/tests/integration.test.ts` — **NEW FILE** (does not exist yet)
20
+
2.`pkg/langchain/dist/` — **NOT YET BUILT** (tsup configured but never run)
21
+
3. Verification of inherited LangChain methods (`similaritySearch`, `similaritySearchWithScore`, `asRetriever`)
22
+
23
+
**Plan correction:**`maxMarginalRelevanceSearch` does NOT exist on the installed `@langchain/core@0.3.x` VectorStore prototype. Task W43.5d is **DROPPED** and replaced with `similaritySearch` string-query test (the actual default method that calls embedQuery + similaritySearchVectorWithScore).
24
+
25
+
---
26
+
11
27
## Tasks
12
28
13
29
| Task | ID | Hours | Status | Dependency |
14
30
|:-----|:---|:------|:-------|:-----------|
15
31
| Create integration test with mock embeddings (no external API) | W43.5a | 1.5h | PENDING | Day 4 |
16
-
| Test full RAG pipeline: embed → store → search → retrieve | W43.5b | 1h | PENDING | W43.5a |
17
-
| Test `addDocuments` default implementation (embeds via `this.embeddings`) | W43.5c | 0.5h | PENDING | Day 3 |
18
-
| Test `maxMarginalRelevanceSearch` default with EdgeVec scores| W43.5d | 0.5h | PENDING | Day 3 |
32
+
| Test full RAG pipeline: embed -> store -> search -> retrieve | W43.5b | 1h | PENDING | W43.5a |
33
+
| Test `similaritySearch` default (string query -> embedQuery -> search) | W43.5c | 0.5h | PENDING | Day 3 |
34
+
| Test `similaritySearchWithScore` default (string query variant)| W43.5d | 0.5h | PENDING | Day 3 |
19
35
| Test `asRetriever()` returns functional `VectorStoreRetriever`| W43.5e | 0.5h | PENDING | Day 3 |
Key difference from unit test `MockEmbeddings`: **deterministic and text-dependent** — different texts produce different vectors, enabling meaningful similarity ranking tests.
92
+
73
93
### W43.5b — Full RAG Pipeline
74
94
75
95
```
76
-
Input texts → Embed → Add to store → Query → Get documents back
96
+
Input texts -> Embed -> Add to store -> Query (string) -> Get documents back
77
97
```
78
98
79
99
Verify:
80
100
1. Documents returned have correct `pageContent`
81
101
2. Documents returned have correct `metadata`
82
102
3. Scores are in [0, 1] range
83
-
4. Most similar document is ranked first
103
+
4. Document IDs are preserved through the pipeline
104
+
5. Results array length <= k
105
+
106
+
### W43.5c — Default `similaritySearch`
84
107
85
-
### W43.5c — Default `addDocuments`
108
+
The `VectorStore` base class provides `similaritySearch(query, k, filter)` which:
109
+
1. Calls `this.embeddings.embedQuery(query)` to get a vector
110
+
2. Calls `this.similaritySearchVectorWithScore(vector, k, filter)` to get results
111
+
3. Returns just the `Document[]` (strips scores)
86
112
87
-
The `VectorStore` base class provides `addDocuments` which calls `this.embeddings.embedDocuments()` then `this.addVectors()`. Verify this works correctly with `EdgeVecStore`.
113
+
Verify this chain works correctly with EdgeVecStore.
88
114
89
-
### W43.5d — Default `maxMarginalRelevanceSearch`
115
+
### W43.5d — Default `similaritySearchWithScore`
90
116
91
-
Verify that the MMR default implementation works with EdgeVec's score format. May return fewer results than `k` — that's expected behavior.
117
+
Same as `similaritySearch` but returns `[Document, score][]` (preserves scores). Verify scores are normalized.
-`dist/index.js` or `dist/index.mjs` exists (ESM output)
140
+
-`dist/index.cjs` exists (CJS output)
141
+
-`dist/index.d.ts` or `dist/index.d.cts` exists (type declarations)
111
142
- No TypeScript errors in strict mode
143
+
- Bundle size < 10KB (excluding edgevec WASM)
144
+
145
+
**Note:** tsup.config.ts output structure may differ from the `dist/esm/` + `dist/cjs/` layout described in the original plan. Check actual tsup output paths.
112
146
113
147
### W43.5g — Peer Dep Compatibility
114
148
115
149
Test installation with:
116
150
-`@langchain/core@0.3.0` (lower bound)
117
-
-`@langchain/core@0.4.x` (latest in range)
151
+
-`@langchain/core@0.4.x` (latest in range, if available)
152
+
153
+
Verify `npm install` succeeds and basic import works. This is a **verification task**, not a separate test suite — run in a temp directory with `npm pack` output.
154
+
155
+
---
156
+
157
+
## Implementation Notes
158
+
159
+
### Mock Strategy
160
+
161
+
Integration tests use the same WASM mock pattern as `store.test.ts`:
But the mock search implementation should be **smarter** for RAG pipeline tests: return results that correspond to what was added, so the pipeline test is meaningful.
166
+
167
+
### Reuse from Day 4
168
+
169
+
-`MockEmbeddings` class pattern (extends `Embeddings`)
170
+
-`testInternals()` accessor pattern
171
+
- IDB cleanup in `beforeEach`
172
+
- Same `vi.mock` setup (can be extracted to a shared test helper if needed)
173
+
174
+
### Available Default Methods (Verified)
175
+
176
+
From `@langchain/core@0.3.x` VectorStore prototype:
| tsup output paths differ from expected `dist/esm/` + `dist/cjs/`| Check actual tsup output after first build; update package.json `exports` if needed |
144
208
145
209
---
146
210
147
211
## Exit Criteria
148
212
149
213
**Day 5 is complete when:**
150
214
1. All 7 tasks are DONE
151
-
2.`npx vitest run tests/integration.test.ts` passes
0 commit comments