Skip to content

armgit / dspy

Public Imported from GitHub
0

DSPy: The framework for programming—not prompting—language models

Python

Fix `Predict` parsing

Connor Shortena22d90d6a07d
diff --git a/dsp/modules/cohere.py b/dsp/modules/cohere.py
index b3a1369f9..caff6bb43 100644
--- a/dsp/modules/cohere.py
+++ b/dsp/modules/cohere.py
@@ -109,4 +109,4 @@ class Cohere(LM):
**kwargs,
):
response = self.request(prompt, **kwargs)
- return response.text
+ return [response.text]
diff --git a/dsp/modules/lm.py b/dsp/modules/lm.py
index 41c90e03c..796d8b11b 100644
--- a/dsp/modules/lm.py
+++ b/dsp/modules/lm.py
@@ -52,7 +52,7 @@ class LM(ABC):
blocks = [{"text": block.text} for block in x["response"].content if block.type == "text"]
printed.append((prompt, blocks))
elif provider == "cohere":
- printed.append((prompt, x["response"]))
+ printed.append((prompt, x["response"].text))
elif provider == "mistral":
printed.append((prompt, x['response'].choices))
else: