Skip to content

Commit

Permalink
fix(dspy): lint and run
Browse files Browse the repository at this point in the history
  • Loading branch information
Anindyadeep committed May 16, 2024
1 parent 0df0730 commit 852e3bf
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions dsp/modules/lm.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ def inspect_history(self, n: int = 1, skip: int = 0):
):
printed.append((prompt, x["response"]))
elif provider == "anthropic":
blocks = [{"text": block.text} for block in x["response"].content if block.type == "text"]
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"].text))
Expand Down Expand Up @@ -97,16 +101,16 @@ def inspect_history(self, n: int = 1, skip: int = 0):
text = choices[0].message.content
elif provider == "cloudflare":
text = choices[0]
elif provider == "ibm":
text = choices
elif provider == "premai":
elif provider == "ibm" or provider == "premai":
text = choices
else:
text = choices[0]["text"]
printing_value += self.print_green(text, end="")

if len(choices) > 1 and isinstance(choices, list):
printing_value += self.print_red(f" \t (and {len(choices)-1} other completions)", end="")
printing_value += self.print_red(
f" \t (and {len(choices)-1} other completions)", end="",
)

printing_value += "\n\n\n"

Expand Down

0 comments on commit 852e3bf

Please sign in to comment.