gepa 1.0.2 β 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +140 -212
- data/lib/gepa/version.rb +1 -1
- metadata +9 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bc4700326507d46b22d96df097707fc40f32ba628bddbadcd6a3b072b8f70199
|
|
4
|
+
data.tar.gz: 8dba84dec0525f8bc5ee68b1c782c2e7b97e12c909291edb9a110b03779c20d7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fe185eba2c4d3319ca79a9f9c5318563cc7f1efa6de4ef235020225f1fa9c3a8a1b2bb490881c31af811b4f3ed927a4705603bf8f22b0306830e29e98a08421b
|
|
7
|
+
data.tar.gz: 7f8ebfdf2a442209eed04ef4179239ff2d43be24e3b7779a5eb30ad0dd81022cd03406cdaa1fd6a506382c043cafc45c6437d8a83ac50333111c59acb1863a3b
|
data/README.md
CHANGED
|
@@ -3,59 +3,98 @@
|
|
|
3
3
|
[](https://rubygems.org/gems/dspy)
|
|
4
4
|
[](https://rubygems.org/gems/dspy)
|
|
5
5
|
[](https://github.com/vicentereig/dspy.rb/actions/workflows/ruby.yml)
|
|
6
|
-
[](https://oss.vicente.services/dspy.rb/)
|
|
7
7
|
[](https://discord.gg/zWBhrMqn)
|
|
8
8
|
|
|
9
|
-
> [!NOTE]
|
|
10
|
-
> The core Prompt Engineering Framework is production-ready with
|
|
11
|
-
> comprehensive documentation. I am focusing now on educational content on systematic Prompt Optimization and Context Engineering.
|
|
12
|
-
> Your feedback is invaluable. if you encounter issues, please open an [issue](https://github.com/vicentereig/dspy.rb/issues). If you have suggestions, open a [new thread](https://github.com/vicentereig/dspy.rb/discussions).
|
|
13
|
-
>
|
|
14
|
-
> If you want to contribute, feel free to reach out to me to coordinate efforts: hey at vicente.services
|
|
15
|
-
>
|
|
16
|
-
|
|
17
9
|
**Build reliable LLM applications in idiomatic Ruby using composable, type-safe modules.**
|
|
18
10
|
|
|
19
|
-
DSPy.rb is the Ruby
|
|
11
|
+
DSPy.rb is the Ruby port of Stanford's [DSPy](https://dspy.ai). Instead of wrestling with brittle prompt strings, you define typed signatures and let the framework handle the rest. Prompts become functions. LLM calls become predictable.
|
|
12
|
+
The `1.x` line is the stable release track for production Ruby LLM applications.
|
|
20
13
|
|
|
21
|
-
|
|
14
|
+
```ruby
|
|
15
|
+
require 'dspy'
|
|
22
16
|
|
|
23
|
-
|
|
17
|
+
DSPy.configure do |c|
|
|
18
|
+
c.lm = DSPy::LM.new('openai/gpt-4o-mini', api_key: ENV['OPENAI_API_KEY'])
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
class Summarize < DSPy::Signature
|
|
22
|
+
description "Summarize the given text in one sentence."
|
|
23
|
+
|
|
24
|
+
input do
|
|
25
|
+
const :text, String
|
|
26
|
+
end
|
|
24
27
|
|
|
25
|
-
|
|
28
|
+
output do
|
|
29
|
+
const :summary, String
|
|
30
|
+
end
|
|
31
|
+
end
|
|
26
32
|
|
|
27
|
-
|
|
33
|
+
summarizer = DSPy::Predict.new(Summarize)
|
|
34
|
+
result = summarizer.call(text: "DSPy.rb brings structured LLM programming to Ruby...")
|
|
35
|
+
puts result.summary
|
|
36
|
+
```
|
|
28
37
|
|
|
29
|
-
|
|
30
|
-
### Installation
|
|
38
|
+
That's it. No prompt templates. No JSON parsing. No prayer-based error handling.
|
|
31
39
|
|
|
32
|
-
|
|
40
|
+
## Installation
|
|
33
41
|
|
|
34
42
|
```ruby
|
|
43
|
+
# Gemfile
|
|
35
44
|
gem 'dspy'
|
|
45
|
+
gem 'dspy-openai' # For OpenAI, OpenRouter, or Ollama
|
|
46
|
+
# gem 'dspy-anthropic' # For Claude
|
|
47
|
+
# gem 'dspy-gemini' # For Gemini
|
|
48
|
+
# gem 'dspy-ruby_llm' # For 12+ providers via RubyLLM
|
|
36
49
|
```
|
|
37
50
|
|
|
38
|
-
and
|
|
39
|
-
|
|
40
51
|
```bash
|
|
41
52
|
bundle install
|
|
42
53
|
```
|
|
43
54
|
|
|
44
|
-
|
|
55
|
+
## Quick Start
|
|
45
56
|
|
|
46
|
-
|
|
47
|
-
require 'dspy'
|
|
57
|
+
### Configure Your LLM
|
|
48
58
|
|
|
49
|
-
|
|
59
|
+
```ruby
|
|
60
|
+
# OpenAI
|
|
50
61
|
DSPy.configure do |c|
|
|
51
62
|
c.lm = DSPy::LM.new('openai/gpt-4o-mini',
|
|
52
63
|
api_key: ENV['OPENAI_API_KEY'],
|
|
53
|
-
structured_outputs: true)
|
|
64
|
+
structured_outputs: true)
|
|
54
65
|
end
|
|
55
66
|
|
|
56
|
-
#
|
|
67
|
+
# Anthropic Claude
|
|
68
|
+
DSPy.configure do |c|
|
|
69
|
+
c.lm = DSPy::LM.new('anthropic/claude-sonnet-4-20250514',
|
|
70
|
+
api_key: ENV['ANTHROPIC_API_KEY'])
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Google Gemini
|
|
74
|
+
DSPy.configure do |c|
|
|
75
|
+
c.lm = DSPy::LM.new('gemini/gemini-2.5-flash',
|
|
76
|
+
api_key: ENV['GEMINI_API_KEY'])
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# Ollama (local, free)
|
|
80
|
+
DSPy.configure do |c|
|
|
81
|
+
c.lm = DSPy::LM.new('ollama/llama3.2')
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# OpenRouter (200+ models)
|
|
85
|
+
DSPy.configure do |c|
|
|
86
|
+
c.lm = DSPy::LM.new('openrouter/deepseek/deepseek-chat-v3.1:free',
|
|
87
|
+
api_key: ENV['OPENROUTER_API_KEY'])
|
|
88
|
+
end
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Define a Signature
|
|
92
|
+
|
|
93
|
+
Signatures are typed contracts for LLM operations. Define inputs, outputs, and let DSPy handle the prompt:
|
|
94
|
+
|
|
95
|
+
```ruby
|
|
57
96
|
class Classify < DSPy::Signature
|
|
58
|
-
description "Classify sentiment of a given sentence."
|
|
97
|
+
description "Classify sentiment of a given sentence."
|
|
59
98
|
|
|
60
99
|
class Sentiment < T::Enum
|
|
61
100
|
enums do
|
|
@@ -64,233 +103,122 @@ class Classify < DSPy::Signature
|
|
|
64
103
|
Neutral = new('neutral')
|
|
65
104
|
end
|
|
66
105
|
end
|
|
67
|
-
|
|
68
|
-
# Structured Inputs: makes sure you are sending only valid prompt inputs to your model
|
|
106
|
+
|
|
69
107
|
input do
|
|
70
108
|
const :sentence, String, description: 'The sentence to analyze'
|
|
71
109
|
end
|
|
72
110
|
|
|
73
|
-
# Structured Outputs: your predictor will validate the output of the model too.
|
|
74
111
|
output do
|
|
75
|
-
const :sentiment, Sentiment
|
|
76
|
-
const :confidence, Float
|
|
112
|
+
const :sentiment, Sentiment
|
|
113
|
+
const :confidence, Float
|
|
77
114
|
end
|
|
78
115
|
end
|
|
79
116
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
# it may raise an error if you mess the inputs or your LLM messes the outputs.
|
|
83
|
-
result = classify.call(sentence: "This book was super fun to read!")
|
|
117
|
+
classifier = DSPy::Predict.new(Classify)
|
|
118
|
+
result = classifier.call(sentence: "This book was super fun to read!")
|
|
84
119
|
|
|
85
|
-
|
|
86
|
-
|
|
120
|
+
result.sentiment # => #<Sentiment::Positive>
|
|
121
|
+
result.confidence # => 0.92
|
|
87
122
|
```
|
|
88
123
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
```bash
|
|
92
|
-
bundle exec ruby examples/first_predictor.rb
|
|
93
|
-
```
|
|
124
|
+
### Chain of Thought
|
|
94
125
|
|
|
95
|
-
|
|
126
|
+
For complex reasoning, use `ChainOfThought` to get step-by-step explanations:
|
|
96
127
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
| --- | --- | --- |
|
|
101
|
-
| `dspy-schema` | Exposes `DSPy::TypeSystem::SorbetJsonSchema` for downstream reuse. (Still required by the core `dspy` gem; extraction lets other projects depend on it directly.) | **Stable** (v1.0.0) |
|
|
102
|
-
| `dspy-openai` | Packages the OpenAI/OpenRouter/Ollama adapters plus the official SDK guardrails. Install whenever you call `openai/*`, `openrouter/*`, or `ollama/*`. [Adapter README](https://github.com/vicentereig/dspy.rb/blob/main/lib/dspy/openai/README.md) | **Stable** (v1.0.0) |
|
|
103
|
-
| `dspy-anthropic` | Claude adapters, streaming, and structured-output helpers behind the official `anthropic` SDK. [Adapter README](https://github.com/vicentereig/dspy.rb/blob/main/lib/dspy/anthropic/README.md) | **Stable** (v1.0.0) |
|
|
104
|
-
| `dspy-gemini` | Gemini adapters with multimodal + tool-call support via `gemini-ai`. [Adapter README](https://github.com/vicentereig/dspy.rb/blob/main/lib/dspy/gemini/README.md) | **Stable** (v1.0.0) |
|
|
105
|
-
| `dspy-code_act` | Think-Code-Observe agents that synthesize and execute Ruby safely. (Add the gem or set `DSPY_WITH_CODE_ACT=1` before requiring `dspy/code_act`.) | **Stable** (v1.0.0) |
|
|
106
|
-
| `dspy-datasets` | Dataset helpers plus Parquet/Polars tooling for richer evaluation corpora. (Toggle via `DSPY_WITH_DATASETS`.) | **Stable** (v1.0.0) |
|
|
107
|
-
| `dspy-evals` | High-throughput evaluation harness with metrics, callbacks, and regression fixtures. (Toggle via `DSPY_WITH_EVALS`.) | **Stable** (v1.0.0) |
|
|
108
|
-
| `dspy-miprov2` | Bayesian optimization + Gaussian Process backend for the MIPROv2 teleprompter. (Install or export `DSPY_WITH_MIPROV2=1` before requiring the teleprompter.) | **Stable** (v1.0.0) |
|
|
109
|
-
| `dspy-gepa` | `DSPy::Teleprompt::GEPA`, reflection loops, experiment tracking, telemetry adapters. (Install or set `DSPY_WITH_GEPA=1`.) | **Stable** (v1.0.0) |
|
|
110
|
-
| `gepa` | GEPA optimizer core (Pareto engine, telemetry, reflective proposer). | **Stable** (v1.0.0) |
|
|
111
|
-
| `dspy-o11y` | Core observability APIs: `DSPy::Observability`, async span processor, observation types. (Install or set `DSPY_WITH_O11Y=1`.) | **Stable** (v1.0.0) |
|
|
112
|
-
| `dspy-o11y-langfuse` | Auto-configures DSPy observability to stream spans to Langfuse via OTLP. (Install or set `DSPY_WITH_O11Y_LANGFUSE=1`.) | **Stable** (v1.0.0) |
|
|
113
|
-
| `dspy-deep_search` | Production DeepSearch loop with Exa-backed search/read, token budgeting, and instrumentation (IssueΒ #163). | **Stable** (v1.0.0) |
|
|
114
|
-
| `dspy-deep_research` | Planner/QA orchestration atop DeepSearch plus the memory supervisor used by the CLI example. | **Stable** (v1.0.0) |
|
|
115
|
-
| `sorbet-toon` | Token-Oriented Object Notation (TOON) codec, prompt formatter, and Sorbet mixins for BAML/TOON Enhanced Prompting. [Sorbet::Toon README](https://github.com/vicentereig/dspy.rb/blob/main/lib/sorbet/toon/README.md) | **Alpha** (v0.1.0) |
|
|
128
|
+
```ruby
|
|
129
|
+
solver = DSPy::ChainOfThought.new(MathProblem)
|
|
130
|
+
result = solver.call(problem: "If a train travels 120km in 2 hours, what's its speed?")
|
|
116
131
|
|
|
117
|
-
|
|
132
|
+
result.reasoning # => "Speed = Distance / Time = 120km / 2h = 60km/h"
|
|
133
|
+
result.answer # => "60 km/h"
|
|
134
|
+
```
|
|
118
135
|
|
|
119
|
-
|
|
120
|
-
### Access to 200+ Models Across 5 Providers
|
|
136
|
+
### ReAct Agents
|
|
121
137
|
|
|
122
|
-
|
|
138
|
+
Build agents that use tools to accomplish tasks:
|
|
123
139
|
|
|
124
140
|
```ruby
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
141
|
+
class SearchTool < DSPy::Tools::Base
|
|
142
|
+
tool_name "search"
|
|
143
|
+
tool_description "Search for information"
|
|
144
|
+
|
|
145
|
+
sig { params(query: String).returns(String) }
|
|
146
|
+
def call(query:)
|
|
147
|
+
# Your search implementation
|
|
148
|
+
"Result 1, Result 2"
|
|
149
|
+
end
|
|
130
150
|
end
|
|
131
151
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
api_key: ENV['GEMINI_API_KEY'],
|
|
136
|
-
structured_outputs: true) # Native structured outputs
|
|
137
|
-
end
|
|
152
|
+
agent = DSPy::ReAct.new(ResearchTask, tools: [SearchTool.new], max_iterations: 5)
|
|
153
|
+
result = agent.call(question: "What's the latest on Ruby 3.4?")
|
|
154
|
+
```
|
|
138
155
|
|
|
139
|
-
|
|
140
|
-
DSPy.configure do |c|
|
|
141
|
-
c.lm = DSPy::LM.new('anthropic/claude-sonnet-4-5-20250929',
|
|
142
|
-
api_key: ENV['ANTHROPIC_API_KEY'],
|
|
143
|
-
structured_outputs: true) # Tool-based extraction (default)
|
|
144
|
-
end
|
|
156
|
+
## What's Included
|
|
145
157
|
|
|
146
|
-
|
|
147
|
-
DSPy.configure do |c|
|
|
148
|
-
c.lm = DSPy::LM.new('ollama/llama3.2') # Free, runs locally, no API key needed
|
|
149
|
-
end
|
|
158
|
+
**Core Modules**: Predict, ChainOfThought, ReAct agents, and composable pipelines.
|
|
150
159
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
api_key: ENV['OPENROUTER_API_KEY'])
|
|
155
|
-
end
|
|
156
|
-
```
|
|
160
|
+
**Type Safety**: Sorbet-based runtime validation. Enums, unions, nested structsβall work.
|
|
161
|
+
|
|
162
|
+
**Multimodal**: Image analysis with `DSPy::Image` for vision-capable models.
|
|
157
163
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
**Developer Experience:** Official clients, multimodal coverage, and observability baked in.
|
|
161
|
-
<details>
|
|
162
|
-
<summary>Expand for everything included</summary>
|
|
163
|
-
|
|
164
|
-
- LLM provider support using official Ruby clients:
|
|
165
|
-
- [OpenAI Ruby](https://github.com/openai/openai-ruby) with vision model support
|
|
166
|
-
- [Anthropic Ruby SDK](https://github.com/anthropics/anthropic-sdk-ruby) with multimodal capabilities
|
|
167
|
-
- [Google Gemini API](https://ai.google.dev/) with native structured outputs
|
|
168
|
-
- [Ollama](https://ollama.com/) via OpenAI compatibility layer for local models
|
|
169
|
-
- **Multimodal Support** - Complete image analysis with DSPy::Image, type-safe bounding boxes, vision-capable models
|
|
170
|
-
- Runtime type checking with [Sorbet](https://sorbet.org/) including T::Enum and union types
|
|
171
|
-
- Type-safe tool definitions for ReAct agents
|
|
172
|
-
- Comprehensive instrumentation and observability
|
|
173
|
-
</details>
|
|
174
|
-
|
|
175
|
-
**Core Building Blocks:** Predictors, agents, and pipelines wired through type-safe signatures.
|
|
176
|
-
<details>
|
|
177
|
-
<summary>Expand for everything included</summary>
|
|
178
|
-
|
|
179
|
-
- **Signatures** - Define input/output schemas using Sorbet types with T::Enum and union type support
|
|
180
|
-
- **Predict** - LLM completion with structured data extraction and multimodal support
|
|
181
|
-
- **Chain of Thought** - Step-by-step reasoning for complex problems with automatic prompt optimization
|
|
182
|
-
- **ReAct** - Tool-using agents with type-safe tool definitions and error recovery
|
|
183
|
-
- **Module Composition** - Combine multiple LLM calls into production-ready workflows
|
|
184
|
-
</details>
|
|
185
|
-
|
|
186
|
-
**Optimization & Evaluation:** Treat prompt optimization like a real ML workflow.
|
|
187
|
-
<details>
|
|
188
|
-
<summary>Expand for everything included</summary>
|
|
189
|
-
|
|
190
|
-
- **Prompt Objects** - Manipulate prompts as first-class objects instead of strings
|
|
191
|
-
- **Typed Examples** - Type-safe training data with automatic validation
|
|
192
|
-
- **Evaluation Framework** - Advanced metrics beyond simple accuracy with error-resilient pipelines
|
|
193
|
-
- **MIPROv2 Optimization** - Advanced Bayesian optimization with Gaussian Processes, multiple optimization strategies, auto-config presets, and storage persistence
|
|
194
|
-
</details>
|
|
195
|
-
|
|
196
|
-
**Production Features:** Hardened behaviors for teams shipping actual products.
|
|
197
|
-
<details>
|
|
198
|
-
<summary>Expand for everything included</summary>
|
|
199
|
-
|
|
200
|
-
- **Reliable JSON Extraction** - Native structured outputs for OpenAI and Gemini, Anthropic tool-based extraction, and automatic strategy selection with fallback
|
|
201
|
-
- **Type-Safe Configuration** - Strategy enums with automatic provider optimization (Strict/Compatible modes)
|
|
202
|
-
- **Smart Retry Logic** - Progressive fallback with exponential backoff for handling transient failures
|
|
203
|
-
- **Zero-Config Langfuse Integration** - Set env vars and get automatic OpenTelemetry traces in Langfuse
|
|
204
|
-
- **Performance Caching** - Schema and capability caching for faster repeated operations
|
|
205
|
-
- **File-based Storage** - Optimization result persistence with versioning
|
|
206
|
-
- **Structured Logging** - JSON and key=value formats with span tracking
|
|
207
|
-
</details>
|
|
208
|
-
|
|
209
|
-
## Recent Achievements
|
|
210
|
-
|
|
211
|
-
DSPy.rb has gone from experimental to production-ready in three fast releases.
|
|
212
|
-
<details>
|
|
213
|
-
<summary>Expand for the full changelog highlights</summary>
|
|
214
|
-
|
|
215
|
-
### Foundation
|
|
216
|
-
- β
**JSON Parsing Reliability** - Native OpenAI structured outputs with adaptive retry logic and schema-aware fallbacks
|
|
217
|
-
- β
**Type-Safe Strategy Configuration** - Provider-optimized strategy selection and enum-backed optimizer presets
|
|
218
|
-
- β
**Core Module System** - Predict, ChainOfThought, ReAct with type safety (add `dspy-code_act` for Think-Code-Observe agents)
|
|
219
|
-
- β
**Production Observability** - OpenTelemetry, New Relic, and Langfuse integration
|
|
220
|
-
- β
**Advanced Optimization** - MIPROv2 with Bayesian optimization, Gaussian Processes, and multi-mode search
|
|
221
|
-
|
|
222
|
-
### Recent Advances
|
|
223
|
-
- β
**MIPROv2 ADE Integrity (v0.29.1)** - Stratified train/val/test splits, honest precision accounting, and enum-driven `--auto` presets with integration coverage
|
|
224
|
-
- β
**Instruction Deduplication (v0.29.1)** - Candidate generation now filters repeated programs so optimization logs highlight unique strategies
|
|
225
|
-
- β
**GEPA Teleprompter (v0.29.0)** - Genetic-Pareto reflective prompt evolution with merge proposer scheduling, reflective mutation, and ADE demo parity
|
|
226
|
-
- β
**Optimizer Utilities Parity (v0.29.0)** - Bootstrap strategies, dataset summaries, and Layer 3 utilities unlock multi-predictor programs on Ruby
|
|
227
|
-
- β
**Observability Hardening (v0.29.0)** - OTLP exporter runs on a single-thread executor preventing frozen SSL contexts without blocking spans
|
|
228
|
-
- β
**Documentation Refresh (v0.29.x)** - New GEPA guide plus ADE optimization docs covering presets, stratified splits, and error-handling defaults
|
|
229
|
-
</details>
|
|
230
|
-
|
|
231
|
-
**Current Focus Areas:** Closing the loop on production patterns and community adoption ahead of v1.0.
|
|
232
|
-
<details>
|
|
233
|
-
<summary>Expand for the roadmap</summary>
|
|
234
|
-
|
|
235
|
-
### Production Readiness
|
|
236
|
-
- π§ **Production Patterns** - Real-world usage validation and performance optimization
|
|
237
|
-
- π§ **Ruby Ecosystem Integration** - Rails integration, Sidekiq compatibility, deployment patterns
|
|
238
|
-
|
|
239
|
-
### Community & Adoption
|
|
240
|
-
- π§ **Community Examples** - Real-world applications and case studies
|
|
241
|
-
- π§ **Contributor Experience** - Making it easier to contribute and extend
|
|
242
|
-
- π§ **Performance Benchmarks** - Comparative analysis vs other frameworks
|
|
243
|
-
</details>
|
|
244
|
-
|
|
245
|
-
**v1.0 Philosophy:** v1.0 lands after battle-testing, not checkbox bingo. The API is already stable; the milestone marks production confidence.
|
|
164
|
+
**Observability**: Zero-config Langfuse integration via OpenTelemetry. Non-blocking, production-ready.
|
|
246
165
|
|
|
166
|
+
**Optimization**: MIPROv2 (Bayesian optimization) and GEPA (genetic evolution) for prompt tuning.
|
|
167
|
+
|
|
168
|
+
**Provider Support**: OpenAI, Anthropic, Gemini, Ollama, and OpenRouter via official SDKs.
|
|
247
169
|
|
|
248
170
|
## Documentation
|
|
249
171
|
|
|
250
|
-
|
|
172
|
+
**[Full Documentation](https://oss.vicente.services/dspy.rb/)** β Getting started, core concepts, advanced patterns.
|
|
173
|
+
|
|
174
|
+
**[llms.txt](https://oss.vicente.services/dspy.rb/llms.txt)** β LLM-friendly reference for AI assistants.
|
|
251
175
|
|
|
252
|
-
###
|
|
176
|
+
### Claude Skill
|
|
253
177
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
178
|
+
A [Claude Skill](https://github.com/vicentereig/dspy-rb-skill) is available to help you build DSPy.rb applications:
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
# Claude Code β install from the vicentereig/engineering marketplace
|
|
182
|
+
claude install-skill vicentereig/engineering --skill dspy-rb
|
|
183
|
+
```
|
|
257
184
|
|
|
258
|
-
|
|
259
|
-
- **[Installation & Setup](docs/src/getting-started/installation.md)** - Detailed installation and configuration
|
|
260
|
-
- **[Quick Start Guide](docs/src/getting-started/quick-start.md)** - Your first DSPy programs
|
|
261
|
-
- **[Core Concepts](docs/src/getting-started/core-concepts.md)** - Understanding signatures, predictors, and modules
|
|
185
|
+
For Claude.ai Pro/Max, download the [skill ZIP](https://github.com/vicentereig/dspy-rb-skill/archive/refs/heads/main.zip) and upload via Settings > Skills.
|
|
262
186
|
|
|
263
|
-
|
|
264
|
-
- **[Signatures & Types](docs/src/core-concepts/signatures.md)** - Define typed interfaces for LLM operations
|
|
265
|
-
- **[Predictors](docs/src/core-concepts/predictors.md)** - Predict, ChainOfThought, ReAct, and more
|
|
266
|
-
- **[Modules & Pipelines](docs/src/core-concepts/modules.md)** - Compose complex multi-stage workflows
|
|
267
|
-
- **[Multimodal Support](docs/src/core-concepts/multimodal.md)** - Image analysis with vision-capable models
|
|
268
|
-
- **[Examples & Validation](docs/src/core-concepts/examples.md)** - Type-safe training data
|
|
269
|
-
- **[Rich Types](docs/src/advanced/complex-types.md)** - Sorbet type integration with automatic coercion for structs, enums, and arrays
|
|
270
|
-
- **[Composable Pipelines](docs/src/advanced/pipelines.md)** - Manual module composition patterns
|
|
187
|
+
## Examples
|
|
271
188
|
|
|
272
|
-
|
|
273
|
-
- **[Evaluation Framework](docs/src/optimization/evaluation.md)** - Advanced metrics beyond simple accuracy
|
|
274
|
-
- **[Prompt Optimization](docs/src/optimization/prompt-optimization.md)** - Manipulate prompts as objects
|
|
275
|
-
- **[MIPROv2 Optimizer](docs/src/optimization/miprov2.md)** - Advanced Bayesian optimization with Gaussian Processes
|
|
276
|
-
- **[GEPA Optimizer](docs/src/optimization/gepa.md)** *(beta)* - Reflective mutation with optional reflection LMs
|
|
189
|
+
The [examples/](examples/) directory has runnable code for common patterns:
|
|
277
190
|
|
|
278
|
-
|
|
279
|
-
-
|
|
280
|
-
-
|
|
281
|
-
-
|
|
191
|
+
- Sentiment classification
|
|
192
|
+
- ReAct agents with tools
|
|
193
|
+
- Image analysis
|
|
194
|
+
- Prompt optimization
|
|
282
195
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
- **[Custom Metrics](docs/src/advanced/custom-metrics.md)** - Proc-based evaluation logic
|
|
196
|
+
```bash
|
|
197
|
+
bundle exec ruby examples/basic_search_agent.rb
|
|
198
|
+
```
|
|
287
199
|
|
|
200
|
+
## Optional Gems
|
|
288
201
|
|
|
202
|
+
DSPy.rb ships sibling gems for features with heavier dependencies. Add them as needed:
|
|
289
203
|
|
|
204
|
+
| Gem | What it does |
|
|
205
|
+
| --- | --- |
|
|
206
|
+
| `dspy-datasets` | Dataset helpers, Parquet/Polars tooling |
|
|
207
|
+
| `dspy-evals` | Evaluation harness with metrics and callbacks |
|
|
208
|
+
| `dspy-miprov2` | Bayesian optimization for prompt tuning |
|
|
209
|
+
| `dspy-gepa` | Genetic-Pareto prompt evolution |
|
|
210
|
+
| `dspy-o11y-langfuse` | Auto-configure Langfuse tracing |
|
|
211
|
+
| `dspy-code_act` | Think-Code-Observe agents |
|
|
212
|
+
| `dspy-deep_search` | Production DeepSearch with Exa |
|
|
290
213
|
|
|
214
|
+
See [the full list](https://oss.vicente.services/dspy.rb/getting-started/installation/) in the docs.
|
|
291
215
|
|
|
216
|
+
## Contributing
|
|
292
217
|
|
|
218
|
+
Feedback is invaluable. If you encounter issues, [open an issue](https://github.com/vicentereig/dspy.rb/issues). For suggestions, [start a discussion](https://github.com/vicentereig/dspy.rb/discussions).
|
|
293
219
|
|
|
220
|
+
Want to contribute code? Reach out: hey at vicente.services
|
|
294
221
|
|
|
295
222
|
## License
|
|
296
|
-
|
|
223
|
+
|
|
224
|
+
MIT License.
|
data/lib/gepa/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: gepa
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Vicente Reig RincΓ³n de Arellano
|
|
@@ -13,16 +13,22 @@ dependencies:
|
|
|
13
13
|
name: dspy
|
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
|
15
15
|
requirements:
|
|
16
|
+
- - ">="
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: 0.30.0
|
|
16
19
|
- - "<"
|
|
17
20
|
- !ruby/object:Gem::Version
|
|
18
|
-
version:
|
|
21
|
+
version: '2.0'
|
|
19
22
|
type: :runtime
|
|
20
23
|
prerelease: false
|
|
21
24
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
25
|
requirements:
|
|
26
|
+
- - ">="
|
|
27
|
+
- !ruby/object:Gem::Version
|
|
28
|
+
version: 0.30.0
|
|
23
29
|
- - "<"
|
|
24
30
|
- !ruby/object:Gem::Version
|
|
25
|
-
version:
|
|
31
|
+
version: '2.0'
|
|
26
32
|
description: GEPA delivers optimization strategies, telemetry, and proposer tooling
|
|
27
33
|
for reflective DSPy agents.
|
|
28
34
|
email:
|