@saltcorn/large-language-model 0.9.6 → 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.
- package/index.js +18 -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",
|
|
@@ -906,6 +911,12 @@ module.exports = {
|
|
|
906
911
|
sublabel: "A short description of what you want to generate.",
|
|
907
912
|
type: "String",
|
|
908
913
|
},
|
|
914
|
+
{
|
|
915
|
+
name: "model",
|
|
916
|
+
label: "Model",
|
|
917
|
+
sublabel: "Override default model name",
|
|
918
|
+
type: "String",
|
|
919
|
+
},
|
|
909
920
|
{
|
|
910
921
|
input_type: "section_header",
|
|
911
922
|
label: "JSON fields to generate",
|
|
@@ -922,16 +933,18 @@ module.exports = {
|
|
|
922
933
|
configuration: {
|
|
923
934
|
prompt_template,
|
|
924
935
|
fields,
|
|
925
|
-
|
|
936
|
+
multiple,
|
|
926
937
|
gen_description,
|
|
927
938
|
answer_field,
|
|
928
939
|
override_config,
|
|
929
940
|
chat_history_field,
|
|
941
|
+
model,
|
|
930
942
|
},
|
|
931
943
|
}) => {
|
|
932
944
|
let prompt = interpolate(prompt_template, row, user);
|
|
933
945
|
|
|
934
946
|
const opts = {};
|
|
947
|
+
if (model) opts.model = model;
|
|
935
948
|
if (override_config) {
|
|
936
949
|
const altcfg = config.altconfigs.find(
|
|
937
950
|
(c) => c.name === override_config
|
|
@@ -946,19 +959,22 @@ module.exports = {
|
|
|
946
959
|
history = row[chat_history_field];
|
|
947
960
|
}
|
|
948
961
|
const fieldArgs = {};
|
|
962
|
+
const required = [];
|
|
949
963
|
(fields || []).forEach((field) => {
|
|
950
964
|
fieldArgs[field.name] = {
|
|
951
965
|
type: field.type,
|
|
952
966
|
description: field.description,
|
|
953
967
|
};
|
|
968
|
+
if (field.required) required.push(field.name);
|
|
954
969
|
if (field.type === "string" && field.options)
|
|
955
970
|
fieldArgs[field.name].enum = field.options
|
|
956
971
|
.split(",")
|
|
957
972
|
.map((s) => s.trim());
|
|
958
973
|
});
|
|
959
974
|
const argObj = { type: "object", properties: fieldArgs };
|
|
975
|
+
if (required.length) argObj.required = required;
|
|
960
976
|
const args = {
|
|
961
|
-
[answer_field]:
|
|
977
|
+
[answer_field]: multiple ? { type: "array", items: argObj } : argObj,
|
|
962
978
|
};
|
|
963
979
|
const expert_function = {
|
|
964
980
|
type: "function",
|