dspy-schema 1.0.0 → 1.0.1

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +62 -34
  3. data/lib/dspy/schema/version.rb +1 -1
  4. metadata +7 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bf1a5bda9480f0a5fd8e00f80949debb6bcd99e0ee014e767dc5ed7ac02440f1
4
- data.tar.gz: a7c318b77fef71636125958148203960d9737897f1eed656471fbe03dd43c406
3
+ metadata.gz: 9f74029ea6216c0037bb06ceb6c7f59d97fb91b1eefa19eb1c7d44322b555394
4
+ data.tar.gz: '08d2fe0cd462d3dc454184a3996c015e8182244c1ad8731780f18e58fbdbe03d'
5
5
  SHA512:
6
- metadata.gz: 8bf44b28876109783dc9570919f2a99f1a48a3b96823aec379f2a10b48ea84d281be226afb9a450a119a81f1721e9e37a990b5edf38b0aadc643f2cf94f49915
7
- data.tar.gz: 3a34993c5c3252c63642a6892eed12e172d139dc834e53d04e7b79424e21f5f0d3ae245ef479dd6b013adec699f4d206daccf29864837db99231a853afc7f9c6
6
+ metadata.gz: ebf9688e45cdc399cd5be6fc72a6b923c8e4bc261d33b0e94fef6e77bd556af4cae3ade15698303088d023ea9207a8317de27e69a7c8803dd10aa1d9c56d797a
7
+ data.tar.gz: 746aaa4652c116c960f1be9bde5b6f9696c041ac3ac88622d1dcf23db4196b60ebd2686fdc58aebd8b62203ee6ce1cbe3a86946b31a22bf7252d8aac275481e4
data/README.md CHANGED
@@ -4,6 +4,7 @@
4
4
  [![Total Downloads](https://img.shields.io/gem/dt/dspy)](https://rubygems.org/gems/dspy)
5
5
  [![Build Status](https://img.shields.io/github/actions/workflow/status/vicentereig/dspy.rb/ruby.yml?branch=main&label=build)](https://github.com/vicentereig/dspy.rb/actions/workflows/ruby.yml)
6
6
  [![Documentation](https://img.shields.io/badge/docs-vicentereig.github.io%2Fdspy.rb-blue)](https://vicentereig.github.io/dspy.rb/)
7
+ [![Discord](https://img.shields.io/discord/1161519468141355160?label=discord&logo=discord&logoColor=white)](https://discord.gg/zWBhrMqn)
7
8
 
8
9
  > [!NOTE]
9
10
  > The core Prompt Engineering Framework is production-ready with
@@ -17,18 +18,13 @@
17
18
 
18
19
  **Build reliable LLM applications in idiomatic Ruby using composable, type-safe modules.**
19
20
 
20
- The Ruby framework for programming with large language models. DSPy.rb brings structured LLM programming to Ruby developers, programmatic Prompt Engineering and Context Engineering.
21
- Instead of wrestling with prompt strings and parsing responses, you define typed signatures using idiomatic Ruby to compose and decompose AI Worklows and AI Agents.
21
+ DSPy.rb is the Ruby-first surgical port of Stanford's [DSPy framework](https://github.com/stanfordnlp/dspy). It delivers structured LLM programming, prompt engineering, and context engineering in the language we love. Instead of wrestling with brittle prompt strings, you define typed signatures in idiomatic Ruby and compose workflows and agents that actually behave.
22
22
 
23
- **Prompts are the just Functions.** Traditional prompting is like writing code with string concatenation: it works until it doesn't. DSPy.rb brings you
24
- the programming approach pioneered by [dspy.ai](https://dspy.ai/): instead of crafting fragile prompts, you define modular
25
- signatures and let the framework handle the messy details.
23
+ **Prompts are just functions.** Traditional prompting is like writing code with string concatenation: it works until it doesn't. DSPy.rb brings you the programming approach pioneered by [dspy.ai](https://dspy.ai/): define modular signatures and let the framework deal with the messy bits.
26
24
 
27
- DSPy.rb is an idiomatic Ruby surgical port of Stanford's [DSPy framework](https://github.com/stanfordnlp/dspy). While implementing
28
- the core concepts of signatures, predictors, and the main optimization algorithms from the original Python library, DSPy.rb embraces Ruby
29
- conventions and adds Ruby-specific innovations like Sorbet-base Typed system, ReAct loops, and production-ready integrations like non-blocking Open Telemetry Instrumentation.
25
+ While we implement the same signatures, predictors, and optimization algorithms as the original library, DSPy.rb leans hard into Ruby conventions with Sorbet-based typing, ReAct loops, and production-ready integrations like non-blocking OpenTelemetry instrumentation.
30
26
 
31
- **What you get?** Ruby LLM applications that actually scale and don't break when you sneeze.
27
+ **What you get?** Ruby LLM applications that scale and don't break when you sneeze.
32
28
 
33
29
  Check the [examples](examples/) and take them for a spin!
34
30
 
@@ -47,25 +43,12 @@ and
47
43
  bundle install
48
44
  ```
49
45
 
50
- ### Optional Sibling Gems
51
-
52
- DSPy.rb ships multiple gems from this monorepo so you only install what you need. Add these alongside `dspy`:
53
-
54
- | Gem | Description |
55
- | --- | --- |
56
- | `dspy-schema` | Exposes `DSPy::TypeSystem::SorbetJsonSchema` so other projects (e.g., exa-ruby) can convert Sorbet types to JSON Schema without pulling the full DSPy stack. |
57
- | `dspy-code_act` | Think-Code-Observe agents that can synthesize and execute Ruby code safely. |
58
- | `dspy-datasets` | Dataset helpers plus Parquet/Polars tooling for richer evaluation corpora. |
59
- | `dspy-evals` | High-throughput evaluation harness with metrics, callbacks, and regression fixtures. |
60
- | `dspy-miprov2` | Bayesian optimization + Gaussian Process backend for the MIPROv2 teleprompter. |
61
- | `gepa` | GEPA optimizer core (Pareto engine, telemetry, reflective proposer) shared with `dspy-gepa`. |
62
-
63
- Set the matching `DSPY_WITH_*` environment variables (see `Gemfile`) to include or exclude each sibling gem when running Bundler locally.
64
46
  ### Your First Reliable Predictor
65
47
 
66
48
  ```ruby
49
+ require 'dspy'
67
50
 
68
- # Configure DSPy globablly to use your fave LLM - you can override this on an instance levle.
51
+ # Configure DSPy globally to use your fave LLM (you can override per predictor).
69
52
  DSPy.configure do |c|
70
53
  c.lm = DSPy::LM.new('openai/gpt-4o-mini',
71
54
  api_key: ENV['OPENAI_API_KEY'],
@@ -96,7 +79,7 @@ class Classify < DSPy::Signature
96
79
  end
97
80
  end
98
81
 
99
- # Wire it to the simplest prompting technique - a Predictn.
82
+ # Wire it to the simplest prompting technique: a prediction loop.
100
83
  classify = DSPy::Predict.new(Classify)
101
84
  # it may raise an error if you mess the inputs or your LLM messes the outputs.
102
85
  result = classify.call(sentence: "This book was super fun to read!")
@@ -105,6 +88,31 @@ puts result.sentiment # => #<Sentiment::Positive>
105
88
  puts result.confidence # => 0.85
106
89
  ```
107
90
 
91
+ Save this as `examples/first_predictor.rb` and run it with:
92
+
93
+ ```bash
94
+ bundle exec ruby examples/first_predictor.rb
95
+ ```
96
+
97
+ ### Sibling Gems
98
+
99
+ DSPy.rb ships multiple gems from this monorepo so you can opt into features with heavier dependency trees (e.g., datasets pull in Polars/Arrow, MIPROv2 requires `numo-*` BLAS bindings) only when you need them. Add these alongside `dspy`:
100
+
101
+ | Gem | Description | Status |
102
+ | --- | --- | --- |
103
+ | `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) |
104
+ | `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) |
105
+ | `dspy-datasets` | Dataset helpers plus Parquet/Polars tooling for richer evaluation corpora. (Toggle via `DSPY_WITH_DATASETS`.) | **Stable** (v1.0.0) |
106
+ | `dspy-evals` | High-throughput evaluation harness with metrics, callbacks, and regression fixtures. (Toggle via `DSPY_WITH_EVALS`.) | **Stable** (v1.0.0) |
107
+ | `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) |
108
+ | `dspy-gepa` | `DSPy::Teleprompt::GEPA`, reflection loops, experiment tracking, telemetry adapters. (Install or set `DSPY_WITH_GEPA=1`.) | **Stable** (v1.0.0) |
109
+ | `gepa` | GEPA optimizer core (Pareto engine, telemetry, reflective proposer). | **Stable** (v1.0.0) |
110
+ | `dspy-o11y` | Core observability APIs: `DSPy::Observability`, async span processor, observation types. (Install or set `DSPY_WITH_O11Y=1`.) | **Stable** (v1.0.0) |
111
+ | `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) |
112
+ | `dspy-deep_search` | Production DeepSearch loop with Exa-backed search/read, token budgeting, and instrumentation (Issue #163). | **Stable** (v1.0.0) |
113
+ | `dspy-deep_research` | Planner/QA orchestration atop DeepSearch plus the memory supervisor used by the CLI example. | **Stable** (v1.0.0) |
114
+
115
+ Set the matching `DSPY_WITH_*` environment variables (see `Gemfile`) to include or exclude each sibling gem when running Bundler locally (for example `DSPY_WITH_GEPA=1` or `DSPY_WITH_O11Y_LANGFUSE=1`). Refer to `adr/013-dependency-tree.md` for the full dependency map and roadmap.
108
116
  ### Access to 200+ Models Across 5 Providers
109
117
 
110
118
  DSPy.rb provides unified access to major LLM providers with provider-specific optimizations:
@@ -145,7 +153,10 @@ end
145
153
 
146
154
  ## What You Get
147
155
 
148
- **Developer Experience:**
156
+ **Developer Experience:** Official clients, multimodal coverage, and observability baked in.
157
+ <details>
158
+ <summary>Expand for everything included</summary>
159
+
149
160
  - LLM provider support using official Ruby clients:
150
161
  - [OpenAI Ruby](https://github.com/openai/openai-ruby) with vision model support
151
162
  - [Anthropic Ruby SDK](https://github.com/anthropics/anthropic-sdk-ruby) with multimodal capabilities
@@ -155,21 +166,33 @@ end
155
166
  - Runtime type checking with [Sorbet](https://sorbet.org/) including T::Enum and union types
156
167
  - Type-safe tool definitions for ReAct agents
157
168
  - Comprehensive instrumentation and observability
169
+ </details>
170
+
171
+ **Core Building Blocks:** Predictors, agents, and pipelines wired through type-safe signatures.
172
+ <details>
173
+ <summary>Expand for everything included</summary>
158
174
 
159
- **Core Building Blocks:**
160
175
  - **Signatures** - Define input/output schemas using Sorbet types with T::Enum and union type support
161
176
  - **Predict** - LLM completion with structured data extraction and multimodal support
162
177
  - **Chain of Thought** - Step-by-step reasoning for complex problems with automatic prompt optimization
163
178
  - **ReAct** - Tool-using agents with type-safe tool definitions and error recovery
164
179
  - **Module Composition** - Combine multiple LLM calls into production-ready workflows
180
+ </details>
181
+
182
+ **Optimization & Evaluation:** Treat prompt optimization like a real ML workflow.
183
+ <details>
184
+ <summary>Expand for everything included</summary>
165
185
 
166
- **Optimization & Evaluation:**
167
186
  - **Prompt Objects** - Manipulate prompts as first-class objects instead of strings
168
187
  - **Typed Examples** - Type-safe training data with automatic validation
169
188
  - **Evaluation Framework** - Advanced metrics beyond simple accuracy with error-resilient pipelines
170
189
  - **MIPROv2 Optimization** - Advanced Bayesian optimization with Gaussian Processes, multiple optimization strategies, auto-config presets, and storage persistence
190
+ </details>
191
+
192
+ **Production Features:** Hardened behaviors for teams shipping actual products.
193
+ <details>
194
+ <summary>Expand for everything included</summary>
171
195
 
172
- **Production Features:**
173
196
  - **Reliable JSON Extraction** - Native structured outputs for OpenAI and Gemini, Anthropic tool-based extraction, and automatic strategy selection with fallback
174
197
  - **Type-Safe Configuration** - Strategy enums with automatic provider optimization (Strict/Compatible modes)
175
198
  - **Smart Retry Logic** - Progressive fallback with exponential backoff for handling transient failures
@@ -177,10 +200,13 @@ end
177
200
  - **Performance Caching** - Schema and capability caching for faster repeated operations
178
201
  - **File-based Storage** - Optimization result persistence with versioning
179
202
  - **Structured Logging** - JSON and key=value formats with span tracking
203
+ </details>
180
204
 
181
205
  ## Recent Achievements
182
206
 
183
- DSPy.rb has rapidly evolved from experimental to production-ready:
207
+ DSPy.rb has gone from experimental to production-ready in three fast releases.
208
+ <details>
209
+ <summary>Expand for the full changelog highlights</summary>
184
210
 
185
211
  ### Foundation
186
212
  - ✅ **JSON Parsing Reliability** - Native OpenAI structured outputs with adaptive retry logic and schema-aware fallbacks
@@ -196,8 +222,11 @@ DSPy.rb has rapidly evolved from experimental to production-ready:
196
222
  - ✅ **Optimizer Utilities Parity (v0.29.0)** - Bootstrap strategies, dataset summaries, and Layer 3 utilities unlock multi-predictor programs on Ruby
197
223
  - ✅ **Observability Hardening (v0.29.0)** - OTLP exporter runs on a single-thread executor preventing frozen SSL contexts without blocking spans
198
224
  - ✅ **Documentation Refresh (v0.29.x)** - New GEPA guide plus ADE optimization docs covering presets, stratified splits, and error-handling defaults
225
+ </details>
199
226
 
200
- **Current Focus Areas:**
227
+ **Current Focus Areas:** Closing the loop on production patterns and community adoption ahead of v1.0.
228
+ <details>
229
+ <summary>Expand for the roadmap</summary>
201
230
 
202
231
  ### Production Readiness
203
232
  - 🚧 **Production Patterns** - Real-world usage validation and performance optimization
@@ -207,10 +236,9 @@ DSPy.rb has rapidly evolved from experimental to production-ready:
207
236
  - 🚧 **Community Examples** - Real-world applications and case studies
208
237
  - 🚧 **Contributor Experience** - Making it easier to contribute and extend
209
238
  - 🚧 **Performance Benchmarks** - Comparative analysis vs other frameworks
239
+ </details>
210
240
 
211
- **v1.0 Philosophy:**
212
- v1.0 will be released after extensive production battle-testing, not after checking off features.
213
- The API is already stable - v1.0 represents confidence in production reliability backed by real-world validation.
241
+ **v1.0 Philosophy:** v1.0 lands after battle-testing, not checkbox bingo. The API is already stable; the milestone marks production confidence.
214
242
 
215
243
 
216
244
  ## Documentation
@@ -2,6 +2,6 @@
2
2
 
3
3
  module DSPy
4
4
  module Schema
5
- VERSION = "1.0.0"
5
+ VERSION = "1.0.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dspy-schema
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vicente Reig Rincón de Arellano
8
+ autorequire:
8
9
  bindir: bin
9
10
  cert_chain: []
10
- date: 2025-10-25 00:00:00.000000000 Z
11
+ date: 2025-10-30 00:00:00.000000000 Z
11
12
  dependencies:
12
13
  - !ruby/object:Gem::Dependency
13
14
  name: sorbet-runtime
@@ -41,6 +42,7 @@ licenses:
41
42
  - MIT
42
43
  metadata:
43
44
  github_repo: git@github.com:vicentereig/dspy.rb
45
+ post_install_message:
44
46
  rdoc_options: []
45
47
  require_paths:
46
48
  - lib
@@ -48,14 +50,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
48
50
  requirements:
49
51
  - - ">="
50
52
  - !ruby/object:Gem::Version
51
- version: 3.3.0
53
+ version: 3.0.0
52
54
  required_rubygems_version: !ruby/object:Gem::Requirement
53
55
  requirements:
54
56
  - - ">="
55
57
  - !ruby/object:Gem::Version
56
58
  version: '0'
57
59
  requirements: []
58
- rubygems_version: 3.6.5
60
+ rubygems_version: 3.0.3.1
61
+ signing_key:
59
62
  specification_version: 4
60
63
  summary: Sorbet to JSON Schema conversion utilities reused by DSPy.rb.
61
64
  test_files: []