| 1 |
from __future__ import annotations |
| 2 |
|
| 3 |
from typing import Union, Optional |
| 4 |
from typing_extensions import Literal, Required, TypeAlias, TypedDict |
| 5 |
|
| 6 |
from .url_image_source_param import URLImageSourceParam |
| 7 |
from .file_image_source_param import FileImageSourceParam |
| 8 |
from .base64_image_source_param import Base64ImageSourceParam |
| 9 |
from .image_transformations_param import ImageTransformationsParam |
| 10 |
from .cache_control_ephemeral_param import CacheControlEphemeralParam |
| 11 |
|
| 12 |
__all__ = ["ImageBlockParam", "Source"] |
| 13 |
|
| 14 |
Source: TypeAlias = Union[Base64ImageSourceParam, URLImageSourceParam, FileImageSourceParam] |
| 15 |
|
| 16 |
|
| 17 |
class ImageBlockParam(TypedDict, total=False): |
| 18 |
source: Required[Source] |
| 19 |
|
| 20 |
type: Required[Literal["image"]] |
| 21 |
|
| 22 |
cache_control: Optional[CacheControlEphemeralParam] |
| 23 |
"""Create a cache control breakpoint at this content block.""" |
| 24 |
|
| 25 |
transformations: Optional[ImageTransformationsParam] |
| 26 |
""" |
| 27 |
Configures the transformations the server applies to this image before the model |
| 28 |
observes it. Each key names a condition the server transforms images for; its |
| 29 |
value selects the transformation applied. Omitted keys keep their default |
| 30 |
behavior, and an empty object is equivalent to omitting the field. |
| 31 |
""" |