dspy 0.15.4 → 0.15.5

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: e7154d8c22730a4216467c15a71d3adf4e2826e49211dfde7fd20e20344e4d4b
4
- data.tar.gz: 4e3450f2b5d9e8acf2a5b583a3180bec0608b4c948a9b860bcd8bd387dc0bb7a
3
+ metadata.gz: 51c3198b48fd7a13694d7da2cd2e59d08c20feade0fa96d07a2722a1e68847be
4
+ data.tar.gz: 868a767f203a12e03df15395a22c8308d0a1a5bcbae2faf298ae05f36c026460
5
5
  SHA512:
6
- metadata.gz: 36f07d86290d95e91ac8842807739d9edd566e3b9694413060181266611ea6fa1de941a509feb4518dfd3cf97f922689f8f15df7f6d3182cae0bef1b94b785cb
7
- data.tar.gz: ad2a480af294da127d6fc6b54c56f66e9c59829e86c4dab70c6427d5b9dc6a7a9e26381f35448e9a8b514326169784ba160a92ba488fc06a9e47fcdacd2a2814
6
+ metadata.gz: fa4b77bf91e75b93104a9059cf7549cb1d368f562dd5140a4e8bd57c923f1d9ad48a9cdc711829796a854f1f9bcb21339763015e6c498a65b925584e8e51fdd4
7
+ data.tar.gz: 234f127d1e947c824977b06a3d200f433316ef9900b2a666eac151987163e972493a7191eda45c1a2fa802accd5334f1e3154457d076b709f7f02b3fc500d1e6
data/README.md CHANGED
@@ -47,7 +47,7 @@ The result? LLM applications that actually scale and don't break when you sneeze
47
47
 
48
48
  ## Development Status
49
49
 
50
- DSPy.rb is actively developed and approaching stability at **v0.13.0**. The core framework is production-ready with comprehensive documentation, but I'm battle-testing features through the 0.x series before committing to a stable v1.0 API.
50
+ DSPy.rb is actively developed and approaching stability at **v0.15.4**. The core framework is production-ready with comprehensive documentation, but I'm battle-testing features through the 0.x series before committing to a stable v1.0 API.
51
51
 
52
52
  Real-world usage feedback is invaluable - if you encounter issues or have suggestions, please open a GitHub issue!
53
53
 
@@ -56,7 +56,7 @@ Real-world usage feedback is invaluable - if you encounter issues or have sugges
56
56
  ### Installation
57
57
 
58
58
  ```ruby
59
- gem 'dspy', '~> 0.13'
59
+ gem 'dspy', '~> 0.15'
60
60
  ```
61
61
 
62
62
  Or add to your Gemfile:
@@ -388,7 +388,17 @@ module DSPy
388
388
  def needs_array_conversion?(type)
389
389
  case type
390
390
  when T::Types::TypedArray
391
- needs_struct_conversion?(type.type)
391
+ needs_struct_conversion?(type.type) || is_enum_type?(type.type)
392
+ when T::Types::Union
393
+ # Handle nilable arrays: T.nilable(T::Array[...])
394
+ if is_nilable_type?(type)
395
+ # Find the non-nil type in the union
396
+ non_nil_type = type.types.find { |t| t != T::Utils.coerce(NilClass) }
397
+ # Recursively check if it needs array conversion
398
+ needs_array_conversion?(non_nil_type)
399
+ else
400
+ false
401
+ end
392
402
  else
393
403
  false
394
404
  end
@@ -396,6 +406,13 @@ module DSPy
396
406
 
397
407
  sig { params(array: T::Array[T.untyped], type: T.untyped).returns(T::Array[T.untyped]) }
398
408
  def convert_array_elements(array, type)
409
+ # Handle nilable arrays: T.nilable(T::Array[...])
410
+ if type.is_a?(T::Types::Union) && is_nilable_type?(type)
411
+ # Find the non-nil type (should be TypedArray)
412
+ array_type = type.types.find { |t| t != T::Utils.coerce(NilClass) }
413
+ return convert_array_elements(array, array_type)
414
+ end
415
+
399
416
  return array unless type.is_a?(T::Types::TypedArray)
400
417
 
401
418
  element_type = type.type
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.15.4"
4
+ VERSION = "0.15.5"
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dspy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.4
4
+ version: 0.15.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vicente Reig Rincón de Arellano
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-08-02 00:00:00.000000000 Z
10
+ date: 2025-08-03 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: dry-configurable