@salesforce/plugin-agent 1.10.0 → 1.11.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.
- package/README.md +136 -93
- package/lib/commands/agent/create-v2.d.ts +3 -7
- package/lib/commands/agent/create-v2.js +31 -75
- package/lib/commands/agent/create-v2.js.map +1 -1
- package/lib/commands/agent/generate/spec-v2.d.ts +64 -1
- package/lib/commands/agent/generate/spec-v2.js +170 -19
- package/lib/commands/agent/generate/spec-v2.js.map +1 -1
- package/lib/commands/agent/generate/{test-definition.d.ts → test-spec.d.ts} +1 -1
- package/lib/commands/agent/generate/{test-cases.js → test-spec.js} +50 -51
- package/lib/commands/agent/generate/test-spec.js.map +1 -0
- package/lib/commands/agent/test/create.d.ts +23 -0
- package/lib/commands/agent/test/create.js +95 -0
- package/lib/commands/agent/test/create.js.map +1 -0
- package/lib/flags.d.ts +1 -28
- package/lib/flags.js +3 -41
- package/lib/flags.js.map +1 -1
- package/messages/agent.create-v2.md +19 -25
- package/messages/agent.generate.spec-v2.md +89 -13
- package/messages/agent.generate.test-spec.md +11 -0
- package/messages/agent.test.create.md +27 -0
- package/messages/shared.md +0 -20
- package/npm-shrinkwrap.json +280 -266
- package/oclif.lock +64 -17
- package/oclif.manifest.json +164 -115
- package/package.json +8 -4
- package/schemas/agent-create__v2.json +129 -5
- package/schemas/agent-test-create.json +19 -0
- package/schemas/agent-test-results.json +14 -17
- package/lib/commands/agent/generate/test-cases.d.ts +0 -16
- package/lib/commands/agent/generate/test-cases.js.map +0 -1
- package/lib/commands/agent/generate/test-definition.js +0 -76
- package/lib/commands/agent/generate/test-definition.js.map +0 -1
- package/messages/agent.generate.test-cases.md +0 -11
- package/messages/agent.generate.test-definition.md +0 -13
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/plugin-agent",
|
|
3
3
|
"description": "Commands to interact with Salesforce agents",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.11.1",
|
|
5
5
|
"author": "Salesforce",
|
|
6
6
|
"bugs": "https://github.com/forcedotcom/cli/issues",
|
|
7
7
|
"dependencies": {
|
|
@@ -9,10 +9,11 @@
|
|
|
9
9
|
"@inquirer/prompts": "^7.2.0",
|
|
10
10
|
"@oclif/core": "^4",
|
|
11
11
|
"@oclif/multi-stage-output": "^0.7.12",
|
|
12
|
-
"@salesforce/agents": "^0.
|
|
12
|
+
"@salesforce/agents": "^0.9.2",
|
|
13
13
|
"@salesforce/core": "^8.8.0",
|
|
14
14
|
"@salesforce/kit": "^3.2.1",
|
|
15
15
|
"@salesforce/sf-plugins-core": "^12.1.0",
|
|
16
|
+
"@salesforce/source-deploy-retrieve": "^12.14.0",
|
|
16
17
|
"ansis": "^3.3.2",
|
|
17
18
|
"fast-xml-parser": "^4.5.1",
|
|
18
19
|
"ink": "^5.0.1",
|
|
@@ -77,6 +78,9 @@
|
|
|
77
78
|
},
|
|
78
79
|
"generate": {
|
|
79
80
|
"external": true
|
|
81
|
+
},
|
|
82
|
+
"create": {
|
|
83
|
+
"external": true
|
|
80
84
|
}
|
|
81
85
|
}
|
|
82
86
|
}
|
|
@@ -222,7 +226,7 @@
|
|
|
222
226
|
"exports": "./lib/index.js",
|
|
223
227
|
"type": "module",
|
|
224
228
|
"sfdx": {
|
|
225
|
-
"publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-agent/1.
|
|
226
|
-
"signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-agent/1.
|
|
229
|
+
"publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-agent/1.11.1.crt",
|
|
230
|
+
"signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-agent/1.11.1.sig"
|
|
227
231
|
}
|
|
228
232
|
}
|
|
@@ -4,18 +4,142 @@
|
|
|
4
4
|
"definitions": {
|
|
5
5
|
"AgentCreateResult": {
|
|
6
6
|
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
7
8
|
"properties": {
|
|
9
|
+
"previewFilePath": {
|
|
10
|
+
"type": "string"
|
|
11
|
+
},
|
|
8
12
|
"isSuccess": {
|
|
9
13
|
"type": "boolean"
|
|
10
14
|
},
|
|
11
15
|
"errorMessage": {
|
|
12
16
|
"type": "string"
|
|
17
|
+
},
|
|
18
|
+
"agentId": {
|
|
19
|
+
"type": "object",
|
|
20
|
+
"properties": {
|
|
21
|
+
"botId": {
|
|
22
|
+
"type": "string"
|
|
23
|
+
},
|
|
24
|
+
"botVersionId": {
|
|
25
|
+
"type": "string"
|
|
26
|
+
},
|
|
27
|
+
"plannerId": {
|
|
28
|
+
"type": "string"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"required": ["botId", "botVersionId", "plannerId"],
|
|
32
|
+
"additionalProperties": false,
|
|
33
|
+
"description": "If the agent was created with saveAgent=true, these are the IDs that make up an agent; Bot, BotVersion, and GenAiPlanner metadata."
|
|
34
|
+
},
|
|
35
|
+
"agentDefinition": {
|
|
36
|
+
"type": "object",
|
|
37
|
+
"properties": {
|
|
38
|
+
"agentDescription": {
|
|
39
|
+
"type": "string"
|
|
40
|
+
},
|
|
41
|
+
"topics": {
|
|
42
|
+
"type": "array",
|
|
43
|
+
"items": {
|
|
44
|
+
"type": "object",
|
|
45
|
+
"properties": {
|
|
46
|
+
"scope": {
|
|
47
|
+
"type": "string"
|
|
48
|
+
},
|
|
49
|
+
"topic": {
|
|
50
|
+
"type": "string"
|
|
51
|
+
},
|
|
52
|
+
"actions": {
|
|
53
|
+
"type": "array",
|
|
54
|
+
"items": {
|
|
55
|
+
"type": "object",
|
|
56
|
+
"properties": {
|
|
57
|
+
"actionName": {
|
|
58
|
+
"type": "string"
|
|
59
|
+
},
|
|
60
|
+
"exampleOutput": {
|
|
61
|
+
"type": "string"
|
|
62
|
+
},
|
|
63
|
+
"actionDescription": {
|
|
64
|
+
"type": "string"
|
|
65
|
+
},
|
|
66
|
+
"inputs": {
|
|
67
|
+
"type": "array",
|
|
68
|
+
"items": {
|
|
69
|
+
"type": "object",
|
|
70
|
+
"properties": {
|
|
71
|
+
"inputName": {
|
|
72
|
+
"type": "string"
|
|
73
|
+
},
|
|
74
|
+
"inputDataType": {
|
|
75
|
+
"type": "string"
|
|
76
|
+
},
|
|
77
|
+
"inputDescription": {
|
|
78
|
+
"type": "string"
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
"required": ["inputName", "inputDataType", "inputDescription"],
|
|
82
|
+
"additionalProperties": false
|
|
83
|
+
},
|
|
84
|
+
"minItems": 1,
|
|
85
|
+
"maxItems": 1
|
|
86
|
+
},
|
|
87
|
+
"outputs": {
|
|
88
|
+
"type": "array",
|
|
89
|
+
"items": {
|
|
90
|
+
"type": "object",
|
|
91
|
+
"properties": {
|
|
92
|
+
"outputName": {
|
|
93
|
+
"type": "string"
|
|
94
|
+
},
|
|
95
|
+
"outputDataType": {
|
|
96
|
+
"type": "string"
|
|
97
|
+
},
|
|
98
|
+
"outputDescription": {
|
|
99
|
+
"type": "string"
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
"required": ["outputName", "outputDataType", "outputDescription"],
|
|
103
|
+
"additionalProperties": false
|
|
104
|
+
},
|
|
105
|
+
"minItems": 1,
|
|
106
|
+
"maxItems": 1
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
"required": ["actionName", "exampleOutput", "actionDescription", "inputs", "outputs"],
|
|
110
|
+
"additionalProperties": false
|
|
111
|
+
},
|
|
112
|
+
"minItems": 1,
|
|
113
|
+
"maxItems": 1
|
|
114
|
+
},
|
|
115
|
+
"instructions": {
|
|
116
|
+
"type": "array",
|
|
117
|
+
"items": {
|
|
118
|
+
"type": "string"
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
"classificationDescription": {
|
|
122
|
+
"type": "string"
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
"required": ["scope", "topic", "actions", "instructions", "classificationDescription"],
|
|
126
|
+
"additionalProperties": false
|
|
127
|
+
},
|
|
128
|
+
"minItems": 1,
|
|
129
|
+
"maxItems": 1
|
|
130
|
+
},
|
|
131
|
+
"sampleUtterances": {
|
|
132
|
+
"type": "array",
|
|
133
|
+
"items": {
|
|
134
|
+
"type": "string"
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
"required": ["agentDescription", "topics", "sampleUtterances"],
|
|
139
|
+
"additionalProperties": false
|
|
13
140
|
}
|
|
14
141
|
},
|
|
15
|
-
"required": [
|
|
16
|
-
"isSuccess"
|
|
17
|
-
],
|
|
18
|
-
"additionalProperties": false
|
|
142
|
+
"required": ["agentDefinition", "isSuccess"]
|
|
19
143
|
}
|
|
20
144
|
}
|
|
21
|
-
}
|
|
145
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$ref": "#/definitions/AgentTestCreateResult",
|
|
4
|
+
"definitions": {
|
|
5
|
+
"AgentTestCreateResult": {
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"path": {
|
|
9
|
+
"type": "string"
|
|
10
|
+
},
|
|
11
|
+
"contents": {
|
|
12
|
+
"type": "string"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"required": ["path", "contents"],
|
|
16
|
+
"additionalProperties": false
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
},
|
|
46
46
|
"TestStatus": {
|
|
47
47
|
"type": "string",
|
|
48
|
-
"enum": ["
|
|
48
|
+
"enum": ["NEW", "IN_PROGRESS", "COMPLETED", "ERROR", "TERMINATED"]
|
|
49
49
|
},
|
|
50
50
|
"TestCaseResult": {
|
|
51
51
|
"type": "object",
|
|
@@ -53,22 +53,25 @@
|
|
|
53
53
|
"status": {
|
|
54
54
|
"$ref": "#/definitions/TestStatus"
|
|
55
55
|
},
|
|
56
|
-
"utterance": {
|
|
57
|
-
"type": "string"
|
|
58
|
-
},
|
|
59
56
|
"startTime": {
|
|
60
57
|
"type": "string"
|
|
61
58
|
},
|
|
62
59
|
"endTime": {
|
|
63
60
|
"type": "string"
|
|
64
61
|
},
|
|
62
|
+
"inputs": {
|
|
63
|
+
"type": "object",
|
|
64
|
+
"properties": {
|
|
65
|
+
"utterance": {
|
|
66
|
+
"type": "string"
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"required": ["utterance"],
|
|
70
|
+
"additionalProperties": false
|
|
71
|
+
},
|
|
65
72
|
"generatedData": {
|
|
66
73
|
"type": "object",
|
|
67
74
|
"properties": {
|
|
68
|
-
"type": {
|
|
69
|
-
"type": "string",
|
|
70
|
-
"const": "AGENT"
|
|
71
|
-
},
|
|
72
75
|
"actionsSequence": {
|
|
73
76
|
"type": "array",
|
|
74
77
|
"items": {
|
|
@@ -80,18 +83,12 @@
|
|
|
80
83
|
},
|
|
81
84
|
"topic": {
|
|
82
85
|
"type": "string"
|
|
83
|
-
},
|
|
84
|
-
"inputTokensCount": {
|
|
85
|
-
"type": "string"
|
|
86
|
-
},
|
|
87
|
-
"outputTokensCount": {
|
|
88
|
-
"type": "string"
|
|
89
86
|
}
|
|
90
87
|
},
|
|
91
|
-
"required": ["
|
|
88
|
+
"required": ["actionsSequence", "outcome", "topic"],
|
|
92
89
|
"additionalProperties": false
|
|
93
90
|
},
|
|
94
|
-
"
|
|
91
|
+
"testResults": {
|
|
95
92
|
"type": "array",
|
|
96
93
|
"items": {
|
|
97
94
|
"type": "object",
|
|
@@ -150,7 +147,7 @@
|
|
|
150
147
|
}
|
|
151
148
|
}
|
|
152
149
|
},
|
|
153
|
-
"required": ["status", "
|
|
150
|
+
"required": ["status", "startTime", "inputs", "generatedData", "testResults"],
|
|
154
151
|
"additionalProperties": false
|
|
155
152
|
}
|
|
156
153
|
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
-
export type TestSetInputs = {
|
|
3
|
-
utterance: string;
|
|
4
|
-
actionSequenceExpectedValue: string[];
|
|
5
|
-
botRatingExpectedValue: string;
|
|
6
|
-
topicSequenceExpectedValue: string;
|
|
7
|
-
};
|
|
8
|
-
export declare function constructTestSetXML(testCases: TestSetInputs[]): string;
|
|
9
|
-
export default class AgentGenerateTestCases extends SfCommand<void> {
|
|
10
|
-
static readonly summary: string;
|
|
11
|
-
static readonly description: string;
|
|
12
|
-
static readonly examples: string[];
|
|
13
|
-
static readonly enableJsonFlag = false;
|
|
14
|
-
static readonly state = "beta";
|
|
15
|
-
run(): Promise<void>;
|
|
16
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test-cases.js","sourceRoot":"","sources":["../../../../src/commands/agent/generate/test-cases.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,0BAA0B,EAAE,2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AK,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACvD,IAAI,CAAC,GAAG,EAAE,CAAC;QACX,IAAI,CAAC,GAAG,CAAC,WAAW,WAAW,EAAE,CAAC,CAAC;QACnC,MAAM,SAAS,CAAC,WAAW,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAC,CAAC;IAC/D,CAAC"}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2024, salesforce.com, inc.
|
|
3
|
-
* All rights reserved.
|
|
4
|
-
* Licensed under the BSD 3-Clause license.
|
|
5
|
-
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
6
|
-
*/
|
|
7
|
-
import { dirname, join } from 'node:path';
|
|
8
|
-
import { mkdir, writeFile } from 'node:fs/promises';
|
|
9
|
-
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
10
|
-
import { Messages, SfError } from '@salesforce/core';
|
|
11
|
-
import { input, select } from '@inquirer/prompts';
|
|
12
|
-
import { theme } from '../../../inquirer-theme.js';
|
|
13
|
-
import { readDir } from '../../../read-dir.js';
|
|
14
|
-
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
15
|
-
const messages = Messages.loadMessages('@salesforce/plugin-agent', 'agent.generate.test-definition');
|
|
16
|
-
export default class AgentGenerateTestDefinition extends SfCommand {
|
|
17
|
-
static summary = messages.getMessage('summary');
|
|
18
|
-
static description = messages.getMessage('description');
|
|
19
|
-
static examples = messages.getMessages('examples');
|
|
20
|
-
static enableJsonFlag = false;
|
|
21
|
-
static state = 'beta';
|
|
22
|
-
async run() {
|
|
23
|
-
const testSetDir = join('force-app', 'main', 'default', 'aiEvaluationTestSets');
|
|
24
|
-
const testSets = (await readDir(testSetDir)).map((testSet) => testSet.replace('.aiEvaluationTestSet-meta.xml', ''));
|
|
25
|
-
if (testSets.length === 0) {
|
|
26
|
-
throw new SfError(`No test sets found in ${testSetDir}`, 'NoTestSetsFoundError', [
|
|
27
|
-
'Run the "sf agent generate test-cases" command to create a test set',
|
|
28
|
-
]);
|
|
29
|
-
}
|
|
30
|
-
const botsDir = join('force-app', 'main', 'default', 'bots');
|
|
31
|
-
const bots = await readDir(botsDir);
|
|
32
|
-
if (bots.length === 0) {
|
|
33
|
-
throw new SfError(`No agents found in ${botsDir}`, 'NoAgentsFoundError');
|
|
34
|
-
}
|
|
35
|
-
const subjectType = await select({
|
|
36
|
-
message: 'What are you testing',
|
|
37
|
-
choices: ['AGENT'],
|
|
38
|
-
theme,
|
|
39
|
-
});
|
|
40
|
-
const agent = await select({
|
|
41
|
-
message: 'Select the Agent to test',
|
|
42
|
-
choices: bots,
|
|
43
|
-
theme,
|
|
44
|
-
});
|
|
45
|
-
const testSet = await select({
|
|
46
|
-
message: 'Select the test set to use',
|
|
47
|
-
choices: testSets,
|
|
48
|
-
theme,
|
|
49
|
-
});
|
|
50
|
-
const name = await input({
|
|
51
|
-
message: 'Enter a name for the test definition',
|
|
52
|
-
validate: (i) => (i.length > 0 ? true : 'Name cannot be empty'),
|
|
53
|
-
theme,
|
|
54
|
-
});
|
|
55
|
-
const description = await input({
|
|
56
|
-
message: 'Enter a description for test definition (optional)',
|
|
57
|
-
theme,
|
|
58
|
-
});
|
|
59
|
-
const xml = `<?xml version="1.0" encoding="UTF-8"?>
|
|
60
|
-
<AiEvaluationDefinition xmlns="http://soap.sforce.com/2006/04/metadata">
|
|
61
|
-
${description ? `<description>${description}</description>` : ''}
|
|
62
|
-
<name>${name}</name>
|
|
63
|
-
<subjectType>${subjectType}</subjectType>
|
|
64
|
-
<subjectName>${agent}</subjectName>
|
|
65
|
-
<testSetName>${testSet}</testSetName>
|
|
66
|
-
</AiEvaluationDefinition>`;
|
|
67
|
-
// remove all empty lines
|
|
68
|
-
const cleanedXml = xml.replace(/^\s*[\r\n]/gm, '');
|
|
69
|
-
const definitionPath = join('force-app', 'main', 'default', 'aiEvaluationDefinitions', `${name}.aiEvaluationDefinition-meta.xml`);
|
|
70
|
-
await mkdir(dirname(definitionPath), { recursive: true });
|
|
71
|
-
this.log();
|
|
72
|
-
this.log(`Created ${definitionPath}`);
|
|
73
|
-
await writeFile(definitionPath, cleanedXml);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
//# sourceMappingURL=test-definition.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test-definition.js","sourceRoot":"","sources":["../../../../src/commands/agent/generate/test-definition.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,0BAA0B,EAAE,gCAAgC,CAAC,CAAC;AAErG,MAAM,CAAC,OAAO,OAAO,2BAA4B,SAAQ,SAAe;IAC/D,MAAM,CAAU,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACzD,MAAM,CAAU,WAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACjE,MAAM,CAAU,QAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IAC5D,MAAM,CAAU,cAA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KAAK,CAAC;YACvB,OAAO,EAAE,sCAAsC;YAC/C,QAAQ,EAAE,CAAC,CAAS,EAAoB,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,sBAAsB,CAAC;YACzF,KAAK;SACN,CAAC,CAAC;QAEH,MAAM,WAAW,GAAG,MAAM,KAAK,CAAC;YAC9B,OAAO,EAAE,oDAAoD;YAC7D,KAAK;SACN,CAAC,CAAC;QAEH,MAAM,GAAG,GAAG;;MAEV,WAAW,CAAC,CAAC,CAAC,gBAAgB,WAAW,gBAAgB,CAAC,CAAC,CAAC,EAAE;YACxD,IAAI;mBACG,WAAW;mBACX,KAAK;mBACL,OAAO;0BACA,CAAC;QAEvB,yBAAyB;QACzB,MAAM,UAAU,GAAG,GAAG,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;QAEnD,MAAM,cAAc,GAAG,IAAI,CACzB,WAAW,EACX,MAAM,EACN,SAAS,EACT,yBAAyB,EACzB,GAAG,IAAI,kCAAkC,CAC1C,CAAC;QACF,MAAM,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC1D,IAAI,CAAC,GAAG,EAAE,CAAC;QACX,IAAI,CAAC,GAAG,CAAC,WAAW,cAAc,EAAE,CAAC,CAAC;QACtC,MAAM,SAAS,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;IAC9C,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
# summary
|
|
2
|
-
|
|
3
|
-
Interactively generate a new Set of AI Evaluation test cases.
|
|
4
|
-
|
|
5
|
-
# description
|
|
6
|
-
|
|
7
|
-
Answer the prompts to generate an AiEvaluationTestSet that will be written to a file. You can then run "sf agent generate definition" to generate the AiEvaluationDefinition that can be used to evaluate the test set.
|
|
8
|
-
|
|
9
|
-
# examples
|
|
10
|
-
|
|
11
|
-
- <%= config.bin %> <%= command.id %>
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# summary
|
|
2
|
-
|
|
3
|
-
Interactively generate a new AI Evaluation Test Definition.
|
|
4
|
-
|
|
5
|
-
# description
|
|
6
|
-
|
|
7
|
-
This command will prompt you for the necessary information to create a new AiEvaluationDefinition. The definition will be saved to the `aiEvaluationDefinitions` directory in the project.
|
|
8
|
-
|
|
9
|
-
You must have the `Bots` and `AiEvaluationTestSets` metadata types present in your project to use this command.
|
|
10
|
-
|
|
11
|
-
# examples
|
|
12
|
-
|
|
13
|
-
- <%= config.bin %> <%= command.id %>
|