gen_ai_hub.orchestration.models.multimodal_items
index
/home/jenkins/agent/workspace/ation_generative-ai-hub-sdk_main/gen_ai_hub/orchestration/models/multimodal_items.py

 
Modules
       
base64
mimetypes

 
Classes
       
builtins.object
ImageUrl
enum.Enum(builtins.object)
ImageDetailLevel
gen_ai_hub.orchestration.models.base.JSONSerializable(abc.ABC)
ImageItem
ImagePart
TextPart

 
class ImageDetailLevel(enum.Enum)
    ImageDetailLevel(value, names=None, *, module=None, qualname=None, type=None, start=1)
 
Controls the resolution and detail level for image analysis.
 
Attributes:
    AUTO: The model determines the detail level automatically.
    LOW: The model uses a low-fidelity, faster version of the image.
    HIGH: The model uses a high-fidelity version of the image.
 
 
Method resolution order:
ImageDetailLevel
enum.Enum
builtins.object

Data and other attributes defined here:
AUTO = <ImageDetailLevel.AUTO: 'auto'>
HIGH = <ImageDetailLevel.HIGH: 'high'>
LOW = <ImageDetailLevel.LOW: 'low'>

Data descriptors inherited from enum.Enum:
name
The name of the Enum member.
value
The value of the Enum member.

Readonly properties inherited from enum.EnumMeta:
__members__
Returns a mapping of member name->value.
 
This mapping lists all enum members, including aliases. Note that this
is a read-only view of the internal mapping.

 
class ImageItem(gen_ai_hub.orchestration.models.base.JSONSerializable)
    ImageItem(url: Optional[str] = None, detail: Optional[gen_ai_hub.orchestration.models.multimodal_items.ImageDetailLevel] = None)
 
Represents an image for use in multimodal messages.
 
Args:
    url: The image location, specified as either a standard URL or a data URL.
        - Standard URL example: 'https://example.com/image.png'
        - Data URL example: 'data:image/png;base64,...'
    detail: The image detail level for model processing.
 
Example:
    # Using a standard URL
    img1 = ImageItem(url="https://example.com/image.png", detail=ImageDetailLevel.HIGH)
 
    # Using a data URL
    img2 = ImageItem(url="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...")
 
 
Method resolution order:
ImageItem
gen_ai_hub.orchestration.models.base.JSONSerializable
abc.ABC
builtins.object

Methods defined here:
__init__(self, url: Optional[str] = None, detail: Optional[gen_ai_hub.orchestration.models.multimodal_items.ImageDetailLevel] = None)
Initialize self.  See help(type(self)) for accurate signature.
to_dict(self) -> Dict[str, Any]
Convert the object to a JSON-serializable dictionary.

Static methods defined here:
from_file(file_path: str, mime_type: Optional[str] = None, detail: Optional[gen_ai_hub.orchestration.models.multimodal_items.ImageDetailLevel] = None) -> 'ImageItem'
Create an ImageItem from a local image file.
 
Args:
    file_path: Path to the image file.
    mime_type: Explicit MIME type (e.g., 'image/png').
        If not provided, the MIME type will be guessed from the file extension.
    detail: The image detail level for model processing.
 
Returns:
    An ImageItem instance with the image data as a data URL.
 
Raises:
    ValueError: If the MIME type cannot be determined and is not provided.
    FileNotFoundError: If the file does not exist.

Data and other attributes defined here:
__abstractmethods__ = frozenset()
__annotations__ = {}

Data descriptors inherited from gen_ai_hub.orchestration.models.base.JSONSerializable:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class ImagePart(gen_ai_hub.orchestration.models.base.JSONSerializable)
    ImagePart(image_url: gen_ai_hub.orchestration.models.multimodal_items.ImageUrl, type: str = 'image_url') -&gt; None
 
Represents an image segment within a multimodal content block.
 
