Commit 942e121
committed
feat(ollama): return real token counts from embedding endpoint
- Switch from deprecated /api/embeddings to /api/embed
- generateEmbedding() now returns EmbeddingResult { embedding, promptTokens }
instead of plain number[] — promptTokens comes from prompt_eval_count
- Add OllamaAdapter.embed() convenience method
- Update live tests to verify promptTokens > 0
- Update README with new return type and adapter example
BREAKING CHANGE: generateEmbedding() return type changed from
Promise<number[]> to Promise<EmbeddingResult>1 parent af045fe commit 942e121
3 files changed
Lines changed: 51 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
54 | | - | |
55 | | - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
| |||
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
67 | | - | |
| 68 | + | |
68 | 69 | | |
69 | 70 | | |
70 | 71 | | |
| |||
75 | 76 | | |
76 | 77 | | |
77 | 78 | | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
78 | 83 | | |
79 | 84 | | |
80 | 85 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
205 | 205 | | |
206 | 206 | | |
207 | 207 | | |
208 | | - | |
| 208 | + | |
209 | 209 | | |
210 | | - | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
211 | 224 | | |
212 | | - | |
213 | | - | |
214 | | - | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
215 | 230 | | |
216 | 231 | | |
217 | 232 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
246 | 246 | | |
247 | 247 | | |
248 | 248 | | |
249 | | - | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
250 | 258 | | |
| 259 | + | |
251 | 260 | | |
252 | 261 | | |
253 | 262 | | |
| |||
297 | 306 | | |
298 | 307 | | |
299 | 308 | | |
300 | | - | |
301 | | - | |
| 309 | + | |
| 310 | + | |
302 | 311 | | |
303 | 312 | | |
304 | | - | |
| 313 | + | |
305 | 314 | | |
306 | 315 | | |
307 | 316 | | |
308 | 317 | | |
309 | 318 | | |
310 | | - | |
311 | | - | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
312 | 324 | | |
313 | 325 | | |
314 | 326 | | |
| |||
385 | 397 | | |
386 | 398 | | |
387 | 399 | | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
388 | 404 | | |
389 | 405 | | |
390 | 406 | | |
| |||
0 commit comments