DSRs
A high-performance DSPy rewrite in Rust for building LLM-powered applications
๐ Overview
DSRs (DSPy Rust) is a ground-up rewrite of the DSPy framework in Rust, designed for building robust, high-performance applications powered by Language Models. Unlike a simple port, DSRs leverages Rust's type system, memory safety, and concurrency features to provide a more efficient and reliable foundation for LLM applications.
๐ฆ Installation
Add DSRs to your Cargo.toml
:
[]
= "0.0.1-beta"
Or use cargo:
๐ง Quick Start
Here's a simple example to get you started:
use *;
use HashMap;
use IndexMap;
async
๐งช Testing
Run the test suite:
# All tests
# Specific test
# With output
๐ Project Status
โ ๏ธ Early Development - DSRs is actively being developed. The API may change between versions.
Core Framework
- Implement core DSPy abstractions
-
Signature
trait and basic implementations (file created:src/premitives/signature.rs
) -
Module
trait system (file created:src/premitives/module.rs
) -
Example
type (implemented insrc/data/example.rs
) -
Prediction
type withLmUsage
tracking (implemented insrc/data/prediction.rs
) - Field types and validation (file created:
src/premitives/field.rs
) - Serialization support (serde integration)
-
- Implement language model abstractions
- LM trait (file created:
src/premitives/lm.rs
)
- LM trait (file created:
- Implement basic modules (files created but empty)
-
Predict
module (src/programs/predict.rs
) -
ChainOfThought
module (src/programs/cot.rs
)
-
LM Integrations
- Litellm-like client[Going with open router]
Data Management
- Basic data structures (
Example
,Prediction
) - Dataset loading and management
Performance Optimizations
- Implement zero-copy parsing where possible[optim clean up]
- Rayon dependency added for parallel execution
- Batch processing for LM calls
๐ License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
๐ Acknowledgments
- Inspired by the original DSPy framework
- Built with the amazing Rust ecosystem
Documentation โข Examples โข Issues โข Discussions