# EvaluatorReference

Represents a reference to an evaluator for online evaluation.

Use the static factory methods to create evaluator references:
- `EvaluatorReference.builtin()` for built-in evaluators
- `EvaluatorReference.custom()` for custom evaluators

Obtainable from: EvaluatorReference.builtin, EvaluatorReference.custom

- Source: [`lib/evaluation/evaluator.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/@aws-cdk/aws-bedrock-agentcore-alpha/lib/evaluation/evaluator.ts#L33)

## Example

TypeScript:

```ts
// Using built-in evaluators
const helpfulness = agentcore.EvaluatorReference.builtin(agentcore.BuiltinEvaluator.HELPFULNESS);

// Using custom evaluators
declare const myCustomEvaluator: agentcore.IEvaluator;
const custom = agentcore.EvaluatorReference.custom(myCustomEvaluator);
```

Python:

```python
# Using custom evaluators
# my_custom_evaluator: agentcore.IEvaluator
# Using built-in evaluators
helpfulness = agentcore.EvaluatorReference.builtin(agentcore.BuiltinEvaluator.HELPFULNESS)
custom = agentcore.EvaluatorReference.custom(my_custom_evaluator)
```

Java:

```java
// Using custom evaluators
IEvaluator myCustomEvaluator;
// Using built-in evaluators
EvaluatorReference helpfulness = EvaluatorReference.builtin(BuiltinEvaluator.HELPFULNESS);
EvaluatorReference custom = EvaluatorReference.custom(myCustomEvaluator);
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.AWS.Bedrock.Agentcore.Alpha
// Using custom evaluators
IEvaluator myCustomEvaluator;
// Using built-in evaluators
var helpfulness = EvaluatorReference.Builtin(BuiltinEvaluator.HELPFULNESS);
var custom = EvaluatorReference.Custom(myCustomEvaluator);
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awsbedrockagentcorealpha/v2
// Using custom evaluators
var myCustomEvaluator IEvaluator
// Using built-in evaluators
helpfulness := agentcore.EvaluatorReference_Builtin(agentcore.BuiltinEvaluator_HELPFULNESS())
custom := agentcore.EvaluatorReference_Custom(myCustomEvaluator)
```

## Properties

- `evaluatorId`: string — The evaluator identifier.

## Methods

- `bind(): EvaluatorReferenceBindResult` — Binds the evaluator reference to produce the L1 property.

- `builtin(evaluator: BuiltinEvaluator): EvaluatorReference // chainable` (static) — Creates a reference to a built-in evaluator.

  Built-in evaluators are provided by Amazon Bedrock AgentCore and assess
  different aspects of agent performance at various levels (session, trace, or tool call).

  **Parameters**

  - `evaluator` — - The built-in evaluator to reference.

  **Returns:** An EvaluatorReference instance

  ```ts
  const helpfulness = agentcore.EvaluatorReference.builtin(agentcore.BuiltinEvaluator.HELPFULNESS);
  const goalSuccess = agentcore.EvaluatorReference.builtin(agentcore.BuiltinEvaluator.GOAL_SUCCESS_RATE);
  ```

- `custom(evaluator: IEvaluator): EvaluatorReference // chainable` (static) — Creates a reference to a custom evaluator.

  Custom evaluators are created using the `Evaluator` construct and can be
  LLM-as-a-Judge or code-based (Lambda) evaluators.

  **Parameters**

  - `evaluator` — - The custom evaluator construct to reference.

  **Returns:** An EvaluatorReference instance

  ```ts
  declare const myCustomEvaluator: agentcore.IEvaluator;
  const ref = agentcore.EvaluatorReference.custom(myCustomEvaluator);
  ```
