Content.fromMap constructor
Implementation
factory Content.fromMap(Map<String, Object?> value) {
assert(value.containsKey(Keys.type));
assert(
value[Keys.type] != ToolUseContent.expectedType &&
value[Keys.type] != ToolResultContent.expectedType,
'Sampling tool content cannot be read as Content.',
);
// Tool use and tool result belong to sampling messages, where they read
// as a `SamplingMessageContentBlock`. A `tools/call` result carrying one
// is a mix-up the static types already refuse, and a map arriving here
// skips those types, so the assert covers that path.
return Content._(value);
}