dspy icon indicating copy to clipboard operation
dspy copied to clipboard

`MultiChainComparison` only keeps the first sentence of the rationale. My `rationale` is multiline

Open saum7800 opened this issue 6 months ago • 0 comments

Hi, I was using the MultiChainComparison module and noticed by entire rationale was not being added in the prompts. Digging in the module, I saw that:

for c in completions:
            rationale = c.rationale.strip().split("\n")[0].strip()
            answer = c[self.last_key].strip().split("\n")[0].strip()
            attempts.append(
                f"«I'm trying to {rationale} I'm not sure but my prediction is {answer}»",
            )

This assumption that rationale and answer can be at max one line seems inaccurate, and at the very least is not intuitive behavior. Wonder if there is a reason it needs to be this way? If not, I can put a quick PR which maintains the more intuitive behavior. Thanks!

saum7800 avatar Jul 29 '24 22:07 saum7800