{
 "name": "S11 - KB Ingest",
 "flow": [
  {
   "id": 1,
   "module": "google-drive:watchFilesInAFolder",
   "version": 4,
   "parameters": {
    "__IMTCONN__": null
   },
   "mapper": {
    "folder": "",
    "limit": 5
   },
   "metadata": {
    "designer": {
     "x": 0,
     "y": 0,
     "name": "קבצים חדשים בתיקייה"
    }
   }
  },
  {
   "id": 2,
   "module": "http:ActionSendData",
   "version": 3,
   "parameters": {},
   "mapper": {
    "url": "https://docs.google.com/document/d/{{1.id}}/export",
    "serializeUrl": false,
    "method": "get",
    "headers": [],
    "qs": [
     {
      "name": "format",
      "value": "txt"
     }
    ],
    "bodyType": "",
    "contentType": "",
    "data": "",
    "parseResponse": true,
    "authUser": "",
    "authPass": "",
    "timeout": "",
    "shareCookies": false,
    "ca": "",
    "rejectUnauthorized": true,
    "followRedirect": true,
    "useQuerystring": false,
    "gzip": true,
    "useMtls": false,
    "followAllRedirects": false
   },
   "metadata": {
    "designer": {
     "x": 300,
     "y": 0,
     "name": "הורדת טקסט (Docs export)"
    }
   }
  },
  {
   "id": 3,
   "module": "builtin:BasicRepeater",
   "version": 1,
   "parameters": {},
   "mapper": {
    "start": "1",
    "repeats": "{{ceil(length(2.data) / 700)}}",
    "step": "1"
   },
   "metadata": {
    "designer": {
     "x": 600,
     "y": 0,
     "name": "Chunks (700 + חפיפה 100)"
    }
   }
  },
  {
   "id": 4,
   "module": "util:SetVariable2",
   "version": 1,
   "parameters": {},
   "mapper": {
    "name": "chunk",
    "scope": "roundtrip",
    "value": "{{substring(2.data; (3.i - 1) * 700; (3.i - 1) * 700 + 800)}}"
   },
   "metadata": {
    "designer": {
     "x": 900,
     "y": 0,
     "name": "chunk"
    }
   }
  },
  {
   "id": 5,
   "module": "http:ActionSendDataAPIKeyAuth",
   "version": 3,
   "parameters": {
    "key": null
   },
   "mapper": {
    "url": "https://api.openai.com/v1/embeddings",
    "serializeUrl": false,
    "method": "post",
    "headers": [],
    "qs": [],
    "bodyType": "raw",
    "contentType": "application/json",
    "data": "{\"model\": \"text-embedding-3-small\", \"input\": {{toString(4.value)}}}",
    "parseResponse": true,
    "authUser": "",
    "authPass": "",
    "timeout": "",
    "shareCookies": false,
    "ca": "",
    "rejectUnauthorized": true,
    "followRedirect": true,
    "useQuerystring": false,
    "gzip": true,
    "useMtls": false,
    "followAllRedirects": false
   },
   "metadata": {
    "designer": {
     "x": 1200,
     "y": 0,
     "name": "OpenAI Embeddings (Keychain)"
    }
   }
  },
  {
   "id": 6,
   "module": "http:ActionSendDataAPIKeyAuth",
   "version": 3,
   "parameters": {
    "key": null
   },
   "mapper": {
    "url": "https://REPLACE_INDEX_HOST/vectors/upsert",
    "serializeUrl": false,
    "method": "post",
    "headers": [],
    "qs": [],
    "bodyType": "raw",
    "contentType": "application/json",
    "data": "{\"vectors\": [{\"id\": \"{{1.id}}-{{3.i}}\", \"values\": {{toString(5.data.data[1].embedding)}}, \"metadata\": {\"source\": \"{{1.name}}\", \"text\": {{toString(4.value)}}}}]}",
    "parseResponse": true,
    "authUser": "",
    "authPass": "",
    "timeout": "",
    "shareCookies": false,
    "ca": "",
    "rejectUnauthorized": true,
    "followRedirect": true,
    "useQuerystring": false,
    "gzip": true,
    "useMtls": false,
    "followAllRedirects": false
   },
   "metadata": {
    "designer": {
     "x": 1500,
     "y": 0,
     "name": "Pinecone Upsert (Keychain)"
    }
   }
  }
 ],
 "metadata": {
  "instant": false,
  "version": 1,
  "scenario": {
   "roundtrips": 1,
   "maxErrors": 3,
   "autoCommit": true,
   "autoCommitTriggerLast": true,
   "sequential": false,
   "slots": null,
   "confidential": false,
   "dataloss": false,
   "dlq": true,
   "freshVariables": false
  },
  "designer": {
   "orphans": []
  },
  "zone": "eu1.make.com"
 }
}