node-red-contrib-ollama 0.2.5 → 0.2.6

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.
@@ -8,6 +8,7 @@
8
8
  model: { value: '', type: 'ollama-config-model', required: true },
9
9
  format: { value: '', type: 'ollama-config-format', required: false },
10
10
  tools: { value: '', type: 'ollama-config-tools', required: false },
11
+ options: { value: '', type: 'ollama-config-options', required: false },
11
12
  },
12
13
  inputs: 1,
13
14
  outputs: 1,
@@ -43,6 +44,11 @@
43
44
  <label for="node-input-tools"><i class="fa fa-cog"></i> Tools</label>
44
45
  <input type="text" id="node-input-tools" />
45
46
  </div>
47
+
48
+ <div class="form-row">
49
+ <label for="node-input-options"><i class="fa fa-cog"></i> Options</label>
50
+ <input type="text" id="node-input-options" />
51
+ </div>
46
52
  </script>
47
53
 
48
54
  <script type="text/html" data-help-name="ollama-chat">
@@ -142,6 +148,7 @@
142
148
  </dt>
143
149
  <dd>
144
150
  Options to configure the runtime.<br />
151
+ <em>Alternative to the <code>Options</code> field.</em>
145
152
 
146
153
  <h4>Options</h4>
147
154
  <dl class="message-properties">
@@ -14,7 +14,7 @@ module.exports = function( RED ) {
14
14
  stream,
15
15
  keep_alive,
16
16
  tools: payloadTools,
17
- options
17
+ options: payloadOptions
18
18
  } = msg.payload
19
19
 
20
20
  const server = RED.nodes.getNode( config.server )
