Skip to main content

ImageContent

Image content with detail level specification.
from adaline_api.models.image_content import ImageContent

Fields

modality
str
required
Must be "image".
detail
str
required
Detail level. One of: "low", "medium", "high", "auto".
value
ImageContentValue
required
Image data — either a URL or base64-encoded content. Use ImageContentValue.from_dict() to construct.

Example

from adaline_api.models.image_content import ImageContent
from adaline_api.models.image_content_value import ImageContentValue
from adaline_api.models.message_content import MessageContent

# URL image
image = ImageContent(
    modality="image",
    detail="high",
    value=ImageContentValue.from_dict({
        "type": "url",
        "url": "https://example.com/chart.png"
    })
)

content = MessageContent(actual_instance=image)

# Base64 image
base64_image = ImageContent(
    modality="image",
    detail="auto",
    value=ImageContentValue.from_dict({
        "type": "base64",
        "base64": "iVBORw0KGgoAAAANSUhEUgA...",
        "mediaType": "jpeg"
    })
)
JSON:
{
  "modality": "image",
  "detail": "high",
  "value": {
    "type": "url",
    "url": "https://example.com/image.jpg"
  }
}