Generate a list of experiences from a list of prompts in async.
(self, prompts: List[str], **kwargs)
| 512 | |
| 513 | @_history_recorder |
| 514 | async def generate_async(self, prompts: List[str], **kwargs) -> List[Experience]: |
| 515 | """Generate a list of experiences from a list of prompts in async.""" |
| 516 | lora_request = await self.get_lora_request_async() |
| 517 | results = await asyncio.gather( |
| 518 | *[self.model.generate.remote(prompt, lora_request, **kwargs) for prompt in prompts] |
| 519 | ) |
| 520 | return [exp for exps in results for exp in exps] |
| 521 | |
| 522 | @_history_recorder |
| 523 | def chat(self, messages: List[dict], **kwargs) -> List[Experience]: |