@@ -157,7 +157,7 @@ def __call__(self, x: str, **kwargs):
157157 include_final_prediction_in_output_stream = False ,
158158 )
159159 # Turn off the cache to ensure the stream is produced.
160- with dspy .context (lm = dspy .LM (lm_for_test , cache = False )):
160+ with dspy .context (lm = dspy .LM (lm_for_test , cache = False , temperature = 0.0 )):
161161 output = program (x = "why did a chicken cross the kitchen?" )
162162 all_chunks = []
163163 async for value in output :
@@ -221,7 +221,7 @@ def __call__(self, x: str, **kwargs):
221221 include_final_prediction_in_output_stream = False ,
222222 )
223223 # Turn off the cache to ensure the stream is produced.
224- with dspy .context (lm = dspy .LM (lm_for_test , cache = False ), adapter = dspy .JSONAdapter ()):
224+ with dspy .context (lm = dspy .LM (lm_for_test , cache = False , temperature = 0.0 ), adapter = dspy .JSONAdapter ()):
225225 output = program (x = "why did a chicken cross the kitchen?" )
226226 all_chunks = []
227227 async for value in output :
@@ -289,7 +289,7 @@ def __call__(self, x: str, **kwargs):
289289 async_streaming = False ,
290290 )
291291 # Turn off the cache to ensure the stream is produced.
292- with dspy .context (lm = dspy .LM (lm_for_test , cache = False )):
292+ with dspy .context (lm = dspy .LM (lm_for_test , cache = False , temperature = 0.0 )):
293293 output = program (x = "why did a chicken cross the kitchen?" )
294294 all_chunks = []
295295 for value in output :
@@ -437,6 +437,7 @@ async def completion_side_effect(*args, **kwargs):
437437 assert all_chunks [22 ].chunk == "."
438438 assert all_chunks [22 ].is_last_chunk is True
439439
440+
440441@pytest .mark .anyio
441442async def test_stream_listener_returns_correct_chunk_json_adapter ():
442443 class MyProgram (dspy .Module ):
0 commit comments