dspy 0.23.0 → 0.24.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a74fa7e459b97d25d515492a9c8ef786981ca5212dcfe970b9f8311e5a2b7be4
4
- data.tar.gz: 7cf45b5f12849e55b1a180f3b39e9054357a23477bbc8dacad4b85be35bc234a
3
+ metadata.gz: e8fb5750b0bc898e3bfb2b64305e5b7eb186c494aba525fd8b739822385e7129
4
+ data.tar.gz: 530f9d8163c914845a2b472cdacce848ba187b9e69f9304d8743966b744ddf9f
5
5
  SHA512:
6
- metadata.gz: d7610ab7261fb039264acf5c2de69b70c7cc33932335faf70b97ba65e459a0d2048a428e8b1f49b6ccd73de3455ad4adc9351bb2e5dc58acfac47323086b7c3d
7
- data.tar.gz: de8c212916e2135c27e881be529f12121439b12bbc8effca7dd98d6aa912f6057ae304e9d1aa5eee6c2dd2fafee904b3665cde4569f61d91360cacb6acbc2e43
6
+ metadata.gz: 9f8e5fa70b1be656f174e5370f529086cb6c836030382c04fd1392e79998c43e93b71db7dbc47ec3cf424254cbd42343ac6f1447f800185d6ce499204dec05f2
7
+ data.tar.gz: 95971087479ca0efa66da1bb6084e94a6cb2120203721c2a949c6fc002d152da9f4587061e8e67c246760dbee5167718f8a6f067024e61106d9fa94c1bd0cd55
data/README.md CHANGED
@@ -5,16 +5,15 @@
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
7
 
8
- **Build reliable LLM applications in Ruby using composable, type-safe modules.**
8
+ **Build reliable LLM applications in idiomatic Ruby using composable, type-safe modules.**
9
9
 
10
- DSPy.rb brings structured LLM programming to Ruby developers. Instead of wrestling with prompt strings and parsing
11
- responses, you define typed signatures and compose them into pipelines that just work.
10
+ The Ruby framework for programming with large language models. DSPy.rb brings structured LLM programming to Ruby developers. 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.
12
11
 
13
- Traditional prompting is like writing code with string concatenation: it works until it doesn't. DSPy.rb brings you
12
+ **Prompts are the just Functions.** Traditional prompting is like writing code with string concatenation: it works until it doesn't. DSPy.rb brings you
14
13
  the programming approach pioneered by [dspy.ai](https://dspy.ai/): instead of crafting fragile prompts, you define modular
15
14
  signatures and let the framework handle the messy details.
16
15
 
17
- DSPy.rb is an idiomatic Ruby port of Stanford's [DSPy framework](https://github.com/stanfordnlp/dspy). While implementing
16
+ DSPy.rb is an idiomatic Ruby surgical port of Stanford's [DSPy framework](https://github.com/stanfordnlp/dspy). While implementing
18
17
  the core concepts of signatures, predictors, and optimization from the original Python library, DSPy.rb embraces Ruby
19
18
  conventions and adds Ruby-specific innovations like CodeAct agents and enhanced production instrumentation.
20
19
 
@@ -1699,8 +1699,17 @@ module DSPy
1699
1699
  end
1700
1700
  secondary_scores[:token_efficiency] = calculate_token_efficiency(mock_traces, predictions.size)
1701
1701
 
1702
- # Response consistency
1703
- response_texts = predictions.map { |p| p[:prediction]&.answer&.to_s || '' }
1702
+ # Response consistency - use first output field for any signature
1703
+ response_texts = predictions.map do |p|
1704
+ pred = p[:prediction]
1705
+ if pred && pred.respond_to?(:class) && pred.class.respond_to?(:props)
1706
+ # Get first output field name and value
1707
+ first_field = pred.class.props.keys.first
1708
+ first_field ? (pred.send(first_field)&.to_s || '') : ''
1709
+ else
1710
+ ''
1711
+ end
1712
+ end
1704
1713
  secondary_scores[:consistency] = calculate_consistency(response_texts)
1705
1714
 
1706
1715
  # Latency performance
data/lib/dspy/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DSPy
4
- VERSION = "0.23.0"
4
+ VERSION = "0.24.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dspy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.23.0
4
+ version: 0.24.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vicente Reig Rincón de Arellano
@@ -177,8 +177,10 @@ dependencies:
177
177
  - - "~>"
178
178
  - !ruby/object:Gem::Version
179
179
  version: '0.30'
180
- description: The Ruby framework for programming with large language models. Includes
181
- event-driven observability system with OpenTelemetry integration and Langfuse export.
180
+ description: The Ruby framework for programming with large language models. DSPy.rb
181
+ brings structured LLM programming to Ruby developers. Instead of wrestling with
182
+ prompt strings and parsing responses, you define typed signatures using idiomatic
183
+ Ruby to compose and decompose AI Worklows and AI Agents.
182
184
  email:
183
185
  - hey@vicente.services
184
186
  executables: []