MCPcopy Index your code
hub / github.com/OpenBMB/ChatDev / MessageBlockType

Class MessageBlockType

entity/messages.py:19–40  ·  view source on GitHub ↗

Supported block types for multimodal message content.

Source from the content-addressed store, hash-verified

17
18
19class MessageBlockType(str, Enum):
20 """Supported block types for multimodal message content."""
21
22 TEXT = "text"
23 IMAGE = "image"
24 AUDIO = "audio"
25 VIDEO = "video"
26 FILE = "file"
27 DATA = "data"
28
29 @classmethod
30 def from_mime_type(cls, mime_type: str) -> "MessageBlockType":
31 """Guess block type from MIME type."""
32 if not mime_type:
33 return MessageBlockType.FILE
34 if mime_type.startswith("image/"):
35 return MessageBlockType.IMAGE
36 if mime_type.startswith("audio/"):
37 return MessageBlockType.AUDIO
38 if mime_type.startswith("video/"):
39 return MessageBlockType.VIDEO
40 return MessageBlockType.FILE
41
42
43@dataclass

Callers 2

from_dictMethod · 0.90
from_dictMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected