DSPy: The framework for programming—not prompting—language models
Python
fix(dsp): indicate other completions only if choices is list, not string
sysid5d3d7b304f0a
diff --git a/dsp/modules/lm.py b/dsp/modules/lm.pyindex cfe8b88d0..025acfca2 100644--- a/dsp/modules/lm.py+++ b/dsp/modules/lm.py@@ -76,8 +76,8 @@ class LM(ABC):text = choiceselif provider == "openai" or provider == "ollama":text = ' ' + self._get_choice_text(choices[0]).strip()- elif provider == "clarifai" or provider == "claude" :- text=choices+ elif provider == "clarifai" or provider == "claude":+ text = choiceselif provider == "groq":text = ' ' + choiceselif provider == "google":@@ -88,7 +88,7 @@ class LM(ABC):text = choices[0]["text"]printing_value += self.print_green(text, end="")- if len(choices) > 1:+ if len(choices) > 1 and isinstance(choices, list):printing_value += self.print_red(f" \t (and {len(choices)-1} other completions)", end="")printing_value += "\n\n\n"