Add GPT4.1, o4-mini and o3 (#6314)

This commit is contained in:
Eric Zhu 2025-04-16 18:10:14 -07:00 committed by GitHub
parent 27b834f296
commit 629fb86e96
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 52 additions and 0 deletions

View File

@ -18,10 +18,12 @@ class ModelFamily:
This namespace class holds constants for the model families that AutoGen understands. Other families definitely exist and can be represented by a string, however, AutoGen will treat them as unknown."""
GPT_41 = "gpt-41"
GPT_45 = "gpt-45"
GPT_4O = "gpt-4o"
O1 = "o1"
O3 = "o3"
O4 = "o4"
GPT_4 = "gpt-4"
GPT_35 = "gpt-35"
R1 = "r1"
@ -38,10 +40,12 @@ class ModelFamily:
UNKNOWN = "unknown"
ANY: TypeAlias = Literal[
"gpt-41",
"gpt-45",
"gpt-4o",
"o1",
"o3",
"o4",
"gpt-4",
"gpt-35",
"r1",
@ -84,9 +88,12 @@ class ModelFamily:
@staticmethod
def is_openai(family: str) -> bool:
return family in (
ModelFamily.GPT_45,
ModelFamily.GPT_41,
ModelFamily.GPT_4O,
ModelFamily.O1,
ModelFamily.O3,
ModelFamily.O4,
ModelFamily.GPT_4,
ModelFamily.GPT_35,
)

View File

@ -11,10 +11,15 @@ trace_logger = logging.getLogger(TRACE_LOGGER_NAME)
# This is a moving target, so correctness is checked by the model value returned by openai against expected values at runtime``
_MODEL_POINTERS = {
# OpenAI models
"o4-mini": "o4-mini-2025-04-16",
"o3": "o3-2025-04-16",
"o3-mini": "o3-mini-2025-01-31",
"o1": "o1-2024-12-17",
"o1-preview": "o1-preview-2024-09-12",
"o1-mini": "o1-mini-2024-09-12",
"gpt-4.1": "gpt-4.1-2025-04-14",
"gpt-4.1-mini": "gpt-4.1-mini-2025-04-14",
"gpt-4.1-nano": "gpt-4.1-nano-2025-04-14",
"gpt-4.5-preview": "gpt-4.5-preview-2025-02-27",
"gpt-4o": "gpt-4o-2024-08-06",
"gpt-4o-mini": "gpt-4o-mini-2024-07-18",
@ -34,6 +39,20 @@ _MODEL_POINTERS = {
}
_MODEL_INFO: Dict[str, ModelInfo] = {
"o4-mini-2025-04-16": {
"vision": True,
"function_calling": True,
"json_output": True,
"family": ModelFamily.O4,
"structured_output": True,
},
"o3-2025-04-16": {
"vision": True,
"function_calling": True,
"json_output": True,
"family": ModelFamily.O3,
"structured_output": True,
},
"o3-mini-2025-01-31": {
"vision": False,
"function_calling": True,
@ -62,6 +81,27 @@ _MODEL_INFO: Dict[str, ModelInfo] = {
"family": ModelFamily.O1,
"structured_output": False,
},
"gpt-4.1-2025-04-14": {
"vision": True,
"function_calling": True,
"json_output": True,
"family": ModelFamily.GPT_41,
"structured_output": True,
},
"gpt-4.1-mini-2025-04-14": {
"vision": True,
"function_calling": True,
"json_output": True,
"family": ModelFamily.GPT_41,
"structured_output": True,
},
"gpt-4.1-nano-2025-04-14": {
"vision": True,
"function_calling": True,
"json_output": True,
"family": ModelFamily.GPT_41,
"structured_output": True,
},
"gpt-4.5-preview-2025-02-27": {
"vision": True,
"function_calling": True,
@ -261,10 +301,15 @@ _MODEL_INFO: Dict[str, ModelInfo] = {
}
_MODEL_TOKEN_LIMITS: Dict[str, int] = {
"o4-mini-2025-04-16": 200000,
"o3-2025-04-16": 200000,
"o3-mini-2025-01-31": 200000,
"o1-2024-12-17": 200000,
"o1-preview-2024-09-12": 128000,
"o1-mini-2024-09-12": 128000,
"gpt-4.1-2025-04-14": 1047576,
"gpt-4.1-mini-2025-04-14": 1047576,
"gpt-4.1-nano-2025-04-14": 1047576,
"gpt-4.5-preview-2025-02-27": 128000,
"gpt-4o-2024-11-20": 128000,
"gpt-4o-2024-08-06": 128000,