MCPcopy Create free account
hub / github.com/Graphify-Labs/graphify / _ImageRef

Class _ImageRef

graphify/llm.py:902–923  ·  view source on GitHub ↗

A single image destined for a vision request. `raw` is None when the image is unreadable or exceeds `_MAX_IMAGE_BYTES`, or when the target backend has no vision support — in every such case the renderers emit a text reference instead of pixels, so the image still becomes a graph nod

Source from the content-addressed store, hash-verified

900
901@dataclass
902class _ImageRef:
903 """A single image destined for a vision request.
904
905 `raw` is None when the image is unreadable or exceeds `_MAX_IMAGE_BYTES`, or
906 when the target backend has no vision support — in every such case the
907 renderers emit a text reference instead of pixels, so the image still
908 becomes a graph node.
909 """
910
911 path: Path # absolute path (claude-cli reads it via the Read tool)
912 rel: str # path relative to the corpus root (the node's source_file)
913 media_type: str # e.g. "image/png"
914 raw: bytes | None
915
916 @property
917 def b64(self) -> str:
918 return base64.standard_b64encode(self.raw).decode("ascii") if self.raw else ""
919
920 @property
921 def bedrock_format(self) -> str:
922 # Converse wants a bare format token, not a media type.
923 return self.media_type.split("/", 1)[-1]
924
925
926def _is_vision_image(path: Path) -> bool:

Callers 1

_build_image_refsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected