Skip to content

Commit b45a844

Browse files
committed
fix format
1 parent 3a8bfca commit b45a844

File tree

3 files changed

+52
-21
lines changed

3 files changed

+52
-21
lines changed

examples/experiment_misinformation/twitter_simulation_misinfo_oai.py

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,56 +63,72 @@ async def main():
6363
action=ActionType.CREATE_POST,
6464
args={
6565
"content":
66-
"Amazon is expanding its delivery drone program to deliver packages within 30 minutes in select cities. This initiative aims to improve efficiency and reduce delivery times."
66+
("Amazon is expanding its delivery drone program to deliver "
67+
"packages within 30 minutes in select cities. This initiative "
68+
"aims to improve efficiency and reduce delivery times.")
6769
})
6870
business_action_misinfo = SingleAction(
6971
agent_id=0,
7072
action=ActionType.CREATE_POST,
7173
args={
7274
"content":
73-
"Amazon plans to completely eliminate its delivery drivers within two years due to the new drone program. #Automation #Future"
75+
("Amazon plans to completely eliminate its delivery drivers "
76+
"within two years due to the new drone program. "
77+
"#Automation #Future")
7478
})
7579
education_action_truth = SingleAction(
7680
agent_id=0,
7781
action=ActionType.CREATE_POST,
7882
args={
7983
"content":
80-
"Harvard University has announced a new scholarship program that will cover full tuition for all undergraduate students from families earning less than $75,000 per year."
84+
("Harvard University has announced a new scholarship program "
85+
"that will cover full tuition for all undergraduate students "
86+
"from families earning less than $75,000 per year.")
8187
})
8288
education_action_misinfo = SingleAction(
8389
agent_id=0,
8490
action=ActionType.CREATE_POST,
8591
args={
8692
"content":
87-
"Harvard is raising tuition fees for all students despite the new scholarship program, making it harder for families to afford education. #EducationCrisis"
93+
("Harvard is raising tuition fees for all students despite the "
94+
"new scholarship program, making it harder for families to "
95+
"afford education. #EducationCrisis")
8896
})
8997
entertainment_action_truth = SingleAction(
9098
agent_id=0,
9199
action=ActionType.CREATE_POST,
92100
args={
93101
"content":
94-
"The latest Marvel movie, Avengers: Forever, has officially broken box office records, earning over $1 billion in its opening weekend."
102+
("The latest Marvel movie, Avengers: Forever, has officially "
103+
"broken box office records, earning over $1 billion in its "
104+
"opening weekend.")
95105
})
96106
entertainment_action_misinfo = SingleAction(
97107
agent_id=0,
98108
action=ActionType.CREATE_POST,
99109
args={
100110
"content":
101-
"Marvel is planning to retire the Avengers franchise after this film, saying it will not produce any more superhero movies. #EndOfAnEra"
111+
("Marvel is planning to retire the Avengers franchise after "
112+
"this film, saying it will not produce any more superhero "
113+
"movies. #EndOfAnEra")
102114
})
103115
health_action_truth = SingleAction(
104116
agent_id=0,
105117
action=ActionType.CREATE_POST,
106118
args={
107119
"content":
108-
"A recent study shows that regular exercise can significantly reduce the risk of chronic diseases such as diabetes and heart disease."
120+
("A recent study shows that regular exercise can significantly "
121+
"reduce the risk of chronic diseases such as diabetes and "
122+
"heart disease.")
109123
})
110124
health_action_misinfo = SingleAction(
111125
agent_id=0,
112126
action=ActionType.CREATE_POST,
113127
args={
114128
"content":
115-
"Health experts claim that exercise will be deemed unnecessary in five years as new treatments will eliminate chronic diseases entirely. #HealthRevolution"
129+
("Health experts claim that exercise will be deemed unnecessary "
130+
"in five years as new treatments will eliminate chronic "
131+
"diseases entirely. #HealthRevolution")
116132
})
117133

118134
init_env_action = EnvAction(
@@ -127,7 +143,7 @@ async def main():
127143
env_simulation_actions = [init_env_action]
128144
# Simulate 60 timesteps
129145
for timestep in range(60):
130-
# Randomly select 10% of agents to activate. This is the active probability in the paper.
146+
# Randomly select 10% of agents to activate
131147
total_agents = env.agent_graph.get_num_nodes()
132148
num_agents_to_activate = max(1, int(
133149
total_agents * 0.1)) # Ensure at least 1 agent is activated

examples/experiment_misinformation/twitter_simulation_misinfo_vllm.py

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import random
1717

1818
from camel.models import ModelFactory
19-
from camel.types import ModelPlatformType, ModelType
19+
from camel.types import ModelPlatformType
2020

2121
import oasis
2222
from oasis import ActionType, EnvAction, SingleAction
@@ -42,7 +42,6 @@ async def main():
4242
ActionType.DO_NOTHING,
4343
]
4444

