SilkLoom Core: DataFrame-first batch runner for LLM and VLM workloads
Project description
SilkLoom Core
SilkLoom Core is a DataFrame-first batch runner for OpenAI-compatible LLM and VLM workloads.
Its core shape is:
indexed data -> selected input columns -> model calls -> repaired JSON -> wider DataFrame
Install
pip install silkloom-core
Quick Start
import pandas as pd
from silkloom_core import Loom
df = pd.read_csv("papers.csv")
loom = Loom(
model="gpt-4o-mini",
prompt="""
Analyze this paper and return JSON only.
Title: {{ title }}
Abstract: {{ abstract }}
Return keys: sentiment, summary, keywords.
""",
)
df = loom(
df,
input=["title", "abstract"],
resume="paper_analysis_v1",
concurrency=10,
)
df.to_csv("papers_with_analysis.csv", index=False)
The returned DataFrame keeps the original index and columns, then appends model output columns.
Inputs
Use a pandas DataFrame:
out = loom(df, input=["title", "abstract"])
Or a sequence of row mappings:
out = loom(
[
{"text": "The experiment is promising."},
{"text": "The evaluation is incomplete."},
],
input="text",
)
The output is always a pandas DataFrame.
Output
By default, SilkLoom expects JSON object output and expands its keys into columns.
loom = Loom(
model="gpt-4o-mini",
prompt="Classify this text and return JSON with keys label and score: {{ text }}",
)
out = loom(df, input="text")
If the model returns:
{"label": "positive", "score": 0.92}
SilkLoom appends:
label | score
Malformed JSON is repaired with json_repair.repair_json(..., return_objects=True).
Status Columns
SilkLoom appends status columns by default:
_loom_ok
_loom_error
_loom_checkpoint
_loom_attempts
You can also include raw model output and extracted reasoning:
out = loom(
df,
input="text",
include_output=True,
include_reasoning=True,
)
This adds:
_loom_output
_loom_reasoning
Disable status columns with:
out = loom(df, input="text", status=False)
Resumable Runs
Pass resume to enable SQLite checkpointing. SQLite is the default checkpoint backend.
out = loom(
df,
input=["title", "abstract"],
resume="paper_analysis_v1",
concurrency=10,
)
The checkpoint fingerprint includes the selected row input, model, prompt, system message, output schema, and model parameters.
Each SQLite row stores a self-describing JSON payload with:
- SilkLoom version
- resume namespace
- model, prompt, system message, model parameters, retry settings, and JSON repair setting
- selected input columns and image columns
- normalized row input, including resolved
images - rendered OpenAI-compatible message payload
- parsed JSON result
- raw model output, extracted reasoning, error trace, attempt count, and checkpoint status
To disable checkpointing:
loom = Loom(..., checkpoint=None)
Column Conflicts
If model output columns conflict with existing DataFrame columns, SilkLoom raises. Use prefix when you want to keep both.
out = loom(df, input="text", prefix="llm_")
Images
If an input row contains an images column, SilkLoom builds a multimodal OpenAI-compatible message. HTTP(S) and data:image/... URLs are passed through. Local files are converted to base64 data URLs.
df = pd.DataFrame(
{
"instruction": ["Extract menu item names and prices."],
"images": [["./receipt.jpg"]],
}
)
out = loom(df, input="instruction", images="images")
You can also pass multiple image columns:
out = loom(df, input="instruction", images=["front_image", "back_image"])
Custom Clients
By default, Loom creates OpenAI SDK clients. You can also pass an existing OpenAI-compatible client:
from openai import OpenAI
from silkloom_core import Loom
client = OpenAI(base_url="https://api.example.com/v1", api_key="...")
loom = Loom(
model="provider-model",
prompt="{{ text }}",
client=client,
)
For full control, pass an object that implements:
class MyClient:
def complete(self, *, model, messages, params) -> str: ...
async def acomplete(self, *, model, messages, params) -> str: ...
def close(self) -> None: ...
async def aclose(self) -> None: ...
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file silkloom_core-5.0.0.tar.gz.
File metadata
- Download URL: silkloom_core-5.0.0.tar.gz
- Upload date:
- Size: 14.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e5792bfe66c3c5c2bd75670c479ba7ddc80a1484a57867cf87848d2b39adc7e6
|
|
| MD5 |
17c061ca7f402d0ae079692a75fc96bf
|
|
| BLAKE2b-256 |
0c9fcee1d99f7e8e967c5f4c6cd057643f19871e7a7f2b3e18c0295b887a72aa
|
Provenance
The following attestation bundles were made for silkloom_core-5.0.0.tar.gz:
Publisher:
publish.yml on LeLiu-GeoAI/silkloom-core
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
silkloom_core-5.0.0.tar.gz -
Subject digest:
e5792bfe66c3c5c2bd75670c479ba7ddc80a1484a57867cf87848d2b39adc7e6 - Sigstore transparency entry: 1760534927
- Sigstore integration time:
-
Permalink:
LeLiu-GeoAI/silkloom-core@fd8f997172647f6e40a31c8c8d3bf631a0f69c3b -
Branch / Tag:
refs/tags/v5.0.1 - Owner: https://github.com/LeLiu-GeoAI
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@fd8f997172647f6e40a31c8c8d3bf631a0f69c3b -
Trigger Event:
push
-
Statement type:
File details
Details for the file silkloom_core-5.0.0-py3-none-any.whl.
File metadata
- Download URL: silkloom_core-5.0.0-py3-none-any.whl
- Upload date:
- Size: 12.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8131fda42e462a18fb7d2dbf3675ec4463ee018c904ec6e4f1e3f0e44decda12
|
|
| MD5 |
5c44c2530ecf81a94630cf98587ce2ce
|
|
| BLAKE2b-256 |
cf15806830e293651b05d38f56135297bfdce6b08bb147740b38a602e35118e1
|
Provenance
The following attestation bundles were made for silkloom_core-5.0.0-py3-none-any.whl:
Publisher:
publish.yml on LeLiu-GeoAI/silkloom-core
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
silkloom_core-5.0.0-py3-none-any.whl -
Subject digest:
8131fda42e462a18fb7d2dbf3675ec4463ee018c904ec6e4f1e3f0e44decda12 - Sigstore transparency entry: 1760535039
- Sigstore integration time:
-
Permalink:
LeLiu-GeoAI/silkloom-core@fd8f997172647f6e40a31c8c8d3bf631a0f69c3b -
Branch / Tag:
refs/tags/v5.0.1 - Owner: https://github.com/LeLiu-GeoAI
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@fd8f997172647f6e40a31c8c8d3bf631a0f69c3b -
Trigger Event:
push
-
Statement type: