dspic
Status: vibe-coded experiment. This project is exploratory and not production-quality. If it reaches
1.0, it means the code and API have been fully reviewed by qualified humans.
DSPIC is a DSPy-inspired library for foundation vision models. It uses typed signatures, adapters, and normalized request/response objects for vision models instead of language models.
Created by Maxime Rivest and Aurelie Guisnet.
Quick start
import dspic
sam = dspic.SAM21VM(endpoint="http://192.168.2.24:8078/v1/vision")
dspic.configure(vm=sam)
segment = dspic.Predict("image: Image, point: Point -> mask: Masks")
pred = segment(
image="image.png",
point=(48, 48),
)
mask = pred.mask
For remote servers, use image data, URLs, or paths the server can access.
Core ideas
VM: a vision model client, analogous to a DSPyLM.Predict: a DSPy-style module for typed vision signatures.ImageAdapter: routes signatures to one or more specialized VMs.demos: visual prompting examples, analogous to DSPy demos.
Signatures
String signatures:
segment = dspic.Predict("image: Image, point: Point -> mask: Masks")
Class signatures:
class Segment(dspic.Signature):
image: dspic.Image = dspic.InputField()
point: dspic.Point = dspic.InputField()
mask: dspic.Masks = dspic.OutputField()
segment = dspic.Predict(Segment)
Simple input types
image = "image.png"
point = (48, 48)
box = (10, 20, 100, 120)
These become normalized VM inputs:
Image->ImageInputPoint->PointPromptBox->BoxPromptMask->MaskPrompt
Common outputs:
MasksBoxesPointsTracksKeypointsRawText
Multiple VMs
Vision models are specialized, so one program can use several VMs:
program = dspic.Predict("image: Image, query: Text -> boxes: Boxes, mask: Masks")
pred = program(
image="image.png",
query="cat",
vm=[detector_vm, segmenter_vm],
)
Visual prompting demos
segment = dspic.Predict(
"image: Image, point: Point -> mask: Masks",
vm=sam,
demos=[{"image": "first-frame.png", "point": (100, 120)}],
)
pred = segment(image="current-frame.png", point=(130, 140))
SAM 2.1 integration test
If a SAM 2.1 server is running at the default endpoint, this test runs end to end:
uv run pytest tests/test_sam21_predict_integration.py
Default endpoint:
http://192.168.2.24:8078/v1/vision
Override it with:
export DSPIC_SAM21_ENDPOINT=http://your-server:8078/v1/vision
uv run pytest tests/test_sam21_predict_integration.py
Development
uv sync --dev
uv run pytest
uv run ruff check .
Metadata
Release files for dspic 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dspic-0.1.0.tar.gz | 84.7 kB | Without provenance | Details for dspic-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dspic-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for dspic-0.1.0-py3-none-any.whl |
Total release size: 116.8 kB
Release files / dspic-0.1.0.tar.gz
| Download URL | dspic-0.1.0.tar.gz |
|---|---|
| Size | 84.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
da81a99cbd12d41ed5b9fc5fd3c1b23ccdda92fa77422ec96aecd29c0534d41a
|
|
BLAKE2b-256 checksum How to use checksums |
f93cc6f41df2f3d74b76f7a81e270ffe923066343bd6d33f7f8bbe9ac9519486
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.3
|
Release files / dspic-0.1.0-py3-none-any.whl
| Download URL | dspic-0.1.0-py3-none-any.whl |
|---|---|
| Size | 32.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4b5df21cfd9fe107d68a1b8e9634b9b222abc7803858e929eb0dd0b4abe9a797
|
|
BLAKE2b-256 checksum How to use checksums |
81040c062d4d670f5fd4a3a8bae3ddd18866b82ba3dc0562007624fd41fac754
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.3
|
Security for dspic 0.1.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.