StepToolCall.fromJson constructor

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

Creates a StepToolCall from JSON.

Implementation

factory StepToolCall.fromJson(Map<String, dynamic> json) {
  final type = json['type'] as String;
  return switch (type) {
    'code_interpreter' => CodeInterpreterStepCall.fromJson(json),
    'file_search' => FileSearchStepCall.fromJson(json),
    'function' => FunctionStepCall.fromJson(json),
    _ => throw FormatException('Unknown tool call type: $type'),
  };
}