{
    "name": "Price offers",
    "nodes": [
        {
            "parameters": {
                "operation": "download",
                "fileId": {
                    "__rl": true,
                    "value": "={{ $json.id }}",
                    "mode": "id"
                },
                "options": []
            },
            "type": "n8n-nodes-base.googleDrive",
            "typeVersion": 3,
            "position": [
                -688,
                528
            ],
            "id": "6199869c-63e8-4682-a136-69417e40794b",
            "name": "Download file1",
            "connections": {
                "main": [
                    [
                        {
                            "node": "3d250d68-087f-47b2-8964-811cefd3d5b3",
                            "type": "main",
                            "index": 0
                        }
                    ]
                ]
            },
            "credentials": {
                "googleDriveOAuth2Api": {
                    "id": "3GeY38MVrO78i1ns",
                    "name": "Google Drive account"
                }
            }
        },
        {
            "parameters": {
                "mode": "insert",
                "pineconeIndex": {
                    "__rl": true,
                    "value": "n8n-price-offers",
                    "mode": "list",
                    "cachedResultName": "n8n-price-offers"
                },
                "options": {
                    "pineconeNamespace": "dropidea-price-offers"
                }
            },
            "type": "@n8n\/n8n-nodes-langchain.vectorStorePinecone",
            "typeVersion": 1.3,
            "position": [
                -224,
                128
            ],
            "id": "cf68c4d5-eda2-4355-bdf6-04fac990a148",
            "name": "Pinecone Vector Store1",
            "connections": {
                "main": [
                    [
                        {
                            "node": "27159c01-8627-45e3-a283-32ca0f67c130",
                            "type": "main",
                            "index": 0
                        }
                    ]
                ]
            },
            "credentials": {
                "pineconeApi": {
                    "id": "eliwNj7WZ1PTR4Zl",
                    "name": "PineconeApi account"
                }
            }
        },
        {
            "parameters": {
                "model": "text-embedding-3-large",
                "options": []
            },
            "type": "@n8n\/n8n-nodes-langchain.embeddingsOpenAi",
            "typeVersion": 1.2,
            "position": [
                -256,
                352
            ],
            "id": "2a2e0534-4d40-4332-85e3-d60a14aadcff",
            "name": "Embeddings OpenAI1",
            "credentials": {
                "openAiApi": {
                    "id": "XMEsLBYvPf9TQsy0",
                    "name": "OpenAi account"
                }
            }
        },
        {
            "parameters": {
                "dataType": "binary",
                "textSplittingMode": "custom",
                "options": {
                    "metadata": {
                        "metadataValues": [
                            {
                                "name": "Quote Nm",
                                "value": "={{ $json.name }}"
                            }
                        ]
                    }
                }
            },
            "type": "@n8n\/n8n-nodes-langchain.documentDefaultDataLoader",
            "typeVersion": 1.1,
            "position": [
                -128,
                352
            ],
            "id": "99b33a7c-f56e-4914-9b9a-0a74a4b24186",
            "name": "Default Data Loader1"
        },
        {
            "parameters": {
                "chunkSize": 900,
                "chunkOverlap": 50,
                "options": []
            },
            "type": "@n8n\/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
            "typeVersion": 1,
            "position": [
                -48,
                560
            ],
            "id": "30525964-968c-4d2e-a12f-70dda47a28ec",
            "name": "Recursive Character Text Splitter1"
        },
        {
            "parameters": {
                "resource": "fileFolder",
                "queryString": "=",
                "returnAll": true,
                "filter": {
                    "folderId": {
                        "__rl": true,
                        "value": "11olXUHuc7QxpaRHQLybQAgHLU9IKvsqp",
                        "mode": "list",
                        "cachedResultName": "عروض اسعار متنوعة",
                        "cachedResultUrl": "https:\/\/drive.google.com\/drive\/folders\/11olXUHuc7QxpaRHQLybQAgHLU9IKvsqp"
                    }
                },
                "options": []
            },
            "type": "n8n-nodes-base.googleDrive",
            "typeVersion": 3,
            "position": [
                -1152,
                448
            ],
            "id": "4df51d71-9b46-4ba7-b411-df6f1743223c",
            "name": "Search files and folders1",
            "connections": {
                "main": [
                    [
                        {
                            "node": null,
                            "type": "main",
                            "index": 0
                        }
                    ]
                ]
            },
            "credentials": {
                "googleDriveOAuth2Api": {
                    "id": "3GeY38MVrO78i1ns",
                    "name": "Google Drive account"
                }
            }
        },
        {
            "parameters": {
                "rule": {
                    "interval": [
                        []
                    ]
                }
            },
            "type": "n8n-nodes-base.scheduleTrigger",
            "typeVersion": 1.2,
            "position": [
                -1600,
                544
            ],
            "id": "68ed8edf-6634-452f-b489-c719b249c243",
            "name": "Schedule Trigger1"
        },
        {
            "parameters": {
                "conditions": {
                    "options": {
                        "caseSensitive": true,
                        "leftValue": "",
                        "typeValidation": "strict",
                        "version": 2
                    },
                    "conditions": [
                        {
                            "id": "a8d5c33a-155e-4dac-ba32-1116d4a88084",
                            "leftValue": "={{$binary.data.mimeType}}",
                            "rightValue": "=application\/pdf",
                            "operator": {
                                "type": "string",
                                "operation": "equals"
                            }
                        }
                    ],
                    "combinator": "and"
                },
                "options": []
            },
            "type": "n8n-nodes-base.if",
            "typeVersion": 2.2,
            "position": [
                -480,
                544
            ],
            "id": "8c9ee974-20da-4027-8d36-abc695af3dc5",
            "name": "PDF Filter1"
        },
        {
            "parameters": {
                "operation": "upsert",
                "schema": {
                    "__rl": true,
                    "mode": "list",
                    "value": "public"
                },
                "table": {
                    "__rl": true,
                    "value": "price-offers",
                    "mode": "list",
                    "cachedResultName": "price-offers"
                },
                "columns": {
                    "mappingMode": "defineBelow",
                    "value": {
                        "file_id": "={{ $json.id }}",
                        "uploaded_at": "={{ $now }}"
                    },
                    "matchingColumns": [
                        "file_id"
                    ],
                    "schema": [
                        {
                            "id": "file_id",
                            "displayName": "file_id",
                            "required": true,
                            "defaultMatch": false,
                            "display": true,
                            "type": "string",
                            "canBeUsedToMatch": true,
                            "removed": false
                        },
                        {
                            "id": "uploaded_at",
                            "displayName": "uploaded_at",
                            "required": false,
                            "defaultMatch": false,
                            "display": true,
                            "type": "string",
                            "canBeUsedToMatch": false,
                            "removed": false
                        }
                    ],
                    "attemptToConvertTypes": false,
                    "convertFieldsToString": false
                },
                "options": []
            },
            "type": "n8n-nodes-base.postgres",
            "typeVersion": 2.6,
            "position": [
                -128,
                736
            ],
            "id": "b58ee4cd-52ee-4561-9e3c-cd4e13e73fa2",
            "name": "Insert or update rows in a table1",
            "credentials": {
                "postgres": {
                    "id": "VrRSp705gu0IHQy1",
                    "name": "Postgres account"
                }
            }
        },
        {
            "parameters": {
                "mode": "combine",
                "mergeByFields": {
                    "values": [
                        {
                            "field1": "id",
                            "field2": "file_id"
                        }
                    ]
                },
                "joinMode": "keepNonMatches",
                "options": []
            },
            "name": "Compare With DB1",
            "type": "n8n-nodes-base.merge",
            "typeVersion": 2,
            "position": [
                -928,
                544
            ],
            "id": "462ab06a-d7a4-47ae-a4da-ba216c9f23ca",
            "connections": {
                "main": [
                    [
                        {
                            "node": "b9e6568c-f5f7-4b35-b13a-188700cd419a",
                            "type": "main",
                            "index": 0
                        }
                    ]
                ]
            }
        },
        {
            "parameters": {
                "jsCode": "return items;\n"
            },
            "type": "n8n-nodes-base.code",
            "typeVersion": 2,
            "position": [
                -1152,
                640
            ],
            "id": "d0463a14-2d95-406b-859e-d7bb2ba78741",
            "name": "Code1"
        },
        {
            "parameters": {
                "operation": "executeQuery",
                "query": "SELECT DISTINCT file_id\nFROM public.\"price-offers\";",
                "options": []
            },
            "name": "Fetch Cleaned File IDs1",
            "type": "n8n-nodes-base.postgres",
            "typeVersion": 2.6,
            "position": [
                -1376,
                640
            ],
            "id": "29200951-6104-4eab-8241-822e1ea5c058",
            "credentials": {
                "postgres": {
                    "id": "VrRSp705gu0IHQy1",
                    "name": "Postgres account"
                }
            }
        }
    ],
    "pinData": [],
    "connections": {
        "Download file1": {
            "main": [
                [
                    {
                        "node": "PDF Filter1",
                        "type": "main",
                        "index": 0
                    }
                ]
            ]
        },
        "Pinecone Vector Store1": {
            "main": [
                []
            ]
        },
        "Embeddings OpenAI1": {
            "ai_embedding": [
                [
                    {
                        "node": "Pinecone Vector Store1",
                        "type": "ai_embedding",
                        "index": 0
                    }
                ]
            ]
        },
        "Default Data Loader1": {
            "ai_document": [
                [
                    {
                        "node": "Pinecone Vector Store1",
                        "type": "ai_document",
                        "index": 0
                    }
                ]
            ]
        },
        "Recursive Character Text Splitter1": {
            "ai_textSplitter": [
                [
                    {
                        "node": "Default Data Loader1",
                        "type": "ai_textSplitter",
                        "index": 0
                    }
                ]
            ]
        },
        "Search files and folders1": {
            "main": [
                [
                    {
                        "node": "Compare With DB1",
                        "type": "main",
                        "index": 0
                    }
                ]
            ]
        },
        "Schedule Trigger1": {
            "main": [
                [
                    {
                        "node": "Search files and folders1",
                        "type": "main",
                        "index": 0
                    },
                    {
                        "node": "Fetch Cleaned File IDs1",
                        "type": "main",
                        "index": 0
                    }
                ]
            ]
        },
        "PDF Filter1": {
            "main": [
                [
                    {
                        "node": "Insert or update rows in a table1",
                        "type": "main",
                        "index": 0
                    },
                    {
                        "node": "Pinecone Vector Store1",
                        "type": "main",
                        "index": 0
                    }
                ]
            ]
        },
        "Compare With DB1": {
            "main": [
                [
                    {
                        "node": "Download file1",
                        "type": "main",
                        "index": 0
                    }
                ]
            ]
        },
        "Code1": {
            "main": [
                [
                    {
                        "node": "Compare With DB1",
                        "type": "main",
                        "index": 1
                    }
                ]
            ]
        },
        "Fetch Cleaned File IDs1": {
            "main": [
                [
                    {
                        "node": "Code1",
                        "type": "main",
                        "index": 0
                    }
                ]
            ]
        },
        "Insert or update rows in a table1": {
            "main": [
                []
            ]
        }
    },
    "active": true,
    "settings": {
        "executionOrder": "v1"
    },
    "versionId": "b6104d66-ad19-47e6-a0b4-0774b168b1b7",
    "meta": {
        "templateCredsSetupCompleted": true,
        "instanceId": "a85fc6519b374e86e01063acbb733de8f006266ec78aa34c0f3dbebd8434a16e"
    },
    "id": "an5abvfaY1tFvv5n",
    "tags": []
}