dspy-code_act 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 +68 -39
  3. data/lib/dspy/code_act/version.rb +1 -1
  4. metadata +7 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cfa3f6fe68fadbf93038e6d422545322feff17f17ecf50b738aa336e201e72ce
4
- data.tar.gz: 74d143813c304431f3d68750762a7ab57fd231a8cda07537409f64cb98b561c0
3
+ metadata.gz: 41e384ba71082ee6532f168cccd6103a46797153d47ed2cfde122d6c2b3dae30
4
+ data.tar.gz: 86ec69fbc323d38513179adf541cbc7ff60600616eeffafae0db9a9055eb7f2a
5
5
  SHA512:
6
- metadata.gz: 75b3cf9ba1c059fc8abe7046cb987880709d9e7fd75fea371aee99ee60cf6539dc7ee3d8da9480c1af57f4a3def875a753c964f25edb64905f24673f58eaa09e
7
- data.tar.gz: 1a5845ec6f54194bd266a1dacf1d6f23196f50c51743721793863adbb6aeb41923c30fb667bb2b4aecb77f2e64946406a806922474f806751b840e2890ed80d9
6
+ metadata.gz: 7a89397a45fe0e63a66ebe993ab26e4a7f244de52e19faaf8ae0f40b9ede20be861d0267cc029f4f5034ecd2d2f7f83229b0428dad4edeb3160400540a8739f0
7
+ data.tar.gz: 0f3ac179289084396771adea5c624fa71b9a029001ad5c1baa99cfa03103ba92fd1aefbfe0ed6b9356447349a1dee6239dcf20027466cfe0b4d6b78d6f40e726
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
@@ -12,23 +13,16 @@
12
13
  >
13
14
  > If you want to contribute, feel free to reach out to me to coordinate efforts: hey at vicente.services
14
15
  >
15
- > And, yes, this is 100% a legit project. :)
16
-
17
16
 
18
17
  **Build reliable LLM applications in idiomatic Ruby using composable, type-safe modules.**
19
18
 
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.
19
+ 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
20
 
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.
21
+ **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
22
 
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.
23
+ 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
24
 
31
- **What you get?** Ruby LLM applications that actually scale and don't break when you sneeze.
25
+ **What you get?** Ruby LLM applications that scale and don't break when you sneeze.
32
26
 
33
27
  Check the [examples](examples/) and take them for a spin!
34
28
 
@@ -47,28 +41,12 @@ and
47
41
  bundle install
48
42
  ```
49
43
 
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 | Status |
55
- | --- | --- | --- |
56
- | `dspy-schema` | Exposes `DSPy::TypeSystem::SorbetJsonSchema` for downstream reuse. | **Stable** (v1.0.0) |
57
- | `dspy-code_act` | Think-Code-Observe agents that synthesize and execute Ruby safely. | Preview (0.x) |
58
- | `dspy-datasets` | Dataset helpers plus Parquet/Polars tooling for richer evaluation corpora. | Preview (0.x) |
59
- | `dspy-evals` | High-throughput evaluation harness with metrics, callbacks, and regression fixtures. | Preview (0.x) |
60
- | `dspy-miprov2` | Bayesian optimization + Gaussian Process backend for the MIPROv2 teleprompter. | Preview (0.x) |
61
- | `dspy-gepa` | `DSPy::Teleprompt::GEPA`, reflection loops, experiment tracking, telemetry adapters. | Preview (mirrors `dspy` version) |
62
- | `gepa` | GEPA optimizer core (Pareto engine, telemetry, reflective proposer). | Preview (mirrors `dspy` version) |
63
- | `dspy-o11y` | Core observability APIs: `DSPy::Observability`, async span processor, observation types. | **Stable** (v1.0.0) |
64
- | `dspy-o11y-langfuse` | Auto-configures DSPy observability to stream spans to Langfuse via OTLP. | **Stable** (v1.0.0) |
65
-
66
- 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 `docs/core-concepts/dependency-tree.md` for the full dependency map and roadmap.
67
44
  ### Your First Reliable Predictor
68
45
 
69
46
  ```ruby
