ruby-on-dspy 0.1.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.
Files changed (118) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +112 -0
  3. data/LICENSE +21 -0
  4. data/README.md +442 -0
  5. data/exe/ruby-on-dspy +7 -0
  6. data/lib/dspy_rb/cli.rb +83 -0
  7. data/lib/dspy_rb/clients/dummy_lm.rb +81 -0
  8. data/lib/dspy_rb/clients/lm.rb +44 -0
  9. data/lib/dspy_rb/datasets/data_loader.rb +74 -0
  10. data/lib/dspy_rb/datasets/dataset.rb +37 -0
  11. data/lib/dspy_rb/datasets/python_random.rb +38 -0
  12. data/lib/dspy_rb/errors.rb +135 -0
  13. data/lib/dspy_rb/evaluate/evaluate.rb +53 -0
  14. data/lib/dspy_rb/evaluate/metric.rb +61 -0
  15. data/lib/dspy_rb/execution/around.rb +63 -0
  16. data/lib/dspy_rb/execution/collector.rb +61 -0
  17. data/lib/dspy_rb/execution/context.rb +160 -0
  18. data/lib/dspy_rb/execution/evaluation.rb +90 -0
  19. data/lib/dspy_rb/execution/optimization.rb +71 -0
  20. data/lib/dspy_rb/execution/program.rb +126 -0
  21. data/lib/dspy_rb/execution/rows.rb +41 -0
  22. data/lib/dspy_rb/execution/scorer.rb +68 -0
  23. data/lib/dspy_rb/execution/step.rb +116 -0
  24. data/lib/dspy_rb/execution/toolbox.rb +28 -0
  25. data/lib/dspy_rb/predict/chain_of_thought.rb +22 -0
  26. data/lib/dspy_rb/predict/predict.rb +101 -0
  27. data/lib/dspy_rb/predict/react.rb +80 -0
  28. data/lib/dspy_rb/primitives/module.rb +105 -0
  29. data/lib/dspy_rb/primitives/parts.rb +121 -0
  30. data/lib/dspy_rb/runtime/channel/callback.rb +105 -0
  31. data/lib/dspy_rb/runtime/channel/ending.rb +35 -0
  32. data/lib/dspy_rb/runtime/channel/exchange.rb +176 -0
  33. data/lib/dspy_rb/runtime/channel/gate.rb +74 -0
  34. data/lib/dspy_rb/runtime/channel/listener.rb +125 -0
  35. data/lib/dspy_rb/runtime/channel/meter.rb +46 -0
  36. data/lib/dspy_rb/runtime/channel/reporter.rb +68 -0
  37. data/lib/dspy_rb/runtime/channel/settler.rb +69 -0
  38. data/lib/dspy_rb/runtime/channel/traffic.rb +121 -0
  39. data/lib/dspy_rb/runtime/channel/watchdog.rb +36 -0
  40. data/lib/dspy_rb/runtime/channel/writer.rb +77 -0
  41. data/lib/dspy_rb/runtime/channel.rb +145 -0
  42. data/lib/dspy_rb/runtime/child.rb +48 -0
  43. data/lib/dspy_rb/runtime/python.rb +43 -0
  44. data/lib/dspy_rb/runtime/registry.rb +48 -0
  45. data/lib/dspy_rb/runtime/startup.rb +53 -0
  46. data/lib/dspy_rb/secrets.rb +25 -0
  47. data/lib/dspy_rb/setup/environment.rb +120 -0
  48. data/lib/dspy_rb/setup/stale.rb +102 -0
  49. data/lib/dspy_rb/setup/uv.rb +122 -0
  50. data/lib/dspy_rb/signatures/signature.rb +100 -0
  51. data/lib/dspy_rb/signatures/types.rb +44 -0
  52. data/lib/dspy_rb/source.rb +64 -0
  53. data/lib/dspy_rb/teleprompt/bootstrap_few_shot.rb +9 -0
  54. data/lib/dspy_rb/teleprompt/bootstrap_few_shot_with_optuna.rb +9 -0
  55. data/lib/dspy_rb/teleprompt/bootstrap_few_shot_with_random_search.rb +9 -0
  56. data/lib/dspy_rb/teleprompt/gepa.rb +9 -0
  57. data/lib/dspy_rb/teleprompt/labeled_few_shot.rb +14 -0
  58. data/lib/dspy_rb/teleprompt/mipro_v2.rb +16 -0
  59. data/lib/dspy_rb/teleprompt/optimizer.rb +127 -0
  60. data/lib/dspy_rb/teleprompt/simba.rb +16 -0
  61. data/lib/dspy_rb/tool.rb +108 -0
  62. data/lib/dspy_rb/values/check.rb +14 -0
  63. data/lib/dspy_rb/values/context.rb +46 -0
  64. data/lib/dspy_rb/values/dataset.rb +55 -0
  65. data/lib/dspy_rb/values/dict.rb +17 -0
  66. data/lib/dspy_rb/values/env.rb +23 -0
  67. data/lib/dspy_rb/values/evaluation_result.rb +31 -0
  68. data/lib/dspy_rb/values/example.rb +134 -0
  69. data/lib/dspy_rb/values/fault.rb +15 -0
  70. data/lib/dspy_rb/values/history.rb +13 -0
  71. data/lib/dspy_rb/values/list.rb +16 -0
  72. data/lib/dspy_rb/values/literal.rb +27 -0
  73. data/lib/dspy_rb/values/loss.rb +12 -0
  74. data/lib/dspy_rb/values/optional.rb +16 -0
  75. data/lib/dspy_rb/values/prediction.rb +58 -0
  76. data/lib/dspy_rb/values/reasoning.rb +13 -0
  77. data/lib/dspy_rb/values/spend.rb +27 -0
  78. data/lib/dspy_rb/values/types.rb +164 -0
  79. data/lib/dspy_rb/version.rb +11 -0
  80. data/lib/dspy_rb/wire/departure.rb +100 -0
  81. data/lib/dspy_rb/wire/descriptions.rb +220 -0
  82. data/lib/dspy_rb/wire/facts.rb +79 -0
  83. data/lib/dspy_rb/wire/in_flight.rb +128 -0
  84. data/lib/dspy_rb/wire/json.rb +76 -0
  85. data/lib/dspy_rb/wire/optimizers.rb +240 -0
  86. data/lib/dspy_rb/wire/records.rb +44 -0
  87. data/lib/dspy_rb/wire/replies.rb +188 -0
  88. data/lib/dspy_rb/wire/requests.rb +214 -0
  89. data/lib/dspy_rb/wire/shape.rb +25 -0
  90. data/lib/dspy_rb/wire/types.rb +23 -0
  91. data/lib/dspy_rb/wire.rb +34 -0
  92. data/lib/dspy_rb.rb +191 -0
  93. data/lib/ruby-on-dspy.rb +4 -0
  94. data/python/dspy_rb/__init__.py +1 -0
  95. data/python/dspy_rb/__main__.py +76 -0
  96. data/python/dspy_rb/server/__init__.py +1 -0
  97. data/python/dspy_rb/server/build.py +281 -0
  98. data/python/dspy_rb/server/calls.py +215 -0
  99. data/python/dspy_rb/server/conversion.py +180 -0
  100. data/python/dspy_rb/server/data.py +169 -0
  101. data/python/dspy_rb/server/evaluation.py +107 -0
  102. data/python/dspy_rb/server/facts.py +357 -0
  103. data/python/dspy_rb/server/optimization.py +98 -0
  104. data/python/dspy_rb/server/pulse.py +68 -0
  105. data/python/dspy_rb/server/ruby.py +206 -0
  106. data/python/dspy_rb/server/serve.py +369 -0
  107. data/python/dspy_rb/server/standins.py +364 -0
  108. data/python/dspy_rb/server/state.py +104 -0
  109. data/python/dspy_rb/server/traffic.py +93 -0
  110. data/python/dspy_rb/values.py +51 -0
  111. data/python/dspy_rb/wire/__init__.py +1 -0
  112. data/python/dspy_rb/wire/channel.py +107 -0
  113. data/python/dspy_rb/wire/lines.py +269 -0
  114. data/python/dspy_rb/wire/shapes.py +1220 -0
  115. data/python/dspy_rb/wire/wire.json +4592 -0
  116. data/python/pyproject.toml +86 -0
  117. data/python/uv.lock +1576 -0
  118. metadata +230 -0
