EverAlgo knowledge: file-based knowledge extractors producing KnowledgeMemory.
Project description
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
# This package is NOT published to PyPI (Private :: Do Not Upload classifier).
# Install within the workspace only:
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
Related distributions
everalgo-parser— producesParsedContentfrom raw files (fully implemented except video, which is deferred pending ADR)everalgo-core—KnowledgeMemorytype is defined here
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file everalgo_knowledge-0.1.1.tar.gz.
File metadata
- Download URL: everalgo_knowledge-0.1.1.tar.gz
- Upload date:
- Size: 50.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
64bcf2c88a4507a3bf704d7c7813956ede55a4575cf63424786f1fa65f4b3200
|
|
| MD5 |
6a7b03d1b8afd817933aee4cf62f72b3
|
|
| BLAKE2b-256 |
0a4fe18401ef276536bce0f30dca8dd358450f5eb38cb8fee7a85e6d7d80bc0a
|
File details
Details for the file everalgo_knowledge-0.1.1-py3-none-any.whl.
File metadata
- Download URL: everalgo_knowledge-0.1.1-py3-none-any.whl
- Upload date:
- Size: 34.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6aa6fc70a65e75f380e4997dc58b69d8f5da7effcf5c4fbcdebd7fe58ca01a36
|
|
| MD5 |
01b5eee08bec6e4a3fcaaa080238cdb8
|
|
| BLAKE2b-256 |
0a8d3f860b72987f2028facf51733e8e3d85d722808136ea3dd1314bf462b7bd
|