Spaces:
Sleeping
Sleeping
ping98k
commited on
Commit
·
62eba67
1
Parent(s):
c595827
Clarify score prompt
Browse files- main.py +1 -1
- tournament_utils.py +9 -2
main.py
CHANGED
|
@@ -62,7 +62,7 @@ def run_tournament(
|
|
| 62 |
if enable_score_filter:
|
| 63 |
def score(player):
|
| 64 |
data = _clean_json(
|
| 65 |
-
prompt_score(instruction, criteria_block(), player)
|
| 66 |
)
|
| 67 |
if "scores" in data and isinstance(data["scores"], list):
|
| 68 |
vals = data["scores"]
|
|
|
|
| 62 |
if enable_score_filter:
|
| 63 |
def score(player):
|
| 64 |
data = _clean_json(
|
| 65 |
+
prompt_score(instruction, criteria_list, criteria_block(), player)
|
| 66 |
)
|
| 67 |
if "scores" in data and isinstance(data["scores"], list):
|
| 68 |
vals = data["scores"]
|
tournament_utils.py
CHANGED
|
@@ -11,12 +11,19 @@ def generate_players(instruction: str, n: int, model: str = "gpt-4o-mini"):
|
|
| 11 |
return [c.message.content.strip() for c in response.choices]
|
| 12 |
|
| 13 |
|
| 14 |
-
def prompt_score(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
"""Return a JSON score string evaluating `player` on the criteria."""
|
|
|
|
| 16 |
prompt = f"""Evaluate the output below on the following criteria:
|
| 17 |
{criteria_block}
|
| 18 |
|
| 19 |
-
Return JSON exactly like: {{"score": [
|
| 20 |
|
| 21 |
Instruction:
|
| 22 |
{instruction}
|
|
|
|
| 11 |
return [c.message.content.strip() for c in response.choices]
|
| 12 |
|
| 13 |
|
| 14 |
+
def prompt_score(
|
| 15 |
+
instruction: str,
|
| 16 |
+
criteria_list: list[str],
|
| 17 |
+
criteria_block: str,
|
| 18 |
+
player: str,
|
| 19 |
+
model: str = "gpt-4o-mini",
|
| 20 |
+
) -> str:
|
| 21 |
"""Return a JSON score string evaluating `player` on the criteria."""
|
| 22 |
+
example_scores = ", ".join(["1-10"] * len(criteria_list)) or "1-10"
|
| 23 |
prompt = f"""Evaluate the output below on the following criteria:
|
| 24 |
{criteria_block}
|
| 25 |
|
| 26 |
+
Return JSON exactly like: {{"score": [{example_scores}]}}.
|
| 27 |
|
| 28 |
Instruction:
|
| 29 |
{instruction}
|