Check input content type. Args: msgs: Raw input messages. Returns: str: Message type (str/dict/liststr/listdict).
(self, msgs)
| 137 | return self.encode_image_directly(img) |
| 138 | |
| 139 | def check_content(self, msgs): |
| 140 | """Check input content type. |
| 141 | |
| 142 | Args: |
| 143 | msgs: Raw input messages. |
| 144 | |
| 145 | Returns: |
| 146 | str: Message type (str/dict/liststr/listdict). |
| 147 | """ |
| 148 | if isinstance(msgs, str): |
| 149 | return "str" |
| 150 | if isinstance(msgs, dict): |
| 151 | return "dict" |
| 152 | if isinstance(msgs, list): |
| 153 | types = [self.check_content(m) for m in msgs] |
| 154 | if all(t == "str" for t in types): |
| 155 | return "liststr" |
| 156 | if all(t == "dict" for t in types): |
| 157 | return "listdict" |
| 158 | return "unknown" |
| 159 | |
| 160 | def preproc_content(self, inputs): |
| 161 | """Convert raw input messages to unified dict list format. |
no outgoing calls