Args:
    image_url: An `ImageUrlobject containing the image's location and detail level.
    type: The type identifier, defaulting to "image_url".
 
 
Method resolution order:
ImagePart
gen_ai_hub.orchestration.models.base.JSONSerializable
abc.ABC
builtins.object

Methods defined here:
__eq__(self, other)
Return self==value.
__init__(self, image_url: gen_ai_hub.orchestration.models.multimodal_items.ImageUrl, type: str = 'image_url') -> None
Initialize self.  See help(type(self)) for accurate signature.
__repr__(self)
Return repr(self).
to_dict(self)
Convert the object to a JSON-serializable dictionary.

Data and other attributes defined here:
__abstractmethods__ = frozenset()
__annotations__ = {'image_url': <class 'gen_ai_hub.orchestration.models.multimodal_items.ImageUrl'>, 'type': <class 'str'>}
__dataclass_fields__ = {'image_url': Field(name='image_url',type=<class 'gen_ai_hub.o...appingproxy({}),kw_only=False,_field_type=_FIELD), 'type': Field(name='type',type=<class 'str'>,default='im...appingproxy({}),kw_only=False,_field_type=_FIELD)}
__dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False)
__hash__ = None
__match_args__ = ('image_url', 'type')
type = 'image_url'

Data descriptors inherited from gen_ai_hub.orchestration.models.base.JSONSerializable:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class ImageUrl(builtins.object)
    ImageUrl(url: str, detail: Optional[gen_ai_hub.orchestration.models.multimodal_items.ImageDetailLevel] = None) -&gt; None
 
A data structure holding the URL and detail level for an image.
 
Args:
    url: The location of the image, as a standard or data URL.
    detail: The processing detail level for the image.
 
  Methods defined here:
__eq__(self, other)
Return self==value.
__init__(self, url: str, detail: Optional[gen_ai_hub.orchestration.models.multimodal_items.ImageDetailLevel] = None) -> None
Initialize self.  See help(type(self)) for accurate signature.
__repr__(self)
Return repr(self).

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes defined here:
__annotations__ = {'detail': typing.Optional[gen_ai_hub.orchestration.models.multimodal_items.ImageDetailLevel], 'url': <class 'str'>}
__dataclass_fields__ = {'detail': Field(name='detail',type=typing.Optional[gen_ai_...appingproxy({}),kw_only=False,_field_type=_FIELD), 'url': Field(name='url',type=<class 'str'>,default=<dat...appingproxy({}),kw_only=False,_field_type=_FIELD)}
__dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False)
__hash__ = None
__match_args__ = ('url', 'detail')
detail = None

 
class TextPart(gen_ai_hub.orchestration.models.base.JSONSerializable)
    TextPart(text: str, type: str = 'text') -&gt; None
 
Represents a text segment within a multimodal content block.
 
Args:
    text: The string content of the text part.
    type: The type identifier, defaulting to "text".
 
 
Method resolution order:
TextPart
gen_ai_hub.orchestration.models.base.JSONSerializable
abc.ABC
builtins.object

Methods defined here:
__eq__(self, other)
Return self==value.
__init__(self, text: str, type: str = 'text') -> None
Initialize self.  See help(type(self)) for accurate signature.
__repr__(self)
Return repr(self).
to_dict(self)
Convert the object to a JSON-serializable dictionary.

Data and other attributes defined here:
__abstractmethods__ = frozenset()
__annotations__ = {'text': <class 'str'>, 'type': <class 'str'>}
__dataclass_fields__ = {'text': Field(name='text',type=<class 'str'>,default=<da...appingproxy({}),kw_only=False,_field_type=_FIELD), 'type': Field(name='type',type=<class 'str'>,default='te...appingproxy({}),kw_only=False,_field_type=_FIELD)}
__dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False)
__hash__ = None
__match_args__ = ('text', 'type')
type = 'text'

Data descriptors inherited from gen_ai_hub.orchestration.models.base.JSONSerializable:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
Data
        Any = typing.Any
ContentPart = typing.Union[gen_ai_hub.orchestration.models.mul....orchestration.models.multimodal_items.ImagePart]
Dict = typing.Dict
Optional = typing.Optional
Union = typing.Union