import { OpenAIEmbeddings } from "langchain/embeddings/openai"; import { createClient } from "@supabase/supabase-js"; import { SupabaseHybridSearch } from "langchain/retrievers/supabase"; export const run = async () => { const client = createClient( process.env.SUPABASE_URL || "", process.env.SUPABASE_PRIVATE_KEY || "" ); const embeddings = new OpenAIEmbeddings(); const retriever = new SupabaseHybridSearch(embeddings, { client, // Below are the defaults, expecting that you set up your supabase table and functions according to the guide above. Please change if necessary. similarityK: 2, keywordK: 2, tableName: "documents", similarityQueryName: "match_documents", keywordQueryName: "kw_match_documents", }); const results = await retriever.getRelevantDocuments("hello bye"); console.log(results); };