{
 "schema_version": 1,
 "generated": "2026-10-20",
 "id": "crow-hq-llm-wiki-v2--file-documents-from-python-code",
 "repo": "crow-hq/llm-wiki-v2",
 "repo_url": "https://github.com/crow-hq/llm-wiki-v2",
 "repo_slug": "crow-hq-llm-wiki-v2",
 "title": "Add documents to a wiki from a Python script",
 "page_title": "How to add documents to a wiki from a Python script with LLM Wiki V2",
 "summary": "Import the Wiki class and file text or files into a wiki from your own code.",
 "who": "A developer who has a data pipeline or script that produces documents and wants them filed into a wiki automatically.",
 "problem": "Documents produced by a script end up in folders with no structure, and someone has to file them by hand.",
 "outcome": "A Python script that files each document as a note and returns the result, including the tokens spent.",
 "steps": [
  "Install the library with `pip install llmwiki2` (Python 3.11 or later).",
  "In Python, run `from llmw2 import Wiki`, then `wiki = Wiki.from_env(bundle=\"./wiki\")` and `wiki.init()`.",
  "Set the OKF_* variables and your provider key, for example OPENROUTER_API_KEY, before creating the Wiki object.",
  "Call `result = wiki.ingest(open(\"meeting.md\").read(), title=\"Pricing meeting\")` for each document.",
  "Print `result` and open the note in ./wiki to check the filing. (inferred, check the README)"
 ],
 "agent_prompt": "Write a Python script that imports Wiki from llmw2, points it at ./wiki, and calls ingest on each file in <folder>. Expected output: one result per file with the note and token usage. Verify that each returned note appears as a Markdown file under ./wiki.",
 "agents": [
  "any"
 ],
 "difficulty": "Intermediate",
 "time": "45 minutes",
 "basis": "readme",
 "caveat": "The README documents the ingest call and Wiki.from_env, but this script's exact return fields should be checked against the library guide before you rely on them.",
 "category": "Research",
 "tags": [
  "Research"
 ],
 "lang": "python",
 "requirements": [
  "Python 3.11 or later, or uv to install it",
  "An API key for OpenRouter, OpenAI, Gemini or another OpenAI-compatible server, or Ollama installed for free local use",
  "Documents as text, Markdown, PDF, Word, PowerPoint, Excel or OpenDocument files"
 ],
 "risk": "none",
 "seen_in_the_wild": false,
 "mentioned_publicly": false,
 "risks": [],
 "best": false,
 "score": 0.7,
 "evidence": [],
 "url": "https://dedupedai.com/use-cases/crow-hq-llm-wiki-v2/file-documents-from-python-code/",
 "md": "https://dedupedai.com/use-cases/crow-hq-llm-wiki-v2/file-documents-from-python-code/index.md",
 "disclaimer": "Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked \"Seen in the wild\", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email hello@dedupedai.com and we will look at it promptly.",
 "api": "https://dedupedai.com/api/v1/usecases/crow-hq-llm-wiki-v2--file-documents-from-python-code.json",
 "api_version": "v1"
}
