@vestal fulcrum Hi Tom - I finished your langchain course (It was quite impressive, thank you for making it). I went along with it on the scrimba application but now that Im trying to build a similar thing on VS code on my REACT app. I keep on running into issues. I'm stuck on the part of setting up my vector base:
function App() {
const fetchBase = async () => {
try {
const baseResponse = await fetch(document);
const baseData = await baseResponse.text();
const splitter = new RecursiveCharacterTextSplitter({
chunkSize: 500,
chunkOverlap: 50,
});
const output = await splitter.createDocuments([baseData]);
const sbApiKey = process.env.sbKey;
const sbUrl = process.env.sbURL;
const openAIApiKey = process.env.OPENAI_API_KEY;
const client = createClient(sbUrl, sbApiKey);
await SupabaseVectorStore.fromDocuments(
output,
new OpenAIEmbeddings({ openAIApiKey }),
{
client,
tableName: "documents",
}
);
} catch (err) {
console.log(err);
}
fetchBase();
return <></>;
};
}
This exact same code, when putting it on the scrimba app works smoothly and my vector store gets created. Please can you help me resolve this issue - its driving me insane I've been on this step since last night. So I can create my vector base using scrimba but not on vs code
I think the error is to do with the 'process.env' because I get an error saying 'openAI key is not found' And when I put my key directly without the process.env the code works on vs code. So begs the questions what is happening exactly.
Would greatly appreciate the help!