dspy-ruby

Program LLMs with type-safe, composable Ruby modules.

12|2|Updated Jan 27, 2026
One-click install
npx skills add https://github.com/jikig-ai/soleur --skill dspy-ruby-jikig-ai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dspy-ruby
Source: https://github.com/jikig-ai/soleur/tree/main/plugins/soleur/skills/dspy-ruby
Command: npx skills add https://github.com/jikig-ai/soleur --skill dspy-ruby-jikig-ai

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) and assets (resource) components.

What problem does it solve?

Many Ruby applications rely on brittle prompt engineering and ad-hoc LLM calls that are hard to test, version, and maintain; DSPy.rb replaces that by letting developers program LLM behavior with type-safe signatures and composable modules to produce reliable, testable AI features.

Core Features & Use Cases

  • Type-safe Signatures: Define clear input/output contracts with runtime validation for extraction, classification, code generation, and multimodal tasks.
  • Composable Modules & Predictors: Build reusable modules and pipelines using Predict, ChainOfThought, ReAct, and CodeAct for tasks like email triage, document analysis, and agent workflows.
  • Provider Configuration & Observability: Templates for OpenAI, Anthropic, Gemini, Ollama, and OpenRouter plus examples for OpenTelemetry and Langfuse tracing, testing patterns, optimization (MIPROv2), and deployment best practices.
  • Use Case Example: Implement an EmailClassification pipeline with a signature, a classifier module, ChainOfThought reasoning for difficult cases, and RSpec tests with mocked LLM responses.

Quick Start

Create an EmailClassification signature, implement a DSPy module that classifies support emails, and configure DSPy to use a local Ollama model or an OpenAI key for testing.

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 pipelines in Ruby without brittle prompt engineering?

You can build type-safe LLM pipelines in Ruby by defining signatures with runtime validation and composing modules like Predict or ChainOfThought. This replaces ad-hoc prompts with testable, maintainable AI features.

What is the best way to structure LLM agent workflows in a Ruby application?

The best way to structure LLM agent workflows in Ruby is using composable modules like ReAct and CodeAct. These allow you to chain reasoning steps and tool usage into reliable, testable pipelines.

How do I test LLM classification modules in Ruby with mocked responses?

You test LLM classification modules in Ruby using RSpec testing patterns with mocked LLM responses. This enables reliable validation of signature contracts and module behavior without live API calls.

Can I configure multiple LLM providers like OpenAI and Ollama for a Ruby AI application?

You can configure multiple LLM providers like OpenAI, Anthropic, Gemini, and Ollama for Ruby AI applications. Provider configuration templates allow switching between cloud and local models seamlessly.

How do I add observability and tracing to LLM agents in Ruby?

You add observability and tracing to LLM agents in Ruby using OpenTelemetry and Langfuse integration examples. These tools provide visibility into module execution and pipeline behavior for production deployments.

When should I use ChainOfThought instead of Predict for LLM tasks in Ruby?

Use ChainOfThought instead of Predict for complex LLM tasks in Ruby when reasoning is required before producing output, such as difficult email classification cases. Predict handles straightforward signature execution directly.