mem0ai 3.0.12 → 3.0.13

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.
@@ -95,6 +95,11 @@ var OpenAIEmbedder = class {
95
95
  ...response.data.sort((a, b) => a.index - b.index).map((item) => item.embedding)
96
96
  );
97
97
  }
98
+ if (allEmbeddings.length !== texts.length) {
99
+ throw new Error(
100
+ `OpenAI embedBatch() returned ${allEmbeddings.length} embeddings for ${texts.length} texts using model '${this.model}'`
101
+ );
102
+ }
98
103
  return allEmbeddings;
99
104
  }
100
105
  };
@@ -2851,9 +2856,8 @@ var GoogleLLM = class {
2851
2856
  this.google = new GoogleGenAI2({ apiKey: config.apiKey });
2852
2857
  this.model = config.model || "gemini-2.0-flash";
2853
2858
  }
2854
- async generateResponse(messages, responseFormat, tools) {
2855
- var _a2;
2856
- const contents = messages.map((msg) => ({
2859
+ formatContents(messages) {
2860
+ return messages.map((msg) => ({
2857
2861
  parts: [
2858
2862
  {
2859
2863
  text: typeof msg.content === "string" ? msg.content : JSON.stringify(msg.content)
@@ -2861,6 +2865,10 @@ var GoogleLLM = class {
2861
2865
  ],
2862
2866
  role: msg.role === "system" ? "model" : "user"
2863
2867
  }));
2868
+ }
2869
+ async generateResponse(messages, responseFormat, tools) {
2870
+ var _a2;
2871
+ const contents = this.formatContents(messages);
2864
2872
  const config = {};
2865
2873
  if (tools && tools.length > 0) {
2866
2874
  config.tools = [
@@ -2892,14 +2900,16 @@ var GoogleLLM = class {
2892
2900
  return text || "";
2893
2901
  }
2894
2902
  async generateChat(messages) {
2903
+ var _a2, _b2, _c;
2895
2904
  const completion = await this.google.models.generateContent({
2896
- contents: messages,
2905
+ contents: this.formatContents(messages),
2897
2906
  model: this.model
2898
2907
  });
2899
- const response = completion.candidates[0].content;
2908
+ const response = (_b2 = (_a2 = completion.candidates) == null ? void 0 : _a2[0]) == null ? void 0 : _b2.content;
2909
+ const content = ((_c = response == null ? void 0 : response.parts) == null ? void 0 : _c.map((part) => part.text || "").join("")) || completion.text || "";
2900
2910
  return {
2901
- content: response.parts[0].text || "",
2902
- role: response.role
2911
+ content,
2912
+ role: (response == null ? void 0 : response.role) || "assistant"
2903
2913
  };
2904
2914
  }
2905
2915
  };
@@ -3008,6 +3018,11 @@ var AzureOpenAIEmbedder = class {
3008
3018
  ...response.data.sort((a, b) => a.index - b.index).map((item) => item.embedding)
3009
3019
  );
3010
3020
  }
3021
+ if (allEmbeddings.length !== texts.length) {
3022
+ throw new Error(
3023
+ `Azure OpenAI embedBatch() returned ${allEmbeddings.length} embeddings for ${texts.length} texts using model '${this.model}'`
3024
+ );
3025
+ }
3011
3026
  return allEmbeddings;
3012
3027
  }
3013
3028
  };
@@ -5221,7 +5236,7 @@ var parse_vision_messages = async (messages) => {
5221
5236
  };
5222
5237
 
5223
5238
  // src/oss/src/utils/telemetry.ts
5224
- var version = true ? "3.0.12" : "dev";
5239
+ var version = true ? "3.0.13" : "dev";
5225
5240
  var MEM0_TELEMETRY = true;
5226
5241
  var _a, _b;
5227
5242
  try {