Compare commits

4 Commits

Author SHA1 Message Date
William Jeynes 38ca7a3d34 I can't affort the full model lol. Use jsonrepair module to fix agent malformed JSON instead. 2026-03-26 15:37:14 +00:00
William Jeynes 38b6fb6a0e Use an even better model 2026-03-26 15:14:43 +00:00
William Jeynes c7cccb87c3 Update to 5.4 mini 2026-03-26 12:44:01 +00:00
William Jeynes fd0674e96a Add a chain of thought to the main prompt 2026-03-26 12:33:43 +00:00
6 changed files with 22 additions and 5 deletions
+1 -1
View File
@@ -9,7 +9,7 @@ export function createModelNode(tools: any, promptPath: string): GraphNode<typeo
const sysPrompt = await hydratePrompt(promptPath, state); const sysPrompt = await hydratePrompt(promptPath, state);
const model = new ChatOpenAI({ const model = new ChatOpenAI({
model: "gpt-5-mini" model: "gpt-5.4-mini"
}); });
const modelWithTools = model.bindTools(Object.values(tools)); const modelWithTools = model.bindTools(Object.values(tools));
+5 -3
View File
@@ -1,8 +1,7 @@
import { GraphNode } from "@langchain/langgraph"; import { GraphNode } from "@langchain/langgraph";
import { MessagesState, ProposedTriggerEventArray } from "../state"; import { MessagesState, ProposedTriggerEventArray } from "../state";
import { logger } from "../utils/logger"; import { logger } from "../utils/logger";
import { queryScraper } from "../tools/webSearch"; import { jsonrepair } from 'jsonrepair'
import { rankAndDisplayData } from "../tools/triggerEventTools";
export const verificationSetup: GraphNode<typeof MessagesState> = async (state) => { export const verificationSetup: GraphNode<typeof MessagesState> = async (state) => {
//this is kinda doing two things, but having two nodes for it seems overkill //this is kinda doing two things, but having two nodes for it seems overkill
@@ -11,7 +10,10 @@ export const verificationSetup: GraphNode<typeof MessagesState> = async (state)
logger.warn("No trigger events in memory, parsing") logger.warn("No trigger events in memory, parsing")
let genResponse = state.messages.at(-1)?.content.toString() ?? ""; let genResponse = state.messages.at(-1)?.content.toString() ?? "";
const parsed = ProposedTriggerEventArray.parse(JSON.parse(genResponse));
const repaired = jsonrepair(genResponse);
const parsed = ProposedTriggerEventArray.parse(JSON.parse(repaired));
for (let i = 0; i < parsed.length; i++) { for (let i = 0; i < parsed.length; i++) {
const search = parsed[i].SearchQuery const search = parsed[i].SearchQuery
+10
View File
@@ -20,6 +20,7 @@
"dotenv": "^17.2.3", "dotenv": "^17.2.3",
"exponential-backoff": "^3.1.3", "exponential-backoff": "^3.1.3",
"fs": "^0.0.1-security", "fs": "^0.0.1-security",
"jsonrepair": "^3.13.3",
"langchain": "^1.2.14", "langchain": "^1.2.14",
"selenium-webdriver": "^4.40.0", "selenium-webdriver": "^4.40.0",
"tldts": "^7.0.23", "tldts": "^7.0.23",
@@ -2075,6 +2076,15 @@
"integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==", "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==",
"license": "ISC" "license": "ISC"
}, },
"node_modules/jsonrepair": {
"version": "3.13.3",
"resolved": "https://registry.npmjs.org/jsonrepair/-/jsonrepair-3.13.3.tgz",
"integrity": "sha512-BTznj0owIt2CBAH/LTo7+1I5pMvl1e1033LRl/HUowlZmJOIhzC0zbX5bxMngLkfT4WnzPP26QnW5wMr2g9tsQ==",
"license": "ISC",
"bin": {
"jsonrepair": "bin/cli.js"
}
},
"node_modules/jszip": { "node_modules/jszip": {
"version": "3.10.1", "version": "3.10.1",
"resolved": "https://registry.npmjs.org/jszip/-/jszip-3.10.1.tgz", "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.10.1.tgz",
+1
View File
@@ -24,6 +24,7 @@
"dotenv": "^17.2.3", "dotenv": "^17.2.3",
"exponential-backoff": "^3.1.3", "exponential-backoff": "^3.1.3",
"fs": "^0.0.1-security", "fs": "^0.0.1-security",
"jsonrepair": "^3.13.3",
"langchain": "^1.2.14", "langchain": "^1.2.14",
"selenium-webdriver": "^4.40.0", "selenium-webdriver": "^4.40.0",
"tldts": "^7.0.23", "tldts": "^7.0.23",
+4
View File
@@ -26,4 +26,8 @@ Events will be reordered as part of processing, each statement must stand alone
The preceeding messages act as examples of previous responses to potentially ficitonal events and scores given. The preceeding messages act as examples of previous responses to potentially ficitonal events and scores given.
Analysis should only be completed for proposed events that would graner >0.7 points Analysis should only be completed for proposed events that would graner >0.7 points
First, consider a range of directions in which the proposed disinformation could have been influenced by.
Then, research these directions in turn, using the tools at hand.
Finally, refine your proposed "trigger event" until it is specific, quantifiable and backed up by evidence.
Lets go through it step by step Lets go through it step by step
+1 -1
View File
@@ -8,7 +8,7 @@ export async function extractWebpageContent(url: string): Promise<string[]> {
const response = await backOff(async () => { const response = await backOff(async () => {
return await extractWebpageContentWorker(url); return await extractWebpageContentWorker(url);
}, { }, {
numOfAttempts: 10, numOfAttempts: 5,
startingDelay: 500, startingDelay: 500,
timeMultiple: 2, timeMultiple: 2,
jitter: "full", jitter: "full",