Experiment with Multiple Workflows
If you’re building a multi-step workflow or chain (e.g. a RAG system, an Agent, or a chain) and want to experiment with multiple combinations of parameters or your versions at once, Chain Sweeps are your friend.
A Chain Sweep allows you to execute, in bulk, multiple chains or workflows iterating over different versions or parameters of your system.
First, you’ll need to wrap your workflow or chain in a function. This function should take anything you want to experiment with as an argument (e.g. chunk size, embedding model, top_k).
Here we create a function rag_chain_executor
utilizing our workflow logging integration.
Alertnatively we can create the function rag_chain_executor
utilizing a LangChain integration.
Finally, call pq.sweep() with your chain’s wrapper function and a dict containing all the different params you’d like to run your chain over:
See the PromptQuality Python Library Docs for the function docstrings.
Was this page helpful?