45-
4645
# Define the path to the database
4746
db_path = "./data/twitter_simulation.db"
4847

@@ -68,56 +67,72 @@ async def main():
6867
action=ActionType.CREATE_POST,
6968
args={
7069
"content":
71-
"Amazon is expanding its delivery drone program to deliver packages within 30 minutes in select cities. This initiative aims to improve efficiency and reduce delivery times."
70+
("Amazon is expanding its delivery drone program to deliver "
71+
"packages within 30 minutes in select cities. This initiative "
72+
"aims to improve efficiency and reduce delivery times.")
7273
})
7374
business_action_misinfo = SingleAction(
7475
agent_id=0,
7576
action=ActionType.CREATE_POST,
7677
args={
7778
"content":
78-
"Amazon plans to completely eliminate its delivery drivers within two years due to the new drone program. #Automation #Future"
79+
("Amazon plans to completely eliminate its delivery drivers "
80+
"within two years due to the new drone program. "
81+
"#Automation #Future")
7982
})
8083
education_action_truth = SingleAction(
8184
agent_id=0,
8285
action=ActionType.CREATE_POST,
8386
args={
8487
"content":
85-
"Harvard University has announced a new scholarship program that will cover full tuition for all undergraduate students from families earning less than $75,000 per year."
88+
("Harvard University has announced a new scholarship program "
89+
"that will cover full tuition for all undergraduate students "
90+
"from families earning less than $75,000 per year.")
8691
})
8792
education_action_misinfo = SingleAction(
8893
agent_id=0,
8994
action=ActionType.CREATE_POST,
9095
args={
9196
"content":
92-
"Harvard is raising tuition fees for all students despite the new scholarship program, making it harder for families to afford education. #EducationCrisis"
97+
("Harvard is raising tuition fees for all students despite the "
98+
"new scholarship program, making it harder for families to "
99+
"afford education. #EducationCrisis")
93100
})
94101
entertainment_action_truth = SingleAction(
95102
agent_id=0,
96103
action=ActionType.CREATE_POST,
97104
args={
98105
"content":
99-
"The latest Marvel movie, Avengers: Forever, has officially broken box office records, earning over $1 billion in its opening weekend."
106+
("The latest Marvel movie, Avengers: Forever, has officially "
107+
"broken box office records, earning over $1 billion in its "
108+
"opening weekend.")
100109
})
101110
entertainment_action_misinfo = SingleAction(
102111
agent_id=0,
103112
action=ActionType.CREATE_POST,
104113
args={
105114
"content":
106-
"Marvel is planning to retire the Avengers franchise after this film, saying it will not produce any more superhero movies. #EndOfAnEra"
115+
("Marvel is planning to retire the Avengers franchise after "
116+
"this film, saying it will not produce any more superhero "
117+
"movies. #EndOfAnEra")
107118
})
108119
health_action_truth = SingleAction(
109120
agent_id=0,
110121
action=ActionType.CREATE_POST,
111122
args={
112123
"content":
113-
"A recent study shows that regular exercise can significantly reduce the risk of chronic diseases such as diabetes and heart disease."
124+
("A recent study shows that regular exercise can significantly "
125+
"reduce the risk of chronic diseases such as diabetes and "
126+
"heart disease.")
114127
})
115128
health_action_misinfo = SingleAction(
116129
agent_id=0,
117130
action=ActionType.CREATE_POST,
118131
args={
119132
"content":
120-
"Health experts claim that exercise will be deemed unnecessary in five years as new treatments will eliminate chronic diseases entirely. #HealthRevolution"
133+
("Health experts claim that exercise will be deemed unnecessary "
134+
"in five years as new treatments will eliminate chronic "
135+
"diseases entirely. #HealthRevolution")
121136
})
122137

123138
init_env_action = EnvAction(
@@ -132,7 +147,7 @@ async def main():
132147
env_simulation_actions = [init_env_action]
133148
# Simulate 60 timesteps
134149
for timestep in range(60):
135-
# Randomly select 10% of agents to activate. This is the active probability in the paper.
150+
# Randomly select 10% of agents to activate
136151
total_agents = env.agent_graph.get_num_nodes()
137152
num_agents_to_activate = max(1, int(
138153
total_agents * 0.1)) # Ensure at least 1 agent is activated

oasis/environment/env.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,4 +214,4 @@ async def close(self) -> None:
214214
await self.platform_task
215215
env_log.info("Simulation finished! Please check the results in the "
216216
f"database: {self.platform.db_path}. Note that the trace "
217-
"table stored all the actions of the agents.")
217+
"table stored all the actions of the agents.")

0 commit comments

Comments
 (0)