MessagePart type

每个 GEN gen-ai 语义约定的所有消息部件类型的联合。

注意: GenericPart 充当一个 catch-all,以便与自定义或将来的部件类型向前兼容。 由于它是typestring (不是文字),因此详尽switch/casepart.type介绍不会为未经处理的事例生成编译时错误。

type MessagePart =
  | TextPart
  | ToolCallRequestPart
  | ToolCallResponsePart
  | ReasoningPart
  | BlobPart
  | FilePart
  | UriPart
  | ServerToolCallPart
  | ServerToolCallResponsePart
  | GenericPart