2.48.0 • Published 9 months ago

@memberjunction/actions-content-autotag v2.48.0

Weekly downloads
-
License
ISC
Repository
-
Last release
9 months ago

@memberjunction/actions-content-autotag

Action classes that execute content autotagging and vectorization operations within the MemberJunction framework.

Overview

The @memberjunction/actions-content-autotag package provides an action class that combines content autotagging and vectorization capabilities. It automates the process of tagging content from various sources (local file system, RSS feeds, and websites) and then optionally vectorizing the tagged content for use in AI/ML applications.

Purpose

This package serves as a bridge between MemberJunction's content autotagging system and the action framework, allowing you to:

  • Automatically tag content from multiple sources (file system, RSS feeds, websites)
  • Vectorize tagged content for semantic search and AI applications
  • Execute both operations through a single, configurable action
  • Integrate content processing into automated workflows

Installation

npm install @memberjunction/actions-content-autotag

Usage

Basic Usage

The package exports the AutotagAndVectorizeContentAction class, which can be executed through the MemberJunction action framework:

import { AutotagAndVectorizeContentAction } from '@memberjunction/actions-content-autotag';
import { RunActionParams } from '@memberjunction/actions-base';

// Configure the action parameters
const actionParams: RunActionParams = {
    ActionName: 'Autotag And Vectorize Content',
    ContextUser: userInfo, // Your UserInfo instance
    Params: [
        {
            Name: 'Autotag',
            Value: 1  // Set to 1 to enable autotagging
        },
        {
            Name: 'Vectorize',
            Value: 1  // Set to 1 to enable vectorization
        },
        {
            Name: 'EntityNames',
            Value: 'Documents,Articles,BlogPosts'  // Comma-separated list of entities to vectorize
        }
    ]
};

// Execute the action
const action = new AutotagAndVectorizeContentAction();
const result = await action.RunAction(actionParams);

if (result.Success) {
    console.log('Content autotagging and vectorization completed successfully');
} else {
    console.error('Action failed:', result.Message);
}

Registration with Action Framework

The action is automatically registered with the MemberJunction action framework using the @RegisterClass decorator. It can be invoked by name:

import { ActionEngine } from '@memberjunction/actions';

const actionEngine = new ActionEngine();
const result = await actionEngine.RunAction({
    ActionName: 'Autotag And Vectorize Content',
    ContextUser: userInfo,
    Params: [
        { Name: 'Autotag', Value: 1 },
        { Name: 'Vectorize', Value: 1 },
        { Name: 'EntityNames', Value: 'Documents' }
    ]
});

API Documentation

AutotagAndVectorizeContentAction

The main action class that performs content autotagging and vectorization.

Parameters

ParameterTypeRequiredDescription
AutotagnumberYesSet to 1 to enable autotagging, 0 to disable
VectorizenumberYesSet to 1 to enable vectorization, 0 to disable
EntityNamesstringNo*Comma-separated list of entity names to vectorize (*Required if Vectorize is 1)

Return Value

Returns an ActionResultSimple object:

interface ActionResultSimple {
    Success: boolean;
    Message?: string;
    ResultCode: string;
}
  • Success: true if the action completed successfully
  • Message: Error message if the action failed
  • ResultCode: "SUCCESS" or "FAILED"

LoadAutotagAndVectorizeContentAction

A utility function that ensures the action class is included in the final bundle:

import { LoadAutotagAndVectorizeContentAction } from '@memberjunction/actions-content-autotag';

// Call this function during application initialization
LoadAutotagAndVectorizeContentAction();

How It Works

  1. Autotagging Phase: When enabled, the action executes three autotagging operations in sequence:

    • AutotagLocalFileSystem: Processes files from configured local directories
    • AutotagRSSFeed: Processes content from configured RSS feeds
    • AutotagWebsite: Processes content from configured websites
  2. Vectorization Phase: When enabled, the action:

    • Inherits functionality from VectorizeEntityAction
    • Processes the specified entities from the EntityNames parameter
    • Creates vector embeddings for the content using configured AI models

Dependencies

This package depends on several MemberJunction packages:

  • @memberjunction/global: Core global utilities and registration system
  • @memberjunction/core: Core MemberJunction functionality
  • @memberjunction/core-entities: Entity definitions and management
  • @memberjunction/actions: Base action framework
  • @memberjunction/core-actions: Core action implementations including VectorizeEntityAction
  • @memberjunction/content-autotagging: Content autotagging implementations

Configuration

