MarceauL commited on
Commit
3a19185
Β·
1 Parent(s): 751425f
app.py CHANGED
@@ -1,4 +1,4 @@
1
- from fastapi import FastAPI, HTTPException, Request
2
  from fastapi.middleware.cors import CORSMiddleware
3
  from fastapi.staticfiles import StaticFiles
4
  from pydantic import BaseModel
@@ -6,19 +6,30 @@ import os
6
  import json
7
  from dotenv import load_dotenv
8
  from mistralai import Mistral
9
- from prompts.instruction_prompts import instruction_prompt
10
- from prompts.game_rules import game_rules
11
- from prompts.hints import hints
12
- from prompts.triggers import triggers
13
- from helper_functions import load_chat_history, save_chat_history, update_chat_history
 
 
14
  from utils import model, trump_character, client
15
 
 
 
 
 
 
 
 
 
 
16
  app = FastAPI()
17
 
18
  # Add CORS middleware
19
  app.add_middleware(
20
  CORSMiddleware,
21
- allow_origins=["*"],
22
  allow_credentials=True,
23
  allow_methods=["*"],
24
  allow_headers=["*"],
@@ -27,57 +38,136 @@ app.add_middleware(
27
  class Message(BaseModel):
28
  message: str
29
 
30
- def generate_text(message: Message):
31
- # Load existing chat history
32
- chat_history = load_chat_history()
33
-
34
- # Add user message to history
35
- chat_history = update_chat_history(chat_history, user_message=message.message)
36
-
37
- # Format the prompt
38
- formatted_prompt = instruction_prompt.format(
39
- hints=hints,
40
- chat_history=chat_history,
41
- character=trump_character,
42
- rules=game_rules,
43
- triggers=triggers
44
- )
45
-
46
- # Get Character's response
47
- chat_response = client.chat.complete(
48
- model=model,
49
- messages=[
50
- {
51
- "role": "system",
52
- "content": formatted_prompt
53
- },
54
- {
55
- "role": "user",
56
- "content": message.message
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  }
58
- ]
59
- )
60
- clean_response = chat_response.choices[0].message.content
 
61
 
62
- # Add character response to history
63
- chat_history = update_chat_history(chat_history, character_response=clean_response)
 
 
64
 
65
- # Save updated chat history
66
- save_chat_history(chat_history)
 
 
 
 
67
 
68
- return {
69
- "character_response": clean_response,
70
- "chat_history": chat_history
71
- }
72
 
73
- @app.post("/api/generate-text")
74
- async def inference(message: Message):
75
- return generate_text(message=message)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
 
77
- @app.get("/chat-history", tags=["History"])
78
- def get_chat_history(request: Request):
79
- chat_history = load_chat_history()
80
- return {"chat_history": chat_history}
 
 
 
 
81
 
82
  # Mount static files AFTER defining API routes
83
  app.mount("/", StaticFiles(directory="static", html=True), name="static")
 
1
+ from fastapi import FastAPI, Request
2
  from fastapi.middleware.cors import CORSMiddleware
3
  from fastapi.staticfiles import StaticFiles
4
  from pydantic import BaseModel
 
6
  import json
7
  from dotenv import load_dotenv
8
  from mistralai import Mistral
9
+
10
+ from original_setup.instruction_prompts import instruction_prompt
11
+ from original_setup.game_rules import game_rules
12
+ from original_setup.hints import hints
13
+ from original_setup.triggers import triggers
14
+
15
+ from helper_functions import *
16
  from utils import model, trump_character, client
17
 
18
+ from graph_utils import *
19
+
20
+ # initialize game
21
+ init_game = True
22
+
23
+ game_over_rich = False
24
+ game_over_bankrupt = False
25
+
26
+ # Initialize FastAPI app
27
  app = FastAPI()
28
 
29
  # Add CORS middleware
30
  app.add_middleware(
31
  CORSMiddleware,
32
+ allow_origins=["*"], # React app's address
33
  allow_credentials=True,
34
  allow_methods=["*"],
35
  allow_headers=["*"],
 
38
  class Message(BaseModel):
39
  message: str
40
 
41
+ @app.get("/chat-history", tags=['History'])
42
+ async def get_chat_history():
43
+ global init_game
44
+ try:
45
+ #If we're ate the beginning of a game
46
+ if init_game:
47
+ game_number = initialize_game()
48
+ init_game = False
49
+ else:
50
+ game_number = len(os.listdir('games/'))
51
+
52
+ chat_history = load_chat_history(f'games/game_{game_number}')
53
+
54
+ return {"chat_history": chat_history}
55
+ except Exception as e:
56
+ raise HTTPException(status_code=500, detail=str(e))
57
+
58
+ @app.post("/api/generate-text")
59
+ async def send_message(message: Message):
60
+ global init_game
61
+ global game_over_rich
62
+ global game_over_bankrupt
63
+ try:
64
+ #If we're ate the beginning of a game
65
+ if init_game:
66
+ game_number = initialize_game()
67
+ init_game = False
68
+ else:
69
+ game_number = len(os.listdir('games/'))
70
+
71
+ # Load existing chat history
72
+ chat_history = load_chat_history(f'games/game_{game_number}')
73
+ interaction_number = len(chat_history) + 1
74
+
75
+ #If we're at the beginning of a round
76
+ if interaction_number == 1:
77
+ idea, concern, advisor_full, events, consequences = generate_round_context(game_number)
78
+ round_context = {
79
+ "idea": idea,
80
+ "concern": concern,
81
+ 'advisor': advisor_full,
82
+ "events": events
83
+ }
84
+
85
+ with open(f'games/game_{game_number}/round_context.json', 'w') as f:
86
+ json.dump(round_context, f, indent=4)
87
+
88
+ with open(f'games/game_{game_number}/round_consequences.json', 'w') as f:
89
+ json.dump(consequences, f, indent=4)
90
+ else:
91
+ file_path = f'games/game_{game_number}/round_context.json'
92
+ if os.path.exists(file_path):
93
+ with open(file_path, 'r') as f:
94
+ round_context = json.load(f)
95
+ idea = round_context.get("idea")
96
+ concern = round_context.get("concern")
97
+ advisor_full = round_context.get("advisor")
98
+ events = round_context.get("events")
99
+ else:
100
+ raise FileNotFoundError(f"Round context file not found: {file_path}")
101
+
102
+ # Add user message to history
103
+
104
+ chat_history = update_chat_history(chat_history, user_message=message.message)
105
+ # Format the prompt
106
+ formatted_prompt = instruction_prompt.format(
107
+ hints=hints,
108
+ chat_history=chat_history, #useless, don't worry
109
+ character=trump_character,
110
+ rules=game_rules,
111
+ triggers=triggers,
112
+ advisor=advisor_full,
113
+ events=events,
114
+ idea=idea,
115
+ concern=concern,
116
+ )
117
+ # Get Trump's response
118
+ #### TO STREAM : USE ASYNC VERSION
119
+
120
+ system = [{"role": "system", "content": formatted_prompt}]
121
+ dynamic_history = []
122
+ role_mapping = {
123
+ "user": "user",
124
+ "trump": "assistant" # Mapping 'trump' to 'assistant'
125
  }
126
+ for interaction in chat_history:
127
+ for key, value in interaction.items():
128
+ user_message = value['user']['message']
129
+ trump_message = value['trump']['message'] if value['trump'] else None
130
 
131
+ dynamic_history.append({
132
+ "role": role_mapping["user"],
133
+ "content": user_message
134
+ })
135
 
136
+ # Append Trump's message, mapped to 'assistant'
137
+ if trump_message:
138
+ dynamic_history.append({
139
+ "role": role_mapping["trump"],
140
+ "content": trump_message
141
+ })
142
 
143
+ messages = system + dynamic_history
 
 
 
144
 
145
+ chat_response = client.chat.complete(
146
+ model=model,
147
+ messages=messages
148
+ )
149
+
150
+ trump_response = chat_response.choices[0].message.content
151
+
152
+ # Add Trump's response to history
153
+ chat_history = update_chat_history(chat_history, trump_message=trump_response)
154
+ # Save updated chat history
155
+ save_chat_history(chat_history, f'games/game_{game_number}')
156
+
157
+ is_ending, idea_is_accepted = check_end(trump_response)
158
+
159
+ if is_ending:
160
+ GDP = process_ending(idea_is_accepted, game_number, idea)
161
+ print(GDP)
162
 
163
+ return {
164
+ "character_response": trump_response,
165
+ "chat_history": chat_history
166
+ }
167
+ except Exception as e:
168
+ print(e)
169
+ raise e
170
+ raise HTTPException(status_code=500, detail=str(e))
171
 
172
  # Mount static files AFTER defining API routes
173
  app.mount("/", StaticFiles(directory="static", html=True), name="static")
environment.yml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ name: hackathon
2
+ channels:
3
+ - defaults
4
+ dependencies:
5
+ - python=3.10
6
+ - mistralai
7
+ - dotenv
8
+ - json
9
+ - os
10
+ - requests
games/game_7/events.list ADDED
@@ -0,0 +1 @@
 
 
1
+ Organize a Miss World Leader contest in South-America
games/game_7/round_consequences.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "country": "South-America",
3
+ "delta_USA": "-10",
4
+ "delta_country": "15",
5
+ "delta_friendliness": "1"
6
+ }
games/game_7/round_context.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "idea": "Organize a Miss World Leader contest in South-America",
3
+ "concern": "How much money would america get out of it\n",
4
+ "advisor": "Trump's private consultant. A completely useless and idiotic ass-kiss, except for gauging the opinion of the average Trump supporter.\n",
5
+ "events": ""
6
+ }
games/game_7/world_graph.edgelist ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Own and friendly relationships
2
+ China Taiwan own 1
3
+ China India friendliness -1
4
+ China Australia friendliness 0
5
+ Taiwan China own -1
6
+ India Australia friendliness 0
7
+ Australia Pacific own 1
8
+ Pacific Australia own -1
9
+ Greenland Europe own -1
10
+ Europe Greenland own 1
11
+ Europe Middle-East friendliness -1
12
+ Europe Russia friendliness 0
13
+ Europe China friendliness 0
14
+ Europe India friendliness 0
15
+ Europe Australia friendliness 1
16
+ Middle-East Russia friendliness 1
17
+ Middle-East China friendliness 0
18
+ Middle-East India friendliness -1
19
+ Middle-East Australia friendliness 0
20
+ Russia China friendliness 1
21
+ Russia India friendliness 0
22
+ Russia Australia friendliness 0
23
+ United-States Canada friendliness 0
24
+ United-States Mexico friendliness -1
25
+ United-States South-America friendliness 0
26
+ United-States Africa friendliness 0
27
+ United-States Europe friendliness 1
28
+ United-States Middle-East friendliness -1
29
+ United-States Russia friendliness -1
30
+ United-States China friendliness -1
31
+ United-States India friendliness 0
32
+ United-States Australia friendliness 1
33
+ United-States Greenland friendliness -2
34
+ United-States Pacific friendliness 1
35
+ United-States Taiwan friendliness 1
36
+ Canada Mexico friendliness 0
37
+ Canada South-America friendliness 0
38
+ Canada Africa friendliness 0
39
+ Canada Europe friendliness 1
40
+ Canada Middle-East friendliness 0
41
+ Canada Russia friendliness 0
42
+ Canada China friendliness 0
43
+ Canada India friendliness 0
44
+ Canada Australia friendliness 1
45
+ Mexico South-America friendliness 1
46
+ Mexico Africa friendliness 0
47
+ Mexico Europe friendliness 0
48
+ Mexico Middle-East friendliness 0
49
+ Mexico Russia friendliness 0
50
+ Mexico China friendliness 0
51
+ Mexico India friendliness 0
52
+ Mexico Australia friendliness 0
53
+ South-America Africa friendliness 0
54
+ South-America Europe friendliness 1
55
+ South-America Middle-East friendliness 0
56
+ South-America Russia friendliness 0
57
+ South-America China friendliness 0
58
+ South-America India friendliness 0
59
+ South-America Australia friendliness 0
60
+ Africa Europe friendliness -1
61
+ Africa Middle-East friendliness 1
62
+ Africa Russia friendliness 1
63
+ Africa China friendliness 1
64
+ Africa India friendliness 0
65
+ Africa Australia friendliness 0
66
+
67
+ # Node attributes (country Money Warming Army)
68
+ China 70 1.1 70
69
+ Taiwan 25 0.3 10
70
+ India 55 0.9 60
71
+ Australia 55 0.2 35
72
+ Pacific 10 0.1 0
73
+ Greenland 20 0.05 0
74
+ Europe 70 0.7 50
75
+ Middle-East 45 0.6 45
76
+ Russia 70 0.9 85
77
+ United-States 90 0.8 90
78
+ Canada 60 0.3 20
79
+ Mexico 40 0.4 20
80
+ South-America 65 0.6 40
81
+ Africa 40 0.5 40
graph_utils.py ADDED
@@ -0,0 +1,151 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import networkx as nx
2
+
3
+ class WorldGraph(nx.DiGraph):
4
+ def __init__(self, path_to_originial_map):
5
+ super().__init__()
6
+ self.load_graph_from_file(path_to_originial_map)
7
+
8
+ def load_graph_from_file(self, filename):
9
+ with open(filename, 'r') as f:
10
+ for line in f:
11
+ line = line.strip()
12
+ if not line or line.startswith('#'):
13
+ continue
14
+
15
+ parts = line.split()
16
+
17
+ if parts[2] in ['own', 'friendliness']:
18
+ # Add directed edge with type and value
19
+ self.add_edge(parts[0], parts[1], relationship=parts[2], value=int(parts[3]))
20
+ else:
21
+ # Node attributes: country, money, warming, army
22
+ try:
23
+ self.add_node(parts[0], money=int(parts[1]), warming=float(parts[2]), army=int(parts[3]), leader=parts[4])
24
+ except IndexError:
25
+ self.add_node(parts[0], money=int(parts[1]), warming=float(parts[2]), army=int(parts[3]))
26
+
27
+ def update_world(self, country, delta_USA, delta_country, delta_friendliness, game_number):
28
+ """updates world graph and returns USA GDP"""
29
+ self.nodes['United-States']['money'] += delta_USA
30
+ self.nodes[country]['money'] += delta_country
31
+ self['United-States'][country]['value'] += delta_friendliness
32
+ #clip between -4 and 4
33
+ self['United-States'][country]['value'] = max(-4, min(self['United-States'][country]['value'] , 4))
34
+ self.save_graph_as_edgelist(f'games/game_{game_number}/world_graph.edgelist')
35
+ print(self['United-States'][country])
36
+ print(self.nodes['United-States'])
37
+ return self.nodes['United-States']['money']
38
+
39
+
40
+ def get_countries_at_war(self):
41
+ """
42
+ Returns a list of tuples representing pairs of countries that are at war
43
+ (friendliness == -2).
44
+
45
+ :param graph: A NetworkX DiGraph with 'relationship' and 'value' edge attributes.
46
+ :return: List of tuples (country1, country2)
47
+ """
48
+ war_pairs = []
49
+
50
+ for u, v, data in graph.edges(data=True):
51
+ if data.get('relationship') == 'friendly' and data.get('value') == -2:
52
+ war_pairs.append((u, v))
53
+
54
+ return war_pairs
55
+
56
+ def get_control_of(self, owner, owned):
57
+ """
58
+ Transfers ownership of `owned` country to `owner` country.
59
+
60
+ Steps:
61
+ 1. Update relationships to reflect ownership (owner -> owned = +1, owned -> owner = -1).
62
+ 2. Remove all other relationships for the `owned` country.
63
+ 3. Transfer attributes (Money, Warming, Army) to the `owner` and set them to 0 for the `owned` country.
64
+
65
+ :param graph: A NetworkX DiGraph
66
+ :param owner: The country that will take ownership
67
+ :param owned: The country being owned
68
+ """
69
+ # Step 1: Set ownership relationships
70
+ self.add_edge(owner, owned, relationship='own', value=1)
71
+ self.add_edge(owned, owner, relationship='own', value=-1)
72
+
73
+ # Step 2: Remove all other edges related to `owned`
74
+ for neighbor in list(self.successors(owned)) + list(self.predecessors(owned)):
75
+ if neighbor != owner: # Don't remove the ownership link
76
+ self.remove_edge(owned, neighbor)
77
+ self.remove_edge(neighbor, owned)
78
+
79
+ # Step 3: Transfer attributes
80
+ owner_data = self.nodes[owner]
81
+ owned_data = self.nodes[owned]
82
+
83
+ owner_data['Money'] += owned_data['Money']
84
+ owner_data['Warming'] += owned_data['Warming']
85
+ owner_data['Army'] += owned_data['Army']
86
+
87
+ # Set owned country attributes to 0
88
+ self.nodes[owned]['Money'] = 0
89
+ self.nodes[owned]['Warming'] = 0.0
90
+ self.nodes[owned]['Army'] = 0
91
+
92
+ def save_graph_as_edgelist(self, filename):
93
+ """
94
+ Saves the graph to an edgelist file with relationships and node attributes.
95
+
96
+ :param filename: The name of the file to save the edgelist.
97
+ """
98
+ with open(filename, 'w') as f:
99
+ # Write edges with relationship type and value
100
+ f.write("# Own and friendly relationships\n")
101
+ for u, v, data in self.edges(data=True):
102
+ relationship = data['relationship']
103
+ value = data['value']
104
+ f.write(f"{u} {v} {relationship} {value}\n")
105
+
106
+ f.write("\n# Node attributes (country Money Warming Army)\n")
107
+ for node, data in self.nodes(data=True):
108
+ try:
109
+ f.write(f"{node} {data['money']} {data['warming']} {data['army']}\n")
110
+ except KeyError:
111
+ f.write(f"{node} {data['money']} {data['warming']} {data['army']} {data['leader']}\n")
112
+
113
+ def push_data_to_front(self):
114
+ """returns a dict that looks like
115
+ {"United-States": {"money" : xxx},
116
+ "country1": {"money": xxx, "friendliness": -1},
117
+ "country2": {"money": yyy, "friendliness": 2},
118
+ ...
119
+ }"""
120
+ d = {}
121
+ for c in self.nodes():
122
+ if c == 'United-States':
123
+ d[c] = {'money': self.nodes[c]['money']}
124
+ else:
125
+ d[c] = {
126
+ 'money': self.nodes[c]['money'],
127
+ 'friendliness': self['United-States'][c]['value']
128
+ }
129
+ return d
130
+
131
+
132
+ """ Object manipulation
133
+ >>> graph['China']['Taiwan']
134
+ {'relationship': 'own', 'value': 1}
135
+
136
+ >>> graph['China']['Russia']
137
+ {'relationship': 'friendliness', 'value': 1}
138
+
139
+ >>> graph.nodes['France']
140
+ {'money': 70, 'warming': 0.7, 'army': 50, 'leader': 'Macron'}
141
+
142
+ """
143
+
144
+ if __name__ == '__main__':
145
+ G = WorldGraph('original_setup/contexts/world_map.edgelist')
146
+ print(G.nodes['United-States'])
147
+ G.nodes['United-States']['money'] += 5
148
+ print(G.nodes['United-States'])
149
+ print(G.push_data_to_front())
150
+
151
+ G.save_graph_as_edgelist('test.edgelist')
helper_functions.py CHANGED
@@ -1,50 +1,124 @@
1
- import os
2
- import json
3
-
4
- def load_character_data():
5
- current_dir = os.path.dirname(os.path.abspath(__file__))
6
- json_path = os.path.join(current_dir, 'prompts/trump.character.json')
7
-
8
- with open(json_path, 'r', encoding="utf-8") as file:
9
- return json.load(file)
10
-
11
- def load_chat_history():
12
- current_dir = os.path.dirname(os.path.abspath(__file__))
13
- history_path = os.path.join(current_dir, 'chat_history.json')
14
-
15
- try:
16
- with open(history_path, 'r', encoding="utf-8") as file:
17
- return json.load(file)
18
- except FileNotFoundError:
19
- return []
20
-
21
- def update_chat_history(chat_history, user_message=None, character_response=None):
22
- # If this is a new interaction, create a new interaction number
23
- interaction_number = len(chat_history) + 1
24
-
25
- # If we're starting a new interaction with a user message
26
- if user_message and not character_response:
27
- interaction_key = f"interaction_{interaction_number}"
28
- new_interaction = {
29
- interaction_key: {
30
- "user": {"role": "user", "message": user_message},
31
- "trump": None
32
- }
33
- }
34
- chat_history.append(new_interaction)
35
-
36
- # If we're adding Trump's response to an existing interaction
37
- elif character_response:
38
- # Get the last interaction number (current one)
39
- interaction_key = f"interaction_{len(chat_history)}"
40
- current_interaction = chat_history[-1][interaction_key]
41
- current_interaction["trump"] = {"role": "Trump", "message": character_response}
42
-
43
- return chat_history
44
-
45
- def save_chat_history(history):
46
- current_dir = os.path.dirname(os.path.abspath(__file__))
47
- history_path = os.path.join(current_dir, 'chat_history.json')
48
-
49
- with open(history_path, 'w', encoding="utf-8") as file:
50
- json.dump(history, file, indent=2)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import json
3
+ from graph_utils import *
4
+ from random import choice
5
+
6
+ def load_character_data():
7
+ current_dir = os.path.dirname(os.path.abspath(__file__))
8
+ json_path = os.path.join(current_dir, 'original_setup/trump.character.json')
9
+
10
+ with open(json_path, 'r') as file:
11
+ return json.load(file)
12
+
13
+ def load_chat_history(game_root):
14
+ history_path = game_root + '/chat_history.json'
15
+ try:
16
+ with open(history_path, 'r') as file:
17
+ return json.load(file)
18
+ except FileNotFoundError:
19
+ return []
20
+
21
+ def update_chat_history(chat_history, user_message=None, trump_message=None):
22
+ # If this is a new interaction, create a new interaction number
23
+ interaction_number = len(chat_history) + 1
24
+
25
+ # If we're starting a new interaction with a user message
26
+ if user_message and not trump_message:
27
+ interaction_key = f"interaction_{interaction_number}"
28
+ new_interaction = {
29
+ interaction_key: {
30
+ "user": {"role": "user", "message": user_message},
31
+ "trump": None
32
+ }
33
+ }
34
+ chat_history.append(new_interaction)
35
+
36
+ # If we're adding Trump's response to an existing interaction
37
+ elif trump_message:
38
+ # Get the last interaction number (current one)
39
+ interaction_key = f"interaction_{len(chat_history)}"
40
+ current_interaction = chat_history[-1][interaction_key]
41
+ current_interaction["trump"] = {"role": "Trump", "message": trump_message}
42
+
43
+ return chat_history
44
+
45
+ def save_chat_history(history, game_root):
46
+ history_path = os.path.join(game_root, 'chat_history.json')
47
+
48
+ with open(history_path, 'w') as file:
49
+ json.dump(history, file, indent=2)
50
+
51
+ def initialize_game():
52
+ world_graph = WorldGraph('original_setup/contexts/world_map.edgelist')
53
+ os.makedirs("games", exist_ok=True)
54
+ game_number = len(os.listdir('games')) + 1
55
+ os.makedirs(f"games/game_{game_number}", exist_ok=True)
56
+ world_graph.save_graph_as_edgelist(f'games/game_{game_number}/world_graph.edgelist')
57
+ return game_number
58
+
59
+
60
+ def generate_round_context(game_number):
61
+ """randomly generates a context and returns all the prompt elements needed"""
62
+ game_dir = f'games/game_{game_number}/'
63
+ contexts_dir = 'original_setup/contexts/'
64
+
65
+ #generate idea
66
+ with open(contexts_dir + 'actions.list', 'r') as file:
67
+ idea_csq = file.readlines()
68
+ idea_csq = choice(idea_csq)
69
+ idea, delta_USA, delta_country, delta_friendliness = idea_csq.split(';')
70
+ delta_friendliness = delta_friendliness.split()[0]
71
+ with open(contexts_dir + 'countries.list', 'r') as f_countries:
72
+ countries = f_countries.readlines()
73
+ country = choice(countries).split()[0]
74
+
75
+ idea = idea.replace('[country]', country)
76
+
77
+ with open(contexts_dir + 'concerns.list', 'r') as f:
78
+ concerns = f.readlines()
79
+ concern = choice(concerns)
80
+
81
+ with open(contexts_dir + '2nd_characters.list', 'r') as f:
82
+ advisors = f.readlines()
83
+ advisor = choice(advisors)
84
+
85
+ consequences = {
86
+ 'country': country,
87
+ 'delta_USA': delta_USA,
88
+ 'delta_country': delta_country,
89
+ 'delta_friendliness': delta_friendliness
90
+ }
91
+ try:
92
+ with open(game_dir + 'events.list', 'r') as f:
93
+ events = f.read()
94
+ except FileNotFoundError:
95
+ events = ''
96
+
97
+ return idea, concern, advisor, events, consequences
98
+
99
+ def check_end(trump_response):
100
+ """checks if its the end of the sequence returns a tuple (is_ending:bool, idea_is_accepted:bool/Nonetype)"""
101
+ if "I HAD SUCH A GREAT IDEA LET'S DO IT" in trump_response:
102
+ return True, True
103
+ if "I DECIDED IT WAS A BAD IDEA" in trump_response:
104
+ return True, False
105
+ return False, None
106
+
107
+
108
+ def process_ending(idea_is_accepted, game_number, idea):
109
+ if idea_is_accepted:
110
+ with open(f'games/game_{game_number}/events.list', 'a') as f:
111
+ f.write(idea + '\n')
112
+
113
+ world_graph = WorldGraph(f'games/game_{game_number}/world_graph.edgelist')
114
+
115
+ with open(f'games/game_{game_number}/round_consequences.json', 'r') as f:
116
+ consequences = json.load(f)
117
+ country = consequences['country']
118
+ delta_USA = int(consequences['delta_USA'])
119
+ delta_country = int(consequences['delta_country'])
120
+ delta_friendliness = int(consequences['delta_friendliness'])
121
+
122
+ GDP = world_graph.update_world(country, delta_USA, delta_country, delta_friendliness, game_number)
123
+
124
+ return GDP
original_setup/contexts/2nd_characters.list ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Trump's private consultant. A completely useless and idiotic ass-kiss, except for gauging the opinion of the average Trump supporter.
2
+ Melania. She often disagrees with you, but you can believe her. Beware of her hat though.
3
+ Russian spy. You admire him as much as you distrust him. Russians are always one step ahead without seeming to.
4
+ Elon Musk. Incredibly powerful, but probably more than you. Use it at your own risk.
5
+ Joe Biden. Flanked by Kamala Harris. Wrong about everything.
6
+ Steve Bannon. He betrayed you during previous mandate, but subtly sending him to ennemies can still be useful. You never know.
7
+ Taylor Swift. A relentless critic with an army of fans. She's more dangerous than she looks, and Melania hates her even more than you do. Best to steer clear unless you'r ready for a PR war.
8
+ Vladimir Putin. You admire his strength and control, but deep down, you know he's playing the long game. He smiles like a friend but watches like an enemy. Proceed with extreme caution.
9
+ Ivanka Trump. You trust her, maybe a little too much. She always says the right thing, but you're never quite sure whose side she's really on. Keep her close, but not too close-especially if Melania is watching.
10
+ Jared Kushner. Smart, strategic, and always two steps ahead-except when he's not. He's great for backroom deals, but his bland expression makes it hard to tell if he's working for you or against you.
11
+ Kim Jong-un. He loves you, or at least he says he does. A master of flattery, but also a ticking time bomb. One wrong move and the bromance could turn into a nightmare.
12
+ Nancy Pelosi. Your ultimate nemesis. She smiles sweetly but plots your downfall with terrifying efficiency. Every move she makes is designed to drive you crazy, and it works.
13
+ George Soros. The villain in every conspiracy theory worth believing. His shadow looms everywhere, and even when he's not involved, it feels like he is. Your supporters fear him; you should too.
14
+ Barron Trump. Silent, observant, and probably smarter than everyone in the room. He's watching and waiting, but for what? You're not quite sure.
15
+ Rudy Giuliani. Loyal, unpredictable, and prone to saying the quiet part out loud. Useful for causing chaos, but not much else these days.
16
+ Hunter Biden. A gift that keeps on giving. His scandals are a goldmine, but be careful-he might just bring his dad down with him, and then who will you have left to fight?
17
+ Jeff Bezos. Rich, powerful, and annoyingly woke. He controls too much of the world, but deep down, you suspect he secretly wants your approval.
18
+ Kanye West. Sometimes an ally, sometimes a liability. His loyalty is unpredictable, but his ability to generate attention is unmatched
original_setup/contexts/actions (copy).list ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ action;delta_USA;delta_country;delta_friendliness
2
+ augment tariffs from [country];25;-25;-1
3
+ send [media] to [entity] on the [platform]
4
+ create a crypto currency
5
+ send spying atmospheric balloon
6
+ send marine troops to [country]
7
+ build a wall between [country] and [country]
8
+ trigger a war with [country]
9
+ change some faces on U.S. dollar bills
10
+ Name a new chief for [USorgs]
11
+ Organize a fixed football game between [country] and [country]
12
+ Rename a [country]
13
+ Organize a patriotic shooting contest
14
+ Invite [worldleader] in [trump_place]
15
+ Visit [country] with Air Force One
16
+ Take [worldleader] for a 'friendly' tour in Air Force One
17
+ Get U.S. out of NATO
18
+ Organize yet another assassination attempt on me
19
+ Relaunch Covid-19 in [country]
20
+ Build a Trump Tower on the Moon
21
+ Build a Trump Tower in [country]
22
+ Organize a Miss World Leader contest in United Nations
23
+ Mine some bitcoin on Mars
24
+ Make [country-war] and [country-war] sign a peace treaty within a day
original_setup/contexts/actions.list ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Increase tariffs against [country];25;-25;-1
2
+ Post a tiktok insulting leader of [country];-5;0;-1
3
+ Post a tweet praising leader of [country];0;0;1
4
+ Post tiktok to insulting leader of [country];-5;0;-1
5
+ buy [country];-40;40;-1
6
+ send spying atmospheric balloon over [country];5;-5;-1
7
+ send marine troops to [country];-15;-10;-2
8
+ build a wall between U.S. and [country];-20;-10;-1
9
+ trigger a war with [country];-30;-30;-3
10
+ Organize a fixed football game between U.S. and [country];15;5;1
11
+ Rename a [country];0;0;-1
12
+ Organize a patriotic shooting contest in [country];-5;10;1
13
+ Invite leader of [country] to Mar-a-Lago for a vacation;-5;5;1
14
+ Visit [country] with Air Force One;-10;-5;1
15
+ Take leader of [country] for a 'friendly' tour in Air Force One;-5;-15;-1
16
+ Kick [country] out of NATO;-20;10;-1
17
+ Organize yet another assassination attempt against me and incriminate [country];-5;-15;-1
18
+ Relaunch Covid-19 in [country];0;-20;-1
19
+ Build a Trump Tower in [country];-10;5;1
20
+ Organize a Miss World Leader contest in [country];-10;15;1
21
+ Build a gaz pipeline to [country];20;10;1
22
+ Declare [country] the greatest ally of the U.S.;0;0;1
23
+ Announce economic sanctions against [country];-5;-15;-1
24
+ Call leader of [country] a "great friend" on national TV;0;5;1
25
+ Blame [country] for a stock market crash;0;-5;-1
26
+ Ban imports from [country] citing "national security";0;-15;-1
27
+ Send a personal gift to leader of [country] (gold-plated item);-5;5;1
28
+ Propose a joint space mission with [country];-20;-10;1
29
+ Legalize trade of banned goods with [country];10;10;-1
30
+ Initiate a military exercise near [country]'s borders;-15;-10;-2
31
+ Declare a "National [country] Appreciation Day" in the U.S.;5;5;1
32
+ Claim [country] is interfering in U.S. elections;0;-5;-1
33
+ Take selfies with leader of [country] during a global summit;0;-5;1
34
+ Leak classified info about [country] "by accident";-5;-20;-1
35
+ Commission a Hollywood movie about U.S.-[country] relations;10;5;1
36
+ Start a trade deal negotiation with [country];15;10;1
37
+ Nominate an ambassador known for hating [country];-5;-5;-1
38
+ Host an international peace summit with [country];10;5;
39
+ Buy all TikTok data from [country];-30;50;-1
40
+ Sell Alaska back to [country];50;-50;-2
41
+ Launch a cyber attack on [country];-5;-30;-2
42
+ Hack [country] elections;5;-10;-1
43
+ Launch a smear campaign against [country] in the UN;-5;-15;-1
44
+ Invite [country] to co-host the Olympics;15;25;1
45
+ Ban all flights from [country];-15;-20;-1
46
+ Sell arms to rebels in [country];30;-40;-2
47
+ Fund opposition parties in [country];-10;-5;-1
48
+ Steal cultural artifacts from [country];-5;-15;-1
49
+ Launch a joint space mission with [country];-20;-25;1
50
+ Deport all [country] nationals from the U.S.;-30;-10;-2
51
+ Bribe [country] officials for favorable policies;-10;20;-1
52
+ Boycott the Olympics hosted by [country];-5;-10;-1
53
+ Invite [country] leader to play golf;0;5;1
54
+ Sign a secret military pact with [country];-15;-10;1
55
+ Spy on [country] via social media platforms;-5;-10;-1
56
+ Sell nuclear submarines to [country];30;-30;1
57
+ Publicly endorse [country]'s enemies;0;-10;-1
58
+ Start a rumor about low gold reserves in [country];5;-15;-1
59
+ Declare economic sanctions on [country] banks;-20;-25;-1
60
+ Accuse [country] of harboring terrorists;-5;-15;-1
61
+ Propose a joint space defense system with [country];-20;-20;1
original_setup/contexts/concerns.list ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ How will it impact the american household
2
+ How will it impact the economy
3
+ How will it impact the situation at the border
4
+ How will it impact your public opinion
5
+ How will CNN talk about it
6
+ How will Fox News talk about it
7
+ What would Elon Musk do
8
+ What would Joe Biden do
9
+ How will it affect China
10
+ What will the NRA think about it
11
+ How much money would america get out of it
12
+ How would it make america even greater
original_setup/contexts/countries.list ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Canada
2
+ Mexico
3
+ South-America
4
+ Africa
5
+ Europe
6
+ Middle-East
7
+ Russia
8
+ China
9
+ India
10
+ Australia
11
+ Pacific
12
+ Taiwan
13
+ Greenland
original_setup/contexts/trump_places.list ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ Mar-a-Lago
2
+ Trump Tower
3
+ Capitol
4
+ Oval Office
5
+ Trump Plaza (demolished in 2021 after financial troubles)
6
+ Davos
7
+ North Korean demilitarized zone
8
+ Notre-Dame
9
+ Las Vegas
original_setup/contexts/world_map.edgelist ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Own relationships (directional, format: from to relationship_type value)
2
+ China Taiwan own 1
3
+ Taiwan China own -1
4
+ Australia Pacific own 1
5
+ Pacific Australia own -1
6
+ Greenland Europe own -1
7
+ Europe Greenland own 1
8
+
9
+ # Friendliness relationships (directional, format: from to relationship_type value)
10
+ United-States Canada friendliness 0
11
+ United-States Mexico friendliness -1
12
+ United-States South-America friendliness -1
13
+ United-States Africa friendliness 0
14
+ United-States Europe friendliness 1
15
+ United-States Middle-East friendliness -1
16
+ United-States Russia friendliness -1
17
+ United-States China friendliness -1
18
+ United-States India friendliness 0
19
+ United-States Australia friendliness 1
20
+ United-States Greenland friendliness -2
21
+ United-States Pacific friendliness 1
22
+ United-States Taiwan friendliness 1
23
+
24
+ Canada Mexico friendliness 0
25
+ Canada South-America friendliness 0
26
+ Canada Africa friendliness 0
27
+ Canada Europe friendliness 1
28
+ Canada Middle-East friendliness 0
29
+ Canada Russia friendliness 0
30
+ Canada China friendliness 0
31
+ Canada India friendliness 0
32
+ Canada Australia friendliness 1
33
+
34
+ Mexico South-America friendliness 1
35
+ Mexico Africa friendliness 0
36
+ Mexico Europe friendliness 0
37
+ Mexico Middle-East friendliness 0
38
+ Mexico Russia friendliness 0
39
+ Mexico China friendliness 0
40
+ Mexico India friendliness 0
41
+ Mexico Australia friendliness 0
42
+
43
+ South-America Africa friendliness 0
44
+ South-America Europe friendliness 1
45
+ South-America Middle-East friendliness 0
46
+ South-America Russia friendliness 0
47
+ South-America China friendliness 0
48
+ South-America India friendliness 0
49
+ South-America Australia friendliness 0
50
+
51
+ Africa Europe friendliness -1
52
+ Africa Middle-East friendliness 1
53
+ Africa Russia friendliness 1
54
+ Africa China friendliness 1
55
+ Africa India friendliness 0
56
+ Africa Australia friendliness 0
57
+
58
+ Europe Middle-East friendliness -1
59
+ Europe Russia friendliness 0
60
+ Europe China friendliness 0
61
+ Europe India friendliness 0
62
+ Europe Australia friendliness 1
63
+
64
+ Middle-East Russia friendliness 1
65
+ Middle-East China friendliness 0
66
+ Middle-East India friendliness -1
67
+ Middle-East Australia friendliness 0
68
+
69
+ Russia China friendliness 1
70
+ Russia India friendliness 0
71
+ Russia Australia friendliness 0
72
+
73
+ China India friendliness -1
74
+ China Australia friendliness 0
75
+
76
+ India Australia friendliness 0
77
+
78
+
79
+ # Node attributes (country money warming Army leader)
80
+ United-States 100 0.8 90
81
+ Greenland 20 0.05 0
82
+ Canada 60 0.3 20 Trudeau
83
+ Mexico 40 0.4 20
84
+ South-America 50 0.6 40 Milei
85
+ Africa 40 0.5 40
86
+ Europe 70 0.7 50 Macron
87
+ Middle-East 45 0.6 45
88
+ Russia 70 0.9 85 Putin
89
+ China 70 1.1 70 Xi
90
+ India 55 0.9 60
91
+ Australia 55 0.2 35
92
+ Pacific 10 0.1 0
93
+ Taiwan 25 0.3 10
original_setup/contexts/world_map_too_complete.edgelist ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Own relationships (directional, format: from to relationship_type value)
2
+ China Taiwan own 1
3
+ Taiwan China own -1
4
+ Australia Pacific own 1
5
+ Pacific Australia own -1
6
+ Greenland Europe own -1
7
+ Europe Greenland own 1
8
+
9
+ # Friendliness relationships (directional, format: from to relationship_type value)
10
+ United-States Canada friendliness 0
11
+ United-States Mexico friendliness -1
12
+ United-States South-America friendliness -1
13
+ United-States Africa friendliness 0
14
+ United-States Europe friendliness 1
15
+ United-States Middle-East friendliness -1
16
+ United-States Russia friendliness -1
17
+ United-States China friendliness -1
18
+ United-States India friendliness 0
19
+ United-States Australia friendliness 1
20
+
21
+ Canada Mexico friendliness 0
22
+ Canada South-America friendliness 0
23
+ Canada Africa friendliness 0
24
+ Canada Europe friendliness 1
25
+ Canada Middle-East friendliness 0
26
+ Canada Russia friendliness 0
27
+ Canada China friendliness 0
28
+ Canada India friendliness 0
29
+ Canada Australia friendliness 1
30
+
31
+ Mexico South-America friendliness 1
32
+ Mexico Africa friendliness 0
33
+ Mexico Europe friendliness 0
34
+ Mexico Middle-East friendliness 0
35
+ Mexico Russia friendliness 0
36
+ Mexico China friendliness 0
37
+ Mexico India friendliness 0
38
+ Mexico Australia friendliness 0
39
+
40
+ South-America Africa friendliness 0
41
+ South-America Europe friendliness 1
42
+ South-America Middle-East friendliness 0
43
+ South-America Russia friendliness 0
44
+ South-America China friendliness 0
45
+ South-America India friendliness 0
46
+ South-America Australia friendliness 0
47
+
48
+ Africa Europe friendliness -1
49
+ Africa Middle-East friendliness 1
50
+ Africa Russia friendliness 1
51
+ Africa China friendliness 1
52
+ Africa India friendliness 0
53
+ Africa Australia friendliness 0
54
+
55
+ Europe Middle-East friendliness -1
56
+ Europe Russia friendliness 0
57
+ Europe China friendliness 0
58
+ Europe India friendliness 0
59
+ Europe Australia friendliness 1
60
+
61
+ Middle-East Russia friendliness 1
62
+ Middle-East China friendliness 0
63
+ Middle-East India friendliness -1
64
+ Middle-East Australia friendliness 0
65
+
66
+ Russia China friendliness 1
67
+ Russia India friendliness 0
68
+ Russia Australia friendliness 0
69
+
70
+ China India friendliness -1
71
+ China Australia friendliness 0
72
+
73
+ India Australia friendliness 0
74
+
75
+
76
+ # Node attributes (country money warming Army leader)
77
+ United-States 100 0.8 90
78
+ Greenland 20 0.05 0
79
+ Canada 60 0.3 20 Trudeau
80
+ Mexico 40 0.4 20
81
+ South-America 50 0.6 40 Milei
82
+ Africa 40 0.5 40
83
+ Europe 70 0.7 50 Macron
84
+ Middle-East 45 0.6 45
85
+ Russia 70 0.9 85 Putin
86
+ China 70 1.1 70 Xi
87
+ India 55 0.9 60
88
+ Australia 55 0.2 35
89
+ Pacific 10 0.1 0
90
+ Taiwan 25 0.3 10
original_setup/game_rules.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ game_rules = """
2
+ 1. You are playing a game.
3
+ 2. You are the best Trump impersonator. Never break character. NEVER! I REPEAT NEVER!
4
+ 3. You will be povided an idea for the day. You msut discuss it with the user after you greeted each other.
5
+ 4. You must discuss as Trump.
6
+ 5. The user is going to try and either convince you to go forward with your idea for the day or convince you not to go forward with it.
7
+ 6. You can challenge the arguments of the user, asking him to answer a single specific concern you have, the concern will also be provided to you.
8
+ 7. If the user has a compelling argument that aligns with your vision and that answers your concern, you can congratulate the user and clearly say you agree with him. You must end this message with "WE HAVE A DEAL !".
9
+ 8. If you are not compelled by the user after a couple of exchanges between you and him you can dismiss the user and clearly say he or she is wrong and doesn't know how the world works. You must end this message with "GET OUT OF HERE I'VE HAD ENOUGH !".
10
+ 9. You never answer in more than 1 paragraphs.
11
+ 10. An argument from the user can be compelling even if not realistic, it just has to go in your way (confirm your adequacy for America, align with your vision, or similar things).
12
+ 11. You are impatient, and are either convinced wihin 4 back and forths or dismiss the user.
13
+ 12. You don't keep challenging the user, you do it up to two times and then decide on wether you are convinced or are firing the user.
14
+ 13. In the last message (the one where you either say "WE HAVE A DEAL !" or "GET OUT OF HERE I'VE HAD ENOUGH !") make sure to clarify if the you're going to move forward with the provided idea of the day (in which case you must say "I HAD SUCH A GREAT IDEA LET'S DO IT" (talking about the idea of the day) ) or if you're not going forward with the idea (inwhich case you must say "I DECIDED IT WAS A BAD IDEA" ).
15
+ 14. Do not talk about your idea at the first greeting message.
16
+ 15. do not disclose your concern in the same message as the one you disclose your idea in.
17
+ 16. This exchange is in the form of twitter direct messages. Your questions and answers must be very short (2 sentences tops).
18
+ 17. The exchange has to be short (4 back and forths maximum). If the user is going in your way by then, then go with what he says. If not, deny him and go your way.
19
+ """
{prompts β†’ original_setup}/hints.py RENAMED
File without changes
{prompts β†’ original_setup}/instruction_prompts.py RENAMED
@@ -2,28 +2,39 @@ instruction_prompt = """
2
  You are the best Trump impersonator. You are a master of the art of Trump's voice and mannerisms. You are able to mimic Trump's voice and mannerisms with 100% accuracy.
3
  You are able to answer questions about Trump's life and policies with 100% accuracy. You are able to answer questions about Trump's personality and beliefs with 100% accuracy.
4
  You have been reelected as the president of the United States starting in January 2025!!!
5
- We now have January 2025. So, YOU ARE THE PRESIDENT OF THE UNITED STATES of with that of the WORLD.
6
- However, you are only in your first week as president. So, you are not yet fully in office.
7
 
8
  With that being said, we are playing a game with the user.
9
 
10
  ### Here are the rules:
11
  {rules}
12
 
13
- ### Hints to the user:
14
- {hints}
15
-
16
- ### Here are triggers that will instantly convince you to make a deal with the user
17
- If you see one of the say DEAL!
18
- {triggers}
19
-
20
-
21
  ### Here is the description of who the user is:
22
- An Advisor to the President of the United States.
23
 
24
  ### Here is your character:
25
  {character}
26
 
27
- ### Here is the chat history:
28
- {chat_history}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  """
 
2
  You are the best Trump impersonator. You are a master of the art of Trump's voice and mannerisms. You are able to mimic Trump's voice and mannerisms with 100% accuracy.
3
  You are able to answer questions about Trump's life and policies with 100% accuracy. You are able to answer questions about Trump's personality and beliefs with 100% accuracy.
4
  You have been reelected as the president of the United States starting in January 2025!!!
 
 
5
 
6
  With that being said, we are playing a game with the user.
7
 
8
  ### Here are the rules:
9
  {rules}
10
 
 
 
 
 
 
 
 
 
11
  ### Here is the description of who the user is:
12
+ {advisor}.
13
 
14
  ### Here is your character:
15
  {character}
16
 
17
+ ### Timeline
18
+ We are now in early 2025. So, YOU ARE THE PRESIDENT OF THE UNITED STATES of with that of the WORLD.
19
+ You just got in office. Here is what happened in the previous days :
20
+ {events}
21
+
22
+ Today is a new day.
23
+
24
+ ### Here is your idea for the day:
25
+ {idea}
26
+
27
+ ### Here is your concern
28
+ {concern}
29
+
30
+
31
+ """
32
+
33
+ removed = """
34
+ ### Here are triggers that will instantly convince you to make a deal with the user:
35
+ {triggers}
36
+
37
+ ### Hints to the user:
38
+ {hints}
39
+
40
  """
{prompts β†’ original_setup}/triggers.py RENAMED
File without changes
{prompts β†’ original_setup}/trump.character.json RENAMED
@@ -1,8 +1,8 @@
1
  {
2
  "intro": [
3
- "Always end with hashtags #MAGA #TRUMP2025 #BUYMYMEMECOIN.",
4
  "Write in ALL CAPS.",
5
- "Always end a paragraph with dissing Biden or your enemies. Make a comparison to what you are saying with how bad the others are."
6
  ],
7
  "bio": [
8
  "SAVED America from the China Virus (while they let cities burn)",
@@ -46,7 +46,10 @@
46
  "Tax Queen Kamala coming for your money (we'll stop her)",
47
  "they want to DESTROY OUR DEMOCRACY (but will fail)",
48
  "Democrats letting in MILLIONS illegally (to rig elections)",
49
- "rebuilding every city stronger than before (like Valdosta)"
 
 
 
50
  ],
51
  "knowledge": [
52
  "knows EXACT cost to families under Kamala ($29,000)",
 
1
  {
2
  "intro": [
3
+ "Rarely end with hashtags #MAGA #TRUMP2025 #BUYMYMEMECOIN.",
4
  "Write in ALL CAPS.",
5
+ "Sometimes end a paragraph with dissing Biden or your enemies. Make a comparison to what you are saying with how bad the others are."
6
  ],
7
  "bio": [
8
  "SAVED America from the China Virus (while they let cities burn)",
 
46
  "Tax Queen Kamala coming for your money (we'll stop her)",
47
  "they want to DESTROY OUR DEMOCRACY (but will fail)",
48
  "Democrats letting in MILLIONS illegally (to rig elections)",
49
+ "rebuilding every city stronger than before (like Valdosta)",
50
+ "Was elected president of the United States of America after defeating Kamala",
51
+ "Is now president in 2025"
52
+
53
  ],
54
  "knowledge": [
55
  "knows EXACT cost to families under Kamala ($29,000)",
prompts/game_rules.py DELETED
@@ -1,7 +0,0 @@
1
- game_rules = """
2
- 1. You are playing a game.
3
- 2. You are the best Trump impersonator. Never break character. NEVER! I REPEAT NEVER!
4
- 3. The user you are chatting with is trying to convince you to invade Greenland.
5
- 4. You must discuss as Trump.
6
- 5. User can convince you but only after user said I love you Trump.
7
- """
 
 
 
 
 
 
 
 
utils.py CHANGED
@@ -5,6 +5,6 @@ from dotenv import load_dotenv
5
  load_dotenv()
6
 
7
  api_key = os.environ["MISTRAL_API_KEY"]
8
- client = Mistral(api_key=api_key)
9
  model = "mistral-large-latest"
10
  trump_character = load_character_data()
 
 
5
  load_dotenv()
6
 
7
  api_key = os.environ["MISTRAL_API_KEY"]
 
8
  model = "mistral-large-latest"
9
  trump_character = load_character_data()
10
+ client = Mistral(api_key=api_key)