(
self,
*,
resource_text: str,
memory_types: list[MemoryType],
categories_prompt_str: str,
llm_client: Any | None = None,
)
| 509 | return entries |
| 510 | |
| 511 | async def _generate_entries_from_text( |
| 512 | self, |
| 513 | *, |
| 514 | resource_text: str, |
| 515 | memory_types: list[MemoryType], |
| 516 | categories_prompt_str: str, |
| 517 | llm_client: Any | None = None, |
| 518 | ) -> list[tuple[MemoryType, str, list[str]]]: |
| 519 | if not memory_types: |
| 520 | return [] |
| 521 | client = llm_client or self._get_llm_client() |
| 522 | prompts = [ |
| 523 | self._build_memory_type_prompt( |
| 524 | memory_type=mtype, |
| 525 | resource_text=resource_text, |
| 526 | categories_str=categories_prompt_str, |
| 527 | ) |
| 528 | for mtype in memory_types |
| 529 | ] |
| 530 | valid_prompts = [prompt for prompt in prompts if prompt.strip()] |
| 531 | # These prompts are instructions that request structured output, not text summaries. |
| 532 | tasks = [client.chat(prompt_text) for prompt_text in valid_prompts] |
| 533 | responses = await asyncio.gather(*tasks) |
| 534 | return self._parse_structured_entries(memory_types, responses) |
| 535 | |
| 536 | def _parse_structured_entries( |
| 537 | self, memory_types: list[MemoryType], responses: Sequence[str] |
no test coverage detected