Start refining scorer. Filter data passed to trigger event agent
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { GraphNode } from "@langchain/langgraph";
|
||||
import { MessagesState } from "../state";
|
||||
import { AIMessage, BaseMessage, HumanMessage } from "@langchain/core/messages";
|
||||
import { rankExampleTriggerEvents, rankNormalizedClaims } from "../tools/retreiveExamples";
|
||||
import { AIMessage, BaseMessage } from "@langchain/core/messages";
|
||||
import { rankExampleTriggerEvents } from "../tools/retreiveExamples";
|
||||
|
||||
export const triggerEventSetup: GraphNode<typeof MessagesState> = async (state) => {
|
||||
let nc = state?.messages?.at(-1)?.content ?? "" //keep a copy of normalized trigger event. Again two things, womp womp
|
||||
@@ -10,7 +10,7 @@ export const triggerEventSetup: GraphNode<typeof MessagesState> = async (state)
|
||||
let similarityResults = await rankExampleTriggerEvents(state.disinformationTitle)
|
||||
|
||||
let messages : BaseMessage[] = similarityResults.map((item) => {
|
||||
return new AIMessage(`Event: ${item.rawtext}, Claims and given scores: ${item.cleantext}`)
|
||||
return new AIMessage(`- Event: ${item.rawtext} \n\n - Claims and given scores: ${item.cleantext}`)
|
||||
})
|
||||
|
||||
return { messages: messages, disinformationTitle: state.disinformationTitle, normalizedClaim: nc };
|
||||
|
||||
@@ -2,7 +2,7 @@ You are an agent in a pipeline to analyse disinformation.
|
||||
Once the information has been created as below, a dataset can be created to feed a model for prediction, which will improve pre-bunking efforts.
|
||||
|
||||
There is a false disinformation claim circulating:
|
||||
("###NTITLE###
|
||||
###NTITLE###
|
||||
Produce up-to 5 specific "trigger events" that happened that could have led to the spread of this disinformation.
|
||||
|
||||
Remember the time frame of the disinformation campaign: {{CAMPAIGN_DATE}}
|
||||
@@ -14,16 +14,14 @@ Include a concise but specific search query that can be looked up on a search en
|
||||
|
||||
Include a url to a source for your trigger event (not a web search, a specific url from a reputuable source). Do not use OAI cite, include url as text in response.
|
||||
|
||||
If you are referencing another disinformation campaign, provide the specific narrative used, not just sentiment, and ensure it is sufficiently different from the claim we are analysing.
|
||||
|
||||
Use a JSON format with each entry containing "Event,ReasoningWhyRelevant,SearchQuery,Url,IsItselfDisinformation".
|
||||
|
||||
Use a JSON format with each entry containing "Event,ReasoningWhyRelevant,SearchQuery,Url".
|
||||
|
||||
Multiple tool invocations should be requested at once, if applicable.
|
||||
Use your abilities to look between the lines and produce some insightful analysis, thinking both short and long term.
|
||||
|
||||
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, to help understanding the intended quality of analysis
|
||||
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
|
||||
|
||||
Lets go through it step by step
|
||||
@@ -9,7 +9,6 @@ export const ProposedTriggerEvent = z.object({
|
||||
ReasoningWhyRelevant: z.string(),
|
||||
SearchQuery: z.string(),
|
||||
Url: z.url(),
|
||||
IsItselfDisinformation: z.boolean(),
|
||||
context: z.string().optional(),
|
||||
score: z.number().optional()
|
||||
})
|
||||
|
||||
@@ -257,7 +257,11 @@ async function ensureExampleClaimJsonlLoaded(): Promise<void> {
|
||||
|
||||
jsonlRawtexts.push(text);
|
||||
|
||||
jsonlCleantexts.push(row.output[0].content);
|
||||
const parsed_content = row.output[0].content_parsed;
|
||||
|
||||
const filtered_content = parsed_content.filter(itm => itm.human_score > 0.5 && itm.score > 0.5)
|
||||
|
||||
jsonlCleantexts.push(JSON.stringify(filtered_content));
|
||||
jsonlEmbeddings.push(embedding);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user