content
Class info¶
Classes¶
Name | Children | Inherits |
---|---|---|
AudioBase64Content llmling_agent.models.content Audio from base64 data. |
||
AudioContent llmling_agent.models.content Base for audio content. |
||
AudioURLContent llmling_agent.models.content Audio from URL. |
||
BaseContent llmling_agent.models.content Base class for special content types (non-text). |
||
BaseImageContent llmling_agent.models.content Base for image content. |
||
BasePDFContent llmling_agent.models.content Base for PDF document content. |
||
ImageBase64Content llmling_agent.models.content Image from base64 data. |
||
ImageURLContent llmling_agent.models.content Image from URL. |
||
PDFBase64Content llmling_agent.models.content PDF from base64 data. |
||
PDFURLContent llmling_agent.models.content PDF from URL. |
||
VideoContent llmling_agent.models.content Base for video content. |
||
VideoURLContent llmling_agent.models.content Video from URL. |
🛈 DocStrings¶
Content types for messages.
AudioBase64Content
¶
Bases: AudioContent
Audio from base64 data.
Source code in src/llmling_agent/models/content.py
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 |
|
type
class-attribute
instance-attribute
¶
type: Literal['audio_base64'] = Field('audio_base64', init=False)
Base64-encoded audio.
from_bytes
classmethod
¶
Create from raw bytes.
Source code in src/llmling_agent/models/content.py
268 269 270 271 |
|
from_path
classmethod
¶
from_path(path: StrPath) -> Self
Create from file path with auto format detection.
Source code in src/llmling_agent/models/content.py
273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 |
|
to_openai_format
¶
Convert to OpenAI API format for audio models.
Source code in src/llmling_agent/models/content.py
262 263 264 265 266 |
|
AudioContent
¶
Bases: BaseContent
Base for audio content.
Source code in src/llmling_agent/models/content.py
225 226 227 228 229 230 231 232 |
|
AudioURLContent
¶
Bases: AudioContent
Audio from URL.
Source code in src/llmling_agent/models/content.py
235 236 237 238 239 240 241 242 243 244 245 246 247 |
|
type
class-attribute
instance-attribute
¶
type: Literal['audio_url'] = Field('audio_url', init=False)
URL-based audio.
to_openai_format
¶
Convert to OpenAI API format for audio models.
Source code in src/llmling_agent/models/content.py
244 245 246 247 |
|
BaseContent
¶
Bases: BaseModel
Base class for special content types (non-text).
Source code in src/llmling_agent/models/content.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
|
BaseImageContent
¶
Bases: BaseContent
Base for image content.
Source code in src/llmling_agent/models/content.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
|
detail
class-attribute
instance-attribute
¶
detail: DetailLevel | None = None
Detail level for image processing by vision models. - high: Maximum resolution (up to 2048x2048) - low: Lower resolution (512x512) - auto: Let model decide based on content
from_path
async
classmethod
¶
from_path(
path: StrPath, *, detail: DetailLevel | None = None, description: str | None = None
) -> ImageURLContent | ImageBase64Content
Create image content from any path.
Automatically chooses between URL and base64 based on path type. Downloads and converts remote content if needed.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
StrPath
|
Local path or URL to image |
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
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
|
BasePDFContent
¶
Bases: BaseContent
Base for PDF document content.
Source code in src/llmling_agent/models/content.py
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 |
|
detail
class-attribute
instance-attribute
¶
detail: DetailLevel | None = None
Detail level for document processing by models.
from_path
async
classmethod
¶
from_path(
path: StrPath, *, detail: DetailLevel | None = None, description: str | None = None
) -> PDFURLContent | PDFBase64Content
Create PDF content from any path.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
StrPath
|
Local path or URL to PDF |
required |
detail
|
DetailLevel | None
|
Optional detail level for processing |
None
|
description
|
str | None
|
Optional description of the document |
None
|
Source code in src/llmling_agent/models/content.py
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 |
|
ImageBase64Content
¶
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 |
|
ImageURLContent
¶
Bases: BaseImageContent
Image from URL.
Source code in src/llmling_agent/models/content.py
82 83 84 85 86 87 88 89 90 91 92 93 94 |
|
type
class-attribute
instance-attribute
¶
type: Literal['image_url'] = Field('image_url', init=False)
URL-based image.
to_openai_format
¶
Convert to OpenAI API format for vision models.
Source code in src/llmling_agent/models/content.py
91 92 93 94 |
|
PDFBase64Content
¶
Bases: BasePDFContent
PDF from base64 data.
Source code in src/llmling_agent/models/content.py
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 |
|
type
class-attribute
instance-attribute
¶
type: Literal['pdf_base64'] = Field('pdf_base64', init=False)
Base64-data based PDF.
from_bytes
classmethod
¶
from_bytes(
data: bytes, *, detail: DetailLevel | None = None, description: str | None = None
) -> Self
Create PDF content from raw bytes.
Source code in src/llmling_agent/models/content.py
212 213 214 215 216 217 218 219 220 221 222 |
|
to_openai_format
¶
Convert to OpenAI API format for PDF handling.
Source code in src/llmling_agent/models/content.py
206 207 208 209 210 |
|
PDFURLContent
¶
Bases: BasePDFContent
PDF from URL.
Source code in src/llmling_agent/models/content.py
182 183 184 185 186 187 188 189 190 191 192 193 194 |
|
type
class-attribute
instance-attribute
¶
type: Literal['pdf_url'] = Field('pdf_url', init=False)
URL-based PDF.
to_openai_format
¶
Convert to OpenAI API format for PDF handling.
Source code in src/llmling_agent/models/content.py
191 192 193 194 |
|
VideoContent
¶
Bases: BaseContent
Base for video content.
Source code in src/llmling_agent/models/content.py
291 292 293 294 295 296 297 298 |
|
VideoURLContent
¶
Bases: VideoContent
Video from URL.
Source code in src/llmling_agent/models/content.py
301 302 303 304 305 306 307 308 309 310 311 312 313 |
|
type
class-attribute
instance-attribute
¶
type: Literal['video_url'] = Field('video_url', init=False)
URL-based video.
to_openai_format
¶
Convert to OpenAI API format for video models.
Source code in src/llmling_agent/models/content.py
310 311 312 313 |
|