Skip to main content

dspy-lite

DSPy with litellm replaced by litelm and numpy made optional.

What this is

  • Same DSPy 3.2.1 -- signatures, modules (Predict, CoT, ReAct), optimizers (Bootstrap, MIPRO, SIMBA, GEPA, GRPO)
  • litellm (100k+ LOC, 70+ transitive deps) replaced by litelm (2.6k LOC, 2 deps)
  • numpy moved from core dep to optional [embeddings] extra
  • 83% smaller clean install (24 MB vs 144 MB, 36 packages vs 67)
  • Unaffected by the litellm supply chain compromise (CVE-2026-33634) — zero litellm code or dependencies

Install

pip install dspy-lite

Supported Python versions: 3.10 through 3.14.

With provider extras:

pip install dspy-lite[anthropic]     # Anthropic
pip install dspy-lite[bedrock]       # AWS Bedrock
pip install dspy-lite[embeddings]    # numpy for embeddings
pip install dspy-lite[all]           # everything

Usage

import dspy

lm = dspy.LM("openai/gpt-4o-mini")
dspy.configure(lm=lm)

predict = dspy.Predict("question -> answer")
result = predict(question="What is DSPy?")
print(result.answer)

Everything from DSPy works -- the import is still import dspy.

Loading images, audio, and files

Resource validation never reads the filesystem or network implicitly. Load resources explicitly:

image = dspy.Image.from_path("./image.png")
image = dspy.Image.from_url("https://example.com/image.png")  # explicit network request
image_reference = dspy.Image("https://example.com/image.png")  # provider-fetched URL; no local request

audio = dspy.Audio.from_path("./audio.wav")
file = dspy.File.from_path("./document.pdf")

Applications must validate or allowlist untrusted URLs before calling from_url(); explicit downloads do not provide SSRF filtering.

Disk-cache safety

Disk caches use restricted pickle deserialization by default. Custom cached classes must be registered with dspy.configure_cache(safe_types=[...]). Setting restrict_pickle=False restores unrestricted pickle compatibility, emits a warning, and must only be used when the cache directory is fully trusted. Unsafe or incompatible legacy entries are treated as cache misses rather than retried with unrestricted deserialization.

What changed from DSPy

DSPy dspy-lite
LM routing litellm (34 MB, 201k LOC) litelm (87 KB, 2.6k LOC)
numpy core dep (60 MB) optional [embeddings]
Clean install size 144 MB, 67 packages 24 MB, 36 packages
API unchanged unchanged

Documentation

Full DSPy documentation: dspy.ai

Development disclosure

This project is maintained with AI-assisted coding. Through 2026-05-14, I used Claude Code with Claude Opus 4.6/4.7. As of 2026-05-14, I use pi with GPT-5.5. The human maintainer remains responsible for what is merged and released.

License

MIT (inherited from DSPy)

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dspy_lite-3.2.1.post2.tar.gz (273.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dspy_lite-3.2.1.post2-py3-none-any.whl (336.2 kB view details)

Uploaded Python 3

File details

Details for the file dspy_lite-3.2.1.post2.tar.gz.

File metadata

  • Download URL: dspy_lite-3.2.1.post2.tar.gz
  • Upload date:
  • Size: 273.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for dspy_lite-3.2.1.post2.tar.gz
Algorithm Hash digest
SHA256 3b8ccb11c2a3028eea5f41ae6536730fd9c7fd12ce7c38357fc4f10fd60600c3
MD5 17519b3b8d7275a13c000b1b0fdf958c
BLAKE2b-256 e9aa77aff4642f193f537579a8a750987ecda21a15424be41b1f96ab2d692270

See more details on using hashes here.

Provenance

The following attestation bundles were made for dspy_lite-3.2.1.post2.tar.gz:

Publisher: publish.yml on kennethwolters/dspy-lite

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dspy_lite-3.2.1.post2-py3-none-any.whl.

File metadata

  • Download URL: dspy_lite-3.2.1.post2-py3-none-any.whl
  • Upload date:
  • Size: 336.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for dspy_lite-3.2.1.post2-py3-none-any.whl
Algorithm Hash digest
SHA256 adf74e2da8067b523050517d208b49b33e622b887dc3003879b49b51af63c460
MD5 0a60b95df86f3cb648947255eaa63ef7
BLAKE2b-256 dad52e65762de785800c5f51ee2825d11bb47701291c4492456f79805172ecc6

See more details on using hashes here.

Provenance

The following attestation bundles were made for dspy_lite-3.2.1.post2-py3-none-any.whl:

Publisher: publish.yml on kennethwolters/dspy-lite

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

3.3.1.post1

2 files

This release

3.2.1.post2 This release

2 files

3.2.1.post1

2 files

3.1.3.post7

2 files

3.1.3.post6

2 files

3.1.3.post5

2 files

3.1.3.post4

2 files

3.1.3.post3

2 files

3.1.3.post2

2 files

3.1.3.post1

2 files

3.1.3

2 files

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