Skip to content

PDFURLContent

Base classes

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

⋔ Inheritance diagram

graph TD
  93827291596896["content.PDFURLContent"]
  93827291490240["content.BasePDFContent"]
  93827291152384["content.BaseContent"]
  93827278265344["schema.Schema"]
  93827258649232["main.BaseModel"]
  139640553287904["builtins.object"]
  93827291490240 --> 93827291596896
  93827291152384 --> 93827291490240
  93827278265344 --> 93827291152384
  93827258649232 --> 93827278265344
  139640553287904 --> 93827258649232

🛈 DocStrings

Bases: BasePDFContent

PDF from URL.

Source code in src/llmling_agent/models/content.py
183
184
185
186
187
188
189
190
191
192
193
194
195
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
192
193
194
195
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