The autotagging sources (file paths, RSS feeds, websites) are configured through the respective autotagging classes. Refer to the @memberjunction/content-autotagging package documentation for detailed configuration options.

Error Handling

The action implements comprehensive error handling:

  • Missing required parameters throw an error before processing begins
  • Any errors during autotagging or vectorization are caught and returned in the result
  • The action returns a failed result with the error message rather than throwing exceptions

Integration with MemberJunction

This action integrates seamlessly with:

  • Action Framework: Registered as a named action that can be invoked programmatically or through workflows
  • Entity System: Works with MemberJunction entities for vectorization
  • AI/Vector System: Leverages the MemberJunction AI vector synchronization for embedding generation
  • User Context: Respects user permissions and context throughout execution

Best Practices

  1. Parameter Validation: Always provide both Autotag and Vectorize parameters, even if setting one to 0
  2. Entity Selection: Only specify entities in EntityNames that have been configured for vectorization
  3. Performance: Consider the volume of content when running both operations together
  4. Monitoring: Check console logs for progress updates during execution
  5. Error Recovery: Implement retry logic for failed operations in production environments

Examples

Autotag Only

const result = await action.RunAction({
    ActionName: 'Autotag And Vectorize Content',
    ContextUser: userInfo,
    Params: [
        { Name: 'Autotag', Value: 1 },
        { Name: 'Vectorize', Value: 0 }
    ]
});

Vectorize Only

const result = await action.RunAction({
    ActionName: 'Autotag And Vectorize Content',
    ContextUser: userInfo,
    Params: [
        { Name: 'Autotag', Value: 0 },
        { Name: 'Vectorize', Value: 1 },
        { Name: 'EntityNames', Value: 'Documents,KnowledgeBase' }
    ]
});

Full Pipeline

const result = await action.RunAction({
    ActionName: 'Autotag And Vectorize Content',
    ContextUser: userInfo,
    Params: [
        { Name: 'Autotag', Value: 1 },
        { Name: 'Vectorize', Value: 1 },
        { Name: 'EntityNames', Value: 'Documents,Articles,BlogPosts,KnowledgeBase' }
    ]
});

License

ISC

2.29.0

12 months ago

2.27.1

12 months ago

2.29.2

12 months ago

2.29.1

12 months ago

2.25.0

1 year ago

2.23.2

1 year ago

2.46.0

9 months ago

2.23.1

1 year ago

2.48.0

9 months ago

2.27.0

12 months ago

2.32.0

11 months ago

2.34.0

10 months ago

2.32.2

11 months ago

2.32.1

11 months ago

2.30.0

11 months ago

2.19.4

1 year ago

2.19.5

1 year ago

2.19.2

1 year ago

2.19.3

1 year ago

2.19.0

1 year ago

2.19.1

1 year ago

2.17.0

1 year ago

2.15.2

1 year ago

2.13.4

1 year ago

2.36.0

10 months ago

2.34.2

10 months ago

2.13.2

1 year ago

2.34.1

10 months ago

2.13.3

1 year ago

2.38.0

10 months ago

2.13.0

1 year ago

2.36.1

10 months ago

2.13.1

1 year ago

2.43.0

9 months ago

2.20.2

1 year ago

2.20.3

1 year ago

2.45.0

9 months ago

2.22.1

1 year ago

2.20.0

1 year ago

2.22.0

1 year ago

2.20.1

1 year ago

2.41.0

9 months ago

2.28.0

12 months ago

2.47.0

9 months ago

2.24.1

1 year ago

2.24.0

1 year ago

2.22.2

1 year ago

2.26.1

1 year ago

2.26.0

1 year ago

2.31.0

11 months ago

2.12.0

1 year ago

2.33.0

10 months ago

2.18.3

1 year ago

2.18.1

1 year ago

2.39.0

10 months ago

2.18.2

1 year ago

2.16.1

1 year ago

2.18.0

1 year ago

2.35.1

10 months ago

2.35.0

10 months ago

2.16.0

1 year ago

2.37.1

10 months ago

2.37.0

10 months ago

2.14.0

1 year ago

2.42.1

9 months ago

2.21.0

1 year ago

2.42.0

9 months ago

2.23.0

1 year ago

2.44.0

9 months ago

2.40.0

9 months ago

2.11.0

1 year ago

2.10.0

1 year ago

2.9.0

1 year ago

2.8.0

1 year ago

2.7.0

1 year ago

2.6.1

1 year ago

2.5.2

1 year ago

2.6.0

1 year ago

2.7.1

1 year ago

2.5.1

1 year ago

2.5.0

1 year ago