MCPcopy Create free account
hub / github.com/agentscope-ai/Trinity-RFT / run

Method run

trinity/common/workflows/workflow.py:299–321  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

297 can_repeat: bool = True
298
299 def run(self) -> List[Experience]:
300 # TODO: Optimize the generate function
301 messages = self.format_messages()
302
303 self.logger.debug("start chat")
304 responses = self.model.chat(messages, **self.rollout_args)
305 for i, response in enumerate(responses):
306 reward_dict = self.reward_fn( # type: ignore [misc]
307 response=response.response_text, # type: ignore [arg-type]
308 truth=self.truth,
309 )
310
311 if response.metrics is None:
312 response.metrics = {}
313 response.metrics.update(reward_dict)
314 reward = sum(reward_dict.values())
315 response.reward = reward
316 response.eid.run = i + self.run_id_base
317
318 self.logger.debug(
319 f"self.task_desc: {self.task_desc}, messages: {messages}, response: {response.response_text}, reward: {reward}"
320 )
321 return responses
322
323
324class AsyncSimpleWorkflow(BaseSimpleWorkflow):

Callers

nothing calls this directly

Calls 5

debugMethod · 0.80
reward_fnMethod · 0.80
format_messagesMethod · 0.45
chatMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected