Skip to main content

everalgo-knowledge

Extracts a flattened topic tree (list[KnowledgeMemory]) from parsed content (ParsedContent) via LLM.

Use

from everalgo.knowledge import KnowledgeExtractor
from everalgo.types import ParsedContent

parsed = ParsedContent(text="...", mime="text/markdown")
memories = await KnowledgeExtractor(llm=client).aextract(parsed, doc_id="doc1", title="My doc")
# memories[0] = synthetic doc root; rest = DFS-ordered topic nodes.

llm: any everalgo.llm.LLMClient (OpenAI-compatible), passed at construction. Sync bridge: extract(...).

Pipeline at a glance

ParsedContent
  → preprocess + atomize           (_block_split)
  → topic-tree LLM (per batch)     (TOPIC_TREE_EXTRACT_PROMPT_EN)
  → cross-batch merge (>1 batch)   (CONTENT_MERGE + TOPIC_MERGE)
  → postprocess: split unsplit leaves + assign uncovered blocks
  → tree assembly + DFS flatten    → list[KnowledgeMemory]

Install

pip install everalgo-knowledge    # pulls everalgo-core + everalgo-parser

For development within the monorepo workspace:

uv sync --package everalgo-knowledge

Live-LLM scripts

Run from the repository root. Put LLM_API_KEY, LLM_BASE_URL, LLM_MODEL in a .env file there first; each command block below sources it inline and is paste-and-run.

Smoke test — 2 fixtures, structural assertions only, no artifacts written:

set -a; source .env; set +a
uv run pytest -m integration packages/everalgo-knowledge/tests/functional/test_extraction_smoke.py

Run one doc — dumps result (JSON + optional HTML viz) under tests/functional/outputs/:

set -a; source .env; set +a
uv run python packages/everalgo-knowledge/examples/run_one_doc.py \
  packages/everalgo-knowledge/tests/functional/fixtures/idx_multi_topic.json --html
  • everalgo-parser — produces ParsedContent from raw files (fully implemented except video, which is deferred pending ADR)
  • everalgo-core — KnowledgeMemory type is defined here

Metadata

Release files for everalgo-knowledge 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for everalgo-knowledge 0.2.0
File Size Uploaded
everalgo_knowledge-0.2.0.tar.gz 56.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for everalgo-knowledge 0.2.0
File Interpreter ABI Platform
everalgo_knowledge-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 93.8 kB

Release files / everalgo_knowledge-0.2.0.tar.gz

Download URL everalgo_knowledge-0.2.0.tar.gz
Size 56.9 kB
Tags Source
SHA-256 checksum
How to use checksums
6e920f9bed51fd35e028816f66956fbf3f4460189f67924329cfd2edb9983d86
BLAKE2b-256 checksum
How to use checksums
463a01f3d8c5f63956c02ceffcc4467fc65ccf85b3cc45e186b5e587fcc46b25
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.12.12

Release files / everalgo_knowledge-0.2.0-py3-none-any.whl

Download URL everalgo_knowledge-0.2.0-py3-none-any.whl
Size 36.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
42c0b6c35e57cdd02b8b326e290f33abf1c7534f05ec76b4f852e05e1e791716
BLAKE2b-256 checksum
How to use checksums
0b8ee0f11f05b2c1f8a6b14f868a430a02cbd6d81578f4a152e88b137708120b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.12.12

Release history Release notifications | RSS feed

0.2.1

2 release files

This release

0.2.0 This release

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page