feat(memory): refuse to open a memory store with a different embedder
Vectors of different models are not comparable even at the same size; the store records its embedder in waggle-memory.json and names the mismatch. Also drop the weaver references from the cli and server tsconfigs.
This commit is contained in:
@@ -32,11 +32,12 @@ export async function openMemoryStore(options: OpenMemoryOptions): Promise<Memor
|
||||
* model download; tests use it. Otherwise memory uses the in-process model,
|
||||
* loaded on first use so startup never waits for a download.
|
||||
*/
|
||||
function memoryEmbedder(options: OpenMemoryOptions): Embedder {
|
||||
function memoryEmbedder(options: OpenMemoryOptions): Embedder & { id?: string } {
|
||||
if (process.env.WAGGLE_MEMORY_EMBEDDER === 'words') {
|
||||
const words = createWordEmbedder();
|
||||
return {
|
||||
dimensions: words.dimensions,
|
||||
id: words.id,
|
||||
embed: async (text) => Float32Array.from(await words.embed(text)),
|
||||
embedBatch: async (texts) => (await words.embedBatch(texts)).map((v) => Float32Array.from(v)),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user