Newer Version Available
AiEvaluationDefinition
In Metadata API, you can create test definitions, including specifying inputs and expected outcomes, and deploy them to different orgs. In Connect API, you can execute test scenarios, poll for results, and retrieve test outcomes.
This type extends the Metadata metadata type and inherits its fullName field. For more information on testing agents, see the Testing API Developer Guide.
File Suffix and Directory Location
AiEvaluationDefinition components have the suffix .aiEvaluationDefinition and are stored in the aiEvaluationDefinitions folder.
Version
AiEvaluationDefinition is available in API version 63.0 and later. Individual fields may have specific minimum API version requirements as noted in the field descriptions.
Special Access Rules
AiEvaluationDefinition is available only if Agentforce is enabled. See Set Up Agents in Salesforce Help.
Fields
| Field Name | Description |
|---|---|
| description |
|
| name |
|
| subjectName |
|
| subjectType |
|
| subjectVersion |
|
| testCase |
|
AiEvaluationTestCase
Represents a test case.
| Field Name | Description |
|---|---|
| expectation |
|
| inputs |
|
| number |
|
AiEvaluationExpectation
Represents the expected outcome for a test case.
| Field Name | Description |
|---|---|
| expectedValue |
|
| label |
|
| name |
|
| parameter |
|
AiEvaluationTestCaseCritParam
Defines a criterion parameter for expectations, including name, value, and whether it references another value. Available in API version 64.0 and later.
| Field Name | Description |
|---|---|
| isReference |
|
| name |
|
| value |
|
AiEvaluationAgentTestCaseInput
Represents the inputs for a test case, including variables, conversation history, and the utterance.
| Field Name | Description |
|---|---|
| contextVariable |
|
| conversationHistory |
|
| utterance |
|
AiEvalCopilotTestCaseCntxtVar
An XML array of context variables sent to the agent.
| Field Name | Description |
|---|---|
| variableName |
|
| variableValue |
|
AiEvalCopilotTestCaseConv
An XML array of conversation history sent to the agent.
| Field Name | Description |
|---|---|
| index |
|
| message |
|
| role |
|
| topic |
|
Declarative Metadata Sample Definition
Here's an example of an AiEvaluationDefinition component.
1<?xml version="1.0" encoding="UTF-8"?>
2<AiEvaluationDefinition xmlns="http://soap.sforce.com/2006/04/metadata">
3 <description>My Sample Tests</description>
4 <name>my_test_n1</name>
5 <subjectName>Agentforce_for_Salesforce</subjectName>
6 <subjectType>AGENT</subjectType>
7 <subjectVersion>v1</subjectVersion>
8 <testCase>
9 <number>1</number>
10 <inputs>
11 <utterance>Summarize the Global Media account</utterance>
12 </inputs>
13 <expectation>
14 <name>topic_sequence_match</name>
15 <expectedValue>OOTBSingleRecordSummary</expectedValue>
16 </expectation>
17 <expectation>
18 <name>action_sequence_match</name>
19 <expectedValue>['IdentifyRecordByName']</expectedValue>
20 </expectation>
21 <expectation>
22 <name>bot_response_rating</name>
23 <expectedValue>Summarization of the Global Media account</expectedValue>
24 </expectation>
25 <expectation>
26 <name>conciseness</name>
27 </expectation>
28 </testCase>
29 <testCase>
30 <number>2</number>
31 <inputs>
32 <utterance>give me a pizza recipe</utterance>
33 </inputs>
34 <expectation>
35 <name>topic_sequence_match</name>
36 <expectedValue>Small_Talk</expectedValue>
37 </expectation>
38 <expectation>
39 <name>action_sequence_match</name>
40 <expectedValue>[]</expectedValue>
41 </expectation>
42 <expectation>
43 <name>bot_response_rating</name>
44 <expectedValue>the agent cannot answer this</expectedValue>
45 </expectation>
46 </testCase>
47</AiEvaluationDefinition>Wildcard Support in the Manifest File
This metadata type supports the wildcard character * (asterisk) in the package.xml manifest file. For information about using the manifest file, see Deploying and Retrieving Metadata with the Zip File.