MCPcopy
hub / github.com/zai-org/Open-AutoGLM / create_user_message

Method create_user_message

phone_agent/model/client.py:228–253  ·  view source on GitHub ↗

Create a user message with optional image. Args: text: Text content. image_base64: Optional base64-encoded image. Returns: Message dictionary.

(
        text: str, image_base64: str | None = None
    )

Source from the content-addressed store, hash-verified

226
227 @staticmethod
228 def create_user_message(
229 text: str, image_base64: str | None = None
230 ) -> dict[str, Any]:
231 """
232 Create a user message with optional image.
233
234 Args:
235 text: Text content.
236 image_base64: Optional base64-encoded image.
237
238 Returns:
239 Message dictionary.
240 """
241 content = []
242
243 if image_base64:
244 content.append(
245 {
246 "type": "image_url",
247 "image_url": {"url": f"data:image/png;base64,{image_base64}"},
248 }
249 )
250
251 content.append({"type": "text", "text": text})
252
253 return {"role": "user", "content": content}
254
255 @staticmethod
256 def create_assistant_message(content: str) -> dict[str, Any]:

Callers 2

_execute_stepMethod · 0.80
_execute_stepMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected