Skip to content

Commit ac3192f

Browse files
committed
refactor(gemini): set empty response when no candidates
1 parent 77c1782 commit ac3192f

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

repoqa/provider/google.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,8 @@ def generate_reply(
3131
system_msg=system_msg,
3232
)
3333

34-
assert (
35-
len(replies.candidates) == n
36-
), f"# replies = {len(replies.candidates)} != {n = }"
34+
if len(replies.candidates) != n:
35+
print(f"[WARNING] # replies = {len(replies.candidates)} != {n = }")
3736

3837
ret_texts = []
3938
for candidate in replies.candidates:
@@ -45,4 +44,4 @@ def generate_reply(
4544
ret_texts.append("")
4645
print(f"{candidate.safety_ratings = }")
4746

48-
return ret_texts
47+
return ret_texts + [""] * (n - len(ret_texts))

0 commit comments

Comments
 (0)