Hey, I am using a Pinecone vector store to store a file from my google drive. Then I set up a telegram chat trigger and connected an AI Agent with it, it searches the file in the vector store and answer the relevant question.
But I want the complete file to be copied and pasted by the agent. Due to Recursive character text splitter the file is getting divided and it’s been hard for AI Agent to retrieve the complete file.
Here is the JSON code:
{
“nodes”: [
{
“parameters”: {
“options”: {}
},
“type”: “@n8n/n8n-nodes-langchain.lmChatOpenAi”,
“typeVersion”: 1.1,
“position”: [
-440,
-240
],
“id”: “e49f6ca2-48b3-4d4c-bc4a-1d65b839476a”,
“name”: “OpenAI Chat Model”,
“credentials”: {
“openAiApi”: {
“id”: “bW0cGozQgtIeZZNP”,
“name”: “OpenAi account”
}
}
},
{
“parameters”: {
“sessionIdType”: “customKey”,
“sessionKey”: “={{ $(‘Telegram Trigger’).item.json.message.chat.id }}”,
“contextWindowLength”: 10
},
“type”: “@n8n/n8n-nodes-langchain.memoryBufferWindow”,
“typeVersion”: 1.3,
“position”: [
-100,
-240
],
“id”: “ccfcdce7-9975-4076-90c4-e52c6f5abd89”,
“name”: “Window Buffer Memory”,
“disabled”: true
},
{
“parameters”: {
“promptType”: “define”,
“text”: “={{ $json.message.text }}”,
“options”: {
“systemMessage”: “=If user ask to write the entire/complete file from vector store then use Vector Store tool to retrieve the file and paste it in the output. Explain all the functions and if nessesary then modify the code as per the user’s requirement”,
“maxIterations”: 10,
“returnIntermediateSteps”: false
}
},
“type”: “@n8n/n8n-nodes-langchain.agent”,
“typeVersion”: 1.7,
“position”: [
-240,
-540
],
“id”: “f21296fd-e733-4887-880d-3db648b77f99”,
“name”: “AI Agent”
},
{
“parameters”: {
“chatId”: “1686297027”,
“text”: “={{ $json.output }}”,
“additionalFields”: {}
},
“type”: “n8n-nodes-base.telegram”,
“typeVersion”: 1.2,
“position”: [
300,
-540
],
“id”: “0fff02df-1f0b-4dca-b73b-a2a332598ca4”,
“name”: “Telegram1”,
“webhookId”: “53652a6e-89bc-415e-8b16-f34fe562c10f”,
“credentials”: {
“telegramApi”: {
“id”: “xgak8IDX9NYPW5sj”,
“name”: “Telegram account”
}
}
},
{
“parameters”: {
“options”: {}
},
“type”: “@n8n/n8n-nodes-langchain.lmChatOpenAi”,
“typeVersion”: 1.1,
“position”: [
480,
-100
],
“id”: “6140c9fa-1c6b-42cf-ae06-78ed91cbf960”,
“name”: “OpenAI Chat Model1”,
“credentials”: {
“openAiApi”: {
“id”: “bW0cGozQgtIeZZNP”,
“name”: “OpenAi account”
}
}
},
{
“parameters”: {
“pineconeIndex”: {
“__rl”: true,
“value”: “new-telegram”,
“mode”: “list”,
“cachedResultName”: “new-telegram”
},
“options”: {
“pineconeNamespace”: “Code”,
“metadata”: {
“metadataValues”: [
{
“name”: “id”,
“value”: “1ciqcMr10EiWSWNCMErtSg7zhQDbHdyUg”
}
]
}
}
},
“type”: “@n8n/n8n-nodes-langchain.vectorStorePinecone”,
“typeVersion”: 1,
“position”: [
60,
-120
],
“id”: “c73a220a-4499-4eaa-94af-e8e0b87b008c”,
“name”: “Pinecone Vector Store1”,
“credentials”: {
“pineconeApi”: {
“id”: “IK6pVyM7lzvpspoB”,
“name”: “PineconeApi account”
}
}
},
{
“parameters”: {
“options”: {}
},
“type”: “@n8n/n8n-nodes-langchain.embeddingsOpenAi”,
“typeVersion”: 1.2,
“position”: [
0,
40
],
“id”: “586d67c0-1d22-4897-8a16-d33b82cb043f”,
“name”: “Embeddings OpenAI1”,
“credentials”: {
“openAiApi”: {
“id”: “bW0cGozQgtIeZZNP”,
“name”: “OpenAi account”
}
}
},
{
“parameters”: {
“name”: “VectorStore”,
“description”: “Vector database with informations.”
},
“type”: “@n8n/n8n-nodes-langchain.toolVectorStore”,
“typeVersion”: 1,
“position”: [
220,
-300
],
“id”: “fc5455f7-7960-4a31-ad76-bd937005ec1a”,
“name”: “Vector Store 1”
},
{
“parameters”: {
“updates”: [
“message”
],
“additionalFields”: {}
},
“type”: “n8n-nodes-base.telegramTrigger”,
“typeVersion”: 1.1,
“position”: [
-760,
-540
],
“id”: “b5d6d3c1-a7ed-44b4-b68e-a37f8c603065”,
“name”: “Telegram Trigger”,
“webhookId”: “bab64528-fa3c-47d6-9a29-3649ea61b914”,
“credentials”: {
“telegramApi”: {
“id”: “xgak8IDX9NYPW5sj”,
“name”: “Telegram account”
}
}
},
{
“parameters”: {},
“type”: “n8n-nodes-base.manualTrigger”,
“typeVersion”: 1,
“position”: [
-760,
300
],
“id”: “d609d81c-a2df-480c-8a81-58a9ff30a1df”,
“name”: “When clicking ‘Test workflow’”,
“disabled”: true
},
{
“parameters”: {
“resource”: “fileFolder”,
“returnAll”: true,
“filter”: {
“folderId”: {
“__rl”: true,
“value”: “1Dp7-B2mGwFktEzTuPDCInx14ROMKkaIi”,
“mode”: “list”,
“cachedResultName”: “n8n Automate”,
“cachedResultUrl”: “https://drive.google.com/drive/folders/1Dp7-B2mGwFktEzTuPDCInx14ROMKkaIi”
}
},
“options”: {}
},
“type”: “n8n-nodes-base.googleDrive”,
“typeVersion”: 3,
“position”: [
-420,
300
],
“id”: “de9f0c4c-b6cd-45f5-ac7d-09f9983c3ab9”,
“name”: “Google Drive1”,
“credentials”: {
“googleDriveOAuth2Api”: {
“id”: “pf8EuSu4ZzubULS0”,
“name”: “Google Drive account”
}
}
},
{
“parameters”: {
“options”: {
“metadata”: {
“metadataValues”: [
{
“name”: “id”,
“value”: “1ciqcMr10EiWSWNCMErtSg7zhQDbHdyUg”
}
]
}
}
},
“type”: “@n8n/n8n-nodes-langchain.documentDefaultDataLoader”,
“typeVersion”: 1,
“position”: [
400,
540
],
“id”: “86b7d6e1-11a4-4a40-aea3-6e5c7a3d588d”,
“name”: “Default Data Loader”
},
{
“parameters”: {
“chunkSize”: 4000,
“options”: {}
},
“type”: “@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter”,
“typeVersion”: 1,
“position”: [
320,
700
],
“id”: “a9dc6492-0736-4e7f-8b11-98921286b4c0”,
“name”: “Recursive Character Text Splitter”
},
{
“parameters”: {
“options”: {}
},
“type”: “@n8n/n8n-nodes-langchain.embeddingsOpenAi”,
“typeVersion”: 1.2,
“position”: [
60,
540
],
“id”: “d56dadd2-f94d-4d5b-851a-04c128d8a797”,
“name”: “Embeddings OpenAI”,
“credentials”: {
“openAiApi”: {
“id”: “bW0cGozQgtIeZZNP”,
“name”: “OpenAi account”
}
}
},
{
“parameters”: {
“mode”: “insert”,
“pineconeIndex”: {
“__rl”: true,
“value”: “new-telegram”,
“mode”: “list”,
“cachedResultName”: “new-telegram”
},
“options”: {
“pineconeNamespace”: “Code”
}
},
“type”: “@n8n/n8n-nodes-langchain.vectorStorePinecone”,
“typeVersion”: 1,
“position”: [
180,
300
],
“id”: “d5028c84-5191-48b1-9055-a69f1ca8885a”,
“name”: “Pinecone Vector Store”,
“credentials”: {
“pineconeApi”: {
“id”: “IK6pVyM7lzvpspoB”,
“name”: “PineconeApi account”
}
}
},
{
“parameters”: {
“operation”: “download”,
“fileId”: {
“__rl”: true,
“value”: “={{ $json.id }}”,
“mode”: “id”
},
“options”: {}
},
“type”: “n8n-nodes-base.googleDrive”,
“typeVersion”: 3,
“position”: [
-140,
300
],
“id”: “2eb2488c-6c13-4cc8-a7d2-19cb9a9db5fa”,
“name”: “Google Drive”,
“credentials”: {
“googleDriveOAuth2Api”: {
“id”: “pf8EuSu4ZzubULS0”,
“name”: “Google Drive account”
}
}
}
],
“connections”: {
“OpenAI Chat Model”: {
“ai_languageModel”: [
[
{
“node”: “AI Agent”,
“type”: “ai_languageModel”,
“index”: 0
}
]
]
},
“Window Buffer Memory”: {
“ai_memory”: [
]
},
“AI Agent”: {
“main”: [
[
{
“node”: “Telegram1”,
“type”: “main”,
“index”: 0
}
]
]
},
“OpenAI Chat Model1”: {
“ai_languageModel”: [
[
{
“node”: “Vector Store 1”,
“type”: “ai_languageModel”,
“index”: 0
}
]
]
},
“Pinecone Vector Store1”: {
“ai_vectorStore”: [
[
{
“node”: “Vector Store 1”,
“type”: “ai_vectorStore”,
“index”: 0
}
]
]
},
“Embeddings OpenAI1”: {
“ai_embedding”: [
[
{
“node”: “Pinecone Vector Store1”,
“type”: “ai_embedding”,
“index”: 0
}
]
]
},
“Vector Store 1”: {
“ai_tool”: [
[
{
“node”: “AI Agent”,
“type”: “ai_tool”,
“index”: 0
}
]
]
},
“Telegram Trigger”: {
“main”: [
[
{
“node”: “AI Agent”,
“type”: “main”,
“index”: 0
}
]
]
},
“When clicking ‘Test workflow’”: {
“main”: [
[
{
“node”: “Google Drive1”,
“type”: “main”,
“index”: 0
}
]
]
},
“Google Drive1”: {
“main”: [
[
{
“node”: “Google Drive”,
“type”: “main”,
“index”: 0
}
]
]
},
“Default Data Loader”: {
“ai_document”: [
[
{
“node”: “Pinecone Vector Store”,
“type”: “ai_document”,
“index”: 0
}
]
]
},
“Recursive Character Text Splitter”: {
“ai_textSplitter”: [
[
{
“node”: “Default Data Loader”,
“type”: “ai_textSplitter”,
“index”: 0
}
]
]
},
“Embeddings OpenAI”: {
“ai_embedding”: [
[
{
“node”: “Pinecone Vector Store”,
“type”: “ai_embedding”,
“index”: 0
}
]
]
},
“Pinecone Vector Store”: {
“main”: [
]
},
“Google Drive”: {
“main”: [
[
{
“node”: “Pinecone Vector Store”,
“type”: “main”,
“index”: 0
}
]
]
}
},
“pinData”: {},
“meta”: {
“templateCredsSetupCompleted”: true,
“instanceId”: “ca46f72ee51f9beb1e76b8d609f7851693ab7de99972d1811aef0cdb6bef55c9”
}
}