@maximem/synap-js-sdk 0.1.3 → 0.1.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.
@@ -168,11 +168,12 @@ async def handle_add_memory(params: dict) -> dict:
168
168
  start = time.perf_counter()
169
169
 
170
170
  step = time.perf_counter()
171
+ mode = params.get("mode", "long-range")
171
172
  create_result = await sdk.memories.create(
172
173
  document=transcript,
173
174
  document_type="ai-chat-conversation",
174
175
  user_id=user_id,
175
- mode="long-range",
176
+ mode=mode,
176
177
  )
177
178
  append_step(timings, "memories_create", step)
178
179
 
@@ -243,6 +244,7 @@ async def handle_search_memory(params: dict) -> dict:
243
244
  user_id = params["user_id"]
244
245
  query = params["query"]
245
246
  max_results = params.get("max_results", 10)
247
+ mode = params.get("mode", "fast")
246
248
 
247
249
  start = time.perf_counter()
248
250
 
@@ -252,7 +254,7 @@ async def handle_search_memory(params: dict) -> dict:
252
254
  search_query=[query],
253
255
  max_results=max_results,
254
256
  types=["all"],
255
- mode="fast",
257
+ mode=mode,
256
258
  )
257
259
  append_step(timings, "context_fetch", step)
258
260
 
@@ -293,6 +295,7 @@ async def handle_get_memories(params: dict) -> dict:
293
295
  timings: List[dict] = []
294
296
 
295
297
  user_id = params["user_id"]
298
+ mode = params.get("mode", "fast")
296
299
 
297
300
  start = time.perf_counter()
298
301
 
@@ -302,7 +305,7 @@ async def handle_get_memories(params: dict) -> dict:
302
305
  search_query=[],
303
306
  max_results=100,
304
307
  types=["all"],
305
- mode="fast",
308
+ mode=mode,
306
309
  )
307
310
  append_step(timings, "context_fetch_all", step)
308
311
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maximem/synap-js-sdk",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "JavaScript wrapper around the Synap Python SDK",
5
5
  "main": "src/index.js",
6
6
  "types": "types/index.d.ts",
@@ -14,32 +14,33 @@ class SynapClient {
14
14
  await this.bridge.ensureStarted();
15
15
  }
16
16
 
17
- async addMemory({ userId, messages }) {
17
+ async addMemory({ userId, messages, mode }) {
18
18
  this.#assert(userId, 'userId is required');
19
19
  this.#assert(Array.isArray(messages), 'messages must be an array');
20
20
 
21
- return this.bridge.call(
22
- 'add_memory',
23
- { user_id: userId, messages },
24
- this.options.ingestTimeoutMs
25
- );
21
+ const params = { user_id: userId, messages };
22
+ if (mode !== undefined) params.mode = mode;
23
+
24
+ return this.bridge.call('add_memory', params, this.options.ingestTimeoutMs);
26
25
  }
27
26
 
28
- async searchMemory({ userId, query, maxResults = 10 }) {
27
+ async searchMemory({ userId, query, maxResults = 10, mode }) {
29
28
  this.#assert(userId, 'userId is required');
30
29
  this.#assert(query, 'query is required');
31
30
 
32
- return this.bridge.call('search_memory', {
33
- user_id: userId,
34
- query,
35
- max_results: maxResults,
36
- });
31
+ const params = { user_id: userId, query, max_results: maxResults };
32
+ if (mode !== undefined) params.mode = mode;
33
+
34
+ return this.bridge.call('search_memory', params);
37
35
  }
38
36
 
39
- async getMemories({ userId }) {
37
+ async getMemories({ userId, mode }) {
40
38
  this.#assert(userId, 'userId is required');
41
39
 
42
- return this.bridge.call('get_memories', { user_id: userId });
40
+ const params = { user_id: userId };
41
+ if (mode !== undefined) params.mode = mode;
42
+
43
+ return this.bridge.call('get_memories', params);
43
44
  }
44
45
 
45
46
  async deleteMemory({ userId, memoryId = null }) {