@memberjunction/actions-content-autotag 2.43.0 → 2.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +222 -0
- package/package.json +7 -7
package/README.md
ADDED
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
# @memberjunction/actions-content-autotag
|
|
2
|
+
|
|
3
|
+
Action classes that execute content autotagging and vectorization operations within the MemberJunction framework.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
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.
|
|
8
|
+
|
|
9
|
+
## Purpose
|
|
10
|
+
|
|
11
|
+
This package serves as a bridge between MemberJunction's content autotagging system and the action framework, allowing you to:
|
|
12
|
+
|
|
13
|
+
- Automatically tag content from multiple sources (file system, RSS feeds, websites)
|
|
14
|
+
- Vectorize tagged content for semantic search and AI applications
|
|
15
|
+
- Execute both operations through a single, configurable action
|
|
16
|
+
- Integrate content processing into automated workflows
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install @memberjunction/actions-content-autotag
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
### Basic Usage
|
|
27
|
+
|
|
28
|
+
The package exports the `AutotagAndVectorizeContentAction` class, which can be executed through the MemberJunction action framework:
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
import { AutotagAndVectorizeContentAction } from '@memberjunction/actions-content-autotag';
|
|
32
|
+
import { RunActionParams } from '@memberjunction/actions-base';
|
|
33
|
+
|
|
34
|
+
// Configure the action parameters
|
|
35
|
+
const actionParams: RunActionParams = {
|
|
36
|
+
ActionName: 'Autotag And Vectorize Content',
|
|
37
|
+
ContextUser: userInfo, // Your UserInfo instance
|
|
38
|
+
Params: [
|
|
39
|
+
{
|
|
40
|
+
Name: 'Autotag',
|
|
41
|
+
Value: 1 // Set to 1 to enable autotagging
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
Name: 'Vectorize',
|
|
45
|
+
Value: 1 // Set to 1 to enable vectorization
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
Name: 'EntityNames',
|
|
49
|
+
Value: 'Documents,Articles,BlogPosts' // Comma-separated list of entities to vectorize
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
// Execute the action
|
|
55
|
+
const action = new AutotagAndVectorizeContentAction();
|
|
56
|
+
const result = await action.RunAction(actionParams);
|
|
57
|
+
|
|
58
|
+
if (result.Success) {
|
|
59
|
+
console.log('Content autotagging and vectorization completed successfully');
|
|
60
|
+
} else {
|
|
61
|
+
console.error('Action failed:', result.Message);
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Registration with Action Framework
|
|
66
|
+
|
|
67
|
+
The action is automatically registered with the MemberJunction action framework using the `@RegisterClass` decorator. It can be invoked by name:
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
import { ActionEngine } from '@memberjunction/actions';
|
|
71
|
+
|
|
72
|
+
const actionEngine = new ActionEngine();
|
|
73
|
+
const result = await actionEngine.RunAction({
|
|
74
|
+
ActionName: 'Autotag And Vectorize Content',
|
|
75
|
+
ContextUser: userInfo,
|
|
76
|
+
Params: [
|
|
77
|
+
{ Name: 'Autotag', Value: 1 },
|
|
78
|
+
{ Name: 'Vectorize', Value: 1 },
|
|
79
|
+
{ Name: 'EntityNames', Value: 'Documents' }
|
|
80
|
+
]
|
|
81
|
+
});
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## API Documentation
|
|
85
|
+
|
|
86
|
+
### AutotagAndVectorizeContentAction
|
|
87
|
+
|
|
88
|
+
The main action class that performs content autotagging and vectorization.
|
|
89
|
+
|
|
90
|
+
#### Parameters
|
|
91
|
+
|
|
92
|
+
| Parameter | Type | Required | Description |
|
|
93
|
+
|-----------|------|----------|-------------|
|
|
94
|
+
| `Autotag` | `number` | Yes | Set to `1` to enable autotagging, `0` to disable |
|
|
95
|
+
| `Vectorize` | `number` | Yes | Set to `1` to enable vectorization, `0` to disable |
|
|
96
|
+
| `EntityNames` | `string` | No* | Comma-separated list of entity names to vectorize (*Required if `Vectorize` is `1`) |
|
|
97
|
+
|
|
98
|
+
#### Return Value
|
|
99
|
+
|
|
100
|
+
Returns an `ActionResultSimple` object:
|
|
101
|
+
|
|
102
|
+
```typescript
|
|
103
|
+
interface ActionResultSimple {
|
|
104
|
+
Success: boolean;
|
|
105
|
+
Message?: string;
|
|
106
|
+
ResultCode: string;
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
- `Success`: `true` if the action completed successfully
|
|
111
|
+
- `Message`: Error message if the action failed
|
|
112
|
+
- `ResultCode`: `"SUCCESS"` or `"FAILED"`
|
|
113
|
+
|
|
114
|
+
### LoadAutotagAndVectorizeContentAction
|
|
115
|
+
|
|
116
|
+
A utility function that ensures the action class is included in the final bundle:
|
|
117
|
+
|
|
118
|
+
```typescript
|
|
119
|
+
import { LoadAutotagAndVectorizeContentAction } from '@memberjunction/actions-content-autotag';
|
|
120
|
+
|
|
121
|
+
// Call this function during application initialization
|
|
122
|
+
LoadAutotagAndVectorizeContentAction();
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## How It Works
|
|
126
|
+
|
|
127
|
+
1. **Autotagging Phase**: When enabled, the action executes three autotagging operations in sequence:
|
|
128
|
+
- `AutotagLocalFileSystem`: Processes files from configured local directories
|
|
129
|
+
- `AutotagRSSFeed`: Processes content from configured RSS feeds
|
|
130
|
+
- `AutotagWebsite`: Processes content from configured websites
|
|
131
|
+
|
|
132
|
+
2. **Vectorization Phase**: When enabled, the action:
|
|
133
|
+
- Inherits functionality from `VectorizeEntityAction`
|
|
134
|
+
- Processes the specified entities from the `EntityNames` parameter
|
|
135
|
+
- Creates vector embeddings for the content using configured AI models
|
|
136
|
+
|
|
137
|
+
## Dependencies
|
|
138
|
+
|
|
139
|
+
This package depends on several MemberJunction packages:
|
|
140
|
+
|
|
141
|
+
- `@memberjunction/global`: Core global utilities and registration system
|
|
142
|
+
- `@memberjunction/core`: Core MemberJunction functionality
|
|
143
|
+
- `@memberjunction/core-entities`: Entity definitions and management
|
|
144
|
+
- `@memberjunction/actions`: Base action framework
|
|
145
|
+
- `@memberjunction/core-actions`: Core action implementations including `VectorizeEntityAction`
|
|
146
|
+
- `@memberjunction/content-autotagging`: Content autotagging implementations
|
|
147
|
+
|
|
148
|
+
## Configuration
|
|
149
|
+
|
|
150
|
+
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.
|
|
151
|
+
|
|
152
|
+
## Error Handling
|
|
153
|
+
|
|
154
|
+
The action implements comprehensive error handling:
|
|
155
|
+
|
|
156
|
+
- Missing required parameters throw an error before processing begins
|
|
157
|
+
- Any errors during autotagging or vectorization are caught and returned in the result
|
|
158
|
+
- The action returns a failed result with the error message rather than throwing exceptions
|
|
159
|
+
|
|
160
|
+
## Integration with MemberJunction
|
|
161
|
+
|
|
162
|
+
This action integrates seamlessly with:
|
|
163
|
+
|
|
164
|
+
- **Action Framework**: Registered as a named action that can be invoked programmatically or through workflows
|
|
165
|
+
- **Entity System**: Works with MemberJunction entities for vectorization
|
|
166
|
+
- **AI/Vector System**: Leverages the MemberJunction AI vector synchronization for embedding generation
|
|
167
|
+
- **User Context**: Respects user permissions and context throughout execution
|
|
168
|
+
|
|
169
|
+
## Best Practices
|
|
170
|
+
|
|
171
|
+
1. **Parameter Validation**: Always provide both `Autotag` and `Vectorize` parameters, even if setting one to `0`
|
|
172
|
+
2. **Entity Selection**: Only specify entities in `EntityNames` that have been configured for vectorization
|
|
173
|
+
3. **Performance**: Consider the volume of content when running both operations together
|
|
174
|
+
4. **Monitoring**: Check console logs for progress updates during execution
|
|
175
|
+
5. **Error Recovery**: Implement retry logic for failed operations in production environments
|
|
176
|
+
|
|
177
|
+
## Examples
|
|
178
|
+
|
|
179
|
+
### Autotag Only
|
|
180
|
+
|
|
181
|
+
```typescript
|
|
182
|
+
const result = await action.RunAction({
|
|
183
|
+
ActionName: 'Autotag And Vectorize Content',
|
|
184
|
+
ContextUser: userInfo,
|
|
185
|
+
Params: [
|
|
186
|
+
{ Name: 'Autotag', Value: 1 },
|
|
187
|
+
{ Name: 'Vectorize', Value: 0 }
|
|
188
|
+
]
|
|
189
|
+
});
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Vectorize Only
|
|
193
|
+
|
|
194
|
+
```typescript
|
|
195
|
+
const result = await action.RunAction({
|
|
196
|
+
ActionName: 'Autotag And Vectorize Content',
|
|
197
|
+
ContextUser: userInfo,
|
|
198
|
+
Params: [
|
|
199
|
+
{ Name: 'Autotag', Value: 0 },
|
|
200
|
+
{ Name: 'Vectorize', Value: 1 },
|
|
201
|
+
{ Name: 'EntityNames', Value: 'Documents,KnowledgeBase' }
|
|
202
|
+
]
|
|
203
|
+
});
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Full Pipeline
|
|
207
|
+
|
|
208
|
+
```typescript
|
|
209
|
+
const result = await action.RunAction({
|
|
210
|
+
ActionName: 'Autotag And Vectorize Content',
|
|
211
|
+
ContextUser: userInfo,
|
|
212
|
+
Params: [
|
|
213
|
+
{ Name: 'Autotag', Value: 1 },
|
|
214
|
+
{ Name: 'Vectorize', Value: 1 },
|
|
215
|
+
{ Name: 'EntityNames', Value: 'Documents,Articles,BlogPosts,KnowledgeBase' }
|
|
216
|
+
]
|
|
217
|
+
});
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
## License
|
|
221
|
+
|
|
222
|
+
ISC
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/actions-content-autotag",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.44.0",
|
|
4
4
|
"description": "Action classes that execute the content autotagging and vectorization actions.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
"typescript": "^5.4.5"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@memberjunction/global": "2.
|
|
23
|
-
"@memberjunction/core": "2.
|
|
24
|
-
"@memberjunction/core-entities": "2.
|
|
25
|
-
"@memberjunction/actions": "2.
|
|
26
|
-
"@memberjunction/core-actions": "2.
|
|
27
|
-
"@memberjunction/content-autotagging": "2.
|
|
22
|
+
"@memberjunction/global": "2.44.0",
|
|
23
|
+
"@memberjunction/core": "2.44.0",
|
|
24
|
+
"@memberjunction/core-entities": "2.44.0",
|
|
25
|
+
"@memberjunction/actions": "2.44.0",
|
|
26
|
+
"@memberjunction/core-actions": "2.44.0",
|
|
27
|
+
"@memberjunction/content-autotagging": "2.44.0",
|
|
28
28
|
"axios": "^1.7.2"
|
|
29
29
|
}
|
|
30
30
|
}
|