Skip to main content

Function: createTestPipeline()

function createTestPipeline(options?): Promise<{
embedder: any;
llm: any;
pipeline: any;
retriever: MemoryRetriever;
}>;

A pipeline with HashEmbedder, a MemoryRetriever already holding documents, and EchoLLM (or the llm you pass).

Parameters​

ParameterTypeDescription
options?{ documents?: object[]; embedder?: any; llm?: any; pipeline?: any; }-
options.documents?object[]-
options.embedder?anyDefaults to a new HashEmbedder
options.llm?anyDefaults to a new EchoLLM; null for retrieval only
options.pipeline?anyExtra createRagPipeline options (e.g. reranker)

Returns​

Promise<{ embedder: any; llm: any; pipeline: any; retriever: MemoryRetriever; }>

Example​

const { createTestPipeline } = require("@devilsdev/rag-pipeline-utils/testing");
const { pipeline, llm } = await createTestPipeline();
const result = await pipeline.run({ query: "How many vacation days?" });
// result.results[0].id === 'vacation'; llm.calls.length === 1