JSPM

tenzor-insights

1.1.0
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 2
    • Score
      100M100P100Q78819F
    • License ISC

    Production-ready Node.js package to analyze structured activity logs and generate intelligent business insights using LLM APIs.

    Package Exports

    • tenzor-insights
    • tenzor-insights/dist/index.js

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (tenzor-insights) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    ๐Ÿš€ Tenzor Insights

    Turn raw data into business intelligence โ€” instantly.

    Tenzor Insights is an AI-powered business intelligence engine for CRM, ERP, and any structured data system.
    It transforms activity logs, historical reports, and arbitrary JSON datasets into actionable insights, trend analyses, and decision-ready summaries โ€” powered by OpenAI, Gemini, and Claude.


    โœจ Features

    Feature Description
    ๐Ÿง  AI-Powered Analysis Transforms raw logs into executive-level business insights
    ๐Ÿ“Š Trend Intelligence Compares reports across time to detect business direction
    ๐Ÿ”€ Hybrid Intelligence Analyzes any structured JSON data without a predefined schema
    โš ๏ธ Risk Detection Identifies anomalies, bottlenecks, and data quality issues
    ๐Ÿ“ˆ Growth Signals Surfaces pipeline movement, conversions, and stagnation signals
    ๐Ÿค– Multi-Provider Supports OpenAI (GPT), Google Gemini, and Anthropic Claude
    ๐Ÿงฉ Variant Modes ADVISOR, OPERATOR, and EXECUTIVE analytical perspectives

    ๐Ÿง  Modes

    Tenzor Insights operates in three intelligent modes. Choose the one that fits your use case.


    1. ๐Ÿ“‹ Analysis Mode

    Analyze structured activity logs and generate business intelligence reports.

    import { analyzeLogs } from "tenzor-insights";
    
    const report = await analyzeLogs({
      mode: "ANALYSIS",
      provider: "gemini",
      apiKey: process.env.API_KEY,
      model: "gemini-2.0-flash",
      variant: "ADVISOR",   // "ADVISOR" | "OPERATOR" | "EXECUTIVE"
      logs: [ /* your activity logs array */ ],
      limit: 200            // optional โ€” default: 200
    });

    What you get: Summary, priority scores, business impact, growth signals, risks, AI suggestions, notable users, trend indicators, and an executive insight.


    2. ๐Ÿ” Compare Mode

    Compare multiple time-period reports to detect business trends and direction.

    import { analyzeLogs } from "tenzor-insights";
    
    const report = await analyzeLogs({
      mode: "COMPARE",
      provider: "gpt",
      apiKey: process.env.OPENAI_API_KEY,
      model: "gpt-4.1-mini",
      variant: "EXECUTIVE",
      reports: [
        { period: { startDate: "2026-03-01", endDate: "2026-03-07" }, report: { /* week 1 report */ } },
        { period: { startDate: "2026-03-08", endDate: "2026-03-14" }, report: { /* week 2 report */ } }
      ]
    });

    What you get: Trend analysis across periods, improvements, declines, persistent issues, new risks, business trajectory verdict, confidence score, and recommendations.


    3. ๐Ÿ”€ Hybrid Mode

    Analyze any structured JSON dataset โ€” no schema required.
    Tenzor Insights will automatically infer the domain, detect entities and patterns, identify anomalies, and generate targeted business or operational insights.

    import { analyzeLogs } from "tenzor-insights";
    
    const report = await analyzeLogs({
      mode: "HYBRID",
      provider: "gemini",
      apiKey: process.env.API_KEY,
      model: "gemini-2.0-flash",
      data: [ /* any JSON array or object */ ],
      contextHint: "Optional: brief description of what this data represents"
    });

    What you get: Detected domain, entity map, key insights, patterns, time-based trends, anomalies, recommendations, data quality score, and a confidence score.

    How Hybrid Intelligence Works

    Hybrid mode executes a 5-phase intelligence pipeline internally:

    Phase 1 โ†’ Understand the dataset (entities, fields, relationships)
    Phase 2 โ†’ Infer the domain (sales, operations, HR, finance, marketing โ€ฆ)
    Phase 3 โ†’ Detect patterns, time trends, growth/decline, and anomalies
    Phase 4 โ†’ Generate high-quality, data-specific insights and recommendations
    Phase 5 โ†’ Assign a confidence score (0.0 โ€“ 1.0) based on data richness

    Supported domains detected automatically: sales ยท operations ยท hr ยท finance ยท marketing ยท product ยท logistics ยท general ยท unknown

    ๐Ÿ’ก contextHint is optional but helps the engine orient faster. If the hint conflicts with the actual data structure, the engine will override it and explain the discrepancy.


    ๐Ÿ“ฆ Installation

    npm install tenzor-insights

    โš™๏ธ Configuration

    Option Type Required Description
    mode string โœ… "ANALYSIS" | "COMPARE" | "HYBRID"
    provider string โœ… "gpt" | "gemini" | "claude"
    apiKey string โœ… API key for the chosen provider
    model string โœ… Model name (e.g. "gpt-4.1-mini", "gemini-2.0-flash")
    variant string โŒ "ADVISOR" | "OPERATOR" | "EXECUTIVE" โ€” default: "ADVISOR"
    logs array โš ๏ธ Required for ANALYSIS mode
    limit number โŒ Max logs to process in ANALYSIS mode โ€” default: 200
    reports array โš ๏ธ Required for COMPARE mode
    data any โš ๏ธ Required for HYBRID mode โ€” any JSON array or object
    contextHint string โŒ Optional domain hint for HYBRID mode

    ๐Ÿ“ฅ Sample Input

    Analysis Mode

    [
      {
        "action": "CREATE",
        "entity": "lead",
        "timestamp": "2026-03-01T10:00:00Z",
        "actor": { "name": "John", "role": "Sales" }
      },
      {
        "action": "UPDATE",
        "entity": "quote",
        "timestamp": "2026-03-01T11:30:00Z",
        "actor": { "name": "Ali", "role": "Sales" }
      }
    ]

    Hybrid Mode

    Pass any structured dataset โ€” the engine figures out the rest:

    [
      { "order_id": "1001", "customer": "Jane", "total": 299.00, "status": "shipped", "created_at": "2026-03-01" },
      { "order_id": "1002", "customer": "Mark", "total": 149.50, "status": "pending", "created_at": "2026-03-02" }
    ]

    ๐Ÿ“ค Sample Output

    Analysis Mode Output

    {
      "summary": "Low system activity detected with only 3 actions recorded, indicating potential sales stagnation.",
      "priorityScore": { "growth": 7, "risk": 2, "operations": 6 },
      "keyHighlights": [
        "One new lead created โ€” positive pipeline signal.",
        "One quote updated โ€” progress in an existing deal."
      ],
      "businessImpact": [
        "Extremely low activity volume suggests a bottleneck in the sales pipeline."
      ],
      "growthSignals": ["New lead created โ€” potential future conversion."],
      "risksOrConcerns": [
        { "issue": "Critically low activity across all users.", "severity": "MEDIUM" }
      ],
      "aiSuggestions": [
        { "suggestion": "Investigate reasons for low system engagement.", "priority": "HIGH" }
      ],
      "ownerFocus": ["Drive consistent team utilization across all pipeline stages."],
      "notableUsers": ["Ali: 2 of 3 actions โ€” single-user dependency risk."],
      "metrics": { "actionsCount": 3, "activeUsers": 2 },
      "trend": {
        "activityLevel": "LOW",
        "growthDirection": "STABLE",
        "riskLevel": "MEDIUM",
        "operationalHealth": "UNSTABLE"
      },
      "executiveInsight": "Current low activity levels present a direct risk to revenue growth if left unaddressed."
    }

    Hybrid Mode Output

    {
      "detectedDomain": "operations",
      "summary": "Dataset contains 1 order record spanning a medical e-commerce workflow. The order lifecycle is complete but abnormal re-engagement after 77 days and late-stage marketing removal events are key concerns.",
      "entities": [
        {
          "type": "order",
          "count": 1,
          "keyFields": ["order_id", "order_total", "shipping_country"],
          "notes": "Single order with full lifecycle tracked via nested timeline."
        }
      ],
      "keyInsights": [
        {
          "insight": "Order completed full lifecycle from checkout to shipment within 4 days โ€” efficient fulfillment.",
          "category": "operational"
        },
        {
          "insight": "Customer re-engaged 77 days post-shipment, triggering marketing removal โ€” churn signal.",
          "category": "business"
        }
      ],
      "patternsDetected": [
        { "pattern": "Repeated member logins within short windows suggest engagement but possible confusion.", "significance": "MEDIUM" }
      ],
      "trends": {
        "hasTimestamps": true,
        "timeRange": "2026-01-18 to 2026-04-07",
        "direction": "STABLE",
        "peakPeriod": "2026-01-20",
        "notes": "Most activity concentrated in first 4 days; long gap before customer re-engagement."
      },
      "anomalies": [
        { "description": "ORDER_WELCOME_SMS sent with null order_id โ€” broken event linkage.", "severity": "HIGH", "affectedRecords": 1 }
      ],
      "recommendations": [
        {
          "action": "Fix null order_id in SMS events to ensure accurate tracking.",
          "priority": "HIGH",
          "rationale": "Broken event linkage compromises downstream analytics and customer communication attribution."
        }
      ],
      "metrics": { "totalRecords": 1, "timelineEvents": 33 },
      "dataQuality": { "score": 0.72, "issues": ["Null order_id in 2 external events", "Empty reference_id fields"] },
      "confidence": 0.78
    }

    ๐Ÿค– Supported Providers

    Provider Parameter Example Models
    OpenAI "gpt" or "openai" gpt-4.1, gpt-4.1-mini, gpt-4o
    Google Gemini "gemini" gemini-2.0-flash, gemini-1.5-pro
    Anthropic Claude "claude" claude-3-5-sonnet, claude-3-haiku

    ๐ŸŽฏ Use Cases

    Mode Use Case
    ANALYSIS CRM log analysis, ERP activity monitoring, sales pipeline review, team performance tracking
    COMPARE Week-over-week trend reporting, sprint retrospectives, monthly business reviews
    HYBRID Order intelligence, support ticket analysis, logistics monitoring, HR data review, any custom JSON dataset

    ๐Ÿš€ Why Tenzor Insights?

    Most analytics tools show you data. Tenzor Insights tells you what it means.

    Without Tenzor Insights With Tenzor Insights
    Raw logs Executive-ready insights
    Numbers Business context
    Activity data Growth signals & risk flags
    Unknown JSON Auto-detected domain intelligence

    ๐Ÿ›ฃ๏ธ Roadmap

    • ๐Ÿ”ฎ Predictive insights and forecasting
    • ๐Ÿ“Š Dashboard & BI tool integrations
    • โšก Real-time alerting
    • ๐Ÿ“… Scheduled intelligence reports (weekly / monthly)
    • ๐Ÿ”— Native CRM connectors (Salesforce, HubSpot)

    ๐Ÿ“„ License

    ISC ยฉ Greyloops