Skip to content

@awssolutions/gen-ai-evaluation-toolkit-ts-client


@awssolutions/gen-ai-evaluation-toolkit-ts-client / CreateTestCaseCommand

Class: CreateTestCaseCommand

Creates a new test case

Example

Use a bare-bones client and the command you need to make an API call.

import { GenAiEvaluationToolkitClient, CreateTestCaseCommand } from "@awssolutions/gen-ai-evaluation-toolkit-ts-client"; // ES Modules import
// const { GenAiEvaluationToolkitClient, CreateTestCaseCommand } = require("@awssolutions/gen-ai-evaluation-toolkit-ts-client"); // CommonJS import
// import type { GenAiEvaluationToolkitClientConfig } from "@awssolutions/gen-ai-evaluation-toolkit-ts-client";
const config = {}; // type is GenAiEvaluationToolkitClientConfig
const client = new GenAiEvaluationToolkitClient(config);
const input = { // CreateTestCaseRequest
  datasetId: "STRING_VALUE", // required
  input: "DOCUMENT_VALUE",
  expected: "DOCUMENT_VALUE",
  context: "DOCUMENT_VALUE",
  metadata: "DOCUMENT_VALUE",
};
const command = new CreateTestCaseCommand(input);
const response = await client.send(command);
// { // TestCase
//   input: "DOCUMENT_VALUE",
//   expected: "DOCUMENT_VALUE",
//   context: "DOCUMENT_VALUE",
//   metadata: "DOCUMENT_VALUE",
//   testCaseId: "STRING_VALUE", // required
//   createdBy: "STRING_VALUE",
//   createdAt: new Date("TIMESTAMP"),
//   annotations: [ // Annotations
//     { // Annotation
//       name: "STRING_VALUE", // required
//       value: { // AnnotationValue Union: only one key present
//         stringValue: "STRING_VALUE",
//         numericValue: Number("double"),
//       },
//       comment: "STRING_VALUE",
//       annotatedBy: "STRING_VALUE", // required
//       annotatedAt: new Date("TIMESTAMP"), // required
//     },
//   ],
// };

Param

CreateTestCaseCommandInput

See

Throws

ValidationException (client fault) A standard error for input validation failures. This should be thrown by services when a member of the input structure falls outside of the modeled or documented constraints.

Throws

UnauthorizedException (client fault) UnauthorizedException is thrown when request is missing or has bad auth

Throws

ThrottlingException (client fault) ThrottlingException is thrown when request was denied due to request throttling

Throws

InternalServerException (server fault) InternalServerException is thrown when unexpected error occurs during processing of request

Throws

ResourceNotFoundException (client fault) ResourceNotFoundException is thrown when request references a resource which does not exist

Throws

GenAiEvaluationToolkitServiceException

Base exception class for all service exceptions from GenAiEvaluationToolkit service.

Extends

Constructors

Constructor

new CreateTestCaseCommand(input): CreateTestCaseCommand

Parameters

input

CreateTestCaseCommandInput

Returns

CreateTestCaseCommand

Inherited from

$Command .classBuilder< CreateTestCaseCommandInput, CreateTestCaseCommandOutput, GenAiEvaluationToolkitClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes >() .ep(commonParams) .m(function (this: any, Command: any, cs: any, config: GenAiEvaluationToolkitClientResolvedConfig, o: any) { return [getEndpointPlugin(config, Command.getEndpointParameterInstructions())]; }) .s("GenAiEtk", "CreateTestCase", {}) .n("GenAiEvaluationToolkitClient", "CreateTestCaseCommand") .sc(CreateTestCase$) .build().constructor

Constructor

new CreateTestCaseCommand(...__namedParameters): CreateTestCaseCommand

Parameters

__namedParameters

...[CreateTestCaseCommandInput]

Returns

CreateTestCaseCommand

Inherited from

$Command .classBuilder< CreateTestCaseCommandInput, CreateTestCaseCommandOutput, GenAiEvaluationToolkitClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes >() .ep(commonParams) .m(function (this: any, Command: any, cs: any, config: GenAiEvaluationToolkitClientResolvedConfig, o: any) { return [getEndpointPlugin(config, Command.getEndpointParameterInstructions())]; }) .s("GenAiEtk", "CreateTestCase", {}) .n("GenAiEvaluationToolkitClient", "CreateTestCaseCommand") .sc(CreateTestCase$) .build().constructor