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.
- checksums.yaml +7 -0
- data/CHANGELOG.md +112 -0
- data/LICENSE +21 -0
- data/README.md +442 -0
- data/exe/ruby-on-dspy +7 -0
- data/lib/dspy_rb/cli.rb +83 -0
- data/lib/dspy_rb/clients/dummy_lm.rb +81 -0
- data/lib/dspy_rb/clients/lm.rb +44 -0
- data/lib/dspy_rb/datasets/data_loader.rb +74 -0
- data/lib/dspy_rb/datasets/dataset.rb +37 -0
- data/lib/dspy_rb/datasets/python_random.rb +38 -0
- data/lib/dspy_rb/errors.rb +135 -0
- data/lib/dspy_rb/evaluate/evaluate.rb +53 -0
- data/lib/dspy_rb/evaluate/metric.rb +61 -0
- data/lib/dspy_rb/execution/around.rb +63 -0
- data/lib/dspy_rb/execution/collector.rb +61 -0
- data/lib/dspy_rb/execution/context.rb +160 -0
- data/lib/dspy_rb/execution/evaluation.rb +90 -0
- data/lib/dspy_rb/execution/optimization.rb +71 -0
- data/lib/dspy_rb/execution/program.rb +126 -0
- data/lib/dspy_rb/execution/rows.rb +41 -0
- data/lib/dspy_rb/execution/scorer.rb +68 -0
- data/lib/dspy_rb/execution/step.rb +116 -0
- data/lib/dspy_rb/execution/toolbox.rb +28 -0
- data/lib/dspy_rb/predict/chain_of_thought.rb +22 -0
- data/lib/dspy_rb/predict/predict.rb +101 -0
- data/lib/dspy_rb/predict/react.rb +80 -0
- data/lib/dspy_rb/primitives/module.rb +105 -0
- data/lib/dspy_rb/primitives/parts.rb +121 -0
- data/lib/dspy_rb/runtime/channel/callback.rb +105 -0
- data/lib/dspy_rb/runtime/channel/ending.rb +35 -0
- data/lib/dspy_rb/runtime/channel/exchange.rb +176 -0
- data/lib/dspy_rb/runtime/channel/gate.rb +74 -0
- data/lib/dspy_rb/runtime/channel/listener.rb +125 -0
- data/lib/dspy_rb/runtime/channel/meter.rb +46 -0
- data/lib/dspy_rb/runtime/channel/reporter.rb +68 -0
- data/lib/dspy_rb/runtime/channel/settler.rb +69 -0
- data/lib/dspy_rb/runtime/channel/traffic.rb +121 -0
- data/lib/dspy_rb/runtime/channel/watchdog.rb +36 -0
- data/lib/dspy_rb/runtime/channel/writer.rb +77 -0
- data/lib/dspy_rb/runtime/channel.rb +145 -0
- data/lib/dspy_rb/runtime/child.rb +48 -0
- data/lib/dspy_rb/runtime/python.rb +43 -0
- data/lib/dspy_rb/runtime/registry.rb +48 -0
- data/lib/dspy_rb/runtime/startup.rb +53 -0
- data/lib/dspy_rb/secrets.rb +25 -0
- data/lib/dspy_rb/setup/environment.rb +120 -0
- data/lib/dspy_rb/setup/stale.rb +102 -0
- data/lib/dspy_rb/setup/uv.rb +122 -0
- data/lib/dspy_rb/signatures/signature.rb +100 -0
- data/lib/dspy_rb/signatures/types.rb +44 -0
- data/lib/dspy_rb/source.rb +64 -0
- data/lib/dspy_rb/teleprompt/bootstrap_few_shot.rb +9 -0
- data/lib/dspy_rb/teleprompt/bootstrap_few_shot_with_optuna.rb +9 -0
- data/lib/dspy_rb/teleprompt/bootstrap_few_shot_with_random_search.rb +9 -0
- data/lib/dspy_rb/teleprompt/gepa.rb +9 -0
- data/lib/dspy_rb/teleprompt/labeled_few_shot.rb +14 -0
- data/lib/dspy_rb/teleprompt/mipro_v2.rb +16 -0
- data/lib/dspy_rb/teleprompt/optimizer.rb +127 -0
- data/lib/dspy_rb/teleprompt/simba.rb +16 -0
- data/lib/dspy_rb/tool.rb +108 -0
- data/lib/dspy_rb/values/check.rb +14 -0
- data/lib/dspy_rb/values/context.rb +46 -0
- data/lib/dspy_rb/values/dataset.rb +55 -0
- data/lib/dspy_rb/values/dict.rb +17 -0
- data/lib/dspy_rb/values/env.rb +23 -0
- data/lib/dspy_rb/values/evaluation_result.rb +31 -0
- data/lib/dspy_rb/values/example.rb +134 -0
- data/lib/dspy_rb/values/fault.rb +15 -0
- data/lib/dspy_rb/values/history.rb +13 -0
- data/lib/dspy_rb/values/list.rb +16 -0
- data/lib/dspy_rb/values/literal.rb +27 -0
- data/lib/dspy_rb/values/loss.rb +12 -0
- data/lib/dspy_rb/values/optional.rb +16 -0
- data/lib/dspy_rb/values/prediction.rb +58 -0
- data/lib/dspy_rb/values/reasoning.rb +13 -0
- data/lib/dspy_rb/values/spend.rb +27 -0
- data/lib/dspy_rb/values/types.rb +164 -0
- data/lib/dspy_rb/version.rb +11 -0
- data/lib/dspy_rb/wire/departure.rb +100 -0
- data/lib/dspy_rb/wire/descriptions.rb +220 -0
- data/lib/dspy_rb/wire/facts.rb +79 -0
- data/lib/dspy_rb/wire/in_flight.rb +128 -0
- data/lib/dspy_rb/wire/json.rb +76 -0
- data/lib/dspy_rb/wire/optimizers.rb +240 -0
- data/lib/dspy_rb/wire/records.rb +44 -0
- data/lib/dspy_rb/wire/replies.rb +188 -0
- data/lib/dspy_rb/wire/requests.rb +214 -0
- data/lib/dspy_rb/wire/shape.rb +25 -0
- data/lib/dspy_rb/wire/types.rb +23 -0
- data/lib/dspy_rb/wire.rb +34 -0
- data/lib/dspy_rb.rb +191 -0
- data/lib/ruby-on-dspy.rb +4 -0
- data/python/dspy_rb/__init__.py +1 -0
- data/python/dspy_rb/__main__.py +76 -0
- data/python/dspy_rb/server/__init__.py +1 -0
- data/python/dspy_rb/server/build.py +281 -0
- data/python/dspy_rb/server/calls.py +215 -0
- data/python/dspy_rb/server/conversion.py +180 -0
- data/python/dspy_rb/server/data.py +169 -0
- data/python/dspy_rb/server/evaluation.py +107 -0
- data/python/dspy_rb/server/facts.py +357 -0
- data/python/dspy_rb/server/optimization.py +98 -0
- data/python/dspy_rb/server/pulse.py +68 -0
- data/python/dspy_rb/server/ruby.py +206 -0
- data/python/dspy_rb/server/serve.py +369 -0
- data/python/dspy_rb/server/standins.py +364 -0
- data/python/dspy_rb/server/state.py +104 -0
- data/python/dspy_rb/server/traffic.py +93 -0
- data/python/dspy_rb/values.py +51 -0
- data/python/dspy_rb/wire/__init__.py +1 -0
- data/python/dspy_rb/wire/channel.py +107 -0
- data/python/dspy_rb/wire/lines.py +269 -0
- data/python/dspy_rb/wire/shapes.py +1220 -0
- data/python/dspy_rb/wire/wire.json +4592 -0
- data/python/pyproject.toml +86 -0
- data/python/uv.lock +1576 -0
- metadata +230 -0
|
@@ -0,0 +1,1220 @@
|
|
|
1
|
+
"""Typed views of the wire's shapes, generated by `rake wire` from lib/dspy_rb/wire/. Do not edit this file."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from dataclasses import dataclass
|
|
6
|
+
from typing import TYPE_CHECKING, Final, Literal
|
|
7
|
+
|
|
8
|
+
if TYPE_CHECKING:
|
|
9
|
+
from _typeshed import DataclassInstance
|
|
10
|
+
|
|
11
|
+
PROTOCOL: Final = 4
|
|
12
|
+
PACKAGE: Final = "0.1.0"
|
|
13
|
+
REQUESTS_FD: Final = 3
|
|
14
|
+
REPLIES_FD: Final = 4
|
|
15
|
+
ALIVE_INTERVAL: Final = 1
|
|
16
|
+
KEY_LIKE: Final = "(?i)\\b(?:sk|key|aiza)[-_][A-Za-z0-9_\\-*.]{4,}|[A-Za-z0-9_-]{24,}"
|
|
17
|
+
CUT_AT: Final = "(?i)authori[sz]ation|x-(?:goog-)?api-key|api[-_ ]?key|bearer|secret|password|cookie"
|
|
18
|
+
|
|
19
|
+
type JsonValue = str | int | float | bool | None | list[JsonValue] | dict[str, JsonValue]
|
|
20
|
+
type Values = dict[str, JsonValue]
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
24
|
+
class Adapter:
|
|
25
|
+
"""The wire's Adapter, as its struct in DSPyRb::Wire defines it."""
|
|
26
|
+
|
|
27
|
+
kind: Literal["chat", "json", "xml"]
|
|
28
|
+
options: Values
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
32
|
+
class Alive:
|
|
33
|
+
"""The wire's Alive, as its struct in DSPyRb::Wire defines it."""
|
|
34
|
+
|
|
35
|
+
kind: Literal["alive"] = "alive"
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
39
|
+
class BootstrapFewShotCompile:
|
|
40
|
+
"""The wire's BootstrapFewShotCompile, as its struct in DSPyRb::Wire defines it."""
|
|
41
|
+
|
|
42
|
+
name: Literal["bootstrap_few_shot"] = "bootstrap_few_shot"
|
|
43
|
+
teacher: Predictor | RubyProgram | None = None
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
47
|
+
class BootstrapFewShotOptions:
|
|
48
|
+
"""The wire's BootstrapFewShotOptions, as its struct in DSPyRb::Wire defines it."""
|
|
49
|
+
|
|
50
|
+
name: Literal["bootstrap_few_shot"] = "bootstrap_few_shot"
|
|
51
|
+
metric: Metric | RubyMetric | None = None
|
|
52
|
+
metric_threshold: float | None = None
|
|
53
|
+
teacher_settings: TeacherSettings | None = None
|
|
54
|
+
max_bootstrapped_demos: int | None = None
|
|
55
|
+
max_labeled_demos: int | None = None
|
|
56
|
+
max_rounds: int | None = None
|
|
57
|
+
max_errors: int | None = None
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
61
|
+
class BootstrapFewShotWithOptunaCompile:
|
|
62
|
+
"""The wire's BootstrapFewShotWithOptunaCompile, as its struct in DSPyRb::Wire defines it."""
|
|
63
|
+
|
|
64
|
+
name: Literal["bootstrap_few_shot_with_optuna"] = "bootstrap_few_shot_with_optuna"
|
|
65
|
+
teacher: Predictor | RubyProgram | None = None
|
|
66
|
+
max_demos: int
|
|
67
|
+
valset: list[Example] | None = None
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
71
|
+
class BootstrapFewShotWithOptunaOptions:
|
|
72
|
+
"""The wire's BootstrapFewShotWithOptunaOptions, as its struct in DSPyRb::Wire defines it."""
|
|
73
|
+
|
|
74
|
+
name: Literal["bootstrap_few_shot_with_optuna"] = "bootstrap_few_shot_with_optuna"
|
|
75
|
+
metric: Metric | RubyMetric
|
|
76
|
+
teacher_settings: TeacherSettings | None = None
|
|
77
|
+
max_bootstrapped_demos: int | None = None
|
|
78
|
+
max_labeled_demos: int | None = None
|
|
79
|
+
max_rounds: int | None = None
|
|
80
|
+
num_candidate_programs: int | None = None
|
|
81
|
+
num_threads: int | None = None
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
85
|
+
class BootstrapFewShotWithRandomSearchCompile:
|
|
86
|
+
"""The wire's BootstrapFewShotWithRandomSearchCompile, as its struct in DSPyRb::Wire defines it."""
|
|
87
|
+
|
|
88
|
+
name: Literal["bootstrap_few_shot_with_random_search"] = "bootstrap_few_shot_with_random_search"
|
|
89
|
+
teacher: Predictor | RubyProgram | None = None
|
|
90
|
+
valset: list[Example] | None = None
|
|
91
|
+
restrict: list[int] | None = None
|
|
92
|
+
labeled_sample: bool | None = None
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
96
|
+
class BootstrapFewShotWithRandomSearchOptions:
|
|
97
|
+
"""The wire's BootstrapFewShotWithRandomSearchOptions, as its struct in DSPyRb::Wire defines it."""
|
|
98
|
+
|
|
99
|
+
name: Literal["bootstrap_few_shot_with_random_search"] = "bootstrap_few_shot_with_random_search"
|
|
100
|
+
metric: Metric | RubyMetric
|
|
101
|
+
teacher_settings: TeacherSettings | None = None
|
|
102
|
+
max_bootstrapped_demos: int | None = None
|
|
103
|
+
max_labeled_demos: int | None = None
|
|
104
|
+
max_rounds: int | None = None
|
|
105
|
+
num_candidate_programs: int | None = None
|
|
106
|
+
num_threads: int | None = None
|
|
107
|
+
max_errors: int | None = None
|
|
108
|
+
stop_at_score: float | None = None
|
|
109
|
+
metric_threshold: float | None = None
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
113
|
+
class Call:
|
|
114
|
+
"""The wire's Call, as its struct in DSPyRb::Wire defines it."""
|
|
115
|
+
|
|
116
|
+
id: str
|
|
117
|
+
component: str | None = None
|
|
118
|
+
instruction: str | None = None
|
|
119
|
+
model: str
|
|
120
|
+
response_model: str | None = None
|
|
121
|
+
messages: list[Message]
|
|
122
|
+
usage: Usage | None = None
|
|
123
|
+
settings: Settings
|
|
124
|
+
cache_hit: bool
|
|
125
|
+
duration_ms: int
|
|
126
|
+
outcome: Literal["completed", "failed", "unsent"]
|
|
127
|
+
error: Failure | None = None
|
|
128
|
+
cost: float | None = None
|
|
129
|
+
cost_details: Values | None = None
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
133
|
+
class CallRequest:
|
|
134
|
+
"""The wire's CallRequest, as its struct in DSPyRb::Wire defines it."""
|
|
135
|
+
|
|
136
|
+
id: int
|
|
137
|
+
kind: Literal["call"] = "call"
|
|
138
|
+
predictor: Predictor
|
|
139
|
+
component: str | None = None
|
|
140
|
+
lm: LM | DummyLM | None = None
|
|
141
|
+
adapter: Adapter | None = None
|
|
142
|
+
inputs: Values
|
|
143
|
+
typed: list[Typed] | None = None
|
|
144
|
+
within: int | None = None
|
|
145
|
+
gated: bool | None = None
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
149
|
+
class Cancel:
|
|
150
|
+
"""The wire's Cancel, as its struct in DSPyRb::Wire defines it."""
|
|
151
|
+
|
|
152
|
+
kind: Literal["cancel"] = "cancel"
|
|
153
|
+
of: int
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
157
|
+
class Cancelled:
|
|
158
|
+
"""The wire's Cancelled, as its struct in DSPyRb::Wire defines it."""
|
|
159
|
+
|
|
160
|
+
id: int
|
|
161
|
+
kind: Literal["cancelled"] = "cancelled"
|
|
162
|
+
unrecorded: int = 0
|
|
163
|
+
running: int = 0
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
167
|
+
class Compile:
|
|
168
|
+
"""The wire's Compile, as its struct in DSPyRb::Wire defines it."""
|
|
169
|
+
|
|
170
|
+
id: int
|
|
171
|
+
kind: Literal["compile"] = "compile"
|
|
172
|
+
optimizer: (
|
|
173
|
+
LabeledFewShotOptions
|
|
174
|
+
| BootstrapFewShotOptions
|
|
175
|
+
| GEPAOptions
|
|
176
|
+
| MIPROv2Options
|
|
177
|
+
| BootstrapFewShotWithOptunaOptions
|
|
178
|
+
| BootstrapFewShotWithRandomSearchOptions
|
|
179
|
+
| SIMBAOptions
|
|
180
|
+
)
|
|
181
|
+
compiling: (
|
|
182
|
+
LabeledFewShotCompile
|
|
183
|
+
| BootstrapFewShotCompile
|
|
184
|
+
| GEPACompile
|
|
185
|
+
| MIPROv2Compile
|
|
186
|
+
| BootstrapFewShotWithOptunaCompile
|
|
187
|
+
| BootstrapFewShotWithRandomSearchCompile
|
|
188
|
+
| SIMBACompile
|
|
189
|
+
| None
|
|
190
|
+
) = None
|
|
191
|
+
student: Predictor | RubyProgram
|
|
192
|
+
trainset: list[Example]
|
|
193
|
+
lm: LM | DummyLM | None = None
|
|
194
|
+
adapter: Adapter | None = None
|
|
195
|
+
within: int | None = None
|
|
196
|
+
gated: bool | None = None
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
200
|
+
class Compiled:
|
|
201
|
+
"""The wire's Compiled, as its struct in DSPyRb::Wire defines it."""
|
|
202
|
+
|
|
203
|
+
id: int
|
|
204
|
+
kind: Literal["compiled"] = "compiled"
|
|
205
|
+
state: ProgramState
|
|
206
|
+
results: Values | None = None
|
|
207
|
+
unrecorded: int = 0
|
|
208
|
+
running: int = 0
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
212
|
+
class Completed:
|
|
213
|
+
"""The wire's Completed, as its struct in DSPyRb::Wire defines it."""
|
|
214
|
+
|
|
215
|
+
id: int
|
|
216
|
+
kind: Literal["completed"] = "completed"
|
|
217
|
+
outputs: Values
|
|
218
|
+
typed: list[Typed] | None = None
|
|
219
|
+
unrecorded: int = 0
|
|
220
|
+
running: int = 0
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
224
|
+
class DSPyDataset:
|
|
225
|
+
"""The wire's DSPyDataset, as its struct in DSPyRb::Wire defines it."""
|
|
226
|
+
|
|
227
|
+
name: Literal["hot_pot_qa", "gsm8k", "math", "colors"]
|
|
228
|
+
train_seed: int | None = None
|
|
229
|
+
train_size: int | None = None
|
|
230
|
+
eval_seed: int | None = None
|
|
231
|
+
dev_size: int | None = None
|
|
232
|
+
test_size: int | None = None
|
|
233
|
+
input_keys: list[str] | None = None
|
|
234
|
+
only_hard_examples: bool | None = None
|
|
235
|
+
keep_details: bool | str | None = None
|
|
236
|
+
unofficial_dev: bool | None = None
|
|
237
|
+
sort_by_suffix: bool | None = None
|
|
238
|
+
subset: str | None = None
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
242
|
+
class DataFile:
|
|
243
|
+
"""The wire's DataFile, as its struct in DSPyRb::Wire defines it."""
|
|
244
|
+
|
|
245
|
+
format: Literal["csv", "json", "parquet"]
|
|
246
|
+
file_path: str
|
|
247
|
+
fields: list[str] | None = None
|
|
248
|
+
input_keys: list[str] | None = None
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
252
|
+
class Describe:
|
|
253
|
+
"""The wire's Describe, as its struct in DSPyRb::Wire defines it."""
|
|
254
|
+
|
|
255
|
+
id: int
|
|
256
|
+
kind: Literal["describe"] = "describe"
|
|
257
|
+
predictor: Predictor
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
261
|
+
class DescribeLM:
|
|
262
|
+
"""The wire's DescribeLM, as its struct in DSPyRb::Wire defines it."""
|
|
263
|
+
|
|
264
|
+
id: int
|
|
265
|
+
kind: Literal["describe_lm"] = "describe_lm"
|
|
266
|
+
lm: LM | DummyLM
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
270
|
+
class DescribeTool:
|
|
271
|
+
"""The wire's DescribeTool, as its struct in DSPyRb::Wire defines it."""
|
|
272
|
+
|
|
273
|
+
id: int
|
|
274
|
+
kind: Literal["describe_tool"] = "describe_tool"
|
|
275
|
+
tool: Tool
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
279
|
+
class Described:
|
|
280
|
+
"""The wire's Described, as its struct in DSPyRb::Wire defines it."""
|
|
281
|
+
|
|
282
|
+
id: int
|
|
283
|
+
kind: Literal["described"] = "described"
|
|
284
|
+
instruction: str
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
288
|
+
class DummyLM:
|
|
289
|
+
"""The wire's DummyLM, as its struct in DSPyRb::Wire defines it."""
|
|
290
|
+
|
|
291
|
+
answers: list[Values] | dict[str, Values]
|
|
292
|
+
follow_examples: bool | None = None
|
|
293
|
+
reasoning: bool | None = None
|
|
294
|
+
adapter: Adapter | None = None
|
|
295
|
+
copies: list[Values] | None = None
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
299
|
+
class Evaluate:
|
|
300
|
+
"""The wire's Evaluate, as its struct in DSPyRb::Wire defines it."""
|
|
301
|
+
|
|
302
|
+
id: int
|
|
303
|
+
kind: Literal["evaluate"] = "evaluate"
|
|
304
|
+
program: Predictor | RubyProgram
|
|
305
|
+
devset: list[Example]
|
|
306
|
+
metric: Metric | RubyMetric
|
|
307
|
+
component: str | None = None
|
|
308
|
+
lm: LM | DummyLM | None = None
|
|
309
|
+
adapter: Adapter | None = None
|
|
310
|
+
options: EvaluateOptions
|
|
311
|
+
overrides: EvaluateOverrides
|
|
312
|
+
within: int | None = None
|
|
313
|
+
gated: bool | None = None
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
317
|
+
class EvaluateOptions:
|
|
318
|
+
"""The wire's EvaluateOptions, as its struct in DSPyRb::Wire defines it."""
|
|
319
|
+
|
|
320
|
+
num_threads: int | None = None
|
|
321
|
+
display_progress: bool | None = None
|
|
322
|
+
display_table: bool | int | None = None
|
|
323
|
+
max_errors: int | None = None
|
|
324
|
+
provide_traceback: bool | None = None
|
|
325
|
+
failure_score: float | None = None
|
|
326
|
+
save_as_csv: str | None = None
|
|
327
|
+
save_as_json: str | None = None
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
331
|
+
class EvaluateOverrides:
|
|
332
|
+
"""The wire's EvaluateOverrides, as its struct in DSPyRb::Wire defines it."""
|
|
333
|
+
|
|
334
|
+
num_threads: int | None = None
|
|
335
|
+
display_progress: bool | None = None
|
|
336
|
+
display_table: bool | int | None = None
|
|
337
|
+
callback_metadata: Values | None = None
|
|
338
|
+
save_as_csv: str | None = None
|
|
339
|
+
save_as_json: str | None = None
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
343
|
+
class Evaluated:
|
|
344
|
+
"""The wire's Evaluated, as its struct in DSPyRb::Wire defines it."""
|
|
345
|
+
|
|
346
|
+
id: int
|
|
347
|
+
kind: Literal["evaluated"] = "evaluated"
|
|
348
|
+
score: float
|
|
349
|
+
results: list[Result]
|
|
350
|
+
unrecorded: int = 0
|
|
351
|
+
running: int = 0
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
355
|
+
class Example:
|
|
356
|
+
"""The wire's Example, as its struct in DSPyRb::Wire defines it."""
|
|
357
|
+
|
|
358
|
+
record: Values
|
|
359
|
+
input_keys: list[str] | None = None
|
|
360
|
+
typed: list[Typed] | None = None
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
364
|
+
class Failed:
|
|
365
|
+
"""The wire's Failed, as its struct in DSPyRb::Wire defines it."""
|
|
366
|
+
|
|
367
|
+
id: int
|
|
368
|
+
kind: Literal["failed"] = "failed"
|
|
369
|
+
error: Failure
|
|
370
|
+
unrecorded: int = 0
|
|
371
|
+
running: int = 0
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
375
|
+
class Failure:
|
|
376
|
+
"""The wire's Failure, as its struct in DSPyRb::Wire defines it."""
|
|
377
|
+
|
|
378
|
+
ancestry: list[str]
|
|
379
|
+
message: str
|
|
380
|
+
retryable: bool
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
384
|
+
class Field:
|
|
385
|
+
"""The wire's Field, as its struct in DSPyRb::Wire defines it."""
|
|
386
|
+
|
|
387
|
+
name: str
|
|
388
|
+
role: Literal["input", "output"]
|
|
389
|
+
type: str | None = None
|
|
390
|
+
desc: str | None = None
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
394
|
+
class GEPACompile:
|
|
395
|
+
"""The wire's GEPACompile, as its struct in DSPyRb::Wire defines it."""
|
|
396
|
+
|
|
397
|
+
name: Literal["gepa"] = "gepa"
|
|
398
|
+
teacher: Predictor | RubyProgram | None = None
|
|
399
|
+
valset: list[Example] | None = None
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
403
|
+
class GEPAOptions:
|
|
404
|
+
"""The wire's GEPAOptions, as its struct in DSPyRb::Wire defines it."""
|
|
405
|
+
|
|
406
|
+
name: Literal["gepa"] = "gepa"
|
|
407
|
+
metric: Metric | RubyMetric
|
|
408
|
+
auto: Literal["light", "medium", "heavy"] | None = None
|
|
409
|
+
max_full_evals: int | None = None
|
|
410
|
+
max_metric_calls: int | None = None
|
|
411
|
+
reflection_minibatch_size: int | None = None
|
|
412
|
+
candidate_selection_strategy: str | None = None
|
|
413
|
+
reflection_lm: LM | DummyLM | None = None
|
|
414
|
+
skip_perfect_score: bool | None = None
|
|
415
|
+
add_format_failure_as_feedback: bool | None = None
|
|
416
|
+
component_selector: str | None = None
|
|
417
|
+
use_merge: bool | None = None
|
|
418
|
+
max_merge_invocations: int | None = None
|
|
419
|
+
num_threads: int | None = None
|
|
420
|
+
failure_score: float | None = None
|
|
421
|
+
perfect_score: float | None = None
|
|
422
|
+
log_dir: str | None = None
|
|
423
|
+
track_stats: bool | None = None
|
|
424
|
+
track_best_outputs: bool | None = None
|
|
425
|
+
warn_on_score_mismatch: bool | None = None
|
|
426
|
+
seed: int | None = None
|
|
427
|
+
gepa_kwargs: Values | None = None
|
|
428
|
+
none: list[Literal["seed"]] | None = None
|
|
429
|
+
|
|
430
|
+
|
|
431
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
432
|
+
class GateCall:
|
|
433
|
+
"""The wire's GateCall, as its struct in DSPyRb::Wire defines it."""
|
|
434
|
+
|
|
435
|
+
id: int
|
|
436
|
+
kind: Literal["gate"] = "gate"
|
|
437
|
+
request: int
|
|
438
|
+
pending: PendingCall
|
|
439
|
+
in_force: InForce | None = None
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
443
|
+
class Generate:
|
|
444
|
+
"""The wire's Generate, as its struct in DSPyRb::Wire defines it."""
|
|
445
|
+
|
|
446
|
+
id: int
|
|
447
|
+
kind: Literal["generate"] = "generate"
|
|
448
|
+
lm: LM | DummyLM
|
|
449
|
+
adapter: Adapter | None = None
|
|
450
|
+
prompt: str
|
|
451
|
+
options: Values
|
|
452
|
+
within: int | None = None
|
|
453
|
+
gated: bool | None = None
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
457
|
+
class Generated:
|
|
458
|
+
"""The wire's Generated, as its struct in DSPyRb::Wire defines it."""
|
|
459
|
+
|
|
460
|
+
id: int
|
|
461
|
+
kind: Literal["generated"] = "generated"
|
|
462
|
+
outputs: list[JsonValue]
|
|
463
|
+
unrecorded: int = 0
|
|
464
|
+
running: int = 0
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
468
|
+
class Hello:
|
|
469
|
+
"""The wire's Hello, as its struct in DSPyRb::Wire defines it."""
|
|
470
|
+
|
|
471
|
+
id: int
|
|
472
|
+
kind: Literal["hello"] = "hello"
|
|
473
|
+
protocol: int
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
477
|
+
class HubDataset:
|
|
478
|
+
"""The wire's HubDataset, as its struct in DSPyRb::Wire defines it."""
|
|
479
|
+
|
|
480
|
+
dataset_name: str
|
|
481
|
+
arguments: list[JsonValue]
|
|
482
|
+
options: Values
|
|
483
|
+
fields: list[str] | None = None
|
|
484
|
+
input_keys: list[str] | None = None
|
|
485
|
+
|
|
486
|
+
|
|
487
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
488
|
+
class InForce:
|
|
489
|
+
"""The wire's InForce, as its struct in DSPyRb::Wire defines it."""
|
|
490
|
+
|
|
491
|
+
lm: LM | DummyLM
|
|
492
|
+
changes: Values
|
|
493
|
+
|
|
494
|
+
|
|
495
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
496
|
+
class LM:
|
|
497
|
+
"""The wire's LM, as its struct in DSPyRb::Wire defines it."""
|
|
498
|
+
|
|
499
|
+
model: str
|
|
500
|
+
options: Values
|
|
501
|
+
api_key_env: str | None = None
|
|
502
|
+
copies: list[Values] | None = None
|
|
503
|
+
|
|
504
|
+
|
|
505
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
506
|
+
class LMDescribed:
|
|
507
|
+
"""The wire's LMDescribed, as its struct in DSPyRb::Wire defines it."""
|
|
508
|
+
|
|
509
|
+
id: int
|
|
510
|
+
kind: Literal["lm_described"] = "lm_described"
|
|
511
|
+
kwargs: Values
|
|
512
|
+
|
|
513
|
+
|
|
514
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
515
|
+
class LabeledFewShotCompile:
|
|
516
|
+
"""The wire's LabeledFewShotCompile, as its struct in DSPyRb::Wire defines it."""
|
|
517
|
+
|
|
518
|
+
name: Literal["labeled_few_shot"] = "labeled_few_shot"
|
|
519
|
+
sample: bool | None = None
|
|
520
|
+
|
|
521
|
+
|
|
522
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
523
|
+
class LabeledFewShotOptions:
|
|
524
|
+
"""The wire's LabeledFewShotOptions, as its struct in DSPyRb::Wire defines it."""
|
|
525
|
+
|
|
526
|
+
name: Literal["labeled_few_shot"] = "labeled_few_shot"
|
|
527
|
+
k: int | None = None
|
|
528
|
+
|
|
529
|
+
|
|
530
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
531
|
+
class Load:
|
|
532
|
+
"""The wire's Load, as its struct in DSPyRb::Wire defines it."""
|
|
533
|
+
|
|
534
|
+
id: int
|
|
535
|
+
kind: Literal["load"] = "load"
|
|
536
|
+
source: DSPyDataset | HubDataset | DataFile
|
|
537
|
+
within: int | None = None
|
|
538
|
+
|
|
539
|
+
|
|
540
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
541
|
+
class LoadState:
|
|
542
|
+
"""The wire's LoadState, as its struct in DSPyRb::Wire defines it."""
|
|
543
|
+
|
|
544
|
+
id: int
|
|
545
|
+
kind: Literal["load_state"] = "load_state"
|
|
546
|
+
program: Predictor | RubyProgram
|
|
547
|
+
path: str
|
|
548
|
+
within: int | None = None
|
|
549
|
+
|
|
550
|
+
|
|
551
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
552
|
+
class Loaded:
|
|
553
|
+
"""The wire's Loaded, as its struct in DSPyRb::Wire defines it."""
|
|
554
|
+
|
|
555
|
+
id: int
|
|
556
|
+
kind: Literal["loaded"] = "loaded"
|
|
557
|
+
splits: list[Split] | None = None
|
|
558
|
+
examples: list[Example] | None = None
|
|
559
|
+
unrecorded: int = 0
|
|
560
|
+
running: int = 0
|
|
561
|
+
|
|
562
|
+
|
|
563
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
564
|
+
class MIPROv2Compile:
|
|
565
|
+
"""The wire's MIPROv2Compile, as its struct in DSPyRb::Wire defines it."""
|
|
566
|
+
|
|
567
|
+
name: Literal["mipro_v2"] = "mipro_v2"
|
|
568
|
+
teacher: Predictor | RubyProgram | None = None
|
|
569
|
+
valset: list[Example] | None = None
|
|
570
|
+
num_trials: int | None = None
|
|
571
|
+
max_bootstrapped_demos: int | None = None
|
|
572
|
+
max_labeled_demos: int | None = None
|
|
573
|
+
seed: int | None = None
|
|
574
|
+
minibatch: bool | None = None
|
|
575
|
+
minibatch_size: int | None = None
|
|
576
|
+
minibatch_full_eval_steps: int | None = None
|
|
577
|
+
program_aware_proposer: bool | None = None
|
|
578
|
+
data_aware_proposer: bool | None = None
|
|
579
|
+
view_data_batch_size: int | None = None
|
|
580
|
+
tip_aware_proposer: bool | None = None
|
|
581
|
+
fewshot_aware_proposer: bool | None = None
|
|
582
|
+
requires_permission_to_run: bool | None = None
|
|
583
|
+
provide_traceback: bool | None = None
|
|
584
|
+
|
|
585
|
+
|
|
586
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
587
|
+
class MIPROv2Options:
|
|
588
|
+
"""The wire's MIPROv2Options, as its struct in DSPyRb::Wire defines it."""
|
|
589
|
+
|
|
590
|
+
name: Literal["mipro_v2"] = "mipro_v2"
|
|
591
|
+
metric: Metric | RubyMetric
|
|
592
|
+
prompt_model: LM | DummyLM | None = None
|
|
593
|
+
task_model: LM | DummyLM | None = None
|
|
594
|
+
teacher_settings: TeacherSettings | None = None
|
|
595
|
+
max_bootstrapped_demos: int | None = None
|
|
596
|
+
max_labeled_demos: int | None = None
|
|
597
|
+
auto: Literal["light", "medium", "heavy"] | None = None
|
|
598
|
+
num_candidates: int | None = None
|
|
599
|
+
num_threads: int | None = None
|
|
600
|
+
max_errors: int | None = None
|
|
601
|
+
seed: int | None = None
|
|
602
|
+
init_temperature: float | None = None
|
|
603
|
+
verbose: bool | None = None
|
|
604
|
+
track_stats: bool | None = None
|
|
605
|
+
log_dir: str | None = None
|
|
606
|
+
metric_threshold: float | None = None
|
|
607
|
+
none: list[Literal["auto", "seed"]] | None = None
|
|
608
|
+
|
|
609
|
+
|
|
610
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
611
|
+
class Measure:
|
|
612
|
+
"""The wire's Measure, as its struct in DSPyRb::Wire defines it."""
|
|
613
|
+
|
|
614
|
+
id: int
|
|
615
|
+
kind: Literal["measure"] = "measure"
|
|
616
|
+
metric: Metric
|
|
617
|
+
example: Example
|
|
618
|
+
prediction: Values
|
|
619
|
+
lm: LM | DummyLM | None = None
|
|
620
|
+
adapter: Adapter | None = None
|
|
621
|
+
within: int | None = None
|
|
622
|
+
gated: bool | None = None
|
|
623
|
+
|
|
624
|
+
|
|
625
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
626
|
+
class Measured:
|
|
627
|
+
"""The wire's Measured, as its struct in DSPyRb::Wire defines it."""
|
|
628
|
+
|
|
629
|
+
id: int
|
|
630
|
+
kind: Literal["measured"] = "measured"
|
|
631
|
+
score: Score
|
|
632
|
+
unrecorded: int = 0
|
|
633
|
+
running: int = 0
|
|
634
|
+
|
|
635
|
+
|
|
636
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
637
|
+
class Message:
|
|
638
|
+
"""The wire's Message, as its struct in DSPyRb::Wire defines it."""
|
|
639
|
+
|
|
640
|
+
role: str
|
|
641
|
+
text: str
|
|
642
|
+
thinking: str | None = None
|
|
643
|
+
|
|
644
|
+
|
|
645
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
646
|
+
class Metric:
|
|
647
|
+
"""The wire's Metric, as its struct in DSPyRb::Wire defines it."""
|
|
648
|
+
|
|
649
|
+
name: Literal[
|
|
650
|
+
"answer_exact_match",
|
|
651
|
+
"answer_passage_match",
|
|
652
|
+
"semantic_f1",
|
|
653
|
+
"complete_and_grounded",
|
|
654
|
+
"gsm8k_metric",
|
|
655
|
+
"math_metric",
|
|
656
|
+
]
|
|
657
|
+
frac: float | None = None
|
|
658
|
+
threshold: float | None = None
|
|
659
|
+
decompositional: bool | None = None
|
|
660
|
+
|
|
661
|
+
|
|
662
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
663
|
+
class MetricCall:
|
|
664
|
+
"""The wire's MetricCall, as its struct in DSPyRb::Wire defines it."""
|
|
665
|
+
|
|
666
|
+
id: int
|
|
667
|
+
kind: Literal["metric"] = "metric"
|
|
668
|
+
request: int
|
|
669
|
+
given: int
|
|
670
|
+
example: Example
|
|
671
|
+
prediction: Values | None = None
|
|
672
|
+
typed: list[Typed] | None = None
|
|
673
|
+
trace: list[TraceStep] | None = None
|
|
674
|
+
pred_name: str | None = None
|
|
675
|
+
pred_trace: list[TraceStep] | None = None
|
|
676
|
+
in_force: InForce | None = None
|
|
677
|
+
|
|
678
|
+
|
|
679
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
680
|
+
class NextCall:
|
|
681
|
+
"""The wire's NextCall, as its struct in DSPyRb::Wire defines it."""
|
|
682
|
+
|
|
683
|
+
id: int
|
|
684
|
+
kind: Literal["next"] = "next"
|
|
685
|
+
request: int
|
|
686
|
+
|
|
687
|
+
|
|
688
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
689
|
+
class Parameter:
|
|
690
|
+
"""The wire's Parameter, as its struct in DSPyRb::Wire defines it."""
|
|
691
|
+
|
|
692
|
+
name: str | None = None
|
|
693
|
+
kind: Literal["req", "opt", "rest", "keyreq", "key", "keyrest"]
|
|
694
|
+
|
|
695
|
+
|
|
696
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
697
|
+
class Part:
|
|
698
|
+
"""The wire's Part, as its struct in DSPyRb::Wire defines it."""
|
|
699
|
+
|
|
700
|
+
path: str
|
|
701
|
+
predictor: Predictor | None = None
|
|
702
|
+
same: str | None = None
|
|
703
|
+
|
|
704
|
+
|
|
705
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
706
|
+
class PendingCall:
|
|
707
|
+
"""The wire's PendingCall, as its struct in DSPyRb::Wire defines it."""
|
|
708
|
+
|
|
709
|
+
id: str
|
|
710
|
+
component: str | None = None
|
|
711
|
+
model: str
|
|
712
|
+
messages: list[Message]
|
|
713
|
+
settings: Settings
|
|
714
|
+
n: int
|
|
715
|
+
|
|
716
|
+
|
|
717
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
718
|
+
class Permute:
|
|
719
|
+
"""The wire's Permute, as its struct in DSPyRb::Wire defines it."""
|
|
720
|
+
|
|
721
|
+
id: int
|
|
722
|
+
kind: Literal["permute"] = "permute"
|
|
723
|
+
draw: Literal["shuffle", "sample", "train_test_split"]
|
|
724
|
+
count: int
|
|
725
|
+
seed: int | None = None
|
|
726
|
+
k: int | None = None
|
|
727
|
+
train_size: float | None = None
|
|
728
|
+
test_size: float | None = None
|
|
729
|
+
random_state: int | None = None
|
|
730
|
+
|
|
731
|
+
|
|
732
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
733
|
+
class Permuted:
|
|
734
|
+
"""The wire's Permuted, as its struct in DSPyRb::Wire defines it."""
|
|
735
|
+
|
|
736
|
+
id: int
|
|
737
|
+
kind: Literal["permuted"] = "permuted"
|
|
738
|
+
parts: list[list[int]]
|
|
739
|
+
|
|
740
|
+
|
|
741
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
742
|
+
class Predictor:
|
|
743
|
+
"""The wire's Predictor, as its struct in DSPyRb::Wire defines it."""
|
|
744
|
+
|
|
745
|
+
kind: Literal["predict", "chain_of_thought", "react"]
|
|
746
|
+
fields: list[Field]
|
|
747
|
+
reasoning: Literal["written"] | None = None
|
|
748
|
+
instructions: str | None = None
|
|
749
|
+
demos: list[Example] | None = None
|
|
750
|
+
tools: list[Tool] | None = None
|
|
751
|
+
max_iters: int | None = None
|
|
752
|
+
task: str | None = None
|
|
753
|
+
compiled: bool | None = None
|
|
754
|
+
teacher: bool | None = None
|
|
755
|
+
|
|
756
|
+
|
|
757
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
758
|
+
class PredictorState:
|
|
759
|
+
"""The wire's PredictorState, as its struct in DSPyRb::Wire defines it."""
|
|
760
|
+
|
|
761
|
+
name: str
|
|
762
|
+
instructions: str | None = None
|
|
763
|
+
demos: list[Example]
|
|
764
|
+
|
|
765
|
+
|
|
766
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
767
|
+
class ProgramCall:
|
|
768
|
+
"""The wire's ProgramCall, as its struct in DSPyRb::Wire defines it."""
|
|
769
|
+
|
|
770
|
+
id: int
|
|
771
|
+
kind: Literal["program"] = "program"
|
|
772
|
+
request: int
|
|
773
|
+
inputs: Values
|
|
774
|
+
teacher: bool | None = None
|
|
775
|
+
in_force: InForce | None = None
|
|
776
|
+
|
|
777
|
+
|
|
778
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
779
|
+
class ProgramState:
|
|
780
|
+
"""The wire's ProgramState, as its struct in DSPyRb::Wire defines it."""
|
|
781
|
+
|
|
782
|
+
predictors: list[PredictorState]
|
|
783
|
+
compiled: bool
|
|
784
|
+
|
|
785
|
+
|
|
786
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
787
|
+
class Progress:
|
|
788
|
+
"""The wire's Progress, as its struct in DSPyRb::Wire defines it."""
|
|
789
|
+
|
|
790
|
+
id: int
|
|
791
|
+
kind: Literal["progress"] = "progress"
|
|
792
|
+
call: Call | None = None
|
|
793
|
+
|
|
794
|
+
|
|
795
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
796
|
+
class Raised:
|
|
797
|
+
"""The wire's Raised, as its struct in DSPyRb::Wire defines it."""
|
|
798
|
+
|
|
799
|
+
id: int
|
|
800
|
+
kind: Literal["raised"] = "raised"
|
|
801
|
+
error: RubyFailure
|
|
802
|
+
|
|
803
|
+
|
|
804
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
805
|
+
class Refused:
|
|
806
|
+
"""The wire's Refused, as its struct in DSPyRb::Wire defines it."""
|
|
807
|
+
|
|
808
|
+
id: int | None = None
|
|
809
|
+
kind: Literal["refused"] = "refused"
|
|
810
|
+
reason: str
|
|
811
|
+
|
|
812
|
+
|
|
813
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
814
|
+
class Result:
|
|
815
|
+
"""The wire's Result, as its struct in DSPyRb::Wire defines it."""
|
|
816
|
+
|
|
817
|
+
prediction: Values
|
|
818
|
+
typed: list[Typed] | None = None
|
|
819
|
+
score: Score
|
|
820
|
+
|
|
821
|
+
|
|
822
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
823
|
+
class Returned:
|
|
824
|
+
"""The wire's Returned, as its struct in DSPyRb::Wire defines it."""
|
|
825
|
+
|
|
826
|
+
id: int
|
|
827
|
+
kind: Literal["returned"] = "returned"
|
|
828
|
+
value: JsonValue | None = None
|
|
829
|
+
prediction: Values | None = None
|
|
830
|
+
typed: list[Typed] | None = None
|
|
831
|
+
|
|
832
|
+
|
|
833
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
834
|
+
class RubyFailure:
|
|
835
|
+
"""The wire's RubyFailure, as its struct in DSPyRb::Wire defines it."""
|
|
836
|
+
|
|
837
|
+
ruby_class: str
|
|
838
|
+
message: str
|
|
839
|
+
fatal: bool
|
|
840
|
+
of: int | None = None
|
|
841
|
+
|
|
842
|
+
|
|
843
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
844
|
+
class RubyMetric:
|
|
845
|
+
"""The wire's RubyMetric, as its struct in DSPyRb::Wire defines it."""
|
|
846
|
+
|
|
847
|
+
ruby: str
|
|
848
|
+
parameters: list[Parameter]
|
|
849
|
+
|
|
850
|
+
|
|
851
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
852
|
+
class RubyProgram:
|
|
853
|
+
"""The wire's RubyProgram, as its struct in DSPyRb::Wire defines it."""
|
|
854
|
+
|
|
855
|
+
ruby: str
|
|
856
|
+
parts: list[Part] | None = None
|
|
857
|
+
compiled: bool | None = None
|
|
858
|
+
compiled_modules: list[str] | None = None
|
|
859
|
+
teacher: bool | None = None
|
|
860
|
+
source: str | None = None
|
|
861
|
+
|
|
862
|
+
|
|
863
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
864
|
+
class SIMBACompile:
|
|
865
|
+
"""The wire's SIMBACompile, as its struct in DSPyRb::Wire defines it."""
|
|
866
|
+
|
|
867
|
+
name: Literal["simba"] = "simba"
|
|
868
|
+
seed: int | None = None
|
|
869
|
+
none: list[Literal["seed"]] | None = None
|
|
870
|
+
|
|
871
|
+
|
|
872
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
873
|
+
class SIMBAOptions:
|
|
874
|
+
"""The wire's SIMBAOptions, as its struct in DSPyRb::Wire defines it."""
|
|
875
|
+
|
|
876
|
+
name: Literal["simba"] = "simba"
|
|
877
|
+
metric: Metric | RubyMetric
|
|
878
|
+
bsize: int | None = None
|
|
879
|
+
num_candidates: int | None = None
|
|
880
|
+
max_steps: int | None = None
|
|
881
|
+
max_demos: int | None = None
|
|
882
|
+
prompt_model: LM | DummyLM | None = None
|
|
883
|
+
teacher_settings: TeacherSettings | None = None
|
|
884
|
+
demo_input_field_maxlen: int | None = None
|
|
885
|
+
num_threads: int | None = None
|
|
886
|
+
temperature_for_sampling: float | None = None
|
|
887
|
+
temperature_for_candidates: float | None = None
|
|
888
|
+
|
|
889
|
+
|
|
890
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
891
|
+
class SaveState:
|
|
892
|
+
"""The wire's SaveState, as its struct in DSPyRb::Wire defines it."""
|
|
893
|
+
|
|
894
|
+
id: int
|
|
895
|
+
kind: Literal["save_state"] = "save_state"
|
|
896
|
+
program: Predictor | RubyProgram
|
|
897
|
+
path: str
|
|
898
|
+
within: int | None = None
|
|
899
|
+
|
|
900
|
+
|
|
901
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
902
|
+
class Score:
|
|
903
|
+
"""The wire's Score, as its struct in DSPyRb::Wire defines it."""
|
|
904
|
+
|
|
905
|
+
value: JsonValue | None = None
|
|
906
|
+
prediction: Values | None = None
|
|
907
|
+
|
|
908
|
+
|
|
909
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
910
|
+
class Settings:
|
|
911
|
+
"""The wire's Settings, as its struct in DSPyRb::Wire defines it."""
|
|
912
|
+
|
|
913
|
+
temperature: float | None = None
|
|
914
|
+
max_tokens: int | None = None
|
|
915
|
+
reasoning_effort: str | None = None
|
|
916
|
+
thinking_budget: int | None = None
|
|
917
|
+
|
|
918
|
+
|
|
919
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
920
|
+
class Split:
|
|
921
|
+
"""The wire's Split, as its struct in DSPyRb::Wire defines it."""
|
|
922
|
+
|
|
923
|
+
name: str
|
|
924
|
+
examples: list[Example] | None = None
|
|
925
|
+
error: Failure | None = None
|
|
926
|
+
|
|
927
|
+
|
|
928
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
929
|
+
class StateLoaded:
|
|
930
|
+
"""The wire's StateLoaded, as its struct in DSPyRb::Wire defines it."""
|
|
931
|
+
|
|
932
|
+
id: int
|
|
933
|
+
kind: Literal["state_loaded"] = "state_loaded"
|
|
934
|
+
state: ProgramState
|
|
935
|
+
|
|
936
|
+
|
|
937
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
938
|
+
class StateSaved:
|
|
939
|
+
"""The wire's StateSaved, as its struct in DSPyRb::Wire defines it."""
|
|
940
|
+
|
|
941
|
+
id: int
|
|
942
|
+
kind: Literal["state_saved"] = "state_saved"
|
|
943
|
+
|
|
944
|
+
|
|
945
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
946
|
+
class TeacherSettings:
|
|
947
|
+
"""The wire's TeacherSettings, as its struct in DSPyRb::Wire defines it."""
|
|
948
|
+
|
|
949
|
+
lm: LM | DummyLM | None = None
|
|
950
|
+
|
|
951
|
+
|
|
952
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
953
|
+
class Tool:
|
|
954
|
+
"""The wire's Tool, as its struct in DSPyRb::Wire defines it."""
|
|
955
|
+
|
|
956
|
+
name: str
|
|
957
|
+
desc: str | None = None
|
|
958
|
+
args: list[ToolArg]
|
|
959
|
+
|
|
960
|
+
|
|
961
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
962
|
+
class ToolArg:
|
|
963
|
+
"""The wire's ToolArg, as its struct in DSPyRb::Wire defines it."""
|
|
964
|
+
|
|
965
|
+
name: str
|
|
966
|
+
type: str | None = None
|
|
967
|
+
desc: str | None = None
|
|
968
|
+
required: bool
|
|
969
|
+
default: JsonValue | None = None
|
|
970
|
+
|
|
971
|
+
|
|
972
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
973
|
+
class ToolCall:
|
|
974
|
+
"""The wire's ToolCall, as its struct in DSPyRb::Wire defines it."""
|
|
975
|
+
|
|
976
|
+
id: int
|
|
977
|
+
kind: Literal["tool"] = "tool"
|
|
978
|
+
request: int
|
|
979
|
+
tool: str
|
|
980
|
+
args: Values
|
|
981
|
+
teacher: bool | None = None
|
|
982
|
+
in_force: InForce | None = None
|
|
983
|
+
|
|
984
|
+
|
|
985
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
986
|
+
class ToolDescribed:
|
|
987
|
+
"""The wire's ToolDescribed, as its struct in DSPyRb::Wire defines it."""
|
|
988
|
+
|
|
989
|
+
id: int
|
|
990
|
+
kind: Literal["tool_described"] = "tool_described"
|
|
991
|
+
args: Values
|
|
992
|
+
text: str
|
|
993
|
+
|
|
994
|
+
|
|
995
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
996
|
+
class TraceStep:
|
|
997
|
+
"""The wire's TraceStep, as its struct in DSPyRb::Wire defines it."""
|
|
998
|
+
|
|
999
|
+
predictor: str | None = None
|
|
1000
|
+
inputs: Values
|
|
1001
|
+
outputs: Values
|
|
1002
|
+
|
|
1003
|
+
|
|
1004
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
1005
|
+
class Typed:
|
|
1006
|
+
"""The wire's Typed, as its struct in DSPyRb::Wire defines it."""
|
|
1007
|
+
|
|
1008
|
+
path: list[str | int]
|
|
1009
|
+
type: Literal["Reasoning", "History"]
|
|
1010
|
+
|
|
1011
|
+
|
|
1012
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
1013
|
+
class Unfit:
|
|
1014
|
+
"""The wire's Unfit, as its struct in DSPyRb::Wire defines it."""
|
|
1015
|
+
|
|
1016
|
+
id: int
|
|
1017
|
+
kind: Literal["unfit"] = "unfit"
|
|
1018
|
+
reason: str
|
|
1019
|
+
unrecorded: int = 0
|
|
1020
|
+
running: int = 0
|
|
1021
|
+
|
|
1022
|
+
|
|
1023
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
1024
|
+
class Usage:
|
|
1025
|
+
"""The wire's Usage, as its struct in DSPyRb::Wire defines it."""
|
|
1026
|
+
|
|
1027
|
+
prompt_tokens: int
|
|
1028
|
+
completion_tokens: int
|
|
1029
|
+
cached_tokens: int
|
|
1030
|
+
cache_creation_tokens: int
|
|
1031
|
+
reasoning_tokens: int
|
|
1032
|
+
|
|
1033
|
+
|
|
1034
|
+
@dataclass(frozen=True, kw_only=True, slots=True)
|
|
1035
|
+
class Welcome:
|
|
1036
|
+
"""The wire's Welcome, as its struct in DSPyRb::Wire defines it."""
|
|
1037
|
+
|
|
1038
|
+
id: int
|
|
1039
|
+
kind: Literal["welcome"] = "welcome"
|
|
1040
|
+
protocol: int
|
|
1041
|
+
package: str
|
|
1042
|
+
dspy: str
|
|
1043
|
+
python: str
|
|
1044
|
+
|
|
1045
|
+
|
|
1046
|
+
type FromRuby = (
|
|
1047
|
+
Hello
|
|
1048
|
+
| Describe
|
|
1049
|
+
| DescribeTool
|
|
1050
|
+
| DescribeLM
|
|
1051
|
+
| CallRequest
|
|
1052
|
+
| Evaluate
|
|
1053
|
+
| Measure
|
|
1054
|
+
| Generate
|
|
1055
|
+
| Compile
|
|
1056
|
+
| SaveState
|
|
1057
|
+
| LoadState
|
|
1058
|
+
| Load
|
|
1059
|
+
| Permute
|
|
1060
|
+
| Returned
|
|
1061
|
+
| Raised
|
|
1062
|
+
| Cancel
|
|
1063
|
+
)
|
|
1064
|
+
type FromPython = (
|
|
1065
|
+
Welcome
|
|
1066
|
+
| Described
|
|
1067
|
+
| ToolDescribed
|
|
1068
|
+
| LMDescribed
|
|
1069
|
+
| Completed
|
|
1070
|
+
| Evaluated
|
|
1071
|
+
| Measured
|
|
1072
|
+
| Generated
|
|
1073
|
+
| Compiled
|
|
1074
|
+
| StateSaved
|
|
1075
|
+
| StateLoaded
|
|
1076
|
+
| Loaded
|
|
1077
|
+
| Permuted
|
|
1078
|
+
| Failed
|
|
1079
|
+
| Cancelled
|
|
1080
|
+
| Unfit
|
|
1081
|
+
| Refused
|
|
1082
|
+
| Progress
|
|
1083
|
+
| Alive
|
|
1084
|
+
| ToolCall
|
|
1085
|
+
| MetricCall
|
|
1086
|
+
| ProgramCall
|
|
1087
|
+
| NextCall
|
|
1088
|
+
| GateCall
|
|
1089
|
+
)
|
|
1090
|
+
type Request = (
|
|
1091
|
+
Hello
|
|
1092
|
+
| Describe
|
|
1093
|
+
| DescribeTool
|
|
1094
|
+
| DescribeLM
|
|
1095
|
+
| CallRequest
|
|
1096
|
+
| Evaluate
|
|
1097
|
+
| Measure
|
|
1098
|
+
| Generate
|
|
1099
|
+
| Compile
|
|
1100
|
+
| SaveState
|
|
1101
|
+
| LoadState
|
|
1102
|
+
| Load
|
|
1103
|
+
| Permute
|
|
1104
|
+
)
|
|
1105
|
+
type Reply = (
|
|
1106
|
+
Welcome
|
|
1107
|
+
| Described
|
|
1108
|
+
| ToolDescribed
|
|
1109
|
+
| LMDescribed
|
|
1110
|
+
| Completed
|
|
1111
|
+
| Evaluated
|
|
1112
|
+
| Measured
|
|
1113
|
+
| Generated
|
|
1114
|
+
| Compiled
|
|
1115
|
+
| StateSaved
|
|
1116
|
+
| StateLoaded
|
|
1117
|
+
| Loaded
|
|
1118
|
+
| Permuted
|
|
1119
|
+
| Failed
|
|
1120
|
+
| Cancelled
|
|
1121
|
+
| Unfit
|
|
1122
|
+
| Refused
|
|
1123
|
+
)
|
|
1124
|
+
type Callback = ToolCall | MetricCall | ProgramCall | NextCall | GateCall
|
|
1125
|
+
type Pooled = CallRequest | Evaluate | Measure | Generate | Compile | SaveState | LoadState | Load
|
|
1126
|
+
type Called = CallRequest | Evaluate | Measure | Generate | Compile
|
|
1127
|
+
|
|
1128
|
+
COUNTED: Final = (Completed, Evaluated, Measured, Generated, Compiled, Loaded, Failed, Cancelled, Unfit)
|
|
1129
|
+
CALLED: Final = (CallRequest, Evaluate, Measure, Generate, Compile)
|
|
1130
|
+
|
|
1131
|
+
VIEWS: Final[dict[str, type[DataclassInstance]]] = {
|
|
1132
|
+
"Adapter": Adapter,
|
|
1133
|
+
"Alive": Alive,
|
|
1134
|
+
"BootstrapFewShotCompile": BootstrapFewShotCompile,
|
|
1135
|
+
"BootstrapFewShotOptions": BootstrapFewShotOptions,
|
|
1136
|
+
"BootstrapFewShotWithOptunaCompile": BootstrapFewShotWithOptunaCompile,
|
|
1137
|
+
"BootstrapFewShotWithOptunaOptions": BootstrapFewShotWithOptunaOptions,
|
|
1138
|
+
"BootstrapFewShotWithRandomSearchCompile": BootstrapFewShotWithRandomSearchCompile,
|
|
1139
|
+
"BootstrapFewShotWithRandomSearchOptions": BootstrapFewShotWithRandomSearchOptions,
|
|
1140
|
+
"Call": Call,
|
|
1141
|
+
"CallRequest": CallRequest,
|
|
1142
|
+
"Cancel": Cancel,
|
|
1143
|
+
"Cancelled": Cancelled,
|
|
1144
|
+
"Compile": Compile,
|
|
1145
|
+
"Compiled": Compiled,
|
|
1146
|
+
"Completed": Completed,
|
|
1147
|
+
"DSPyDataset": DSPyDataset,
|
|
1148
|
+
"DataFile": DataFile,
|
|
1149
|
+
"Describe": Describe,
|
|
1150
|
+
"DescribeLM": DescribeLM,
|
|
1151
|
+
"DescribeTool": DescribeTool,
|
|
1152
|
+
"Described": Described,
|
|
1153
|
+
"DummyLM": DummyLM,
|
|
1154
|
+
"Evaluate": Evaluate,
|
|
1155
|
+
"EvaluateOptions": EvaluateOptions,
|
|
1156
|
+
"EvaluateOverrides": EvaluateOverrides,
|
|
1157
|
+
"Evaluated": Evaluated,
|
|
1158
|
+
"Example": Example,
|
|
1159
|
+
"Failed": Failed,
|
|
1160
|
+
"Failure": Failure,
|
|
1161
|
+
"Field": Field,
|
|
1162
|
+
"GEPACompile": GEPACompile,
|
|
1163
|
+
"GEPAOptions": GEPAOptions,
|
|
1164
|
+
"GateCall": GateCall,
|
|
1165
|
+
"Generate": Generate,
|
|
1166
|
+
"Generated": Generated,
|
|
1167
|
+
"Hello": Hello,
|
|
1168
|
+
"HubDataset": HubDataset,
|
|
1169
|
+
"InForce": InForce,
|
|
1170
|
+
"LM": LM,
|
|
1171
|
+
"LMDescribed": LMDescribed,
|
|
1172
|
+
"LabeledFewShotCompile": LabeledFewShotCompile,
|
|
1173
|
+
"LabeledFewShotOptions": LabeledFewShotOptions,
|
|
1174
|
+
"Load": Load,
|
|
1175
|
+
"LoadState": LoadState,
|
|
1176
|
+
"Loaded": Loaded,
|
|
1177
|
+
"MIPROv2Compile": MIPROv2Compile,
|
|
1178
|
+
"MIPROv2Options": MIPROv2Options,
|
|
1179
|
+
"Measure": Measure,
|
|
1180
|
+
"Measured": Measured,
|
|
1181
|
+
"Message": Message,
|
|
1182
|
+
"Metric": Metric,
|
|
1183
|
+
"MetricCall": MetricCall,
|
|
1184
|
+
"NextCall": NextCall,
|
|
1185
|
+
"Parameter": Parameter,
|
|
1186
|
+
"Part": Part,
|
|
1187
|
+
"PendingCall": PendingCall,
|
|
1188
|
+
"Permute": Permute,
|
|
1189
|
+
"Permuted": Permuted,
|
|
1190
|
+
"Predictor": Predictor,
|
|
1191
|
+
"PredictorState": PredictorState,
|
|
1192
|
+
"ProgramCall": ProgramCall,
|
|
1193
|
+
"ProgramState": ProgramState,
|
|
1194
|
+
"Progress": Progress,
|
|
1195
|
+
"Raised": Raised,
|
|
1196
|
+
"Refused": Refused,
|
|
1197
|
+
"Result": Result,
|
|
1198
|
+
"Returned": Returned,
|
|
1199
|
+
"RubyFailure": RubyFailure,
|
|
1200
|
+
"RubyMetric": RubyMetric,
|
|
1201
|
+
"RubyProgram": RubyProgram,
|
|
1202
|
+
"SIMBACompile": SIMBACompile,
|
|
1203
|
+
"SIMBAOptions": SIMBAOptions,
|
|
1204
|
+
"SaveState": SaveState,
|
|
1205
|
+
"Score": Score,
|
|
1206
|
+
"Settings": Settings,
|
|
1207
|
+
"Split": Split,
|
|
1208
|
+
"StateLoaded": StateLoaded,
|
|
1209
|
+
"StateSaved": StateSaved,
|
|
1210
|
+
"TeacherSettings": TeacherSettings,
|
|
1211
|
+
"Tool": Tool,
|
|
1212
|
+
"ToolArg": ToolArg,
|
|
1213
|
+
"ToolCall": ToolCall,
|
|
1214
|
+
"ToolDescribed": ToolDescribed,
|
|
1215
|
+
"TraceStep": TraceStep,
|
|
1216
|
+
"Typed": Typed,
|
|
1217
|
+
"Unfit": Unfit,
|
|
1218
|
+
"Usage": Usage,
|
|
1219
|
+
"Welcome": Welcome,
|
|
1220
|
+
}
|