content_str

content_str(content: str | list[autogen.types.UserMessageTextContentPart | autogen.types.UserMessageImageContentPart] | None) -> str

Converts the content field of an OpenAI message into a string format.

This function processes content that may be a string, a list of mixed text and image URLs, or None, and converts it into a string. Text is directly appended to the result string, while image URLs are represented by a placeholder image token. If the content is None, an empty string is returned.

Parameters:
NameDescription
contentType: str | list[autogen.types.UserMessageTextContentPart | autogen.types.UserMessageImageContentPart] | None
Returns:
TypeDescription
strstr: A string representation of the input content. Image URLs are replaced with an image token.