MCPcopy
hub / github.com/open-compass/VLMEvalKit / check_content

Method check_content

vlmeval/api/base.py:83–102  ·  view source on GitHub ↗

Check the content type of the input. Four types are allowed: str, dict, liststr, listdict. Args: msgs: Raw input messages. Returns: str: The message type.

(self, msgs)

Source from the content-addressed store, hash-verified

81 return False
82
83 def check_content(self, msgs):
84 """Check the content type of the input. Four types are allowed: str, dict, liststr, listdict.
85
86 Args:
87 msgs: Raw input messages.
88
89 Returns:
90 str: The message type.
91 """
92 if isinstance(msgs, str):
93 return 'str'
94 if isinstance(msgs, dict):
95 return 'dict'
96 if isinstance(msgs, list):
97 types = [self.check_content(m) for m in msgs]
98 if all(t == 'str' for t in types):
99 return 'liststr'
100 if all(t == 'dict' for t in types):
101 return 'listdict'
102 return 'unknown'
103
104 def preproc_content(self, inputs):
105 """Convert the raw input messages to a list of dicts.

Callers 3

preproc_contentMethod · 0.95
chatMethod · 0.95
generateMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected