Skip to content

Commit 1de7e90

Browse files
authored
feat: improvements to generate testset|definition
1 parent 48500a6 commit 1de7e90

25 files changed

Lines changed: 674 additions & 1066 deletions

README.md

Lines changed: 50 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,22 @@ sf plugins
6161

6262
<!-- commands -->
6363

64-
- [`sf agent create`](#sf-agent-create)
65-
- [`sf agent generate definition`](#sf-agent-generate-definition)
66-
- [`sf agent generate spec`](#sf-agent-generate-spec)
67-
- [`sf agent generate spec-v2`](#sf-agent-generate-spec-v2)
68-
- [`sf agent generate testset`](#sf-agent-generate-testset)
69-
- [`sf agent preview`](#sf-agent-preview)
70-
- [`sf agent test cancel`](#sf-agent-test-cancel)
71-
- [`sf agent test results`](#sf-agent-test-results)
72-
- [`sf agent test resume`](#sf-agent-test-resume)
73-
- [`sf agent test run`](#sf-agent-test-run)
64+
- [plugin-agent - PREVIEW](#plugin-agent---preview)
65+
- [THIS PLUGIN IS A PREVIEW VERSION AND IS NOT MEANT FOR PRODUCTION USAGE UNTIL ANNOUNCED.](#this-plugin-is-a-preview-version-and-is-not-meant-for-production-usage-until-announced)
66+
- [Install](#install)
67+
- [Contributing](#contributing)
68+
- [CLA](#cla)
69+
- [Build](#build)
70+
- [Commands](#commands)
71+
- [`sf agent create`](#sf-agent-create)
72+
- [`sf agent generate spec`](#sf-agent-generate-spec)
73+
- [`sf agent generate test-cases`](#sf-agent-generate-test-cases)
74+
- [`sf agent generate test-definition`](#sf-agent-generate-test-definition)
75+
- [`sf agent preview`](#sf-agent-preview)
76+
- [`sf agent test cancel`](#sf-agent-test-cancel)
77+
- [`sf agent test results`](#sf-agent-test-results)
78+
- [`sf agent test resume`](#sf-agent-test-resume)
79+
- [`sf agent test run`](#sf-agent-test-run)
7480

7581
## `sf agent create`
7682

@@ -112,32 +118,7 @@ EXAMPLES
112118
$ sf agent create --name CustomerSupportAgent --spec ./config/agentSpec.json --target-org my-org
113119
```
114120

115-
_See code: [src/commands/agent/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.8.0/src/commands/agent/create.ts)_
116-
117-
## `sf agent generate definition`
118-
119-
Interactively generate a new AiEvaluationDefinition.
120-
121-
```
122-
USAGE
123-
$ sf agent generate definition [--flags-dir <value>]
124-
125-
GLOBAL FLAGS
126-
--flags-dir=<value> Import flag values from a directory.
127-
128-
DESCRIPTION
129-
Interactively generate a new AiEvaluationDefinition.
130-
131-
This command will prompt you for the necessary information to create a new AiEvaluationDefinition. The definition will
132-
be saved to the `aiEvaluationDefinitions` directory in the project.
133-
134-
You must have the `Bots` and `AiEvaluationTestSets` metadata types present in your project to use this command.
135-
136-
EXAMPLES
137-
$ sf agent generate definition
138-
```
139-
140-
_See code: [src/commands/agent/generate/definition.ts](https://github.com/salesforcecli/plugin-agent/blob/1.8.0/src/commands/agent/generate/definition.ts)_
121+
_See code: [src/commands/agent/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.7.3-dev.5/src/commands/agent/create.ts)_
141122

142123
## `sf agent generate spec`
143124

@@ -198,94 +179,55 @@ EXAMPLES
198179
$ sf agent generate spec --output-dir specs --target-org my-org
199180
```
200181

201-
_See code: [src/commands/agent/generate/spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.8.0/src/commands/agent/generate/spec.ts)_
182+
_See code: [src/commands/agent/generate/spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.7.3-dev.5/src/commands/agent/generate/spec.ts)_
202183

203-
## `sf agent generate spec-v2`
184+
## `sf agent generate test-cases`
204185

205-
Generate an agent spec, which is the list of jobs that the agent performs.
186+
Interactively generate a new Set of AI Evaluation test cases.
206187

207188
```
208189
USAGE
209-
$ sf agent generate spec-v2 -o <value> [--json] [--flags-dir <value>] [--api-version <value>] [-t customer|internal]
210-
[--role <value>] [--company-name <value>] [--company-description <value>] [--company-website <value>] [--spec
211-
<value>] [--output-file <value>] [--max-topics <value>] [--grounding-context <value> --prompt-template <value>]
212-
213-
FLAGS
214-
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
215-
configuration variable is already set.
216-
-t, --type=<option> Type of agent to create.
217-
<options: customer|internal>
218-
--api-version=<value> Override the api version used for api requests made by this command
219-
--company-description=<value> Description of your company.
220-
--company-name=<value> Name of your company.
221-
--company-website=<value> Website URL of your company.
222-
--grounding-context=<value> Context information to be used with the customized prompt template.
223-
--max-topics=<value> Maximum number of agent job topics to generate in the spec; default is 10.
224-
--output-file=<value> [default: config/agentSpec.yaml] Path for the generated agent spec file (yaml); can
225-
be an absolute or relative path.
226-
--prompt-template=<value> Developer name of a customized prompt template to use instead of the default.
227-
--role=<value> Role of the agent.
228-
--spec=<value> Spec file (yaml) to use as input to the command.
190+
$ sf agent generate test-cases [--flags-dir <value>]
229191
230192
GLOBAL FLAGS
231193
--flags-dir=<value> Import flag values from a directory.
232-
--json Format output as json.
233194
234195
DESCRIPTION
235-
Generate an agent spec, which is the list of jobs that the agent performs.
196+
Interactively generate a new Set of AI Evaluation test cases.
236197
237-
When using Salesforce CLI to create an agent in your org, you can choose to generate a YAML-formatted agent spec file
238-
with this command as a first step.
239-
240-
An agent spec is a list of jobs and descriptions that capture what the agent can do. Use flags such as --role and
241-
--company-description to provide details about your company and the role that the agent plays in your company; you can
242-
also enter the information interactively if you prefer. When you then execute this command, the large language model
243-
(LLM) associated with your org uses the information to generate the list of jobs that the agent most likely performs.
244-
We recommend that you provide good details for --role, --company-description, etc, so that the LLM can generate the
245-
best and most relevant list of jobs and descriptions. Once generated, you can edit the spec file; for example, you can
246-
remove jobs that don't apply to your agent.
247-
248-
When your agent spec is ready, you then create the agent in your org by specifying the agent spec file to the
249-
--job-spec flag of the "agent create" CLI command.
198+
Answer the prompts to generate an AiEvaluationTestSet that will be written to a file. You can then run "sf agent
199+
generate definition" to generate the AiEvaluationDefinition that can be used to evaluate the test set.
250200
251201
EXAMPLES
252-
Create an agent spec for your default org in the default location and use flags to specify the agent's role and your
253-
company details:
254-
255-
$ sf agent generate spec-v2 --type customer --role "Assist users in navigating and managing bookings" \
256-
--company-name "Coral Cloud" --company-description "Resort that manages guests and their reservations and \
257-
experiences"
258-
259-
Create an agent spec by being prompted for role and company details interactively; write the generated file to the
260-
"specs" directory and use the org with alias "my-org":
261-
262-
$ sf agent generate spec-v2 --output-dir specs --target-org my-org
202+
$ sf agent generate test-cases
263203
```
264204

265-
_See code: [src/commands/agent/generate/spec-v2.ts](https://github.com/salesforcecli/plugin-agent/blob/1.8.0/src/commands/agent/generate/spec-v2.ts)_
205+
_See code: [src/commands/agent/generate/test-cases.ts](https://github.com/salesforcecli/plugin-agent/blob/1.7.3-dev.5/src/commands/agent/generate/test-cases.ts)_
266206

267-
## `sf agent generate testset`
207+
## `sf agent generate test-definition`
268208

269-
Interactively generate an AiEvaluationTestSet.
209+
Interactively generate a new AI Evaluation Test Definition.
270210

271211
```
272212
USAGE
273-
$ sf agent generate testset [--flags-dir <value>]
213+
$ sf agent generate test-definition [--flags-dir <value>]
274214
275215
GLOBAL FLAGS
276216
--flags-dir=<value> Import flag values from a directory.
277217
278218
DESCRIPTION
279-
Interactively generate an AiEvaluationTestSet.
219+
Interactively generate a new AI Evaluation Test Definition.
280220
281-
Answer the prompts to generate an AiEvaluationTestSet that will be written to a file. You can then run "sf agent
282-
generate definition" to generate the AiEvaluationDefinition that can be used to evaluate the test set.
221+
This command will prompt you for the necessary information to create a new AiEvaluationDefinition. The definition will
222+
be saved to the `aiEvaluationDefinitions` directory in the project.
223+
224+
You must have the `Bots` and `AiEvaluationTestSets` metadata types present in your project to use this command.
283225
284226
EXAMPLES
285-
$ sf agent generate testset
227+
$ sf agent generate test-definition
286228
```
287229

288-
_See code: [src/commands/agent/generate/testset.ts](https://github.com/salesforcecli/plugin-agent/blob/1.8.0/src/commands/agent/generate/testset.ts)_
230+
_See code: [src/commands/agent/generate/test-definition.ts](https://github.com/salesforcecli/plugin-agent/blob/1.7.3-dev.5/src/commands/agent/generate/test-definition.ts)_
289231

290232
## `sf agent preview`
291233

@@ -320,7 +262,7 @@ FLAG DESCRIPTIONS
320262
the API name of the agent? (TBD based on agents library)
321263
```
322264

323-
_See code: [src/commands/agent/preview.ts](https://github.com/salesforcecli/plugin-agent/blob/1.8.0/src/commands/agent/preview.ts)_
265+
_See code: [src/commands/agent/preview.ts](https://github.com/salesforcecli/plugin-agent/blob/1.7.3-dev.5/src/commands/agent/preview.ts)_
324266

325267
## `sf agent test cancel`
326268

@@ -357,7 +299,7 @@ EXAMPLES
357299
$ sf agent test cancel --job-id 4KBfake0000003F4AQ --target-org my-org
358300
```
359301

360-
_See code: [src/commands/agent/test/cancel.ts](https://github.com/salesforcecli/plugin-agent/blob/1.8.0/src/commands/agent/test/cancel.ts)_
302+
_See code: [src/commands/agent/test/cancel.ts](https://github.com/salesforcecli/plugin-agent/blob/1.7.3-dev.5/src/commands/agent/test/cancel.ts)_
361303

362304
## `sf agent test results`
363305

@@ -366,10 +308,10 @@ Get the results of a completed agent test run.
366308
```
367309
USAGE
368310
$ sf agent test results -o <value> -i <value> [--json] [--flags-dir <value>] [--api-version <value>] [--result-format
369-
json|human|junit|tap] [-f <value>]
311+
json|human|junit|tap] [-d <value>]
370312
371313
FLAGS
372-
-f, --output-dir=<value> Directory to write the agent test results into.
314+
-d, --output-dir=<value> Directory to write the agent test results into.
373315
-i, --job-id=<value> (required) Job ID of the completed agent test run.
374316
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
375317
configuration variable is already set.
@@ -407,13 +349,13 @@ EXAMPLES
407349
$ sf agent test results --use-most-recent --output-dir ./test-results --result-format json
408350
409351
FLAG DESCRIPTIONS
410-
-f, --output-dir=<value> Directory to write the agent test results into.
352+
-d, --output-dir=<value> Directory to write the agent test results into.
411353
412354
If the agent test run completes, write the results to the specified directory. If the test is still running, the
413355
test results aren't written.
414356
```
415357

416-
_See code: [src/commands/agent/test/results.ts](https://github.com/salesforcecli/plugin-agent/blob/1.8.0/src/commands/agent/test/results.ts)_
358+
_See code: [src/commands/agent/test/results.ts](https://github.com/salesforcecli/plugin-agent/blob/1.7.3-dev.5/src/commands/agent/test/results.ts)_
417359

418360
## `sf agent test resume`
419361

@@ -422,10 +364,10 @@ Resume an agent test that you previously started in your org so you can view the
422364
```
423365
USAGE
424366
$ sf agent test resume -o <value> [--json] [--flags-dir <value>] [--api-version <value>] [-i <value>] [-r] [-w
425-
<value>] [--result-format json|human|junit|tap] [-f <value>]
367+
<value>] [--result-format json|human|junit|tap] [-d <value>]
426368
427369
FLAGS
428-
-f, --output-dir=<value> Directory to write the agent test results into.
370+
-d, --output-dir=<value> Directory to write the agent test results into.
429371
-i, --job-id=<value> Job ID of the original agent test run.
430372
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
431373
configuration variable is already set.
@@ -470,13 +412,13 @@ EXAMPLES
470412
$ sf agent test resume --use-most-recent --output-dir ./test-results --result-format json
471413
472414
FLAG DESCRIPTIONS
473-
-f, --output-dir=<value> Directory to write the agent test results into.
415+
-d, --output-dir=<value> Directory to write the agent test results into.
474416
475417
If the agent test run completes, write the results to the specified directory. If the test is still running, the
476418
test results aren't written.
477419
```
478420

479-
_See code: [src/commands/agent/test/resume.ts](https://github.com/salesforcecli/plugin-agent/blob/1.8.0/src/commands/agent/test/resume.ts)_
421+
_See code: [src/commands/agent/test/resume.ts](https://github.com/salesforcecli/plugin-agent/blob/1.7.3-dev.5/src/commands/agent/test/resume.ts)_
480422

481423
## `sf agent test run`
482424

@@ -485,10 +427,10 @@ Start an agent test in your org.
485427
```
486428
USAGE
487429
$ sf agent test run -o <value> -n <value> [--json] [--flags-dir <value>] [--api-version <value>] [-w <value>]
488-
[--result-format json|human|junit|tap] [-f <value>]
430+
[--result-format json|human|junit|tap] [-d <value>]
489431
490432
FLAGS
491-
-f, --output-dir=<value> Directory to write the agent test results into.
433+
-d, --output-dir=<value> Directory to write the agent test results into.
492434
-n, --name=<value> (required) Name of the agent test to start.
493435
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
494436
configuration variable is already set.
@@ -533,12 +475,12 @@ EXAMPLES
533475
$ sf agent test run --name MyAgentTest --wait 10 --output-dir ./test-results --result-format json
534476
535477
FLAG DESCRIPTIONS
536-
-f, --output-dir=<value> Directory to write the agent test results into.
478+
-d, --output-dir=<value> Directory to write the agent test results into.
537479
538480
If the agent test run completes, write the results to the specified directory. If the test is still running, the
539481
test results aren't written.
540482
```
541483

542-
_See code: [src/commands/agent/test/run.ts](https://github.com/salesforcecli/plugin-agent/blob/1.8.0/src/commands/agent/test/run.ts)_
484+
_See code: [src/commands/agent/test/run.ts](https://github.com/salesforcecli/plugin-agent/blob/1.7.3-dev.5/src/commands/agent/test/run.ts)_
543485

544486
<!-- commandsstop -->

command-snapshot.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,6 @@
77
"flags": ["api-version", "flags-dir", "json", "name", "spec", "target-org"],
88
"plugin": "@salesforce/plugin-agent"
99
},
10-
{
11-
"alias": [],
12-
"command": "agent:generate:definition",
13-
"flagAliases": [],
14-
"flagChars": [],
15-
"flags": ["flags-dir"],
16-
"plugin": "@salesforce/plugin-agent"
17-
},
1810
{
1911
"alias": [],
2012
"command": "agent:generate:spec",
@@ -60,7 +52,15 @@
6052
},
6153
{
6254
"alias": [],
63-
"command": "agent:generate:testset",
55+
"command": "agent:generate:test-cases",
56+
"flagAliases": [],
57+
"flagChars": [],
58+
"flags": ["flags-dir"],
59+
"plugin": "@salesforce/plugin-agent"
60+
},
61+
{
62+
"alias": [],
63+
"command": "agent:generate:test-definition",
6464
"flagAliases": [],
6565
"flagChars": [],
6666
"flags": ["flags-dir"],
@@ -86,15 +86,15 @@
8686
"alias": [],
8787
"command": "agent:test:results",
8888
"flagAliases": [],
89-
"flagChars": ["f", "i", "o"],
89+
"flagChars": ["d", "i", "o"],
9090
"flags": ["api-version", "flags-dir", "job-id", "json", "output-dir", "result-format", "target-org"],
9191
"plugin": "@salesforce/plugin-agent"
9292
},
9393
{
9494
"alias": [],
9595
"command": "agent:test:resume",
9696
"flagAliases": [],
97-
"flagChars": ["f", "i", "o", "r", "w"],
97+
"flagChars": ["d", "i", "o", "r", "w"],
9898
"flags": [
9999
"api-version",
100100
"flags-dir",
@@ -112,7 +112,7 @@
112112
"alias": [],
113113
"command": "agent:test:run",
114114
"flagAliases": [],
115-
"flagChars": ["f", "n", "o", "w"],
115+
"flagChars": ["d", "n", "o", "w"],
116116
"flags": ["api-version", "flags-dir", "json", "name", "output-dir", "result-format", "target-org", "wait"],
117117
"plugin": "@salesforce/plugin-agent"
118118
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# summary
22

3-
Interactively generate an AiEvaluationTestSet.
3+
Interactively generate a new Set of AI Evaluation test cases.
44

55
# description
66

messages/agent.generate.definition.md renamed to messages/agent.generate.test-definition.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# summary
22

3-
Interactively generate a new AiEvaluationDefinition.
3+
Interactively generate a new AI Evaluation Test Definition.
44

55
# description
66

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,16 @@
55
"author": "Salesforce",
66
"bugs": "https://github.com/forcedotcom/cli/issues",
77
"dependencies": {
8-
"@inquirer/confirm": "^5.1.0",
98
"@inquirer/figures": "^1.0.7",
10-
"@inquirer/input": "^4.0.1",
11-
"@inquirer/select": "^4.0.1",
9+
"@inquirer/prompts": "^7.2.0",
1210
"@oclif/core": "^4",
1311
"@oclif/multi-stage-output": "^0.7.12",
14-
"@salesforce/agents": "^0.6.0",
12+
"@salesforce/agents": "^0.7.0",
1513
"@salesforce/core": "^8.8.0",
1614
"@salesforce/kit": "^3.2.1",
1715
"@salesforce/sf-plugins-core": "^12.1.0",
1816
"ansis": "^3.3.2",
17+
"fast-xml-parser": "^4.5.1",
1918
"ink": "^5.0.1",
2019
"ink-text-input": "^6.0.0",
2120
"react": "^18.3.1",

0 commit comments

Comments
 (0)