Skip to main content

vruksha

vruksha turns a litesearch store into a typed knowledge graph. It extracts entities and typed relations from each chunk with a model you pass in, primes the model with the entities already in the graph so it reuses them, merges the duplicates that slip through behind a lexical guard, and searches by walking refers_to/cites/builds_on edges fused with hybrid.

It is model-agnostic: you inject chat (any object with .oneshot(prompt, sp=, max_tokens=)) and emb_fn. rishi, urai, an API client, anything. vruksha names no model and owns litesearch’s entity/mention/edge tables.

from litesearch import database
from vruksha import build_graph          # extract + prime + write + embed + merge, incremental

db = database('corpus.db')               # a litesearch store with a tree
build_graph(db, chat=my_chat, emb_fn=my_encoder)   # a local model does the extraction
db.graph_search('how does resolution work', qemb)  # hybrid + a typed-edge walk

The lexical guard

Priming stops most duplicates; resolve_entities merges the rest. Embedding similarity alone merges python 3.11 into python 3.12, so every merge passes _lex_ok first: token overlap or a matching acronym or, for a one-word name, the same romanisation key (Bhīṣma, Bheeshma, भीष्म), and identical numbers.

from vruksha.entities import _lex_ok
_lex_ok('multi-head attention', 'multi head attention'), _lex_ok('python 3.11', 'python 3.12')

A per-corpus citation seed

The model catches loose references. Structured ones (an EU directive’s Article 5, Annex III) are cheaper caught by a regex, so a legal corpus can pass seed_fn=cites, canon=norm_cite. It is optional and off by default: nothing but a citation-dense corpus needs it.

What it is worth

On cross-reference bridges (the query shares no word with the answer), the typed leg reaches the target 0.61 to 0.87 of the time against 0.08 to 0.20 for hybrid, tracking the extractor: a local Qwen3-4B matches a frontier model, a 1.5B needs the seed. The PMI co-occurrence graph this package used to build reached none of them; the method and numbers are in litesearch evals/RESULTS.md.

Install

pip install vruksha

Metadata

Release files for vruksha 0.1.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 vruksha 0.1.1
File Size Uploaded
vruksha-0.1.1.tar.gz 13.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for vruksha 0.1.1
File Interpreter ABI Platform
vruksha-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 27.0 kB

Release files / vruksha-0.1.1.tar.gz

Download URL vruksha-0.1.1.tar.gz
Size 13.0 kB
Tags Source
SHA-256 checksum
How to use checksums
93db35e13f597a2046c3150d49b4de038bcd57c2971c5f254160a3c587b1db29
BLAKE2b-256 checksum
How to use checksums
3bb3225dcc507f7cc0b341474aa539accb602152ca9cf2251d4f9f1dbbb83524
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.1

Release files / vruksha-0.1.1-py3-none-any.whl

Download URL vruksha-0.1.1-py3-none-any.whl
Size 14.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ba343a944d85f92dd911379fa133c7e1aaf9bf1c18b2ad361da7b24447ae0b78
BLAKE2b-256 checksum
How to use checksums
b0ad29b21e921cb1f6d06c7161ed0a7a0730ed1305f3ee2cab17e94b266f955b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.1

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

0.0.2

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