S
Supabase2y ago
Art

Cannot get SupabaseVectorStore to recognize 'client'

//supabase setup, properly implemented
const supabaseUrl = 'https://[].supabase.co';
const supabaseKey = import.meta.env.VITE_SUPABASE_PRIVATE_KEY;
const supabaseClient = createClient(supabaseUrl, supabaseKey);


const splitting = async function(){

if (!supabaseClient) { //check to see if supabaseClient is undefined
console.log('supabaseClient is undefined');
return;
}
const splitter = new RecursiveCharacterTextSplitter({
chunkSize: 1000,
chunkOverlap: 200,
});

const output = await splitter.createDocuments([pdfText]);
console.log(supabaseClient) //also a check to see if supabaseClient exists
const vectorStore = await SupabaseVectorStore.fromTexts(
output,
new OpenAIEmbeddings({openAIApiKey: `${import.meta.env.VITE_OPENAI_API_KEY}`}),
{
client: supabaseClient,
tableName: "documents",
queryName: "match_documents",
}
);
console.log(supabaseClient) //another check
const resultOne = await vectorStore.similaritySearch("hello world", 1);

console.log(resultOne);
}
//supabase setup, properly implemented
const supabaseUrl = 'https://[].supabase.co';
const supabaseKey = import.meta.env.VITE_SUPABASE_PRIVATE_KEY;
const supabaseClient = createClient(supabaseUrl, supabaseKey);


const splitting = async function(){

if (!supabaseClient) { //check to see if supabaseClient is undefined
console.log('supabaseClient is undefined');
return;
}
const splitter = new RecursiveCharacterTextSplitter({
chunkSize: 1000,
chunkOverlap: 200,
});

const output = await splitter.createDocuments([pdfText]);
console.log(supabaseClient) //also a check to see if supabaseClient exists
const vectorStore = await SupabaseVectorStore.fromTexts(
output,
new OpenAIEmbeddings({openAIApiKey: `${import.meta.env.VITE_OPENAI_API_KEY}`}),
{
client: supabaseClient,
tableName: "documents",
queryName: "match_documents",
}
);
console.log(supabaseClient) //another check
const resultOne = await vectorStore.similaritySearch("hello world", 1);

console.log(resultOne);
}
above's my code and I attached a picture of the error that I am getting. after checking the console in chrome, i realized that the langchain/vectorstore isn't able to read the client, but it reads the tableName and queryName properly (also attached) would appreciate help in getting the vectorstore to recognizing the client
No description
No description
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?