What problem does it solve?
DSPy.rb provides a Ruby-centric framework to program LLMs by defining type-safe signatures and modular workflows, replacing scattered ad-hoc prompts with maintainable code-based contracts.
Core Features & Use Cases
- Type-safe Signatures: Define input/output contracts with runtime validation to guard LLM outputs.
- Composable Modules: Build pipelines by chaining signatures and modules to implement complex tasks.
- Provider Configuration & Multimodal Support: Configure OpenAI, Google Gemini, Ollama, and other providers; support multimodal inputs via DSPy::Image where available.
- Testing & Observability: Easy RSpec tests, VCR fixtures, and instrumentation for monitoring and observability.
- Agent Systems with Tools: Create agents that utilize tools via ReAct-style patterns for external data.
Quick Start
Install the DSPy.rb gem and a provider adapter, configure a provider with your API key, create a signature class, implement a module, instantiate it, and call forward to run an LLM-driven task.