Skip to content

PDFURLContent

Base classes

Name Children Inherits
BasePDFContent
llmling_agent.models.content
Base for PDF document content.

⋔ Inheritance diagram

graph TD
  94461877189072["content.PDFURLContent"]
  94461877935216["content.BasePDFContent"]
  94461877390128["content.BaseContent"]
  94461844082608["main.BaseModel"]
  139711135027392["builtins.object"]
  94461877935216 --> 94461877189072
  94461877390128 --> 94461877935216
  94461844082608 --> 94461877390128
  139711135027392 --> 94461844082608

🛈 DocStrings

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}

Show source on GitHub