@n8n/ai-workflow-builder 0.28.0 → 0.29.1
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/dist/build.tsbuildinfo +1 -1
- package/dist/chains/prompt-categorization.d.ts +3 -0
- package/dist/chains/prompt-categorization.js +109 -0
- package/dist/chains/prompt-categorization.js.map +1 -0
- package/dist/chains/test/integration/test-helpers.d.ts +3 -0
- package/dist/chains/test/integration/test-helpers.js +16 -0
- package/dist/chains/test/integration/test-helpers.js.map +1 -0
- package/dist/tools/best-practices/chatbot.d.ts +7 -0
- package/dist/tools/best-practices/chatbot.js +118 -0
- package/dist/tools/best-practices/chatbot.js.map +1 -0
- package/dist/tools/best-practices/content-generation.d.ts +7 -0
- package/dist/tools/best-practices/content-generation.js +79 -0
- package/dist/tools/best-practices/content-generation.js.map +1 -0
- package/dist/tools/best-practices/data-extraction.d.ts +7 -0
- package/dist/tools/best-practices/data-extraction.js +105 -0
- package/dist/tools/best-practices/data-extraction.js.map +1 -0
- package/dist/tools/best-practices/form-input.d.ts +7 -0
- package/dist/tools/best-practices/form-input.js +173 -0
- package/dist/tools/best-practices/form-input.js.map +1 -0
- package/dist/tools/best-practices/index.d.ts +3 -0
- package/dist/tools/best-practices/index.js +27 -0
- package/dist/tools/best-practices/index.js.map +1 -0
- package/dist/tools/best-practices/scraping-and-research.d.ts +7 -0
- package/dist/tools/best-practices/scraping-and-research.js +147 -0
- package/dist/tools/best-practices/scraping-and-research.js.map +1 -0
- package/dist/tools/builder-tools.js +6 -0
- package/dist/tools/builder-tools.js.map +1 -1
- package/dist/tools/categorize-prompt.tool.d.ts +5 -0
- package/dist/tools/categorize-prompt.tool.js +84 -0
- package/dist/tools/categorize-prompt.tool.js.map +1 -0
- package/dist/tools/engines/node-search-engine.d.ts +0 -9
- package/dist/tools/engines/node-search-engine.js +52 -72
- package/dist/tools/engines/node-search-engine.js.map +1 -1
- package/dist/tools/get-best-practices.tool.d.ts +33 -0
- package/dist/tools/get-best-practices.tool.js +94 -0
- package/dist/tools/get-best-practices.tool.js.map +1 -0
- package/dist/tools/prompts/main-agent.prompt.js +23 -5
- package/dist/tools/prompts/main-agent.prompt.js.map +1 -1
- package/dist/tools/validate-workflow.tool.js +0 -16
- package/dist/tools/validate-workflow.tool.js.map +1 -1
- package/dist/types/best-practices.d.ts +6 -0
- package/dist/types/best-practices.js +3 -0
- package/dist/types/best-practices.js.map +1 -0
- package/dist/types/categorization.d.ts +23 -0
- package/dist/types/categorization.js +38 -0
- package/dist/types/categorization.js.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/tools.d.ts +4 -0
- package/dist/utils/stream-processor.js +85 -58
- package/dist/utils/stream-processor.js.map +1 -1
- package/dist/validation/checks/agent-prompt.js +1 -1
- package/dist/validation/checks/agent-prompt.js.map +1 -1
- package/dist/validation/checks/connections.js +32 -1
- package/dist/validation/checks/connections.js.map +1 -1
- package/dist/workflow-state.d.ts +1 -1
- package/dist/workflow-state.js.map +1 -1
- package/package.json +9 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-input.js","sourceRoot":"","sources":["../../../src/tools/best-practices/form-input.ts"],"names":[],"mappings":";;;AACA,2DAA2D;AAE3D,MAAa,sBAAsB;IACzB,SAAS,GAAG,kCAAiB,CAAC,UAAU,CAAC;IACzC,OAAO,GAAG,OAAO,CAAC;IAEV,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+JjC,CAAC;IAED,gBAAgB;QACf,OAAO,IAAI,CAAC,aAAa,CAAC;IAC3B,CAAC;CACD;AAxKD,wDAwKC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.documentation = void 0;
|
|
4
|
+
const categorization_1 = require("../../types/categorization");
|
|
5
|
+
const chatbot_1 = require("./chatbot");
|
|
6
|
+
const content_generation_1 = require("./content-generation");
|
|
7
|
+
const data_extraction_1 = require("./data-extraction");
|
|
8
|
+
const form_input_1 = require("./form-input");
|
|
9
|
+
const scraping_and_research_1 = require("./scraping-and-research");
|
|
10
|
+
exports.documentation = {
|
|
11
|
+
[categorization_1.WorkflowTechnique.SCRAPING_AND_RESEARCH]: new scraping_and_research_1.ScrapingAndResearchBestPractices(),
|
|
12
|
+
[categorization_1.WorkflowTechnique.CHATBOT]: new chatbot_1.ChatbotBestPractices(),
|
|
13
|
+
[categorization_1.WorkflowTechnique.CONTENT_GENERATION]: new content_generation_1.ContentGenerationBestPractices(),
|
|
14
|
+
[categorization_1.WorkflowTechnique.DATA_EXTRACTION]: new data_extraction_1.DataExtractionBestPractices(),
|
|
15
|
+
[categorization_1.WorkflowTechnique.FORM_INPUT]: new form_input_1.FormInputBestPractices(),
|
|
16
|
+
[categorization_1.WorkflowTechnique.DATA_ANALYSIS]: undefined,
|
|
17
|
+
[categorization_1.WorkflowTechnique.DATA_TRANSFORMATION]: undefined,
|
|
18
|
+
[categorization_1.WorkflowTechnique.DOCUMENT_PROCESSING]: undefined,
|
|
19
|
+
[categorization_1.WorkflowTechnique.ENRICHMENT]: undefined,
|
|
20
|
+
[categorization_1.WorkflowTechnique.HUMAN_IN_THE_LOOP]: undefined,
|
|
21
|
+
[categorization_1.WorkflowTechnique.KNOWLEDGE_BASE]: undefined,
|
|
22
|
+
[categorization_1.WorkflowTechnique.MONITORING]: undefined,
|
|
23
|
+
[categorization_1.WorkflowTechnique.NOTIFICATION]: undefined,
|
|
24
|
+
[categorization_1.WorkflowTechnique.SCHEDULING]: undefined,
|
|
25
|
+
[categorization_1.WorkflowTechnique.TRIAGE]: undefined,
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/best-practices/index.ts"],"names":[],"mappings":";;;AACA,2DAAuF;AAEvF,uCAAiD;AACjD,6DAAsE;AACtE,uDAAgE;AAChE,6CAAsD;AACtD,mEAA2E;AAE9D,QAAA,aAAa,GAAqE;IAC9F,CAAC,kCAAiB,CAAC,qBAAqB,CAAC,EAAE,IAAI,wDAAgC,EAAE;IACjF,CAAC,kCAAiB,CAAC,OAAO,CAAC,EAAE,IAAI,8BAAoB,EAAE;IACvD,CAAC,kCAAiB,CAAC,kBAAkB,CAAC,EAAE,IAAI,mDAA8B,EAAE;IAC5E,CAAC,kCAAiB,CAAC,eAAe,CAAC,EAAE,IAAI,6CAA2B,EAAE;IACtE,CAAC,kCAAiB,CAAC,UAAU,CAAC,EAAE,IAAI,mCAAsB,EAAE;IAG5D,CAAC,kCAAiB,CAAC,aAAa,CAAC,EAAE,SAAS;IAC5C,CAAC,kCAAiB,CAAC,mBAAmB,CAAC,EAAE,SAAS;IAClD,CAAC,kCAAiB,CAAC,mBAAmB,CAAC,EAAE,SAAS;IAClD,CAAC,kCAAiB,CAAC,UAAU,CAAC,EAAE,SAAS;IACzC,CAAC,kCAAiB,CAAC,iBAAiB,CAAC,EAAE,SAAS;IAChD,CAAC,kCAAiB,CAAC,cAAc,CAAC,EAAE,SAAS;IAC7C,CAAC,kCAAiB,CAAC,UAAU,CAAC,EAAE,SAAS;IACzC,CAAC,kCAAiB,CAAC,YAAY,CAAC,EAAE,SAAS;IAC3C,CAAC,kCAAiB,CAAC,UAAU,CAAC,EAAE,SAAS;IACzC,CAAC,kCAAiB,CAAC,MAAM,CAAC,EAAE,SAAS;CACrC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { BestPracticesDocument } from '../../types/best-practices';
|
|
2
|
+
export declare class ScrapingAndResearchBestPractices implements BestPracticesDocument {
|
|
3
|
+
readonly technique: "scraping_and_research";
|
|
4
|
+
readonly version = "1.0.0";
|
|
5
|
+
private readonly documentation;
|
|
6
|
+
getDocumentation(): string;
|
|
7
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ScrapingAndResearchBestPractices = void 0;
|
|
4
|
+
const categorization_1 = require("../../types/categorization");
|
|
5
|
+
class ScrapingAndResearchBestPractices {
|
|
6
|
+
technique = categorization_1.WorkflowTechnique.SCRAPING_AND_RESEARCH;
|
|
7
|
+
version = '1.0.0';
|
|
8
|
+
documentation = `# Best Practices: Scraping & Research Workflows
|
|
9
|
+
|
|
10
|
+
## Performance & Resource Management
|
|
11
|
+
|
|
12
|
+
Batch requests and introduce delays to avoid hitting API rate limits or overloading target servers. Use Wait nodes and
|
|
13
|
+
batching options in HTTP Request nodes. When 429 rate limiting errors occur due to receiving too many requests,
|
|
14
|
+
implement batching to reduce request frequency or use the "Retry on Fail" feature to automatically handle throttled
|
|
15
|
+
responses.
|
|
16
|
+
|
|
17
|
+
Workflows processing large datasets can crash due to memory constraints. Use the Split In Batches node to process 200
|
|
18
|
+
rows at a time to reduce memory usage, leverage built-in nodes instead of custom code, and increase execution timeouts
|
|
19
|
+
via environment variables for better resource management.
|
|
20
|
+
|
|
21
|
+
## Looping & Pagination
|
|
22
|
+
|
|
23
|
+
Implement robust looping for paginated data. Use Set, IF, and Code nodes to manage page numbers and loop conditions,
|
|
24
|
+
ensuring you don't miss data or create infinite loops. Leverage n8n's built-in mechanisms rather than manual approaches:
|
|
25
|
+
use the $runIndex variable to track iterations without additional code nodes, and employ workflow static data or node
|
|
26
|
+
run indexes to maintain state across loop cycles.
|
|
27
|
+
|
|
28
|
+
## Recommended Nodes
|
|
29
|
+
|
|
30
|
+
### HTTP Request (n8n-nodes-base.httpRequest)
|
|
31
|
+
|
|
32
|
+
Purpose: Fetches web pages or API data for scraping and research workflows
|
|
33
|
+
|
|
34
|
+
Pitfalls:
|
|
35
|
+
|
|
36
|
+
- Depending on the data which the user wishes to scrape/research, it maybe against the terms of service to attempt to
|
|
37
|
+
fetch it from the site directly. Using scraping nodes is the best way to get around this.
|
|
38
|
+
|
|
39
|
+
Pitfalls:
|
|
40
|
+
|
|
41
|
+
- Double-check URL formatting, query parameters, and ensure all required fields are present to avoid bad request errors
|
|
42
|
+
- Be aware of 429 rate limiting errors when the service receives too many requests - implement batching or use "Retry on
|
|
43
|
+
Fail" feature
|
|
44
|
+
- Refresh expired tokens, verify API keys, and ensure correct permissions to avoid authentication failures
|
|
45
|
+
|
|
46
|
+
### HTML Extract (n8n-nodes-base.htmlExtract)
|
|
47
|
+
|
|
48
|
+
Purpose: Parses HTML and extracts data using CSS selectors for web scraping
|
|
49
|
+
|
|
50
|
+
Pitfalls:
|
|
51
|
+
|
|
52
|
+
- Some sites use JavaScript to render content, which may not be accessible via simple HTTP requests. Consider using
|
|
53
|
+
browser automation tools or APIs if the HTML appears empty
|
|
54
|
+
- Validate that the CSS selectors match the actual page structure to avoid extraction failures
|
|
55
|
+
|
|
56
|
+
### Split Out (n8n-nodes-base.splitOut)
|
|
57
|
+
|
|
58
|
+
Purpose: Processes lists of items one by one for sequential operations
|
|
59
|
+
|
|
60
|
+
Pitfalls:
|
|
61
|
+
- Can cause performance issues with very large datasets - consider using Split In Batches instead
|
|
62
|
+
|
|
63
|
+
### Loop Over Items (Split in Batches) (n8n-nodes-base.splitInBatches)
|
|
64
|
+
|
|
65
|
+
Purpose: Processes lists of items in batches to manage memory and performance
|
|
66
|
+
|
|
67
|
+
Pitfalls:
|
|
68
|
+
- Ensure proper loop configuration to avoid infinite loops or skipped data. The index 0
|
|
69
|
+
(first connection) of the loop is treated as the done state, while the index 1 (second connection)
|
|
70
|
+
is the connection that loops.
|
|
71
|
+
- Use appropriate batch sizes (e.g., 200 rows) to balance memory usage and performance
|
|
72
|
+
|
|
73
|
+
### Edit Fields (Set) (n8n-nodes-base.set)
|
|
74
|
+
|
|
75
|
+
Purpose: Manipulates data, sets variables for loop control and state management
|
|
76
|
+
|
|
77
|
+
### Code (n8n-nodes-base.code)
|
|
78
|
+
|
|
79
|
+
Purpose: Implements custom logic for complex data transformations or pagination
|
|
80
|
+
|
|
81
|
+
Pitfalls:
|
|
82
|
+
|
|
83
|
+
- Prefer built-in nodes over custom code to reduce memory usage and improve maintainability
|
|
84
|
+
- Avoid processing very large datasets in a single code execution - use batching
|
|
85
|
+
|
|
86
|
+
### If (n8n-nodes-base.if)
|
|
87
|
+
|
|
88
|
+
Purpose: Adds conditional logic for error handling, loop control, or data filtering
|
|
89
|
+
|
|
90
|
+
Pitfalls:
|
|
91
|
+
- Validate expressions carefully to avoid unexpected branching behavior
|
|
92
|
+
|
|
93
|
+
### Wait (n8n-nodes-base.wait)
|
|
94
|
+
|
|
95
|
+
Purpose: Introduces delays to respect rate limits and avoid overloading servers
|
|
96
|
+
|
|
97
|
+
### Google Sheets (n8n-nodes-base.googleSheets)
|
|
98
|
+
|
|
99
|
+
Purpose: Stores scraped data in spreadsheets for easy access and sharing
|
|
100
|
+
|
|
101
|
+
### Microsoft Excel 365 (n8n-nodes-base.microsoftExcel)
|
|
102
|
+
|
|
103
|
+
Purpose: Stores scraped data in Excel files for offline analysis
|
|
104
|
+
|
|
105
|
+
### Airtable (n8n-nodes-base.airtable)
|
|
106
|
+
|
|
107
|
+
Purpose: Saves structured data to a database with rich data types and relationships
|
|
108
|
+
|
|
109
|
+
### AI Agent (@n8n/n8n-nodes-langchain.agent)
|
|
110
|
+
|
|
111
|
+
Purpose: For research, summarization, and advanced data extraction. AI agents can autonomously gather information
|
|
112
|
+
from websites, analyze content, and organize findings into structured formats, integrating tools for web scraping,
|
|
113
|
+
content analysis, and database storage
|
|
114
|
+
|
|
115
|
+
### Scraping Nodes
|
|
116
|
+
|
|
117
|
+
- Phantombuster (n8n-nodes-base.phantombuster)
|
|
118
|
+
- Apify (use HTTP Request or community node)
|
|
119
|
+
- BrightData (use HTTP Request or community node)
|
|
120
|
+
|
|
121
|
+
Purpose: If the user wishes to scrap data from sites like LinkedIn, Facebook, Instagram, Twitter/X, Indeed, Glassdoor
|
|
122
|
+
or any other service similar to these large providers it is better to use a node designed for this. The scraping
|
|
123
|
+
nodes provide access to these datasets while avoiding issues like rate limiting or breaking terms of service for
|
|
124
|
+
sites like these.
|
|
125
|
+
|
|
126
|
+
## Common Pitfalls to Avoid
|
|
127
|
+
|
|
128
|
+
Bad Request Errors: Double-check URL formatting, query parameters, and ensure all required fields are present to
|
|
129
|
+
avoid 400 errors when making HTTP requests.
|
|
130
|
+
|
|
131
|
+
Rate Limits: Use batching and Wait nodes to avoid 429 errors. When the service receives too many requests, implement
|
|
132
|
+
batching to reduce request frequency or use the "Retry on Fail" feature.
|
|
133
|
+
|
|
134
|
+
Memory Issues: Avoid processing very large datasets in a single run; use batching and increase server resources if
|
|
135
|
+
needed. Use Split In Batches node to process 200 rows at a time, leverage built-in nodes instead of custom code, and
|
|
136
|
+
increase execution timeouts via environment variables.
|
|
137
|
+
|
|
138
|
+
Empty or Unexpected Data: Some sites use JavaScript to render content, which may not be accessible via simple HTTP
|
|
139
|
+
requests. Standard HTTP and HTML parsing nodes fail because sites load data asynchronously via JavaScript, leaving the
|
|
140
|
+
initial HTML empty of actual content. Web scraping nodes can be used to avoid this.
|
|
141
|
+
`;
|
|
142
|
+
getDocumentation() {
|
|
143
|
+
return this.documentation;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
exports.ScrapingAndResearchBestPractices = ScrapingAndResearchBestPractices;
|
|
147
|
+
//# sourceMappingURL=scraping-and-research.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scraping-and-research.js","sourceRoot":"","sources":["../../../src/tools/best-practices/scraping-and-research.ts"],"names":[],"mappings":";;;AACA,2DAA2D;AAE3D,MAAa,gCAAgC;IACnC,SAAS,GAAG,kCAAiB,CAAC,qBAAqB,CAAC;IACpD,OAAO,GAAG,OAAO,CAAC;IAEV,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqIjC,CAAC;IAED,gBAAgB;QACf,OAAO,IAAI,CAAC,aAAa,CAAC;IAC3B,CAAC;CACD;AA9ID,4EA8IC"}
|
|
@@ -3,7 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getBuilderTools = getBuilderTools;
|
|
4
4
|
exports.getBuilderToolsForDisplay = getBuilderToolsForDisplay;
|
|
5
5
|
const add_node_tool_1 = require("./add-node.tool");
|
|
6
|
+
const categorize_prompt_tool_1 = require("./categorize-prompt.tool");
|
|
6
7
|
const connect_nodes_tool_1 = require("./connect-nodes.tool");
|
|
8
|
+
const get_best_practices_tool_1 = require("./get-best-practices.tool");
|
|
7
9
|
const get_node_parameter_tool_1 = require("./get-node-parameter.tool");
|
|
8
10
|
const node_details_tool_1 = require("./node-details.tool");
|
|
9
11
|
const node_search_tool_1 = require("./node-search.tool");
|
|
@@ -13,6 +15,8 @@ const update_node_parameters_tool_1 = require("./update-node-parameters.tool");
|
|
|
13
15
|
const validate_workflow_tool_1 = require("./validate-workflow.tool");
|
|
14
16
|
function getBuilderTools({ parsedNodeTypes, logger, llmComplexTask, instanceUrl, }) {
|
|
15
17
|
return [
|
|
18
|
+
(0, categorize_prompt_tool_1.createCategorizePromptTool)(llmComplexTask, logger),
|
|
19
|
+
(0, get_best_practices_tool_1.createGetBestPracticesTool)(),
|
|
16
20
|
(0, node_search_tool_1.createNodeSearchTool)(parsedNodeTypes),
|
|
17
21
|
(0, node_details_tool_1.createNodeDetailsTool)(parsedNodeTypes),
|
|
18
22
|
(0, add_node_tool_1.createAddNodeTool)(parsedNodeTypes),
|
|
@@ -26,6 +30,8 @@ function getBuilderTools({ parsedNodeTypes, logger, llmComplexTask, instanceUrl,
|
|
|
26
30
|
}
|
|
27
31
|
function getBuilderToolsForDisplay({ nodeTypes, }) {
|
|
28
32
|
return [
|
|
33
|
+
categorize_prompt_tool_1.CATEGORIZE_PROMPT_TOOL,
|
|
34
|
+
get_best_practices_tool_1.GET_BEST_PRACTICES_TOOL,
|
|
29
35
|
node_search_tool_1.NODE_SEARCH_TOOL,
|
|
30
36
|
node_details_tool_1.NODE_DETAILS_TOOL,
|
|
31
37
|
(0, add_node_tool_1.getAddNodeToolBase)(nodeTypes),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builder-tools.js","sourceRoot":"","sources":["../../src/tools/builder-tools.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"builder-tools.js","sourceRoot":"","sources":["../../src/tools/builder-tools.ts"],"names":[],"mappings":";;AAqBA,0CAwBC;AAOD,8DAgBC;AA9DD,mDAAwE;AACxE,qEAA8F;AAC9F,6DAAkF;AAClF,uEAAgG;AAChG,uEAAgG;AAChG,2DAA+E;AAC/E,yDAA4E;AAC5E,qEAA8F;AAC9F,yDAA4E;AAC5E,+EAGuC;AACvC,qEAA8F;AAE9F,SAAgB,eAAe,CAAC,EAC/B,eAAe,EACf,MAAM,EACN,cAAc,EACd,WAAW,GAMX;IACA,OAAO;QACN,IAAA,mDAA0B,EAAC,cAAc,EAAE,MAAM,CAAC;QAClD,IAAA,oDAA0B,GAAE;QAC5B,IAAA,uCAAoB,EAAC,eAAe,CAAC;QACrC,IAAA,yCAAqB,EAAC,eAAe,CAAC;QACtC,IAAA,iCAAiB,EAAC,eAAe,CAAC;QAClC,IAAA,2CAAsB,EAAC,eAAe,EAAE,MAAM,CAAC;QAC/C,IAAA,mDAA0B,EAAC,MAAM,CAAC;QAClC,IAAA,uCAAoB,EAAC,MAAM,CAAC;QAC5B,IAAA,4DAA8B,EAAC,eAAe,EAAE,cAAc,EAAE,MAAM,EAAE,WAAW,CAAC;QACpF,IAAA,oDAA0B,GAAE;QAC5B,IAAA,mDAA0B,EAAC,eAAe,EAAE,MAAM,CAAC;KACnD,CAAC;AACH,CAAC;AAOD,SAAgB,yBAAyB,CAAC,EACzC,SAAS,GAC8B;IACvC,OAAO;QACN,+CAAsB;QACtB,iDAAuB;QACvB,mCAAgB;QAChB,qCAAiB;QACjB,IAAA,kCAAkB,EAAC,SAAS,CAAC;QAC7B,uCAAkB;QAClB,+CAAsB;QACtB,mCAAgB;QAChB,0DAA4B;QAC5B,iDAAuB;QACvB,+CAAsB;KACtB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
|
2
|
+
import type { Logger } from '@n8n/backend-common';
|
|
3
|
+
import type { BuilderTool, BuilderToolBase } from '../utils/stream-processor';
|
|
4
|
+
export declare const CATEGORIZE_PROMPT_TOOL: BuilderToolBase;
|
|
5
|
+
export declare function createCategorizePromptTool(llm: BaseChatModel, logger?: Logger): BuilderTool;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CATEGORIZE_PROMPT_TOOL = void 0;
|
|
4
|
+
exports.createCategorizePromptTool = createCategorizePromptTool;
|
|
5
|
+
const tools_1 = require("@langchain/core/tools");
|
|
6
|
+
const zod_1 = require("zod");
|
|
7
|
+
const prompt_categorization_1 = require("../chains/prompt-categorization");
|
|
8
|
+
const errors_1 = require("../errors");
|
|
9
|
+
const progress_1 = require("../tools/helpers/progress");
|
|
10
|
+
const response_1 = require("../tools/helpers/response");
|
|
11
|
+
const categorizePromptSchema = zod_1.z.object({
|
|
12
|
+
prompt: zod_1.z.string().min(1).describe('The user prompt to categorize'),
|
|
13
|
+
});
|
|
14
|
+
function buildCategorizationMessage(categorization) {
|
|
15
|
+
const parts = [];
|
|
16
|
+
parts.push('Prompt categorized');
|
|
17
|
+
if (categorization.techniques.length > 0) {
|
|
18
|
+
parts.push(`- Techniques: ${categorization.techniques.join(', ')}`);
|
|
19
|
+
}
|
|
20
|
+
if (categorization.confidence !== undefined) {
|
|
21
|
+
parts.push(`- Confidence: ${(categorization.confidence * 100).toFixed(0)}%`);
|
|
22
|
+
}
|
|
23
|
+
return parts.join('\n');
|
|
24
|
+
}
|
|
25
|
+
exports.CATEGORIZE_PROMPT_TOOL = {
|
|
26
|
+
toolName: 'categorize_prompt',
|
|
27
|
+
displayTitle: 'Categorizing prompt',
|
|
28
|
+
};
|
|
29
|
+
function createCategorizePromptTool(llm, logger) {
|
|
30
|
+
const dynamicTool = (0, tools_1.tool)(async (input, config) => {
|
|
31
|
+
const reporter = (0, progress_1.createProgressReporter)(config, exports.CATEGORIZE_PROMPT_TOOL.toolName, exports.CATEGORIZE_PROMPT_TOOL.displayTitle);
|
|
32
|
+
try {
|
|
33
|
+
const validatedInput = categorizePromptSchema.parse(input);
|
|
34
|
+
const { prompt } = validatedInput;
|
|
35
|
+
reporter.start(validatedInput);
|
|
36
|
+
logger?.debug('Categorizing user prompt using LLM...');
|
|
37
|
+
reporter.progress('Analyzing prompt to identify use case and techniques...');
|
|
38
|
+
const categorization = await (0, prompt_categorization_1.promptCategorizationChain)(llm, prompt);
|
|
39
|
+
logger?.debug('Prompt categorized', {
|
|
40
|
+
techniques: categorization.techniques,
|
|
41
|
+
confidence: categorization.confidence,
|
|
42
|
+
});
|
|
43
|
+
const output = {
|
|
44
|
+
categorization,
|
|
45
|
+
};
|
|
46
|
+
reporter.complete(output);
|
|
47
|
+
return (0, response_1.createSuccessResponse)(config, buildCategorizationMessage(categorization), {
|
|
48
|
+
categorization,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
if (error instanceof zod_1.z.ZodError) {
|
|
53
|
+
const validationError = new errors_1.ValidationError('Invalid input parameters', {
|
|
54
|
+
extra: { errors: error.errors },
|
|
55
|
+
});
|
|
56
|
+
reporter.error(validationError);
|
|
57
|
+
return (0, response_1.createErrorResponse)(config, validationError);
|
|
58
|
+
}
|
|
59
|
+
const toolError = new errors_1.ToolExecutionError(error instanceof Error ? error.message : 'Unknown error occurred', {
|
|
60
|
+
toolName: exports.CATEGORIZE_PROMPT_TOOL.toolName,
|
|
61
|
+
cause: error instanceof Error ? error : undefined,
|
|
62
|
+
});
|
|
63
|
+
reporter.error(toolError);
|
|
64
|
+
return (0, response_1.createErrorResponse)(config, toolError);
|
|
65
|
+
}
|
|
66
|
+
}, {
|
|
67
|
+
name: exports.CATEGORIZE_PROMPT_TOOL.toolName,
|
|
68
|
+
description: `Categorize a user's workflow request to identify the use case and required techniques.
|
|
69
|
+
|
|
70
|
+
This helps understand what type of workflow the user wants to build and which automation patterns will be needed.
|
|
71
|
+
|
|
72
|
+
Use this tool when you receive an initial workflow request to:
|
|
73
|
+
- Detect required techniques (e.g., scraping, data transformation, notifications)
|
|
74
|
+
- Better understand the user's needs and context
|
|
75
|
+
|
|
76
|
+
The categorization allows retrieving relevant best practice documentation to improve workflow structure and node selection.`,
|
|
77
|
+
schema: categorizePromptSchema,
|
|
78
|
+
});
|
|
79
|
+
return {
|
|
80
|
+
tool: dynamicTool,
|
|
81
|
+
...exports.CATEGORIZE_PROMPT_TOOL,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=categorize-prompt.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"categorize-prompt.tool.js","sourceRoot":"","sources":["../../src/tools/categorize-prompt.tool.ts"],"names":[],"mappings":";;;AAsCA,gEAwEC;AA7GD,iDAA6C;AAE7C,6BAAwB;AAExB,0EAA2E;AAC3E,qCAA+D;AAC/D,uDAAkE;AAClE,uDAAsF;AAKtF,MAAM,sBAAsB,GAAG,OAAC,CAAC,MAAM,CAAC;IACvC,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,+BAA+B,CAAC;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QACrC,WAAW,EAAE;;;;;;;;4HAQ4G;QACzH,MAAM,EAAE,sBAAsB;KAC9B,CACD,CAAC;IAEF,OAAO;QACN,IAAI,EAAE,WAAW;QACjB,GAAG,8BAAsB;KACzB,CAAC;AACH,CAAC"}
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import type { INodeTypeDescription, NodeConnectionType } from 'n8n-workflow';
|
|
2
2
|
import type { NodeSearchResult } from '../../types/nodes';
|
|
3
3
|
export declare const SCORE_WEIGHTS: {
|
|
4
|
-
readonly NAME_CONTAINS: 10;
|
|
5
|
-
readonly DISPLAY_NAME_CONTAINS: 8;
|
|
6
|
-
readonly DESCRIPTION_CONTAINS: 5;
|
|
7
|
-
readonly ALIAS_CONTAINS: 8;
|
|
8
|
-
readonly NAME_EXACT: 20;
|
|
9
|
-
readonly DISPLAY_NAME_EXACT: 15;
|
|
10
4
|
readonly CONNECTION_EXACT: 100;
|
|
11
5
|
readonly CONNECTION_IN_EXPRESSION: 50;
|
|
12
6
|
};
|
|
@@ -16,10 +10,7 @@ export declare class NodeSearchEngine {
|
|
|
16
10
|
searchByName(query: string, limit?: number): NodeSearchResult[];
|
|
17
11
|
searchByConnectionType(connectionType: NodeConnectionType, limit?: number, nameFilter?: string): NodeSearchResult[];
|
|
18
12
|
formatResult(result: NodeSearchResult): string;
|
|
19
|
-
private calculateNameScore;
|
|
20
13
|
private getConnectionScore;
|
|
21
|
-
private createSearchResult;
|
|
22
|
-
private sortAndLimit;
|
|
23
14
|
static isAiConnectionType(connectionType: string): boolean;
|
|
24
15
|
static getAiConnectionTypes(): NodeConnectionType[];
|
|
25
16
|
}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NodeSearchEngine = exports.SCORE_WEIGHTS = void 0;
|
|
4
|
+
const sublimeSearch_1 = require("@n8n/utils/dist/search/sublimeSearch");
|
|
4
5
|
const n8n_workflow_1 = require("n8n-workflow");
|
|
6
|
+
const NODE_SEARCH_KEYS = [
|
|
7
|
+
{ key: 'displayName', weight: 1.5 },
|
|
8
|
+
{ key: 'name', weight: 1.3 },
|
|
9
|
+
{ key: 'codex.alias', weight: 1.0 },
|
|
10
|
+
{ key: 'description', weight: 0.7 },
|
|
11
|
+
];
|
|
5
12
|
exports.SCORE_WEIGHTS = {
|
|
6
|
-
NAME_CONTAINS: 10,
|
|
7
|
-
DISPLAY_NAME_CONTAINS: 8,
|
|
8
|
-
DESCRIPTION_CONTAINS: 5,
|
|
9
|
-
ALIAS_CONTAINS: 8,
|
|
10
|
-
NAME_EXACT: 20,
|
|
11
|
-
DISPLAY_NAME_EXACT: 15,
|
|
12
13
|
CONNECTION_EXACT: 100,
|
|
13
14
|
CONNECTION_IN_EXPRESSION: 50,
|
|
14
15
|
};
|
|
@@ -18,40 +19,54 @@ class NodeSearchEngine {
|
|
|
18
19
|
this.nodeTypes = nodeTypes;
|
|
19
20
|
}
|
|
20
21
|
searchByName(query, limit = 20) {
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
return this.sortAndLimit(results, limit);
|
|
22
|
+
const searchResults = (0, sublimeSearch_1.sublimeSearch)(query, this.nodeTypes, NODE_SEARCH_KEYS);
|
|
23
|
+
return searchResults
|
|
24
|
+
.slice(0, limit)
|
|
25
|
+
.map(({ item, score }) => ({
|
|
26
|
+
name: item.name,
|
|
27
|
+
displayName: item.displayName,
|
|
28
|
+
description: item.description ?? 'No description available',
|
|
29
|
+
inputs: item.inputs,
|
|
30
|
+
outputs: item.outputs,
|
|
31
|
+
score,
|
|
32
|
+
}));
|
|
34
33
|
}
|
|
35
34
|
searchByConnectionType(connectionType, limit = 20, nameFilter) {
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
35
|
+
const nodesWithConnectionType = this.nodeTypes
|
|
36
|
+
.map((nodeType) => {
|
|
37
|
+
const connectionScore = this.getConnectionScore(nodeType, connectionType);
|
|
38
|
+
return connectionScore > 0 ? { nodeType, connectionScore } : null;
|
|
39
|
+
})
|
|
40
|
+
.filter((result) => Boolean(result));
|
|
41
|
+
if (!nameFilter) {
|
|
42
|
+
return nodesWithConnectionType
|
|
43
|
+
.sort((a, b) => b.connectionScore - a.connectionScore)
|
|
44
|
+
.slice(0, limit)
|
|
45
|
+
.map(({ nodeType, connectionScore }) => ({
|
|
46
|
+
name: nodeType.name,
|
|
47
|
+
displayName: nodeType.displayName,
|
|
48
|
+
description: nodeType.description ?? 'No description available',
|
|
49
|
+
inputs: nodeType.inputs,
|
|
50
|
+
outputs: nodeType.outputs,
|
|
51
|
+
score: connectionScore,
|
|
52
|
+
}));
|
|
53
53
|
}
|
|
54
|
-
|
|
54
|
+
const nodeTypesOnly = nodesWithConnectionType.map((result) => result.nodeType);
|
|
55
|
+
const nameFilteredResults = (0, sublimeSearch_1.sublimeSearch)(nameFilter, nodeTypesOnly, NODE_SEARCH_KEYS);
|
|
56
|
+
return nameFilteredResults
|
|
57
|
+
.slice(0, limit)
|
|
58
|
+
.map(({ item, score: nameScore }) => {
|
|
59
|
+
const connectionResult = nodesWithConnectionType.find((result) => result.nodeType.name === item.name);
|
|
60
|
+
const connectionScore = connectionResult?.connectionScore ?? 0;
|
|
61
|
+
return {
|
|
62
|
+
name: item.name,
|
|
63
|
+
displayName: item.displayName,
|
|
64
|
+
description: item.description ?? 'No description available',
|
|
65
|
+
inputs: item.inputs,
|
|
66
|
+
outputs: item.outputs,
|
|
67
|
+
score: connectionScore + nameScore,
|
|
68
|
+
};
|
|
69
|
+
});
|
|
55
70
|
}
|
|
56
71
|
formatResult(result) {
|
|
57
72
|
return `
|
|
@@ -62,28 +77,6 @@ class NodeSearchEngine {
|
|
|
62
77
|
<node_outputs>${typeof result.outputs === 'object' ? JSON.stringify(result.outputs) : result.outputs}</node_outputs>
|
|
63
78
|
</node>`;
|
|
64
79
|
}
|
|
65
|
-
calculateNameScore(nodeType, normalizedQuery) {
|
|
66
|
-
let score = 0;
|
|
67
|
-
if (nodeType.name.toLowerCase().includes(normalizedQuery)) {
|
|
68
|
-
score += exports.SCORE_WEIGHTS.NAME_CONTAINS;
|
|
69
|
-
}
|
|
70
|
-
if (nodeType.displayName.toLowerCase().includes(normalizedQuery)) {
|
|
71
|
-
score += exports.SCORE_WEIGHTS.DISPLAY_NAME_CONTAINS;
|
|
72
|
-
}
|
|
73
|
-
if (nodeType.description?.toLowerCase().includes(normalizedQuery)) {
|
|
74
|
-
score += exports.SCORE_WEIGHTS.DESCRIPTION_CONTAINS;
|
|
75
|
-
}
|
|
76
|
-
if (nodeType.codex?.alias?.some((alias) => alias.toLowerCase().includes(normalizedQuery))) {
|
|
77
|
-
score += exports.SCORE_WEIGHTS.ALIAS_CONTAINS;
|
|
78
|
-
}
|
|
79
|
-
if (nodeType.name.toLowerCase() === normalizedQuery) {
|
|
80
|
-
score += exports.SCORE_WEIGHTS.NAME_EXACT;
|
|
81
|
-
}
|
|
82
|
-
if (nodeType.displayName.toLowerCase() === normalizedQuery) {
|
|
83
|
-
score += exports.SCORE_WEIGHTS.DISPLAY_NAME_EXACT;
|
|
84
|
-
}
|
|
85
|
-
return score;
|
|
86
|
-
}
|
|
87
80
|
getConnectionScore(nodeType, connectionType) {
|
|
88
81
|
const outputs = nodeType.outputs;
|
|
89
82
|
if (Array.isArray(outputs)) {
|
|
@@ -98,19 +91,6 @@ class NodeSearchEngine {
|
|
|
98
91
|
}
|
|
99
92
|
return 0;
|
|
100
93
|
}
|
|
101
|
-
createSearchResult(nodeType, score) {
|
|
102
|
-
return {
|
|
103
|
-
name: nodeType.name,
|
|
104
|
-
displayName: nodeType.displayName,
|
|
105
|
-
description: nodeType.description ?? 'No description available',
|
|
106
|
-
inputs: nodeType.inputs,
|
|
107
|
-
outputs: nodeType.outputs,
|
|
108
|
-
score,
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
sortAndLimit(results, limit) {
|
|
112
|
-
return results.sort((a, b) => b.score - a.score).slice(0, limit);
|
|
113
|
-
}
|
|
114
94
|
static isAiConnectionType(connectionType) {
|
|
115
95
|
return connectionType.startsWith('ai_');
|
|
116
96
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-search-engine.js","sourceRoot":"","sources":["../../../src/tools/engines/node-search-engine.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"node-search-engine.js","sourceRoot":"","sources":["../../../src/tools/engines/node-search-engine.ts"],"names":[],"mappings":";;;AAAA,wEAAqE;AAErE,+CAAmD;AAQnD,MAAM,gBAAgB,GAAG;IACxB,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,EAAE,GAAG,EAAE;IACnC,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE;IAC5B,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,EAAE,GAAG,EAAE;IACnC,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,EAAE,GAAG,EAAE;CACnC,CAAC;AAKW,QAAA,aAAa,GAAG;IAC5B,gBAAgB,EAAE,GAAG;IACrB,wBAAwB,EAAE,EAAE;CACnB,CAAC;AAMX,MAAa,gBAAgB;IACC;IAA7B,YAA6B,SAAiC;QAAjC,cAAS,GAAT,SAAS,CAAwB;IAAG,CAAC;IAQlE,YAAY,CAAC,KAAa,EAAE,QAAgB,EAAE;QAE7C,MAAM,aAAa,GAAG,IAAA,6BAAa,EAClC,KAAK,EACL,IAAI,CAAC,SAAS,EACd,gBAAgB,CAChB,CAAC;QAGF,OAAO,a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F,OAAO,MAAM,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO;UAC7F,CAAC;IACV,CAAC;IAQO,kBAAkB,CACzB,QAA8B,EAC9B,cAAkC;QAElC,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC;QAEjC,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;YAE5B,IAAI,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;gBACtC,OAAO,qBAAa,CAAC,gBAAgB,CAAC;YACvC,CAAC;QACF,CAAC;aAAM,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;YAExC,IAAI,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;gBACtC,OAAO,qBAAa,CAAC,wBAAwB,CAAC;YAC/C,CAAC;QACF,CAAC;QAED,OAAO,CAAC,CAAC;IACV,CAAC;IAOD,MAAM,CAAC,kBAAkB,CAAC,cAAsB;QAC/C,OAAO,cAAc,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC;IAMD,MAAM,CAAC,oBAAoB;QAC1B,OAAO,MAAM,CAAC,MAAM,CAAC,kCAAmB,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CACzD,gBAAgB,CAAC,kBAAkB,CAAC,IAAI,CAAC,CACjB,CAAC;IAC3B,CAAC;CACD;AAvJD,4CAuJC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { BuilderToolBase } from '../utils/stream-processor';
|
|
3
|
+
export declare const GET_BEST_PRACTICES_TOOL: BuilderToolBase;
|
|
4
|
+
export declare function createGetBestPracticesTool(): {
|
|
5
|
+
toolName: string;
|
|
6
|
+
displayTitle: string;
|
|
7
|
+
getCustomDisplayTitle?: (values: Record<string, unknown>) => string;
|
|
8
|
+
tool: import("@langchain/core/tools").DynamicStructuredTool<z.ZodObject<{
|
|
9
|
+
techniques: z.ZodArray<z.ZodNativeEnum<{
|
|
10
|
+
readonly SCHEDULING: "scheduling";
|
|
11
|
+
readonly CHATBOT: "chatbot";
|
|
12
|
+
readonly FORM_INPUT: "form_input";
|
|
13
|
+
readonly SCRAPING_AND_RESEARCH: "scraping_and_research";
|
|
14
|
+
readonly MONITORING: "monitoring";
|
|
15
|
+
readonly ENRICHMENT: "enrichment";
|
|
16
|
+
readonly TRIAGE: "triage";
|
|
17
|
+
readonly CONTENT_GENERATION: "content_generation";
|
|
18
|
+
readonly DOCUMENT_PROCESSING: "document_processing";
|
|
19
|
+
readonly DATA_EXTRACTION: "data_extraction";
|
|
20
|
+
readonly DATA_ANALYSIS: "data_analysis";
|
|
21
|
+
readonly DATA_TRANSFORMATION: "data_transformation";
|
|
22
|
+
readonly NOTIFICATION: "notification";
|
|
23
|
+
readonly KNOWLEDGE_BASE: "knowledge_base";
|
|
24
|
+
readonly HUMAN_IN_THE_LOOP: "human_in_the_loop";
|
|
25
|
+
}>, "many">;
|
|
26
|
+
}, "strip", z.ZodTypeAny, {
|
|
27
|
+
techniques: ("scheduling" | "chatbot" | "form_input" | "scraping_and_research" | "monitoring" | "enrichment" | "triage" | "content_generation" | "document_processing" | "data_extraction" | "data_analysis" | "data_transformation" | "notification" | "knowledge_base" | "human_in_the_loop")[];
|
|
28
|
+
}, {
|
|
29
|
+
techniques: ("scheduling" | "chatbot" | "form_input" | "scraping_and_research" | "monitoring" | "enrichment" | "triage" | "content_generation" | "document_processing" | "data_extraction" | "data_analysis" | "data_transformation" | "notification" | "knowledge_base" | "human_in_the_loop")[];
|
|
30
|
+
}>, unknown, {
|
|
31
|
+
techniques: ("scheduling" | "chatbot" | "form_input" | "scraping_and_research" | "monitoring" | "enrichment" | "triage" | "content_generation" | "document_processing" | "data_extraction" | "data_analysis" | "data_transformation" | "notification" | "knowledge_base" | "human_in_the_loop")[];
|
|
32
|
+
}, import("@langchain/langgraph").Command<unknown>>;
|
|
33
|
+
};
|