Skip to content

Commit bd0d3bb

Browse files
committed
done
1 parent f966713 commit bd0d3bb

File tree

8 files changed

+13
-15
lines changed

8 files changed

+13
-15
lines changed

dspy/adapters/types/audio.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def __repr__(self) -> str:
114114
def encode_audio(audio: Union[str, bytes, dict, "Audio", Any], sampling_rate: int = 16000, format: str = "wav") -> dict:
115115
"""
116116
Encode audio to a dict with 'data' and 'audio_format'.
117-
117+
118118
Accepts: local file path, URL, data URI, dict, Audio instance, numpy array, or bytes (with known format).
119119
"""
120120
if isinstance(audio, dict) and "data" in audio and "audio_format" in audio:

dspy/evaluate/evaluate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,9 @@ def __call__(
126126
127127
Returns:
128128
The evaluation results are returned as a dspy.EvaluationResult object containing the following attributes:
129-
129+
130130
- score: A float percentage score (e.g., 67.30) representing overall performance
131-
131+
132132
- results: a list of (example, prediction, score) tuples for each example in devset
133133
"""
134134
metric = metric if metric is not None else self.metric

dspy/primitives/base_module.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,10 @@ def save(self, path, save_program=False, modules_to_serialize=None):
169169
- `save_program=True`: Save the whole module to a directory via cloudpickle, which contains both the state and
170170
architecture of the model.
171171
172-
If `save_program=True` and `modules_to_serialize` are provided, it will register those modules for serialization
173-
with cloudpickle's `register_pickle_by_value`. This causes cloudpickle to serialize the module by value rather
174-
than by reference, ensuring the module is fully preserved along with the saved program. This is useful
175-
when you have custom modules that need to be serialized alongside your program. If None, then no modules
172+
If `save_program=True` and `modules_to_serialize` are provided, it will register those modules for serialization
173+
with cloudpickle's `register_pickle_by_value`. This causes cloudpickle to serialize the module by value rather
174+
than by reference, ensuring the module is fully preserved along with the saved program. This is useful
175+
when you have custom modules that need to be serialized alongside your program. If None, then no modules
176176
will be registered for serialization.
177177
178178
We also save the dependency versions, so that the loaded model can check if there is a version mismatch on

dspy/utils/langchain_tool.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
def convert_langchain_tool(tool: "BaseTool") -> Tool:
1111
"""Build a DSPy tool from a LangChain tool.
12-
12+
1313
This function converts a LangChain tool (either created with @tool decorator
1414
or by subclassing BaseTool) into a DSPy Tool.
1515

tests/primitives/test_base_module.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,8 +306,8 @@ def __call__(self, question: str) -> str:
306306
assert results[0].get_lm_usage() is not None
307307
assert results[1].get_lm_usage() is not None
308308

309-
assert results[0].get_lm_usage().keys() == set(["openai/gpt-4o-mini"])
310-
assert results[1].get_lm_usage().keys() == set(["openai/gpt-3.5-turbo"])
309+
assert results[0].get_lm_usage().keys() == {"openai/gpt-4o-mini"}
310+
assert results[1].get_lm_usage().keys() == {"openai/gpt-3.5-turbo"}
311311

312312

313313
@pytest.mark.asyncio

tests/signatures/test_custom_types.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ class Container:
2929
class NestedType(pydantic.BaseModel):
3030
value: str
3131

32-
NestedType = Container.NestedType
3332
alias_sig = Signature("input: str -> output: NestedType")
3433
assert alias_sig.output_fields["output"].annotation == Container.NestedType
3534

tests/streaming/test_streaming.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ async def gpt_4o_mini_stream_2():
388388
async def completion_side_effect(*args, **kwargs):
389389
return stream_generators.pop(0)() # return new async generator instance
390390

391-
with mock.patch("litellm.acompletion", side_effect=completion_side_effect) as mock_completion:
391+
with mock.patch("litellm.acompletion", side_effect=completion_side_effect):
392392
program = dspy.streamify(
393393
MyProgram(),
394394
stream_listeners=[
@@ -484,7 +484,7 @@ async def gpt_4o_mini_stream_2(*args, **kwargs):
484484

485485
with mock.patch(
486486
"litellm.acompletion", new_callable=AsyncMock, side_effect=[gpt_4o_mini_stream_1(), gpt_4o_mini_stream_2()]
487-
) as mock_completion:
487+
):
488488
program = dspy.streamify(
489489
MyProgram(),
490490
stream_listeners=[

tests/teleprompt/test_bootstrap_finetune.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def test_bootstrap_finetune_initialization():
2121
# Initialize BootstrapFinetune with a dummy metric and minimal setup
2222
bootstrap = BootstrapFinetune(metric=simple_metric)
2323
assert bootstrap.metric == simple_metric, "Metric not correctly initialized"
24-
assert bootstrap.multitask == True, "Multitask should default to True"
24+
assert bootstrap.multitask, "Multitask should default to True"
2525

2626

2727
class SimpleModule(dspy.Module):
@@ -44,7 +44,6 @@ def test_compile_with_predict_instances_no_explicit_lm():
4444
teacher = SimpleModule("input -> output")
4545

4646
lm = DummyLM(["Initial thoughts", "Finish[blue]"])
47-
original_lm = dspy.settings.lm
4847
dspy.settings.configure(lm=lm)
4948

5049
# Verify that the predictor doesn't have an explicit LM

0 commit comments

Comments
 (0)