AI chat model ignores URL from vector database

Describe the problem/error/question

Hello!

I am working on an AI agent for a school database. The project is based on the gemini model running 2.5 flash, the database is uploaded to pinecone using gemini text/embedding 004.

When I ask the AI about the database at this point the answers are mostly correct, but the issue is I want it to return a link to our website (bookstack based wiki) with every answer.

My SQL query gathers the database information, and generates a clean “header” for each page containing the link. The Metadata is preserved in Pinecone for all chunks, but the AI Agent (using the Vector Store Tool) often ignores hidden metadata and the header, and hallucinates links when it can’t find them.

Even more strange, the gemini chat model connected to the vectore store tool receives all of the information it needs (including the link), but it outputs an answer without it (example below).

I have thought about adding a second vector retrieval to specifically look for the link, but that would add processing time and extra api calls.

I am still new to this, so if you need extra information please feel free to ask! (I have hidden some information from the examples below, I wrapped them in () so you understand what I have modified).

Please share your workflow

Share the output returned by the last node

What the gemini chat model receives:
System: Use the following pieces of context to answer the users question. \nIf you don’t know the answer, just say that you don’t know, don’t try to make up an answer.\n----------------\nSource Book: School Wide Information | Chapter: General Information | Page: WiFi Access | Link: (https://ProperLink)\n\nCONTENT START:\n(hidden page content)

It replies with the correct information but does not recognize that the link is attached.

Information on your n8n setup

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

If it is only one specific link you can just add it in response of agent and then return answer to end user using response to chat node.

Each response the AI makes is based on a different web page. Each page is uploaded in the database and includes its own link. So if someone requests info about wifi usage for example, I would like the AI to explain how to log in and link to the wifi page specifically.