dspy-ruby

Build type-safe LLM applications with Ruby and Sorbet.

Updated Feb 16, 2026
One-click install
npx skills add https://github.com/praburajasekaran/ruthva-clinic-os --skill dspy-ruby-praburajasekaran
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dspy-ruby
Source: https://github.com/praburajasekaran/ruthva-clinic-os/tree/main/.gemini/skills/dspy-ruby
Command: npx skills add https://github.com/praburajasekaran/ruthva-clinic-os --skill dspy-ruby-praburajasekaran

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires dspy, ruby_llm, and includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

This Skill helps developers build type-safe language model applications with Ruby, offering a structured approach to implement AI features, configure providers, and optimize prompts.

Core Features & Use Cases

  • Type-safe Signatures: Define interfaces between applications and LLMs with Ruby types.
  • Modular Components: Use modular components for workflows like prediction, reasoning, and code generation.
  • Optimization: Apply advanced optimization techniques like multi-prompt optimization and genetic Pareto reflective prompt evolution.
  • Quick Start: Install the gem and configure your language model provider.

Quick Start

Install the dspy-ruby gem and configure your language model provider:

gem 'dspy'
DSPy.configure do |c|
  c.lm = DSPy::LM.new('openai/gpt-4o-mini', api_key: ENV['OPENAI_API_KEY'])
end

Frequently Asked Questions about dspy-ruby

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build type-safe LLM applications in Ruby?

You can build type-safe LLM applications in Ruby by defining interfaces between your application and the language model using Ruby types and Sorbet for type checking. This framework handles interface definition, modular component composition, and provider configuration.

Can I use RubyLLM to configure multiple LLM providers for predictive AI?

Yes, you can configure multiple LLM providers using RubyLLM within your Ruby application. The framework supports provider configuration for predictive AI, allowing you to set up models like openai/gpt-4o-mini directly through the configuration block.

What is the best way to define interfaces between my application and an LLM?

The best way to define LLM interfaces is by using type-safe signatures that specify Ruby types for inputs and outputs. This structured approach ensures predictable interactions for tasks like prediction, reasoning, and code generation.

Do I need Sorbet to use this Ruby prompt framework?

Yes, Sorbet is required for type checking when using this Ruby prompt framework. It enforces type safety across your LLM signatures and modular components, ensuring reliable application behavior.

How do I optimize prompts for AI application development in Ruby?

You optimize prompts for AI application development in Ruby by applying advanced techniques like multi-prompt optimization and genetic Pareto reflective prompt evolution. These methods refine predictive AI performance within modular component workflows.

What modular components are available for LLM workflows in Ruby?

Modular components for LLM workflows in Ruby include building blocks for prediction, reasoning, and code generation. These components compose together to handle complex agent systems and structured predictive tasks.