DeciderOption constructor

DeciderOption(
  1. String id, {
  2. String? description,
  3. List<EmbeddingInput> examples = const [],
  4. Map<String, Object?>? metadata,
})

Throws ArgumentError when id is empty or description is empty (leave it out instead).

examples and metadata are copied. metadata is never embedded; it is carried for the app (a tool declaration, a route) and stored in the decider's artifact, so it must be JSON-encodable to export the decider.

Implementation

DeciderOption(
  this.id, {
  this.description,
  List<EmbeddingInput> examples = const [],
  Map<String, Object?>? metadata,
}) : examples = List.unmodifiable(examples),
     metadata = metadata == null ? null : Map.unmodifiable(metadata) {
  if (id.isEmpty) {
    throw ArgumentError.value(id, 'id', 'must not be empty');
  }
  if (description != null && description!.isEmpty) {
    throw ArgumentError.value(
      description,
      'description',
      'must not be empty; leave it out instead',
    );
  }
}