Metadata-Version: 2.5
Name: dspy-lite
Version: 3.3.1.post1
Summary: DSPy with litellm replaced by litelm and numpy made optional
Project-URL: Homepage, https://github.com/kennethwolters/dspy-lite
Project-URL: Repository, https://github.com/kennethwolters/dspy-lite
Project-URL: Issues, https://github.com/kennethwolters/dspy-lite/issues
Project-URL: Documentation, https://dspy.ai
Author: Kenneth Wolters
License: MIT License
        
        Copyright (c) 2023 Stanford Future Data Systems
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: ai,dspy,language-models,llm,prompt-optimization
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: <3.15,>=3.10
Requires-Dist: anyio==4.15.1
Requires-Dist: cachetools==7.1.8
Requires-Dist: cloudpickle==3.1.2
Requires-Dist: diskcache==5.6.3
Requires-Dist: gepa[dspy]==0.1.4
Requires-Dist: json-repair==0.63.4
Requires-Dist: jsonschema==4.26.0
Requires-Dist: litelm==0.5.1
Requires-Dist: openai==1.88.0
Requires-Dist: orjson==3.12.0
Requires-Dist: pydantic==2.13.5
Requires-Dist: regex==2026.9.10
Requires-Dist: requests==2.34.2
Requires-Dist: tqdm==4.70.1
Provides-Extra: all
Requires-Dist: deno==2.9.6; extra == 'all'
Requires-Dist: litelm[anthropic]==0.5.1; extra == 'all'
Requires-Dist: litelm[bedrock]==0.5.1; extra == 'all'
Requires-Dist: litelm[cloudflare]==0.5.1; extra == 'all'
Requires-Dist: numpy==2.2.6; (python_version == '3.10') and extra == 'all'
Requires-Dist: numpy==2.4.6; (python_version == '3.11') and extra == 'all'
Requires-Dist: numpy==2.5.3; (python_version >= '3.12' and python_version < '3.15') and extra == 'all'
Provides-Extra: anthropic
Requires-Dist: litelm[anthropic]==0.5.1; extra == 'anthropic'
Provides-Extra: bedrock
Requires-Dist: litelm[bedrock]==0.5.1; extra == 'bedrock'
Provides-Extra: cloudflare
Requires-Dist: litelm[cloudflare]==0.5.1; extra == 'cloudflare'
Provides-Extra: deno
Requires-Dist: deno==2.9.6; extra == 'deno'
Provides-Extra: dev
Requires-Dist: build==1.6.0; extra == 'dev'
Requires-Dist: datamodel-code-generator==0.79.0; extra == 'dev'
Requires-Dist: litelm==0.5.1; extra == 'dev'
Requires-Dist: pillow==12.3.0; extra == 'dev'
Requires-Dist: pip-audit==2.10.1; extra == 'dev'
Requires-Dist: pre-commit==4.6.2; extra == 'dev'
Requires-Dist: pytest-asyncio==1.4.0; extra == 'dev'
Requires-Dist: pytest-mock==3.15.1; extra == 'dev'
Requires-Dist: pytest-timeout==2.4.0; extra == 'dev'
Requires-Dist: pytest==9.0.3; extra == 'dev'
Requires-Dist: ruff==0.16.7; extra == 'dev'
Provides-Extra: embeddings
Requires-Dist: numpy==2.2.6; (python_version == '3.10') and extra == 'embeddings'
Requires-Dist: numpy==2.4.6; (python_version == '3.11') and extra == 'embeddings'
Requires-Dist: numpy==2.5.3; (python_version >= '3.12' and python_version < '3.15') and extra == 'embeddings'
Provides-Extra: langchain
Requires-Dist: langchain-core==1.6.2; extra == 'langchain'
Provides-Extra: mcp
Requires-Dist: mcp==2.2.0; (python_version >= '3.10') and extra == 'mcp'
Provides-Extra: optuna
Requires-Dist: optuna==5.0.0; extra == 'optuna'
Provides-Extra: test-extras
Requires-Dist: datasets==5.0.1; extra == 'test-extras'
Requires-Dist: langchain-core==1.6.2; extra == 'test-extras'
Requires-Dist: mcp==2.2.0; (python_version >= '3.10') and extra == 'test-extras'
Requires-Dist: optuna==5.0.0; extra == 'test-extras'
Requires-Dist: pandas==2.3.3; (python_version == '3.10') and extra == 'test-extras'
Requires-Dist: pandas==3.0.5; (python_version >= '3.11' and python_version < '3.15') and extra == 'test-extras'
Provides-Extra: weaviate
Requires-Dist: weaviate-client==4.23.1; extra == 'weaviate'
Description-Content-Type: text/markdown

# dspy-lite

DSPy with [litellm](https://github.com/BerriAI/litellm) replaced by [litelm](https://github.com/kennethwolters/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](https://github.com/kennethwolters/dspy-lite/issues/3) (CVE-2026-33634) — zero litellm code or dependencies

## Install

```bash
pip install dspy-lite
```

Supported Python versions: 3.10 through 3.14.

With provider extras:

```bash
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

```python
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:

```python
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](https://github.com/stanfordnlp/dspy/releases/tag/3.3.0) and [3.3.1](https://github.com/stanfordnlp/dspy/releases/tag/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](https://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)
