@saltcorn/large-language-model 0.9.7 → 0.9.8

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 (2) hide show
  1. package/index.js +8 -0
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -820,6 +820,11 @@ module.exports = {
820
820
  sublabel: "A description of the field.",
821
821
  type: "String",
822
822
  },
823
+ {
824
+ label: "Required",
825
+ name: "required",
826
+ type: "Bool",
827
+ },
823
828
  {
824
829
  name: "type",
825
830
  label: "Type",
@@ -954,17 +959,20 @@ module.exports = {
954
959
  history = row[chat_history_field];
955
960
  }
956
961
  const fieldArgs = {};
962
+ const required = [];
957
963
  (fields || []).forEach((field) => {
958
964
  fieldArgs[field.name] = {
959
965
  type: field.type,
960
966
  description: field.description,
961
967
  };
968
+ if (field.required) required.push(field.name);
962
969
  if (field.type === "string" && field.options)
963
970
  fieldArgs[field.name].enum = field.options
964
971
  .split(",")
965
972
  .map((s) => s.trim());
966
973
  });
967
974
  const argObj = { type: "object", properties: fieldArgs };
975
+ if (required.length) argObj.required = required;
968
976
  const args = {
969
977
  [answer_field]: multiple ? { type: "array", items: argObj } : argObj,
970
978
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saltcorn/large-language-model",
3
- "version": "0.9.7",
3
+ "version": "0.9.8",
4
4
  "description": "Large language models and functionality for Saltcorn",
5
5
  "main": "index.js",
6
6
  "dependencies": {