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.4.tar.gz (10.7 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.4.tar.gz.

File metadata

File hashes

Hashes for payload_documents_worker_builder-0.1.4.tar.gz
Algorithm Hash digest
SHA256 fa34bc429678c02c3dd8e1755b822e3d660b19f9000c105733c29a22574f093b
MD5 cdc42ae66d7487b55aa44f72161b12ac
BLAKE2b-256 e68706d0b72573bc41fb357814f9a607fe3fc6b9c24c3e916a922b6897616d3f

See more details on using hashes here.

Provenance

The following attestation bundles were made for payload_documents_worker_builder-0.1.4.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.4-py3-none-any.whl.

File metadata

File hashes

Hashes for payload_documents_worker_builder-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 75595db9f96df3674ecfce40e907be7a3065c9d3e4560a19ff13e4385825752d
MD5 39e6ecc20acdd20dae6afee6f7e43d99
BLAKE2b-256 c21274208f72f987808242ec09d56d31a4dbe203ebc7e91bddbda0833b15618c

See more details on using hashes here.

Provenance

The following attestation bundles were made for payload_documents_worker_builder-0.1.4-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