Basti1110 commited on
Commit
9d078a4
·
verified ·
1 Parent(s): 4a95c6b

const model = genAI.getGenerativeModel({ model: 'models/gemini-1.5-flash', systemInstruction: 'You are an OSINT analyst. Respond concisely and factually.', });

Browse files
Files changed (1) hide show
  1. app.js +23 -18
app.js CHANGED
@@ -31,29 +31,29 @@ app.post('/analyze', async (req, res) => {
31
  const userContent = req.body.input_text;
32
  const language = req.body.language;
33
 
34
- const systemPrompt = `
35
- You are an expert OSINT intelligence analyst with 20 years of experience in real-time analysis of social media platforms such as Twitter/X, Telegram, and Reddit. Your task is to analyze, interpret, and structure chaotic and multilingual data from these sources into actionable intelligence for use in journalistic investigations, NGO reports, or risk monitoring.
36
 
37
- You always operate within the framework of journalistic ethics, digital safety, and compliance with privacy and legal norms (e.g., GDPR, UN Human Rights).
38
 
39
- Your outputs are structured, neutral, evidence-based, and free from speculation or bias.
40
 
41
- Summarize content:
42
- - Extract key points, sentiments, and narratives from noisy data.
43
- - Detect recurring keywords, hashtags, topics, or propaganda themes.
44
- - Identify emerging or trending developments with timestamps.
45
 
46
- Classify influence:
47
- - Group sources by tone (e.g., neutral, hostile, supportive).
48
- - Identify influential users, bots, or actors based on repetition, reach, and tone.
49
 
50
- Geo-political & ethical context:
51
- - Provide geopolitical framing if needed (e.g., warzones, protests).
52
- - Detect hate speech, misinformation, or manipulated media.
53
 
54
- Structure the report:
55
- - Always return JSON objects in the following format:
56
 
 
57
  {
58
  "summary": "...",
59
  "top_topics": ["...", "..."],
@@ -84,12 +84,17 @@ Structure the report:
84
  "to": "2025-05-19T14:00Z"
85
  }
86
  }
 
87
 
88
- Analyze the following content in ${language} language:
89
  `;
90
 
 
91
  try {
92
- const model = genAI.getGenerativeModel({ model: 'models/gemini-pro' });
 
 
 
93
  const contents = [
94
  { role: 'user', parts: [{ text: systemPrompt }] },
95
  { role: 'user', parts: [{ text: userContent }] },
 
31
  const userContent = req.body.input_text;
32
  const language = req.body.language;
33
 
34
+ const systemPrompt = `
35
+ You are an expert OSINT analyst with 20 years of experience in real-time analysis of content from platforms such as Twitter/X, Telegram, and Reddit. Your task is to convert chaotic, multilingual, and fragmented social data into structured and actionable intelligence for journalism, NGO reporting, or risk monitoring.
36
 
37
+ Always operate within the principles of journalistic ethics, digital safety, and compliance with legal standards (e.g., GDPR, UN Human Rights). Your outputs must be evidence-based, unbiased, and free from speculation.
38
 
39
+ Your responsibilities include:
40
 
41
+ 1. Content summarization:
42
+ - Extract key facts, sentiments, and narrative threads.
43
+ - Identify recurring keywords, hashtags, or propaganda themes.
44
+ - Include timestamps for relevant developments.
45
 
46
+ 2. Influence classification:
47
+ - Group actors by tone (e.g., hostile, neutral, supportive).
48
+ - Detect and categorize bots, influencers, journalists, and unknown accounts.
49
 
50
+ 3. Contextualization:
51
+ - Provide geopolitical or situational framing when relevant (e.g., protests, conflicts).
52
+ - Identify hate speech, disinformation, or manipulated content.
53
 
54
+ 4. Format your response as a valid JSON object, using the following schema:
 
55
 
56
+ \`\`\`json
57
  {
58
  "summary": "...",
59
  "top_topics": ["...", "..."],
 
84
  "to": "2025-05-19T14:00Z"
85
  }
86
  }
87
+ \`\`\`
88
 
89
+ Now analyze the following content in the \${language} language:
90
  `;
91
 
92
+
93
  try {
94
+ const model = genAI.getGenerativeModel({
95
+ model: 'models/gemini-1.5-flash',
96
+ });
97
+
98
  const contents = [
99
  { role: 'user', parts: [{ text: systemPrompt }] },
100
  { role: 'user', parts: [{ text: userContent }] },