Run the semantic knowledge lint agent against the wiki. Args: kb_dir: Root of the knowledge base. model: LLM model name. Returns: The agent's lint report as a Markdown string.
(kb_dir: Path, model: str)
| 90 | |
| 91 | |
| 92 | async def run_knowledge_lint(kb_dir: Path, model: str) -> str: |
| 93 | """Run the semantic knowledge lint agent against the wiki. |
| 94 | |
| 95 | Args: |
| 96 | kb_dir: Root of the knowledge base. |
| 97 | model: LLM model name. |
| 98 | |
| 99 | Returns: |
| 100 | The agent's lint report as a Markdown string. |
| 101 | """ |
| 102 | from openkb.config import load_config |
| 103 | |
| 104 | openkb_dir = kb_dir / ".openkb" |
| 105 | config = load_config(openkb_dir / "config.yaml") |
| 106 | language: str = config.get("language", "en") |
| 107 | |
| 108 | wiki_root = str(kb_dir / "wiki") |
| 109 | agent = build_lint_agent(wiki_root, model, language=language) |
| 110 | |
| 111 | prompt = ( |
| 112 | "Please audit this knowledge base wiki for semantic quality issues: " |
| 113 | "contradictions, gaps, staleness, redundancy, and missing concept and " |
| 114 | "entity pages. Start with index.md, then read summaries, concepts, and " |
| 115 | "entities as needed. Produce a structured Markdown report." |
| 116 | ) |
| 117 | |
| 118 | result = await Runner.run(agent, prompt, max_turns=MAX_TURNS) |
| 119 | return result.final_output or "Knowledge lint completed. No output produced." |