|
| 1 | +// smithy-typescript generated code |
| 2 | +import { getEndpointPlugin } from "@smithy/middleware-endpoint"; |
| 3 | +import { Command as $Command } from "@smithy/smithy-client"; |
| 4 | +import { MetadataBearer as __MetadataBearer } from "@smithy/types"; |
| 5 | + |
| 6 | +import { BedrockAgentCoreClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../BedrockAgentCoreClient"; |
| 7 | +import { commonParams } from "../endpoint/EndpointParameters"; |
| 8 | +import { EvaluateRequest, EvaluateResponse } from "../models/models_0"; |
| 9 | +import { Evaluate } from "../schemas/schemas_0"; |
| 10 | + |
| 11 | +/** |
| 12 | + * @public |
| 13 | + */ |
| 14 | +export type { __MetadataBearer }; |
| 15 | +export { $Command }; |
| 16 | +/** |
| 17 | + * @public |
| 18 | + * |
| 19 | + * The input for {@link EvaluateCommand}. |
| 20 | + */ |
| 21 | +export interface EvaluateCommandInput extends EvaluateRequest {} |
| 22 | +/** |
| 23 | + * @public |
| 24 | + * |
| 25 | + * The output of {@link EvaluateCommand}. |
| 26 | + */ |
| 27 | +export interface EvaluateCommandOutput extends EvaluateResponse, __MetadataBearer {} |
| 28 | + |
| 29 | +/** |
| 30 | + * <p> Performs on-demand evaluation of agent traces using a specified evaluator. This synchronous API accepts traces in OpenTelemetry format and returns immediate scoring results with detailed explanations.</p> |
| 31 | + * @example |
| 32 | + * Use a bare-bones client and the command you need to make an API call. |
| 33 | + * ```javascript |
| 34 | + * import { BedrockAgentCoreClient, EvaluateCommand } from "@aws-sdk/client-bedrock-agentcore"; // ES Modules import |
| 35 | + * // const { BedrockAgentCoreClient, EvaluateCommand } = require("@aws-sdk/client-bedrock-agentcore"); // CommonJS import |
| 36 | + * // import type { BedrockAgentCoreClientConfig } from "@aws-sdk/client-bedrock-agentcore"; |
| 37 | + * const config = {}; // type is BedrockAgentCoreClientConfig |
| 38 | + * const client = new BedrockAgentCoreClient(config); |
| 39 | + * const input = { // EvaluateRequest |
| 40 | + * evaluatorId: "STRING_VALUE", // required |
| 41 | + * evaluationInput: { // EvaluationInput Union: only one key present |
| 42 | + * sessionSpans: [ // Spans |
| 43 | + * "DOCUMENT_VALUE", |
| 44 | + * ], |
| 45 | + * }, |
| 46 | + * evaluationTarget: { // EvaluationTarget Union: only one key present |
| 47 | + * spanIds: [ // SpanIds |
| 48 | + * "STRING_VALUE", |
| 49 | + * ], |
| 50 | + * traceIds: [ // TraceIds |
| 51 | + * "STRING_VALUE", |
| 52 | + * ], |
| 53 | + * }, |
| 54 | + * }; |
| 55 | + * const command = new EvaluateCommand(input); |
| 56 | + * const response = await client.send(command); |
| 57 | + * // { // EvaluateResponse |
| 58 | + * // evaluationResults: [ // EvaluationResults // required |
| 59 | + * // { // EvaluationResultContent |
| 60 | + * // evaluatorArn: "STRING_VALUE", // required |
| 61 | + * // evaluatorId: "STRING_VALUE", // required |
| 62 | + * // evaluatorName: "STRING_VALUE", // required |
| 63 | + * // explanation: "STRING_VALUE", |
| 64 | + * // context: { // Context Union: only one key present |
| 65 | + * // spanContext: { // SpanContext |
| 66 | + * // sessionId: "STRING_VALUE", // required |
| 67 | + * // traceId: "STRING_VALUE", |
| 68 | + * // spanId: "STRING_VALUE", |
| 69 | + * // }, |
| 70 | + * // }, |
| 71 | + * // value: Number("double"), |
| 72 | + * // label: "STRING_VALUE", |
| 73 | + * // tokenUsage: { // TokenUsage |
| 74 | + * // inputTokens: Number("int"), |
| 75 | + * // outputTokens: Number("int"), |
| 76 | + * // totalTokens: Number("int"), |
| 77 | + * // }, |
| 78 | + * // errorMessage: "STRING_VALUE", |
| 79 | + * // errorCode: "STRING_VALUE", |
| 80 | + * // }, |
| 81 | + * // ], |
| 82 | + * // }; |
| 83 | + * |
| 84 | + * ``` |
| 85 | + * |
| 86 | + * @param EvaluateCommandInput - {@link EvaluateCommandInput} |
| 87 | + * @returns {@link EvaluateCommandOutput} |
| 88 | + * @see {@link EvaluateCommandInput} for command's `input` shape. |
| 89 | + * @see {@link EvaluateCommandOutput} for command's `response` shape. |
| 90 | + * @see {@link BedrockAgentCoreClientResolvedConfig | config} for BedrockAgentCoreClient's `config` shape. |
| 91 | + * |
| 92 | + * @throws {@link AccessDeniedException} (client fault) |
| 93 | + * <p>The exception that occurs when you do not have sufficient permissions to perform an action. Verify that your IAM policy includes the necessary permissions for the operation you are trying to perform.</p> |
| 94 | + * |
| 95 | + * @throws {@link ConflictException} (client fault) |
| 96 | + * <p>The exception that occurs when the request conflicts with the current state of the resource. This can happen when trying to modify a resource that is currently being modified by another request, or when trying to create a resource that already exists.</p> |
| 97 | + * |
| 98 | + * @throws {@link DuplicateIdException} (client fault) |
| 99 | + * <p> An exception thrown when attempting to create a resource with an identifier that already exists.</p> |
| 100 | + * |
| 101 | + * @throws {@link InternalServerException} (server fault) |
| 102 | + * <p>The exception that occurs when the service encounters an unexpected internal error. This is a temporary condition that will resolve itself with retries. We recommend implementing exponential backoff retry logic in your application.</p> |
| 103 | + * |
| 104 | + * @throws {@link ResourceNotFoundException} (client fault) |
| 105 | + * <p>The exception that occurs when the specified resource does not exist. This can happen when using an invalid identifier or when trying to access a resource that has been deleted.</p> |
| 106 | + * |
| 107 | + * @throws {@link ServiceQuotaExceededException} (client fault) |
| 108 | + * <p>The exception that occurs when the request would cause a service quota to be exceeded. Review your service quotas and either reduce your request rate or request a quota increase.</p> |
| 109 | + * |
| 110 | + * @throws {@link ThrottlingException} (client fault) |
| 111 | + * <p>The exception that occurs when the request was denied due to request throttling. This happens when you exceed the allowed request rate for an operation. Reduce the frequency of requests or implement exponential backoff retry logic in your application.</p> |
| 112 | + * |
| 113 | + * @throws {@link UnauthorizedException} (client fault) |
| 114 | + * <p>This exception is thrown when the JWT bearer token is invalid or not found for OAuth bearer token based access</p> |
| 115 | + * |
| 116 | + * @throws {@link ValidationException} (client fault) |
| 117 | + * <p>The exception that occurs when the input fails to satisfy the constraints specified by the service. Check the error message for details about which input parameter is invalid and correct your request.</p> |
| 118 | + * |
| 119 | + * @throws {@link BedrockAgentCoreServiceException} |
| 120 | + * <p>Base exception class for all service exceptions from BedrockAgentCore service.</p> |
| 121 | + * |
| 122 | + * |
| 123 | + * @public |
| 124 | + */ |
| 125 | +export class EvaluateCommand extends $Command |
| 126 | + .classBuilder< |
| 127 | + EvaluateCommandInput, |
| 128 | + EvaluateCommandOutput, |
| 129 | + BedrockAgentCoreClientResolvedConfig, |
| 130 | + ServiceInputTypes, |
| 131 | + ServiceOutputTypes |
| 132 | + >() |
| 133 | + .ep(commonParams) |
| 134 | + .m(function (this: any, Command: any, cs: any, config: BedrockAgentCoreClientResolvedConfig, o: any) { |
| 135 | + return [getEndpointPlugin(config, Command.getEndpointParameterInstructions())]; |
| 136 | + }) |
| 137 | + .s("AmazonBedrockAgentCore", "Evaluate", {}) |
| 138 | + .n("BedrockAgentCoreClient", "EvaluateCommand") |
| 139 | + .sc(Evaluate) |
| 140 | + .build() { |
| 141 | + /** @internal type navigation helper, not in runtime. */ |
| 142 | + protected declare static __types: { |
| 143 | + api: { |
| 144 | + input: EvaluateRequest; |
| 145 | + output: EvaluateResponse; |
| 146 | + }; |
| 147 | + sdk: { |
| 148 | + input: EvaluateCommandInput; |
| 149 | + output: EvaluateCommandOutput; |
| 150 | + }; |
| 151 | + }; |
| 152 | +} |
0 commit comments