copyWith method

PromptMessage copyWith({
  1. ContentBlock? content,
  2. Role? role,
})

A copy with the given properties replaced; everything else, unknown keys included, is kept.

Implementation

PromptMessage copyWith({
  ContentBlock? content,
  Role? role,
}) =>
    PromptMessage.fromJson({
      ...toJson(),
      if (content != null) 'content': $encode(content),
      if (role != null) 'role': $encode(role),
    });