@usewhisper/sdk 0.2.5 → 1.0.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/index.d.ts +15 -8
- package/index.js +28 -4
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -141,30 +141,37 @@ declare class WhisperContext {
|
|
|
141
141
|
}): Promise<{
|
|
142
142
|
ingested: number;
|
|
143
143
|
}>;
|
|
144
|
+
/**
|
|
145
|
+
* Add Memory - Creates a memory using the SOTA memory system
|
|
146
|
+
* This is the recommended method for conversational memory
|
|
147
|
+
*/
|
|
144
148
|
addMemory(params: {
|
|
145
149
|
project: string;
|
|
146
150
|
content: string;
|
|
147
|
-
memory_type?: "factual" | "
|
|
151
|
+
memory_type?: "factual" | "preference" | "event" | "relationship" | "opinion" | "goal" | "instruction";
|
|
148
152
|
user_id?: string;
|
|
149
153
|
session_id?: string;
|
|
150
154
|
agent_id?: string;
|
|
151
155
|
importance?: number;
|
|
152
156
|
metadata?: Record<string, any>;
|
|
153
157
|
expires_in_seconds?: number;
|
|
154
|
-
}): Promise<
|
|
158
|
+
}): Promise<{
|
|
159
|
+
id: string;
|
|
160
|
+
success: boolean;
|
|
161
|
+
}>;
|
|
162
|
+
/**
|
|
163
|
+
* Search Memories - Searches memories using SOTA memory search with temporal reasoning
|
|
164
|
+
* This is the recommended method for memory retrieval
|
|
165
|
+
*/
|
|
155
166
|
searchMemories(params: {
|
|
156
167
|
project: string;
|
|
157
168
|
query: string;
|
|
158
169
|
user_id?: string;
|
|
159
170
|
session_id?: string;
|
|
160
171
|
agent_id?: string;
|
|
161
|
-
memory_type?: "factual" | "
|
|
172
|
+
memory_type?: "factual" | "preference" | "event" | "relationship" | "opinion" | "goal" | "instruction";
|
|
162
173
|
top_k?: number;
|
|
163
|
-
}): Promise<
|
|
164
|
-
memories: Array<Memory & {
|
|
165
|
-
score: number;
|
|
166
|
-
}>;
|
|
167
|
-
}>;
|
|
174
|
+
}): Promise<any>;
|
|
168
175
|
createApiKey(params: {
|
|
169
176
|
name: string;
|
|
170
177
|
scopes?: string[];
|
package/index.js
CHANGED
|
@@ -111,16 +111,40 @@ var WhisperContext = class {
|
|
|
111
111
|
}
|
|
112
112
|
]);
|
|
113
113
|
}
|
|
114
|
+
/**
|
|
115
|
+
* Add Memory - Creates a memory using the SOTA memory system
|
|
116
|
+
* This is the recommended method for conversational memory
|
|
117
|
+
*/
|
|
114
118
|
async addMemory(params) {
|
|
115
|
-
return this.request("/v1/
|
|
119
|
+
return this.request("/v1/memory/ingest/session", {
|
|
116
120
|
method: "POST",
|
|
117
|
-
body: JSON.stringify(
|
|
121
|
+
body: JSON.stringify({
|
|
122
|
+
project: params.project,
|
|
123
|
+
session_id: params.session_id || `single-${Date.now()}`,
|
|
124
|
+
user_id: params.user_id,
|
|
125
|
+
messages: [{
|
|
126
|
+
role: "user",
|
|
127
|
+
content: params.content,
|
|
128
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
129
|
+
}]
|
|
130
|
+
})
|
|
118
131
|
});
|
|
119
132
|
}
|
|
133
|
+
/**
|
|
134
|
+
* Search Memories - Searches memories using SOTA memory search with temporal reasoning
|
|
135
|
+
* This is the recommended method for memory retrieval
|
|
136
|
+
*/
|
|
120
137
|
async searchMemories(params) {
|
|
121
|
-
return this.request("/v1/
|
|
138
|
+
return this.request("/v1/memory/search", {
|
|
122
139
|
method: "POST",
|
|
123
|
-
body: JSON.stringify(
|
|
140
|
+
body: JSON.stringify({
|
|
141
|
+
query: params.query,
|
|
142
|
+
project: params.project,
|
|
143
|
+
user_id: params.user_id,
|
|
144
|
+
session_id: params.session_id,
|
|
145
|
+
memory_types: params.memory_type ? [params.memory_type] : void 0,
|
|
146
|
+
top_k: params.top_k || 10
|
|
147
|
+
})
|
|
124
148
|
});
|
|
125
149
|
}
|
|
126
150
|
async createApiKey(params) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@usewhisper/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "tsup ../src/sdk/index.ts --format esm,cjs --dts --out-dir .",
|
|
6
6
|
"prepublishOnly": "npm run build"
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"license": "MIT",
|
|
39
39
|
"repository": {
|
|
40
40
|
"type": "git",
|
|
41
|
-
"url": "https://github.com/Alixus/
|
|
41
|
+
"url": "https://github.com/Alixus/"
|
|
42
42
|
},
|
|
43
43
|
"homepage": "https://usewhisper.dev",
|
|
44
44
|
"bugs": {
|