DEDUPED Hot AI repos, turned into use cases Get 5 a day

How to add documents to a wiki from a Python script with LLM Wiki V2

Import the Wiki class and file text or files into a wiki from your own code.

  • Research
  • Intermediate
  • 45 minutes
  • From the README
  • Any agent

Who it is forA developer who has a data pipeline or script that produces documents and wants them filed into a wiki automatically.

The problemDocuments produced by a script end up in folders with no structure, and someone has to file them by hand.

The outcomeA Python script that files each document as a note and returns the result, including the tokens spent.

What you need first

  • 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

Steps

  1. Install the library with pip install llmwiki2 (Python 3.11 or later).
  2. In Python, run from llmw2 import Wiki, then wiki = Wiki.from_env(bundle="./wiki") and wiki.init().
  3. Set the OKF_* variables and your provider key, for example OPENROUTER_API_KEY, before creating the Wiki object.
  4. Call result = wiki.ingest(open("meeting.md").read(), title="Pricing meeting") for each document.
  5. Print result and open the note in ./wiki to check the filing. (inferred, check the README)

Prompt for your agent

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.

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.

Share: X LinkedIn Hacker News Email Copy link

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 [email protected] and we will look at it promptly. Full disclaimer page