Skip to main content

Payload CMS documents worker on the Nexus-Queue runtime — LlamaParse parse-document handler over JobStatePort.

Project description

payload-documents-worker-builder

Parametrizable taskiq worker for Payload CMS, ready to drop into a workspace.

Provides:

  • RuntimeConfig — pydantic config (one place for everything: DB DSN, Payload base URL, internal secret, LlamaCloud API key).
  • create_broker(config) — Redis stream broker (via taskiq-redis) with smart retry middleware.
  • create_app(config) — bundles broker + tasks + a small FastAPI HTTP "kicker" that exposes POST /tasks/parse-document so the Next.js side can enqueue parses without speaking the taskiq protocol directly.
  • parse_document_task — built-in task that uploads a Payload document to LlamaParse, polls until done, and writes parsed_text + parse_status back via Payload REST.

Usage

from payload_documents_worker_builder import RuntimeConfig, create_app
from pydantic import SecretStr

config = RuntimeConfig(
    app_name="my-worker",
    redis_url="redis://redis:6379",
    payload_url="http://app:3000",
    payload_service_token=SecretStr("..."),  # Payload API key with write access
    llama_cloud_api_key=SecretStr("..."),
    internal_secret=SecretStr("dev"),
    documents_collection_slug="documents",
)

app, broker = create_app(config)

Run two processes side by side:

uvicorn my_worker.main:app --host 0.0.0.0 --port 8001  # HTTP kicker
taskiq worker my_worker.main:broker                     # task consumer

Architecture

   Next.js (Payload)               payload-documents-worker (uvicorn)        payload-documents-worker (taskiq)
  ─────────────────────────       ────────────────────────────    ────────────────────────────
  POST /api/documents/{id}/parse  POST /tasks/parse-document      consume `parse_document` task
   ├ stamps parse_status='queued'  ├ broker.kiq()                  ├ download file from Payload
   └ HTTP→ kicker                  └ returns 202                   ├ upload to LlamaCloud
                                                                   ├ poll status
                                                                   └ PATCH parsed_text/status
                                          │                                  │
                                          └─────────── Redis Stream ─────────┘

Public API

from payload_documents_worker_builder import (
    create_app,
    create_broker,
    RuntimeConfig,
    LlamaParseClient,
    PayloadClient,
    parse_document_task,
)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

payload_documents_worker_builder-0.1.5.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file payload_documents_worker_builder-0.1.5.tar.gz.

File metadata

File hashes

Hashes for payload_documents_worker_builder-0.1.5.tar.gz
Algorithm Hash digest
SHA256 783175e5e74b72bf75d14a8b3b1e865006602e3a31d3b9ca31f8c8a31deaf6f4
MD5 9e03f895ad3231874ff5fb50548709f3
BLAKE2b-256 c715ccade92a2c00c9277ad396175e90c9116ee04883faea55f1d5129f8033be

See more details on using hashes here.

Provenance

The following attestation bundles were made for payload_documents_worker_builder-0.1.5.tar.gz:

Publisher: release-please.yml on Zetesis-Labs/PayloadAgents

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file payload_documents_worker_builder-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for payload_documents_worker_builder-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 f084760f10488a1dea0c1bc1d71d6aa0be0fc47eac50c7c4405bad8fd05242cc
MD5 44bf8c1aca4daf7470c3a67becdd71b2
BLAKE2b-256 9f9daaf27dfd5d14ede9b7bac1fb71e6d9e38b9a6e9b73c7d87b0702be60d601

See more details on using hashes here.

Provenance

The following attestation bundles were made for payload_documents_worker_builder-0.1.5-py3-none-any.whl:

Publisher: release-please.yml on Zetesis-Labs/PayloadAgents

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page