paperap.scripts.describe module
METADATA:
- File: describe.py
Project: paperap
- Created: 2025-03-18
Version: 0.0.9
Author: Jess Mann Email: jess@jmann.me
Copyright (c) 2025 Jess Mann
LAST MODIFIED:
2025-03-18 By Jess Mann
- class paperap.scripts.describe.ScriptDefaults(*values)[source]
Bases:
StrEnum- NEEDS_DESCRIPTION = 'needs-description'
- DESCRIBED = 'described'
- NEEDS_TITLE = 'needs-title'
- NEEDS_DATE = 'needs-date'
- MODEL = 'gpt-4o-mini'
- class paperap.scripts.describe.DescribePhotos(**data)[source]
Bases:
BaseModelDescribes photos in the Paperless NGX instance using an LLM (such as OpenAI’s GPT-4o-mini model).
- Parameters:
data (
Any)
- max_threads: int
- paperless_tag: str | None
- prompt: str | None
- client: PaperlessClient
- model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- property progress_bar: ProgressBar
- property openai: OpenAI
- property jinja_env: Environment
- parse_date(date_str)[source]
Parse a date string.
- Parameters:
date_str (
str) – The date string to parse.- Returns:
The parsed date.
- Return type:
date
- parse_datetime(date_str)[source]
Parse a date string.
- Parameters:
date_str (
str) – The date string to parse.- Returns:
The parsed date.
- Return type:
date
- standardize_image_contents(content)[source]
Standardize image contents to base64-encoded PNG format.
- describe_document(document)[source]
Describe a single document using OpenAI’s GPT-4o model.
The document object passed in will be updated with the description.
- process_response(response, document)[source]
Process the response from OpenAI and update the document.
- describe_documents(documents=None)[source]
Describe a list of documents using OpenAI’s GPT-4o model.
- model_post_init(context, /)
This function is meant to behave like a BaseModel method to initialise private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.