MCPcopy Create free account
hub / github.com/SkyworkAI/DeepResearchAgent / HumanMessage

Class HumanMessage

src/message/types.py:162–190  ·  view source on GitHub ↗

A message from a human user.

Source from the content-addressed store, hash-verified

160 cache: bool = Field(default=False, description="Whether to cache this message. This is only applicable when using Anthropic models.") # type: ignore
161
162class HumanMessage(Message):
163 """A message from a human user."""
164 role: Literal['user'] = Field(default='user', description="The role of the messages author, in this case `user`.") # type: ignore
165 content: Union[str, List[Union[
166 ContentPartText,
167 ContentPartImage,
168 ContentPartAudio,
169 ContentPartVideo,
170 ContentPartPdf,
171 ]]] = Field(description="The contents of the user message.")
172 name: Optional[str] = Field(default=None, description="An optional name for the participant. Provides the model information to differentiate between participants of the same role.") # type: ignore
173
174 @property
175 def text(self) -> str:
176 """
177 Automatically parse the text inside content, whether it's a string or a list of content parts.
178 """
179 if isinstance(self.content, str):
180 return self.content
181 elif isinstance(self.content, list):
182 return '\n'.join([str(part) for part in self.content])
183 else:
184 return ''
185
186 def __str__(self) -> str:
187 return f'HumanMessage(content={self.text})'
188
189 def __repr__(self) -> str:
190 return f'HumanMessage(content={repr(self.text)})'
191
192
193class SystemMessage(Message):

Callers 15

get_messageMethod · 0.90
add_eventMethod · 0.90
add_eventMethod · 0.90
_process_memoryMethod · 0.90
add_eventMethod · 0.90
add_eventMethod · 0.90

Calls

no outgoing calls

Tested by 10

test_math_benchmarkFunction · 0.72
test_chatFunction · 0.72
test_transcriptionFunction · 0.72
test_embeddingFunction · 0.72
test_videoFunction · 0.72
test_pdfFunction · 0.72
test_response_formatFunction · 0.72
test_tool_callingFunction · 0.72
test_searchFunction · 0.72
test_messageFunction · 0.72