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.1

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.1
File Size Uploaded
everalgo_knowledge-0.2.1.tar.gz 57.3 kB Details

Built distribution (wheel)

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

Total release size: 94.0 kB

Release files / everalgo_knowledge-0.2.1.tar.gz

Download URL everalgo_knowledge-0.2.1.tar.gz
Size 57.3 kB
Tags Source
SHA-256 checksum
How to use checksums
77a7051edefbe889b971c3fa8c77d133ab43c2a6e322a43d32df0cd8562b0741
BLAKE2b-256 checksum
How to use checksums
752f46d8b7508578e7a4fc48d556b0e480c9ae99b51f20692cdb64a56bae766c
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.1-py3-none-any.whl

Download URL everalgo_knowledge-0.2.1-py3-none-any.whl
Size 36.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b94474404c14d2ed86fd18f13f10b42e733753b337ef3c71fc2d6a6b6a37aaf4
BLAKE2b-256 checksum
How to use checksums
422722d47843135cd93f0cfee7602f546e103def16cbd0ceb6a3863f8ad69190
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

This release

0.2.1 This release

2 release files

0.2.0

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