mem0ai 2.1.38 → 2.2.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.
@@ -16,6 +16,7 @@ interface EmbeddingConfig {
16
16
  apiKey?: string;
17
17
  model?: string | any;
18
18
  url?: string;
19
+ embeddingDims?: number;
19
20
  modelProperties?: Record<string, any>;
20
21
  }
21
22
  interface VectorStoreConfig {
@@ -107,16 +108,22 @@ declare const MemoryConfigSchema: z.ZodObject<{
107
108
  apiKey: z.ZodOptional<z.ZodString>;
108
109
  model: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodAny]>>;
109
110
  baseURL: z.ZodOptional<z.ZodString>;
111
+ embeddingDims: z.ZodOptional<z.ZodNumber>;
112
+ url: z.ZodOptional<z.ZodString>;
110
113
  }, "strip", z.ZodTypeAny, {
111
114
  modelProperties?: Record<string, any> | undefined;
112
115
  apiKey?: string | undefined;
113
116
  model?: any;
114
117
  baseURL?: string | undefined;
118
+ embeddingDims?: number | undefined;
119
+ url?: string | undefined;
115
120
  }, {
116
121
  modelProperties?: Record<string, any> | undefined;
117
122
  apiKey?: string | undefined;
118
123
  model?: any;
119
124
  baseURL?: string | undefined;
125
+ embeddingDims?: number | undefined;
126
+ url?: string | undefined;
120
127
  }>;
121
128
  }, "strip", z.ZodTypeAny, {
122
129
  provider: string;
@@ -125,6 +132,8 @@ declare const MemoryConfigSchema: z.ZodObject<{
125
132
  apiKey?: string | undefined;
126
133
  model?: any;
127
134
  baseURL?: string | undefined;
135
+ embeddingDims?: number | undefined;
136
+ url?: string | undefined;
128
137
  };
129
138
  }, {
130
139
  provider: string;
@@ -133,6 +142,8 @@ declare const MemoryConfigSchema: z.ZodObject<{
133
142
  apiKey?: string | undefined;
134
143
  model?: any;
135
144
  baseURL?: string | undefined;
145
+ embeddingDims?: number | undefined;
146
+ url?: string | undefined;
136
147
  };
137
148
  }>;
138
149
  vectorStore: z.ZodObject<{
@@ -277,6 +288,8 @@ declare const MemoryConfigSchema: z.ZodObject<{
277
288
  apiKey?: string | undefined;
278
289
  model?: any;
279
290
  baseURL?: string | undefined;
291
+ embeddingDims?: number | undefined;
292
+ url?: string | undefined;
280
293
  };
281
294
  };
282
295
  vectorStore: {
@@ -328,6 +341,8 @@ declare const MemoryConfigSchema: z.ZodObject<{
328
341
  apiKey?: string | undefined;
329
342
  model?: any;
330
343
  baseURL?: string | undefined;
344
+ embeddingDims?: number | undefined;
345
+ url?: string | undefined;
331
346
  };
332
347
  };
