Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
2b52ec6
fix(teleprompt): respect MIPROv2.compile seed=0
Zsanz3 Sep 2, 2026
3c8ffe7
Merge branch 'main' into cursor/fix-miprov2-compile-seed-zero-88e7
Zsanz3 Sep 17, 2026
085d64d
Merge branch 'main' into cursor/fix-miprov2-compile-seed-zero-88e7
Zsanz3 Sep 18, 2026
0593ebf
Merge branch 'main' into cursor/fix-miprov2-compile-seed-zero-88e7
Zsanz3 Sep 21, 2026
8b8d07f
Merge branch 'main' into cursor/fix-miprov2-compile-seed-zero-88e7
Zsanz3 Sep 22, 2026
0196eb7
Merge branch 'main' into cursor/fix-miprov2-compile-seed-zero-88e7
Zsanz3 Sep 24, 2026
ddd9d25
Merge branch 'main' into cursor/fix-miprov2-compile-seed-zero-88e7
Zsanz3 Sep 25, 2026
08ace8a
Merge branch 'main' into cursor/fix-miprov2-compile-seed-zero-88e7
Zsanz3 Sep 25, 2026
ce621d3
Merge branch 'main' into cursor/fix-miprov2-compile-seed-zero-88e7
Zsanz3 Sep 25, 2026
275576a
Merge branch 'main' into cursor/fix-miprov2-compile-seed-zero-88e7
Zsanz3 Sep 26, 2026
5c936af
Merge branch 'main' into cursor/fix-miprov2-compile-seed-zero-88e7
Zsanz3 Sep 27, 2026
fc03065
Merge branch 'main' into cursor/fix-miprov2-compile-seed-zero-88e7
Zsanz3 Sep 30, 2026
3f3bcfe
Merge branch 'main' into cursor/fix-miprov2-compile-seed-zero-88e7
Zsanz3 Sep 30, 2026
2cbeda1
Merge branch 'main' into cursor/fix-miprov2-compile-seed-zero-88e7
Zsanz3 Oct 2, 2026
28047f8
Merge branch 'main' into cursor/fix-miprov2-compile-seed-zero-88e7
Zsanz3 Oct 2, 2026
9a7421b
Merge branch 'main' into cursor/fix-miprov2-compile-seed-zero-88e7
Zsanz3 Oct 4, 2026
8d72587
Merge branch 'main' into cursor/fix-miprov2-compile-seed-zero-88e7
Zsanz3 Oct 5, 2026
f9d4229
Merge branch 'main' into cursor/fix-miprov2-compile-seed-zero-88e7
Zsanz3 Oct 7, 2026
6c13fdc
Merge branch 'main' into cursor/fix-miprov2-compile-seed-zero-88e7
Zsanz3 Oct 9, 2026
96750af
Merge branch 'main' into cursor/fix-miprov2-compile-seed-zero-88e7
Zsanz3 Oct 12, 2026
738956e
Merge branch 'main' into cursor/fix-miprov2-compile-seed-zero-88e7
Zsanz3 Oct 12, 2026
055b966
Merge branch 'main' into cursor/fix-miprov2-compile-seed-zero-88e7
Zsanz3 Oct 12, 2026
7d8c57a
Merge branch 'main' into cursor/fix-miprov2-compile-seed-zero-88e7
Zsanz3 Oct 13, 2026
3fde2d8
Merge branch 'main' into cursor/fix-miprov2-compile-seed-zero-88e7
Zsanz3 Oct 13, 2026
0962d4c
Merge branch 'main' into cursor/fix-miprov2-compile-seed-zero-88e7
Zsanz3 Oct 13, 2026
0c75473
Merge branch 'main' into cursor/fix-miprov2-compile-seed-zero-88e7
Zsanz3 Oct 14, 2026
fa825f8
Merge branch 'main' into cursor/fix-miprov2-compile-seed-zero-88e7
Zsanz3 Oct 14, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dspy/teleprompt/mipro_optimizer_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def compile(
)

# Set random seeds
seed = seed or self.seed
seed = seed if seed is not None else self.seed
self._set_random_seeds(seed)


Expand Down
23 changes: 23 additions & 0 deletions tests/teleprompt/test_mipro_optimizer_v2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from unittest.mock import MagicMock, patch

import pytest

from dspy.teleprompt.mipro_optimizer_v2 import MIPROv2


def test_compile_respects_seed_zero():
"""compile(seed=0) must keep seed 0 instead of falling back to the constructor default.

Regression test for https://github.com/stanfordnlp/dspy/issues/10321
"""
lm = MagicMock()
optimizer = MIPROv2(metric=lambda *args, **kwargs: True, auto="light", prompt_model=lm, task_model=lm)

with (
patch.object(optimizer, "_set_random_seeds") as mock_set_seeds,
patch.object(optimizer, "_set_and_validate_datasets", side_effect=RuntimeError("stop after seed")),
):
with pytest.raises(RuntimeError, match="stop after seed"):
optimizer.compile(MagicMock(), trainset=[], seed=0)

mock_set_seeds.assert_called_once_with(0)