{
  "id": "a31fIa8ZmGBq07CK",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Reasoning Expert with Graph RAG Knowledge Ontology",
  "tags": [],
  "nodes": [
    {
      "id": "aa3aae5b-5652-4bd8-a1bf-986eb9765ab3",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -480,
        -220
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "7c700795-faff-412e-aecb-4624439c1246",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -360,
        200
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "4a09a841-6743-4d8f-8cbc-33b64b2d21bb",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        -160,
        200
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "c388dd69-24a6-422b-a08c-4a2046a75997",
      "name": "Interaction Dynamics Expert",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        200,
        200
      ],
      "parameters": {
        "url": "https://infranodus.com/api/v1/graphAndAdvice?doNotSave=true&addStats=true&optimize=develop&includeStatements=true&includeGraphSummary=true&includeGraph=false",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "name",
              "value": "eightos_system"
            },
            {
              "name": "requestMode",
              "value": "response"
            },
            {
              "name": "prompt",
              "value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters2_Value', `User query to send to the expert`, 'string') }}"
            },
            {
              "name": "aiTopics",
              "value": "true"
            }
          ]
        },
        "genericAuthType": "httpBearerAuth",
        "toolDescription": "You are an expert in interaction dynamics who provides advice on the best way to interact with people and situations. You receive information about the dynamics of an interaction and then provide advice for what to do next based on these dynamics.\n\n<MainConcepts>: \n[[escalation]], [[adaptive_strategy]], [[metastability]], [[polysingularity]]\n</MainConcepts>\n\n\n<MainTopics>: \n1. Tension Dynamics: [[escalation]] [[engagement]] [[tension_release]] \n2. Synergistic Growth: [[synergy]] [[assimilation]] [[common_good]] \n3. Ethical Narratives: [[\u221eos_private_ethics]] [[narrative_activation_formula]] [[environment]] \n4. Chaotic Stability: [[metastability]] [[chaotic_itinerancy]] [[dynamic_stability]] \n5. Adaptive Fluidity: [[adaptive_strategy]] [[fluidity]] [[environmental_input]] \n6. Diverse Governance: [[polysingularity]] [[hedging_preset]] [[holocracy]] \n</MainTopics>\n\n<TopicalGap>: \n4. Chaotic Stability: [[metastability]] [[chaotic_itinerancy]] \n6. Diverse Governance: [[polysingularity]] [[hedging_preset]] \n</TopicalGap>\n\n<ConceptualGateways> \n[[common_good]] [[chaotic_itinerancy]] [[hedging_preset]] [[environmental_input]] [[synergy]] [[narrative_activation_formula]] [[\u221eos_private_ethics]] [[environment]] [[fluidity]] [[holocracy]] [[assimilation]] [[panarchy]] [[discipline_preset]] \n</ConceptualGateways>\n\n\n<Relations>: \n1) [[dissipation]] [[tension_release]]\n2) [[dissipation]] [[a_r_d_method]]\n3) [[common_good]] [[synergy]]\n4) [[oscillatory_progress]] [[pendulation]]\n5) [[assimilation]] [[energy_absorption]]\n6) [[feedback_escalation]] [[feedback_loop]]\n7) [[metastability]] [[chaotic_itinerancy]]\n8) [[polysingularity]] [[diversity]]\n9) [[oscillatory_pattern]] [[synchronization]]\n10) [[fluidity]] [[adaptive_strategy]]\n11) [[tension_increase]] [[tension_release]]\n12) [[escalation]] [[adaptive_strategy]]\n</Relations>\n\nSentiment (wink):\npositive: 15%, negative: 18%, neutral: 68%\n\n"
      },
      "credentials": {
        "httpBearerAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "1bf99f65-00fb-49f3-b576-b21acc14e2ae",
      "name": "Reasoning Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -200,
        -60
      ],
      "parameters": {
        "options": {
          "systemMessage": "You are a reasoning agent. You have access to a dynamic interaction expert that provides you advice on how to continue your interaction. When you send a request to this expert, you need to give it an interpretation of the previous interaction and its dynamics (your interpretation of the conversation) using the language and concepts that the reasoning agent will understand. \n\nUse the response from the expert as an instruction to improve your response to the user's query. Give the utmost importance to the expert's advice to improve your standard response to the client's original query."
        }
      },
      "typeVersion": 1.9
    },
    {
      "id": "61106e92-7c6a-4e93-8afb-180f00123f2e",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -220,
        -240
      ],
      "parameters": {
        "width": 380,
        "height": 320,
        "content": "## 1. Reasoning Agent \n\nHere you add a system prompt that tell the agent to augment the original prompt using its knowledge about the reasoning ontology. "
      },
      "typeVersion": 1
    },
    {
      "id": "7b409287-758d-46e8-b828-69776ce5f56d",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        60,
        120
      ],
      "parameters": {
        "width": 340,
        "height": 560,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n## 2. Reasoning Ontology\n\nHere you add an [InfraNodus](https://infranodus.com) knowledge graph that will contain the reasoning ontology you want to use. \n\n1. Specify it in the `name` field\n\n2. Add a description and topical summary (generated in `Project Notes` > `prompt augmentation for RAG` on the graph's page)"
      },
      "typeVersion": 1
    },
    {
      "id": "06e7c099-dd74-4f46-bb3b-b7639c3fc3ea",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        400,
        120
      ],
      "parameters": {
        "width": 420,
        "height": 560,
        "content": "\n\n\n\n\n\n\n\n\n\n### Knowledge Graph: Reasoning Ontology\n\nYou can auto-generate the reasoning ontology using the [https://infranodus.com/import/ai-ontologies](https://infranodus.com/import/ai-ontologies) interface and / or edit it manually using the [[wiki links]] for nodes and [tags] for relationship types. \n\n[![InfraNodus knowledge graph](https://infranodus.com/images/front/blog/reasoning-knowledge-graph-infranodus.png)](https://support.noduslabs.com/hc/en-us/articles/21429518472988-Using-Knowledge-Graphs-as-Reasoning-Experts)\n\n**[Learn more on the InfraNodus support portal](https://support.noduslabs.com/hc/en-us/articles/21429518472988-Using-Knowledge-Graphs-as-Reasoning-Experts)**\n"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "02353b90-13a1-4624-bc39-391a0dd4a1b0",
  "connections": {
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "Reasoning Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Reasoning Agent": {
      "main": [
        []
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Reasoning Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "Reasoning Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Interaction Dynamics Expert": {
      "ai_tool": [
        [
          {
            "node": "Reasoning Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  }
}