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

Persistent caches use versioned JSON in stdlib SQLite, not pickle or DiskCache. Built-in provider response types and numeric NumPy arrays round-trip; custom dataclasses and Pydantic data models require dspy.configure_cache(safe_types=[...]). Register only trusted data types: model validation may invoke their validators. Unsupported values remain eligible for memory caching but are not persisted. restrict_pickle=False is rejected.

Storage lives under json-v1/ within the configured cache directory. Legacy pickle directories are left untouched and never read or migrated; old entries become misses. The size limit bounds logical entry costs (serialized values, keys and metadata), not the exact physical size of SQLite files. The latest configuration sets the shared budget for all instances and immediately evicts excess entries. Failed/oversized replacements invalidate the old entry rather than resurrecting stale responses. SQLite transactions coordinate threads and processes; eviction removes least-recently-used entries. Cache files cannot be symlinks/hard links; POSIX storage requires private app-owned paths, including safe parent directories. These protections do not defend against a compromised application account. Corrupt or unknown data become misses without payload logging. Explicit load_memory_cache(..., allow_pickle=True) remains a separate, unsafe opt-in API; persistent-cache reads never fall back to it.

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.post3

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.post3
File Size Uploaded Provenance Actions
dspy_lite-3.3.1.post3.tar.gz 355.6 kB With provenance Details for dspy_lite-3.3.1.post3.tar.gz

Built distribution (wheel)

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

Total release size: 782.5 kB

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

Download URL dspy_lite-3.3.1.post3.tar.gz
Size 355.6 kB
Tags Source
SHA-256 checksum
How to use checksums
93ca2aba37929cdaf5b602db526b2bb3cf355ee03b00c66d20a960850a81cfd8
BLAKE2b-256 checksum
How to use checksums
ad912a94a78f7aa72b1c8ac2249285910a385d3c755935d69e72c2f847ec07d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 31, 2026.

Transparency log

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

Download URL dspy_lite-3.3.1.post3-py3-none-any.whl
Size 427.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9fd730eb26104b276bdd9756234f709cf3d94b9f9ba54061eaa7328e9f4fb472
BLAKE2b-256 checksum
How to use checksums
9c42b0e9248693faef1d6a043ec0bfb966bccffb794446043abc21cbd1946b14
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 31, 2026.

Transparency log

Security for dspy-lite 3.3.1.post3

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for dspy_lite-3.3.1.post3.tar.gz

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 Oct 31, 2026.

Transparency log

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