@voidwire/lore 1.6.2 → 1.6.3
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/lib/contradiction.ts +10 -28
- package/package.json +1 -1
package/lib/contradiction.ts
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
import { hybridSearch, type HybridResult } from "./semantic.js";
|
|
18
18
|
import { PURGEABLE_SOURCES } from "./purge.js";
|
|
19
|
+
import { complete } from "@voidwire/llm-core";
|
|
19
20
|
import type { CaptureEvent } from "./capture.js";
|
|
20
21
|
|
|
21
22
|
// ─── Types ──────────────────────────────────────────────────────────────────
|
|
@@ -38,11 +39,8 @@ export interface ContradictionDecision {
|
|
|
38
39
|
|
|
39
40
|
// ─── Constants ──────────────────────────────────────────────────────────────
|
|
40
41
|
|
|
41
|
-
const MLX_URL = "http://localhost:8080/v1/chat/completions";
|
|
42
|
-
const MLX_MODEL = "mlx-community/Qwen2.5-7B-Instruct-4bit";
|
|
43
|
-
const MLX_TIMEOUT_MS = 1500;
|
|
44
|
-
|
|
45
42
|
const CANDIDATE_LIMIT = 5;
|
|
43
|
+
const LLM_SERVICE = "mlx";
|
|
46
44
|
|
|
47
45
|
// Sources eligible for contradiction checking (same as purgeable)
|
|
48
46
|
const CONTRADICTION_SOURCES = new Set<string>(PURGEABLE_SOURCES);
|
|
@@ -126,33 +124,17 @@ If DELETE, reply: DELETE <rowid>
|
|
|
126
124
|
Otherwise reply: ADD or NOOP`;
|
|
127
125
|
|
|
128
126
|
try {
|
|
129
|
-
const
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
{ role: "system", content: systemPrompt },
|
|
136
|
-
{ role: "user", content: userPrompt },
|
|
137
|
-
],
|
|
138
|
-
max_tokens: 20,
|
|
139
|
-
temperature: 0,
|
|
140
|
-
}),
|
|
141
|
-
signal: AbortSignal.timeout(MLX_TIMEOUT_MS),
|
|
127
|
+
const result = await complete({
|
|
128
|
+
service: LLM_SERVICE,
|
|
129
|
+
prompt: userPrompt,
|
|
130
|
+
systemPrompt,
|
|
131
|
+
maxTokens: 20,
|
|
132
|
+
temperature: 0,
|
|
142
133
|
});
|
|
143
134
|
|
|
144
|
-
|
|
145
|
-
return { action: "ADD" };
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
const json = (await resp.json()) as {
|
|
149
|
-
choices?: Array<{ message?: { content?: string } }>;
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
const raw = json.choices?.[0]?.message?.content?.trim() || "";
|
|
153
|
-
return parseClassification(raw);
|
|
135
|
+
return parseClassification(result.text);
|
|
154
136
|
} catch {
|
|
155
|
-
//
|
|
137
|
+
// Network error, model unavailable — fail open
|
|
156
138
|
return { action: "ADD" };
|
|
157
139
|
}
|
|
158
140
|
}
|