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,86 @@
|
|
|
1
|
+
# ruby-on-dspy's Python side. Never built or installed as a package (`package = false`): `ruby-on-dspy setup`
|
|
2
|
+
# installs only the locked dependencies and names this folder in the environment's dspy_rb.pth, so a read-only gem
|
|
3
|
+
# folder works.
|
|
4
|
+
[project]
|
|
5
|
+
name = "dspy-rb"
|
|
6
|
+
# A placeholder uv requires. The version is DSPyRb::VERSION; a dynamic one would make uv build metadata.
|
|
7
|
+
version = "0"
|
|
8
|
+
requires-python = "==3.12.*"
|
|
9
|
+
# The exact versions whose source the code cites; the lock pins everything else.
|
|
10
|
+
dependencies = [
|
|
11
|
+
"dspy[litellm]==3.5.0",
|
|
12
|
+
"gepa==0.1.4",
|
|
13
|
+
"litellm==1.111.0",
|
|
14
|
+
"optuna==4.9.0",
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
[dependency-groups]
|
|
18
|
+
# DSPy's dataset loaders' Hugging Face datasets, and MATH's metric's math_equivalence, on no index, so from git at a
|
|
19
|
+
# pinned commit. `ruby-on-dspy setup --with data` alone installs them.
|
|
20
|
+
data = [
|
|
21
|
+
"datasets==5.2.0",
|
|
22
|
+
"math-equivalence @ git+https://github.com/hendrycks/math@985bdc1696e88e8643f081a0ff4719da39f2ae2a",
|
|
23
|
+
]
|
|
24
|
+
dev = [
|
|
25
|
+
"mypy==2.4.1",
|
|
26
|
+
"pyright==1.1.414",
|
|
27
|
+
"pytest==9.2.0",
|
|
28
|
+
"ruff==0.14.6",
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
[tool.uv]
|
|
32
|
+
package = false
|
|
33
|
+
# The checks' own environment holds every group; setup installs none but the one it is asked for.
|
|
34
|
+
default-groups = ["dev", "data"]
|
|
35
|
+
|
|
36
|
+
[tool.pytest.ini_options]
|
|
37
|
+
testpaths = ["tests"]
|
|
38
|
+
addopts = "-p no:cacheprovider"
|
|
39
|
+
|
|
40
|
+
[tool.ruff]
|
|
41
|
+
line-length = 120
|
|
42
|
+
target-version = "py312"
|
|
43
|
+
|
|
44
|
+
[tool.ruff.lint]
|
|
45
|
+
select = ["ALL"]
|
|
46
|
+
ignore = [
|
|
47
|
+
# ruff cannot enforce both halves of these pairs: D211 and D212 are the halves kept.
|
|
48
|
+
"D203",
|
|
49
|
+
"D213",
|
|
50
|
+
# Checked in a step of its own before formatting (`rake python`), since ruff format warns while it is selected.
|
|
51
|
+
# Its trailing comma is what keeps the formatter at one item a line.
|
|
52
|
+
"COM812",
|
|
53
|
+
]
|
|
54
|
+
|
|
55
|
+
[tool.ruff.lint.per-file-ignores]
|
|
56
|
+
# A stub keeps the library's own names and types: its parameter names, builtins included, so keyword calls match
|
|
57
|
+
# it; its function and class names, such as InputField and tqdm; and the Any DSPy itself returns from a field or an
|
|
58
|
+
# attribute.
|
|
59
|
+
"typings/**/*.pyi" = ["A002", "ANN401", "N801", "N802"]
|
|
60
|
+
# The tests and their helpers, but not the stand-in provider or the references: pytest's assert is how a test checks
|
|
61
|
+
# (S101), and the tests start their own Python children, with arguments they write themselves (S603). A test is named
|
|
62
|
+
# by its name, so the tests alone need no docstrings (D1).
|
|
63
|
+
"tests/{__init__,conftest,test_*}.py" = ["D1", "S101", "S603"]
|
|
64
|
+
"tests/{dspy_rb,conformance,gem}/**" = ["D1", "S101", "S603"]
|
|
65
|
+
"tests/support/{__init__,asking,bounds,engine,peer,programs}.py" = ["S101", "S603"]
|
|
66
|
+
|
|
67
|
+
[tool.mypy]
|
|
68
|
+
strict = true
|
|
69
|
+
python_version = "3.12"
|
|
70
|
+
files = [
|
|
71
|
+
"dspy_rb",
|
|
72
|
+
"tests",
|
|
73
|
+
]
|
|
74
|
+
# DSPy and tqdm ship no types, nor does one LiteLLM module this reads; typings/ declares that surface for mypy and
|
|
75
|
+
# pyright.
|
|
76
|
+
mypy_path = "typings"
|
|
77
|
+
|
|
78
|
+
[tool.pyright]
|
|
79
|
+
include = [
|
|
80
|
+
"dspy_rb",
|
|
81
|
+
"tests",
|
|
82
|
+
]
|
|
83
|
+
pythonVersion = "3.12"
|
|
84
|
+
typeCheckingMode = "strict"
|
|
85
|
+
venvPath = "."
|
|
86
|
+
venv = ".venv"
|