Skip to content

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
                class AudioBase64Content(AudioContent):
                    """Audio from base64 data."""
                
                    type: Literal["audio_base64"] = Field("audio_base64", init=False)
                    """Base64-encoded audio."""
                
                    data: str
                    """Audio data in base64 format."""
                
                    format: str | None = None  # mp3, wav, etc
                    """Audio format."""
                
                    def to_openai_format(self) -> dict[str, Any]:
                        """Convert to OpenAI API format for audio models."""
                        data_url = f"data:audio/{self.format or 'mp3'};base64,{self.data}"
                        content = {"url": data_url, "format": self.format or "auto"}
                        return {"type": "audio", "audio": content}
                
                    @classmethod
                    def from_bytes(cls, data: bytes, audio_format: str = "mp3") -> Self:
                        """Create from raw bytes."""
                        return cls(data=base64.b64encode(data).decode(), format=audio_format)
                
                    @classmethod
                    def from_path(cls, path: StrPath) -> Self:
                        """Create from file path with auto format detection."""
                        import mimetypes
                
                        from upath import UPath
                
                        path_obj = UPath(path)
                        mime_type, _ = mimetypes.guess_type(str(path_obj))
                        fmt = (
                            mime_type.removeprefix("audio/")
                            if mime_type and mime_type.startswith("audio/")
                            else "mp3"
                        )
                
                        return cls(data=base64.b64encode(path_obj.read_bytes()).decode(), format=fmt)
                

                data instance-attribute

                data: str
                

                Audio data in base64 format.

                format class-attribute instance-attribute

                format: str | None = None
                

                Audio format.

                type class-attribute instance-attribute

                type: Literal['audio_base64'] = Field('audio_base64', init=False)
                

                Base64-encoded audio.

                from_bytes classmethod

                from_bytes(data: bytes, audio_format: str = 'mp3') -> Self
                

                Create from raw bytes.

                Source code in src/llmling_agent/models/content.py
                268
                269
                270
                271
                @classmethod
                def from_bytes(cls, data: bytes, audio_format: str = "mp3") -> Self:
                    """Create from raw bytes."""
                    return cls(data=base64.b64encode(data).decode(), format=audio_format)
                

                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
                @classmethod
                def from_path(cls, path: StrPath) -> Self:
                    """Create from file path with auto format detection."""
                    import mimetypes
                
                    from upath import UPath
                
                    path_obj = UPath(path)
                    mime_type, _ = mimetypes.guess_type(str(path_obj))
                    fmt = (
                        mime_type.removeprefix("audio/")
                        if mime_type and mime_type.startswith("audio/")
                        else "mp3"
                    )
                
                    return cls(data=base64.b64encode(path_obj.read_bytes()).decode(), format=fmt)
                

                to_openai_format

                to_openai_format() -> dict[str, Any]
                

                Convert to OpenAI API format for audio models.

                Source code in src/llmling_agent/models/content.py
                262
                263
                264
                265
                266
                def to_openai_format(self) -> dict[str, Any]:
                    """Convert to OpenAI API format for audio models."""
                    data_url = f"data:audio/{self.format or 'mp3'};base64,{self.data}"
                    content = {"url": data_url, "format": self.format or "auto"}
                    return {"type": "audio", "audio": content}
                

                AudioContent

                Bases: BaseContent

                Base for audio content.

                Source code in src/llmling_agent/models/content.py
                225
                226
                227
                228
                229
                230
                231
                232
                class AudioContent(BaseContent):
                    """Base for audio content."""
                
                    format: str | None = None  # mp3, wav, etc
                    """Audio format."""
                
                    description: str | None = None
                    """Human-readable description of the content."""
                

                description class-attribute instance-attribute

                description: str | None = None
                

                Human-readable description of the content.

                format class-attribute instance-attribute

                format: str | None = None
                

                Audio format.

                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
                class AudioURLContent(AudioContent):
                    """Audio from URL."""
                
                    type: Literal["audio_url"] = Field("audio_url", init=False)
                    """URL-based audio."""
                
                    url: str
                    """URL to the audio."""
                
                    def to_openai_format(self) -> dict[str, Any]:
                        """Convert to OpenAI API format for audio models."""
                        content = {"url": self.url, "format": self.format or "auto"}
                        return {"type": "audio", "audio": content}
                

                type class-attribute instance-attribute

                type: Literal['audio_url'] = Field('audio_url', init=False)
                

                URL-based audio.

                url instance-attribute

                url: str
                

                URL to the audio.

                to_openai_format

                to_openai_format() -> dict[str, Any]
                

                Convert to OpenAI API format for audio models.

                Source code in src/llmling_agent/models/content.py
                244
                245
                246
                247
                def to_openai_format(self) -> dict[str, Any]:
                    """Convert to OpenAI API format for audio models."""
                    content = {"url": self.url, "format": self.format or "auto"}
                    return {"type": "audio", "audio": content}
                

                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
                class BaseContent(BaseModel):
                    """Base class for special content types (non-text)."""
                
                    type: str = Field(init=False)
                    """Discriminator field for content types."""
                
                    description: str | None = None
                    """Human-readable description of the content."""
                
                    model_config = ConfigDict(frozen=True, use_attribute_docstrings=True, extra="forbid")
                
                    def to_openai_format(self) -> dict[str, Any]:
                        """Convert to OpenAI API format."""
                        raise NotImplementedError
                

                description class-attribute instance-attribute

                description: str | None = None
                

                Human-readable description of the content.

                type class-attribute instance-attribute

                type: str = Field(init=False)
                

                Discriminator field for content types.

                to_openai_format

                to_openai_format() -> dict[str, Any]
                

                Convert to OpenAI API format.

                Source code in src/llmling_agent/models/content.py
                33
                34
                35
                def to_openai_format(self) -> dict[str, Any]:
                    """Convert to OpenAI API format."""
                    raise NotImplementedError
                

                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
                class BaseImageContent(BaseContent):
                    """Base for image content."""
                
                    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
                    """
                
                    @classmethod
                    async def from_path(
                        cls,
                        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.
                
                        Args:
                            path: Local path or URL to image
                            detail: Optional detail level for processing
                            description: Optional description of the image
                        """
                        from upath import UPath
                
                        path_obj = UPath(path)
                
                        # For http(s) URLs, pass through as URL content
                        if path_obj.protocol in ("http", "https"):
                            return ImageURLContent(
                                url=str(path_obj), detail=detail, description=description
                            )
                
                        # For all other paths, read and convert to base64
                        data = await read_path(path_obj, mode="rb")
                        content = base64.b64encode(data).decode()
                        return ImageBase64Content(data=content, detail=detail, description=description)
                

                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
                @classmethod
                async def from_path(
                    cls,
                    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.
                
                    Args:
                        path: Local path or URL to image
                        detail: Optional detail level for processing
                        description: Optional description of the image
                    """
                    from upath import UPath
                
                    path_obj = UPath(path)
                
                    # For http(s) URLs, pass through as URL content
                    if path_obj.protocol in ("http", "https"):
                        return ImageURLContent(
                            url=str(path_obj), detail=detail, description=description
                        )
                
                    # For all other paths, read and convert to base64
                    data = await read_path(path_obj, mode="rb")
                    content = base64.b64encode(data).decode()
                    return ImageBase64Content(data=content, detail=detail, description=description)
                

                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
                class BasePDFContent(BaseContent):
                    """Base for PDF document content."""
                
                    detail: DetailLevel | None = None
                    """Detail level for document processing by models."""
                
                    def to_openai_format(self) -> dict[str, Any]:
                        """Convert to OpenAI API format for PDF handling."""
                        raise NotImplementedError
                
                    @classmethod
                    async def from_path(
                        cls,
                        path: StrPath,
                        *,
                        detail: DetailLevel | None = None,
                        description: str | None = None,
                    ) -> PDFURLContent | PDFBase64Content:
                        """Create PDF content from any path.
                
                        Args:
                            path: Local path or URL to PDF
                            detail: Optional detail level for processing
                            description: Optional description of the document
                        """
                        from upath import UPath
                
                        path_obj = UPath(path)
                
                        # For http(s) URLs, pass through as URL content
                        if path_obj.protocol in ("http", "https"):
                            return PDFURLContent(
                                url=str(path_obj), detail=detail, description=description
                            )
                
                        # For all other paths, read and convert to base64
                        data = await read_path(path_obj, mode="rb")
                        content = base64.b64encode(data).decode()
                        return PDFBase64Content(data=content, detail=detail, description=description)
                

                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
                @classmethod
                async def from_path(
                    cls,
                    path: StrPath,
                    *,
                    detail: DetailLevel | None = None,
                    description: str | None = None,
                ) -> PDFURLContent | PDFBase64Content:
                    """Create PDF content from any path.
                
                    Args:
                        path: Local path or URL to PDF
                        detail: Optional detail level for processing
                        description: Optional description of the document
                    """
                    from upath import UPath
                
                    path_obj = UPath(path)
                
                    # For http(s) URLs, pass through as URL content
                    if path_obj.protocol in ("http", "https"):
                        return PDFURLContent(
                            url=str(path_obj), detail=detail, description=description
                        )
                
                    # For all other paths, read and convert to base64
                    data = await read_path(path_obj, mode="rb")
                    content = base64.b64encode(data).decode()
                    return PDFBase64Content(data=content, detail=detail, description=description)
                

                to_openai_format

                to_openai_format() -> dict[str, Any]
                

                Convert to OpenAI API format for PDF handling.

                Source code in src/llmling_agent/models/content.py
                147
                148
                149
                def to_openai_format(self) -> dict[str, Any]:
                    """Convert to OpenAI API format for PDF handling."""
                    raise NotImplementedError
                

                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
                class ImageBase64Content(BaseImageContent):
                    """Image from base64 data."""
                
                    type: Literal["image_base64"] = Field("image_base64", init=False)
                    """Base64-encoded image."""
                
                    data: str
                    """Base64-encoded image data."""
                
                    mime_type: str = "image/jpeg"
                    """MIME type of the image."""
                
                    def to_openai_format(self) -> dict[str, Any]:
                        """Convert to OpenAI API format for vision models."""
                        data_url = f"data:{self.mime_type};base64,{self.data}"
                        content = {"url": data_url, "detail": self.detail or "auto"}
                        return {"type": "image_url", "image_url": content}
                
                    @classmethod
                    def from_bytes(
                        cls,
                        data: bytes,
                        *,
                        detail: DetailLevel | None = None,
                        description: str | None = None,
                    ) -> ImageBase64Content:
                        """Create image content from raw bytes.
                
                        Args:
                            data: Raw image bytes
                            detail: Optional detail level for processing
                            description: Optional description of the image
                        """
                        content = base64.b64encode(data).decode()
                        return cls(data=content, detail=detail, description=description)
                
                    @classmethod
                    def from_pil_image(cls, image: PIL.Image.Image) -> ImageBase64Content:
                        """Create content from PIL Image."""
                        with io.BytesIO() as buffer:
                            image.save(buffer, format="PNG")
                            return cls(data=base64.b64encode(buffer.getvalue()).decode())
                

                data instance-attribute

                data: str
                

                Base64-encoded image data.

                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
                @classmethod
                def from_bytes(
                    cls,
                    data: bytes,
                    *,
                    detail: DetailLevel | None = None,
                    description: str | None = None,
                ) -> ImageBase64Content:
                    """Create image content from raw bytes.
                
                    Args:
                        data: Raw image bytes
                        detail: Optional detail level for processing
                        description: Optional description of the image
                    """
                    content = base64.b64encode(data).decode()
                    return cls(data=content, detail=detail, description=description)
                

                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
                @classmethod
                def from_pil_image(cls, image: PIL.Image.Image) -> ImageBase64Content:
                    """Create content from PIL Image."""
                    with io.BytesIO() as buffer:
                        image.save(buffer, format="PNG")
                        return cls(data=base64.b64encode(buffer.getvalue()).decode())
                

                to_openai_format

                to_openai_format() -> dict[str, Any]
                

                Convert to OpenAI API format for vision models.

                Source code in src/llmling_agent/models/content.py
                109
                110
                111
                112
                113
                def to_openai_format(self) -> dict[str, Any]:
                    """Convert to OpenAI API format for vision models."""
                    data_url = f"data:{self.mime_type};base64,{self.data}"
                    content = {"url": data_url, "detail": self.detail or "auto"}
                    return {"type": "image_url", "image_url": content}
                

                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
                class ImageURLContent(BaseImageContent):
                    """Image from URL."""
                
                    type: Literal["image_url"] = Field("image_url", init=False)
                    """URL-based image."""
                
                    url: str
                    """URL to the image."""
                
                    def to_openai_format(self) -> dict[str, Any]:
                        """Convert to OpenAI API format for vision models."""
                        content = {"url": self.url, "detail": self.detail or "auto"}
                        return {"type": "image_url", "image_url": content}
                

                type class-attribute instance-attribute

                type: Literal['image_url'] = Field('image_url', init=False)
                

                URL-based image.

                url instance-attribute

                url: str
                

                URL to the image.

                to_openai_format

                to_openai_format() -> dict[str, Any]
                

                Convert to OpenAI API format for vision models.

                Source code in src/llmling_agent/models/content.py
                91
                92
                93
                94
                def to_openai_format(self) -> dict[str, Any]:
                    """Convert to OpenAI API format for vision models."""
                    content = {"url": self.url, "detail": self.detail or "auto"}
                    return {"type": "image_url", "image_url": content}
                

                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
                class PDFBase64Content(BasePDFContent):
                    """PDF from base64 data."""
                
                    type: Literal["pdf_base64"] = Field("pdf_base64", init=False)
                    """Base64-data based PDF."""
                
                    data: str
                    """Base64-encoded PDF data."""
                
                    def to_openai_format(self) -> dict[str, Any]:
                        """Convert to OpenAI API format for PDF handling."""
                        data_url = f"data:application/pdf;base64,{self.data}"
                        content = {"url": data_url, "detail": self.detail or "auto"}
                        return {"type": "file", "file": content}
                
                    @classmethod
                    def from_bytes(
                        cls,
                        data: bytes,
                        *,
                        detail: DetailLevel | None = None,
                        description: str | None = None,
                    ) -> Self:
                        """Create PDF content from raw bytes."""
                        content = base64.b64encode(data).decode()
                        return cls(data=content, detail=detail, description=description)
                

                data instance-attribute

                data: str
                

                Base64-encoded PDF data.

                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
                @classmethod
                def from_bytes(
                    cls,
                    data: bytes,
                    *,
                    detail: DetailLevel | None = None,
                    description: str | None = None,
                ) -> Self:
                    """Create PDF content from raw bytes."""
                    content = base64.b64encode(data).decode()
                    return cls(data=content, detail=detail, description=description)
                

                to_openai_format

                to_openai_format() -> dict[str, Any]
                

                Convert to OpenAI API format for PDF handling.

                Source code in src/llmling_agent/models/content.py
                206
                207
                208
                209
                210
                def to_openai_format(self) -> dict[str, Any]:
                    """Convert to OpenAI API format for PDF handling."""
                    data_url = f"data:application/pdf;base64,{self.data}"
                    content = {"url": data_url, "detail": self.detail or "auto"}
                    return {"type": "file", "file": content}
                

                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
                class PDFURLContent(BasePDFContent):
                    """PDF from URL."""
                
                    type: Literal["pdf_url"] = Field("pdf_url", init=False)
                    """URL-based PDF."""
                
                    url: str
                    """URL to the PDF document."""
                
                    def to_openai_format(self) -> dict[str, Any]:
                        """Convert to OpenAI API format for PDF handling."""
                        content = {"url": self.url, "detail": self.detail or "auto"}
                        return {"type": "file", "file": content}
                

                type class-attribute instance-attribute

                type: Literal['pdf_url'] = Field('pdf_url', init=False)
                

                URL-based PDF.

                url instance-attribute

                url: str
                

                URL to the PDF document.

                to_openai_format

                to_openai_format() -> dict[str, Any]
                

                Convert to OpenAI API format for PDF handling.

                Source code in src/llmling_agent/models/content.py
                191
                192
                193
                194
                def to_openai_format(self) -> dict[str, Any]:
                    """Convert to OpenAI API format for PDF handling."""
                    content = {"url": self.url, "detail": self.detail or "auto"}
                    return {"type": "file", "file": content}
                

                VideoContent

                Bases: BaseContent

                Base for video content.

                Source code in src/llmling_agent/models/content.py
                291
                292
                293
                294
                295
                296
                297
                298
                class VideoContent(BaseContent):
                    """Base for video content."""
                
                    format: str | None = None
                    """Video format."""
                
                    description: str | None = None
                    """Human-readable description of the content."""
                

                description class-attribute instance-attribute

                description: str | None = None
                

                Human-readable description of the content.

                format class-attribute instance-attribute

                format: str | None = None
                

                Video format.

                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
                class VideoURLContent(VideoContent):
                    """Video from URL."""
                
                    type: Literal["video_url"] = Field("video_url", init=False)
                    """URL-based video."""
                
                    url: str
                    """URL to the video."""
                
                    def to_openai_format(self) -> dict[str, Any]:
                        """Convert to OpenAI API format for video models."""
                        content = {"url": self.url, "format": self.format or "auto"}
                        return {"type": "video", "video": content}
                

                type class-attribute instance-attribute

                type: Literal['video_url'] = Field('video_url', init=False)
                

                URL-based video.

                url instance-attribute

                url: str
                

                URL to the video.

                to_openai_format

                to_openai_format() -> dict[str, Any]
                

                Convert to OpenAI API format for video models.

                Source code in src/llmling_agent/models/content.py
                310
                311
                312
                313
                def to_openai_format(self) -> dict[str, Any]:
                    """Convert to OpenAI API format for video models."""
                    content = {"url": self.url, "format": self.format or "auto"}
                    return {"type": "video", "video": content}