metadata ADDED
@@ -0,0 +1,230 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ruby-on-dspy
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Samuel Ralak
8
+ bindir: exe
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: dry-configurable
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - "~>"
17
+ - !ruby/object:Gem::Version
18
+ version: '1.3'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - "~>"
24
+ - !ruby/object:Gem::Version
25
+ version: '1.3'
26
+ - !ruby/object:Gem::Dependency
27
+ name: dry-initializer
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: '3.1'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '3.1'
40
+ - !ruby/object:Gem::Dependency
41
+ name: dry-struct
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '1.8'
47
+ type: :runtime
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '1.8'
54
+ - !ruby/object:Gem::Dependency
55
+ name: dry-types
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '1.8'
61
+ type: :runtime
62
+ prerelease: false
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '1.8'
68
+ - !ruby/object:Gem::Dependency
69
+ name: json
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '2.13'
75
+ type: :runtime
76
+ prerelease: false
77
+ version_requirements: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '2.13'
82
+ description: DSPy's API in Ruby. Signatures, predictors and modules are Ruby classes;
83
+ the real DSPy 3.5.0 runs them, in a Python process the gem installs and manages.
84
+ executables:
85
+ - ruby-on-dspy
86
+ extensions: []
87
+ extra_rdoc_files: []
88
+ files:
89
+ - CHANGELOG.md
90
+ - LICENSE
91
+ - README.md
92
+ - exe/ruby-on-dspy
93
+ - lib/dspy_rb.rb
94
+ - lib/dspy_rb/cli.rb
95
+ - lib/dspy_rb/clients/dummy_lm.rb
96
+ - lib/dspy_rb/clients/lm.rb
97
+ - lib/dspy_rb/datasets/data_loader.rb
98
+ - lib/dspy_rb/datasets/dataset.rb
99
+ - lib/dspy_rb/datasets/python_random.rb
100
+ - lib/dspy_rb/errors.rb
101
+ - lib/dspy_rb/evaluate/evaluate.rb
102
+ - lib/dspy_rb/evaluate/metric.rb
103
+ - lib/dspy_rb/execution/around.rb
104
+ - lib/dspy_rb/execution/collector.rb
105
+ - lib/dspy_rb/execution/context.rb
106
+ - lib/dspy_rb/execution/evaluation.rb
107
+ - lib/dspy_rb/execution/optimization.rb
108
+ - lib/dspy_rb/execution/program.rb
109
+ - lib/dspy_rb/execution/rows.rb
110
+ - lib/dspy_rb/execution/scorer.rb
111
+ - lib/dspy_rb/execution/step.rb
112
+ - lib/dspy_rb/execution/toolbox.rb
113
+ - lib/dspy_rb/predict/chain_of_thought.rb
114
+ - lib/dspy_rb/predict/predict.rb
115
+ - lib/dspy_rb/predict/react.rb
116
+ - lib/dspy_rb/primitives/module.rb
117
+ - lib/dspy_rb/primitives/parts.rb
118
+ - lib/dspy_rb/runtime/channel.rb
119
+ - lib/dspy_rb/runtime/channel/callback.rb
120
+ - lib/dspy_rb/runtime/channel/ending.rb
121
+ - lib/dspy_rb/runtime/channel/exchange.rb
122
+ - lib/dspy_rb/runtime/channel/gate.rb
123
+ - lib/dspy_rb/runtime/channel/listener.rb
124
+ - lib/dspy_rb/runtime/channel/meter.rb
125
+ - lib/dspy_rb/runtime/channel/reporter.rb
126
+ - lib/dspy_rb/runtime/channel/settler.rb
127
+ - lib/dspy_rb/runtime/channel/traffic.rb
128
+ - lib/dspy_rb/runtime/channel/watchdog.rb
129
+ - lib/dspy_rb/runtime/channel/writer.rb
130
+ - lib/dspy_rb/runtime/child.rb
131
+ - lib/dspy_rb/runtime/python.rb
132
+ - lib/dspy_rb/runtime/registry.rb
133
+ - lib/dspy_rb/runtime/startup.rb
134
+ - lib/dspy_rb/secrets.rb
135
+ - lib/dspy_rb/setup/environment.rb
136
+ - lib/dspy_rb/setup/stale.rb
137
+ - lib/dspy_rb/setup/uv.rb
138
+ - lib/dspy_rb/signatures/signature.rb
139
+ - lib/dspy_rb/signatures/types.rb
140
+ - lib/dspy_rb/source.rb
141
+ - lib/dspy_rb/teleprompt/bootstrap_few_shot.rb
142
+ - lib/dspy_rb/teleprompt/bootstrap_few_shot_with_optuna.rb
143
+ - lib/dspy_rb/teleprompt/bootstrap_few_shot_with_random_search.rb
144
+ - lib/dspy_rb/teleprompt/gepa.rb
145
+ - lib/dspy_rb/teleprompt/labeled_few_shot.rb
146
+ - lib/dspy_rb/teleprompt/mipro_v2.rb
147
+ - lib/dspy_rb/teleprompt/optimizer.rb
148
+ - lib/dspy_rb/teleprompt/simba.rb
149
+ - lib/dspy_rb/tool.rb
150
+ - lib/dspy_rb/values/check.rb
151
+ - lib/dspy_rb/values/context.rb
152
+ - lib/dspy_rb/values/dataset.rb
153
+ - lib/dspy_rb/values/dict.rb
154
+ - lib/dspy_rb/values/env.rb
155
+ - lib/dspy_rb/values/evaluation_result.rb
156
+ - lib/dspy_rb/values/example.rb
157
+ - lib/dspy_rb/values/fault.rb
158
+ - lib/dspy_rb/values/history.rb
159
+ - lib/dspy_rb/values/list.rb
160
+ - lib/dspy_rb/values/literal.rb
161
+ - lib/dspy_rb/values/loss.rb
162
+ - lib/dspy_rb/values/optional.rb
163
+ - lib/dspy_rb/values/prediction.rb
164
+ - lib/dspy_rb/values/reasoning.rb
165
+ - lib/dspy_rb/values/spend.rb
166
+ - lib/dspy_rb/values/types.rb
167
+ - lib/dspy_rb/version.rb
168
+ - lib/dspy_rb/wire.rb
169
+ - lib/dspy_rb/wire/departure.rb
170
+ - lib/dspy_rb/wire/descriptions.rb
171
+ - lib/dspy_rb/wire/facts.rb
172
+ - lib/dspy_rb/wire/in_flight.rb
173
+ - lib/dspy_rb/wire/json.rb
174
+ - lib/dspy_rb/wire/optimizers.rb
175
+ - lib/dspy_rb/wire/records.rb
176
+ - lib/dspy_rb/wire/replies.rb
177
+ - lib/dspy_rb/wire/requests.rb
178
+ - lib/dspy_rb/wire/shape.rb
179
+ - lib/dspy_rb/wire/types.rb
180
+ - lib/ruby-on-dspy.rb
181
+ - python/dspy_rb/__init__.py
182
+ - python/dspy_rb/__main__.py
183
+ - python/dspy_rb/server/__init__.py
184
+ - python/dspy_rb/server/build.py
185
+ - python/dspy_rb/server/calls.py
186
+ - python/dspy_rb/server/conversion.py
187
+ - python/dspy_rb/server/data.py
188
+ - python/dspy_rb/server/evaluation.py
189
+ - python/dspy_rb/server/facts.py
190
+ - python/dspy_rb/server/optimization.py
191
+ - python/dspy_rb/server/pulse.py
192
+ - python/dspy_rb/server/ruby.py
193
+ - python/dspy_rb/server/serve.py
194
+ - python/dspy_rb/server/standins.py
195
+ - python/dspy_rb/server/state.py
196
+ - python/dspy_rb/server/traffic.py
197
+ - python/dspy_rb/values.py
198
+ - python/dspy_rb/wire/__init__.py
199
+ - python/dspy_rb/wire/channel.py
200
+ - python/dspy_rb/wire/lines.py
201
+ - python/dspy_rb/wire/shapes.py
202
+ - python/dspy_rb/wire/wire.json
203
+ - python/pyproject.toml
204
+ - python/uv.lock
205
+ homepage: https://ruby-on-dspy.ralak.co
206
+ licenses:
207
+ - MIT
208
+ metadata:
209
+ source_code_uri: https://github.com/samuelralak/ruby-on-dspy
210
+ changelog_uri: https://github.com/samuelralak/ruby-on-dspy/blob/main/CHANGELOG.md
211
+ documentation_uri: https://ruby-on-dspy.ralak.co
212
+ rubygems_mfa_required: 'true'
213
+ rdoc_options: []
214
+ require_paths:
215
+ - lib
216
+ required_ruby_version: !ruby/object:Gem::Requirement
217
+ requirements:
218
+ - - ">="
219
+ - !ruby/object:Gem::Version
220
+ version: 3.3.1
221
+ required_rubygems_version: !ruby/object:Gem::Requirement
222
+ requirements:
223
+ - - ">="
224
+ - !ruby/object:Gem::Version
225
+ version: '0'
226
+ requirements: []
227
+ rubygems_version: 4.0.3
228
+ specification_version: 4
229
+ summary: 'Ruby on DSPy: Ruby bindings for DSPy'
230
+ test_files: []