333
348
  vectorStore: {
@@ -439,6 +454,7 @@ interface Embedder {
439
454
  declare class OpenAIEmbedder implements Embedder {
440
455
  private openai;
441
456
  private model;
457
+ private embeddingDims?;
442
458
  constructor(config: EmbeddingConfig);
443
459
  embed(text: string): Promise<number[]>;
444
460
  embedBatch(texts: string[]): Promise<number[][]>;
@@ -447,6 +463,7 @@ declare class OpenAIEmbedder implements Embedder {
447
463
  declare class OllamaEmbedder implements Embedder {
448
464
  private ollama;
449
465
  private model;
466
+ private embeddingDims?;
450
467
  private initialized;
451
468
  constructor(config: EmbeddingConfig);
452
469
  embed(text: string): Promise<number[]>;
@@ -457,6 +474,7 @@ declare class OllamaEmbedder implements Embedder {
457
474
  declare class GoogleEmbedder implements Embedder {
458
475
  private google;
459
476
  private model;
477
+ private embeddingDims?;
460
478
  constructor(config: EmbeddingConfig);
461
479
  embed(text: string): Promise<number[]>;
462
480
  embedBatch(texts: string[]): Promise<number[][]>;
@@ -465,6 +483,7 @@ declare class GoogleEmbedder implements Embedder {
465
483
  declare class AzureOpenAIEmbedder implements Embedder {
466
484
  private client;
467
485
  private model;
486
+ private embeddingDims?;
468
487
  constructor(config: EmbeddingConfig);
469
488
  embed(text: string): Promise<number[]>;
470
489
  embedBatch(texts: string[]): Promise<number[][]>;
@@ -742,6 +761,144 @@ declare class VectorizeDB implements VectorStore {
742
761
  initialize(): Promise<void>;
743
762
  }
744
763
 
764
+ /**
765
+ * Configuration interface for Azure AI Search vector store
766
+ */
767
+ interface AzureAISearchConfig extends VectorStoreConfig {
768
+ /**
769
+ * Azure AI Search service name (e.g., "my-search-service")
770
+ */
771
+ serviceName: string;
772
+ /**
773
+ * Index/collection name to use
774
+ */
775
+ collectionName: string;
776
+ /**
777
+ * API key for authentication (if not provided, uses DefaultAzureCredential)
778
+ */
779
+ apiKey?: string;
780
+ /**
781
+ * Vector embedding dimensions
782
+ */
783
+ embeddingModelDims: number;
784
+ /**
785
+ * Compression type: 'none', 'scalar', or 'binary'
786
+ * @default 'none'
787
+ */
788
+ compressionType?: "none" | "scalar" | "binary";
789
+ /**
790
+ * Use half precision (float16) instead of full precision (float32)
791
+ * @default false
792
+ */
793
+ useFloat16?: boolean;
794
+ /**
795
+ * Enable hybrid search (combines vector + text search)
796
+ * @default false
797
+ */
798
+ hybridSearch?: boolean;
799
+ /**
800
+ * Vector filter mode: 'preFilter' or 'postFilter'
801
+ * @default 'preFilter'
802
+ */
803
+ vectorFilterMode?: string;
804
+ }
805
+ /**
806
+ * Azure AI Search vector store implementation
807
+ * Supports vector search with hybrid search, compression, and filtering
808
+ */
809
+ declare class AzureAISearch implements VectorStore {
810
+ private searchClient;
811
+ private indexClient;
812
+ private readonly serviceName;
813
+ private readonly indexName;
814
+ private readonly embeddingModelDims;
815
+ private readonly compressionType;
816
+ private readonly useFloat16;
817
+ private readonly hybridSearch;
818
+ private readonly vectorFilterMode;
819
+ private readonly apiKey;
820
+ constructor(config: AzureAISearchConfig);
821
+ /**
822
+ * Initialize the Azure AI Search index if it doesn't exist
823
+ */
824
+ initialize(): Promise<void>;
825
+ /**
826
+ * Create a new index in Azure AI Search
827
+ */
828
+ private createCol;
829
+ /**
830
+ * Generate a document for insertion
831
+ */
832
+ private generateDocument;
833
+ /**
834
+ * Insert vectors into the index
835
+ */
836
+ insert(vectors: number[][], ids: string[], payloads: Record<string, any>[]): Promise<void>;
837
+ /**
838
+ * Sanitize filter keys to remove non-alphanumeric characters
839
+ */
840
+ private sanitizeKey;
841
+ /**
842
+ * Build OData filter expression from SearchFilters
843
+ */
844
+ private buildFilterExpression;
845
+ /**
846
+ * Extract JSON from payload string
847
+ * Handles cases where payload might have extra text
848
+ */
849
+ private extractJson;
850
+ /**
851
+ * Search for similar vectors
852
+ */
853
+ search(query: number[], limit?: number, filters?: SearchFilters): Promise<VectorStoreResult[]>;
854
+ /**
855
+ * Delete a vector by ID
856
+ */
857
+ delete(vectorId: string): Promise<void>;
858
+ /**
859
+ * Update a vector and its payload
860
+ */
861
+ update(vectorId: string, vector: number[], payload: Record<string, any>): Promise<void>;
862
+ /**
863
+ * Retrieve a vector by ID
864
+ */
865
+ get(vectorId: string): Promise<VectorStoreResult | null>;
866
+ /**
867
+ * List all collections (indexes)
868
+ */
869
+ private listCols;
870
+ /**
871
+ * Delete the index
872
+ */
873
+ deleteCol(): Promise<void>;
874
+ /**
875
+ * Get information about the index
876
+ */
877
+ private colInfo;
878
+ /**
879
+ * List all vectors in the index
880
+ */
881
+ list(filters?: SearchFilters, limit?: number): Promise<[VectorStoreResult[], number]>;
882
+ /**
883
+ * Generate a random user ID
884
+ */
885
+ private generateUUID;
886
+ /**
887
+ * Get user ID from memory_migrations collection
888
+ * Required by VectorStore interface
889
+ */
890
+ getUserId(): Promise<string>;
891
+ /**
892
+ * Set user ID in memory_migrations collection
893
+ * Required by VectorStore interface
894
+ */
895
+ setUserId(userId: string): Promise<void>;
896
+ /**
897
+ * Reset the index by deleting and recreating it
898
+ */
899
+ reset(): Promise<void>;
900
+ }
901
+
745
902
  interface HistoryManager {
746
903
  addHistory(memoryId: string, previousValue: string | null, newValue: string | null, action: string, createdAt?: string, updatedAt?: string, isDeleted?: number): Promise<void>;
747
904
  getHistory(memoryId: string): Promise<any[]>;
@@ -762,4 +919,4 @@ declare class HistoryManagerFactory {
762
919
  static create(provider: string, config: HistoryStoreConfig): HistoryManager;
763
920
  }
764
921
 
765
- export { type AddMemoryOptions, AnthropicLLM, AzureOpenAIEmbedder, type DeleteAllMemoryOptions, type Embedder, EmbedderFactory, type EmbeddingConfig, type Entity, type GetAllMemoryOptions, GoogleEmbedder, GoogleLLM, type GraphStoreConfig, GroqLLM, HistoryManagerFactory, type HistoryStoreConfig, type LLM, type LLMConfig, LLMFactory, type LLMResponse, LangchainEmbedder, LangchainLLM, LangchainVectorStore, Memory, type MemoryConfig, MemoryConfigSchema, type MemoryItem, MemoryVectorStore, type Message, MistralLLM, type MultiModalMessages, type Neo4jConfig, OllamaEmbedder, OllamaLLM, OpenAIEmbedder, OpenAILLM, OpenAIStructuredLLM, Qdrant, RedisDB, type SearchFilters, type SearchMemoryOptions, type SearchResult, SupabaseDB, type VectorStore, type VectorStoreConfig, VectorStoreFactory, type VectorStoreResult, VectorizeDB };
922
+ export { type AddMemoryOptions, AnthropicLLM, AzureAISearch, AzureOpenAIEmbedder, type DeleteAllMemoryOptions, type Embedder, EmbedderFactory, type EmbeddingConfig, type Entity, type GetAllMemoryOptions, GoogleEmbedder, GoogleLLM, type GraphStoreConfig, GroqLLM, HistoryManagerFactory, type HistoryStoreConfig, type LLM, type LLMConfig, LLMFactory, type LLMResponse, LangchainEmbedder, LangchainLLM, LangchainVectorStore, Memory, type MemoryConfig, MemoryConfigSchema, type MemoryItem, MemoryVectorStore, type Message, MistralLLM, type MultiModalMessages, type Neo4jConfig, OllamaEmbedder, OllamaLLM, OpenAIEmbedder, OpenAILLM, OpenAIStructuredLLM, Qdrant, RedisDB, type SearchFilters, type SearchMemoryOptions, type SearchResult, SupabaseDB, type VectorStore, type VectorStoreConfig, VectorStoreFactory, type VectorStoreResult, VectorizeDB };
@@ -16,6 +16,7 @@ interface EmbeddingConfig {
16
16
  apiKey?: string;
17
17
  model?: string | any;
18
18
  url?: string;
19
+ embeddingDims?: number;
19
20
  modelProperties?: Record<string, any>;
20
21
  }
21
22
  interface VectorStoreConfig {
@@ -107,16 +108,22 @@ declare const MemoryConfigSchema: z.ZodObject<{
107
108
  apiKey: z.ZodOptional<z.ZodString>;
108
109
  model: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodAny]>>;
109
110
  baseURL: z.ZodOptional<z.ZodString>;
111
+ embeddingDims: z.ZodOptional<z.ZodNumber>;
112
+ url: z.ZodOptional<z.ZodString>;
110
113
  }, "strip", z.ZodTypeAny, {
111
114
  modelProperties?: Record<string, any> | undefined;
112
115
  apiKey?: string | undefined;
113
116
  model?: any;
114
117
  baseURL?: string | undefined;
118
+ embeddingDims?: number | undefined;
119
+ url?: string | undefined;
115
120
  }, {
116
121
  modelProperties?: Record<string, any> | undefined;
117
122
  apiKey?: string | undefined;
118
123
  model?: any;
119
124
  baseURL?: string | undefined;
125
+ embeddingDims?: number | undefined;
126
+ url?: string | undefined;
120
127
  }>;
121
128
  }, "strip", z.ZodTypeAny, {
122
129
  provider: string;
@@ -125,6 +132,8 @@ declare const MemoryConfigSchema: z.ZodObject<{
125
132
  apiKey?: string | undefined;
126
133
  model?: any;
127
134
  baseURL?: string | undefined;
135
+ embeddingDims?: number | undefined;
136
+ url?: string | undefined;
128
137
  };
129
138
  }, {
130
139
  provider: string;
@@ -133,6 +142,8 @@ declare const MemoryConfigSchema: z.ZodObject<{
133
142
  apiKey?: string | undefined;
134
143
  model?: any;
135
144
  baseURL?: string | undefined;
145
+ embeddingDims?: number | undefined;
146
+ url?: string | undefined;
136
147
  };
137
148
  }>;
138
149
  vectorStore: z.ZodObject<{
@@ -277,6 +288,8 @@ declare const MemoryConfigSchema: z.ZodObject<{
277
288
  apiKey?: string | undefined;
278
289
  model?: any;
279
290
  baseURL?: string | undefined;
291
+ embeddingDims?: number | undefined;
292
+ url?: string | undefined;
280
293
  };
281
294
  };
282
295
  vectorStore: {
@@ -328,6 +341,8 @@ declare const MemoryConfigSchema: z.ZodObject<{
328
341
  apiKey?: string | undefined;
329
342
  model?: any;
330
343
  baseURL?: string | undefined;
344
+ embeddingDims?: number | undefined;
345
+ url?: string | undefined;
331
346
  };
332
347
  };
333
348
  vectorStore: {
@@ -439,6 +454,7 @@ interface Embedder {
439
454
  declare class OpenAIEmbedder implements Embedder {
440
455
  private openai;
441
456
  private model;
457
+ private embeddingDims?;
442
458
  constructor(config: EmbeddingConfig);
443
459
  embed(text: string): Promise<number[]>;
444
460
  embedBatch(texts: string[]): Promise<number[][]>;
@@ -447,6 +463,7 @@ declare class OpenAIEmbedder implements Embedder {
447
463
  declare class OllamaEmbedder implements Embedder {
448
464
  private ollama;
449
465
  private model;
466
+ private embeddingDims?;
450
467
  private initialized;
451
468
  constructor(config: EmbeddingConfig);
452
469
  embed(text: string): Promise<number[]>;
@@ -457,6 +474,7 @@ declare class OllamaEmbedder implements Embedder {
457
474
  declare class GoogleEmbedder implements Embedder {
458
475
  private google;
459
476
  private model;
477
+ private embeddingDims?;
460
478
  constructor(config: EmbeddingConfig);
461
479
  embed(text: string): Promise<number[]>;
462
480
  embedBatch(texts: string[]): Promise<number[][]>;
@@ -465,6 +483,7 @@ declare class GoogleEmbedder implements Embedder {
465
483
  declare class AzureOpenAIEmbedder implements Embedder {
466
484
  private client;
467
485
  private model;
486
+ private embeddingDims?;
468
487
  constructor(config: EmbeddingConfig);
469
488
  embed(text: string): Promise<number[]>;
470
489
  embedBatch(texts: string[]): Promise<number[][]>;
@@ -742,6 +761,144 @@ declare class VectorizeDB implements VectorStore {
742
761
  initialize(): Promise<void>;
743
762
  }
744
763
 
764
+ /**
765
+ * Configuration interface for Azure AI Search vector store
766
+ */
767
+ interface AzureAISearchConfig extends VectorStoreConfig {
768
+ /**
769
+ * Azure AI Search service name (e.g., "my-search-service")
770
+ */
771
+ serviceName: string;
772
+ /**
773
+ * Index/collection name to use
774
+ */
775
+ collectionName: string;
776
+ /**
777
+ * API key for authentication (if not provided, uses DefaultAzureCredential)
778
+ */
779
+ apiKey?: string;
780
+ /**
781
+ * Vector embedding dimensions
782
+ */
783
+ embeddingModelDims: number;
784
+ /**
785
+ * Compression type: 'none', 'scalar', or 'binary'
786
+ * @default 'none'
787
+ */
788
+ compressionType?: "none" | "scalar" | "binary";
789
+ /**
790
+ * Use half precision (float16) instead of full precision (float32)
791
+ * @default false
792
+ */
793
+ useFloat16?: boolean;
794
+ /**
795
+ * Enable hybrid search (combines vector + text search)
796
+ * @default false
797
+ */
798
+ hybridSearch?: boolean;
799
+ /**
800
+ * Vector filter mode: 'preFilter' or 'postFilter'
801
+ * @default 'preFilter'
802
+ */
803
+ vectorFilterMode?: string;
804
+ }
805
+ /**
806
+ * Azure AI Search vector store implementation
807
+ * Supports vector search with hybrid search, compression, and filtering
808
+ */
809
+ declare class AzureAISearch implements VectorStore {
810
+ private searchClient;
811
+ private indexClient;
812
+ private readonly serviceName;
813
+ private readonly indexName;
814
+ private readonly embeddingModelDims;
815
+ private readonly compressionType;
816
+ private readonly useFloat16;
817
+ private readonly hybridSearch;
818
+ private readonly vectorFilterMode;
819
+ private readonly apiKey;
820
+ constructor(config: AzureAISearchConfig);
821
+ /**
822
+ * Initialize the Azure AI Search index if it doesn't exist
823
+ */
824
+ initialize(): Promise<void>;
825
+ /**
826
+ * Create a new index in Azure AI Search
827
+ */
828
+ private createCol;
829
+ /**
830
+ * Generate a document for insertion
831
+ */
832
+ private generateDocument;
833
+ /**
834
+ * Insert vectors into the index
835
+ */
836
+ insert(vectors: number[][], ids: string[], payloads: Record<string, any>[]): Promise<void>;
837
+ /**
838
+ * Sanitize filter keys to remove non-alphanumeric characters
839
+ */
840
+ private sanitizeKey;
841
+ /**
842
+ * Build OData filter expression from SearchFilters
843
+ */
844
+ private buildFilterExpression;
845
+ /**
846
+ * Extract JSON from payload string
847
+ * Handles cases where payload might have extra text
848
+ */
849
+ private extractJson;
850
+ /**
851
+ * Search for similar vectors
852
+ */
853
+ search(query: number[], limit?: number, filters?: SearchFilters): Promise<VectorStoreResult[]>;
854
+ /**
855
+ * Delete a vector by ID
856
+ */
857
+ delete(vectorId: string): Promise<void>;
858
+ /**
859
+ * Update a vector and its payload
860
+ */
861
+ update(vectorId: string, vector: number[], payload: Record<string, any>): Promise<void>;
862
+ /**
863
+ * Retrieve a vector by ID
864
+ */
865
+ get(vectorId: string): Promise<VectorStoreResult | null>;
866
+ /**
867
+ * List all collections (indexes)
868
+ */
869
+ private listCols;
870
+ /**
871
+ * Delete the index
872
+ */
873
+ deleteCol(): Promise<void>;
874
+ /**
875
+ * Get information about the index
876
+ */
877
+ private colInfo;
878
+ /**
879
+ * List all vectors in the index
880
+ */
881
+ list(filters?: SearchFilters, limit?: number): Promise<[VectorStoreResult[], number]>;
882
+ /**
883
+ * Generate a random user ID
884
+ */
885
+ private generateUUID;
886
+ /**
887
+ * Get user ID from memory_migrations collection
888
+ * Required by VectorStore interface
889
+ */
890
+ getUserId(): Promise<string>;
891
+ /**
892
+ * Set user ID in memory_migrations collection
893
+ * Required by VectorStore interface
894
+ */
895
+ setUserId(userId: string): Promise<void>;
896
+ /**
897
+ * Reset the index by deleting and recreating it
898
+ */
899
+ reset(): Promise<void>;
900
+ }
901
+
745
902
  interface HistoryManager {
746
903
  addHistory(memoryId: string, previousValue: string | null, newValue: string | null, action: string, createdAt?: string, updatedAt?: string, isDeleted?: number): Promise<void>;
747
904
  getHistory(memoryId: string): Promise<any[]>;
@@ -762,4 +919,4 @@ declare class HistoryManagerFactory {
762
919
  static create(provider: string, config: HistoryStoreConfig): HistoryManager;
763
920
  }
764
921
 
765
- export { type AddMemoryOptions, AnthropicLLM, AzureOpenAIEmbedder, type DeleteAllMemoryOptions, type Embedder, EmbedderFactory, type EmbeddingConfig, type Entity, type GetAllMemoryOptions, GoogleEmbedder, GoogleLLM, type GraphStoreConfig, GroqLLM, HistoryManagerFactory, type HistoryStoreConfig, type LLM, type LLMConfig, LLMFactory, type LLMResponse, LangchainEmbedder, LangchainLLM, LangchainVectorStore, Memory, type MemoryConfig, MemoryConfigSchema, type MemoryItem, MemoryVectorStore, type Message, MistralLLM, type MultiModalMessages, type Neo4jConfig, OllamaEmbedder, OllamaLLM, OpenAIEmbedder, OpenAILLM, OpenAIStructuredLLM, Qdrant, RedisDB, type SearchFilters, type SearchMemoryOptions, type SearchResult, SupabaseDB, type VectorStore, type VectorStoreConfig, VectorStoreFactory, type VectorStoreResult, VectorizeDB };
922
+ export { type AddMemoryOptions, AnthropicLLM, AzureAISearch, AzureOpenAIEmbedder, type DeleteAllMemoryOptions, type Embedder, EmbedderFactory, type EmbeddingConfig, type Entity, type GetAllMemoryOptions, GoogleEmbedder, GoogleLLM, type GraphStoreConfig, GroqLLM, HistoryManagerFactory, type HistoryStoreConfig, type LLM, type LLMConfig, LLMFactory, type LLMResponse, LangchainEmbedder, LangchainLLM, LangchainVectorStore, Memory, type MemoryConfig, MemoryConfigSchema, type MemoryItem, MemoryVectorStore, type Message, MistralLLM, type MultiModalMessages, type Neo4jConfig, OllamaEmbedder, OllamaLLM, OpenAIEmbedder, OpenAILLM, OpenAIStructuredLLM, Qdrant, RedisDB, type SearchFilters, type SearchMemoryOptions, type SearchResult, SupabaseDB, type VectorStore, type VectorStoreConfig, VectorStoreFactory, type VectorStoreResult, VectorizeDB };