Skip to content

armgit / dspy

Public Imported from GitHub
0

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

Python

use context instead of settings (#7796)

Chen Qian4ddd181682b3
diff --git a/dspy/utils/streaming.py b/dspy/utils/streaming.py
index 6f3e43825..79f42f9ad 100644
--- a/dspy/utils/streaming.py
+++ b/dspy/utils/streaming.py
@@ -266,10 +266,9 @@ def streamify(
status_streaming_callback = StatusStreamingCallback(status_message_provider)
if not any(isinstance(c, StatusStreamingCallback) for c in callbacks):
callbacks.append(status_streaming_callback)
- settings.configure(callbacks=callbacks)
async def generator(args, kwargs, stream: MemoryObjectSendStream):
- with settings.context(send_stream=stream):
+ with settings.context(send_stream=stream, callbacks=callbacks):
prediction = await program(*args, **kwargs)
await stream.send(prediction)