mem0ai 2.4.2 → 2.4.4

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.
@@ -670,6 +670,12 @@ var Qdrant = class {
670
670
  }
671
671
  if (config.url) {
672
672
  params.url = config.url;
673
+ try {
674
+ const parsedUrl = new URL(config.url);
675
+ params.port = parsedUrl.port ? parseInt(parsedUrl.port, 10) : 6333;
676
+ } catch (_) {
677
+ params.port = 6333;
678
+ }
673
679
  }
674
680
  if (config.host && config.port) {
675
681
  params.host = config.host;
@@ -2463,7 +2469,7 @@ var MemoryUpdateSchema = z2.object({
2463
2469
  event: z2.enum(["ADD", "UPDATE", "DELETE", "NONE"]).describe(
2464
2470
  "The action taken for this memory item (ADD, UPDATE, DELETE, or NONE)."
2465
2471
  ),
2466
- old_memory: z2.string().optional().describe(
2472
+ old_memory: z2.string().optional().nullable().describe(
2467
2473
  "The previous content of the memory item if the event was UPDATE."
2468
2474
  )
2469
2475
  })
@@ -3626,7 +3632,8 @@ var AzureAISearch = class {
3626
3632
  };
3627
3633
 
3628
3634
  // src/oss/src/vector_stores/pgvector.ts
3629
- import { Client } from "pg";
3635
+ import pkg from "pg";
3636
+ var { Client } = pkg;
3630
3637
  var PGVector = class {
3631
3638
  constructor(config) {
3632
3639
  this.collectionName = config.collectionName || "memories";
@@ -3642,6 +3649,7 @@ var PGVector = class {
3642
3649
  host: config.host,
3643
3650
  port: config.port
3644
3651
  });
3652
+ this.initialize().catch(console.error);
3645
3653
  }
3646
3654
  async initialize() {
3647
3655
  try {
@@ -4010,12 +4018,6 @@ var DEFAULT_MEMORY_CONFIG = {
4010
4018
  url: process.env.NEO4J_URL || "neo4j://localhost:7687",
4011
4019
  username: process.env.NEO4J_USERNAME || "neo4j",
4012
4020
  password: process.env.NEO4J_PASSWORD || "password"
4013
- },
4014
- llm: {
4015
- provider: "openai",
4016
- config: {
4017
- model: "gpt-4-turbo-preview"
4018
- }
4019
4021
  }
4020
4022
  },
4021
4023
  historyStore: {
@@ -4251,7 +4253,7 @@ function getDeleteMessages(existingMemoriesString, data, userId) {
4251
4253
  // src/oss/src/memory/graph_memory.ts
4252
4254
  var MemoryGraph = class {
4253
4255
  constructor(config) {
4254
- var _a2, _b, _c, _d, _e, _f, _g, _h, _i;
4256
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
4255
4257
  this.config = config;
4256
4258
  if (!((_b = (_a2 = config.graphStore) == null ? void 0 : _a2.config) == null ? void 0 : _b.url) || !((_d = (_c = config.graphStore) == null ? void 0 : _c.config) == null ? void 0 : _d.username) || !((_f = (_e = config.graphStore) == null ? void 0 : _e.config) == null ? void 0 : _f.password)) {
4257
4259
  throw new Error("Neo4j configuration is incomplete");
@@ -4268,17 +4270,16 @@ var MemoryGraph = class {
4268
4270
  this.config.embedder.config
4269
4271
  );
4270
4272
  this.llmProvider = "openai";
4273
+ let llmConfig = this.config.llm.config;
4271
4274
  if ((_g = this.config.llm) == null ? void 0 : _g.provider) {
4272
4275
  this.llmProvider = this.config.llm.provider;
4273
4276
  }
4274
4277
  if ((_i = (_h = this.config.graphStore) == null ? void 0 : _h.llm) == null ? void 0 : _i.provider) {
4275
4278
  this.llmProvider = this.config.graphStore.llm.provider;
4279
+ llmConfig = (_j = this.config.graphStore.llm.config) != null ? _j : llmConfig;
4276
4280
  }
4277
- this.llm = LLMFactory.create(this.llmProvider, this.config.llm.config);
4278
- this.structuredLlm = LLMFactory.create(
4279
- this.llmProvider,
4280
- this.config.llm.config
4281
- );
4281
+ this.llm = LLMFactory.create(this.llmProvider, llmConfig);
4282
+ this.structuredLlm = LLMFactory.create(this.llmProvider, llmConfig);
4282
4283
  this.threshold = 0.7;
4283
4284
  }
4284
4285
  async add(data, filters) {