Skip to content

PDFURLContent

Base classes

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

⋔ Inheritance diagram

graph TD
  94743663684544["content.PDFURLContent"]
  94743664346800["content.BasePDFContent"]
  94743663696960["content.BaseContent"]
  94743632922272["main.BaseModel"]
  139793542615232["builtins.object"]
  94743664346800 --> 94743663684544
  94743663696960 --> 94743664346800
  94743632922272 --> 94743663696960
  139793542615232 --> 94743632922272

🛈 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