StepDetails.fromJson constructor

StepDetails.fromJson(
  1. Map<String, dynamic> json
)

Creates a StepDetails from JSON.

Implementation

factory StepDetails.fromJson(Map<String, dynamic> json) {
  final type = json['type'] as String;
  return switch (type) {
    'message_creation' => MessageCreationDetails.fromJson(json),
    'tool_calls' => ToolCallsDetails.fromJson(json),
    _ => throw FormatException('Unknown step type: $type'),
  };
}