Skip to content

armgit / dspy

Public Imported from GitHub
0

DSPy: The framework for programming—not prompting—language models

Python

Fix last unit test

Lukas Kreusselcec972edf46b
diff --git a/tests/functional/test_signature_opt_typed.py b/tests/functional/test_signature_opt_typed.py
index 42d7450fd..59a610e6b 100644
--- a/tests/functional/test_signature_opt_typed.py
+++ b/tests/functional/test_signature_opt_typed.py
@@ -10,7 +10,8 @@ from dspy.utils import DummyLM
from dspy.evaluate import Evaluate
from dspy.evaluate.metrics import answer_exact_match
from dspy.functional import TypedPredictor
-
+import json
+from pydantic_core import to_jsonable_python
hotpotqa = [
ex.with_inputs("question")
@@ -163,18 +164,13 @@ def test_opt_composed():
info2 = make_info(ExpectedSignature2)
- T = TypeVar("T")
-
- class OutputWrapper(pydantic.BaseModel, Generic[T]):
- value: list[T]
-
qa_model = DummyLM([])
prompt_model = DummyLM(
[
"some thoughts",
- OutputWrapper[type(info1)](value=[info1]).model_dump_json(),
+ json.dumps([to_jsonable_python(info1)]),
"some thoughts",
- OutputWrapper[type(info2)](value=[info2]).model_dump_json(),
+ json.dumps([to_jsonable_python(info2)]),
]
)
dspy.settings.configure(lm=qa_model)