1- from abc import abstractmethod
2-
31import openai
42
53from trinity .common .experience import Experience
@@ -45,7 +43,6 @@ def run(self) -> list[Experience]:
4543
4644 return experiences
4745
48- @abstractmethod
4946 def step (self , step_num : int ) -> bool :
5047 """Run a single step of your agent application.
5148
@@ -59,17 +56,16 @@ def step(self, step_num: int) -> bool:
5956 You can use the openai client (`self.client`) to migrate your existing
6057 applications at low cost.
6158 """
62- pass
59+ raise NotImplementedError
6360
64- @abstractmethod
6561 def reward (self , exps : list [Experience ], step_num : int ) -> float :
6662 """Calculate the reward for the given experiences at the specified step."""
67- pass
63+ raise NotImplementedError
6864
6965 @property
70- @abstractmethod
7166 def max_step_num (self ):
7267 """Return the maximum number of steps in the task."""
68+ raise NotImplementedError
7369
7470 @property
7571 def repeatable (self ):
@@ -104,7 +100,6 @@ async def run_async(self) -> list[Experience]:
104100
105101 return experiences
106102
107- @abstractmethod
108103 async def step_async (self , step_num : int ) -> bool :
109104 """Run a single step of your agent application asynchronously.
110105
@@ -118,12 +113,11 @@ async def step_async(self, step_num: int) -> bool:
118113 You can use the openai client (`self.client`) to migrate your existing
119114 applications at low cost.
120115 """
121- pass
116+ raise NotImplementedError
122117
123- @abstractmethod
124118 async def reward_async (self , exps : list [Experience ], step_num : int ) -> float :
125119 """Calculate the reward for the given experiences at the specified step asynchronously."""
126- pass
120+ raise NotImplementedError
127121
128122
129123class RewardPropagationWorkflow (Workflow ):
@@ -166,7 +160,6 @@ def run(self) -> list[Experience]:
166160 exp .metrics ["actual_env_steps" ] = step + 1 # +1 because step starts from 0
167161 return experiences
168162
169- @abstractmethod
170163 def step (self , step_num : int ) -> bool :
171164 """Run a single step of your agent application.
172165
@@ -180,17 +173,16 @@ def step(self, step_num: int) -> bool:
180173 You can use the openai client (`self.client`) to migrate your existing
181174 applications at low cost.
182175 """
183- pass
176+ raise NotImplementedError
184177
185- @abstractmethod
186178 def reward (self , exps : list [Experience ]) -> float :
187179 """Calculate the reward for the given experiences of the entire run."""
188- pass
180+ raise NotImplementedError
189181
190182 @property
191- @abstractmethod
192183 def max_step_num (self ):
193184 """Return the maximum number of steps in the task."""
185+ raise NotImplementedError
194186
195187 @property
196188 def repeatable (self ):
@@ -227,7 +219,6 @@ async def run_async(self) -> list[Experience]:
227219 exp .metrics ["actual_env_steps" ] = step + 1 # +1 because step starts from 0
228220 return experiences
229221
230- @abstractmethod
231222 async def step_async (self , step_num : int ) -> bool :
232223 """Run a single step of your agent application asynchronously.
233224
@@ -241,9 +232,8 @@ async def step_async(self, step_num: int) -> bool:
241232 You can use the openai client (`self.client`) to migrate your existing
242233 applications at low cost.
243234 """
244- pass
235+ raise NotImplementedError
245236
246- @abstractmethod
247237 async def reward_async (self , exps : list [Experience ]) -> float :
248238 """Calculate the reward for the given experiences of the entire run asynchronously."""
249- pass
239+ raise NotImplementedError
0 commit comments