@inkeep/cxkit-primitives 0.0.0-dev-20250410010657 → 0.0.0-dev-20250410174124
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/dist/components/intelligent-form/actions/context-model-response.cjs +60 -4
- package/dist/components/intelligent-form/actions/context-model-response.js +65 -9
- package/dist/components/intelligent-form/actions/qa-model-messages.cjs +66 -14
- package/dist/components/intelligent-form/actions/qa-model-messages.js +67 -15
- package/package.json +4 -4
|
@@ -1,9 +1,65 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=async(t,o,
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=async(t,o,i)=>{const n=JSON.stringify(t.primaryFieldValues,null,2),l=JSON.stringify(t.fieldsToGenerate,null,2),a=await o.chat.completions.create({model:"inkeep-base-expert",messages:[{role:"system",content:`You are a helpful assistant that suggests form field values based on context. You will receive form field information including field names, descriptions, input types, and available options for select fields.
|
|
2
2
|
|
|
3
3
|
For each field, consider its description, input type, and available options (for select fields).
|
|
4
4
|
|
|
5
|
-
You must respond with a JSON object where keys are the field names and values match the expected input type and length for that field
|
|
6
|
-
|
|
5
|
+
You must respond with a JSON object where keys are the field names and values match the expected input type and length for that field.
|
|
6
|
+
|
|
7
|
+
<context>
|
|
8
|
+
You are quickly suggesting form field values on behalf of an end-user. Think of yourself as the user filling out this form - keep suggestions simple, direct, and user-centric.
|
|
9
|
+
|
|
10
|
+
You will receive:
|
|
11
|
+
- Field metadata (names, descriptions, types)
|
|
12
|
+
- For dropdown/select fields, their valid choice options
|
|
13
|
+
- Initial form field values as context
|
|
14
|
+
</context>
|
|
15
|
+
|
|
16
|
+
<guidance>
|
|
17
|
+
<rule>
|
|
18
|
+
<name>Field Value Suggestions</name>
|
|
19
|
+
<actions>
|
|
20
|
+
<action>
|
|
21
|
+
Return a JSON object where:
|
|
22
|
+
- Keys are field names
|
|
23
|
+
- Values must match field type requirements:
|
|
24
|
+
- Text fields: Plain text strings
|
|
25
|
+
- Dropdown/select fields: ONLY values from provided options list
|
|
26
|
+
- Number fields: Valid numbers
|
|
27
|
+
- Boolean fields: true/false
|
|
28
|
+
|
|
29
|
+
<good_example>
|
|
30
|
+
✅ Example (fields will vary based on actual form configuration):
|
|
31
|
+
{
|
|
32
|
+
"issueType": "bug", // from options: ["bug", "feature", "question"]
|
|
33
|
+
"severity": "high", // from options: ["low", "medium", "high"]
|
|
34
|
+
"shortDescription": "Cannot log in to dashboard"
|
|
35
|
+
}
|
|
36
|
+
</good_example>
|
|
37
|
+
|
|
38
|
+
<bad_example>
|
|
39
|
+
❌ Bad Example (using same illustrative fields):
|
|
40
|
+
{
|
|
41
|
+
"issueType": "not sure but maybe bug?", // invalid: not from options list
|
|
42
|
+
"severity": "very very high", // invalid: not from options list
|
|
43
|
+
"shortDescription": null // invalid: should be string
|
|
44
|
+
}
|
|
45
|
+
</bad_example>
|
|
46
|
+
|
|
47
|
+
Note: The actual field names, types and valid options will be provided in the form configuration.
|
|
48
|
+
Above examples are only illustrative of the expected format and validation rules.
|
|
49
|
+
</action>
|
|
50
|
+
</actions>
|
|
51
|
+
</rule>
|
|
52
|
+
|
|
53
|
+
<global_prohibitions>
|
|
54
|
+
<never>Include explanations or comments in the JSON</never>
|
|
55
|
+
<never>Suggest multiple values for a single field</never>
|
|
56
|
+
<never>Return values not from the provided options for dropdown/select fields</never>
|
|
57
|
+
<never>Skip required fields</never>
|
|
58
|
+
<never>Add fields not present in the input metadata</never>
|
|
59
|
+
<never>Overthink suggestions - keep them straightforward</never>
|
|
60
|
+
</global_prohibitions>
|
|
61
|
+
`},{role:"user",content:`Based on these primary field values:
|
|
62
|
+
${n}
|
|
7
63
|
|
|
8
64
|
Suggest values for these additional fields:
|
|
9
|
-
${
|
|
65
|
+
${l}`}],stream:!0,response_format:{type:"json_object"}},i?{headers:i}:void 0);let e="";for await(const r of a){const s=r.choices?.[0]?.delta?.content;s&&(e+=s)}return{suggestedValues:e?JSON.parse(e):{}}};exports.generateContextModelResponse=d;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const d = async (t, o,
|
|
3
|
-
const
|
|
2
|
+
const d = async (t, o, i) => {
|
|
3
|
+
const n = JSON.stringify(t.primaryFieldValues, null, 2), l = JSON.stringify(t.fieldsToGenerate, null, 2), a = await o.chat.completions.create(
|
|
4
4
|
{
|
|
5
5
|
model: "inkeep-base-expert",
|
|
6
6
|
messages: [
|
|
@@ -10,15 +10,71 @@ const d = async (t, o, s) => {
|
|
|
10
10
|
|
|
11
11
|
For each field, consider its description, input type, and available options (for select fields).
|
|
12
12
|
|
|
13
|
-
You must respond with a JSON object where keys are the field names and values match the expected input type and length for that field
|
|
13
|
+
You must respond with a JSON object where keys are the field names and values match the expected input type and length for that field.
|
|
14
|
+
|
|
15
|
+
<context>
|
|
16
|
+
You are quickly suggesting form field values on behalf of an end-user. Think of yourself as the user filling out this form - keep suggestions simple, direct, and user-centric.
|
|
17
|
+
|
|
18
|
+
You will receive:
|
|
19
|
+
- Field metadata (names, descriptions, types)
|
|
20
|
+
- For dropdown/select fields, their valid choice options
|
|
21
|
+
- Initial form field values as context
|
|
22
|
+
</context>
|
|
23
|
+
|
|
24
|
+
<guidance>
|
|
25
|
+
<rule>
|
|
26
|
+
<name>Field Value Suggestions</name>
|
|
27
|
+
<actions>
|
|
28
|
+
<action>
|
|
29
|
+
Return a JSON object where:
|
|
30
|
+
- Keys are field names
|
|
31
|
+
- Values must match field type requirements:
|
|
32
|
+
- Text fields: Plain text strings
|
|
33
|
+
- Dropdown/select fields: ONLY values from provided options list
|
|
34
|
+
- Number fields: Valid numbers
|
|
35
|
+
- Boolean fields: true/false
|
|
36
|
+
|
|
37
|
+
<good_example>
|
|
38
|
+
✅ Example (fields will vary based on actual form configuration):
|
|
39
|
+
{
|
|
40
|
+
"issueType": "bug", // from options: ["bug", "feature", "question"]
|
|
41
|
+
"severity": "high", // from options: ["low", "medium", "high"]
|
|
42
|
+
"shortDescription": "Cannot log in to dashboard"
|
|
43
|
+
}
|
|
44
|
+
</good_example>
|
|
45
|
+
|
|
46
|
+
<bad_example>
|
|
47
|
+
❌ Bad Example (using same illustrative fields):
|
|
48
|
+
{
|
|
49
|
+
"issueType": "not sure but maybe bug?", // invalid: not from options list
|
|
50
|
+
"severity": "very very high", // invalid: not from options list
|
|
51
|
+
"shortDescription": null // invalid: should be string
|
|
52
|
+
}
|
|
53
|
+
</bad_example>
|
|
54
|
+
|
|
55
|
+
Note: The actual field names, types and valid options will be provided in the form configuration.
|
|
56
|
+
Above examples are only illustrative of the expected format and validation rules.
|
|
57
|
+
</action>
|
|
58
|
+
</actions>
|
|
59
|
+
</rule>
|
|
60
|
+
|
|
61
|
+
<global_prohibitions>
|
|
62
|
+
<never>Include explanations or comments in the JSON</never>
|
|
63
|
+
<never>Suggest multiple values for a single field</never>
|
|
64
|
+
<never>Return values not from the provided options for dropdown/select fields</never>
|
|
65
|
+
<never>Skip required fields</never>
|
|
66
|
+
<never>Add fields not present in the input metadata</never>
|
|
67
|
+
<never>Overthink suggestions - keep them straightforward</never>
|
|
68
|
+
</global_prohibitions>
|
|
69
|
+
`
|
|
14
70
|
},
|
|
15
71
|
{
|
|
16
72
|
role: "user",
|
|
17
73
|
content: `Based on these primary field values:
|
|
18
|
-
${
|
|
74
|
+
${n}
|
|
19
75
|
|
|
20
76
|
Suggest values for these additional fields:
|
|
21
|
-
${
|
|
77
|
+
${l}`
|
|
22
78
|
}
|
|
23
79
|
],
|
|
24
80
|
stream: !0,
|
|
@@ -27,12 +83,12 @@ ${a}`
|
|
|
27
83
|
type: "json_object"
|
|
28
84
|
}
|
|
29
85
|
},
|
|
30
|
-
|
|
86
|
+
i ? { headers: i } : void 0
|
|
31
87
|
);
|
|
32
88
|
let e = "";
|
|
33
|
-
for await (const r of
|
|
34
|
-
const
|
|
35
|
-
|
|
89
|
+
for await (const r of a) {
|
|
90
|
+
const s = r.choices?.[0]?.delta?.content;
|
|
91
|
+
s && (e += s);
|
|
36
92
|
}
|
|
37
93
|
return {
|
|
38
94
|
suggestedValues: e ? JSON.parse(e) : {}
|
|
@@ -1,27 +1,79 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=o=>{const e=JSON.stringify(o,null,2);return[{id:`${Date.now()}1`,role:"system",content:`
|
|
2
|
+
<context>
|
|
3
|
+
You are evaluating a support form submission to determine if an immediate solution can be provided. Your response is final and non-conversational - the user cannot respond or ask follow-ups. You must either provide a complete solution or explain why one cannot be provided.
|
|
4
|
+
</context>
|
|
2
5
|
<guidance>
|
|
3
6
|
<rule>
|
|
4
|
-
<name>
|
|
7
|
+
<name>High Confidence Response</name>
|
|
5
8
|
<conditions>
|
|
6
|
-
<
|
|
9
|
+
<and>
|
|
10
|
+
<condition>Form provides clear, specific problem description</condition>
|
|
11
|
+
<condition>Authoritative information exists for this exact issue</condition>
|
|
12
|
+
<condition>Complete solution can be provided from available information</condition>
|
|
13
|
+
<condition>Solution requires no clarification or follow-up</condition>
|
|
14
|
+
</and>
|
|
7
15
|
</conditions>
|
|
8
16
|
<actions>
|
|
9
17
|
<action>
|
|
10
|
-
|
|
18
|
+
Provide complete solution in this format:
|
|
19
|
+
1. State identified problem
|
|
20
|
+
2. List solution steps
|
|
21
|
+
3. Include any necessary implementation details
|
|
11
22
|
|
|
12
|
-
|
|
13
|
-
|
|
23
|
+
<good_example>
|
|
24
|
+
"To resolve [...paraphrased problem...], try [...solution steps]."
|
|
25
|
+
</good_example>
|
|
14
26
|
|
|
15
|
-
|
|
16
|
-
|
|
27
|
+
<bad_example>
|
|
28
|
+
"I think this might be related to [problem]. Would you like me to explain more about...? If you could clarify [X], I could better assist..."
|
|
29
|
+
</bad_example>
|
|
17
30
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
31
|
+
<guidance>
|
|
32
|
+
<should>Use only information from form fields</should>
|
|
33
|
+
<should>State solution directly and completely</should>
|
|
34
|
+
<should>Include all necessary steps</should>
|
|
35
|
+
<should>Maintain professional, instructional tone</should>
|
|
36
|
+
</guidance>
|
|
23
37
|
</action>
|
|
24
38
|
</actions>
|
|
25
39
|
</rule>
|
|
40
|
+
<rule>
|
|
41
|
+
<name>Low Confidence Response</name>
|
|
42
|
+
<conditions>
|
|
43
|
+
<or>
|
|
44
|
+
<condition>Problem description is unclear/ambiguous</condition>
|
|
45
|
+
<condition>Authoritative information is missing</condition>
|
|
46
|
+
<condition>Solution would require additional details</condition>
|
|
47
|
+
<condition>Cannot provide complete confidence in solution</condition>
|
|
48
|
+
</or>
|
|
49
|
+
</conditions>
|
|
50
|
+
<actions>
|
|
51
|
+
<action>
|
|
52
|
+
Provide single-sentence explanation focusing on specific information gap.
|
|
53
|
+
|
|
54
|
+
<good_example>
|
|
55
|
+
"The information sources don't cover [specific detail[s]]"
|
|
56
|
+
</good_example>
|
|
57
|
+
|
|
58
|
+
<bad_example>
|
|
59
|
+
"I'm not entirely sure about this, but here are some possibilities... Could you provide more details about [X]? Have you tried [Y]? It might also help if..."
|
|
60
|
+
</bad_example>
|
|
61
|
+
|
|
62
|
+
<guidance>
|
|
63
|
+
<should>State only the primary information gap</should>
|
|
64
|
+
<should>Keep explanation BRIEF and specific</should>
|
|
65
|
+
<should>Focus on what's missing, not what's known</should>
|
|
66
|
+
</guidance>
|
|
67
|
+
</action>
|
|
68
|
+
</actions>
|
|
69
|
+
</rule>
|
|
70
|
+
<global_prohibitions>
|
|
71
|
+
<never>Ask questions or request clarification</never>
|
|
72
|
+
<never>Use conditional phrases ("would you like", "do you need")</never>
|
|
73
|
+
<never>Suggest contacting support</never>
|
|
74
|
+
<never>Provide partial or uncertain solutions</never>
|
|
75
|
+
<never>Offer multiple possible solutions</never>
|
|
76
|
+
<never>Speculate beyond available information</never>
|
|
77
|
+
</global_prohibitions>
|
|
26
78
|
</guidance>
|
|
27
|
-
`},{id:`${Date.now()}2`,role:"user",content:`${
|
|
79
|
+
`},{id:`${Date.now()}2`,role:"user",content:`${e}`}]};exports.getQAModelMessages=i;
|
|
@@ -1,42 +1,94 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const n = (
|
|
3
|
-
const
|
|
2
|
+
const n = (o) => {
|
|
3
|
+
const e = JSON.stringify(o, null, 2);
|
|
4
4
|
return [
|
|
5
5
|
{
|
|
6
6
|
id: `${Date.now()}1`,
|
|
7
7
|
role: "system",
|
|
8
8
|
content: `
|
|
9
|
+
<context>
|
|
10
|
+
You are evaluating a support form submission to determine if an immediate solution can be provided. Your response is final and non-conversational - the user cannot respond or ask follow-ups. You must either provide a complete solution or explain why one cannot be provided.
|
|
11
|
+
</context>
|
|
9
12
|
<guidance>
|
|
10
13
|
<rule>
|
|
11
|
-
<name>
|
|
14
|
+
<name>High Confidence Response</name>
|
|
12
15
|
<conditions>
|
|
13
|
-
<
|
|
16
|
+
<and>
|
|
17
|
+
<condition>Form provides clear, specific problem description</condition>
|
|
18
|
+
<condition>Authoritative information exists for this exact issue</condition>
|
|
19
|
+
<condition>Complete solution can be provided from available information</condition>
|
|
20
|
+
<condition>Solution requires no clarification or follow-up</condition>
|
|
21
|
+
</and>
|
|
14
22
|
</conditions>
|
|
15
23
|
<actions>
|
|
16
24
|
<action>
|
|
17
|
-
|
|
25
|
+
Provide complete solution in this format:
|
|
26
|
+
1. State identified problem
|
|
27
|
+
2. List solution steps
|
|
28
|
+
3. Include any necessary implementation details
|
|
18
29
|
|
|
19
|
-
|
|
20
|
-
|
|
30
|
+
<good_example>
|
|
31
|
+
"To resolve [...paraphrased problem...], try [...solution steps]."
|
|
32
|
+
</good_example>
|
|
21
33
|
|
|
22
|
-
|
|
23
|
-
|
|
34
|
+
<bad_example>
|
|
35
|
+
"I think this might be related to [problem]. Would you like me to explain more about...? If you could clarify [X], I could better assist..."
|
|
36
|
+
</bad_example>
|
|
24
37
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
38
|
+
<guidance>
|
|
39
|
+
<should>Use only information from form fields</should>
|
|
40
|
+
<should>State solution directly and completely</should>
|
|
41
|
+
<should>Include all necessary steps</should>
|
|
42
|
+
<should>Maintain professional, instructional tone</should>
|
|
43
|
+
</guidance>
|
|
30
44
|
</action>
|
|
31
45
|
</actions>
|
|
32
46
|
</rule>
|
|
47
|
+
<rule>
|
|
48
|
+
<name>Low Confidence Response</name>
|
|
49
|
+
<conditions>
|
|
50
|
+
<or>
|
|
51
|
+
<condition>Problem description is unclear/ambiguous</condition>
|
|
52
|
+
<condition>Authoritative information is missing</condition>
|
|
53
|
+
<condition>Solution would require additional details</condition>
|
|
54
|
+
<condition>Cannot provide complete confidence in solution</condition>
|
|
55
|
+
</or>
|
|
56
|
+
</conditions>
|
|
57
|
+
<actions>
|
|
58
|
+
<action>
|
|
59
|
+
Provide single-sentence explanation focusing on specific information gap.
|
|
60
|
+
|
|
61
|
+
<good_example>
|
|
62
|
+
"The information sources don't cover [specific detail[s]]"
|
|
63
|
+
</good_example>
|
|
64
|
+
|
|
65
|
+
<bad_example>
|
|
66
|
+
"I'm not entirely sure about this, but here are some possibilities... Could you provide more details about [X]? Have you tried [Y]? It might also help if..."
|
|
67
|
+
</bad_example>
|
|
68
|
+
|
|
69
|
+
<guidance>
|
|
70
|
+
<should>State only the primary information gap</should>
|
|
71
|
+
<should>Keep explanation BRIEF and specific</should>
|
|
72
|
+
<should>Focus on what's missing, not what's known</should>
|
|
73
|
+
</guidance>
|
|
74
|
+
</action>
|
|
75
|
+
</actions>
|
|
76
|
+
</rule>
|
|
77
|
+
<global_prohibitions>
|
|
78
|
+
<never>Ask questions or request clarification</never>
|
|
79
|
+
<never>Use conditional phrases ("would you like", "do you need")</never>
|
|
80
|
+
<never>Suggest contacting support</never>
|
|
81
|
+
<never>Provide partial or uncertain solutions</never>
|
|
82
|
+
<never>Offer multiple possible solutions</never>
|
|
83
|
+
<never>Speculate beyond available information</never>
|
|
84
|
+
</global_prohibitions>
|
|
33
85
|
</guidance>
|
|
34
86
|
`
|
|
35
87
|
},
|
|
36
88
|
{
|
|
37
89
|
id: `${Date.now()}2`,
|
|
38
90
|
role: "user",
|
|
39
|
-
content: `${
|
|
91
|
+
content: `${e}`
|
|
40
92
|
}
|
|
41
93
|
];
|
|
42
94
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/cxkit-primitives",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20250410174124",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "Inkeep, Inc. Customer License (IICL) v1.1",
|
|
6
6
|
"homepage": "",
|
|
@@ -59,9 +59,9 @@
|
|
|
59
59
|
"remark-gfm": "^4.0.1",
|
|
60
60
|
"unist-util-visit": "^5.0.0",
|
|
61
61
|
"use-sync-external-store": "^1.4.0",
|
|
62
|
-
"@inkeep/cxkit-color-mode": "0.0.0-dev-
|
|
63
|
-
"@inkeep/cxkit-theme": "0.0.0-dev-
|
|
64
|
-
"@inkeep/cxkit-types": "0.0.0-dev-
|
|
62
|
+
"@inkeep/cxkit-color-mode": "0.0.0-dev-20250410174124",
|
|
63
|
+
"@inkeep/cxkit-theme": "0.0.0-dev-20250410174124",
|
|
64
|
+
"@inkeep/cxkit-types": "0.0.0-dev-20250410174124"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@biomejs/biome": "1.9.4",
|