VectorStoreFile.fromJson constructor

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

Creates a VectorStoreFile from JSON.

Implementation

factory VectorStoreFile.fromJson(Map<String, dynamic> json) {
  return VectorStoreFile(
    id: json['id'] as String,
    object: json['object'] as String,
    usageBytes: json['usage_bytes'] as int,
    createdAt: json['created_at'] as int,
    vectorStoreId: json['vector_store_id'] as String,
    status: VectorStoreFileStatus.fromJson(json['status'] as String),
    lastError: json['last_error'] != null
        ? VectorStoreFileError.fromJson(
            json['last_error'] as Map<String, dynamic>,
          )
        : null,
    chunkingStrategy: json['chunking_strategy'] != null
        ? ChunkingStrategy.fromJson(
            json['chunking_strategy'] as Map<String, dynamic>,
          )
        : null,
  );
}