n8n-nodes-empiriolabs 0.2.0 → 0.3.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 +132 -137
- package/dist/nodes/Empiriolabs/Empiriolabs.node.d.ts +3 -6
- package/dist/nodes/Empiriolabs/Empiriolabs.node.js +15 -12
- package/dist/nodes/Empiriolabs/Empiriolabs.node.js.map +1 -1
- package/dist/nodes/Empiriolabs/actions/document.d.ts +5 -0
- package/dist/nodes/Empiriolabs/actions/document.js +106 -0
- package/dist/nodes/Empiriolabs/actions/document.js.map +1 -0
- package/dist/nodes/Empiriolabs/actions/search.d.ts +3 -0
- package/dist/nodes/Empiriolabs/actions/search.js +28 -0
- package/dist/nodes/Empiriolabs/actions/search.js.map +1 -0
- package/dist/nodes/Empiriolabs/descriptions/DocumentDescription.d.ts +3 -0
- package/dist/nodes/Empiriolabs/descriptions/DocumentDescription.js +174 -0
- package/dist/nodes/Empiriolabs/descriptions/DocumentDescription.js.map +1 -0
- package/dist/nodes/Empiriolabs/descriptions/SearchDescription.d.ts +3 -0
- package/dist/nodes/Empiriolabs/descriptions/SearchDescription.js +77 -0
- package/dist/nodes/Empiriolabs/descriptions/SearchDescription.js.map +1 -0
- package/dist/nodes/Empiriolabs/methods/loadOptions.d.ts +2 -3
- package/dist/nodes/Empiriolabs/methods/loadOptions.js +10 -28
- package/dist/nodes/Empiriolabs/methods/loadOptions.js.map +1 -1
- package/dist/nodes/Empiriolabs/transport.d.ts +0 -5
- package/dist/nodes/Empiriolabs/transport.js +1 -44
- package/dist/nodes/Empiriolabs/transport.js.map +1 -1
- package/dist/package.json +5 -3
- package/dist/test/fixtures/invoice.png +0 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +72 -70
- package/dist/nodes/Empiriolabs/actions/tool.d.ts +0 -4
- package/dist/nodes/Empiriolabs/actions/tool.js +0 -81
- package/dist/nodes/Empiriolabs/actions/tool.js.map +0 -1
- package/dist/nodes/Empiriolabs/descriptions/ToolDescription.d.ts +0 -3
- package/dist/nodes/Empiriolabs/descriptions/ToolDescription.js +0 -82
- package/dist/nodes/Empiriolabs/descriptions/ToolDescription.js.map +0 -1
- package/dist/nodes/Empiriolabs/methods/resourceMapping.d.ts +0 -10
- package/dist/nodes/Empiriolabs/methods/resourceMapping.js +0 -154
- package/dist/nodes/Empiriolabs/methods/resourceMapping.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,137 +1,132 @@
|
|
|
1
|
-
# n8n-nodes-empiriolabs
|
|
2
|
-
|
|
3
|
-
This is an n8n community node package. It lets you use [EmpirioLabs AI](https://empiriolabs.ai) in your n8n workflows for chat, image generation, text to speech, transcription, video generation,
|
|
4
|
-
|
|
5
|
-
EmpirioLabs AI is a specialized AI inference and integration provider. It self-hosts open-source models on GPU infrastructure it manages, runs optimized endpoints for proprietary models, helps teams ship their own models to large audiences, and offers on-demand GPU Cloud instances and hosted AI agents. Its model catalog covers text, image, audio, video, transcription, embedding, reranking, research, and 3D models.
|
|
6
|
-
|
|
7
|
-
[n8n](https://n8n.io/) is a [fair-code licensed](https://docs.n8n.io/sustainable-use-license/) workflow automation platform.
|
|
8
|
-
|
|
9
|
-
[Installation](#installation)
|
|
10
|
-
[Operations](#operations)
|
|
11
|
-
[Trigger](#trigger)
|
|
12
|
-
[Credentials](#credentials)
|
|
13
|
-
[Compatibility](#compatibility)
|
|
14
|
-
[Usage](#usage)
|
|
15
|
-
[Development](#development)
|
|
16
|
-
[Resources](#resources)
|
|
17
|
-
[Version history](#version-history)
|
|
18
|
-
|
|
19
|
-
## Installation
|
|
20
|
-
|
|
21
|
-
Follow the [installation guide](https://docs.n8n.io/integrations/community-nodes/installation/) in the n8n community nodes documentation and install the package `n8n-nodes-empiriolabs`.
|
|
22
|
-
|
|
23
|
-
## Operations
|
|
24
|
-
|
|
25
|
-
The **EmpirioLabs AI** node supports these resources and operations. Every model list loads live from the EmpirioLabs AI model catalog and shows only the models that support the selected operation.
|
|
26
|
-
|
|
27
|
-
| Resource | Operation | What it does |
|
|
28
|
-
| --- | --- | --- |
|
|
29
|
-
| Audio | Text to Speech | Turns text into speech and returns the audio as a binary file. Choose a model, a voice the model offers, and optionally a language and output format. |
|
|
30
|
-
| Audio | Transcribe | Turns speech into text from a binary file in the input item or from a public HTTPS file URL. Waits for the transcript by default and returns the text, language, and duration. |
|
|
31
|
-
| Chat | Create Completion | Sends a prompt (with an optional system message) or a full conversation to a chat model and returns the reply. Options include temperature, maximum number of tokens, top P, and JSON output. |
|
|
32
|
-
|
|
|
33
|
-
|
|
|
34
|
-
|
|
|
35
|
-
| Job | Get
|
|
36
|
-
|
|
|
37
|
-
|
|
|
38
|
-
| Video | Generate | Starts a video generation job and returns the job. Turn on **Wait for Completion** to wait for the video, with a timeout, and download it as a binary file. |
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
- **
|
|
50
|
-
- **
|
|
51
|
-
- **
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
##
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
npm run
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
##
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
First release: Audio (Text to Speech, Transcribe), Chat (Create Completion), Embedding (Create), Image (Generate), Job (Get, Get Many), Model (Get Many), Video (Generate), and the Job Finished trigger.
|
|
134
|
-
|
|
135
|
-
## License
|
|
136
|
-
|
|
137
|
-
[MIT](LICENSE.md)
|
|
1
|
+
# n8n-nodes-empiriolabs
|
|
2
|
+
|
|
3
|
+
This is an n8n community node package. It lets you use [EmpirioLabs AI](https://empiriolabs.ai) in your n8n workflows for chat, image generation, text to speech, transcription, video generation, embeddings, document reading (OCR), and web search. It can also start a workflow when a generation job finishes.
|
|
4
|
+
|
|
5
|
+
EmpirioLabs AI is a specialized AI inference and integration provider. It self-hosts open-source models on GPU infrastructure it manages, runs optimized endpoints for proprietary models, helps teams ship their own models to large audiences, and offers on-demand GPU Cloud instances and hosted AI agents. Its model catalog covers text, image, audio, video, transcription, embedding, reranking, research, and 3D models.
|
|
6
|
+
|
|
7
|
+
[n8n](https://n8n.io/) is a [fair-code licensed](https://docs.n8n.io/sustainable-use-license/) workflow automation platform.
|
|
8
|
+
|
|
9
|
+
[Installation](#installation)
|
|
10
|
+
[Operations](#operations)
|
|
11
|
+
[Trigger](#trigger)
|
|
12
|
+
[Credentials](#credentials)
|
|
13
|
+
[Compatibility](#compatibility)
|
|
14
|
+
[Usage](#usage)
|
|
15
|
+
[Development](#development)
|
|
16
|
+
[Resources](#resources)
|
|
17
|
+
[Version history](#version-history)
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
Follow the [installation guide](https://docs.n8n.io/integrations/community-nodes/installation/) in the n8n community nodes documentation and install the package `n8n-nodes-empiriolabs`.
|
|
22
|
+
|
|
23
|
+
## Operations
|
|
24
|
+
|
|
25
|
+
The **EmpirioLabs AI** node supports these resources and operations. Every model list loads live from the EmpirioLabs AI model catalog and shows only the models that support the selected operation.
|
|
26
|
+
|
|
27
|
+
| Resource | Operation | What it does |
|
|
28
|
+
| --- | --- | --- |
|
|
29
|
+
| Audio | Text to Speech | Turns text into speech and returns the audio as a binary file. Choose a model, a voice the model offers, and optionally a language and output format. |
|
|
30
|
+
| Audio | Transcribe | Turns speech into text from a binary file in the input item or from a public HTTPS file URL. Waits for the transcript by default and returns the text, language, and duration. |
|
|
31
|
+
| Chat | Create Completion | Sends a prompt (with an optional system message) or a full conversation to a chat model and returns the reply. Options include temperature, maximum number of tokens, top P, and JSON output. |
|
|
32
|
+
| Document | Read | Reads a PDF or an image (PNG, JPEG, WebP, TIFF, BMP, GIF or AVIF) from a binary file in the input item or from a public HTTPS URL, and returns every page as Markdown, plus `text`, the whole document as one Markdown text. Options choose pages, move tables, headers and footers into their own fields, and return image regions. A long document is read in the background, and the node waits for it by default. |
|
|
33
|
+
| Embedding | Create | Returns the embedding vector for a text. |
|
|
34
|
+
| Image | Generate | Creates images from a prompt and returns each image as a binary file in its own item. Options include aspect ratio, resolution, number of images, and reference image URLs for editing. |
|
|
35
|
+
| Job | Get | Returns the status and result of a job. Can also download the finished file as binary data. |
|
|
36
|
+
| Job | Get Many | Returns recent jobs, optionally filtered by status. |
|
|
37
|
+
| Model | Get Many | Returns models from the catalog, optionally filtered by category or search text. |
|
|
38
|
+
| Video | Generate | Starts a video generation job and returns the job. Turn on **Wait for Completion** to wait for the video, with a timeout, and download it as a binary file. |
|
|
39
|
+
| Web Search | Search | Searches the web with a search model and returns its answer: results with titles, URLs and snippets, an answer, or both, depending on the model. Each model's own fields, such as the number of results, go in **Model Parameters (JSON)**. |
|
|
40
|
+
|
|
41
|
+
Operations that create content also accept **Model Parameters (JSON)**: extra request fields for the selected model, such as `{"seed": 42}`. Each model lists the fields it accepts on its page in the [model catalog](https://docs.empiriolabs.ai/models-pricing).
|
|
42
|
+
|
|
43
|
+
The node can be used as a tool by the n8n AI Agent.
|
|
44
|
+
|
|
45
|
+
## Trigger
|
|
46
|
+
|
|
47
|
+
The **EmpirioLabs AI Trigger** node polls your recent jobs and starts the workflow when a job finishes.
|
|
48
|
+
|
|
49
|
+
- **Event:** Job Finished.
|
|
50
|
+
- **Statuses:** Completed, Failed, or Cancelled. Completed and Failed are selected by default.
|
|
51
|
+
- **Filters:** job type (image, video, music and sound, speech, transcription, or 3D generation) and model ID.
|
|
52
|
+
|
|
53
|
+
Each finished job starts the workflow once. When you activate the workflow, jobs that already finished are skipped. The jobs list covers the last hour, so keep the poll interval under an hour. When you test the trigger in the editor, it returns the most recent finished job.
|
|
54
|
+
|
|
55
|
+
## Credentials
|
|
56
|
+
|
|
57
|
+
The nodes authenticate with an EmpirioLabs AI API key.
|
|
58
|
+
|
|
59
|
+
1. Sign in or create an account at [platform.empiriolabs.ai](https://platform.empiriolabs.ai).
|
|
60
|
+
2. Open [API Keys](https://platform.empiriolabs.ai/dashboard/api-keys) in the dashboard and create a key. Keys start with `sk-empiriolabs-`.
|
|
61
|
+
3. In n8n, create a new **EmpirioLabs AI API** credential and paste the key into **API Key**.
|
|
62
|
+
|
|
63
|
+
n8n checks the key with a request to `GET https://api.empiriolabs.ai/v1/account/usage?limit=1`, which does not use credits. Requests that run models use the credits on your account; prices are listed on the [pricing page](https://empiriolabs.ai/pricing). See [Authentication](https://docs.empiriolabs.ai/authentication) for more about API keys.
|
|
64
|
+
|
|
65
|
+
## Compatibility
|
|
66
|
+
|
|
67
|
+
Built with the n8n node CLI (`@n8n/node-cli` 0.54) and tested against `n8n-workflow` 2.45. The package has no runtime dependencies.
|
|
68
|
+
|
|
69
|
+
## Usage
|
|
70
|
+
|
|
71
|
+
- **Choosing a model:** each model list shows the models whose catalog entry supports the selected operation. To set a model by ID instead, switch the field to **Expression** and enter an ID from the [models page](https://empiriolabs.ai/models).
|
|
72
|
+
- **Voices:** the Voice list shows the voices the selected text to speech model offers. **Model Default** uses the default voice of the model.
|
|
73
|
+
- **Binary files:** images, speech, and downloaded videos are returned in the binary field `data`. Change it with **Put Output in Field**. For transcription, set **Input Data Field Name** to the binary field that holds the audio or video file.
|
|
74
|
+
- **Long jobs:** video generation usually takes 1 to 15 minutes. Either turn on **Wait for Completion** and set a timeout, or keep the default, which returns the job right away, and continue with the Job resource or the trigger. Job results are kept for one hour after the job finishes.
|
|
75
|
+
- **Generated file links expire 7 days after they are created.** Download a file you want to keep, for example with the download options on the Video and Job resources.
|
|
76
|
+
- **Errors:** the node shows the message returned by the API, such as an unsupported parameter for the selected model. Turn on **Continue On Fail** in the node settings to keep the workflow running and return the message in the item instead.
|
|
77
|
+
|
|
78
|
+
## Development
|
|
79
|
+
|
|
80
|
+
```sh
|
|
81
|
+
npm install
|
|
82
|
+
npm run build # compile to dist/
|
|
83
|
+
npm run lint # n8n community node lint rules
|
|
84
|
+
npm test # offline unit tests with a mocked n8n context
|
|
85
|
+
npm run scan:local # the lint passes of @n8n/scan-community-package, run locally
|
|
86
|
+
npm run dev # start n8n with this package loaded at http://localhost:5678
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
`npm run scan:local` installs `@n8n/scan-community-package` into `.scan/` and runs its two lint passes against the source and against the files `npm pack` would publish. The published scan, `npx @n8n/scan-community-package n8n-nodes-empiriolabs`, also checks npm provenance, so it can only pass after a version is published from GitHub Actions.
|
|
90
|
+
|
|
91
|
+
The live smoke test is skipped unless you opt in. It runs the credential test and one short chat completion on the cheapest chat model in the catalog, which uses a small amount of credit:
|
|
92
|
+
|
|
93
|
+
```sh
|
|
94
|
+
EMPIRIOLABS_LIVE=1 EMPIRIOLABS_API_KEY=sk-empiriolabs-... npm run test:live
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Set `EMPIRIOLABS_LIVE_MODEL` to choose the chat model.
|
|
98
|
+
|
|
99
|
+
### Releasing
|
|
100
|
+
|
|
101
|
+
Versions are published to npm with a provenance statement by the [Publish workflow](.github/workflows/publish.yml) when a version tag such as `0.1.0` is pushed. Run `npm run release` to bump the version, update the changelog, tag, and push.
|
|
102
|
+
|
|
103
|
+
## Resources
|
|
104
|
+
|
|
105
|
+
- [n8n community nodes documentation](https://docs.n8n.io/integrations/#community-nodes)
|
|
106
|
+
- [EmpirioLabs AI documentation](https://docs.empiriolabs.ai/getting-started)
|
|
107
|
+
- [EmpirioLabs AI API reference](https://docs.empiriolabs.ai/api-reference-overview)
|
|
108
|
+
- [EmpirioLabs AI models](https://empiriolabs.ai/models)
|
|
109
|
+
- [npm package](https://www.npmjs.com/package/n8n-nodes-empiriolabs)
|
|
110
|
+
- Support: [support@empiriolabs.ai](mailto:support@empiriolabs.ai)
|
|
111
|
+
|
|
112
|
+
## Version history
|
|
113
|
+
|
|
114
|
+
### 0.3.0
|
|
115
|
+
|
|
116
|
+
New Document resource (Read: a PDF or an image as Markdown) and Web Search resource (Search), each calling the EmpirioLabs AI API directly with typed fields. They replace the Tool resource of 0.2.0, which is removed.
|
|
117
|
+
|
|
118
|
+
### 0.2.0
|
|
119
|
+
|
|
120
|
+
New Tool resource with the Run operation (Run a tool), which runs any EmpirioLabs AI tool. The tool list and each tool's arguments load live from EmpirioLabs AI, so new tools appear without a node update.
|
|
121
|
+
|
|
122
|
+
### 0.1.1
|
|
123
|
+
|
|
124
|
+
Published from GitHub Actions through npm trusted publishing, with provenance. The README links the npm package.
|
|
125
|
+
|
|
126
|
+
### 0.1.0
|
|
127
|
+
|
|
128
|
+
First release: Audio (Text to Speech, Transcribe), Chat (Create Completion), Embedding (Create), Image (Generate), Job (Get, Get Many), Model (Get Many), Video (Generate), and the Job Finished trigger.
|
|
129
|
+
|
|
130
|
+
## License
|
|
131
|
+
|
|
132
|
+
[MIT](LICENSE.md)
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import type { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
2
|
-
import { getChatModels, getEmbeddingModels, getImageModels, getModelCategories,
|
|
2
|
+
import { getChatModels, getDocumentModels, getEmbeddingModels, getImageModels, getModelCategories, getSearchModels, getSpeechModels, getTranscriptionModels, getVideoModels, getVoices } from './methods/loadOptions';
|
|
3
3
|
import { searchJobs } from './methods/listSearch';
|
|
4
|
-
import { getToolFields } from './methods/resourceMapping';
|
|
5
4
|
export declare class Empiriolabs implements INodeType {
|
|
6
5
|
description: INodeTypeDescription;
|
|
7
6
|
methods: {
|
|
8
7
|
loadOptions: {
|
|
9
8
|
getChatModels: typeof getChatModels;
|
|
9
|
+
getDocumentModels: typeof getDocumentModels;
|
|
10
10
|
getEmbeddingModels: typeof getEmbeddingModels;
|
|
11
11
|
getImageModels: typeof getImageModels;
|
|
12
12
|
getModelCategories: typeof getModelCategories;
|
|
13
|
+
getSearchModels: typeof getSearchModels;
|
|
13
14
|
getSpeechModels: typeof getSpeechModels;
|
|
14
|
-
getTools: typeof getTools;
|
|
15
15
|
getTranscriptionModels: typeof getTranscriptionModels;
|
|
16
16
|
getVideoModels: typeof getVideoModels;
|
|
17
17
|
getVoices: typeof getVoices;
|
|
@@ -19,9 +19,6 @@ export declare class Empiriolabs implements INodeType {
|
|
|
19
19
|
listSearch: {
|
|
20
20
|
searchJobs: typeof searchJobs;
|
|
21
21
|
};
|
|
22
|
-
resourceMapping: {
|
|
23
|
-
getToolFields: typeof getToolFields;
|
|
24
|
-
};
|
|
25
22
|
};
|
|
26
23
|
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
27
24
|
}
|
|
@@ -4,32 +4,34 @@ exports.Empiriolabs = void 0;
|
|
|
4
4
|
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
5
|
const audio_1 = require("./actions/audio");
|
|
6
6
|
const chat_1 = require("./actions/chat");
|
|
7
|
+
const document_1 = require("./actions/document");
|
|
7
8
|
const embedding_1 = require("./actions/embedding");
|
|
8
9
|
const image_1 = require("./actions/image");
|
|
9
10
|
const job_1 = require("./actions/job");
|
|
10
11
|
const model_1 = require("./actions/model");
|
|
11
|
-
const
|
|
12
|
+
const search_1 = require("./actions/search");
|
|
12
13
|
const video_1 = require("./actions/video");
|
|
13
14
|
const AudioDescription_1 = require("./descriptions/AudioDescription");
|
|
14
15
|
const ChatDescription_1 = require("./descriptions/ChatDescription");
|
|
16
|
+
const DocumentDescription_1 = require("./descriptions/DocumentDescription");
|
|
15
17
|
const EmbeddingDescription_1 = require("./descriptions/EmbeddingDescription");
|
|
16
18
|
const ImageDescription_1 = require("./descriptions/ImageDescription");
|
|
17
19
|
const JobDescription_1 = require("./descriptions/JobDescription");
|
|
18
20
|
const ModelDescription_1 = require("./descriptions/ModelDescription");
|
|
19
|
-
const
|
|
21
|
+
const SearchDescription_1 = require("./descriptions/SearchDescription");
|
|
20
22
|
const VideoDescription_1 = require("./descriptions/VideoDescription");
|
|
21
23
|
const loadOptions_1 = require("./methods/loadOptions");
|
|
22
24
|
const listSearch_1 = require("./methods/listSearch");
|
|
23
|
-
const resourceMapping_1 = require("./methods/resourceMapping");
|
|
24
25
|
const OPERATIONS = {
|
|
25
26
|
audio: { textToSpeech: audio_1.textToSpeech, transcribe: audio_1.transcribe },
|
|
26
27
|
chat: { create: chat_1.createChatCompletion },
|
|
28
|
+
document: { read: document_1.readDocument },
|
|
27
29
|
embedding: { create: embedding_1.createEmbedding },
|
|
28
30
|
image: { generate: image_1.generateImage },
|
|
29
31
|
job: { get: job_1.getJob, getAll: job_1.getManyJobs },
|
|
30
32
|
model: { getAll: model_1.getManyModels },
|
|
31
|
-
tool: { run: tool_1.runTool },
|
|
32
33
|
video: { generate: video_1.generateVideo },
|
|
34
|
+
webSearch: { search: search_1.searchWeb },
|
|
33
35
|
};
|
|
34
36
|
class Empiriolabs {
|
|
35
37
|
constructor() {
|
|
@@ -40,7 +42,7 @@ class Empiriolabs {
|
|
|
40
42
|
group: ['transform'],
|
|
41
43
|
version: 1,
|
|
42
44
|
subtitle: '={{ $parameter["operation"] + ": " + $parameter["resource"] }}',
|
|
43
|
-
description: 'Use EmpirioLabs AI models for chat, images, speech, transcription, video,
|
|
45
|
+
description: 'Use EmpirioLabs AI models for chat, images, speech, transcription, video, embeddings, document reading, and web search',
|
|
44
46
|
defaults: {
|
|
45
47
|
name: 'EmpirioLabs AI',
|
|
46
48
|
},
|
|
@@ -62,12 +64,13 @@ class Empiriolabs {
|
|
|
62
64
|
options: [
|
|
63
65
|
{ name: 'Audio', value: 'audio' },
|
|
64
66
|
{ name: 'Chat', value: 'chat' },
|
|
67
|
+
{ name: 'Document', value: 'document' },
|
|
65
68
|
{ name: 'Embedding', value: 'embedding' },
|
|
66
69
|
{ name: 'Image', value: 'image' },
|
|
67
70
|
{ name: 'Job', value: 'job' },
|
|
68
71
|
{ name: 'Model', value: 'model' },
|
|
69
|
-
{ name: 'Tool', value: 'tool' },
|
|
70
72
|
{ name: 'Video', value: 'video' },
|
|
73
|
+
{ name: 'Web Search', value: 'webSearch' },
|
|
71
74
|
],
|
|
72
75
|
default: 'chat',
|
|
73
76
|
},
|
|
@@ -75,6 +78,8 @@ class Empiriolabs {
|
|
|
75
78
|
...AudioDescription_1.audioFields,
|
|
76
79
|
...ChatDescription_1.chatOperations,
|
|
77
80
|
...ChatDescription_1.chatFields,
|
|
81
|
+
...DocumentDescription_1.documentOperations,
|
|
82
|
+
...DocumentDescription_1.documentFields,
|
|
78
83
|
...EmbeddingDescription_1.embeddingOperations,
|
|
79
84
|
...EmbeddingDescription_1.embeddingFields,
|
|
80
85
|
...ImageDescription_1.imageOperations,
|
|
@@ -83,20 +88,21 @@ class Empiriolabs {
|
|
|
83
88
|
...JobDescription_1.jobFields,
|
|
84
89
|
...ModelDescription_1.modelOperations,
|
|
85
90
|
...ModelDescription_1.modelFields,
|
|
86
|
-
...ToolDescription_1.toolOperations,
|
|
87
|
-
...ToolDescription_1.toolFields,
|
|
88
91
|
...VideoDescription_1.videoOperations,
|
|
89
92
|
...VideoDescription_1.videoFields,
|
|
93
|
+
...SearchDescription_1.searchOperations,
|
|
94
|
+
...SearchDescription_1.searchFields,
|
|
90
95
|
],
|
|
91
96
|
};
|
|
92
97
|
this.methods = {
|
|
93
98
|
loadOptions: {
|
|
94
99
|
getChatModels: loadOptions_1.getChatModels,
|
|
100
|
+
getDocumentModels: loadOptions_1.getDocumentModels,
|
|
95
101
|
getEmbeddingModels: loadOptions_1.getEmbeddingModels,
|
|
96
102
|
getImageModels: loadOptions_1.getImageModels,
|
|
97
103
|
getModelCategories: loadOptions_1.getModelCategories,
|
|
104
|
+
getSearchModels: loadOptions_1.getSearchModels,
|
|
98
105
|
getSpeechModels: loadOptions_1.getSpeechModels,
|
|
99
|
-
getTools: loadOptions_1.getTools,
|
|
100
106
|
getTranscriptionModels: loadOptions_1.getTranscriptionModels,
|
|
101
107
|
getVideoModels: loadOptions_1.getVideoModels,
|
|
102
108
|
getVoices: loadOptions_1.getVoices,
|
|
@@ -104,9 +110,6 @@ class Empiriolabs {
|
|
|
104
110
|
listSearch: {
|
|
105
111
|
searchJobs: listSearch_1.searchJobs,
|
|
106
112
|
},
|
|
107
|
-
resourceMapping: {
|
|
108
|
-
getToolFields: resourceMapping_1.getToolFields,
|
|
109
|
-
},
|
|
110
113
|
};
|
|
111
114
|
}
|
|
112
115
|
async execute() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Empiriolabs.node.js","sourceRoot":"","sources":["../../../nodes/Empiriolabs/Empiriolabs.node.ts"],"names":[],"mappings":";;;AAOA,+CAAqF;AAErF,2CAA2D;AAC3D,yCAAsD;AACtD,mDAAsD;AACtD,2CAAgD;AAChD,uCAAoD;AACpD,2CAAgD;A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,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;YAC3D,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,IAAI,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC;oBAC3B,UAAU,CAAC,IAAI,CAAC;wBACf,IAAI,EAAE,EAAE,KAAK,EAAG,KAAe,CAAC,OAAO,EAAE;wBACzC,UAAU,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;qBAC/B,CAAC,CAAC;oBACH,SAAS;gBACV,CAAC;gBACD,IAAI,KAAK,YAAY,2BAAY,EAAE,CAAC;oBAEnC,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;wBAC3C,KAAK,CAAC,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;oBACrC,CAAC;oBACD,MAAM,IAAI,2BAAY,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,KAA8B,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;gBACvF,CAAC;gBACD,MAAM,IAAI,iCAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,KAAc,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;YAC7E,CAAC;QACF,CAAC;QAED,OAAO,CAAC,UAAU,CAAC,CAAC;IACrB,CAAC;CACD;AAtHD,kCAsHC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { IDataObject, IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
|
|
2
|
+
export declare function documentText(result: IDataObject): string;
|
|
3
|
+
export declare function ocrDocument(kind: 'pdf' | 'image', url: string): IDataObject;
|
|
4
|
+
export declare function buildDocumentBody(this: IExecuteFunctions, itemIndex: number): Promise<IDataObject>;
|
|
5
|
+
export declare function readDocument(this: IExecuteFunctions, itemIndex: number): Promise<INodeExecutionData[]>;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.documentText = documentText;
|
|
4
|
+
exports.ocrDocument = ocrDocument;
|
|
5
|
+
exports.buildDocumentBody = buildDocumentBody;
|
|
6
|
+
exports.readDocument = readDocument;
|
|
7
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
8
|
+
const transport_1 = require("../transport");
|
|
9
|
+
const IMAGE_TYPES = [
|
|
10
|
+
'image/png',
|
|
11
|
+
'image/jpeg',
|
|
12
|
+
'image/webp',
|
|
13
|
+
'image/tiff',
|
|
14
|
+
'image/bmp',
|
|
15
|
+
'image/gif',
|
|
16
|
+
'image/avif',
|
|
17
|
+
];
|
|
18
|
+
function documentText(result) {
|
|
19
|
+
const pages = Array.isArray(result.pages) ? result.pages.filter(transport_1.isDataObject) : [];
|
|
20
|
+
return pages
|
|
21
|
+
.map((page) => (typeof page.markdown === 'string' ? page.markdown.trim() : ''))
|
|
22
|
+
.filter((markdown) => markdown !== '')
|
|
23
|
+
.join('\n\n');
|
|
24
|
+
}
|
|
25
|
+
function ocrDocument(kind, url) {
|
|
26
|
+
return kind === 'pdf'
|
|
27
|
+
? { type: 'document_url', document_url: url }
|
|
28
|
+
: { type: 'image_url', image_url: url };
|
|
29
|
+
}
|
|
30
|
+
async function documentFromBinary(itemIndex) {
|
|
31
|
+
var _a, _b;
|
|
32
|
+
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', itemIndex);
|
|
33
|
+
const binaryData = this.helpers.assertBinaryData(itemIndex, binaryPropertyName);
|
|
34
|
+
const mimeType = String((_a = binaryData.mimeType) !== null && _a !== void 0 ? _a : '').toLowerCase();
|
|
35
|
+
const extension = String((_b = binaryData.fileExtension) !== null && _b !== void 0 ? _b : '').toLowerCase();
|
|
36
|
+
const isPdf = mimeType === 'application/pdf' || extension === 'pdf';
|
|
37
|
+
if (!isPdf && !IMAGE_TYPES.includes(mimeType)) {
|
|
38
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'The file is not a PDF or a supported image', {
|
|
39
|
+
itemIndex,
|
|
40
|
+
description: `The field "${binaryPropertyName}" holds a file of type "${mimeType || 'unknown'}". Read a PDF, or a PNG, JPEG, WebP, TIFF, BMP, GIF or AVIF image.`,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
const buffer = await this.helpers.getBinaryDataBuffer(itemIndex, binaryPropertyName);
|
|
44
|
+
const dataUri = `data:${isPdf ? 'application/pdf' : mimeType};base64,${buffer.toString('base64')}`;
|
|
45
|
+
return ocrDocument(isPdf ? 'pdf' : 'image', dataUri);
|
|
46
|
+
}
|
|
47
|
+
async function buildDocumentBody(itemIndex) {
|
|
48
|
+
const model = this.getNodeParameter('model', itemIndex);
|
|
49
|
+
const inputSource = this.getNodeParameter('inputSource', itemIndex, 'binaryData');
|
|
50
|
+
const options = this.getNodeParameter('options', itemIndex, {});
|
|
51
|
+
let document;
|
|
52
|
+
if (inputSource === 'url') {
|
|
53
|
+
const fileUrl = this.getNodeParameter('fileUrl', itemIndex).trim();
|
|
54
|
+
const fileType = this.getNodeParameter('fileType', itemIndex, 'pdf');
|
|
55
|
+
document = ocrDocument(fileType === 'image' ? 'image' : 'pdf', fileUrl);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
document = await documentFromBinary.call(this, itemIndex);
|
|
59
|
+
}
|
|
60
|
+
const optional = {};
|
|
61
|
+
if (typeof options.pages === 'string' && options.pages.trim() !== '') {
|
|
62
|
+
optional.pages = options.pages.trim();
|
|
63
|
+
}
|
|
64
|
+
if (typeof options.tableFormat === 'string' && options.tableFormat !== '') {
|
|
65
|
+
optional.table_format = options.tableFormat;
|
|
66
|
+
}
|
|
67
|
+
if (options.extractHeader === true) {
|
|
68
|
+
optional.extract_header = true;
|
|
69
|
+
}
|
|
70
|
+
if (options.extractFooter === true) {
|
|
71
|
+
optional.extract_footer = true;
|
|
72
|
+
}
|
|
73
|
+
if (options.includeImageBase64 === true) {
|
|
74
|
+
optional.include_image_base64 = true;
|
|
75
|
+
}
|
|
76
|
+
if (typeof options.imageLimit === 'number' && options.imageLimit > 0) {
|
|
77
|
+
optional.image_limit = options.imageLimit;
|
|
78
|
+
}
|
|
79
|
+
if (typeof options.imageMinSize === 'number' && options.imageMinSize > 0) {
|
|
80
|
+
optional.image_min_size = options.imageMinSize;
|
|
81
|
+
}
|
|
82
|
+
const extra = transport_1.parseJsonObjectParameter.call(this, options.modelParameters, 'Model Parameters (JSON)', itemIndex);
|
|
83
|
+
return { ...optional, ...extra, model, document };
|
|
84
|
+
}
|
|
85
|
+
async function readDocument(itemIndex) {
|
|
86
|
+
const options = this.getNodeParameter('options', itemIndex, {});
|
|
87
|
+
const body = await buildDocumentBody.call(this, itemIndex);
|
|
88
|
+
const response = await transport_1.apiRequest.call(this, 'POST', '/ocr', body);
|
|
89
|
+
if (!(0, transport_1.isJobEnvelope)(response)) {
|
|
90
|
+
return [{ json: { text: documentText(response), ...response }, pairedItem: { item: itemIndex } }];
|
|
91
|
+
}
|
|
92
|
+
const wait = this.getNodeParameter('waitForCompletion', itemIndex, true);
|
|
93
|
+
if (!wait) {
|
|
94
|
+
return [{ json: response, pairedItem: { item: itemIndex } }];
|
|
95
|
+
}
|
|
96
|
+
const timeout = typeof options.timeout === 'number' ? options.timeout : 600;
|
|
97
|
+
const job = await transport_1.waitForJob.call(this, String(response.job_id), timeout, itemIndex, 5);
|
|
98
|
+
const result = (0, transport_1.isDataObject)(job.result) ? job.result : {};
|
|
99
|
+
return [
|
|
100
|
+
{
|
|
101
|
+
json: { text: documentText(result), ...result, job_id: job.job_id },
|
|
102
|
+
pairedItem: { item: itemIndex },
|
|
103
|
+
},
|
|
104
|
+
];
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=document.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document.js","sourceRoot":"","sources":["../../../../nodes/Empiriolabs/actions/document.ts"],"names":[],"mappings":";;AAsBA,oCAMC;AA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AE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC;IAC9D,CAAC;IACD,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;IAC5E,MAAM,GAAG,GAAG,MAAM,sBAAU,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;IACxF,MAAM,MAAM,GAAG,IAAA,wBAAY,EAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1D,OAAO;QACN;YACC,IAAI,EAAE,EAAE,IAAI,EAAE,YAAY,CAAC,MAAM,CAAC,EAAE,GAAG,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE;YACnE,UAAU,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;SAC/B;KACD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { IDataObject, IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
|
|
2
|
+
export declare function buildSearchBody(this: IExecuteFunctions, itemIndex: number): IDataObject;
|
|
3
|
+
export declare function searchWeb(this: IExecuteFunctions, itemIndex: number): Promise<INodeExecutionData[]>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildSearchBody = buildSearchBody;
|
|
4
|
+
exports.searchWeb = searchWeb;
|
|
5
|
+
const transport_1 = require("../transport");
|
|
6
|
+
function buildSearchBody(itemIndex) {
|
|
7
|
+
const model = this.getNodeParameter('model', itemIndex);
|
|
8
|
+
const query = this.getNodeParameter('query', itemIndex).trim();
|
|
9
|
+
const options = this.getNodeParameter('options', itemIndex, {});
|
|
10
|
+
const extra = transport_1.parseJsonObjectParameter.call(this, options.modelParameters, 'Model Parameters (JSON)', itemIndex);
|
|
11
|
+
return { ...extra, model, query };
|
|
12
|
+
}
|
|
13
|
+
async function searchWeb(itemIndex) {
|
|
14
|
+
const options = this.getNodeParameter('options', itemIndex, {});
|
|
15
|
+
const response = await transport_1.apiRequest.call(this, 'POST', '/search', buildSearchBody.call(this, itemIndex));
|
|
16
|
+
if (!(0, transport_1.isJobEnvelope)(response)) {
|
|
17
|
+
return [{ json: response, pairedItem: { item: itemIndex } }];
|
|
18
|
+
}
|
|
19
|
+
const wait = this.getNodeParameter('waitForCompletion', itemIndex, true);
|
|
20
|
+
if (!wait) {
|
|
21
|
+
return [{ json: response, pairedItem: { item: itemIndex } }];
|
|
22
|
+
}
|
|
23
|
+
const timeout = typeof options.timeout === 'number' ? options.timeout : 600;
|
|
24
|
+
const job = await transport_1.waitForJob.call(this, String(response.job_id), timeout, itemIndex, 5);
|
|
25
|
+
const result = (0, transport_1.isDataObject)(job.result) ? job.result : {};
|
|
26
|
+
return [{ json: { ...result, job_id: job.job_id }, pairedItem: { item: itemIndex } }];
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../../../nodes/Empiriolabs/actions/search.ts"],"names":[],"mappings":";;AAUA,0CAWC;AAMD,8BAkBC;AA3CD,4CAMsB;AAEtB,SAAgB,eAAe,CAA0B,SAAiB;IACzE,MAAM,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,SAAS,CAAW,CAAC;IAClE,MAAM,KAAK,GAAI,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,SAAS,CAAY,CAAC,IAAI,EAAE,CAAC;IAC3E,MAAM,OAAO,GAAG,IAAI,CAAC,gBAAgB,CAAC,SAA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