@zerogpu/n8n-nodes-zerogpu 0.3.0 → 0.4.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 +44 -14
- package/dist/nodes/ZeroGpu/ZeroGpu.node.js +7 -1
- package/dist/nodes/ZeroGpu/ZeroGpu.node.js.map +1 -1
- package/dist/nodes/ZeroGpu/resources/audio/index.d.ts +2 -0
- package/dist/nodes/ZeroGpu/resources/audio/index.js +197 -0
- package/dist/nodes/ZeroGpu/resources/audio/index.js.map +1 -0
- package/dist/nodes/ZeroGpu/resources/embedding/index.d.ts +2 -0
- package/dist/nodes/ZeroGpu/resources/embedding/index.js +28 -0
- package/dist/nodes/ZeroGpu/resources/embedding/index.js.map +1 -0
- package/dist/nodes/ZeroGpu/shared/audio.d.ts +10 -0
- package/dist/nodes/ZeroGpu/shared/audio.js +169 -0
- package/dist/nodes/ZeroGpu/shared/audio.js.map +1 -0
- package/dist/nodes/ZeroGpu/shared/operations.d.ts +2 -1
- package/dist/nodes/ZeroGpu/shared/operations.js +4 -0
- package/dist/nodes/ZeroGpu/shared/operations.js.map +1 -1
- package/dist/nodes/ZeroGpu/shared/routing.d.ts +3 -0
- package/dist/nodes/ZeroGpu/shared/routing.js +8 -1
- package/dist/nodes/ZeroGpu/shared/routing.js.map +1 -1
- package/dist/nodes/ZeroGpuEmbeddings/ZeroGpuEmbeddings.node.d.ts +10 -0
- package/dist/nodes/ZeroGpuEmbeddings/ZeroGpuEmbeddings.node.js +154 -0
- package/dist/nodes/ZeroGpuEmbeddings/ZeroGpuEmbeddings.node.js.map +1 -0
- package/dist/nodes/ZeroGpuEmbeddings/ZeroGpuEmbeddings.node.json +18 -0
- package/dist/package.json +3 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -33,20 +33,25 @@ Follow the [installation guide](https://docs.n8n.io/integrations/community-nodes
|
|
|
33
33
|
|
|
34
34
|
## Operations
|
|
35
35
|
|
|
36
|
-
The package has
|
|
36
|
+
The package has three nodes:
|
|
37
37
|
|
|
38
|
-
- **ZeroGPU** runs ZeroGPU's task models on text and
|
|
38
|
+
- **ZeroGPU** runs ZeroGPU's task models on text, documents and audio. Use it as a step in any workflow, or attach it to an AI Agent as **ZeroGPU Tool**.
|
|
39
39
|
- **ZeroGPU Chat Model** connects ZeroGPU's language models to n8n's AI nodes, such as AI Agent and Basic LLM Chain.
|
|
40
|
+
- **ZeroGPU Embeddings** connects ZeroGPU's embedding models to n8n's vector stores, for semantic search and RAG.
|
|
40
41
|
|
|
41
42
|
The **ZeroGPU** node has these operations:
|
|
42
43
|
|
|
43
44
|
| Resource | Operation | Returns | Default model |
|
|
44
45
|
| -------------- | --------------------- | ------------------------------------------------------------------------------- | ------------------------------ |
|
|
46
|
+
| Audio | Generate Speech | Spoken audio of the text, as a binary file | `chatterbox-nano` |
|
|
47
|
+
| | Transcribe Audio | The text of the speech in an audio file | `whisper-tiny` |
|
|
48
|
+
| | Translate Audio | The speech in an audio file, as English text | `whisper-tiny` |
|
|
45
49
|
| Classification | Classify by Labels | A score for each label | `deberta-v3-small` |
|
|
46
50
|
| | Classify by Schema | One label for each category | `gliner2.5-base-v1` |
|
|
47
51
|
| | Classify Domain | IAB categories, audiences and topics for a domain name | `zlm-v1-iab-domain-classifier` |
|
|
48
52
|
| | Classify IAB Category | IAB content and audience categories | `zlm-v1-iab-classify-edge` |
|
|
49
53
|
| Document | Extract Text | The document's text as Markdown | `unlimited-ocr` |
|
|
54
|
+
| Embedding | Embed Text | A vector for the text, in OpenAI's embeddings format | `all-minilm-l6-v2` |
|
|
50
55
|
| Extraction | Detect PII | The personal data found, grouped by type | `gliner2.5-base-v1` |
|
|
51
56
|
| | Extract Entities | The entities found, grouped by type | `gliner2.5-base-v1` |
|
|
52
57
|
| | Extract JSON | The fields in your schema, filled in from the text | `gliner2.5-base-v1` |
|
|
@@ -56,7 +61,7 @@ The **ZeroGPU** node has these operations:
|
|
|
56
61
|
|
|
57
62
|
## Credentials
|
|
58
63
|
|
|
59
|
-
The package includes a **ZeroGPU API** credential, which
|
|
64
|
+
The package includes a **ZeroGPU API** credential, which every node in the package uses to call ZeroGPU:
|
|
60
65
|
|
|
61
66
|
1. Log in to the [ZeroGPU dashboard](https://platform.zerogpu.ai/dashboard).
|
|
62
67
|
2. Copy a key from the **API Keys** page.
|
|
@@ -79,9 +84,14 @@ Some fields take a particular format:
|
|
|
79
84
|
- **Schema** for **Extract JSON**: a JSON object that maps each group to its fields, written as `name::type::description`, like `{"contact": ["name::str::Full name", "email::str::Email address"]}`.
|
|
80
85
|
- **Threshold**, under **Options**: the minimum confidence, from 0 to 1, for a label or entity to be returned. Lower it to find more.
|
|
81
86
|
- **Document URL**: the public URL of a PDF, scanned document or image. ZeroGPU bills **Extract Text** per page.
|
|
87
|
+
- **Input Data Field Name** for **Transcribe Audio** and **Translate Audio**: the binary field that holds the audio file, `data` by default, like the output of a **Read/Write Files from Disk** or **HTTP Request** node. The file can be up to 25 MB and 10 minutes long, in flac, m4a, mp3, mp4, mpeg, mpga, oga, ogg, wav or webm.
|
|
88
|
+
- **Text** for **Generate Speech**: English text up to 2,000 characters. Tags like `[laugh]` or `[cough]` add cues.
|
|
89
|
+
- **Voice Sample Field**, under **Options** for **Generate Speech**: the binary field that holds a 6 to 30 second clip of the voice to clone, up to 10 MB. Leave it empty to use the built-in voice.
|
|
82
90
|
|
|
83
91
|
**Redact PII** replaces every place each value it finds appears, so a name mentioned three times is replaced three times. It only finds the types listed in **Labels**.
|
|
84
92
|
|
|
93
|
+
**Generate Speech** puts the audio in the `data` binary field, or the field set in **Put Output in Field**, and returns its length in seconds as `durationSeconds`. ZeroGPU bills audio per minute. `whisper-tiny` and `chatterbox-nano` round up to the next whole minute, with a one-minute minimum, and `chatterbox` rounds up to the next second.
|
|
94
|
+
|
|
85
95
|
### ZeroGPU Tool
|
|
86
96
|
|
|
87
97
|
Attach the **ZeroGPU** node to an AI Agent so the agent can call it:
|
|
@@ -92,6 +102,8 @@ Attach the **ZeroGPU** node to an AI Agent so the agent can call it:
|
|
|
92
102
|
|
|
93
103
|
n8n describes the tool to the agent based on its operation. To write the description yourself, set **Tool Description** to **Set Manually**.
|
|
94
104
|
|
|
105
|
+
The **Audio** operations read or write binary files, which an agent can't pass to a tool, so use them as regular workflow steps instead.
|
|
106
|
+
|
|
95
107
|
### ZeroGPU Chat Model
|
|
96
108
|
|
|
97
109
|
1. Add an **AI Agent** or **Basic LLM Chain** node to your workflow.
|
|
@@ -112,19 +124,37 @@ Some models have limits:
|
|
|
112
124
|
- If you set **Maximum Tokens** or **Reasoning Effort** on a model that doesn't support it, the node stops with an error. A few models accept a setting and ignore it instead: **Reasoning Effort** on `gpt-4.1-mini` and `llama-3.1-8b-instruct-fast`, and **Maximum Tokens** on `zlm-v1-tool-decisions`.
|
|
113
125
|
- `gpt-6-luna` only accepts its default temperature, so leave **Sampling Temperature** unset.
|
|
114
126
|
|
|
127
|
+
### ZeroGPU Embeddings
|
|
128
|
+
|
|
129
|
+
1. Add a vector store node, such as **In-Memory Vector Store**, **Pinecone Vector Store** or **Supabase Vector Store**.
|
|
130
|
+
2. Connect a **ZeroGPU Embeddings** node to its **Embedding** input and select your **ZeroGPU API** credential.
|
|
131
|
+
3. Choose a model. The list shows ZeroGPU's embedding models and comes from ZeroGPU, so it stays current as models are added.
|
|
132
|
+
|
|
133
|
+
Use the same model to insert documents and to search them. `all-minilm-l6-v2` and `bge-small-en-v1.5` both return 384-dimensional vectors, so create your vector index with 384 dimensions. Switching to a model with a different vector size means inserting your documents again.
|
|
134
|
+
|
|
135
|
+
`all-minilm-l6-v2` reads up to 256 tokens of each text and `bge-small-en-v1.5` up to 512, so split long documents into chunks that fit, for example with a **Recursive Character Text Splitter**. ZeroGPU embeds up to 256 texts per request, and the node splits larger batches for you.
|
|
136
|
+
|
|
137
|
+
To get vectors in a regular workflow instead, use the **Embed Text** operation of the **ZeroGPU** node. The vector is at `data[0].embedding` in its output.
|
|
138
|
+
|
|
115
139
|
### Errors
|
|
116
140
|
|
|
117
|
-
If n8n shows a general error in
|
|
118
|
-
|
|
119
|
-
| Message
|
|
120
|
-
|
|
|
121
|
-
| `Invalid credentials`
|
|
122
|
-
| `Model not found`
|
|
123
|
-
| `Tool calling is not supported for model`
|
|
124
|
-
| `doesn't support Maximum Tokens`, `doesn't support Reasoning Effort` or `Unsupported parameter`
|
|
125
|
-
| `Upstream inference failed`
|
|
126
|
-
| `Model not
|
|
127
|
-
| `
|
|
141
|
+
If n8n shows a general error in any node, open its details to see ZeroGPU's message:
|
|
142
|
+
|
|
143
|
+
| Message | What to do |
|
|
144
|
+
| --------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
|
|
145
|
+
| `Invalid credentials` | Check the API key in your **ZeroGPU API** credential. |
|
|
146
|
+
| `Model not found` | Check the model ID, including its capitalization. |
|
|
147
|
+
| `Tool calling is not supported for model` | Choose another model, or use a Basic LLM Chain. |
|
|
148
|
+
| `doesn't support Maximum Tokens`, `doesn't support Reasoning Effort` or `Unsupported parameter` | Remove that setting under **Options**, or choose another model. |
|
|
149
|
+
| `Upstream inference failed` | ZeroGPU couldn't run the model this time. Run the node again, or turn on **Retry On Fail** in the node's settings. |
|
|
150
|
+
| `Model is not loaded` | The model is starting up. Run the node again in a moment, or turn on **Retry On Fail** in the node's settings. |
|
|
151
|
+
| `Model not supported` or `Unsupported usecase` | Choose a model from the list for the operation. |
|
|
152
|
+
| `Enter the …`, `Enter at least one label`, `Schema must be a JSON object…` or `… must be a number from …` | Fix the field named in the message. |
|
|
153
|
+
| `The item has no binary field` | Make **Input Data Field Name** or **Voice Sample Field** match a binary field from the previous node. |
|
|
154
|
+
| `exceeds the 2000 character limit` | Split the text and generate speech for each part. |
|
|
155
|
+
| `file_too_large`, `audio_too_long`, `voice_sample_too_large` or `voice_sample_too_long` | Use audio up to 25 MB and 10 minutes long, and a voice clip up to 10 MB and 30 seconds long. |
|
|
156
|
+
| `voice_conditioning_failed` | ZeroGPU couldn't clone the voice from the clip. Try another clip of 6 to 30 seconds. |
|
|
157
|
+
| `Invalid document at index` or `Cannot embed empty or undefined text` | A text sent to **ZeroGPU Embeddings** was empty. Check the data loader or expression that supplies it. |
|
|
128
158
|
|
|
129
159
|
## Compatibility
|
|
130
160
|
|
|
@@ -3,8 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ZeroGpu = void 0;
|
|
4
4
|
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
5
|
const getModels_1 = require("./loadOptions/getModels");
|
|
6
|
+
const audio_1 = require("./resources/audio");
|
|
6
7
|
const classification_1 = require("./resources/classification");
|
|
7
8
|
const document_1 = require("./resources/document");
|
|
9
|
+
const embedding_1 = require("./resources/embedding");
|
|
8
10
|
const extraction_1 = require("./resources/extraction");
|
|
9
11
|
const moderation_1 = require("./resources/moderation");
|
|
10
12
|
const summarization_1 = require("./resources/summarization");
|
|
@@ -17,7 +19,7 @@ class ZeroGpu {
|
|
|
17
19
|
group: ['transform'],
|
|
18
20
|
version: 1,
|
|
19
21
|
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
|
20
|
-
description: 'Classify, extract, redact, moderate and
|
|
22
|
+
description: 'Classify, extract, redact, moderate, summarize and embed text, read documents, and generate or transcribe speech with ZeroGPU models',
|
|
21
23
|
defaults: {
|
|
22
24
|
name: 'ZeroGPU',
|
|
23
25
|
},
|
|
@@ -44,16 +46,20 @@ class ZeroGpu {
|
|
|
44
46
|
type: 'options',
|
|
45
47
|
noDataExpression: true,
|
|
46
48
|
options: [
|
|
49
|
+
{ name: 'Audio', value: 'audio' },
|
|
47
50
|
{ name: 'Classification', value: 'classification' },
|
|
48
51
|
{ name: 'Document', value: 'document' },
|
|
52
|
+
{ name: 'Embedding', value: 'embedding' },
|
|
49
53
|
{ name: 'Extraction', value: 'extraction' },
|
|
50
54
|
{ name: 'Moderation', value: 'moderation' },
|
|
51
55
|
{ name: 'Summarization', value: 'summarization' },
|
|
52
56
|
],
|
|
53
57
|
default: 'classification',
|
|
54
58
|
},
|
|
59
|
+
...audio_1.audioDescription,
|
|
55
60
|
...classification_1.classificationDescription,
|
|
56
61
|
...document_1.documentDescription,
|
|
62
|
+
...embedding_1.embeddingDescription,
|
|
57
63
|
...extraction_1.extractionDescription,
|
|
58
64
|
...moderation_1.moderationDescription,
|
|
59
65
|
...summarization_1.summarizationDescription,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ZeroGpu.node.js","sourceRoot":"","sources":["../../../nodes/ZeroGpu/ZeroGpu.node.ts"],"names":[],"mappings":";;;AAAA,+CAA8F;AAC9F,uDAAoD;AACpD,+DAAuE;AACvE,mDAA2D;AAC3D,uDAA+D;AAC/D,uDAA+D;AAC/D,6DAAqE;AAErE,MAAa,OAAO;IAApB;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,SAAS;YACtB,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,EAAE,KAAK,EAAE,8BAA8B,EAAE,IAAI,EAAE,mCAAmC,EAAE;YAC1F,KAAK,EAAE,CAAC,WAAW,CAAC;YACpB,OAAO,EAAE,CAAC;YACV,QAAQ,EAAE,8DAA8D;YACxE,WAAW,EACV,
|
|
1
|
+
{"version":3,"file":"ZeroGpu.node.js","sourceRoot":"","sources":["../../../nodes/ZeroGpu/ZeroGpu.node.ts"],"names":[],"mappings":";;;AAAA,+CAA8F;AAC9F,uDAAoD;AACpD,6CAAqD;AACrD,+DAAuE;AACvE,mDAA2D;AAC3D,qDAA6D;AAC7D,uDAA+D;AAC/D,uDAA+D;AAC/D,6DAAqE;AAErE,MAAa,OAAO;IAApB;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,SAAS;YACtB,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,EAAE,KAAK,EAAE,8BAA8B,EAAE,IAAI,EAAE,mCAAmC,EAAE;YAC1F,KAAK,EAAE,CAAC,WAAW,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G,wCAAwB;aAC3B;SACD,CAAC;QAEF,YAAO,GAAG;YACT,WAAW,EAAE;gBACZ,SAAS,EAAT,qBAAS;aACT;SACD,CAAC;IACH,CAAC;CAAA;AA7DD,0BA6DC"}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.audioDescription = void 0;
|
|
4
|
+
const audio_1 = require("../../shared/audio");
|
|
5
|
+
const descriptions_1 = require("../../shared/descriptions");
|
|
6
|
+
const resource = 'audio';
|
|
7
|
+
const show = (operation) => ({
|
|
8
|
+
show: { resource: [resource], operation },
|
|
9
|
+
});
|
|
10
|
+
function transcriptOptions(operation) {
|
|
11
|
+
return {
|
|
12
|
+
displayName: 'Options',
|
|
13
|
+
name: 'options',
|
|
14
|
+
type: 'collection',
|
|
15
|
+
placeholder: 'Add Option',
|
|
16
|
+
default: {},
|
|
17
|
+
displayOptions: show([operation]),
|
|
18
|
+
options: [
|
|
19
|
+
...(operation === 'transcribe'
|
|
20
|
+
? [
|
|
21
|
+
{
|
|
22
|
+
displayName: 'Language',
|
|
23
|
+
name: 'language',
|
|
24
|
+
type: 'string',
|
|
25
|
+
default: '',
|
|
26
|
+
placeholder: 'e.g. en',
|
|
27
|
+
description: 'The language spoken, as an ISO-639-1 code like en. Detected automatically when empty.',
|
|
28
|
+
},
|
|
29
|
+
]
|
|
30
|
+
: []),
|
|
31
|
+
{
|
|
32
|
+
displayName: 'Prompt',
|
|
33
|
+
name: 'prompt',
|
|
34
|
+
type: 'string',
|
|
35
|
+
default: '',
|
|
36
|
+
description: 'Text to guide spelling and style, such as names or jargon',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
displayName: 'Response Format',
|
|
40
|
+
name: 'responseFormat',
|
|
41
|
+
type: 'options',
|
|
42
|
+
default: 'json',
|
|
43
|
+
options: [
|
|
44
|
+
{ name: 'JSON', value: 'json', description: 'The transcript under text' },
|
|
45
|
+
{ name: 'SRT', value: 'srt', description: 'SRT subtitles under text' },
|
|
46
|
+
{ name: 'Text', value: 'text', description: 'The plain transcript under text' },
|
|
47
|
+
{
|
|
48
|
+
name: 'Verbose JSON',
|
|
49
|
+
value: 'verbose_json',
|
|
50
|
+
description: 'The transcript with its language, duration and timed segments',
|
|
51
|
+
},
|
|
52
|
+
{ name: 'VTT', value: 'vtt', description: 'WebVTT subtitles under text' },
|
|
53
|
+
],
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
displayName: 'Temperature',
|
|
57
|
+
name: 'temperature',
|
|
58
|
+
type: 'number',
|
|
59
|
+
default: 0,
|
|
60
|
+
typeOptions: { minValue: 0, maxValue: 1, numberPrecision: 2 },
|
|
61
|
+
description: 'Sampling temperature, from 0 to 1',
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
exports.audioDescription = [
|
|
67
|
+
{
|
|
68
|
+
displayName: 'Operation',
|
|
69
|
+
name: 'operation',
|
|
70
|
+
type: 'options',
|
|
71
|
+
noDataExpression: true,
|
|
72
|
+
displayOptions: { show: { resource: [resource] } },
|
|
73
|
+
options: [
|
|
74
|
+
{
|
|
75
|
+
name: 'Generate Speech',
|
|
76
|
+
value: 'generateSpeech',
|
|
77
|
+
action: 'Generate speech from text',
|
|
78
|
+
description: 'Turn English text into spoken audio, in the built-in voice or a cloned one',
|
|
79
|
+
routing: audio_1.speechRouting,
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
name: 'Transcribe Audio',
|
|
83
|
+
value: 'transcribe',
|
|
84
|
+
action: 'Transcribe audio into text',
|
|
85
|
+
description: 'Turn speech in an audio file into text',
|
|
86
|
+
routing: audio_1.transcriptionsRouting,
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
name: 'Translate Audio',
|
|
90
|
+
value: 'translate',
|
|
91
|
+
action: 'Translate audio',
|
|
92
|
+
description: 'Turn speech in any language into English text',
|
|
93
|
+
routing: audio_1.translationsRouting,
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
default: 'generateSpeech',
|
|
97
|
+
},
|
|
98
|
+
(0, descriptions_1.modelField)(resource, 'generateSpeech', 'chatterbox-nano'),
|
|
99
|
+
(0, descriptions_1.modelField)(resource, 'transcribe', 'whisper-tiny'),
|
|
100
|
+
(0, descriptions_1.modelField)(resource, 'translate', 'whisper-tiny'),
|
|
101
|
+
(0, descriptions_1.textField)(resource, ['generateSpeech'], 'The English text to speak, up to 2,000 characters. Tags like [laugh] or [cough] add cues.'),
|
|
102
|
+
{
|
|
103
|
+
displayName: 'Input Data Field Name',
|
|
104
|
+
name: 'binaryPropertyName',
|
|
105
|
+
type: 'string',
|
|
106
|
+
required: true,
|
|
107
|
+
default: 'data',
|
|
108
|
+
placeholder: 'e.g. data',
|
|
109
|
+
hint: 'The name of the input binary field containing the audio file',
|
|
110
|
+
description: 'Up to 25 MB and 10 minutes, in one of these formats: flac, m4a, mp3, mp4, mpeg, mpga, oga, ogg, wav or webm',
|
|
111
|
+
displayOptions: show(['transcribe', 'translate']),
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
displayName: 'Options',
|
|
115
|
+
name: 'options',
|
|
116
|
+
type: 'collection',
|
|
117
|
+
placeholder: 'Add Option',
|
|
118
|
+
default: {},
|
|
119
|
+
displayOptions: show(['generateSpeech']),
|
|
120
|
+
options: [
|
|
121
|
+
{
|
|
122
|
+
displayName: 'Put Output in Field',
|
|
123
|
+
name: 'binaryPropertyOutput',
|
|
124
|
+
type: 'string',
|
|
125
|
+
default: 'data',
|
|
126
|
+
hint: 'The name of the output binary field to put the audio in',
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
displayName: 'Repetition Penalty',
|
|
130
|
+
name: 'repetitionPenalty',
|
|
131
|
+
type: 'number',
|
|
132
|
+
default: 1.2,
|
|
133
|
+
typeOptions: { minValue: 1, maxValue: 4, numberPrecision: 2 },
|
|
134
|
+
description: 'Penalty on repeated speech tokens, from 1 to 4',
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
displayName: 'Response Format',
|
|
138
|
+
name: 'responseFormat',
|
|
139
|
+
type: 'options',
|
|
140
|
+
default: 'mp3',
|
|
141
|
+
options: [
|
|
142
|
+
{ name: 'AAC', value: 'aac' },
|
|
143
|
+
{ name: 'FLAC', value: 'flac' },
|
|
144
|
+
{ name: 'MP3', value: 'mp3' },
|
|
145
|
+
{ name: 'Opus', value: 'opus' },
|
|
146
|
+
{ name: 'PCM', value: 'pcm', description: 'Raw 16-bit little-endian mono at 24 kHz' },
|
|
147
|
+
{ name: 'WAV', value: 'wav' },
|
|
148
|
+
],
|
|
149
|
+
description: 'The format of the audio',
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
displayName: 'Seed',
|
|
153
|
+
name: 'seed',
|
|
154
|
+
type: 'number',
|
|
155
|
+
default: 0,
|
|
156
|
+
typeOptions: { minValue: 0, maxValue: 4294967295 },
|
|
157
|
+
description: 'Pins sampling so the same request gives the same audio, on a best-effort basis',
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
displayName: 'Temperature',
|
|
161
|
+
name: 'temperature',
|
|
162
|
+
type: 'number',
|
|
163
|
+
default: 0.8,
|
|
164
|
+
typeOptions: { minValue: 0, maxValue: 2, numberPrecision: 2 },
|
|
165
|
+
description: 'Sampling temperature, from 0 to 2',
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
displayName: 'Top K',
|
|
169
|
+
name: 'topK',
|
|
170
|
+
type: 'number',
|
|
171
|
+
default: 1000,
|
|
172
|
+
typeOptions: { minValue: 0, maxValue: 10000 },
|
|
173
|
+
description: 'Samples from only this many of the most likely tokens, from 0 to 10,000',
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
displayName: 'Top P',
|
|
177
|
+
name: 'topP',
|
|
178
|
+
type: 'number',
|
|
179
|
+
default: 0.95,
|
|
180
|
+
typeOptions: { minValue: 0, maxValue: 1, numberPrecision: 2 },
|
|
181
|
+
description: 'Nucleus sampling, from 0 to 1',
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
displayName: 'Voice Sample Field',
|
|
185
|
+
name: 'voiceSampleField',
|
|
186
|
+
type: 'string',
|
|
187
|
+
default: '',
|
|
188
|
+
placeholder: 'e.g. voice',
|
|
189
|
+
hint: 'The name of the input binary field containing a clip of the voice to clone',
|
|
190
|
+
description: 'A 6 to 30 second clip, up to 10 MB, in one of these formats: mp3, m4a, wav, flac, ogg, webm or mp4. Overrides the built-in voice.',
|
|
191
|
+
},
|
|
192
|
+
],
|
|
193
|
+
},
|
|
194
|
+
transcriptOptions('transcribe'),
|
|
195
|
+
transcriptOptions('translate'),
|
|
196
|
+
];
|
|
197
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../nodes/ZeroGpu/resources/audio/index.ts"],"names":[],"mappings":";;;AACA,8CAA+F;AAC/F,4DAAkE;AAGlE,MAAM,QAAQ,GAAG,OAAO,CAAC;AAEzB,MAAM,IAAI,GAAG,CAAC,SAA2B,EAAE,EAAE,CAAC,CAAC;IAC9C,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,QAAQ,CAAC,EAAE,SAAS,EAAE;CACzC,CAAC,CAAC;AAEH,SAAS,iBAAiB,CAAC,SAAqC;IAC/D,OAAO;QACN,WAAW,EAAE,SAAS;QACtB,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,YAAY;QAClB,WAAW,EAAE,YAAY;QACzB,OAAO,EAAE,EAAE;QACX,cAAc,EAAE,IAAI,CAAC,CAAC,SAAS,CAAC,CAAC;QACjC,OAAO,EAAE;YACR,GAAG,CAAC,SAAS,KAAK,YAAY;gBAC7B,CAAC,CAAC;oBACA;wBACC,WAAW,EAAE,UAAU;wBACvB,IAAI,EAAE,UAAU;wBAChB,IAAI,EAAE,QAAiB;wBACvB,OAAO,EAAE,EA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AAgF;aACjF;YACD;gBACC,WAAW,EAAE,aAAa;gBAC1B,IAAI,EAAE,aAAa;gBACnB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,GAAG;gBACZ,WAAW,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,eAAe,EAAE,CAAC,EAAE;gBAC7D,WAAW,EAAE,mCAAmC;aAChD;YACD;gBACC,WAAW,EAAE,OAAO;gBACpB,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,IAAI;gBACb,WAAW,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE;gBAC7C,WAAW,EAAE,yEAAyE;aACtF;YACD;gBACC,WAAW,EAAE,OAAO;gBACpB,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,IAAI;gBACb,WAAW,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,eAAe,EAAE,CAAC,EAAE;gBAC7D,WAAW,EAAE,+BAA+B;aAC5C;YACD;gBACC,WAAW,EAAE,oBAAoB;gBACjC,IAAI,EAAE,kBAAkB;gBACxB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,YAAY;gBACzB,IAAI,EAAE,4EAA4E;gBAClF,WAAW,EACV,mIAAmI;aACpI;SACD;KACD;IACD,iBAAiB,CAAC,YAAY,CAAC;IAC/B,iBAAiB,CAAC,WAAW,CAAC;CAC9B,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.embeddingDescription = void 0;
|
|
4
|
+
const descriptions_1 = require("../../shared/descriptions");
|
|
5
|
+
const routing_1 = require("../../shared/routing");
|
|
6
|
+
const resource = 'embedding';
|
|
7
|
+
exports.embeddingDescription = [
|
|
8
|
+
{
|
|
9
|
+
displayName: 'Operation',
|
|
10
|
+
name: 'operation',
|
|
11
|
+
type: 'options',
|
|
12
|
+
noDataExpression: true,
|
|
13
|
+
displayOptions: { show: { resource: [resource] } },
|
|
14
|
+
options: [
|
|
15
|
+
{
|
|
16
|
+
name: 'Embed Text',
|
|
17
|
+
value: 'embedText',
|
|
18
|
+
action: 'Embed text',
|
|
19
|
+
description: 'Turn text into a vector for semantic search, clustering and deduplication',
|
|
20
|
+
routing: routing_1.embeddingsRouting,
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
default: 'embedText',
|
|
24
|
+
},
|
|
25
|
+
(0, descriptions_1.modelField)(resource, 'embedText', 'all-minilm-l6-v2'),
|
|
26
|
+
(0, descriptions_1.textField)(resource, ['embedText'], 'The text to embed'),
|
|
27
|
+
];
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../nodes/ZeroGpu/resources/embedding/index.ts"],"names":[],"mappings":";;;AACA,4DAAkE;AAClE,kDAAyD;AAEzD,MAAM,QAAQ,GAAG,WAAW,CAAC;AAEhB,QAAA,oBAAoB,GAAsB;IACtD;QACC,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,IAAI;QACtB,cAAc,EAAE,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE;QAClD,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,YAAY;gBAClB,KAAK,EAAE,WAAW;gBAClB,MAAM,EAAE,YAAY;gBACpB,WAAW,EAAE,2EAA2E;gBACxF,OAAO,EAAE,2BAAiB;aAC1B;SACD;QACD,OAAO,EAAE,WAAW;KACpB;IACD,IAAA,yBAAU,EAAC,QAAQ,EAAE,WAAW,EAAE,kBAAkB,CAAC;IACrD,IAAA,wBAAS,EAAC,QAAQ,EAAE,CAAC,WAAW,CAAC,EAAE,mBAAmB,CAAC;CACvD,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IExecuteSingleFunctions, IHttpRequestOptions, IN8nHttpFullResponse, INodeExecutionData, INodePropertyRouting } from 'n8n-workflow';
|
|
2
|
+
export declare const SPEECH_FORMATS: string[];
|
|
3
|
+
export declare const TRANSCRIPT_FORMATS: string[];
|
|
4
|
+
export declare function buildSpeechRequest(this: IExecuteSingleFunctions, requestOptions: IHttpRequestOptions): Promise<IHttpRequestOptions>;
|
|
5
|
+
export declare function buildTranscriptionRequest(this: IExecuteSingleFunctions, requestOptions: IHttpRequestOptions): Promise<IHttpRequestOptions>;
|
|
6
|
+
export declare function toSpeechBinary(this: IExecuteSingleFunctions, _items: INodeExecutionData[], response: IN8nHttpFullResponse): Promise<INodeExecutionData[]>;
|
|
7
|
+
export declare function parseTranscript(this: IExecuteSingleFunctions, _items: INodeExecutionData[], response: IN8nHttpFullResponse): Promise<INodeExecutionData[]>;
|
|
8
|
+
export declare const speechRouting: INodePropertyRouting;
|
|
9
|
+
export declare const transcriptionsRouting: INodePropertyRouting;
|
|
10
|
+
export declare const translationsRouting: INodePropertyRouting;
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.translationsRouting = exports.transcriptionsRouting = exports.speechRouting = exports.TRANSCRIPT_FORMATS = exports.SPEECH_FORMATS = void 0;
|
|
4
|
+
exports.buildSpeechRequest = buildSpeechRequest;
|
|
5
|
+
exports.buildTranscriptionRequest = buildTranscriptionRequest;
|
|
6
|
+
exports.toSpeechBinary = toSpeechBinary;
|
|
7
|
+
exports.parseTranscript = parseTranscript;
|
|
8
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
9
|
+
const routing_1 = require("./routing");
|
|
10
|
+
exports.SPEECH_FORMATS = ['aac', 'flac', 'mp3', 'opus', 'pcm', 'wav'];
|
|
11
|
+
exports.TRANSCRIPT_FORMATS = ['json', 'srt', 'text', 'verbose_json', 'vtt'];
|
|
12
|
+
const SPEECH_NUMBERS = [
|
|
13
|
+
{ name: 'seed', field: 'seed', label: 'Seed', min: 0, max: 4294967295, integer: true },
|
|
14
|
+
{ name: 'temperature', field: 'temperature', label: 'Temperature', min: 0, max: 2 },
|
|
15
|
+
{ name: 'topP', field: 'top_p', label: 'Top P', min: 0, max: 1 },
|
|
16
|
+
{ name: 'topK', field: 'top_k', label: 'Top K', min: 0, max: 10000, integer: true },
|
|
17
|
+
{
|
|
18
|
+
name: 'repetitionPenalty',
|
|
19
|
+
field: 'repetition_penalty',
|
|
20
|
+
label: 'Repetition Penalty',
|
|
21
|
+
min: 1,
|
|
22
|
+
max: 4,
|
|
23
|
+
},
|
|
24
|
+
];
|
|
25
|
+
const TRANSCRIPT_NUMBERS = [
|
|
26
|
+
{ name: 'temperature', field: 'temperature', label: 'Temperature', min: 0, max: 1 },
|
|
27
|
+
];
|
|
28
|
+
const getOptions = (context) => context.getNodeParameter('options', {});
|
|
29
|
+
function getNumbers(context, options, numbers) {
|
|
30
|
+
const fields = {};
|
|
31
|
+
for (const { name, field, label, min, max, integer } of numbers) {
|
|
32
|
+
const value = options[name];
|
|
33
|
+
if (value === undefined)
|
|
34
|
+
continue;
|
|
35
|
+
if (typeof value !== 'number' ||
|
|
36
|
+
!(value >= min && value <= max) ||
|
|
37
|
+
(integer && !Number.isInteger(value))) {
|
|
38
|
+
(0, routing_1.fail)(context, `${label} must be ${integer ? 'a whole number' : 'a number'} from ${min} to ${max}`);
|
|
39
|
+
}
|
|
40
|
+
fields[field] = value;
|
|
41
|
+
}
|
|
42
|
+
return fields;
|
|
43
|
+
}
|
|
44
|
+
function getFormat(context, options, formats) {
|
|
45
|
+
const value = options.responseFormat;
|
|
46
|
+
if (value === undefined)
|
|
47
|
+
return {};
|
|
48
|
+
if (typeof value !== 'string' || !formats.includes(value)) {
|
|
49
|
+
(0, routing_1.fail)(context, `Response Format must be one of ${formats.join(', ')}`);
|
|
50
|
+
}
|
|
51
|
+
return { response_format: value };
|
|
52
|
+
}
|
|
53
|
+
function getText(options, name) {
|
|
54
|
+
return typeof options[name] === 'string' ? options[name].trim() : '';
|
|
55
|
+
}
|
|
56
|
+
async function getFile(context, field) {
|
|
57
|
+
const { fileName, mimeType } = context.helpers.assertBinaryData(field);
|
|
58
|
+
const buffer = await context.helpers.getBinaryDataBuffer(field);
|
|
59
|
+
return {
|
|
60
|
+
blob: new Blob([new Uint8Array(buffer)], { type: mimeType }),
|
|
61
|
+
fileName: fileName !== null && fileName !== void 0 ? fileName : 'audio',
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function sendForm(requestOptions, fields) {
|
|
65
|
+
const form = new FormData();
|
|
66
|
+
for (const [name, value] of Object.entries(fields))
|
|
67
|
+
form.append(name, String(value));
|
|
68
|
+
const headers = { ...requestOptions.headers };
|
|
69
|
+
for (const name of Object.keys(headers)) {
|
|
70
|
+
if (name.toLowerCase() === 'content-type')
|
|
71
|
+
delete headers[name];
|
|
72
|
+
}
|
|
73
|
+
requestOptions.headers = headers;
|
|
74
|
+
requestOptions.body = form;
|
|
75
|
+
return form;
|
|
76
|
+
}
|
|
77
|
+
async function buildSpeechRequest(requestOptions) {
|
|
78
|
+
const options = getOptions(this);
|
|
79
|
+
const fields = {
|
|
80
|
+
model: (0, routing_1.getRequiredString)(this, 'model', 'Model'),
|
|
81
|
+
input: (0, routing_1.getRequiredString)(this, 'text', 'Text'),
|
|
82
|
+
...getFormat(this, options, exports.SPEECH_FORMATS),
|
|
83
|
+
...getNumbers(this, options, SPEECH_NUMBERS),
|
|
84
|
+
};
|
|
85
|
+
const voiceSampleField = getText(options, 'voiceSampleField');
|
|
86
|
+
if (voiceSampleField === '') {
|
|
87
|
+
requestOptions.body = fields;
|
|
88
|
+
return requestOptions;
|
|
89
|
+
}
|
|
90
|
+
const { blob, fileName } = await getFile(this, voiceSampleField);
|
|
91
|
+
sendForm(requestOptions, fields).append('voice_sample', blob, fileName);
|
|
92
|
+
return requestOptions;
|
|
93
|
+
}
|
|
94
|
+
async function buildTranscriptionRequest(requestOptions) {
|
|
95
|
+
const options = getOptions(this);
|
|
96
|
+
const language = getText(options, 'language');
|
|
97
|
+
const prompt = getText(options, 'prompt');
|
|
98
|
+
const fields = {
|
|
99
|
+
model: (0, routing_1.getRequiredString)(this, 'model', 'Model'),
|
|
100
|
+
...(language && this.getNodeParameter('operation') === 'transcribe' ? { language } : {}),
|
|
101
|
+
...(prompt ? { prompt } : {}),
|
|
102
|
+
...getFormat(this, options, exports.TRANSCRIPT_FORMATS),
|
|
103
|
+
...getNumbers(this, options, TRANSCRIPT_NUMBERS),
|
|
104
|
+
};
|
|
105
|
+
const field = (0, routing_1.getRequiredString)(this, 'binaryPropertyName', 'Input Data Field Name').trim();
|
|
106
|
+
const { blob, fileName } = await getFile(this, field);
|
|
107
|
+
sendForm(requestOptions, fields).append('file', blob, fileName);
|
|
108
|
+
return requestOptions;
|
|
109
|
+
}
|
|
110
|
+
function isObject(value) {
|
|
111
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
112
|
+
}
|
|
113
|
+
function throwApiError(context, response) {
|
|
114
|
+
const text = Buffer.from(response.body).toString('utf8');
|
|
115
|
+
const parsed = (0, n8n_workflow_1.jsonParse)(text, { fallbackValue: {} });
|
|
116
|
+
const error = isObject(parsed) && isObject(parsed.error) ? parsed.error : {};
|
|
117
|
+
const description = typeof error.message === 'string' ? error.message : text;
|
|
118
|
+
throw new n8n_workflow_1.NodeApiError(context.getNode(), (isObject(parsed) ? parsed : {}), {
|
|
119
|
+
httpCode: String(response.statusCode),
|
|
120
|
+
description,
|
|
121
|
+
itemIndex: context.getItemIndex(),
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
async function toSpeechBinary(_items, response) {
|
|
125
|
+
var _a;
|
|
126
|
+
if (response.statusCode >= 400)
|
|
127
|
+
throwApiError(this, response);
|
|
128
|
+
const options = getOptions(this);
|
|
129
|
+
const format = getText(options, 'responseFormat') || 'mp3';
|
|
130
|
+
const outputField = getText(options, 'binaryPropertyOutput') || 'data';
|
|
131
|
+
const mimeType = String((_a = response.headers['content-type']) !== null && _a !== void 0 ? _a : '')
|
|
132
|
+
.split(';')[0]
|
|
133
|
+
.trim();
|
|
134
|
+
const binary = await this.helpers.prepareBinaryData(Buffer.from(response.body), `speech.${format}`, mimeType || undefined);
|
|
135
|
+
const duration = Number(response.headers['x-audio-duration-seconds']);
|
|
136
|
+
return [
|
|
137
|
+
{
|
|
138
|
+
json: Number.isFinite(duration) ? { durationSeconds: duration } : {},
|
|
139
|
+
binary: { [outputField]: binary },
|
|
140
|
+
},
|
|
141
|
+
];
|
|
142
|
+
}
|
|
143
|
+
async function parseTranscript(_items, response) {
|
|
144
|
+
const { body } = response;
|
|
145
|
+
if (isObject(body))
|
|
146
|
+
return [{ json: body }];
|
|
147
|
+
if (body === undefined || body === null || body === '')
|
|
148
|
+
(0, routing_1.fail)(this, 'ZeroGPU returned no transcript');
|
|
149
|
+
return [{ json: { text: String(body) } }];
|
|
150
|
+
}
|
|
151
|
+
exports.speechRouting = {
|
|
152
|
+
request: {
|
|
153
|
+
method: 'POST',
|
|
154
|
+
url: '/audio/speech',
|
|
155
|
+
headers: { Accept: '*/*' },
|
|
156
|
+
encoding: 'arraybuffer',
|
|
157
|
+
ignoreHttpStatusErrors: true,
|
|
158
|
+
},
|
|
159
|
+
send: { preSend: [buildSpeechRequest] },
|
|
160
|
+
output: { postReceive: [toSpeechBinary] },
|
|
161
|
+
};
|
|
162
|
+
const transcriptRouting = (url) => ({
|
|
163
|
+
request: { method: 'POST', url, headers: { Accept: '*/*' } },
|
|
164
|
+
send: { preSend: [buildTranscriptionRequest] },
|
|
165
|
+
output: { postReceive: [parseTranscript] },
|
|
166
|
+
});
|
|
167
|
+
exports.transcriptionsRouting = transcriptRouting('/audio/transcriptions');
|
|
168
|
+
exports.translationsRouting = transcriptRouting('/audio/translations');
|
|
169
|
+
//# sourceMappingURL=audio.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audio.js","sourceRoot":"","sources":["../../../../nodes/ZeroGpu/shared/audio.ts"],"names":[],"mappings":";;;AAkHA,gDAqBC;AAED,8DAoBC;AAoBD,wCA2BC;AAGD,0CAUC;AAhND,+CAAuD;AACvD,uCAAoD;AAEvC,QAAA,cAAc,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;AAC9D,QAAA,kBAAkB,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,KAAK,CAAC,CAAC;AAWjF,MAAM,cAAc,GAAmB;IACtC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,EAAE;IACtF,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE;IACnF,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE;IAChE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE;IACnF;QACC,IAAI,EAAE,mBAAmB;QACzB,KAAK,EAAE,oBAAoB;QAC3B,KAAK,EAAE,oBAAoB;QAC3B,GAAG,EAAE,CAAC;QACN,GAAG,EAAE,CAAC;KACN;CACD,CAAC;AAE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E,CAAC,kBAAkB,CAAC,EAAE;IACvC,MAAM,EAAE,EAAE,WAAW,EAAE,CAAC,cAAc,CAAC,EAAE;CACzC,CAAC;AAEF,MAAM,iBAAiB,GAAG,CAAC,GAAW,EAAwB,EAAE,CAAC,CAAC;IACjE,OAAO,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE;IAC5D,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,yBAAyB,CAAC,EAAE;IAC9C,MAAM,EAAE,EAAE,WAAW,EAAE,CAAC,eAAe,CAAC,EAAE;CAC1C,CAAC,CAAC;AAEU,QAAA,qBAAqB,GAAG,iBAAiB,CAAC,uBAAuB,CAAC,CAAC;AACnE,QAAA,mBAAmB,GAAG,iBAAiB,CAAC,qBAAqB,CAAC,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { type ZeroGpuModel } from '../../shared/models';
|
|
2
|
-
export type
|
|
2
|
+
export type AudioOperation = 'generateSpeech' | 'transcribe' | 'translate';
|
|
3
|
+
export type Operation = AudioOperation | 'classifyByLabels' | 'classifyBySchema' | 'classifyDomain' | 'classifyIab' | 'detectPii' | 'embedText' | 'extractEntities' | 'extractJson' | 'extractText' | 'moderate' | 'redactPii' | 'summarize';
|
|
3
4
|
export declare const MODEL_FILTERS: Record<Operation, (model: ZeroGpuModel) => boolean>;
|