You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This class is used to run DSPy modules in parallel in a thread-safe way. The code is located in dspy/utils/parallelizer.py, a sample usage is like below:
import dspy
dspy.settings.configure(lm=dspy.LM("openai/gpt-4o-mini"))
cot = dspy.ChainOfThought("question->answer")
parallelizer = dspy.Parallel()
results = parallelizer(
[
(cot, {"question": "What is the meaning of life?"}),
(cot, {"question": "why did a chicken cross the kitchen?"}),
(cot, {"question": "what is the capital of France?"}),
]
)
print(results)
We don't have unit test for this class now, and should test the following:
Worker threads don't affect each other, for example, each worker thread can maintain its own trace.
Worker threads are executed in parallel, which means it should be faster than executing in sequential order.
The parallel run doesn't crash until max_errors is hit.
The text was updated successfully, but these errors were encountered:
This class is used to run DSPy modules in parallel in a thread-safe way. The code is located in
dspy/utils/parallelizer.py
, a sample usage is like below:We don't have unit test for this class now, and should test the following:
max_errors
is hit.The text was updated successfully, but these errors were encountered: