node-red-contrib-ollama 0.2.4 → 0.2.5
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/nodes/ollama-chat.html
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
name: { value: 'Ollama Chat' },
|
|
7
7
|
server: { value: '', type: 'ollama-config-server', required: false },
|
|
8
8
|
model: { value: '', type: 'ollama-config-model', required: true },
|
|
9
|
+
format: { value: '', type: 'ollama-config-format', required: false },
|
|
9
10
|
tools: { value: '', type: 'ollama-config-tools', required: false },
|
|
10
11
|
},
|
|
11
12
|
inputs: 1,
|
|
@@ -33,6 +34,11 @@
|
|
|
33
34
|
<input type="text" id="node-input-model" />
|
|
34
35
|
</div>
|
|
35
36
|
|
|
37
|
+
<div class="form-row">
|
|
38
|
+
<label for="node-input-format"><i class="fa fa-cog"></i> Format</label>
|
|
39
|
+
<input type="text" id="node-input-format" />
|
|
40
|
+
</div>
|
|
41
|
+
|
|
36
42
|
<div class="form-row">
|
|
37
43
|
<label for="node-input-tools"><i class="fa fa-cog"></i> Tools</label>
|
|
38
44
|
<input type="text" id="node-input-tools" />
|
|
@@ -102,7 +108,10 @@
|
|
|
102
108
|
<dt class="optional">
|
|
103
109
|
payload.format <span class="property-type">string</span>
|
|
104
110
|
</dt>
|
|
105
|
-
<dd>
|
|
111
|
+
<dd>
|
|
112
|
+
The format of the response (only <code>json</code> for now).<br />
|
|
113
|
+
<em>Alternative to the <code>Format</code> field.</em>
|
|
114
|
+
</dd>
|
|
106
115
|
|
|
107
116
|
<dt class="optional">
|
|
108
117
|
payload.stream <span class="property-type">boolean</span>
|
|
@@ -119,7 +128,7 @@
|
|
|
119
128
|
</dt>
|
|
120
129
|
<dd>
|
|
121
130
|
Tools for the model to use if supported.<br />
|
|
122
|
-
Requires <code>stream</code> to be set to <code>false</code
|
|
131
|
+
Requires <code>stream</code> to be set to <code>false</code>.<br />
|
|
123
132
|
<em>Alternative to the <code>Model</code> field.</em>
|
|
124
133
|
|
|
125
134
|
<p>
|
package/nodes/ollama-chat.js
CHANGED
|
@@ -10,7 +10,7 @@ module.exports = function( RED ) {
|
|
|
10
10
|
host: payloadHost,
|
|
11
11
|
model: payloadModel,
|
|
12
12
|
messages,
|
|
13
|
-
format,
|
|
13
|
+
format: payloadFormat,
|
|
14
14
|
stream,
|
|
15
15
|
keep_alive,
|
|
16
16
|
tools: payloadTools,
|
|
@@ -25,6 +25,9 @@ module.exports = function( RED ) {
|
|
|
25
25
|
const modelConfig = RED.nodes.getNode( config.model )
|
|
26
26
|
const model = ( modelConfig ) ? modelConfig.name : payloadModel
|
|
27
27
|
|
|
28
|
+
const formatConfig = RED.nodes.getNode( config.format )
|
|
29
|
+
const format = ( formatConfig ) ? formatConfig.json : payloadFormat
|
|
30
|
+
|
|
28
31
|
const toolsConfig = RED.nodes.getNode( config.tools )
|
|
29
32
|
const tools = ( toolsConfig ) ? toolsConfig.json : payloadTools
|
|
30
33
|
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<script type="text/javascript">
|
|
2
|
+
RED.nodes.registerType( 'ollama-config-format', {
|
|
3
|
+
category: 'config',
|
|
4
|
+
defaults: {
|
|
5
|
+
name: { value: 'Ollama Format Config' },
|
|
6
|
+
json: { value: '' }
|
|
7
|
+
},
|
|
8
|
+
label: function() {
|
|
9
|
+
return this.name;
|
|
10
|
+
},
|
|
11
|
+
oneditprepare: function() {
|
|
12
|
+
$( '#node-config-input-json' ).typedInput( {
|
|
13
|
+
type: 'json',
|
|
14
|
+
types: [ 'json' ]
|
|
15
|
+
} )
|
|
16
|
+
}
|
|
17
|
+
} )
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<script type="text/html" data-template-name="ollama-config-format">
|
|
21
|
+
<div class="form-row">
|
|
22
|
+
<label for="node-config-input-name"><i class="fa fa-server"></i> Name</label>
|
|
23
|
+
<input type="text" id="node-config-input-name" placeholder="Ollama Format Config" />
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
<div class="form-row">
|
|
27
|
+
<label for="node-config-input-json"><i class="fa fa-cog"></i> JSON</label>
|
|
28
|
+
<input type="text" id="node-config-input-json" placeholder="" />
|
|
29
|
+
</div>
|
|
30
|
+
</script>
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
defaults: {
|
|
6
6
|
name: { value: 'Ollama Generate' },
|
|
7
7
|
server: { value: '', type: 'ollama-config-server', required: false },
|
|
8
|
+
format: { value: '', type: 'ollama-config-format', required: false },
|
|
8
9
|
model: { value: '', type: 'ollama-config-model', required: false },
|
|
9
10
|
},
|
|
10
11
|
inputs: 1,
|
|
@@ -27,6 +28,11 @@
|
|
|
27
28
|
<input type="text" id="node-input-server" />
|
|
28
29
|
</div>
|
|
29
30
|
|
|
31
|
+
<div class="form-row">
|
|
32
|
+
<label for="node-input-format"><i class="fa fa-cog"></i> Format</label>
|
|
33
|
+
<input type="text" id="node-input-format" />
|
|
34
|
+
</div>
|
|
35
|
+
|
|
30
36
|
<div class="form-row">
|
|
31
37
|
<label for="node-input-model"><i class="fa fa-bookmark"></i> Model</label>
|
|
32
38
|
<input type="text" id="node-input-model" />
|
|
@@ -81,7 +87,10 @@
|
|
|
81
87
|
<dt class="optional">
|
|
82
88
|
payload.format <span class="property-type">string</span>
|
|
83
89
|
</dt>
|
|
84
|
-
<dd>
|
|
90
|
+
<dd>
|
|
91
|
+
The format to return a response in. Currently the only accepted value is <code>json</code><br />
|
|
92
|
+
<em>Alternative to the <code>Format</code> field.</em>
|
|
93
|
+
</dd>
|
|
85
94
|
|
|
86
95
|
<dt class="optional">
|
|
87
96
|
payload.options <span class="property-type">object</span>
|
package/nodes/ollama-generate.js
CHANGED
|
@@ -15,7 +15,7 @@ module.exports = function( RED ) {
|
|
|
15
15
|
template,
|
|
16
16
|
raw,
|
|
17
17
|
images,
|
|
18
|
-
format,
|
|
18
|
+
format: payloadFormat,
|
|
19
19
|
stream,
|
|
20
20
|
keep_alive,
|
|
21
21
|
options
|
|
@@ -29,6 +29,9 @@ module.exports = function( RED ) {
|
|
|
29
29
|
const modelConfig = RED.nodes.getNode( config.model )
|
|
30
30
|
const model = ( modelConfig ) ? modelConfig.name : payloadModel
|
|
31
31
|
|
|
32
|
+
const formatConfig = RED.nodes.getNode( config.format )
|
|
33
|
+
const format = ( formatConfig ) ? formatConfig.json : payloadFormat
|
|
34
|
+
|
|
32
35
|
const response = await ollama.generate( {
|
|
33
36
|
model,
|
|
34
37
|
prompt,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-red-contrib-ollama",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"description": "Add AI functionality to your flows! This module includes a set of nodes that enable easy communication with Ollama, enriching your projects with intelligent solutions.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"ollama-abort": "nodes/ollama-abort.js",
|
|
32
32
|
"ollama-config-server": "nodes/ollama-config-server.js",
|
|
33
33
|
"ollama-config-model": "nodes/ollama-config-model.js",
|
|
34
|
+
"ollama-config-format": "nodes/ollama-config-format.js",
|
|
34
35
|
"ollama-config-tools": "nodes/ollama-config-tools.js"
|
|
35
36
|
}
|
|
36
37
|
},
|