MCPcopy Create free account
hub / github.com/CommonstackAI/UncommonRoute / _message_text

Function _message_text

uncommon_route/cache_support.py:478–488  ·  view source on GitHub ↗
(message: dict[str, Any])

Source from the content-addressed store, hash-verified

476
477
478def _message_text(message: dict[str, Any]) -> str:
479 content = message.get("content")
480 if isinstance(content, str):
481 return content
482 if isinstance(content, list):
483 parts: list[str] = []
484 for item in content:
485 if isinstance(item, dict) and item.get("type") in {"text", "input_text"}:
486 parts.append(str(item.get("text", "")))
487 return "\n".join(part for part in parts if part)
488 return str(content or "")
489
490
491def _as_int(value: Any) -> int:

Callers 1

_stable_prompt_cache_keyFunction · 0.70

Calls 2

getMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected