Skip to content

Commit

Permalink
Move DEFAULT_BATCH_SIZE to utils (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
gordonhart committed Sep 5, 2024
1 parent 496620e commit 12fd242
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 12 deletions.
3 changes: 1 addition & 2 deletions autoarena/judge/anthropic.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from autoarena.api import api
from autoarena.api.api import JudgeType
from autoarena.judge.base import AutomatedJudge
from autoarena.judge.utils import get_user_prompt, rate_limit
from tests.unit.judge.test_utils import DEFAULT_BATCH_SIZE
from autoarena.judge.utils import get_user_prompt, rate_limit, DEFAULT_BATCH_SIZE


class AnthropicJudge(AutomatedJudge):
Expand Down
3 changes: 1 addition & 2 deletions autoarena/judge/cohere.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from autoarena.api import api
from autoarena.api.api import JudgeType
from autoarena.judge.base import AutomatedJudge
from autoarena.judge.utils import get_user_prompt, rate_limit
from tests.unit.judge.test_utils import DEFAULT_BATCH_SIZE
from autoarena.judge.utils import get_user_prompt, rate_limit, DEFAULT_BATCH_SIZE


class CohereJudge(AutomatedJudge):
Expand Down
2 changes: 1 addition & 1 deletion autoarena/judge/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from autoarena.api import api
from autoarena.judge.base import Judge
from tests.unit.judge.test_utils import DEFAULT_BATCH_SIZE
from autoarena.judge.utils import DEFAULT_BATCH_SIZE


# TODO: this interface is a little gnarly as callers need to deal with responses coming back in any order
Expand Down
3 changes: 1 addition & 2 deletions autoarena/judge/gemini.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from autoarena.api import api
from autoarena.api.api import JudgeType
from autoarena.judge.base import AutomatedJudge
from autoarena.judge.utils import get_user_prompt, JOINED_PROMPT_TEMPLATE, rate_limit
from tests.unit.judge.test_utils import DEFAULT_BATCH_SIZE
from autoarena.judge.utils import get_user_prompt, JOINED_PROMPT_TEMPLATE, rate_limit, DEFAULT_BATCH_SIZE


class GeminiJudge(AutomatedJudge):
Expand Down
3 changes: 1 addition & 2 deletions autoarena/judge/openai.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from autoarena.api import api
from autoarena.api.api import JudgeType
from autoarena.judge.base import AutomatedJudge
from autoarena.judge.utils import get_user_prompt, rate_limit
from tests.unit.judge.test_utils import DEFAULT_BATCH_SIZE
from autoarena.judge.utils import get_user_prompt, rate_limit, DEFAULT_BATCH_SIZE


class OpenAIJudge(AutomatedJudge):
Expand Down
3 changes: 3 additions & 0 deletions autoarena/judge/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@

ACCEPTABLE_RESPONSES = {"A", "B", "-"}

# this is more or less a constant as it is baked into the @rate_limit decorators applied to proprietary judges
DEFAULT_BATCH_SIZE = 8


def get_user_prompt(h2h: api.HeadToHead) -> str:
return USER_PROMPT_TEMPLATE.format(prompt=h2h.prompt, response_a=h2h.response_a, response_b=h2h.response_b)
Expand Down
3 changes: 0 additions & 3 deletions tests/unit/judge/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
from autoarena.judge.base import Judge
from autoarena.judge.utils import CleaningJudge, RetryingJudge, FixingJudge, ABShufflingJudge, rate_limit

# this is more or less a constant as it is baked into the @rate_limit decorators applied to proprietary judges
DEFAULT_BATCH_SIZE = 8


class DummyJudge(Judge):
def __init__(self, winners: list[str]):
Expand Down

0 comments on commit 12fd242

Please sign in to comment.