Skip to content

Commit 974e679

Browse files
committed
fix: make google api do n samples
1 parent cb283fd commit 974e679

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

bigcodebench/gen/util/google_request.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,17 @@
55

66

77
def make_request(
8-
client: genai.GenerativeModel, temperature, messages, max_new_tokens=2048
8+
client: genai.GenerativeModel,
9+
messages: List,
10+
temperature: float,
11+
n: int,
12+
max_new_tokens: int = 2048,
913
) -> genai.types.GenerateContentResponse:
1014
messages = [{"role": m["role"], "parts": [m["content"]]} for m in messages]
1115
response = client.generate_content(
1216
messages,
1317
generation_config=genai.types.GenerationConfig(
14-
candidate_count=1,
18+
candidate_count=n,
1519
max_output_tokens=max_new_tokens,
1620
temperature=temperature,
1721
),

bigcodebench/provider/google.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,9 @@ def codegen(
3636
ret = make_auto_request(
3737
self.client,
3838
message,
39-
self.name,
4039
n=num_samples,
41-
max_tokens=self.max_new_tokens,
4240
temperature=self.temperature,
41+
max_new_tokens=self.max_new_tokens,
4342
)
4443
for candidate in ret.candidates:
4544
parts = candidate.content.parts

0 commit comments

Comments
 (0)