{
  "name": "AI Agent - Multi Language",
  "nodes": [
    {
      "parameters": {
        "options": {}
      },
      "id": "b24b05a7-d802-4413-bfb1-23e1e76f6203",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.1,
      "position": [
        368,
        32
      ],
      "webhookId": "a889d2ae-2159-402f-b326-5f61e90f602e"
    },
    {
      "parameters": {
        "content": "## Multi-Language AI Agent\n\nThis agent detects your language and responds accordingly.\n\nSupports: Polish, English, German, French, Spanish",
        "height": 120,
        "width": 200
      },
      "id": "5592c045-6718-4c4e-9961-ce67a251b6df",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        192,
        -48
      ]
    },
    {
      "parameters": {
        "options": {}
      },
      "id": "d5e60eb2-267c-4f68-aefe-439031bcaceb",
      "name": "OpenAI Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1,
      "position": [
        512,
        240
      ],
      "credentials": {
        "openAiApi": {
          "id": "8KOw1KW8PQBPIJU1",
          "name": "OpenAi account"
        }
      }
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=## Language Detection and Response System\n\n### Step 1: Detect User Language\nFirst, analyze the user's message to determine their language:\n- Polish: Contains words like 'cześć', 'witam', 'dziękuję', 'proszę', 'możesz', 'mi', 'to', 'lekko', 'przebudować'\n- English: Contains words like 'hello', 'hi', 'help', 'can you', 'please', 'thank you'\n- German: Contains words like 'hallo', 'guten', 'können', 'sie', 'bitte', 'danke'\n- French: Contains words like 'bonjour', 'salut', 'pouvez', 'vous', 's'il vous plaît', 'merci'\n- Spanish: Contains words like 'hola', 'buenos', 'puedes', 'por favor', 'gracias'\n\n### Step 2: Respond in Detected Language\nBased on the detected language, respond appropriately:\n\n**If Polish detected:**\n- Greet: \"Cześć! Jak mogę Ci pomóc?\"\n- Be helpful and friendly in Polish\n- Use informal 'ty' form\n\n**If English detected:**\n- Greet: \"Hello! How can I help you today?\"\n- Be professional and helpful in English\n\n**If German detected:**\n- Greet: \"Hallo! Wie kann ich Ihnen helfen?\"\n- Be polite and helpful in German\n\n**If French detected:**\n- Greet: \"Bonjour! Comment puis-je vous aider?\"\n- Be courteous and helpful in French\n\n**If Spanish detected:**\n- Greet: \"¡Hola! ¿Cómo puedo ayudarte?\"\n- Be friendly and helpful in Spanish\n\n**If language unclear:**\n- Default to English: \"Hello! I can help you in multiple languages. Please let me know what you need.\"\n\n### Step 3: Provide Helpful Assistance\nOnce language is established, help the user with:\n- General questions and information\n- n8n workflow assistance\n- Technical support\n- Any other requests\n\n### Important Rules:\n- ALWAYS respond in the same language as the user's message\n- Be helpful and engaging\n- Don't ignore any user messages\n- If you're unsure about language, ask politely in English\n- Keep responses concise but informative\n\n# User Message:\n{{ $json.chatInput }}",
        "options": {
          "systemMessage": "=You are a helpful multi-language AI assistant. Your primary goal is to:\n\n1. **Detect the user's language** from their message\n2. **Respond in the same language** as the user\n3. **Be helpful and engaging** - never ignore user messages\n4. **Provide useful assistance** for any questions or requests\n\nKey behaviors:\n- Always acknowledge the user's message\n- Respond in their detected language\n- Be friendly and professional\n- Offer specific help based on their needs\n- If language is unclear, default to English but ask for clarification\n\nNever ignore or dismiss user messages. Always provide a helpful response."
        }
      },
      "id": "41174c8a-6ac8-42bd-900e-ca15196600c5",
      "name": "Multi-Language Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.7,
      "position": [
        592,
        32
      ]
    }
  ],
  "pinData": {},
  "connections": {
    "When chat message received": {
      "main": [
        [
          {
            "node": "Multi-Language Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Model": {
      "ai_languageModel": [
        [
          {
            "node": "Multi-Language Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "40c9fcdb-5331-49d8-a69b-589eaddb7af4",
  "meta": {
    "templateId": "multi-language-ai-agent",
    "templateCredsSetupCompleted": true,
    "instanceId": "7e11a34c2d5ca5344c09b6b1255849fa22da181f506cd70c61f6c8dec02ad1c2"
  },
  "id": "Te9HrQeGmt2BRECY",
  "tags": ["multi-language", "ai-agent", "polish", "english"]
}