47
+ require 'dspy'
70
48
 
71
- # Configure DSPy globablly to use your fave LLM - you can override this on an instance levle.
49
+ # Configure DSPy globally to use your fave LLM (you can override per predictor).
72
50
  DSPy.configure do |c|
73
51
  c.lm = DSPy::LM.new('openai/gpt-4o-mini',
74
52
  api_key: ENV['OPENAI_API_KEY'],
@@ -99,7 +77,7 @@ class Classify < DSPy::Signature
99
77
  end
100
78
  end
101
79
 
102
- # Wire it to the simplest prompting technique - a Predictn.
80
+ # Wire it to the simplest prompting technique: a prediction loop.
103
81
  classify = DSPy::Predict.new(Classify)
104
82
  # it may raise an error if you mess the inputs or your LLM messes the outputs.
105
83
  result = classify.call(sentence: "This book was super fun to read!")
@@ -108,6 +86,37 @@ puts result.sentiment # => #<Sentiment::Positive>
108
86
  puts result.confidence # => 0.85
109
87
  ```
110
88
 
89
+ Save this as `examples/first_predictor.rb` and run it with:
90
+
91
+ ```bash
92
+ bundle exec ruby examples/first_predictor.rb
93
+ ```
94
+
95
+ ### Sibling Gems
96
+
97
+ 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`:
98
+
99
+ | Gem | Description | Status |
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) |
116
+
117
+ **Provider adapters:** Add `dspy-openai`, `dspy-anthropic`, and/or `dspy-gemini` next to `dspy` in your Gemfile depending on which `DSPy::LM` providers you call. Each gem already depends on the official SDK (`openai`, `anthropic`, `gemini-ai`), and DSPy auto-loads the adapters when the gem is present—no extra `require` needed.
118
+
119
+ 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.
111
120
  ### Access to 200+ Models Across 5 Providers
112
121
 
113
122
  DSPy.rb provides unified access to major LLM providers with provider-specific optimizations:
@@ -148,7 +157,10 @@ end
148
157
 
149
158
  ## What You Get
150
159
 
151
- **Developer Experience:**
160
+ **Developer Experience:** Official clients, multimodal coverage, and observability baked in.
161
+ <details>
162
+ <summary>Expand for everything included</summary>
163
+
152
164
  - LLM provider support using official Ruby clients:
