Skip to main content

dspy-lite

DSPy with litellm replaced by litelm and numpy made optional.

What this is

  • Same DSPy 3.3.1 -- signatures, modules (Predict, CoT, ReAct/ReActV2, RLM, Flex), 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
  • 85% smaller clean install (25 MB vs 171 MB, 34 packages vs 65)
  • 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[deno]          # managed Deno runtime for interpreters
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.

DSPy 3.3 APIs

This release includes DSPy 3.3.1's typed provider-neutral LM boundary, experimental ReActV2 and Flex, structured native tool-call history, interpreter isolation improvements, optional managed Deno runtime, and GEPA 0.1.4 integration. Review the upstream 3.3.0 and 3.3.1 notes for compatibility changes.

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 171 MB, 65 packages 25 MB, 34 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)

Metadata

Release files for dspy-lite 3.3.1.post2

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

Source distribution (sdist)

Source distribution for dspy-lite 3.3.1.post2
File Size Uploaded
dspy_lite-3.3.1.post2.tar.gz 352.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dspy-lite 3.3.1.post2
File Interpreter ABI Platform
dspy_lite-3.3.1.post2-py3-none-any.whl Python 3 none any Details

Total release size: 776.1 kB

Release files / dspy_lite-3.3.1.post2.tar.gz

Download URL dspy_lite-3.3.1.post2.tar.gz
Size 352.4 kB
Tags Source
SHA-256 checksum
How to use checksums
a889a28dcf4f6efb52078d6e73e5964a75d9567f2f742c49fb6c9f68474f3d24
BLAKE2b-256 checksum
How to use checksums
0a1a93c8b945641d94a15b2bb52c5e1f9289a1f3b9595625aeed0f0b78477433
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 19, 2026.

Transparency log

Release files / dspy_lite-3.3.1.post2-py3-none-any.whl

Download URL dspy_lite-3.3.1.post2-py3-none-any.whl
Size 423.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0ca38f1c5a6ea01e768c1e85cb6aa4943d51dec58b74b1b2811f2079295715da
BLAKE2b-256 checksum
How to use checksums
4fedd6f10d1b331cd7c27dd8e0a55a3da4bc0bc5e7231da167ddee3dea5d4af9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 19, 2026.

Transparency log
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