Discover and explore top open-source AI tools and projects—updated daily.
ruvnetTypeScript framework for declarative AI systems
Top 99.0% on SourcePulse
DSPy.ts brings Stanford's DSPy framework to TypeScript, enabling developers to program AI systems declaratively rather than solely relying on manual prompt engineering. It targets developers building complex AI applications who need robust, optimizable, and type-safe language model interactions. The primary benefit is automating the tuning of prompts and demonstrations, leading to more efficient and effective AI systems, with all memory and caching operations powered by the AgentDB backend.
How It Works
DSPy.ts operates on a principle of declarative programming for AI. Users define signatures which are typed input-output specifications for LM calls. These signatures are then composed into modules (e.g., PredictModule, ChainOfThought, ReAct, RetrieveModule) and pipelines. Optimizers like BootstrapFewShot, MIPROv2, and GEPA take a metric and a training set to automatically tune the underlying prompts and demonstrations, producing an OptimizedModule. Crucially, DSPy.ts is built "AgentDB-first," meaning vector indexing, memory, and caching leverage AgentDB's capabilities, including HNSW search, RaBitQ quantization, and hierarchical storage, allowing learned experiences to persist across compilation runs.
Quick Start & Requirements
npm install dspy.tsexamples/ directory, executable via npx ts-node examples/ /index.ts.npm run docs.Highlighted Details
Predict, ChainOfThought, ReAct, Retrieve, Pipeline) ensure end-to-end type safety.BootstrapFewShot, MIPROv2, and GEPA reduce manual prompt engineering.GEPA offers genetic-Pareto prompt evolution with reflection and mutation for prompt candidates.MIPROv2 allows subsequent compilations to warm-start from previous learning.RetrieveModule over AgentDB.ReAct modules support reflexion for episodic memory and skill promotion.ReasoningBank.CachingLM offers a fuzzy cache for LM responses based on vector similarity.CompilationTracer for detailed run tracking and optional MLflow integration.Maintenance & Community
The project is built by rUv. Community links such as Discord or Slack are not explicitly mentioned in the README. The issue tracker on GitHub serves as the primary point for roadmap and known limitations: github.com/ruvnet/dspy.ts/issues.
Licensing & Compatibility
The project is released under the MIT license. This license is permissive and generally allows for commercial use, modification, and distribution, including within closed-source applications.
Limitations & Caveats
Current limitations include the need for a dedicated tokenizer and autoregressive decode loop for ONNX generate() output. AgentDB's HNSW search is currently a JavaScript cosine scan rather than a WASM-backed KNN implementation. Direct delegation to certain AgentDB memory classes requires a sql.js db handle not yet exposed by AgentDBClient. Further development is planned for Bayesian surrogates in optimizers and broader test coverage. The linting setup requires migration to ESLint 9 flat-config.
4 days ago
Inactive
microsoft