@amemhq/core 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -16,6 +16,43 @@ declare function configure(opts: {
16
16
  declare const DEFAULT_EMBEDDING_MODEL = "Xenova/paraphrase-multilingual-MiniLM-L12-v2";
17
17
  /** Which model this process embeds with. */
18
18
  declare function getEmbeddingModel(): string;
19
+ /** How token embeddings are collapsed into one sentence vector. */
20
+ type PoolingMode = 'mean' | 'cls';
21
+ /**
22
+ * Which pooling this process uses: `AMEM_EMBED_POOLING`, else the model's known
23
+ * mode, else `mean`.
24
+ *
25
+ * Getting this wrong does not fail. `encode()` returns a normalized vector of the
26
+ * right width either way, and search keeps working because notes and queries are
27
+ * embedded by the same function — it just retrieves worse than the model can,
28
+ * with nothing to indicate it. That is why the mode is resolved rather than
29
+ * assumed.
30
+ */
31
+ declare function getEmbeddingPooling(): PoolingMode;
32
+ /**
33
+ * Where inference runs. Unset means Transformers.js picks, which on Node is `cpu`.
34
+ *
35
+ * It is not CPU-only for lack of anything else: `onnxruntime-node`'s macOS arm64
36
+ * binary links CoreML.framework and exports the CoreML provider, and
37
+ * Transformers.js lists `coreml` (macOS), `dml` (Windows), `cuda` (Linux x64) and
38
+ * `webgpu` alongside `cpu`. It simply defaults to `cpu` and amem never asked for
39
+ * anything else.
40
+ *
41
+ * Whether asking helps is **unmeasured**. CoreML partitions a graph operator by
42
+ * operator and falls back to CPU for the ones it cannot take, so it can lose to
43
+ * plain CPU on some models and pay a compile cost on first load. Hence: opt-in,
44
+ * default unchanged, and no recommendation until someone benchmarks it.
45
+ */
46
+ declare function getEmbeddingDevice(): string | undefined;
47
+ /**
48
+ * Weight precision. Unset means Transformers.js picks, which on Node is `fp32` —
49
+ * the largest download of every variant a model publishes.
50
+ *
51
+ * Passed through rather than validated against a list: Transformers.js already
52
+ * rejects an unknown value and names the valid ones, and a list here would go
53
+ * stale the moment it gains a quantization.
54
+ */
55
+ declare function getEmbeddingDtype(): string | undefined;
19
56
  /**
20
57
  * The vector width this model produces, measured rather than looked up.
21
58
  *
@@ -26,7 +63,8 @@ declare function getEmbeddingModel(): string;
26
63
  */
27
64
  declare function getEmbeddingDim(): Promise<number>;
28
65
  /**
29
- * Encode text to 384-dim normalized embedding vector.
66
+ * Encode text to a normalized embedding vector. The width is the model's — 384
67
+ * for the default, 1024 for bge-m3 — so nothing here should assume a number.
30
68
  * Singleton model, loaded once and reused.
31
69
  */
32
70
  declare function encode(text: string): Promise<number[]>;
@@ -140,6 +178,18 @@ declare class EmbeddingDimensionMismatchError extends Error {
140
178
  readonly model: string;
141
179
  constructor(collection: string, collectionDim: number, modelDim: number, model: string);
142
180
  }
181
+ /**
182
+ * Which embedding model built a collection, and what the process wants to use.
183
+ *
184
+ * Vector width is the only thing Qdrant can check for us, and two models of the
185
+ * same width are indistinguishable to it. This is the case that check misses.
186
+ */
187
+ declare class EmbeddingModelMismatchError extends Error {
188
+ readonly collection: string;
189
+ readonly collectionModel: string;
190
+ readonly configuredModel: string;
191
+ constructor(collection: string, collectionModel: string, configuredModel: string);
192
+ }
143
193
  /**
144
194
  * Ask Qdrant whether it can serve, right now.
145
195
  *
@@ -499,4 +549,4 @@ declare function llmCrudDecision(userText: string, assistantText: string, existi
499
549
  content: string;
500
550
  }>): Promise<MemoryOperation[]>;
501
551
 
502
- export { type AgentAmemConfig, type AmemPluginConfig, type ConflictMode, type ConflictSweepResult, DEFAULT_CRUD_UPDATE_MIN_SIM, DEFAULT_EMBEDDING_MODEL, EmbeddingDimensionMismatchError, type EvolutionEntry, type LlmConfig, type LowQualityItem, type LowQualityReason, type MemoryNote, type MemoryOperation, type MigrateResult, type QueryResult, type SearchResult, type StorageContext, addEpisodic, addMemory, canRead, canWrite, checkQuality, configure, configureLlm, conflictSweep, consolidateMemories, createStorageContext, deleteNote, encode, ensureCollection, generateReviewBatch, getEmbeddingDim, getEmbeddingModel, getNote, invalidateNote, isModelLoaded, isPlausibleUpdateTarget, listMemories, listNotes, llmCrudDecision, loadModel, mergeSimilarNotes, migrateCollection, patchNotePayload, pingQdrant, resolveCrudUpdateMinSim, scanLowQuality, searchMemory, updateNote };
552
+ export { type AgentAmemConfig, type AmemPluginConfig, type ConflictMode, type ConflictSweepResult, DEFAULT_CRUD_UPDATE_MIN_SIM, DEFAULT_EMBEDDING_MODEL, EmbeddingDimensionMismatchError, EmbeddingModelMismatchError, type EvolutionEntry, type LlmConfig, type LowQualityItem, type LowQualityReason, type MemoryNote, type MemoryOperation, type MigrateResult, type PoolingMode, type QueryResult, type SearchResult, type StorageContext, addEpisodic, addMemory, canRead, canWrite, checkQuality, configure, configureLlm, conflictSweep, consolidateMemories, createStorageContext, deleteNote, encode, ensureCollection, generateReviewBatch, getEmbeddingDevice, getEmbeddingDim, getEmbeddingDtype, getEmbeddingModel, getEmbeddingPooling, getNote, invalidateNote, isModelLoaded, isPlausibleUpdateTarget, listMemories, listNotes, llmCrudDecision, loadModel, mergeSimilarNotes, migrateCollection, patchNotePayload, pingQdrant, resolveCrudUpdateMinSim, scanLowQuality, searchMemory, updateNote };
package/dist/index.d.ts CHANGED
@@ -16,6 +16,43 @@ declare function configure(opts: {
16
16
  declare const DEFAULT_EMBEDDING_MODEL = "Xenova/paraphrase-multilingual-MiniLM-L12-v2";
17
17
  /** Which model this process embeds with. */
18
18
  declare function getEmbeddingModel(): string;
19
+ /** How token embeddings are collapsed into one sentence vector. */
20
+ type PoolingMode = 'mean' | 'cls';
21
+ /**
22
+ * Which pooling this process uses: `AMEM_EMBED_POOLING`, else the model's known
23
+ * mode, else `mean`.
24
+ *
25
+ * Getting this wrong does not fail. `encode()` returns a normalized vector of the
26
+ * right width either way, and search keeps working because notes and queries are
27
+ * embedded by the same function — it just retrieves worse than the model can,
28
+ * with nothing to indicate it. That is why the mode is resolved rather than
29
+ * assumed.
30
+ */
31
+ declare function getEmbeddingPooling(): PoolingMode;
32
+ /**
33
+ * Where inference runs. Unset means Transformers.js picks, which on Node is `cpu`.
34
+ *
35
+ * It is not CPU-only for lack of anything else: `onnxruntime-node`'s macOS arm64
36
+ * binary links CoreML.framework and exports the CoreML provider, and
37
+ * Transformers.js lists `coreml` (macOS), `dml` (Windows), `cuda` (Linux x64) and
38
+ * `webgpu` alongside `cpu`. It simply defaults to `cpu` and amem never asked for
39
+ * anything else.
40
+ *
41
+ * Whether asking helps is **unmeasured**. CoreML partitions a graph operator by
42
+ * operator and falls back to CPU for the ones it cannot take, so it can lose to
43
+ * plain CPU on some models and pay a compile cost on first load. Hence: opt-in,
44
+ * default unchanged, and no recommendation until someone benchmarks it.
45
+ */
46
+ declare function getEmbeddingDevice(): string | undefined;
47
+ /**
48
+ * Weight precision. Unset means Transformers.js picks, which on Node is `fp32` —
49
+ * the largest download of every variant a model publishes.
50
+ *
51
+ * Passed through rather than validated against a list: Transformers.js already
52
+ * rejects an unknown value and names the valid ones, and a list here would go
53
+ * stale the moment it gains a quantization.
54
+ */
55
+ declare function getEmbeddingDtype(): string | undefined;
19
56
  /**
20
57
  * The vector width this model produces, measured rather than looked up.
21
58
  *
@@ -26,7 +63,8 @@ declare function getEmbeddingModel(): string;
26
63
  */
27
64
  declare function getEmbeddingDim(): Promise<number>;
28
65
  /**
29
- * Encode text to 384-dim normalized embedding vector.
66
+ * Encode text to a normalized embedding vector. The width is the model's — 384
67
+ * for the default, 1024 for bge-m3 — so nothing here should assume a number.
30
68
  * Singleton model, loaded once and reused.
31
69
  */
32
70
  declare function encode(text: string): Promise<number[]>;
@@ -140,6 +178,18 @@ declare class EmbeddingDimensionMismatchError extends Error {
140
178
  readonly model: string;
141
179
  constructor(collection: string, collectionDim: number, modelDim: number, model: string);
142
180
  }
181
+ /**
182
+ * Which embedding model built a collection, and what the process wants to use.
183
+ *
184
+ * Vector width is the only thing Qdrant can check for us, and two models of the
185
+ * same width are indistinguishable to it. This is the case that check misses.
186
+ */
187
+ declare class EmbeddingModelMismatchError extends Error {
188
+ readonly collection: string;
189
+ readonly collectionModel: string;
190
+ readonly configuredModel: string;
191
+ constructor(collection: string, collectionModel: string, configuredModel: string);
192
+ }
143
193
  /**
144
194
  * Ask Qdrant whether it can serve, right now.
145
195
  *
@@ -499,4 +549,4 @@ declare function llmCrudDecision(userText: string, assistantText: string, existi
499
549
  content: string;
500
550
  }>): Promise<MemoryOperation[]>;
501
551
 
502
- export { type AgentAmemConfig, type AmemPluginConfig, type ConflictMode, type ConflictSweepResult, DEFAULT_CRUD_UPDATE_MIN_SIM, DEFAULT_EMBEDDING_MODEL, EmbeddingDimensionMismatchError, type EvolutionEntry, type LlmConfig, type LowQualityItem, type LowQualityReason, type MemoryNote, type MemoryOperation, type MigrateResult, type QueryResult, type SearchResult, type StorageContext, addEpisodic, addMemory, canRead, canWrite, checkQuality, configure, configureLlm, conflictSweep, consolidateMemories, createStorageContext, deleteNote, encode, ensureCollection, generateReviewBatch, getEmbeddingDim, getEmbeddingModel, getNote, invalidateNote, isModelLoaded, isPlausibleUpdateTarget, listMemories, listNotes, llmCrudDecision, loadModel, mergeSimilarNotes, migrateCollection, patchNotePayload, pingQdrant, resolveCrudUpdateMinSim, scanLowQuality, searchMemory, updateNote };
552
+ export { type AgentAmemConfig, type AmemPluginConfig, type ConflictMode, type ConflictSweepResult, DEFAULT_CRUD_UPDATE_MIN_SIM, DEFAULT_EMBEDDING_MODEL, EmbeddingDimensionMismatchError, EmbeddingModelMismatchError, type EvolutionEntry, type LlmConfig, type LowQualityItem, type LowQualityReason, type MemoryNote, type MemoryOperation, type MigrateResult, type PoolingMode, type QueryResult, type SearchResult, type StorageContext, addEpisodic, addMemory, canRead, canWrite, checkQuality, configure, configureLlm, conflictSweep, consolidateMemories, createStorageContext, deleteNote, encode, ensureCollection, generateReviewBatch, getEmbeddingDevice, getEmbeddingDim, getEmbeddingDtype, getEmbeddingModel, getEmbeddingPooling, getNote, invalidateNote, isModelLoaded, isPlausibleUpdateTarget, listMemories, listNotes, llmCrudDecision, loadModel, mergeSimilarNotes, migrateCollection, patchNotePayload, pingQdrant, resolveCrudUpdateMinSim, scanLowQuality, searchMemory, updateNote };