{
"nodes": [
{
"id": 117,
"labels": [
"IA_Function"
],
"properties": {
"$schema.fields": "evaluate({\r\n \tinput: {\r\n\t\tmodel: 'input',\r\n\t\tlabel: t('Enter your query'),\r\n\t\ttype: \"textArea\",\r\n\t\trows: 5\r\n\t},\r\n submit: {\r\n type: 'submit',\r\n index: 5,\r\n id: 'submit',\r\n buttonText: t('Submit query'),\r\n action: 'submit'\r\n\t }\r\n})",
"area": "sidebar-left",
"container.closable": "true",
"container.index": -4,
"container.title": "null",
"name": "input query",
"type": "InputView"
}
},
{
"id": 118,
"labels": [
"IA_Function"
],
"properties": {
"headers": "evaluate({\r\n\tAuthorization: \"Bearer [your OpenAI token]\",\r\n\tchangeOrigin: true,\r\n\tAccept: '*/*',\r\n\t\"content-type\": \"application/json\"\r\n})",
"method": "POST",
"name": "Create embedding",
"timeout": 60000,
"type": "Request",
"url": "https://api.openai.com/v1/embeddings"
}
},
{
"id": 120,
"labels": [
"IA_Function"
],
"properties": {
"cypher": "CALL apoc.load.xml(\"graphileon_urls.xml\")\r\nYIELD value\r\nUNWIND value._children AS page\r\nWITH HEAD([ i IN page._children WHERE i._type = 'loc'])._text AS url,\r\n HEAD([ i IN page._children WHERE i._type = 'lastmod'])._text AS date\r\n\r\nMERGE (p:Page {source: url})\r\nSET p.date= left(date,10)\r\nRETURN p.source , p.date ",
"name": "Create nodes from XML",
"store": "data",
"type": "Query"
}
},
{
"id": 121,
"labels": [
"IA_Function"
],
"properties": {
"type": "TableView"
}
},
{
"id": 122,
"labels": [
"IA_Function"
],
"properties": {
"cypher": "MATCH (p:Page)\r\n \r\nWHERE p.source STARTS WITH \"http://\"\r\n\r\n AND NOT (\r\n p.source CONTAINS '/archive/'\r\n OR \r\n\t\t\tp.source CONTAINS '/graphileon-dev/'\r\n\t\t )\r\n\r\nRETURN COLLECT({source:p.source}) AS sources",
"name": "Create page collection",
"store": "data",
"type": "Query"
}
},
{
"id": 123,
"labels": [
"IA_Function"
],
"properties": {
"$_instance": "sourceIterator",
"iterationType": "serial",
"name": "sources",
"type": "Iterate"
}
},
{
"id": 124,
"labels": [
"IA_Function"
],
"properties": {
"method": "post",
"name": "extract chunks of clean text",
"serverSide": "true",
"type": "Request",
"url": "http://111.222.333.444:8080/{{endpoint}}"
}
},
{
"id": 125,
"labels": [
"IA_Function"
],
"properties": {
"headers": "evaluate({\r\n\tAuthorization: \"Bearer [your OpenAI token]\",\r\n\tchangeOrigin: true,\r\n\tAccept: '*/*',\r\n\t\"content-type\": \"application/json\"\r\n})",
"method": "POST",
"name": "Create embedding OpenAI",
"timeout": 60000,
"type": "Request",
"url": "https://api.openai.com/v1/embeddings"
}
},
{
"id": 126,
"labels": [
"IA_Function"
],
"properties": {
"cypher": "MATCH (p:Page {source: $source})\r\nWITH p\r\nCREATE (c:Chunk)<-[:CHUNK {index:toInteger($chunkIndex)}]-(p)\r\nSET c.content = $content\r\nWITH c\r\nCALL db.create.setVectorProperty(c, 'embedding', $vector) YIELD node\r\nRETURN node.embedding",
"name": "Write embedding",
"store": "data",
"type": "Query"
}
},
{
"id": 128,
"labels": [
"IA_Function"
],
"properties": {
"#logEntries": "evaluate([])",
"$_instance": "logView",
"$area": "sidebar-left",
"$template": "\r\n\r\n",
"container.closable": "true",
"container.height": 400,
"container.id": "progress",
"container.index": 99,
"name": "Progress",
"type": "HtmlView"
}
},
{
"id": 129,
"labels": [
"IA_Function"
],
"properties": {
"cypher": "CALL db.index.vector.queryNodes('chunk-embeddings',10, $vector)\r\nYIELD node AS closeNode, score\r\nWITH closeNode,score WHERE id(closeNode) <> 1759\r\nOPTIONAL MATCH (closeNode)<-[:CHUNK]-(p:Page)\r\n\r\nRETURN p.source AS source, score ,\r\n closeNode.content AS content,\r\n\t id(closeNode) AS id",
"name": "Look up nearest chunks",
"store": "data",
"type": "Query"
}
},
{
"id": 130,
"labels": [
"IA_Function"
],
"properties": {
"container.id": "closeNodes",
"container.state": "maximized",
"type": "TableView"
}
},
{
"id": 131,
"labels": [
"IA_Function"
],
"properties": {
"$_instance": "chunkIterator",
"iterationType": "serial",
"name": "chuncks",
"type": "Iterate"
}
},
{
"id": 134,
"labels": [
"IA_Function"
],
"properties": {
"cypher": "MATCH (c:Chunk)<-[:CHUNK]-(p:Page)\r\nDETACH DELETE c",
"name": "Delete chuncks connected to pages",
"store": "data",
"type": "Query"
}
},
{
"id": 135,
"labels": [
"IA_Function"
],
"properties": {
"$schema.fields": "evaluate({\r\n\r\n \tsource: {\r\n\t\tmodel: 'source',\r\n\t\tlabel: t('Title'),\r\n\t\ttype: \"input\",\r\n\t\tinputType: \"text\"\r\n\t},\r\n \tinput: {\r\n\t\tmodel: 'input',\r\n\t\tlabel: t('Content'),\r\n\t\ttype: \"textArea\",\r\n\t\trows: 5\r\n\t},\r\n submit: {\r\n type: 'submit',\r\n index: 5,\r\n id: 'submit',\r\n buttonText: t('Submit page'),\r\n action: 'submit'\r\n\t }\r\n})",
"name": "input page",
"type": "InputView"
}
},
{
"id": 136,
"labels": [
"IA_Function"
],
"properties": {
"$params.chunkIndex": 0,
"cypher": "MERGE (p:Page {source: $source})\r\nWITH p\r\nCREATE (c:Chunk)<-[:CHUNK {index:toInteger($chunkIndex)}]-(p)\r\nSET c.content = $content\r\nWITH c\r\nCALL db.create.setVectorProperty(c, 'embedding', $vector) YIELD node\r\nRETURN node.embedding",
"name": "Write embedding",
"store": "data",
"type": "Query"
}
},
{
"id": 156,
"labels": [
"IA_Function"
],
"properties": {
"iaName": "query",
"method": "GET",
"name": "query",
"public": "true",
"type": "API"
}
},
{
"id": 157,
"labels": [
"IA_Function"
],
"properties": {
"headers": "evaluate({\r\n\tAuthorization: \"Bearer [your OpenAI token]\",\r\n\tchangeOrigin: true,\r\n\tAccept: '*/*',\r\n\t\"content-type\": \"application/json\"\r\n})",
"method": "POST",
"name": "Create embedding",
"public": "true",
"timeout": 60000,
"type": "Request",
"url": "https://api.openai.com/v1/embeddings"
}
},
{
"id": 158,
"labels": [
"IA_Function"
],
"properties": {
"cypher": "CALL db.index.vector.queryNodes('chunk-embeddings',10, $vector)\r\nYIELD node AS closeNode, score\r\nRETURN COLLECT(closeNode.content) AS chunks",
"name": "Look up nearest chunks",
"public": "true",
"store": "data",
"type": "Query"
}
},
{
"id": 162,
"labels": [
"IA_Dashboard"
],
"properties": {
"name": "RAG"
}
}
],
"relations": [
{
"id": 237,
"source": 117,
"target": 118,
"type": "TRIGGER",
"properties": {
"$data": "evaluate({\n \"input\": (%).data.input,\n \"model\": 'text-embedding-ada-002'\n})",
"$method": "POST",
"$urlData.url": "https://api.openai.com/v1/embeddings",
"type": "submit"
}
},
{
"id": 241,
"source": 120,
"target": 121,
"type": "TRIGGER",
"properties": {
"#data": "(%).data",
"type": "success"
}
},
{
"id": 243,
"source": 122,
"target": 123,
"type": "TRIGGER",
"properties": {
"#data": "(%).data[0].sources",
"type": "success"
}
},
{
"id": 244,
"source": 136,
"target": 131,
"type": "TRIGGER",
"properties": {
"$nextIteration": "true",
"type": "success"
}
},
{
"id": 246,
"source": 134,
"target": 122,
"type": "TRIGGER",
"properties": {
"type": "success"
}
},
{
"id": 247,
"source": 156,
"target": 157,
"type": "TRIGGER",
"properties": {
"$data": "evaluate({\r\n \"input\": (%).input.q,\r\n \"model\": 'text-embedding-ada-002'\r\n})",
"$method": "POST",
"type": "request"
}
},
{
"id": 248,
"source": 128,
"target": 128,
"type": "TRIGGER",
"properties": {
"#logEntries": "evaluate([])",
"action": "clear",
"type": "batch"
}
},
{
"id": 249,
"source": 126,
"target": 128,
"type": "TRIGGER",
"properties": {
"#logEntries": "evaluate(\r\n concat([\r\n (%).meta.params.source\r\n\t\t ],\r\n\t\t (@).instances.logView.logEntries\r\n\t\t)\r\n)",
"type": "success"
}
},
{
"id": 250,
"source": 118,
"target": 129,
"type": "TRIGGER",
"properties": {
"#params.vector": "(%).response.data.data[0].embedding",
"type": "success"
}
},
{
"id": 251,
"source": 129,
"target": 130,
"type": "TRIGGER",
"properties": {
"#data": "(%).data",
"type": "success"
}
},
{
"id": 252,
"source": 124,
"target": 131,
"type": "TRIGGER",
"properties": {
"#data": "(%).response.data.chunks",
"type": "success"
}
},
{
"id": 253,
"source": 131,
"target": 125,
"type": "TRIGGER",
"properties": {
"$_path.chunkIndex": "(%).index",
"$_path.content": "(%).data",
"$_path:templating": "none",
"$data.input": "(%).data",
"$data.model": "text-embedding-ada-002",
"$data:templating": "none",
"$method": "POST",
"type": "iteration"
}
},
{
"id": 254,
"source": 125,
"target": 126,
"type": "TRIGGER",
"properties": {
"#params.vector": "(%).response.data.data[0].embedding",
"$params.chunkIndex": "(%)._path.chunkIndex",
"$params.content": "(%)._path.content",
"$params.source": "(%)._path.source",
"$params:templating": "none",
"(%)._path.process": "batchLoad",
"type": "success"
}
},
{
"id": 255,
"source": 126,
"target": 131,
"type": "TRIGGER",
"properties": {
"$nextIteration": "true",
"type": "success"
}
},
{
"id": 256,
"source": 131,
"target": 123,
"type": "TRIGGER",
"properties": {
"$nextIteration": "true",
"(%)._path.process": "batchLoad",
"type": "iterationEnd"
}
},
{
"id": 260,
"source": 125,
"target": 136,
"type": "TRIGGER",
"properties": {
"#params.vector": "(%).response.data.data[0].embedding",
"$params.chunkIndex": "(%)._path.chunkIndex",
"$params.content": "(%)._path.content",
"$params.source": "(%)._path.source",
"$params:templating": "none",
"(%)._path.process": "singleLoad",
"type": "success"
}
},
{
"id": 261,
"source": 136,
"target": 128,
"type": "TRIGGER",
"properties": {
"#logEntries": "evaluate(\r\n concat([\r\n (%).meta.params.source\r\n\t\t ],\r\n\t\t (@).instances.logView.logEntries\r\n\t\t)\r\n)",
"type": "success"
}
},
{
"id": 262,
"source": 135,
"target": 135,
"type": "TRIGGER",
"properties": {
"$_instance": "_previous",
"$kill": "true",
"type": "submit"
}
},
{
"id": 294,
"source": 135,
"target": 124,
"type": "TRIGGER",
"properties": {
"$_path.content": "(%).data.input",
"$_path.process": "singleLoad",
"$_path.source": "(%).data.source",
"$data.chunkOverlap": 20,
"$data.chunkSize": 512,
"$data.content": "(%).data.input",
"$method": "POST",
"$urlData.endpoint": "split",
"type": "submit"
}
},
{
"id": 295,
"source": 123,
"target": 124,
"type": "TRIGGER",
"properties": {
"$_path.process": "batchLoad",
"$_path.source": "(%).data.source",
"$data.chunkOverlap": 20,
"$data.chunkSize": 512,
"$data.selector": "evaluate(\r\n\tincludes((%).data.source, 'docs.graphileon') ? '.s-content' : '.post .entry-content')",
"$data.source": "(%).data.source",
"$urlData.endpoint": "extract",
"type": "iteration"
}
},
{
"id": 296,
"source": 157,
"target": 158,
"type": "TRIGGER",
"properties": {
"#params.vector": "(%).response.data.data[0].embedding",
"type": "success"
}
},
{
"id": 297,
"source": 158,
"target": 156,
"type": "TRIGGER",
"properties": {
"#response": "(%).data",
"$_instance": "(%)._path.apiInstance",
"type": "success"
}
},
{
"id": 298,
"source": 162,
"target": 120,
"type": "SHORTCUT",
"properties": {}
},
{
"id": 299,
"source": 162,
"target": 134,
"type": "SHORTCUT",
"properties": {
"name": "Create embeddings"
}
},
{
"id": 300,
"source": 162,
"target": 135,
"type": "SHORTCUT",
"properties": {}
},
{
"id": 301,
"source": 162,
"target": 117,
"type": "SHORTCUT",
"properties": {}
}
]
}