URL metadata not included in agent response

Describe the problem/error/question

The source url is returned by the Pinecone node as metadata but isn’t being picked by the AI Agent in its response. Maybe the problem is that there are 4 chunks being returned, and each one has a different source url.
Kindly suggest a fix.

What is the error message (if any)?

Please share your workflow


Share the output returned by the last node

image

Information on your n8n setup

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

the pinecone node returns 4 chunks with different source URLs, and the ai agent isnt picking them up in the response. have you tried reducing the metadata to just one field (like a single source URL per chunk) before passing to the agent? the agent might be confused by having multiple metadata fields with the same value repeated. alternately, use a set node to consolidate the URLs into one before the ai agent node.

Hi @nushworks Welcome!
First remove the middle node 'Vector Store KB" and connect the PineCone tool directly to the AI agent, Also you can try increasing this count in your pinecone Node:
image
Also make sure you have chunked the data WELL i mean in a good and arranged manner as chunking may effect the retrieval at some points like these where you explicitly need a specific data if possible just create a different store for that specific data, and also if you are not then try using this model:
image
And i am supposing you have INCLUDE META DATA toggle turned on.. and if you want you can get yourself a free reranker so that you almost always get some certain results with an extra layer.

2 Likes

The AI Agent does not automatically surface metadata fields unless you specifically tell it to. Here are some options that might work well:

-You can use a Set node after the Pinecone to extract the source URLs and format the chunks into a clean list before sending them to the agent.

-You can update your agent’s system prompt to instruct it to include source URL(s) from the retrieved context every response to say something like, “Make sure to ALWAYS cite the source URL(s) from the retrieved documents at the end of your response.

@Anshul_Namdev thanks, this worked for me!

1 Like