Skip to content

Function: chatContentToText()

chatContentToText(content, options?): string

Flatten a message content value to plain text. Accepts the string form and the structured-parts form (ChatContentPart), and yields "" for anything else (null, a lone image part, a malformed payload). Typed as unknown because most callers are reading a just-parsed JSON body, and the point of this helper is that they do not have to pre-check it.

unknown

ChatContentToTextOptions = {}

string