Passing AI agent generated parameter to vector store

Hi,

I’m trying to get the AI Agent to determine the variable in the Vector Store’s metadata filter.

So for example, when i ask the question “Can you tell me about calculus from the file math2023”, the metadata for file should be “math2023”.

I made a code tool which can pick out the file name as expected. If I can pass that into the metadata for the vector store that would work but I’m not seeing the output from the code tool as an input option.

Here is my full flow:

Here is the only input I see in my vector store tool:

Here is the code tool:
image

1 Like

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hey @Ariya
Unfortunately, I don’t think vector store tool passes anything other than the user’s query to the vector store.

However, here are 2 possible approaches which might work.

1. Extract the metadata pre-agent
Pros: works in n8n cloud, uses built-in nodes
Cons: extra call to LLM, looks odd (subjective)

2. BYO vector store tool using Langchain Code node
Pros: Be the master your own destiny
Cons: Doesn’t work in n8n cloud
Note: you’ll need to add NODE_FUNCTION_ALLOW_EXTERNAL=zod to your environment variables.