Skip to main content

Async Utils

PyPI version PyPI license

Utilities for running asynchronous IO tasks.

Authors

  • Li Peng-Hsuan (李朋軒) @ ailabs.tw (jacobvsdanniel [at] gmail.com)

Features

  • A framework of modularized, customizable data definition, quota management, and task runner
  • A bare-bones math application for demo purposes
  • OpenAI and Deep Infra applications for high-throughput, real-time, batched requests

Installation

python -m pip install jb_async_utils

Usage

For more detailed usage, see examples

import json
import asyncio
import tiktoken
from openai import AsyncOpenAI
from async_utils import (
    process_batch_data, OpenAITaskDatum, OpenAIQuotaManager, openai_task_runner
)

input_file = "tmp_in.jsonl"
output_file = "tmp_out.jsonl"

api_key = input("API key: ")
OpenAITaskDatum.client = AsyncOpenAI(api_key=api_key)
OpenAITaskDatum.tokenizer = tiktoken.encoding_for_model("gpt-5")
quota_manager = OpenAIQuotaManager(60, 500)

with open(input_file, "w", encoding="utf8") as f:
    for i in range(10):
        datum = {
            "text_in": f"Reverse the word order of the sentence: I have {i + 1} fish.",
            "model": "gpt-5.2",
            "choices": 1,
        }
        json.dump(datum, f, ensure_ascii=False)
        f.write("\n")

asyncio.run(process_batch_data(
    input_file, output_file, OpenAITaskDatum, openai_task_runner, quota_manager,
    max_task_runs=3, start_id=None, end_id=None, ignore_and_rewrite_output_file=True,
    sleep_interval=0.001,
))

Metadata

Release files for jb_async_utils 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jb_async_utils 0.3.0
File Size Uploaded Provenance Actions
jb_async_utils-0.3.0.tar.gz 138.7 kB Without provenance Details for jb_async_utils-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for jb_async_utils 0.3.0
File Interpreter ABI Platform Actions
jb_async_utils-0.3.0-py3-none-any.whl Python 3 none any Details for jb_async_utils-0.3.0-py3-none-any.whl

Total release size: 168.7 kB

Release files / jb_async_utils-0.3.0.tar.gz

Download URL jb_async_utils-0.3.0.tar.gz
Size 138.7 kB
Tags Source
SHA-256 checksum
How to use checksums
72f525a2c86cefcb3d43a881056c005b24326a5cc9e3ff4c4fa939b2db80d11d
BLAKE2b-256 checksum
How to use checksums
c9608b586f55470402cc8459d1a48369655f499db16a8c8e40a3d0078704d816
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / jb_async_utils-0.3.0-py3-none-any.whl

Download URL jb_async_utils-0.3.0-py3-none-any.whl
Size 30.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8bbbbb1a662aafd5fb1b9a48054af73f6928c28e9ff5037c65e52bddaf3a3077
BLAKE2b-256 checksum
How to use checksums
788900346969ae29650bc59f170182d28604eeb42b34ee50e5dcd65ae73ea8d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for jb_async_utils 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page