Hey @hbertsch
If you really want to learn langchain, it’s probably better to learn it in a code environment first ie. with python or javascript. n8n has to bring some subtle changes into the mix to make it all work and because it’s mostly hidden, it’s likely you’ll miss important concepts of langchain.
Regarding your code, you can fix it by replacing the following lines:
// Attaching the vector store and mapping the retriever
const vectorStore = await this.getInputConnectionData('ai_vectorStore', 0);
const retriever = vectorStore.asRetriever();
I don’t recommend you do it this way however since AI Agents do have the Vector Store tool which serves this purpose. See my review here: Review: Vector Store Tool (+ Langchain Code Alternative!)