npm package: @potnoddle/n8n-nodes-custom_llm_nodes
Description: Custom n8n nodes for LLM workflows.
Author: potnoddle
Latest version: 1.0.1

# @potnoddle/n8n-nodes-article-gen

A comprehensive suite of custom n8n nodes designed to power advanced AI agent workflows. These nodes handle complex data normalization, prompt rendering, and robust LLM output parsing, offloading logic from your agents to Ensure reliable automation.

## 📦 Included Nodes

### 1. 🔍 Universal Data Lookup
Dynamically searches across inconsistent JSON data structures without complex expression logic.
*   **Problem**: APIs return data in different shapes: Lists `[{id:1}]`, Grouped Dictionaries `{ "Category": [{id:1}] }`, or Key-Value Maps `{ "id_1": {name...} }`.
*   **Solution**: This node automatically detects the structure and finds your item.
*   **Modes**: 
    *   **Auto-Detect**: Smartly identifies the structure.
    *   **Flat/Grouped/Key-Value**: Manual overrides.
    *   **Return**: Get just the item, or the item plus its category key.

### 2. 📝 Nunjucks Prompt Renderer
Renders complex text prompts using the Nunjucks engine (Jinja2 compatible).
*   **Why**: Standard n8n expressions don't support logic like `{% if variable %}...{% endif %}` which is common in professional prompt engineering.
*   **Features**: 
    *   Supports full Jinja2/Nunjucks syntax.
    *   Inject n8n JSON data directly into templates.
    *   Perfect for dynamic system prompts.

### 3. 🤖 Smart JSON Parser
Robustly parses JSON outputs from Large Language Models (LLMs).
*   **Problem**: LLMs often wrap JSON in Markdown code fences (e.g., ` ```json { ... } ``` `) or add conversational text, breaking standard JSON parsers.
*   **Solution**: automatic regex cleaning strips markdown fences and extracts the valid JSON block before parsing.

### 4. 🧹 Content Cleaner
Sanitizes raw AI text outputs for production use.
*   **Function**: Strips "chain-of-thought" markers or specific boundary lines (e.g., `START TASK OUTPUT`, `*** END ***`).
*   **Result**: Clean, usable content ready for publishing or the next agent.

### 5. 🖼️ Image Gen Utility
Specialized pre-processing for AI Image Generation prompts.
*   **Features**:
    *   Extracts the specific prompt from verbose LLM explanations.
    *   **Acronym Filter**: Options to strip filler words and keep style keywords/acronyms.
    *   Isolates content between specific generation markers.

### 6. 🔍 SEO Toolkit
Utilities for content validation and optimization.
*   **Operations**:
    *   **Analyze**: detailed Keyword Density analysis.
    *   **Validate**: Checks HTML/Markdown structure (e.g., ensuring mostly one H1, proper hierarchy).

### 7. 🏛️ ArXiv Search
Standardized interface for academic research.
*   **Features**:
    *   Directly query the ArXiv API.
    *   Filter by category, author, or title.
    *   Returns structured JSON citations.

---

## 🚀 Installation

### Option 1: Community Node (Recommended)
1.  In your n8n instance, go to **Settings** > **Community Nodes**.
2.  Click **Install**.
3.  Enter the package name: `@potnoddle/n8n-nodes-article-gen`.
4.  Click **Install**.

### Option 2: Manual / Local Development
If you want to modify these nodes or run them locally:

1.  **Clone the Repository**:
    ```bash
    git clone https://github.com/potnoddle/n8n-nodes.git
    cd n8n-nodes
    ```

2.  **Install Dependencies & Build**:
    ```bash
    npm install
    npm run build
    ```

3.  **Link to n8n**:
    *   In this directory: `npm link`
    *   Go to your n8n configuration directory (usually `~/.n8n/custom`):
        ```bash
        cd ~/.n8n/custom
        npm link @potnoddle/n8n-nodes-article-gen
        ```
    *   Start n8n: `n8n start`

### Option 3: Docker
Map the volume to your n8n container:
```yaml
volumes:
  - ./path/to/n8n-nodes/dist:/home/node/.n8n/custom/node_modules/@potnoddle/n8n-nodes-article-gen
```

## 🛠️ Development

*   **Build**: `npm run build` - Compiles TypeScript to JavaScript in `dist/`.
*   **Watch**: `npm run dev` - Watches for changes and recompiles.

## License
MIT