← Blog

· Hive AI

Knolo for LangChain and LlamaIndex: Retrievers Over Verified Knowledge Images

Use the open-source Knolo retrievers for LangChain and LlamaIndex with a .knolo pack or a V5 Knowledge Image, and keep query roots in every result's metadata.

Knolo is the open-source, local-first Knowledge Image runtime and format (Apache-2.0, @knolo/core on npm). If your app already speaks LangChain or LlamaIndex, you don't have to rewrite retrieval to use Knolo: two small adapter packages give you a KnoLoRetriever that reads a local Knolo pack or a mounted V5 Knowledge Image and returns results in the shape those frameworks expect.

This post covers what the published packages do today, what changed on the Knolo core repository this week, and how to wire them up. The full reference is on the Knolo LangChain and LlamaIndex docs page.

Install the Knolo adapters

Both adapters are on npm at 6.2.0 and depend on @knolo/core ^6.0.0 (current @knolo/core is 6.2.3):

npm install @knolo/langchain @knolo/core
# or
npm install @knolo/llamaindex @knolo/core

Everything runs in your process. There is no service to call: the retriever mounts the file you point it at.

Knolo with LangChain: documents from a pack

import { KnoLoRetriever } from '@knolo/langchain';

const retriever = new KnoLoRetriever({
  packPath: './dist/knowledge.knolo',
  topK: 5,
});
const documents = await retriever.getRelevantDocuments('billing policy');

Each result is a Document with pageContent and metadata. For a classic .knolo pack, the metadata carries the Knolo score, source, namespace and block ID, using Knolo's deterministic V4 retrieval.

Knolo with LlamaIndex: the same retriever, retrieve()

import { KnoLoRetriever } from '@knolo/llamaindex';

const retriever = new KnoLoRetriever({
  packPath: './dist/knowledge.knolo',
  topK: 5,
});
const results = await retriever.retrieve('billing policy');

The LlamaIndex adapter returns nodes instead of documents, with the same Knolo metadata.

Point Knolo at a V5 Knowledge Image instead

Pass image (an already mounted image) or, in Node, imagePath instead of a pack:

const retriever = new KnoLoRetriever({
  imagePath: './dist/knowledge.v5',
  topK: 5,
});

The adapter mounts the image with mountKnowledgeImageV5 and runs a bounded V5 EQL search (FROM * SEARCH "…" LIMIT n, with topK clamped to 1–1000). Each result's metadata then includes:

  • the object ID and kind,
  • compatibility: 'knowledge-image-v5',
  • v5Query with the image state root, the query plan root and the query result root.

That is the useful part for agents and audits: the framework still sees ordinary documents, but every chunk it hands to a model can be traced back to an exact image state and an exact query, and anyone holding the same image can rerun the query and get the same roots. See Knolo roots and receipts for what those roots mean.

What changed this week: Knolo TypeScript declarations

TypeScript users had a real problem with the published 6.2.0 tarballs: each package shipped an empty src/index.ts, so strict NodeNext resolution picked it up and import { KnoLoRetriever } failed with TS2305.

Pull request #259, merged on 27 November, replaces those stubs with src/index.d.ts declarations for the existing APIs and wires them through each package's types field and export conditions. The declared metadata keeps numeric V4 block IDs separate from V5 object IDs, kinds and query roots, and the package tests now compile strict TypeScript consumers against the public package names.

The fix is on the main branch and is not in an npm release yet: @knolo/langchain and @knolo/llamaindex on npm are still 6.2.0. Plain JavaScript and ESM users are unaffected. Watch the Knolo versions page for the next release.

Scope of the Knolo adapters

The adapters are deliberately thin. They retrieve; they don't implement Knolo composition or Cortex, and they don't verify, migrate or manage images. Use @knolo/core (@knolo/core/composition, @knolo/core/cortex) and @knolo/cli for those.

Links

Knolo is built by Hive AI and released under Apache-2.0.

knolo · langchain · llamaindex · knowledge-images · npm · typescript