node-red-contrib-ollama 0.0.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/LICENSE +21 -0
- package/README.md +58 -0
- package/node-red-contrib-ollama-logo.png +0 -0
- package/nodes/ollama-chat.html +396 -0
- package/nodes/ollama-chat.js +23 -0
- package/nodes/ollama-copy.html +55 -0
- package/nodes/ollama-copy.js +23 -0
- package/nodes/ollama-create.html +90 -0
- package/nodes/ollama-create.js +23 -0
- package/nodes/ollama-delete.html +48 -0
- package/nodes/ollama-delete.js +23 -0
- package/nodes/ollama-embeddings.html +268 -0
- package/nodes/ollama-embeddings.js +23 -0
- package/nodes/ollama-generate.html +380 -0
- package/nodes/ollama-generate.js +23 -0
- package/nodes/ollama-list.html +123 -0
- package/nodes/ollama-list.js +22 -0
- package/nodes/ollama-pull.html +83 -0
- package/nodes/ollama-pull.js +23 -0
- package/nodes/ollama-push.html +83 -0
- package/nodes/ollama-push.js +23 -0
- package/nodes/ollama-show.html +178 -0
- package/nodes/ollama-show.js +23 -0
- package/package.json +36 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
<script type="text/javascript">
|
|
2
|
+
RED.nodes.registerType( 'ollama-push', {
|
|
3
|
+
category: 'AI',
|
|
4
|
+
color: 'rgb(186 230 253)',
|
|
5
|
+
defaults: {
|
|
6
|
+
name: { value: '' },
|
|
7
|
+
},
|
|
8
|
+
inputs: 1,
|
|
9
|
+
outputs: 1,
|
|
10
|
+
icon: 'ollama.png',
|
|
11
|
+
label: function() {
|
|
12
|
+
return this.name || 'ollama-push';
|
|
13
|
+
},
|
|
14
|
+
} )
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<script type="text/html" data-template-name="ollama-push">
|
|
18
|
+
<div class="form-row">
|
|
19
|
+
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
20
|
+
<input type="text" id="node-input-name" placeholder="Name" />
|
|
21
|
+
</div>
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<script type="text/html" data-help-name="ollama-push">
|
|
25
|
+
<p>Upload a model to a model library. Requires registering for ollama.ai and adding a public key first.</p>
|
|
26
|
+
|
|
27
|
+
<h3>Inputs</h3>
|
|
28
|
+
|
|
29
|
+
<dl class="message-properties">
|
|
30
|
+
<dt>
|
|
31
|
+
payload.model
|
|
32
|
+
|
|
33
|
+
<span class="property-type">string</span>
|
|
34
|
+
</dt>
|
|
35
|
+
<dd>The name of the model to upload.</dd>
|
|
36
|
+
|
|
37
|
+
<dt>
|
|
38
|
+
payload.insecure
|
|
39
|
+
|
|
40
|
+
<span class="property-type">boolean</span>
|
|
41
|
+
</dt>
|
|
42
|
+
<dd>Push to servers whose identity cannot be verified.</dd>
|
|
43
|
+
|
|
44
|
+
<dt>
|
|
45
|
+
payload.stream
|
|
46
|
+
|
|
47
|
+
<span class="property-type">boolean</span>
|
|
48
|
+
</dt>
|
|
49
|
+
<dd>When true an AsyncGenerator is returned.</dd>
|
|
50
|
+
</dl>
|
|
51
|
+
|
|
52
|
+
<h3>Outputs</h3>
|
|
53
|
+
|
|
54
|
+
<dl class="message-properties">
|
|
55
|
+
<dt>
|
|
56
|
+
payload.status
|
|
57
|
+
|
|
58
|
+
<span class="property-type">string</span>
|
|
59
|
+
</dt>
|
|
60
|
+
<dd>The progress status.</dd>
|
|
61
|
+
|
|
62
|
+
<dt>
|
|
63
|
+
payload.digest
|
|
64
|
+
|
|
65
|
+
<span class="property-type">string</span>
|
|
66
|
+
</dt>
|
|
67
|
+
<dd>The progress digest.</dd>
|
|
68
|
+
|
|
69
|
+
<dt>
|
|
70
|
+
payload.total
|
|
71
|
+
|
|
72
|
+
<span class="property-type">number</span>
|
|
73
|
+
</dt>
|
|
74
|
+
<dd>The total progress.</dd>
|
|
75
|
+
|
|
76
|
+
<dt>
|
|
77
|
+
payload.completed
|
|
78
|
+
|
|
79
|
+
<span class="property-type">number</span>
|
|
80
|
+
</dt>
|
|
81
|
+
<dd>The completed progress.</dd>
|
|
82
|
+
</dl>
|
|
83
|
+
</script>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module.exports = function( RED ) {
|
|
2
|
+
const { Ollama } = require( 'ollama' )
|
|
3
|
+
|
|
4
|
+
function OllamaPushNode( config ) {
|
|
5
|
+
RED.nodes.createNode( this, config )
|
|
6
|
+
const node = this
|
|
7
|
+
|
|
8
|
+
node.on( 'input', async function( msg ) {
|
|
9
|
+
const ollama = new Ollama()
|
|
10
|
+
const { model, insecure, stream } = msg.payload
|
|
11
|
+
|
|
12
|
+
const response = await ollama.push( { model, insecure, stream } )
|
|
13
|
+
.catch( error => {
|
|
14
|
+
node.error( error )
|
|
15
|
+
} )
|
|
16
|
+
|
|
17
|
+
msg.payload = response
|
|
18
|
+
node.send( msg )
|
|
19
|
+
} )
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
RED.nodes.registerType( 'ollama-push', OllamaPushNode )
|
|
23
|
+
}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
<script type="text/javascript">
|
|
2
|
+
RED.nodes.registerType( 'ollama-show', {
|
|
3
|
+
category: 'AI',
|
|
4
|
+
color: 'rgb(186 230 253)',
|
|
5
|
+
defaults: {
|
|
6
|
+
name: { value: '' },
|
|
7
|
+
},
|
|
8
|
+
inputs: 1,
|
|
9
|
+
outputs: 1,
|
|
10
|
+
icon: 'ollama.png',
|
|
11
|
+
label: function() {
|
|
12
|
+
return this.name || 'ollama-show';
|
|
13
|
+
},
|
|
14
|
+
} )
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<script type="text/html" data-template-name="ollama-show">
|
|
18
|
+
<div class="form-row">
|
|
19
|
+
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
20
|
+
<input type="text" id="node-input-name" placeholder="Name" />
|
|
21
|
+
</div>
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<script type="text/html" data-help-name="ollama-show">
|
|
25
|
+
<p>Show information about a model including details, modelfile, template, parameters, license, and system prompt.</p>
|
|
26
|
+
|
|
27
|
+
<h3>Inputs</h3>
|
|
28
|
+
|
|
29
|
+
<dl class="message-properties">
|
|
30
|
+
<dt>
|
|
31
|
+
payload.model
|
|
32
|
+
|
|
33
|
+
<span class="property-type">string</span>
|
|
34
|
+
</dt>
|
|
35
|
+
<dd>The model to show information for.</dd>
|
|
36
|
+
|
|
37
|
+
<dt class="optional">
|
|
38
|
+
payload.system
|
|
39
|
+
|
|
40
|
+
<span class="property-type">string</span>
|
|
41
|
+
</dt>
|
|
42
|
+
<dd>Override the model system prompt.</dd>
|
|
43
|
+
|
|
44
|
+
<dt class="optional">
|
|
45
|
+
payload.template
|
|
46
|
+
|
|
47
|
+
<span class="property-type">string</span>
|
|
48
|
+
</dt>
|
|
49
|
+
|
|
50
|
+
<dt class="optional">
|
|
51
|
+
payload.options
|
|
52
|
+
|
|
53
|
+
<span class="property-type">object</span>
|
|
54
|
+
</dt>
|
|
55
|
+
<dd>Options to configure the runtime.</dd>
|
|
56
|
+
</dl>
|
|
57
|
+
|
|
58
|
+
<h3>Outputs</h3>
|
|
59
|
+
|
|
60
|
+
<dl class="message-properties">
|
|
61
|
+
<dt>
|
|
62
|
+
payload.license
|
|
63
|
+
|
|
64
|
+
<span class="property-type">string</span>
|
|
65
|
+
</dt>
|
|
66
|
+
<dd>The license of the model.</dd>
|
|
67
|
+
|
|
68
|
+
<dt>
|
|
69
|
+
payload.modelfile
|
|
70
|
+
|
|
71
|
+
<span class="property-type">string</span>
|
|
72
|
+
</dt>
|
|
73
|
+
<dd>The modelfile of the model.</dd>
|
|
74
|
+
|
|
75
|
+
<dt>
|
|
76
|
+
payload.parameters
|
|
77
|
+
|
|
78
|
+
<span class="property-type">string</span>
|
|
79
|
+
</dt>
|
|
80
|
+
<dd>The parameters of the model.</dd>
|
|
81
|
+
|
|
82
|
+
<dt>
|
|
83
|
+
payload.template
|
|
84
|
+
|
|
85
|
+
<span class="property-type">string</span>
|
|
86
|
+
</dt>
|
|
87
|
+
<dd>The template of the model.</dd>
|
|
88
|
+
|
|
89
|
+
<dt>
|
|
90
|
+
payload.system
|
|
91
|
+
|
|
92
|
+
<span class="property-type">string</span>
|
|
93
|
+
</dt>
|
|
94
|
+
<dd>The system prompt of the model.</dd>
|
|
95
|
+
|
|
96
|
+
<dt>
|
|
97
|
+
payload.parent_model
|
|
98
|
+
|
|
99
|
+
<span class="property-type">string</span>
|
|
100
|
+
</dt>
|
|
101
|
+
<dd>The parent model of the model.</dd>
|
|
102
|
+
|
|
103
|
+
<dt>
|
|
104
|
+
payload.format
|
|
105
|
+
|
|
106
|
+
<span class="property-type">string</span>
|
|
107
|
+
</dt>
|
|
108
|
+
<dd>The format of the response.</dd>
|
|
109
|
+
|
|
110
|
+
<dt>
|
|
111
|
+
payload.family
|
|
112
|
+
|
|
113
|
+
<span class="property-type">string</span>
|
|
114
|
+
</dt>
|
|
115
|
+
<dd>The family of the model.</dd>
|
|
116
|
+
|
|
117
|
+
<dt>
|
|
118
|
+
payload.families
|
|
119
|
+
|
|
120
|
+
<span class="property-type">array</span>
|
|
121
|
+
</dt>
|
|
122
|
+
<dd>The families of the model.</dd>
|
|
123
|
+
|
|
124
|
+
<dt>
|
|
125
|
+
payload.parameter_size
|
|
126
|
+
|
|
127
|
+
<span class="property-type">string</span>
|
|
128
|
+
</dt>
|
|
129
|
+
<dd>The parameter size of the model.</dd>
|
|
130
|
+
|
|
131
|
+
<dt>
|
|
132
|
+
payload.quantization_size
|
|
133
|
+
|
|
134
|
+
<span class="property-type">string</span>
|
|
135
|
+
</dt>
|
|
136
|
+
<dd>The quantization size of the model.</dd>
|
|
137
|
+
|
|
138
|
+
<dt>
|
|
139
|
+
payload.quantization_level
|
|
140
|
+
|
|
141
|
+
<span class="property-type">string</span>
|
|
142
|
+
</dt>
|
|
143
|
+
<dd>The quantization level of the model.</dd>
|
|
144
|
+
|
|
145
|
+
<dt>
|
|
146
|
+
payload.messages
|
|
147
|
+
|
|
148
|
+
<span class="property-type">array</span>
|
|
149
|
+
</dt>
|
|
150
|
+
<dd>
|
|
151
|
+
The chat history to use for generating the next message.<br />
|
|
152
|
+
|
|
153
|
+
<h4>Message</h4>
|
|
154
|
+
<dl class="message-properties">
|
|
155
|
+
<dt>
|
|
156
|
+
role
|
|
157
|
+
|
|
158
|
+
<span class="property-type">string</span>
|
|
159
|
+
</dt>
|
|
160
|
+
<dd>The role of the message sender ('user', 'system', or 'assistant').</dd>
|
|
161
|
+
|
|
162
|
+
<dt>
|
|
163
|
+
content
|
|
164
|
+
|
|
165
|
+
<span class="property-type">string</span>
|
|
166
|
+
</dt>
|
|
167
|
+
<dd>The content of the message.</dd>
|
|
168
|
+
|
|
169
|
+
<dt>
|
|
170
|
+
images
|
|
171
|
+
|
|
172
|
+
<span class="property-type">array</span>
|
|
173
|
+
</dt>
|
|
174
|
+
<dd>The images attached to the message, either as Uint8Array or base64 encoded strings.</dd>
|
|
175
|
+
</dl>
|
|
176
|
+
</dd>
|
|
177
|
+
</dl>
|
|
178
|
+
</script>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module.exports = function( RED ) {
|
|
2
|
+
const { Ollama } = require( 'ollama' )
|
|
3
|
+
|
|
4
|
+
function OllamaShowNode( config ) {
|
|
5
|
+
RED.nodes.createNode( this, config )
|
|
6
|
+
const node = this
|
|
7
|
+
|
|
8
|
+
node.on( 'input', async function( msg ) {
|
|
9
|
+
const ollama = new Ollama()
|
|
10
|
+
const { name } = msg.payload
|
|
11
|
+
|
|
12
|
+
const response = await ollama.show( { name } )
|
|
13
|
+
.catch( error => {
|
|
14
|
+
node.error( error )
|
|
15
|
+
} )
|
|
16
|
+
|
|
17
|
+
msg.payload = response
|
|
18
|
+
node.send( msg )
|
|
19
|
+
} )
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
RED.nodes.registerType( 'ollama-show', OllamaShowNode )
|
|
23
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "node-red-contrib-ollama",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "A Node-RED module that wraps the ollama.js library, offering its functionalities as configurable nodes for easy integration into flows.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"ai",
|
|
7
|
+
"llama",
|
|
8
|
+
"llm",
|
|
9
|
+
"llms",
|
|
10
|
+
"node-red",
|
|
11
|
+
"ollama"
|
|
12
|
+
],
|
|
13
|
+
"main": "index.js",
|
|
14
|
+
"scripts": {
|
|
15
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
16
|
+
},
|
|
17
|
+
"node-red": {
|
|
18
|
+
"nodes": {
|
|
19
|
+
"ollama-chat": "nodes/ollama-chat.js",
|
|
20
|
+
"ollama-copy": "nodes/ollama-copy.js",
|
|
21
|
+
"ollama-create": "nodes/ollama-create.js",
|
|
22
|
+
"ollama-delete": "nodes/ollama-delete.js",
|
|
23
|
+
"ollama-embeddings": "nodes/ollama-embeddings.js",
|
|
24
|
+
"ollama-generate": "nodes/ollama-generate.js",
|
|
25
|
+
"ollama-list": "nodes/ollama-list.js",
|
|
26
|
+
"ollama-pull": "nodes/ollama-pull.js",
|
|
27
|
+
"ollama-push": "nodes/ollama-push.js",
|
|
28
|
+
"ollama-show": "nodes/ollama-show.js"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"ollama": "^0.5.0"
|
|
33
|
+
},
|
|
34
|
+
"author": "Jakub Burkiewicz",
|
|
35
|
+
"license": "MIT"
|
|
36
|
+
}
|