Skip to content

tinker.types.ImageChunk

class tinker.types.ImageChunk(StrictBase)

Fields:

  • data – Image data as bytes
  • format – Image format
  • expected_tokens – Expected number of tokens this image represents. This is only advisory: the tinker backend will compute the number of tokens from the image, and we can fail requests quickly if the tokens does not match expected_tokens.
  • type

validate_data(value)

Deserialize base64 string to bytes if needed.

Returns: bytes

serialize_data(value)

Serialize bytes to base64 string for JSON.

Returns: str