comemo 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/README.md +0 -12
- package/dist/client.js +12 -15
- package/dist/types.d.ts +0 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -26,18 +26,6 @@ const client = new MemoryClient({
|
|
|
26
26
|
});
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
Optional fields:
|
|
30
|
-
|
|
31
|
-
```ts
|
|
32
|
-
const client = new MemoryClient({
|
|
33
|
-
...,
|
|
34
|
-
pineconeNamespace: "tenant-a", // Multi-tenant within one Pinecone index
|
|
35
|
-
neo4jDatabase: "mydb", // Neo4j database name (defaults to "neo4j")
|
|
36
|
-
baseUrl: "https://xvert.io", // API base URL
|
|
37
|
-
timeout: 30000, // Request timeout in ms
|
|
38
|
-
});
|
|
39
|
-
```
|
|
40
|
-
|
|
41
29
|
### Core Memory
|
|
42
30
|
|
|
43
31
|
```ts
|
package/dist/client.js
CHANGED
|
@@ -35,10 +35,10 @@ class MemoryClient {
|
|
|
35
35
|
* @param options - Client configuration options including tenant credentials.
|
|
36
36
|
*/
|
|
37
37
|
constructor(options) {
|
|
38
|
-
this.baseUrl =
|
|
39
|
-
this.timeout =
|
|
38
|
+
this.baseUrl = "https://xvert.io";
|
|
39
|
+
this.timeout = 30000;
|
|
40
40
|
// Tenant config sent with every request
|
|
41
|
-
|
|
41
|
+
this.config = {
|
|
42
42
|
llm_api_key: options.llmApiKey,
|
|
43
43
|
model: options.model ?? "gpt-4o-mini",
|
|
44
44
|
pinecone_api_key: options.pineconeApiKey,
|
|
@@ -47,11 +47,6 @@ class MemoryClient {
|
|
|
47
47
|
neo4j_username: options.neo4jUsername,
|
|
48
48
|
neo4j_password: options.neo4jPassword,
|
|
49
49
|
};
|
|
50
|
-
if (options.pineconeNamespace)
|
|
51
|
-
cfg.pinecone_namespace = options.pineconeNamespace;
|
|
52
|
-
if (options.neo4jDatabase)
|
|
53
|
-
cfg.neo4j_database = options.neo4jDatabase;
|
|
54
|
-
this.config = cfg;
|
|
55
50
|
}
|
|
56
51
|
async request(method, path, options = {}) {
|
|
57
52
|
let url = `${this.baseUrl}${path}`;
|
|
@@ -131,7 +126,9 @@ class MemoryClient {
|
|
|
131
126
|
* @returns Object with status, memory_id, and deleted flag.
|
|
132
127
|
*/
|
|
133
128
|
async deleteMemory(memoryId) {
|
|
134
|
-
return this.request("
|
|
129
|
+
return this.request("POST", "/memory/single/delete", {
|
|
130
|
+
body: { memory_id: memoryId, config: this.config },
|
|
131
|
+
});
|
|
135
132
|
}
|
|
136
133
|
/**
|
|
137
134
|
* Delete all memories for a user.
|
|
@@ -140,8 +137,8 @@ class MemoryClient {
|
|
|
140
137
|
* @returns DeleteResult with count of deleted memories.
|
|
141
138
|
*/
|
|
142
139
|
async deleteUserMemories(userId) {
|
|
143
|
-
const data = await this.request("
|
|
144
|
-
|
|
140
|
+
const data = await this.request("POST", "/memory/delete", {
|
|
141
|
+
body: { user_id: userId, config: this.config },
|
|
145
142
|
});
|
|
146
143
|
return {
|
|
147
144
|
status: data.status ?? "",
|
|
@@ -157,8 +154,8 @@ class MemoryClient {
|
|
|
157
154
|
* @returns DeleteResult with count of deleted memories.
|
|
158
155
|
*/
|
|
159
156
|
async deleteSessionMemories(userId, sessionId) {
|
|
160
|
-
const data = await this.request("
|
|
161
|
-
|
|
157
|
+
const data = await this.request("POST", "/memory/session/delete", {
|
|
158
|
+
body: { user_id: userId, session_id: sessionId, config: this.config },
|
|
162
159
|
});
|
|
163
160
|
return {
|
|
164
161
|
status: data.status ?? "",
|
|
@@ -271,8 +268,8 @@ class MemoryClient {
|
|
|
271
268
|
* @returns RetrieveResult with matching memories across all sessions.
|
|
272
269
|
*/
|
|
273
270
|
async listMemories(userId, query, topK = 10) {
|
|
274
|
-
const data = await this.request("
|
|
275
|
-
|
|
271
|
+
const data = await this.request("POST", "/memories", {
|
|
272
|
+
body: { user_id: userId, query, top_k: topK, config: this.config },
|
|
276
273
|
});
|
|
277
274
|
const memories = (data.memories ?? []).map((m) => ({
|
|
278
275
|
memory_id: m.memory_id,
|
package/dist/types.d.ts
CHANGED
|
@@ -8,16 +8,12 @@ export interface TenantConfig {
|
|
|
8
8
|
pineconeApiKey: string;
|
|
9
9
|
/** Pinecone index name. */
|
|
10
10
|
pineconeIndex: string;
|
|
11
|
-
/** Pinecone namespace (for multi-tenant within one index). */
|
|
12
|
-
pineconeNamespace?: string;
|
|
13
11
|
/** Neo4j connection URI (e.g. "neo4j+s://xxx.databases.neo4j.io"). */
|
|
14
12
|
neo4jUri: string;
|
|
15
13
|
/** Neo4j username. */
|
|
16
14
|
neo4jUsername: string;
|
|
17
15
|
/** Neo4j password. */
|
|
18
16
|
neo4jPassword: string;
|
|
19
|
-
/** Neo4j database name (defaults to "neo4j"). */
|
|
20
|
-
neo4jDatabase?: string;
|
|
21
17
|
}
|
|
22
18
|
/** Result of adding a memory. */
|
|
23
19
|
export interface AddMemoryResult {
|
|
@@ -91,10 +87,6 @@ export interface HealthResult {
|
|
|
91
87
|
}
|
|
92
88
|
/** Options for the MemoryClient constructor. */
|
|
93
89
|
export interface MemoryClientOptions extends TenantConfig {
|
|
94
|
-
/** Base URL of the API. Defaults to "https://xvert.io". */
|
|
95
|
-
baseUrl?: string;
|
|
96
|
-
/** Request timeout in milliseconds. Defaults to 30000. */
|
|
97
|
-
timeout?: number;
|
|
98
90
|
}
|
|
99
91
|
/** Options for advanced retrieval. */
|
|
100
92
|
export interface RetrieveAdvancedOptions {
|