@tensflare/llamaindex

Installation

npm install @tensflare/llamaindex

Overview

LlamaIndex middleware wraps query engines and retrievers to record their operations as Truss actions with SHA-256 hashed inputs and outputs.

API

TrussLlamaIndexMiddleware

import { TrussLlamaIndexMiddleware } from "@tensflare/llamaindex";

const truss = new TrussLlamaIndexMiddleware({
  apiUrl: "...",
  apiKey: "...",
  mandateId: "...",
});

const wrapped = truss.wrapQueryEngine(myQueryEngine);

wrapQueryEngine(engine)

Wraps a query engine, recording a llamaindex_query action type on each query.

wrapRetriever(retriever)

Wraps a retriever, recording a llamaindex_retrieve action type on each retrieval.

Key Features

  • Records llamaindex_query and llamaindex_retrieve action types
  • SHA-256 hashing of query inputs and results
  • Separate wrapping for engines and retrievers
  • Preserves original interface for drop-in replacement