@saltcorn/agents 0.7.0 → 0.7.1

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.
Files changed (3) hide show
  1. package/action.js +16 -6
  2. package/common.js +2 -0
  3. package/package.json +1 -1
package/action.js CHANGED
@@ -4,6 +4,7 @@ const { get_skills, process_interaction } = require("./common");
4
4
  const { applyAsync } = require("@saltcorn/data/utils");
5
5
  const WorkflowRun = require("@saltcorn/data/models/workflow_run");
6
6
  const { interpolate } = require("@saltcorn/data/utils");
7
+ const { getState } = require("@saltcorn/data/db/state");
7
8
 
8
9
  module.exports = {
9
10
  disableInBuilder: true,
@@ -22,12 +23,10 @@ module.exports = {
22
23
  }
23
24
  }
24
25
  }
25
- const tables_with_json_field = (await Table.find({})).filter(
26
- (table) =>
27
- !table.external &&
28
- !table.provider_name &&
29
- table.fields.some((f) => f.type?.name === "JSON"),
30
- );
26
+ const llm_cfg_fun = getState().functions.llm_get_configuration;
27
+ const alt_config_options = llm_cfg_fun
28
+ ? llm_cfg_fun.run().alt_config_names || []
29
+ : [];
31
30
  return [
32
31
  ...(table
33
32
  ? [
@@ -50,6 +49,17 @@ module.exports = {
50
49
  type: "String",
51
50
  fieldview: "textarea",
52
51
  },
52
+ ...(alt_config_options.length
53
+ ? [
54
+ {
55
+ name: "alt_config",
56
+ label: "Alternative configuration",
57
+ sublabel: "Use this configuration for LLM interactions",
58
+ type: "String",
59
+ attributes: { options: alt_config_options },
60
+ },
61
+ ]
62
+ : []),
53
63
  {
54
64
  name: "model",
55
65
  label: "Model",
package/common.js CHANGED
@@ -141,6 +141,7 @@ const getCompletionArguments = async (
141
141
  if (tools.length === 0) tools = undefined;
142
142
  const complArgs = { tools, systemPrompt: sysPrompts.join("\n\n") };
143
143
  if (config.model) complArgs.model = config.model;
144
+ if (config.alt_config) complArgs.alt_config = config.alt_config;
144
145
  return complArgs;
145
146
  };
146
147
 
@@ -449,6 +450,7 @@ const process_interaction = async (
449
450
  chat,
450
451
  appendToChat: true,
451
452
  systemPrompt,
453
+ alt_config: config.alt_config,
452
454
  ...opts,
453
455
  });
454
456
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saltcorn/agents",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "AI agents for Saltcorn",
5
5
  "main": "index.js",
6
6
  "dependencies": {