Skip to content

Commit e7a8f45

Browse files
committed
fix: streamify should deepcopy settings before appending a callback
1 parent 901ddcf commit e7a8f45

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

dspy/streaming/streamify.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
import contextvars
33
import logging
44
import threading
5+
56
from asyncio import iscoroutinefunction
7+
from copy import deepcopy
68
from queue import Queue
79
from typing import TYPE_CHECKING, Any, AsyncGenerator, Awaitable, Callable, Generator
810

@@ -161,7 +163,7 @@ async def use_streaming():
161163
elif not iscoroutinefunction(program):
162164
program = asyncify(program)
163165

164-
callbacks = settings.callbacks
166+
callbacks = deepcopy(settings.callbacks)
165167
status_streaming_callback = StatusStreamingCallback(status_message_provider)
166168
if not any(isinstance(c, StatusStreamingCallback) for c in callbacks):
167169
callbacks.append(status_streaming_callback)

0 commit comments

Comments
 (0)