MCPcopy Create free account
hub / github.com/Open-Bee/DataStudio / check_content

Method check_content

datastudio/models/base.py:139–158  ·  view source on GitHub ↗

Check input content type. Args: msgs: Raw input messages. Returns: str: Message type (str/dict/liststr/listdict).

(self, msgs)

Source from the content-addressed store, hash-verified

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.

Calls

no outgoing calls