@minded-ai/mindedjs 3.1.14 → 3.1.15
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/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/internalTools/documentExtraction/documentExtraction.d.ts +28 -80
- package/dist/internalTools/documentExtraction/documentExtraction.d.ts.map +1 -1
- package/dist/internalTools/documentExtraction/documentExtraction.js +39 -105
- package/dist/internalTools/documentExtraction/documentExtraction.js.map +1 -1
- package/dist/internalTools/documentExtraction/parseDocument.d.ts +66 -0
- package/dist/internalTools/documentExtraction/parseDocument.d.ts.map +1 -0
- package/dist/internalTools/documentExtraction/parseDocument.js +92 -0
- package/dist/internalTools/documentExtraction/parseDocument.js.map +1 -0
- package/dist/nodes/addAppToolNode.js +1 -1
- package/dist/nodes/addAppToolNode.js.map +1 -1
- package/dist/nodes/addToolNode.js +1 -1
- package/dist/nodes/addToolNode.js.map +1 -1
- package/dist/nodes/compilePrompt.d.ts +8 -0
- package/dist/nodes/compilePrompt.d.ts.map +1 -1
- package/dist/nodes/compilePrompt.js +56 -15
- package/dist/nodes/compilePrompt.js.map +1 -1
- package/dist/toolsLibrary/parseDocument.d.ts +6 -5
- package/dist/toolsLibrary/parseDocument.d.ts.map +1 -1
- package/dist/toolsLibrary/parseDocument.js +16 -8
- package/dist/toolsLibrary/parseDocument.js.map +1 -1
- package/docs/low-code-editor/nodes.md +101 -1
- package/docs/low-code-editor/tools.md +24 -3
- package/docs/tooling/document-processing.md +103 -19
- package/package.json +4 -2
- package/src/index.ts +2 -1
- package/src/internalTools/documentExtraction/documentExtraction.ts +51 -131
- package/src/internalTools/documentExtraction/parseDocument.ts +107 -0
- package/src/nodes/addAppToolNode.ts +2 -2
- package/src/nodes/addToolNode.ts +2 -2
- package/src/nodes/compilePrompt.ts +56 -16
- package/src/toolsLibrary/parseDocument.ts +17 -8
package/dist/index.d.ts
CHANGED
|
@@ -18,7 +18,8 @@ export type { Flow, Node, Edge, TriggerNode, AppTriggerNode, PromptNode, PromptC
|
|
|
18
18
|
export { NodeType, TriggerType, EdgeType, AppNodeMetadata, AppNodeMetadataType, NodeMetadata, KnownTriggerNames, RpaActionType, } from './types/Flows.types';
|
|
19
19
|
export type { Tool, ToolExecuteInput } from './types/Tools.types';
|
|
20
20
|
export { ToolType, ProxyType } from './types/Tools.types';
|
|
21
|
-
export { parseDocumentAndExtractStructuredData
|
|
21
|
+
export { parseDocumentAndExtractStructuredData } from './internalTools/documentExtraction/documentExtraction';
|
|
22
|
+
export { parseDocument, DocumentProcessingMode } from './internalTools/documentExtraction/parseDocument';
|
|
22
23
|
export { extractStructuredDataFromString } from './internalTools/documentExtraction/extractStructuredData';
|
|
23
24
|
export type { DocumentProcessorConfig, DocumentExtractionOptions, DocumentProcessingResult, } from './internalTools/documentExtraction/types';
|
|
24
25
|
export { HistoryStep, TriggerHistoryStep, AppActionInvocationHistoryStep, AppTriggerHistoryStep, CustomActionInvocationHistoryStep, SessionType, TriggerEvent, } from './types/Agent.types';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAC5E,OAAO,EAAE,iCAAiC,EAAE,MAAM,kC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AY,EAAE,eAAe,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAGzG,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACrE,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAGtG,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,YAAY,EAAE,yBAAyB,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAGlG,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,YAAY,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE9D,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAC/F,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -76,8 +76,9 @@ Object.defineProperty(exports, "ProxyType", { enumerable: true, get: function ()
|
|
|
76
76
|
// Document processing utilities
|
|
77
77
|
var documentExtraction_1 = require("./internalTools/documentExtraction/documentExtraction");
|
|
78
78
|
Object.defineProperty(exports, "parseDocumentAndExtractStructuredData", { enumerable: true, get: function () { return documentExtraction_1.parseDocumentAndExtractStructuredData; } });
|
|
79
|
-
|
|
80
|
-
Object.defineProperty(exports, "
|
|
79
|
+
var parseDocument_1 = require("./internalTools/documentExtraction/parseDocument");
|
|
80
|
+
Object.defineProperty(exports, "parseDocument", { enumerable: true, get: function () { return parseDocument_1.parseDocument; } });
|
|
81
|
+
Object.defineProperty(exports, "DocumentProcessingMode", { enumerable: true, get: function () { return parseDocument_1.DocumentProcessingMode; } });
|
|
81
82
|
var extractStructuredData_1 = require("./internalTools/documentExtraction/extractStructuredData");
|
|
82
83
|
Object.defineProperty(exports, "extractStructuredDataFromString", { enumerable: true, get: function () { return extractStructuredData_1.extractStructuredDataFromString; } });
|
|
83
84
|
var Agent_types_1 = require("./types/Agent.types");
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAAgC;AAY9B,sFAZO,aAAK,OAYP;AAXP,sDAA8B;AAY5B,iBAZK,gBAAM,CAYL;AAXR,2CAAwC;AAYtC,uFAZO,eAAM,OAYP;AAXR,yFAAsF;AAYpF,uGAZO,+CAAsB,OAYP;AAXxB,iDAAyE;AAYvE,2FAZO,kBAAU,OAYP;AACV,4FAbmB,mBAAW,OAanB;AACX,wFAdgC,eAAO,OAchC;AAbT,yDAAyE;AAcvE,2FAdO,mBAAU,OAcP;AACV,8FAfmB,sBAAa,OAenB;AAdf,+EAA4E;AAe1E,kGAfO,qCAAiB,OAeP;AAdnB,4EAAqF;AAenF,kHAfO,yDAAiC,OAeP;AAdnC,yDAAgE;AAe9D,oGAfO,+BAAmB,OAeP;AAGrB,6BAA6B;AAC7B,uEAAsE;AAA7D,oHAAA,gBAAgB,OAAA;AACzB,qEAA0E;AAAjE,wHAAA,qBAAqB,OAAA;AA+B9B,mDAS6B;AAR3B,uGAAA,QAAQ,OAAA;AACR,0GAAA,WAAW,OAAA;AACX,uGAAA,QAAQ,OAAA;AAER,kHAAA,mBAAmB,OAAA;AAEnB,gHAAA,iBAAiB,OAAA;AACjB,4GAAA,aAAa,OAAA;AAGf,mDAA0D;AAAjD,uGAAA,QAAQ,OAAA;AAAE,wGAAA,SAAS,OAAA;AAE5B,gCAAgC;AAChC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";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,OAAA;AAAE,8GAAA,gBAAgB,OAAA;AAAE,2GAAA,aAAa,OAAA;AAGlD,8BAA8B;AAC9B,wDAAqE;AAA5D,qGAAA,OAAO,OAAA;AAAE,6GAAA,eAAe,OAAA;AAGjC,qBAAqB;AACrB,oDAAmD;AAA1C,0GAAA,WAAW,OAAA;AAGpB,yBAAyB;AACzB,2DAA6D;AAApD,qHAAA,kBAAkB,OAAA;AAG3B,uEAA+F;AAAtF,0HAAA,oBAAoB,OAAA;AAAE,2HAAA,qBAAqB,OAAA;AACpD,wEAAuE;AAA9D,wHAAA,kBAAkB,OAAA;AAC3B,6CAAsD;AAA7C,wGAAA,eAAe,OAAA;AACxB,yCAAsD;AAA7C,oHAAA,uBAAuB,OAAA;AAChC,gEAA+D;AAAtD,gHAAA,cAAc,OAAA"}
|
|
@@ -1,26 +1,18 @@
|
|
|
1
1
|
import { ZodType } from 'zod';
|
|
2
2
|
import { BaseLanguageModel } from '@langchain/core/language_models/base';
|
|
3
|
-
import {
|
|
4
|
-
/**
|
|
5
|
-
* Document processing mode
|
|
6
|
-
*/
|
|
7
|
-
export declare enum DocumentProcessingMode {
|
|
8
|
-
/** Process documents using Minded cloud service (default) */
|
|
9
|
-
MANAGED = "managed",
|
|
10
|
-
/** Process documents locally using LlamaCloud */
|
|
11
|
-
LOCAL = "local"
|
|
12
|
-
}
|
|
3
|
+
import { DocumentProcessingMode } from './parseDocument';
|
|
13
4
|
/**
|
|
14
5
|
* Parse document and extract structured data using AI.
|
|
15
6
|
*
|
|
16
|
-
* This function provides a flexible way to process documents with optional AI-powered extraction:
|
|
17
|
-
* - Raw text extraction: Parse document without LLM processing
|
|
7
|
+
* This function provides a flexible way to process one or more documents with optional AI-powered extraction:
|
|
8
|
+
* - Raw text extraction: Parse document(s) without LLM processing
|
|
18
9
|
* - Structured extraction with schema: Extract data matching a Zod schema
|
|
19
10
|
* - Structured extraction with prompt: Guide extraction using custom prompts
|
|
11
|
+
* - Multiple document support: Process multiple documents by passing an array - their content will be concatenated
|
|
20
12
|
* - Processing modes: Use DocumentProcessingMode.LOCAL (requires LlamaCloud API key) or DocumentProcessingMode.MANAGED (backend service)
|
|
21
13
|
*
|
|
22
14
|
* @param options - Document processing options
|
|
23
|
-
* @param options.
|
|
15
|
+
* @param options.documentSources - Array of URLs/file paths. When multiple documents are provided, they are parsed and concatenated with double newlines before optional structured extraction.
|
|
24
16
|
* @param options.processingMode - Document parsing mode: DocumentProcessingMode.MANAGED (default, backend service) or DocumentProcessingMode.LOCAL (requires llamaCloudApiKey)
|
|
25
17
|
* @param options.sessionId - Unique session identifier for logging and tracking
|
|
26
18
|
* @param options.llamaCloudApiKey - LlamaCloud API key for local processing. Required when processingMode is DocumentProcessingMode.LOCAL. Can be provided as parameter or via LLAMA_CLOUD_API_KEY environment variable
|
|
@@ -30,11 +22,10 @@ export declare enum DocumentProcessingMode {
|
|
|
30
22
|
* @param options.outputSchemaPrompt - Optional prompt to guide the llm how to extract the data
|
|
31
23
|
*
|
|
32
24
|
* @returns Promise resolving to an object containing:
|
|
33
|
-
* - rawContent: The raw extracted text from the document
|
|
34
|
-
* - structuredContent: AI-extracted structured data (if returnStructuredOutput is true)
|
|
35
|
-
* - metadata: Document metadata from processing
|
|
25
|
+
* - rawContent: The raw extracted text from the document. When multiple documents are provided, contains their concatenated content separated by double newlines.
|
|
26
|
+
* - structuredContent: AI-extracted structured data (only present if returnStructuredOutput is true). When multiple documents are provided, extracts from their concatenated content.
|
|
36
27
|
*
|
|
37
|
-
* @throws {Error} If
|
|
28
|
+
* @throws {Error} If documentSources is not provided
|
|
38
29
|
* @throws {Error} If returnStructuredOutput is true but llm is not provided
|
|
39
30
|
* @throws {Error} If document parsing or extraction fails
|
|
40
31
|
*
|
|
@@ -43,9 +34,9 @@ export declare enum DocumentProcessingMode {
|
|
|
43
34
|
* import { parseDocumentAndExtractStructuredData, DocumentProcessingMode } from '@minded-ai/mindedjs';
|
|
44
35
|
* import { z } from 'zod';
|
|
45
36
|
*
|
|
46
|
-
* // Parse document and extract structured data using a schema
|
|
37
|
+
* // Parse single document and extract structured data using a schema
|
|
47
38
|
* const result1 = await parseDocumentAndExtractStructuredData({
|
|
48
|
-
*
|
|
39
|
+
* documentSources: ['./invoice.pdf'],
|
|
49
40
|
* processingMode: DocumentProcessingMode.MANAGED,
|
|
50
41
|
* sessionId: state.sessionId,
|
|
51
42
|
* returnStructuredOutput: true,
|
|
@@ -57,17 +48,31 @@ export declare enum DocumentProcessingMode {
|
|
|
57
48
|
* }),
|
|
58
49
|
* });
|
|
59
50
|
*
|
|
60
|
-
* // Parse
|
|
51
|
+
* // Parse multiple documents and extract structured data from their combined content
|
|
52
|
+
* const result2 = await parseDocumentAndExtractStructuredData({
|
|
53
|
+
* documentSources: ['./invoice1.pdf', './invoice2.pdf', './invoice3.pdf'],
|
|
54
|
+
* processingMode: DocumentProcessingMode.MANAGED,
|
|
55
|
+
* sessionId: state.sessionId,
|
|
56
|
+
* returnStructuredOutput: true,
|
|
57
|
+
* llm: agent.llm,
|
|
58
|
+
* outputSchema: z.array(z.object({
|
|
59
|
+
* invoiceNumber: z.string(),
|
|
60
|
+
* totalAmount: z.number(),
|
|
61
|
+
* date: z.string(),
|
|
62
|
+
* })),
|
|
63
|
+
* });
|
|
64
|
+
*
|
|
65
|
+
* // Parse document without structured extraction
|
|
61
66
|
* const result3 = await parseDocumentAndExtractStructuredData({
|
|
62
|
-
*
|
|
67
|
+
* documentSources: ['./document.pdf'],
|
|
63
68
|
* processingMode: DocumentProcessingMode.MANAGED,
|
|
64
69
|
* sessionId: state.sessionId,
|
|
65
70
|
* returnStructuredOutput: false,
|
|
66
71
|
* });
|
|
67
72
|
* ```
|
|
68
73
|
*/
|
|
69
|
-
export declare function parseDocumentAndExtractStructuredData<T extends Record<string, any>>({
|
|
70
|
-
|
|
74
|
+
export declare function parseDocumentAndExtractStructuredData<T extends Record<string, any>>({ documentSources, processingMode, sessionId, llamaCloudApiKey, returnStructuredOutput, llm, outputSchema, outputSchemaPrompt, }: {
|
|
75
|
+
documentSources: string[];
|
|
71
76
|
processingMode?: DocumentProcessingMode;
|
|
72
77
|
sessionId: string;
|
|
73
78
|
llamaCloudApiKey?: string;
|
|
@@ -78,62 +83,5 @@ export declare function parseDocumentAndExtractStructuredData<T extends Record<s
|
|
|
78
83
|
}): Promise<{
|
|
79
84
|
rawContent?: string;
|
|
80
85
|
structuredContent?: T | string;
|
|
81
|
-
metadata?: DocumentProcessResponse['metadata'];
|
|
82
|
-
}>;
|
|
83
|
-
/**
|
|
84
|
-
* Parse document and extract raw text content.
|
|
85
|
-
*
|
|
86
|
-
* This function processes various document types (PDFs, images, Word docs, etc.) and extracts
|
|
87
|
-
* raw text content using either local processing with LlamaCloud or managed backend service.
|
|
88
|
-
* Use this for raw text extraction without AI-powered data extraction.
|
|
89
|
-
*
|
|
90
|
-
* @param options - Document parsing options
|
|
91
|
-
* @param options.documentSource - URL or file path to the document
|
|
92
|
-
* @param options.processingMode - Parsing mode: DocumentProcessingMode.LOCAL (requires llamaCloudApiKey) or DocumentProcessingMode.MANAGED (backend service, default)
|
|
93
|
-
* @param options.sessionId - Unique session identifier for logging and tracking
|
|
94
|
-
* @param options.llamaCloudApiKey - LlamaCloud API key for local processing. Required when processingMode is DocumentProcessingMode.LOCAL. Can be provided as parameter or via LLAMA_CLOUD_API_KEY environment variable
|
|
95
|
-
*
|
|
96
|
-
* @returns Promise resolving to an object containing:
|
|
97
|
-
* - rawContent: The raw extracted text from the document
|
|
98
|
-
* - metadata: Document processing metadata (file size, type, processing time, content length)
|
|
99
|
-
*
|
|
100
|
-
* @throws {Error} If documentSource is not provided
|
|
101
|
-
* @throws {Error} If document processing fails
|
|
102
|
-
*
|
|
103
|
-
* @example
|
|
104
|
-
* ```typescript
|
|
105
|
-
* import { parseDocument, DocumentProcessingMode } from '@minded-ai/mindedjs';
|
|
106
|
-
*
|
|
107
|
-
* // Parse document using managed service
|
|
108
|
-
* const result1 = await parseDocument({
|
|
109
|
-
* documentSource: 'https://example.com/invoice.pdf',
|
|
110
|
-
* processingMode: DocumentProcessingMode.MANAGED,
|
|
111
|
-
* sessionId: state.sessionId,
|
|
112
|
-
* });
|
|
113
|
-
* // result1: { rawContent: "Invoice text...", metadata: {...} }
|
|
114
|
-
*
|
|
115
|
-
* // Parse local document using LlamaCloud
|
|
116
|
-
* const result2 = await parseDocument({
|
|
117
|
-
* documentSource: './contract.pdf',
|
|
118
|
-
* processingMode: DocumentProcessingMode.LOCAL,
|
|
119
|
-
* sessionId: state.sessionId,
|
|
120
|
-
* llamaCloudApiKey: process.env.LLAMA_CLOUD_API_KEY,
|
|
121
|
-
* });
|
|
122
|
-
* // result2: { rawContent: "Contract text...", metadata: {...} }
|
|
123
|
-
* ```
|
|
124
|
-
*/
|
|
125
|
-
export declare function parseDocument({ documentSource, processingMode, sessionId, llamaCloudApiKey, }: {
|
|
126
|
-
documentSource: string;
|
|
127
|
-
processingMode?: DocumentProcessingMode;
|
|
128
|
-
sessionId: string;
|
|
129
|
-
llamaCloudApiKey?: string;
|
|
130
|
-
}): Promise<{
|
|
131
|
-
rawContent?: string;
|
|
132
|
-
metadata?: {
|
|
133
|
-
fileSize?: number;
|
|
134
|
-
fileType: string;
|
|
135
|
-
processingTime: number;
|
|
136
|
-
contentLength: number;
|
|
137
|
-
};
|
|
138
86
|
}>;
|
|
139
87
|
//# sourceMappingURL=documentExtraction.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documentExtraction.d.ts","sourceRoot":"","sources":["../../../src/internalTools/documentExtraction/documentExtraction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAC9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAEzE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"documentExtraction.d.ts","sourceRoot":"","sources":["../../../src/internalTools/documentExtraction/documentExtraction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAC9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAEzE,OAAO,EAAE,sBAAsB,EAAiB,MAAM,iBAAiB,CAAC;AAExE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqEG;AACH,wBAAsB,qCAAqC,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,EACzF,eAAe,EACf,cAAc,EACd,SAAS,EACT,gBAAgB,EAChB,sBAA8B,EAC9B,GAAG,EACH,YAAY,EACZ,kBAAkB,GACnB,EAAE;IACD,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,cAAc,CAAC,EAAE,sBAAsB,CAAC;IACxC,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,sBAAsB,EAAE,OAAO,CAAC;IAChC,GAAG,CAAC,EAAE,iBAAiB,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,GAAG,OAAO,CAAC;IACV,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iBAAiB,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC;CAChC,CAAC,CA4CD"}
|
|
@@ -1,32 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DocumentProcessingMode = void 0;
|
|
4
3
|
exports.parseDocumentAndExtractStructuredData = parseDocumentAndExtractStructuredData;
|
|
5
|
-
exports.parseDocument = parseDocument;
|
|
6
4
|
const extractStructuredData_1 = require("./extractStructuredData");
|
|
7
|
-
const
|
|
8
|
-
const parseDocumentLocal_1 = require("./parseDocumentLocal");
|
|
9
|
-
/**
|
|
10
|
-
* Document processing mode
|
|
11
|
-
*/
|
|
12
|
-
var DocumentProcessingMode;
|
|
13
|
-
(function (DocumentProcessingMode) {
|
|
14
|
-
/** Process documents using Minded cloud service (default) */
|
|
15
|
-
DocumentProcessingMode["MANAGED"] = "managed";
|
|
16
|
-
/** Process documents locally using LlamaCloud */
|
|
17
|
-
DocumentProcessingMode["LOCAL"] = "local";
|
|
18
|
-
})(DocumentProcessingMode || (exports.DocumentProcessingMode = DocumentProcessingMode = {}));
|
|
5
|
+
const parseDocument_1 = require("./parseDocument");
|
|
19
6
|
/**
|
|
20
7
|
* Parse document and extract structured data using AI.
|
|
21
8
|
*
|
|
22
|
-
* This function provides a flexible way to process documents with optional AI-powered extraction:
|
|
23
|
-
* - Raw text extraction: Parse document without LLM processing
|
|
9
|
+
* This function provides a flexible way to process one or more documents with optional AI-powered extraction:
|
|
10
|
+
* - Raw text extraction: Parse document(s) without LLM processing
|
|
24
11
|
* - Structured extraction with schema: Extract data matching a Zod schema
|
|
25
12
|
* - Structured extraction with prompt: Guide extraction using custom prompts
|
|
13
|
+
* - Multiple document support: Process multiple documents by passing an array - their content will be concatenated
|
|
26
14
|
* - Processing modes: Use DocumentProcessingMode.LOCAL (requires LlamaCloud API key) or DocumentProcessingMode.MANAGED (backend service)
|
|
27
15
|
*
|
|
28
16
|
* @param options - Document processing options
|
|
29
|
-
* @param options.
|
|
17
|
+
* @param options.documentSources - Array of URLs/file paths. When multiple documents are provided, they are parsed and concatenated with double newlines before optional structured extraction.
|
|
30
18
|
* @param options.processingMode - Document parsing mode: DocumentProcessingMode.MANAGED (default, backend service) or DocumentProcessingMode.LOCAL (requires llamaCloudApiKey)
|
|
31
19
|
* @param options.sessionId - Unique session identifier for logging and tracking
|
|
32
20
|
* @param options.llamaCloudApiKey - LlamaCloud API key for local processing. Required when processingMode is DocumentProcessingMode.LOCAL. Can be provided as parameter or via LLAMA_CLOUD_API_KEY environment variable
|
|
@@ -36,11 +24,10 @@ var DocumentProcessingMode;
|
|
|
36
24
|
* @param options.outputSchemaPrompt - Optional prompt to guide the llm how to extract the data
|
|
37
25
|
*
|
|
38
26
|
* @returns Promise resolving to an object containing:
|
|
39
|
-
* - rawContent: The raw extracted text from the document
|
|
40
|
-
* - structuredContent: AI-extracted structured data (if returnStructuredOutput is true)
|
|
41
|
-
* - metadata: Document metadata from processing
|
|
27
|
+
* - rawContent: The raw extracted text from the document. When multiple documents are provided, contains their concatenated content separated by double newlines.
|
|
28
|
+
* - structuredContent: AI-extracted structured data (only present if returnStructuredOutput is true). When multiple documents are provided, extracts from their concatenated content.
|
|
42
29
|
*
|
|
43
|
-
* @throws {Error} If
|
|
30
|
+
* @throws {Error} If documentSources is not provided
|
|
44
31
|
* @throws {Error} If returnStructuredOutput is true but llm is not provided
|
|
45
32
|
* @throws {Error} If document parsing or extraction fails
|
|
46
33
|
*
|
|
@@ -49,9 +36,9 @@ var DocumentProcessingMode;
|
|
|
49
36
|
* import { parseDocumentAndExtractStructuredData, DocumentProcessingMode } from '@minded-ai/mindedjs';
|
|
50
37
|
* import { z } from 'zod';
|
|
51
38
|
*
|
|
52
|
-
* // Parse document and extract structured data using a schema
|
|
39
|
+
* // Parse single document and extract structured data using a schema
|
|
53
40
|
* const result1 = await parseDocumentAndExtractStructuredData({
|
|
54
|
-
*
|
|
41
|
+
* documentSources: ['./invoice.pdf'],
|
|
55
42
|
* processingMode: DocumentProcessingMode.MANAGED,
|
|
56
43
|
* sessionId: state.sessionId,
|
|
57
44
|
* returnStructuredOutput: true,
|
|
@@ -63,23 +50,45 @@ var DocumentProcessingMode;
|
|
|
63
50
|
* }),
|
|
64
51
|
* });
|
|
65
52
|
*
|
|
66
|
-
* // Parse
|
|
53
|
+
* // Parse multiple documents and extract structured data from their combined content
|
|
54
|
+
* const result2 = await parseDocumentAndExtractStructuredData({
|
|
55
|
+
* documentSources: ['./invoice1.pdf', './invoice2.pdf', './invoice3.pdf'],
|
|
56
|
+
* processingMode: DocumentProcessingMode.MANAGED,
|
|
57
|
+
* sessionId: state.sessionId,
|
|
58
|
+
* returnStructuredOutput: true,
|
|
59
|
+
* llm: agent.llm,
|
|
60
|
+
* outputSchema: z.array(z.object({
|
|
61
|
+
* invoiceNumber: z.string(),
|
|
62
|
+
* totalAmount: z.number(),
|
|
63
|
+
* date: z.string(),
|
|
64
|
+
* })),
|
|
65
|
+
* });
|
|
66
|
+
*
|
|
67
|
+
* // Parse document without structured extraction
|
|
67
68
|
* const result3 = await parseDocumentAndExtractStructuredData({
|
|
68
|
-
*
|
|
69
|
+
* documentSources: ['./document.pdf'],
|
|
69
70
|
* processingMode: DocumentProcessingMode.MANAGED,
|
|
70
71
|
* sessionId: state.sessionId,
|
|
71
72
|
* returnStructuredOutput: false,
|
|
72
73
|
* });
|
|
73
74
|
* ```
|
|
74
75
|
*/
|
|
75
|
-
async function parseDocumentAndExtractStructuredData({
|
|
76
|
-
// Parse document
|
|
77
|
-
const
|
|
76
|
+
async function parseDocumentAndExtractStructuredData({ documentSources, processingMode, sessionId, llamaCloudApiKey, returnStructuredOutput = false, llm, outputSchema, outputSchemaPrompt, }) {
|
|
77
|
+
// Parse each document and concatenate results
|
|
78
|
+
const results = await Promise.all(documentSources.map((documentSource) => (0, parseDocument_1.parseDocument)({
|
|
78
79
|
documentSource,
|
|
79
80
|
processingMode,
|
|
80
81
|
sessionId,
|
|
81
82
|
llamaCloudApiKey,
|
|
82
|
-
});
|
|
83
|
+
})));
|
|
84
|
+
// Concatenate the raw content of the parsed documents with two newlines
|
|
85
|
+
const concatenatedContent = results
|
|
86
|
+
.map((r) => r.rawContent)
|
|
87
|
+
.filter(Boolean)
|
|
88
|
+
.join('\n\n');
|
|
89
|
+
const result = {
|
|
90
|
+
rawContent: concatenatedContent,
|
|
91
|
+
};
|
|
83
92
|
if (!returnStructuredOutput || !result.rawContent) {
|
|
84
93
|
return result;
|
|
85
94
|
}
|
|
@@ -95,83 +104,8 @@ async function parseDocumentAndExtractStructuredData({ documentSource, processin
|
|
|
95
104
|
sessionId,
|
|
96
105
|
});
|
|
97
106
|
return {
|
|
98
|
-
|
|
107
|
+
rawContent: result.rawContent,
|
|
99
108
|
structuredContent,
|
|
100
109
|
};
|
|
101
110
|
}
|
|
102
|
-
/**
|
|
103
|
-
* Parse document and extract raw text content.
|
|
104
|
-
*
|
|
105
|
-
* This function processes various document types (PDFs, images, Word docs, etc.) and extracts
|
|
106
|
-
* raw text content using either local processing with LlamaCloud or managed backend service.
|
|
107
|
-
* Use this for raw text extraction without AI-powered data extraction.
|
|
108
|
-
*
|
|
109
|
-
* @param options - Document parsing options
|
|
110
|
-
* @param options.documentSource - URL or file path to the document
|
|
111
|
-
* @param options.processingMode - Parsing mode: DocumentProcessingMode.LOCAL (requires llamaCloudApiKey) or DocumentProcessingMode.MANAGED (backend service, default)
|
|
112
|
-
* @param options.sessionId - Unique session identifier for logging and tracking
|
|
113
|
-
* @param options.llamaCloudApiKey - LlamaCloud API key for local processing. Required when processingMode is DocumentProcessingMode.LOCAL. Can be provided as parameter or via LLAMA_CLOUD_API_KEY environment variable
|
|
114
|
-
*
|
|
115
|
-
* @returns Promise resolving to an object containing:
|
|
116
|
-
* - rawContent: The raw extracted text from the document
|
|
117
|
-
* - metadata: Document processing metadata (file size, type, processing time, content length)
|
|
118
|
-
*
|
|
119
|
-
* @throws {Error} If documentSource is not provided
|
|
120
|
-
* @throws {Error} If document processing fails
|
|
121
|
-
*
|
|
122
|
-
* @example
|
|
123
|
-
* ```typescript
|
|
124
|
-
* import { parseDocument, DocumentProcessingMode } from '@minded-ai/mindedjs';
|
|
125
|
-
*
|
|
126
|
-
* // Parse document using managed service
|
|
127
|
-
* const result1 = await parseDocument({
|
|
128
|
-
* documentSource: 'https://example.com/invoice.pdf',
|
|
129
|
-
* processingMode: DocumentProcessingMode.MANAGED,
|
|
130
|
-
* sessionId: state.sessionId,
|
|
131
|
-
* });
|
|
132
|
-
* // result1: { rawContent: "Invoice text...", metadata: {...} }
|
|
133
|
-
*
|
|
134
|
-
* // Parse local document using LlamaCloud
|
|
135
|
-
* const result2 = await parseDocument({
|
|
136
|
-
* documentSource: './contract.pdf',
|
|
137
|
-
* processingMode: DocumentProcessingMode.LOCAL,
|
|
138
|
-
* sessionId: state.sessionId,
|
|
139
|
-
* llamaCloudApiKey: process.env.LLAMA_CLOUD_API_KEY,
|
|
140
|
-
* });
|
|
141
|
-
* // result2: { rawContent: "Contract text...", metadata: {...} }
|
|
142
|
-
* ```
|
|
143
|
-
*/
|
|
144
|
-
async function parseDocument({ documentSource, processingMode = DocumentProcessingMode.MANAGED, sessionId, llamaCloudApiKey, }) {
|
|
145
|
-
if (!documentSource) {
|
|
146
|
-
throw new Error('documentSource is required - provide a URL or file path');
|
|
147
|
-
}
|
|
148
|
-
const isDocumentUrl = isUrl(documentSource);
|
|
149
|
-
if (processingMode === DocumentProcessingMode.MANAGED) {
|
|
150
|
-
return (0, parseDocumentManaged_1.parseDocumentWithManagedService)({
|
|
151
|
-
documentSource,
|
|
152
|
-
isDocumentUrl,
|
|
153
|
-
sessionId,
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
else {
|
|
157
|
-
return (0, parseDocumentLocal_1.parseDocumentWithLocalService)({
|
|
158
|
-
documentSource,
|
|
159
|
-
isDocumentUrl,
|
|
160
|
-
sessionId,
|
|
161
|
-
llamaCloudApiKey: llamaCloudApiKey !== null && llamaCloudApiKey !== void 0 ? llamaCloudApiKey : process.env.LLAMA_CLOUD_API_KEY,
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* Check if a string is a URL
|
|
167
|
-
*/
|
|
168
|
-
function isUrl(source) {
|
|
169
|
-
try {
|
|
170
|
-
const url = new URL(source);
|
|
171
|
-
return url.protocol === 'http:' || url.protocol === 'https:';
|
|
172
|
-
}
|
|
173
|
-
catch (_a) {
|
|
174
|
-
return false;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
111
|
//# sourceMappingURL=documentExtraction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documentExtraction.js","sourceRoot":"","sources":["../../../src/internalTools/documentExtraction/documentExtraction.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"documentExtraction.js","sourceRoot":"","sources":["../../../src/internalTools/documentExtraction/documentExtraction.ts"],"names":[],"mappings":";;AA2EA,sFAiEC;AA1ID,mEAA0E;AAC1E,mDAAwE;AAExE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqEG;AACI,KAAK,UAAU,qCAAqC,CAAgC,EACzF,eAAe,EACf,cAAc,EACd,SAAS,EACT,gBAAgB,EAChB,sBAAsB,GAAG,KAAK,EAC9B,GAAG,EACH,YAAY,EACZ,kBAAkB,GAUnB;IAIC,8CAA8C;IAC9C,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,CAC/B,eAAe,CAAC,GAAG,CAAC,CAAC,cAAc,EAAE,EAAE,CACrC,IAAA,6BAAa,EAAC;QACZ,cAAc;QACd,cAAc;QACd,SAAS;QACT,gBAAgB;KACjB,CAAC,CACH,CACF,CAAC;IAEF,wEAAwE;IACxE,MAAM,mBAAmB,GAAG,OAAO;SAChC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC;SACxB,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,MAAM,CAAC,CAAC;IAEhB,MAAM,MAAM,GAAG;QACb,UAAU,EAAE,mBAAmB;KAChC,CAAC;IAEF,IAAI,CAAC,sBAAsB,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;QAClD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CAAC,+FAA+F,CAAC,CAAC;IACnH,CAAC;IAED,mDAAmD;IACnD,MAAM,iBAAiB,GAAG,MAAM,IAAA,uDAA+B,EAAI;QACjE,OAAO,EAAE,MAAM,CAAC,UAAW;QAC3B,GAAG;QACH,MAAM,EAAE,YAAY;QACpB,MAAM,EAAE,kBAAkB;QAC1B,SAAS;KACV,CAAC,CAAC;IAEH,OAAO;QACL,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,iBAAiB;KAClB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Document processing mode
|
|
3
|
+
*/
|
|
4
|
+
export declare enum DocumentProcessingMode {
|
|
5
|
+
/** Process documents using Minded cloud service (default) */
|
|
6
|
+
MANAGED = "managed",
|
|
7
|
+
/** Process documents locally using LlamaCloud */
|
|
8
|
+
LOCAL = "local"
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Parse document and extract raw text content.
|
|
12
|
+
*
|
|
13
|
+
* This function processes various document types (PDFs, images, Word docs, etc.) and extracts
|
|
14
|
+
* raw text content using either local processing with LlamaCloud or managed backend service.
|
|
15
|
+
* Use this for raw text extraction without AI-powered data extraction.
|
|
16
|
+
*
|
|
17
|
+
* @param options - Document parsing options
|
|
18
|
+
* @param options.documentSource - URL or file path to the document
|
|
19
|
+
* @param options.processingMode - Parsing mode: DocumentProcessingMode.LOCAL (requires llamaCloudApiKey) or DocumentProcessingMode.MANAGED (backend service, default)
|
|
20
|
+
* @param options.sessionId - Unique session identifier for logging and tracking
|
|
21
|
+
* @param options.llamaCloudApiKey - LlamaCloud API key for local processing. Required when processingMode is DocumentProcessingMode.LOCAL. Can be provided as parameter or via LLAMA_CLOUD_API_KEY environment variable
|
|
22
|
+
*
|
|
23
|
+
* @returns Promise resolving to an object containing:
|
|
24
|
+
* - rawContent: The raw extracted text from the document
|
|
25
|
+
* - metadata: Document processing metadata (file size, type, processing time, content length)
|
|
26
|
+
*
|
|
27
|
+
* @throws {Error} If documentSource is not provided
|
|
28
|
+
* @throws {Error} If document processing fails
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* import { parseDocument, DocumentProcessingMode } from '@minded-ai/mindedjs';
|
|
33
|
+
*
|
|
34
|
+
* // Parse document using managed service
|
|
35
|
+
* const result1 = await parseDocument({
|
|
36
|
+
* documentSource: 'https://example.com/invoice.pdf',
|
|
37
|
+
* processingMode: DocumentProcessingMode.MANAGED,
|
|
38
|
+
* sessionId: state.sessionId,
|
|
39
|
+
* });
|
|
40
|
+
* // result1: { rawContent: "Invoice text...", metadata: {...} }
|
|
41
|
+
*
|
|
42
|
+
* // Parse local document using LlamaCloud
|
|
43
|
+
* const result2 = await parseDocument({
|
|
44
|
+
* documentSource: './contract.pdf',
|
|
45
|
+
* processingMode: DocumentProcessingMode.LOCAL,
|
|
46
|
+
* sessionId: state.sessionId,
|
|
47
|
+
* llamaCloudApiKey: process.env.LLAMA_CLOUD_API_KEY,
|
|
48
|
+
* });
|
|
49
|
+
* // result2: { rawContent: "Contract text...", metadata: {...} }
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export declare function parseDocument({ documentSource, processingMode, sessionId, llamaCloudApiKey, }: {
|
|
53
|
+
documentSource: string;
|
|
54
|
+
processingMode?: DocumentProcessingMode;
|
|
55
|
+
sessionId: string;
|
|
56
|
+
llamaCloudApiKey?: string;
|
|
57
|
+
}): Promise<{
|
|
58
|
+
rawContent?: string;
|
|
59
|
+
metadata?: {
|
|
60
|
+
fileSize?: number;
|
|
61
|
+
fileType: string;
|
|
62
|
+
processingTime: number;
|
|
63
|
+
contentLength: number;
|
|
64
|
+
};
|
|
65
|
+
}>;
|
|
66
|
+
//# sourceMappingURL=parseDocument.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseDocument.d.ts","sourceRoot":"","sources":["../../../src/internalTools/documentExtraction/parseDocument.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,oBAAY,sBAAsB;IAChC,6DAA6D;IAC7D,OAAO,YAAY;IACnB,iDAAiD;IACjD,KAAK,UAAU;CAChB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,wBAAsB,aAAa,CAAC,EAClC,cAAc,EACd,cAA+C,EAC/C,SAAS,EACT,gBAAgB,GACjB,EAAE;IACD,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,sBAAsB,CAAC;IACxC,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,GAAG,OAAO,CAAC;IACV,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE;QACT,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,QAAQ,EAAE,MAAM,CAAC;QACjB,cAAc,EAAE,MAAM,CAAC;QACvB,aAAa,EAAE,MAAM,CAAC;KACvB,CAAC;CACH,CAAC,CAqBD"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DocumentProcessingMode = void 0;
|
|
4
|
+
exports.parseDocument = parseDocument;
|
|
5
|
+
const parseDocumentManaged_1 = require("./parseDocumentManaged");
|
|
6
|
+
const parseDocumentLocal_1 = require("./parseDocumentLocal");
|
|
7
|
+
/**
|
|
8
|
+
* Document processing mode
|
|
9
|
+
*/
|
|
10
|
+
var DocumentProcessingMode;
|
|
11
|
+
(function (DocumentProcessingMode) {
|
|
12
|
+
/** Process documents using Minded cloud service (default) */
|
|
13
|
+
DocumentProcessingMode["MANAGED"] = "managed";
|
|
14
|
+
/** Process documents locally using LlamaCloud */
|
|
15
|
+
DocumentProcessingMode["LOCAL"] = "local";
|
|
16
|
+
})(DocumentProcessingMode || (exports.DocumentProcessingMode = DocumentProcessingMode = {}));
|
|
17
|
+
/**
|
|
18
|
+
* Parse document and extract raw text content.
|
|
19
|
+
*
|
|
20
|
+
* This function processes various document types (PDFs, images, Word docs, etc.) and extracts
|
|
21
|
+
* raw text content using either local processing with LlamaCloud or managed backend service.
|
|
22
|
+
* Use this for raw text extraction without AI-powered data extraction.
|
|
23
|
+
*
|
|
24
|
+
* @param options - Document parsing options
|
|
25
|
+
* @param options.documentSource - URL or file path to the document
|
|
26
|
+
* @param options.processingMode - Parsing mode: DocumentProcessingMode.LOCAL (requires llamaCloudApiKey) or DocumentProcessingMode.MANAGED (backend service, default)
|
|
27
|
+
* @param options.sessionId - Unique session identifier for logging and tracking
|
|
28
|
+
* @param options.llamaCloudApiKey - LlamaCloud API key for local processing. Required when processingMode is DocumentProcessingMode.LOCAL. Can be provided as parameter or via LLAMA_CLOUD_API_KEY environment variable
|
|
29
|
+
*
|
|
30
|
+
* @returns Promise resolving to an object containing:
|
|
31
|
+
* - rawContent: The raw extracted text from the document
|
|
32
|
+
* - metadata: Document processing metadata (file size, type, processing time, content length)
|
|
33
|
+
*
|
|
34
|
+
* @throws {Error} If documentSource is not provided
|
|
35
|
+
* @throws {Error} If document processing fails
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```typescript
|
|
39
|
+
* import { parseDocument, DocumentProcessingMode } from '@minded-ai/mindedjs';
|
|
40
|
+
*
|
|
41
|
+
* // Parse document using managed service
|
|
42
|
+
* const result1 = await parseDocument({
|
|
43
|
+
* documentSource: 'https://example.com/invoice.pdf',
|
|
44
|
+
* processingMode: DocumentProcessingMode.MANAGED,
|
|
45
|
+
* sessionId: state.sessionId,
|
|
46
|
+
* });
|
|
47
|
+
* // result1: { rawContent: "Invoice text...", metadata: {...} }
|
|
48
|
+
*
|
|
49
|
+
* // Parse local document using LlamaCloud
|
|
50
|
+
* const result2 = await parseDocument({
|
|
51
|
+
* documentSource: './contract.pdf',
|
|
52
|
+
* processingMode: DocumentProcessingMode.LOCAL,
|
|
53
|
+
* sessionId: state.sessionId,
|
|
54
|
+
* llamaCloudApiKey: process.env.LLAMA_CLOUD_API_KEY,
|
|
55
|
+
* });
|
|
56
|
+
* // result2: { rawContent: "Contract text...", metadata: {...} }
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
async function parseDocument({ documentSource, processingMode = DocumentProcessingMode.MANAGED, sessionId, llamaCloudApiKey, }) {
|
|
60
|
+
if (!documentSource) {
|
|
61
|
+
throw new Error('documentSource is required - provide a URL or file path');
|
|
62
|
+
}
|
|
63
|
+
const isDocumentUrl = isUrl(documentSource);
|
|
64
|
+
if (processingMode === DocumentProcessingMode.MANAGED) {
|
|
65
|
+
return (0, parseDocumentManaged_1.parseDocumentWithManagedService)({
|
|
66
|
+
documentSource,
|
|
67
|
+
isDocumentUrl,
|
|
68
|
+
sessionId,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
return (0, parseDocumentLocal_1.parseDocumentWithLocalService)({
|
|
73
|
+
documentSource,
|
|
74
|
+
isDocumentUrl,
|
|
75
|
+
sessionId,
|
|
76
|
+
llamaCloudApiKey: llamaCloudApiKey !== null && llamaCloudApiKey !== void 0 ? llamaCloudApiKey : process.env.LLAMA_CLOUD_API_KEY,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Check if a string is a URL
|
|
82
|
+
*/
|
|
83
|
+
function isUrl(source) {
|
|
84
|
+
try {
|
|
85
|
+
const url = new URL(source);
|
|
86
|
+
return url.protocol === 'http:' || url.protocol === 'https:';
|
|
87
|
+
}
|
|
88
|
+
catch (_a) {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=parseDocument.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseDocument.js","sourceRoot":"","sources":["../../../src/internalTools/documentExtraction/parseDocument.ts"],"names":[],"mappings":";;;AAuDA,sCAuCC;AA9FD,iEAAyE;AACzE,6DAAqE;AAErE;;GAEG;AACH,IAAY,sBAKX;AALD,WAAY,sBAAsB;IAChC,6DAA6D;IAC7D,6CAAmB,CAAA;IACnB,iDAAiD;IACjD,yCAAe,CAAA;AACjB,CAAC,EALW,sBAAsB,sCAAtB,sBAAsB,QAKjC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACI,KAAK,UAAU,aAAa,CAAC,EAClC,cAAc,EACd,cAAc,GAAG,sBAAsB,CAAC,OAAO,EAC/C,SAAS,EACT,gBAAgB,GAMjB;IASC,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;IAC7E,CAAC;IAED,MAAM,aAAa,GAAG,KAAK,CAAC,cAAc,CAAC,CAAC;IAE5C,IAAI,cAAc,KAAK,sBAAsB,CAAC,OAAO,EAAE,CAAC;QACtD,OAAO,IAAA,sDAA+B,EAAC;YACrC,cAAc;YACd,aAAa;YACb,SAAS;SACV,CAAC,CAAC;IACL,CAAC;SAAM,CAAC;QACN,OAAO,IAAA,kDAA6B,EAAC;YACnC,cAAc;YACd,aAAa;YACb,SAAS;YACT,gBAAgB,EAAE,gBAAgB,aAAhB,gBAAgB,cAAhB,gBAAgB,GAAI,OAAO,CAAC,GAAG,CAAC,mBAAmB;SACtE,CAAC,CAAC;IACL,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAS,KAAK,CAAC,MAAc;IAC3B,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;QAC5B,OAAO,GAAG,CAAC,QAAQ,KAAK,OAAO,IAAI,GAAG,CAAC,QAAQ,KAAK,QAAQ,CAAC;IAC/D,CAAC;IAAC,WAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
|
@@ -32,7 +32,7 @@ const addAppToolNode = async ({ graph, node, llm, agent, tools, }) => {
|
|
|
32
32
|
if (value !== '') {
|
|
33
33
|
// If the value is a string, compile it to allow variable injection
|
|
34
34
|
if (typeof value === 'string') {
|
|
35
|
-
compiledParameters[key] = (0, compilePrompt_1.
|
|
35
|
+
compiledParameters[key] = (0, compilePrompt_1.compileParameter)(value, compileContext);
|
|
36
36
|
}
|
|
37
37
|
else {
|
|
38
38
|
compiledParameters[key] = value;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addAppToolNode.js","sourceRoot":"","sources":["../../src/nodes/addAppToolNode.ts"],"names":[],"mappings":";;;AAAA,sDAAwF;AACxF,iDAA8D;AAE9D,uDAAyD;AAMzD,4CAAyC;AACzC,8CAAqD;AAErD,sDAA0D;AAC1D,
|
|
1
|
+
{"version":3,"file":"addAppToolNode.js","sourceRoot":"","sources":["../../src/nodes/addAppToolNode.ts"],"names":[],"mappings":";;;AAAA,sDAAwF;AACxF,iDAA8D;AAE9D,uDAAyD;AAMzD,4CAAyC;AACzC,8CAAqD;AAErD,sDAA0D;AAC1D,mDAAkE;AAClE,uDAAuD;AACvD,8DAA8D;AAC9D,0DAAiE;AAE1D,MAAM,cAAc,GAAG,KAAK,EAAE,EACnC,KAAK,EACL,IAAI,EACJ,GAAG,EACH,KAAK,EACL,KAAK,GAON,EAAE,EAAE;IACH,6CAA6C;IAC7C,MAAM,aAAa,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,SAAS,CAAC,CAAC;IAEzE,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,4BAA4B,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;IAClE,CAAC;IAED,MAAM,QAAQ,GAAiB,KAAK,EAAE,KAAmC,EAAE,EAAE;QAC3E,eAAM,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,4BAA4B,EAAE,IAAI,EAAE,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC;QAE9E,IAAA,+BAAmB,EACjB,oCAAkB,CAAC,cAAc,EACjC;YACE,QAAQ,EAAE,sBAAQ,CAAC,QAAQ;YAC3B,QAAQ,EAAE,IAAI,CAA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