content_str
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:
Name | Description |
---|---|
content | The content to be processed. Can be a string, a list of dictionaries representing text and image URLs, or None. Type: str | list[UserMessageTextContentPart | UserMessageImageContentPart] | None |
Type | Description |
---|---|
str | str: A string representation of the input content. Image URLs are replaced with an image token. |