(concept: dict)
| 1809 | semaphore = asyncio.Semaphore(max_concurrency) |
| 1810 | |
| 1811 | async def _gen_create(concept: dict) -> tuple[str, str, bool, str]: |
| 1812 | name = concept["name"] |
| 1813 | title = concept.get("title", name) |
| 1814 | async with semaphore: |
| 1815 | raw = await _llm_call_page_async( |
| 1816 | model, |
| 1817 | [ |
| 1818 | system_msg, |
| 1819 | doc_msg, # cached (BP1) |
| 1820 | summary_msg, # cached (BP2) |
| 1821 | known_targets_msg, # cached (BP3) — whitelist |
| 1822 | { |
| 1823 | "role": "user", |
| 1824 | "content": _CONCEPT_PAGE_USER.format( |
| 1825 | title=title, |
| 1826 | doc_name=doc_name, |
| 1827 | update_instruction="", |
| 1828 | ), |
| 1829 | }, |
| 1830 | ], |
| 1831 | f"concept: {name}", |
| 1832 | response_format=_JSON_RESPONSE_FORMAT, |
| 1833 | ) |
| 1834 | brief, content, _ = _page_fields(raw) |
| 1835 | _require_nonempty_content(content, name) |
| 1836 | return name, content, False, brief |
| 1837 | |
| 1838 | async def _gen_update(concept: dict) -> tuple[str, str, bool, str]: |
| 1839 | name = concept["name"] |
no test coverage detected