Skip to content

Add gpt4o and gpt-4o-mini support #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions common/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ This postamble can be modified by setting the `prompt_postamble` variable in `sh
**Supporting additional models**

We natively provide support for the following models:
- GPT-4o-mini (`gpt-4o-mini`)
- GPT-4o (`gpt-4o-2024-05-13`)
- GPT-4-Turbo (`gpt-4-0125-preview`)
- GPT-4 (`gpt-4-0613`)
- GPT-4-32K (`gpt-4-32k-0613`)
Expand Down
5 changes: 4 additions & 1 deletion common/modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ class Usage(pg.Object):
class LMSamplingResult(lf.LMSamplingResult):
"""LMSamplingResult with usage information."""

usage: Usage | None = None
usage: Annotated[
lf.LMSamplingUsage,
'Usage information. Currently only OpenAI models are supported.',
] = lf.UsageNotAvailable()


@lf.use_init_args(['model'])
Expand Down
4 changes: 4 additions & 0 deletions common/shared_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
serper_api_key = ''
random_seed = 1
model_options = {
'gpt_4o_mini': 'OPENAI:gpt-4o-mini',
'gpt_4o': 'OPENAI:gpt-4o-2024-05-13',
'gpt_4_turbo': 'OPENAI:gpt-4-0125-preview',
'gpt_4': 'OPENAI:gpt-4-0613',
'gpt_4_32k': 'OPENAI:gpt-4-32k-0613',
Expand All @@ -52,6 +54,8 @@
'claude_instant': 'ANTHROPIC:claude-instant-1.2',
}
model_string = {
'gpt_4o_mini': 'gpt4omini',
'gpt_4o': 'gpt4o',
'gpt_4_turbo': 'gpt4turbo',
'gpt_4': 'gpt4',
'gpt_4_32k': 'gpt432k',
Expand Down
2 changes: 2 additions & 0 deletions data_creation/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
# generator_model: str = the model for generating data.
# generation_temp: float = temperature to use when generating responses.
# Currently supported models (copy-paste into `generator_model` field): [
# 'gpt_4o_mini',
# 'gpt_4o',
# 'gpt_4_turbo',
# 'gpt_4',
# 'gpt_4_32k',
Expand Down
2 changes: 2 additions & 0 deletions data_creation/config_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
# pylint: enable=g-bad-import-order

_ACCEPTED_MODELS = (
'gpt_4o_mini',
'gpt_4o',
'gpt_4_turbo',
'gpt_4',
'gpt_4_32k',
Expand Down
2 changes: 1 addition & 1 deletion eval/safe/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
# 'claude_instant',
# ]
################################################################################
model_short = 'gpt_35_turbo'
model_short = 'gpt_4o_mini'
model_temp = 0.1
max_tokens = 512

Expand Down
2 changes: 2 additions & 0 deletions eval/safe/config_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
# pylint: enable=g-bad-import-order

_SUPPORTED_MODELS = (
'gpt_4o_mini'
'gpt_4o'
'gpt_4_turbo',
'gpt_4',
'gpt_4_32k',
Expand Down
4 changes: 3 additions & 1 deletion main/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@ This can be done by adding your Anthropic API key into the `common/shared_config

**Changing the language model**

The default configuration is set to use `GPT-3.5-Turbo` to respond to prompts.
The default configuration is set to use `GPT-4o-mini` to respond to prompts.
To use any other model, simply copy-paste the desired model into the `responder_model_short` variable in `config.py`.
If a model that you would like to test on is not listed in the currently-supported models, see the README in the `common/` folder for information on how to add support for additional models.
Currently-supported models:
- `gpt_4o_mini`: links to `gpt-4o-mini-2024-07-18`.
- `gpt_4o`: links to `gpt-4o-2024-05-13`.
- `gpt_4_turbo`: links to `gpt-4-0125-preview`.
- `gpt_4`: links to `gpt-4-0613`.
- `gpt_4_32k`: links to `gpt-4-32k-0613`.
Expand Down
4 changes: 3 additions & 1 deletion main/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
# MODEL SETTINGS
# responder_model_short: str = model for getting structures.
# Currently supported models (copy-paste into fields): [
# 'gpt_4o_mini',
# 'gpt_4o',
# 'gpt_4_turbo',
# 'gpt_4',
# 'gpt_4_32k',
Expand All @@ -53,7 +55,7 @@
# 'claude_instant',
# ]
################################################################################
responder_model_short = 'gpt_35_turbo'
responder_model_short = 'gpt_4o_mini'

################################################################################
# DEBUG SETTINGS
Expand Down
2 changes: 2 additions & 0 deletions main/config_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
'none',
)
ACCEPTED_MODELS = (
'gpt_4o_mini',
'gpt_4o',
'gpt_4_turbo',
'gpt_4',
'gpt_4_32k',
Expand Down
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ absl-py==2.1.0
aiohttp==3.9.3
aiosignal==1.3.1
annotated-types==0.6.0
anthropic==0.16.0
anthropic==0.33.0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has this been verified (and same below)?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you asking for a clean environment installation with all dependencies or a re-run with Claude models?

anyio==4.2.0
async-timeout==4.0.3
attrs==23.2.0
Expand Down Expand Up @@ -41,7 +41,7 @@ Jinja2==3.1.3
joblib==1.3.2
kiwisolver==1.4.5
langcodes==3.3.0
langfun==0.0.2.dev20240202
langfun==0.1.1.dev20240810
MarkupSafe==2.1.5
matplotlib==3.8.2
mpmath==1.3.0
Expand Down Expand Up @@ -73,7 +73,7 @@ pyasn1==0.5.1
pyasn1-modules==0.3.0
pydantic==2.6.0
pydantic_core==2.16.1
pyglove==0.4.5.dev20240202
pyglove==0.4.5.dev20240810
pyparsing==3.1.1
python-dateutil==2.8.2
pytz==2024.1
Expand Down