ChunkingStrategy.fromJson constructor

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

Creates a ChunkingStrategy from JSON.

Implementation

factory ChunkingStrategy.fromJson(Map<String, dynamic> json) {
  final type = json['type'] as String;
  return switch (type) {
    'auto' => const AutoChunkingStrategy(),
    'static' => StaticChunkingStrategy.fromJson(json),
    _ => throw FormatException('Unknown chunking strategy: $type'),
  };
}