@saltcorn/agents 0.4.2 → 0.4.3

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/common.js CHANGED
@@ -105,13 +105,9 @@ const getCompletionArguments = async (config, user, triggering_row) => {
105
105
  else if (skillTools) tools.push(skillTools);
106
106
  }
107
107
  if (tools.length === 0) tools = undefined;
108
- return { tools, systemPrompt: sysPrompts.join("\n\n") };
109
- };
110
-
111
- const getCompletion = async (language, prompt) => {
112
- return getState().functions.llm_generate.run(prompt, {
113
- systemPrompt: `You are a helpful code assistant. Your language of choice is ${language}. Do not include any explanation, just generate the code block itself.`,
114
- });
108
+ const complArgs = { tools, systemPrompt: sysPrompts.join("\n\n") };
109
+ if (config.model) complArgs.model = config.model;
110
+ return complArgs;
115
111
  };
116
112
 
117
113
  const incompleteCfgMsg = () => {
@@ -359,7 +355,6 @@ module.exports = {
359
355
  get_skills,
360
356
  get_skill_class,
361
357
  incompleteCfgMsg,
362
- getCompletion,
363
358
  find_tool,
364
359
  get_skill_instances,
365
360
  getCompletionArguments,
package/index.js CHANGED
@@ -56,7 +56,12 @@ module.exports = {
56
56
  type: "String",
57
57
  fieldview: "textarea",
58
58
  },
59
-
59
+ {
60
+ name: "model",
61
+ label: "Model",
62
+ sublabel: "Override default model name",
63
+ type: "String",
64
+ },
60
65
  new FieldRepeat({
61
66
  name: "skills",
62
67
  label: "Skills",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saltcorn/agents",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "description": "AI agents for Saltcorn",
5
5
  "main": "index.js",
6
6
  "dependencies": {
@@ -9,7 +9,8 @@
9
9
  "node-sql-parser": "4.15.0",
10
10
  "markdown-it": "14.1.0",
11
11
  "style-to-object": "1.0.8",
12
- "node-html-parser": "7.0.1"
12
+ "node-html-parser": "7.0.1",
13
+ "node-fetch": "2.6.9"
13
14
  },
14
15
  "author": "Tom Nielsen",
15
16
  "license": "MIT",
@@ -11,6 +11,7 @@ const db = require("@saltcorn/data/db");
11
11
  const { eval_expression } = require("@saltcorn/data/models/expression");
12
12
  const { interpolate } = require("@saltcorn/data/utils");
13
13
  const vm = require("vm");
14
+ const fetch = require("node-fetch");
14
15
 
15
16
  class PreloadData {
16
17
  static skill_name = "Preload Data";
@@ -36,6 +37,7 @@ class PreloadData {
36
37
  Trigger,
37
38
  setTimeout,
38
39
  interpolate,
40
+ fetch,
39
41
  require,
40
42
  getConfig: (k) =>
41
43
  sysState.isFixedConfig(k) ? undefined : sysState.getConfig(k),