ImageBase64Content
Base classes¶
| Name | Children | Inherits |
|---|---|---|
| BaseImageContent llmling_agent.models.content Base for image content. |
⋔ Inheritance diagram¶
graph TD
94890200657616["content.ImageBase64Content"]
94890194365632["content.BaseImageContent"]
94890199950896["content.BaseContent"]
94890183243792["schema.Schema"]
94890170496944["main.BaseModel"]
139970493684192["builtins.object"]
94890194365632 --> 94890200657616
94890199950896 --> 94890194365632
94890183243792 --> 94890199950896
94890170496944 --> 94890183243792
139970493684192 --> 94890170496944
🛈 DocStrings¶
Bases: BaseImageContent
Image from base64 data.
Source code in src/llmling_agent/models/content.py
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | |
mime_type
class-attribute
instance-attribute
¶
mime_type: str = 'image/jpeg'
MIME type of the image.
type
class-attribute
instance-attribute
¶
type: Literal['image_base64'] = Field('image_base64', init=False)
Base64-encoded image.
from_bytes
classmethod
¶
from_bytes(
data: bytes, *, detail: DetailLevel | None = None, description: str | None = None
) -> ImageBase64Content
Create image content from raw bytes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
bytes
|
Raw image bytes |
required |
detail
|
DetailLevel | None
|
Optional detail level for processing |
None
|
description
|
str | None
|
Optional description of the image |
None
|
Source code in src/llmling_agent/models/content.py
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | |
from_pil_image
classmethod
¶
from_pil_image(image: Image) -> ImageBase64Content
Create content from PIL Image.
Source code in src/llmling_agent/models/content.py
133 134 135 136 137 138 | |
to_openai_format
¶
Convert to OpenAI API format for vision models.
Source code in src/llmling_agent/models/content.py
109 110 111 112 113 | |