Skip to main content

BioLM AI

https://img.shields.io/pypi/v/biolmai.svg https://api.travis-ci.com/BioLM/py-biolm.svg?branch=production Documentation Status

Python client and SDK for BioLM

Install the package:

pip install biolmai

Basic usage:

from biolmai import biolm

# Encode a single sequence
result = biolm(entity="esm2-8m", action="encode", type="sequence", items="MSILVTRPSPAGEEL")

# Predict a batch of sequences
result = biolm(entity="esmfold", action="predict", type="sequence", items=["SEQ1", "SEQ2"])

# Write results to disk
biolm(entity="esmfold", action="predict", type="sequence", items=["SEQ1", "SEQ2"], output='disk', file_path="results.jsonl")

Asynchronous usage:

from biolmai.core.http import BioLMApiClient
import asyncio

async def main():
    model = BioLMApiClient("esmfold")
    result = await model.predict(items=[{"sequence": "MDNELE"}])
    print(result)

asyncio.run(main())

Overview

The BioLM Python client provides a high-level, user-friendly interface for interacting with the BioLM API. It supports both synchronous and asynchronous usage, automatic batching, flexible error handling, and efficient processing of biological data.

Main features:

  • High-level BioLM constructor for quick requests

  • Sync and async interfaces

  • Automatic or custom rate limiting/throttling

  • Schema-based batch size detection

  • Flexible input formats (single key + list, or list of dicts)

  • Low memory usage via generators

  • Flexible error handling (raise, continue, or stop on error)

  • Universal HTTP client for both sync and async

Features

  • High-level constructor: Instantly run an API call with a single line.

  • Sync and async: Use BioLM for sync, or BioLMApiClient for async.

  • Flexible rate limiting: Use API throttle, disable, or set your own (e.g., ‘1000/second’).

  • Schema-based batching: Automatically queries API for max batch size.

  • Flexible input: Accepts a single key and list, or list of dicts, or list of lists for advanced batching.

  • Low memory: Uses generators for validation and batching.

  • Error handling: Raise HTTPX errors, continue on error, or stop on first error.

  • Disk output: Write results as JSONL to disk.

  • Universal HTTP client: Efficient for both sync and async.

  • Direct access to schema and batching: Use BioLMApi for advanced workflows, including .schema(), .call(), and ._batch_call_autoschema_or_manual().

Example endpoints and actions:

  • esm2-8m/encode: Embedding for protein sequences.

  • esmfold/predict: Structure prediction for protein sequences.

  • progen2-oas/generate: Sequence generation from a context string.

  • dnabert2/predict: Masked prediction for protein sequences.

  • ablang2/encode: Embeddings for paired-chain antibodies.

Metadata

Release files for biolmai 0.4.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 biolmai 0.4.0
File Size Uploaded Provenance Actions
biolmai-0.4.0.tar.gz 2.4 MB Without provenance Details for biolmai-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for biolmai 0.4.0
File Interpreter ABI Platform Actions
biolmai-0.4.0-py2.py3-none-any.whl Python 2, Python 3 none any Details for biolmai-0.4.0-py2.py3-none-any.whl

Total release size: 2.5 MB

Release files / biolmai-0.4.0.tar.gz

Download URL biolmai-0.4.0.tar.gz
Size 2.4 MB
Tags Source
SHA-256 checksum
How to use checksums
7577c9de85e1f8c6df7dc31cbacca63342f49a59ea33fd6cc0936e00eda7b646
BLAKE2b-256 checksum
How to use checksums
98f019788ae5a44535ed12a5d3adb0960d0084e6f5f48a26be25b1aa17724832
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.19

Release files / biolmai-0.4.0-py2.py3-none-any.whl

Download URL biolmai-0.4.0-py2.py3-none-any.whl
Size 114.5 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
f4768080463c278e8984eafc161ddebe2474a8f8fbf424987fadb795b012d06e
BLAKE2b-256 checksum
How to use checksums
d3b7eba172d7381be14b48f43dd5808d96b9f372e8e6efcb0c8d06d0217388ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.19

Security for biolmai 0.4.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