@@ -31,6 +31,9 @@ module.exports = function( RED ) {
31
31
  const toolsConfig = RED.nodes.getNode( config.tools )
32
32
  const tools = ( toolsConfig ) ? toolsConfig.json : payloadTools
33
33
 
34
+ const optionsConfig = RED.nodes.getNode( config.options )
35
+ const options = ( optionsConfig ) ? optionsConfig.json : payloadOptions
36
+
34
37
  const response = await ollama.chat( {
35
38
  model,
36
39
  messages,
@@ -0,0 +1,25 @@
1
+ <script type="text/javascript">
2
+ RED.nodes.registerType( 'ollama-config-options', {
3
+ category: 'config',
4
+ defaults: {
5
+ name: { value: 'Ollama Options 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-options">
21
+ <div class="form-row">
22
+ <label for="node-config-input-json"><i class="fa fa-server"></i> JSON</label>
23
+ <input type="text" id="node-config-input-json" />
24
+ </div>
25
+ </script>
@@ -0,0 +1,10 @@
1
+ module.exports = function( RED ) {
2
+ function OllamaConfigOptionsNode( config ) {
3
+ RED.nodes.createNode( this, config )
4
+
5
+ this.name = config.name
6
+ this.json = config.json
7
+ }
8
+
9
+ RED.nodes.registerType( 'ollama-config-options', OllamaConfigOptionsNode )
10
+ }
@@ -6,6 +6,7 @@
6
6
  name: { value: 'Ollama Embed' },
7
7
  server: { value: '', type: 'ollama-config-server', required: false },
8
8
  model: { value: '', type: 'ollama-config-model', required: false },
9
+ options: { value: '', type: 'ollama-config-options', required: false },
9
10
  },
10
11
  inputs: 1,
11
12
  outputs: 1,
@@ -31,6 +32,11 @@
31
32
  <label for="node-input-model"><i class="fa fa-bookmark"></i> Model</label>
32
33
  <input type="text" id="node-input-model" />
33
34
  </div>
35
+
36
+ <div class="form-row">
37
+ <label for="node-input-options"><i class="fa fa-cog"></i> Options</label>
38
+ <input type="text" id="node-input-options" />
39
+ </div>
34
40
  </script>
35
41
 
36
42
  <script type="text/html" data-help-name="ollama-embed">
@@ -83,6 +89,7 @@
83
89
  </dt>
84
90
  <dd>
85
91
  Options to configure the runtime.<br />
92
+ <em>Alternative to the <code>Options</code> field.</em>
86
93
 
87
94
  <h4>Options</h4>
88
95
  <dl class="message-properties">
@@ -12,7 +12,7 @@ module.exports = function( RED ) {
12
12
  input,
13
13
  truncate,
14
14
  keep_alive,
15
- options
15
+ options: payloadOptions
16
16
  } = msg.payload
17
17
 
18
18
  const server = RED.nodes.getNode( config.server )
@@ -23,6 +23,9 @@ module.exports = function( RED ) {
23
23
  const modelConfig = RED.nodes.getNode( config.model )
24
24
  const model = ( modelConfig ) ? modelConfig.name : payloadModel
25
25
 
26
+ const optionsConfig = RED.nodes.getNode( config.options )
27
+ const options = ( optionsConfig ) ? optionsConfig.json : payloadOptions
28
+
26
29
  const response = await ollama.embed( {
27
30
  model,
28
31
  input,
@@ -7,6 +7,7 @@
7
7
  server: { value: '', type: 'ollama-config-server', required: false },
8
8
  format: { value: '', type: 'ollama-config-format', required: false },
9
9
  model: { value: '', type: 'ollama-config-model', required: false },
10
+ options: { value: '', type: 'ollama-config-options', required: false },
10
11
  },
11
12
  inputs: 1,
12
13
  outputs: 1,
@@ -37,6 +38,11 @@
37
38
  <label for="node-input-model"><i class="fa fa-bookmark"></i> Model</label>
38
39
  <input type="text" id="node-input-model" />
39
40
  </div>
41
+
42
+ <div class="form-row">
43
+ <label for="node-input-options"><i class="fa fa-cog"></i> Options</label>
44
+ <input type="text" id="node-input-options" />
45
+ </div>
40
46
  </script>
41
47
 
42
48
  <script type="text/html" data-help-name="ollama-generate">
@@ -96,7 +102,8 @@
96
102
  payload.options <span class="property-type">object</span>
97
103
  </dt>
98
104
  <dd>
99
- Additional model parameters listed in the documentation for the <a href="https://github.com/ollama/ollama/blob/main/docs/modelfile.md#valid-parameters-and-values">Modelfile</a>.
105
+ Additional model parameters listed in the documentation for the <a href="https://github.com/ollama/ollama/blob/main/docs/modelfile.md#valid-parameters-and-values">Modelfile</a>.<br />
106
+ <em>Alternative to the <code>Options</code> field.</em>
100
107
  </dd>
101
108
 
102
109
  <dt class="optional">
@@ -18,7 +18,7 @@ module.exports = function( RED ) {
18
18
  format: payloadFormat,
19
19
  stream,
20
20
  keep_alive,
21
- options
21
+ options: payloadOptions
22
22
  } = msg.payload
23
23
 
24
24
  const server = RED.nodes.getNode( config.server )
@@ -32,6 +32,9 @@ module.exports = function( RED ) {
32
32
  const formatConfig = RED.nodes.getNode( config.format )
33
33
  const format = ( formatConfig ) ? formatConfig.json : payloadFormat
34
34
 
35
+ const optionsConfig = RED.nodes.getNode( config.options )
36
+ const options = ( optionsConfig ) ? optionsConfig.json : payloadOptions
37
+
35
38
  const response = await ollama.generate( {
36
39
  model,
37
40
  prompt,
@@ -6,6 +6,7 @@
6
6
  name: { value: 'Ollama Show' },
7
7
  server: { value: '', type: 'ollama-config-server', required: false },
8
8
  model: { value: '', type: 'ollama-config-model', required: false },
9
+ options: { value: '', type: 'ollama-config-options', required: false },
9
10
  },
10
11
  inputs: 1,
11
12
  outputs: 1,
@@ -31,6 +32,11 @@
31
32
  <label for="node-input-model"><i class="fa fa-bookmark"></i> Model</label>
32
33
  <input type="text" id="node-input-model" />
33
34
  </div>
35
+
36
+ <div class="form-row">
37
+ <label for="node-input-options"><i class="fa fa-cog"></i> Options</label>
38
+ <input type="text" id="node-input-options" />
39
+ </div>
34
40
  </script>
35
41
 
36
42
  <script type="text/html" data-help-name="ollama-show">
@@ -75,7 +81,10 @@
75
81
  <dt class="optional">
76
82
  payload.options <span class="property-type">object</span>
77
83
  </dt>
78
- <dd>Options to configure the runtime.</dd>
84
+ <dd>
85
+ Options to configure the runtime.<br />
86
+ <em>Alternative to the <code>Server</code> field.</em>
87
+ </dd>
79
88
  </dl>
80
89
  </dd>
81
90
  </dl>
@@ -11,7 +11,7 @@ module.exports = function( RED ) {
11
11
  model: payloadModel,
12
12
  system,
13
13
  template,
14
- options
14
+ options: payloadOptions
15
15
  } = msg.payload
16
16
 
17
17
  const server = RED.nodes.getNode( config.server )
@@ -22,6 +22,9 @@ module.exports = function( RED ) {
22
22
  const modelConfig = RED.nodes.getNode( config.model )
23
23
  const model = ( modelConfig ) ? modelConfig.name : payloadModel
24
24
 
25
+ const optionsConfig = RED.nodes.getNode( config.options )
26
+ const options = ( optionsConfig ) ? optionsConfig.json : payloadOptions
27
+
25
28
  const response = await ollama.show( {
26
29
  model,
27
30
  system,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-ollama",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
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",
@@ -32,7 +32,8 @@
32
32
  "ollama-config-server": "nodes/ollama-config-server.js",
33
33
  "ollama-config-model": "nodes/ollama-config-model.js",
34
34
  "ollama-config-format": "nodes/ollama-config-format.js",
35
- "ollama-config-tools": "nodes/ollama-config-tools.js"
35
+ "ollama-config-tools": "nodes/ollama-config-tools.js",
36
+ "ollama-config-options": "nodes/ollama-config-options.js"
36
37
  }
37
38
  },
38
39
  "engines": {