@salesforce/agents
Version:
Client side APIs for working with Salesforce agents
32 lines (31 loc) • 1.93 kB
TypeScript
/**
* Known scorer names for the NGT (Agentforce Studio) test runner — used for IDE
* autocomplete and the per-scorer metadata in {@link NgtScorerCatalog}.
*
* The `(string & NonNullable<unknown>)` branch keeps this open: arbitrary names from a future Core
* release pass type-checks. Validation is non-strict on purpose — `validateNgtSpec`
* emits a lifecycle warning for unknown names, and Core's MD validator
* (`AITestingOOTBEvaluations.resolveByKeyOrName`) is the authoritative runtime gate.
*
* Update when Core ships a new OOTB scorer.
*
* Future direction: when `AiTestingDefinition` lands in `@salesforce/types`
* (currently only `AiEvaluationDefinition` is published; see forcedotcom/wsdl
* `src/metadata.ts`), the XML types should be swapped for generated ones. The
* scorer name list itself isn't enum-typed in the WSDL though, so this catalog
* stays the source of truth for the `needsExpected` and `grade` metadata even
* after that swap.
*/
export type NgtScorerName = KnownNgtScorerName | (string & NonNullable<unknown>);
/** The closed set used for catalog lookups and autocomplete. */
export type KnownNgtScorerName = 'topic_sequence_match' | 'action_sequence_match' | 'agent_handoff_match' | 'bot_response_rating' | 'response_match' | 'coherence' | 'conciseness' | 'factuality' | 'completeness' | 'task_resolution' | 'output_latency_milliseconds';
/** Grading scheme a scorer reports back. Used for downstream rendering / threshold logic. */
export type NgtScorerGrade = 'PASS_FAIL' | 'LLM_PASS_FAIL' | 'LLM_0_100' | 'LLM_0_5' | 'NUMERIC';
/** Catalog row describing a single scorer. */
export type NgtScorerEntry = {
needsExpected: boolean;
grade: NgtScorerGrade;
requiresConversationHistory?: true;
};
export declare const NgtScorerCatalog: Readonly<Record<KnownNgtScorerName, NgtScorerEntry>>;
export declare const isNgtScorerName: (s: string) => s is KnownNgtScorerName;