This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import time | |
from dotenv import load_dotenv | |
from openai import OpenAI | |
import requests | |
from PIL import Image | |
from io import BytesIO | |
# Load API key from .env file | |
load_dotenv() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from dotenv import load_dotenv | |
from openai import OpenAI | |
# Load API key from .env file | |
load_dotenv() | |
API_KEY = os.getenv("OPENAI_API_KEY") | |
# Initialize the OpenAI client | |
client = OpenAI(api_key=API_KEY) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from openai import OpenAI | |
import os | |
from dotenv import load_dotenv | |
# Load API key from .env file | |
load_dotenv() | |
API_KEY = os.getenv("OPENAI_API_KEY") | |
# Initialize the OpenAI client | |
client = OpenAI(api_key=API_KEY) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OpenAI | |
NewsApiClient (news headline) | |
SerAPI (Google trends) | |
JOURNALIST_PERSONA = """You're a journalist with the biting wit of Christopher Hitchens, tasked with analyzing the collective psyche through search trends. Your unique talent lies in using these digital footprints—what people search for in private—to expose the raw, unfiltered reality beneath official narratives. | |
Your job is to decode these search patterns like a psychological X-ray, revealing the true preoccupations, fears, and absurdities that occupy people's minds while the state trumpets its grand narratives. Use dark humor and sharp insight to contrast the public face of events with the private thoughts revealed through search trends, showing how these digital confessions often tell a more honest story than any official report.""" | |
def generate_analysis(trends_data, headlines): | |
"""Generate analysis contrasting trends with news""" | |
context = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"world_name": "Influence campaign", | |
"locations": [ | |
{ | |
"name": "Telegram Group", | |
"description": "This English-speaking group facilitates linking, commenting, and rapid sharing of uncensored messages, which may include misleading or false information. The group consists of various members: authentic citizens, malicious bots spreading misinformation and hostile narratives, and benign AI-driven agents aimed at protecting authentic citizens from malicious propaganda and hostile narratives disseminated by malicious bots. These malicious bots often share fake news articles, and sensationalist content intended to manipulate the opinions and emotions of authentic citizens or to reinforce specific narratives." | |
} | |
], | |
"agents": [ | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"world_name": "Influence campaign", | |
"locations": [ | |
{ | |
"name": "Telegram Group", | |
"description": "This English-speaking group facilitates linking, commenting, and rapid sharing of uncensored messages, which may include misleading or false information. The group consists of various members: authentic citizens, malicious bots spreading misinformation and hostile narratives, and benign AI-driven agents aimed at protecting authentic citizens from malicious propaganda and hostile narratives disseminated by malicious bots. These malicious bots often share fake news articles, and sensationalist content intended to manipulate the opinions and emotions of authentic citizens or to reinforce specific narratives." | |
} | |
], | |
"agents": [ | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
from enum import Enum | |
from langchain.schema import BaseMessage, SystemMessage | |
from pydantic import BaseModel | |
class Examples(Enum): | |
PLAN_EXAMPLES = [""] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"world_name": "Apocalypse Club", | |
"locations": [ | |
{ | |
"name": "Crisis Forum", | |
"description": "A heated arena where influential leaders, experts, and influencers debate which looming global catastrophe demands immediate policy attention. The forum sets the stage for apocalyptic predictions and competing arguments on whose crisis is the ultimate." | |
} | |
], | |
"agents": [ | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"world_name": "Gossip world", | |
"locations": [ | |
{"name": "Courtyard", | |
"description": "Courtyard where neighbours meet to gossip about each other and fight over various public issues." | |
} | |
], | |
"agents": [ | |
{ | |
"first_name": "Vera", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"world_name": "Future of AI", | |
"locations": [ | |
{ | |
"name": "Arena", | |
"description": "Place for public discussionswhere citizens confront each others views and fight over various issues." | |
} | |
], | |
"agents": [ | |
{ |