Skip to content

armgit / dspy

Public Imported from GitHub
0

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

Python

Use importorskip for PIL in ReAct test (#8870)

TomuHiratab71a1182e993
diff --git a/pyproject.toml b/pyproject.toml
index 3928635dc..78005f0a2 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -40,6 +40,7 @@ dependencies = [
"cachetools>=5.5.0",
"cloudpickle>=3.0.0",
"rich>=13.7.1",
+ "pillow>=10.1.0",
"numpy>=1.26.0",
"xxhash>=3.5.0",
"gepa[dspy]==0.0.17",
diff --git a/tests/predict/test_react.py b/tests/predict/test_react.py
index 55ff59607..6c12859c0 100644
--- a/tests/predict/test_react.py
+++ b/tests/predict/test_react.py
@@ -2,14 +2,17 @@ import re
import litellm
import pytest
-from PIL import Image
from pydantic import BaseModel
import dspy
from dspy.utils.dummies import DummyLM
def test_tool_observation_preserves_custom_type():
+ pytest.importorskip("PIL.Image")
+ from PIL import Image
+
captured_calls = []
class SpyChatAdapter(dspy.ChatAdapter):
diff --git a/uv.lock b/uv.lock
index 2e1bff8ff..0e9afdf5c 100644
--- a/uv.lock
+++ b/uv.lock
@@ -683,6 +683,7 @@ dependencies = [
{ name = "openai" },
{ name = "optuna" },
{ name = "orjson" },
+ { name = "pillow" },
{ name = "pydantic" },
{ name = "regex" },
{ name = "requests" },