153
165
  - [OpenAI Ruby](https://github.com/openai/openai-ruby) with vision model support
154
166
  - [Anthropic Ruby SDK](https://github.com/anthropics/anthropic-sdk-ruby) with multimodal capabilities
@@ -158,21 +170,33 @@ end
158
170
  - Runtime type checking with [Sorbet](https://sorbet.org/) including T::Enum and union types
159
171
  - Type-safe tool definitions for ReAct agents
160
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>
161
178
 
162
- **Core Building Blocks:**
163
179
  - **Signatures** - Define input/output schemas using Sorbet types with T::Enum and union type support
164
180
  - **Predict** - LLM completion with structured data extraction and multimodal support
165
181
  - **Chain of Thought** - Step-by-step reasoning for complex problems with automatic prompt optimization
166
182
  - **ReAct** - Tool-using agents with type-safe tool definitions and error recovery
167
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>
168
189
 
169
- **Optimization & Evaluation:**
170
190
  - **Prompt Objects** - Manipulate prompts as first-class objects instead of strings
171
191
  - **Typed Examples** - Type-safe training data with automatic validation
172
192
  - **Evaluation Framework** - Advanced metrics beyond simple accuracy with error-resilient pipelines
173
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>
174
199
 
175
- **Production Features:**
176
200
  - **Reliable JSON Extraction** - Native structured outputs for OpenAI and Gemini, Anthropic tool-based extraction, and automatic strategy selection with fallback
177
201
  - **Type-Safe Configuration** - Strategy enums with automatic provider optimization (Strict/Compatible modes)
178
202
  - **Smart Retry Logic** - Progressive fallback with exponential backoff for handling transient failures
@@ -180,10 +204,13 @@ end
180
204
  - **Performance Caching** - Schema and capability caching for faster repeated operations
181
205
  - **File-based Storage** - Optimization result persistence with versioning
182
206
  - **Structured Logging** - JSON and key=value formats with span tracking
207
+ </details>
183
208
 
184
209
  ## Recent Achievements
185
210
 
186
- DSPy.rb has rapidly evolved from experimental to production-ready:
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>
187
214
 
188
215
  ### Foundation
189
216
  - ✅ **JSON Parsing Reliability** - Native OpenAI structured outputs with adaptive retry logic and schema-aware fallbacks
@@ -199,8 +226,11 @@ DSPy.rb has rapidly evolved from experimental to production-ready:
199
226
  - ✅ **Optimizer Utilities Parity (v0.29.0)** - Bootstrap strategies, dataset summaries, and Layer 3 utilities unlock multi-predictor programs on Ruby
200
227
  - ✅ **Observability Hardening (v0.29.0)** - OTLP exporter runs on a single-thread executor preventing frozen SSL contexts without blocking spans
201
228
  - ✅ **Documentation Refresh (v0.29.x)** - New GEPA guide plus ADE optimization docs covering presets, stratified splits, and error-handling defaults
229
+ </details>
202
230
 
203
- **Current Focus Areas:**
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>
204
234
 
205
235
  ### Production Readiness
206
236
  - 🚧 **Production Patterns** - Real-world usage validation and performance optimization
@@ -210,10 +240,9 @@ DSPy.rb has rapidly evolved from experimental to production-ready:
210
240
  - 🚧 **Community Examples** - Real-world applications and case studies
211
241
  - 🚧 **Contributor Experience** - Making it easier to contribute and extend
212
242
  - 🚧 **Performance Benchmarks** - Comparative analysis vs other frameworks
243
+ </details>
213
244
 
214
- **v1.0 Philosophy:**
215
- v1.0 will be released after extensive production battle-testing, not after checking off features.
216
- The API is already stable - v1.0 represents confidence in production reliability backed by real-world validation.
245
+ **v1.0 Philosophy:** v1.0 lands after battle-testing, not checkbox bingo. The API is already stable; the milestone marks production confidence.
217
246
 
218
247
 
219
248
  ## Documentation
@@ -2,6 +2,6 @@
2
2
 
3
3
  module DSPy
4
4
  module CodeActVersion
5
- VERSION = '1.0.0'
5
+ VERSION = '1.0.1'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,29 +1,28 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dspy-code_act
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:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2025-10-25 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: dspy
15
14
  requirement: !ruby/object:Gem::Requirement
16
15
  requirements:
17
- - - '='
16
+ - - ">="
18
17
  - !ruby/object:Gem::Version
19
- version: 0.30.0
18
+ version: '0.30'
20
19
  type: :runtime
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
- - - '='
23
+ - - ">="
25
24
  - !ruby/object:Gem::Version
26
- version: 0.30.0
25
+ version: '0.30'
27
26
  description: CodeAct provides Think-Code-Observe agents that synthesize and execute
28
27
  Ruby code dynamically. Ship DSPy.rb workflows that write custom Ruby code while
29
28
  tracking execution history, observations, and safety signals.
@@ -43,7 +42,6 @@ licenses:
43
42
  - MIT
44
43
  metadata:
45
44
  github_repo: git@github.com:vicentereig/dspy.rb
46
- post_install_message:
47
45
  rdoc_options: []
48
46
  require_paths:
49
47
  - lib
@@ -58,8 +56,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
58
56
  - !ruby/object:Gem::Version
59
57
  version: '0'
60
58
  requirements: []
61
- rubygems_version: 3.0.3.1
62
- signing_key:
59
+ rubygems_version: 3.6.9
63
60
  specification_version: 4
64
61
  summary: Dynamic code generation agents for DSPy.rb.
65
62
  test_files: []