Skip to content

Commit

Permalink
Merge pull request #1 from m1ckc3b/multi-query-retriever
Browse files Browse the repository at this point in the history
implements multiQueryRetriever
  • Loading branch information
m1ckc3b authored Apr 23, 2024
2 parents f5b019a + 9ecf0be commit 00f55f5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/api/src/llm/supabase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { createClient } from "@supabase/supabase-js";
import { PDFLoader } from "langchain/document_loaders/fs/pdf";
import { RecursiveCharacterTextSplitter } from "langchain/text_splitter";
import type { Document } from "langchain/document";
import { MultiQueryRetriever } from "langchain/retrievers/multi_query";
import { model } from "./model";

if (!process.env.SUPABASE_API_KEY) throw new Error(`Expected SUPABASE_API_KEY`);
const supabaseKey = process.env.SUPABASE_API_KEY;
Expand All @@ -19,7 +21,11 @@ const vectorStore = new SupabaseVectorStore(new OpenAIEmbeddings(), {
queryName: "match_documents",
});

export const retriever = vectorStore.asRetriever();
export const retriever = MultiQueryRetriever.fromLLM({
llm: model,
retriever: vectorStore.asRetriever(),
verbose: true
})

/**
* Adding docs to a Supabase Vector store from a PDF file
Expand Down

0 comments on commit 00f55f5

Please sign in to comment.