@anuma/sdk 3.8.0 → 3.8.2
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/dist/client/index.cjs +10 -0
- package/dist/client/index.d.mts +98 -3
- package/dist/client/index.d.ts +98 -3
- package/dist/client/index.mjs +9 -0
- package/dist/expo/{chunk-AAB7OG7Q.mjs → chunk-IFZZQPRO.mjs} +2 -2
- package/dist/expo/index.cjs +16 -9
- package/dist/expo/index.d.mts +7 -1
- package/dist/expo/index.d.ts +7 -1
- package/dist/expo/index.mjs +16 -9
- package/dist/expo/{recall-YVU7OSSJ.mjs → recall-MUFOZB6P.mjs} +1 -1
- package/dist/index.d.mts +38 -2
- package/dist/index.d.ts +38 -2
- package/dist/react/{chunk-3VPEZDYL.mjs → chunk-35BHTCK4.mjs} +2 -2
- package/dist/react/index.cjs +16 -9
- package/dist/react/index.d.mts +7 -1
- package/dist/react/index.d.ts +7 -1
- package/dist/react/index.mjs +16 -9
- package/dist/react/{recall-Z7BWJ67X.mjs → recall-JUERXQA7.mjs} +1 -1
- package/dist/server/{chunk-LSKFJNLF.mjs → chunk-GKN5NJKZ.mjs} +2 -2
- package/dist/server/index.cjs +16 -9
- package/dist/server/index.d.mts +1 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.mjs +16 -9
- package/dist/server/{recall-XEOLXA6P.mjs → recall-XZ6WLFPJ.mjs} +1 -1
- package/package.json +3 -2
package/dist/server/index.mjs
CHANGED
|
@@ -125,7 +125,7 @@ import {
|
|
|
125
125
|
updateVaultMemoryOp,
|
|
126
126
|
upsertMessageOp,
|
|
127
127
|
vaultMemoryToStored
|
|
128
|
-
} from "./chunk-
|
|
128
|
+
} from "./chunk-GKN5NJKZ.mjs";
|
|
129
129
|
import {
|
|
130
130
|
createStreamingDeAnonymizer,
|
|
131
131
|
resolvePiiRedactor
|
|
@@ -6623,7 +6623,10 @@ ${evidence}`;
|
|
|
6623
6623
|
headers: { ...authHeaders, "Content-Type": "application/json" },
|
|
6624
6624
|
body: JSON.stringify({
|
|
6625
6625
|
model,
|
|
6626
|
-
|
|
6626
|
+
// Modern OpenAI field; the portal reads only `max_completion_tokens`
|
|
6627
|
+
// (the deprecated `max_tokens` is silently ignored → falls back to the
|
|
6628
|
+
// portal's default output cap and truncates the answer).
|
|
6629
|
+
max_completion_tokens: maxTokens,
|
|
6627
6630
|
messages: [
|
|
6628
6631
|
{ role: "system", content: systemPrompt },
|
|
6629
6632
|
{ role: "user", content: userMessage }
|
|
@@ -7060,14 +7063,15 @@ function extractFacetText(structured) {
|
|
|
7060
7063
|
var TOPIC_EXTRACTION_BATCH_SIZE = 10;
|
|
7061
7064
|
var MAX_CHARS_PER_MEMORY = 300;
|
|
7062
7065
|
var MAX_VOCABULARY_NAMES = 100;
|
|
7066
|
+
var MAX_COMPLETION_TOKENS = 8192;
|
|
7063
7067
|
var SYSTEM_PROMPT4 = `You assign topics to saved memories for a personal memory system.
|
|
7064
7068
|
|
|
7065
7069
|
Each memory is a short statement about the user. For each memory, list the NAMED entities it mentions \u2014 these become the memory's topics, used to connect related memories in a knowledge graph.
|
|
7066
7070
|
|
|
7067
7071
|
Include only NAMED entities, skip generic/common nouns. ${ENTITY_KIND_GUIDELINES}
|
|
7068
7072
|
|
|
7069
|
-
Output strict JSON: {"memories": [{"id": string, "entities": [{"name": string, "kind": string}]}]}
|
|
7070
|
-
- exactly one element per input memory
|
|
7073
|
+
Each memory below is written as "<id>: <text>". Output strict JSON: {"memories": [{"id": string, "entities": [{"name": string, "kind": string}]}]}
|
|
7074
|
+
- exactly one element per input memory; copy its id EXACTLY as written (the token before the first ": "), with no brackets, quotes, or extra characters
|
|
7071
7075
|
- "entities" may be empty when a memory mentions no named entities \u2014 most short memories have 0-3
|
|
7072
7076
|
No prose.`;
|
|
7073
7077
|
async function extractEntitiesForMemories(memories, options) {
|
|
@@ -7082,8 +7086,8 @@ When a memory refers to one of these, reuse the EXACT existing name (same spelli
|
|
|
7082
7086
|
for (let i = 0; i < memories.length; i += TOPIC_EXTRACTION_BATCH_SIZE) {
|
|
7083
7087
|
const batch = memories.slice(i, i + TOPIC_EXTRACTION_BATCH_SIZE);
|
|
7084
7088
|
const listing = batch.map((m) => {
|
|
7085
|
-
const content = m.content.slice(0, MAX_CHARS_PER_MEMORY);
|
|
7086
|
-
return
|
|
7089
|
+
const content = m.content.slice(0, MAX_CHARS_PER_MEMORY).replace(/\s+/g, " ").trim();
|
|
7090
|
+
return `${m.id}: ${redactor ? redactor.redactText(content).text : content}`;
|
|
7087
7091
|
}).join("\n");
|
|
7088
7092
|
const parsed = await callPortalJsonCompletion({
|
|
7089
7093
|
...options.apiKey !== void 0 && { apiKey: options.apiKey },
|
|
@@ -7099,6 +7103,7 @@ ${listing}
|
|
|
7099
7103
|
|
|
7100
7104
|
List each memory's named entities.`,
|
|
7101
7105
|
tag: "memory/topics",
|
|
7106
|
+
extra: { max_completion_tokens: MAX_COMPLETION_TOKENS },
|
|
7102
7107
|
...options.fetchFn && { fetchFn: options.fetchFn },
|
|
7103
7108
|
...options.maxAttempts !== void 0 && { maxAttempts: options.maxAttempts },
|
|
7104
7109
|
...options.timeoutMs !== void 0 && { timeoutMs: options.timeoutMs },
|
|
@@ -7142,9 +7147,11 @@ function parseTopicResponse(parsed, validIds) {
|
|
|
7142
7147
|
for (const raw of list) {
|
|
7143
7148
|
if (typeof raw !== "object" || raw === null) continue;
|
|
7144
7149
|
const obj = raw;
|
|
7145
|
-
if (typeof obj.id !== "string"
|
|
7150
|
+
if (typeof obj.id !== "string") continue;
|
|
7151
|
+
const id = obj.id.trim().replace(/:$/, "").replace(/^\[([\s\S]*)\]$/, "$1").trim();
|
|
7152
|
+
if (!validIds.has(id) || out.has(id)) continue;
|
|
7146
7153
|
const entities = Array.isArray(obj.entities) ? parseEntities(obj.entities) : [];
|
|
7147
|
-
out.set(
|
|
7154
|
+
out.set(id, entities);
|
|
7148
7155
|
}
|
|
7149
7156
|
return out;
|
|
7150
7157
|
}
|
|
@@ -9733,7 +9740,7 @@ var CompletionsStrategy = class {
|
|
|
9733
9740
|
model,
|
|
9734
9741
|
stream,
|
|
9735
9742
|
...temperature !== void 0 && { temperature },
|
|
9736
|
-
...maxOutputTokens !== void 0 && {
|
|
9743
|
+
...maxOutputTokens !== void 0 && { max_completion_tokens: maxOutputTokens },
|
|
9737
9744
|
...tools && { tools },
|
|
9738
9745
|
...toolChoice && { tool_choice: toolChoice },
|
|
9739
9746
|
...portal && { portal }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anuma/sdk",
|
|
3
|
-
"version": "3.8.
|
|
3
|
+
"version": "3.8.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -140,6 +140,7 @@
|
|
|
140
140
|
"check-exports": "publint && attw --pack --ignore-rules no-resolution false-cjs && node scripts/assert-no-client-self-import.mjs",
|
|
141
141
|
"check": "pnpm run lint && pnpm run knip && pnpm run format && pnpm run generate",
|
|
142
142
|
"eval:extraction": "tsx test/memory/src/extraction/benchmark.test.ts",
|
|
143
|
+
"eval:topic": "tsx test/memory/src/topic/benchmark.ts",
|
|
143
144
|
"eval:consolidation": "tsx test/memory/src/consolidation/benchmark.test.ts"
|
|
144
145
|
},
|
|
145
146
|
"repository": {
|
|
@@ -155,7 +156,7 @@
|
|
|
155
156
|
"homepage": "https://github.com/anuma-ai/sdk#readme",
|
|
156
157
|
"packageManager": "pnpm@10.23.0",
|
|
157
158
|
"dependencies": {
|
|
158
|
-
"@anuma/portal": "1.0.0-next.
|
|
159
|
+
"@anuma/portal": "1.0.0-next.20260724050535",
|
|
159
160
|
"@babel/parser": "^7.29.2",
|
|
160
161
|
"@babel/types": "^7.29.0",
|
|
161
162
|
"ai": "6.0.202",
|