Skip to content

Commit 7c80fb1

Browse files
committed
Allow heartbeat input
1 parent 117bd87 commit 7c80fb1

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

src/virtuals_sdk/game.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,13 +161,17 @@ def __init__(
161161
goal: str = "",
162162
description: str = "",
163163
world_info: str = "",
164+
main_heartbeat: int = 15,
165+
reaction_heartbeat: int = 5
164166
):
165167
self.game_sdk = sdk.GameSDK(api_key)
166168
self.goal = goal
167169
self.description = description
168170
self.world_info = world_info
169171
self.enabled_functions: List[str] = []
170172
self.custom_functions: List[Function] = []
173+
self.main_heartbeat = main_heartbeat
174+
self.reaction_heartbeat = reaction_heartbeat
171175

172176
def set_goal(self, goal: str):
173177
self.goal = goal
@@ -180,6 +184,14 @@ def set_description(self, description: str):
180184
def set_world_info(self, world_info: str):
181185
self.world_info = world_info
182186
return True
187+
188+
def set_main_heartbeat(self, main_heartbeat: int):
189+
self.main_heartbeat = main_heartbeat
190+
return True
191+
192+
def set_reaction_heartbeat(self, reaction_heartbeat: int):
193+
self.reaction_heartbeat = reaction_heartbeat
194+
return True
183195

184196
def get_goal(self) -> str:
185197
return self.goal
@@ -254,7 +266,9 @@ def deploy_twitter(self):
254266
self.description,
255267
self.world_info,
256268
self.enabled_functions,
257-
self.custom_functions
269+
self.custom_functions,
270+
self.main_heartbeat,
271+
self.reaction_heartbeat
258272
)
259273

260274
def export(self) -> str:

src/virtuals_sdk/sdk.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def react(self, session_id: str, platform: str, goal: str,
9090

9191
return response.json()["data"]
9292

93-
def deploy(self, goal: str, description: str, world_info: str, functions: list, custom_functions: list):
93+
def deploy(self, goal: str, description: str, world_info: str, functions: list, custom_functions: list, main_heartbeat: int, reaction_heartbeat: int):
9494
"""
9595
Simulate the agent configuration
9696
"""
@@ -102,7 +102,11 @@ def deploy(self, goal: str, description: str, world_info: str, functions: list,
102102
"description": description,
103103
"worldInfo": world_info,
104104
"functions": functions,
105-
"customFunctions": custom_functions
105+
"customFunctions": custom_functions,
106+
"gameState" : {
107+
"mainHeartbeat" : main_heartbeat,
108+
"reactionHeartbeat" : reaction_heartbeat,
109+
}
106110
}
107111
},
108112
headers={"x-api-key": self.api_key}

0 commit comments

Comments
 (0)